From 796ed8853600f3852cebad505b1a2e84d1150e58 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 14:15:56 +0800 Subject: [PATCH 01/41] core-sdk-go add proto pkg --- core-sdk/bank/bank.go | 3 +- core-sdk/client.go | 3 +- core-sdk/client/account.go | 6 +- core-sdk/client/base_client.go | 14 +- core-sdk/client/keys.go | 4 +- core-sdk/client/rpc_client.go | 4 +- core-sdk/client/store.go | 1 - core-sdk/client/tx.go | 8 +- core-sdk/common/bech32/bech32.go | 1 - core-sdk/common/commom.go | 1 - core-sdk/common/common_test.go | 3 +- .../common/crypto/keys/ed25519/ed25519.go | 6 +- core-sdk/common/crypto/keys/sm2/gm_sm2.go | 3 +- core-sdk/go.mod | 1 + core-sdk/integration_test/bank_test.go | 8 +- core-sdk/integration_test/integration_test.go | 18 +- core-sdk/proto/cosmos/auth/v1beta1/auth.proto | 49 + .../proto/cosmos/auth/v1beta1/query.proto | 47 + core-sdk/proto/cosmos/bank/v1beta1/bank.proto | 85 + .../proto/cosmos/bank/v1beta1/query.proto | 111 + core-sdk/proto/cosmos/bank/v1beta1/tx.proto | 27 + .../proto/cosmos/base/abci/v1beta1/abci.proto | 137 + .../proto/cosmos/base/kv/v1beta1/kv.proto | 17 + .../base/query/v1beta1/pagination.proto | 50 + core-sdk/proto/cosmos/base/v1beta1/coin.proto | 40 + .../proto/cosmos/crypto/ed25519/keys.proto | 22 + .../proto/cosmos/crypto/multisig/keys.proto | 18 + .../crypto/multisig/v1beta1/multisig.proto | 25 + .../proto/cosmos/crypto/secp256k1/keys.proto | 22 + .../cosmos/tx/signing/v1beta1/signing.proto | 79 + core-sdk/proto/cosmos/tx/v1beta1/tx.proto | 182 + .../github.com/confio/ics23/go/proofs.pb.go | 4590 +++++++++++++++++ .../gogo/protobuf/gogoproto/gogo.pb.go | 888 ++++ .../regen-network/cosmos-proto/cosmos.pb.go | 77 + .../third_party/proto/confio/proofs.proto | 234 + .../proto/cosmos_proto/cosmos.proto | 16 + .../third_party/proto/gogoproto/gogo.proto | 145 + .../proto/google/api/annotations.proto | 31 + .../third_party/proto/google/api/http.proto | 318 ++ .../proto/google/api/httpbody.proto | 78 + .../proto/google/protobuf/any.proto | 161 + .../proto/tendermint/abci/types.proto | 407 ++ .../proto/tendermint/crypto/keys.proto | 16 + .../proto/tendermint/crypto/proof.proto | 41 + .../proto/tendermint/libs/bits/types.proto | 9 + .../proto/tendermint/types/evidence.proto | 31 + .../proto/tendermint/types/params.proto | 81 + .../proto/tendermint/types/types.proto | 162 + .../proto/tendermint/types/validator.proto | 25 + .../proto/tendermint/version/types.proto | 24 + core-sdk/third_party/protocgen.sh | 18 + core-sdk/types/address.go | 1 - core-sdk/types/address_test.go | 6 +- core-sdk/types/auth/types.go | 4 +- core-sdk/types/block.go | 4 +- core-sdk/types/config.go | 3 +- core-sdk/types/events.go | 3 +- core-sdk/types/factory.go | 1 - core-sdk/types/module.go | 3 +- core-sdk/types/result.go | 3 +- core-sdk/types/stdtx.go | 1 - core-sdk/types/store/codec.go | 3 +- core-sdk/types/store/types.go | 4 +- core-sdk/types/tm_types.go | 5 +- core-sdk/types/tx.go | 3 +- core-sdk/types/tx/types.go | 1 - 66 files changed, 8307 insertions(+), 85 deletions(-) create mode 100644 core-sdk/proto/cosmos/auth/v1beta1/auth.proto create mode 100644 core-sdk/proto/cosmos/auth/v1beta1/query.proto create mode 100644 core-sdk/proto/cosmos/bank/v1beta1/bank.proto create mode 100644 core-sdk/proto/cosmos/bank/v1beta1/query.proto create mode 100644 core-sdk/proto/cosmos/bank/v1beta1/tx.proto create mode 100644 core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto create mode 100644 core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto create mode 100644 core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto create mode 100644 core-sdk/proto/cosmos/base/v1beta1/coin.proto create mode 100644 core-sdk/proto/cosmos/crypto/ed25519/keys.proto create mode 100644 core-sdk/proto/cosmos/crypto/multisig/keys.proto create mode 100644 core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto create mode 100644 core-sdk/proto/cosmos/crypto/secp256k1/keys.proto create mode 100644 core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto create mode 100644 core-sdk/proto/cosmos/tx/v1beta1/tx.proto create mode 100644 core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go create mode 100644 core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go create mode 100644 core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go create mode 100644 core-sdk/third_party/proto/confio/proofs.proto create mode 100644 core-sdk/third_party/proto/cosmos_proto/cosmos.proto create mode 100644 core-sdk/third_party/proto/gogoproto/gogo.proto create mode 100644 core-sdk/third_party/proto/google/api/annotations.proto create mode 100644 core-sdk/third_party/proto/google/api/http.proto create mode 100644 core-sdk/third_party/proto/google/api/httpbody.proto create mode 100644 core-sdk/third_party/proto/google/protobuf/any.proto create mode 100644 core-sdk/third_party/proto/tendermint/abci/types.proto create mode 100644 core-sdk/third_party/proto/tendermint/crypto/keys.proto create mode 100644 core-sdk/third_party/proto/tendermint/crypto/proof.proto create mode 100644 core-sdk/third_party/proto/tendermint/libs/bits/types.proto create mode 100644 core-sdk/third_party/proto/tendermint/types/evidence.proto create mode 100644 core-sdk/third_party/proto/tendermint/types/params.proto create mode 100644 core-sdk/third_party/proto/tendermint/types/types.proto create mode 100644 core-sdk/third_party/proto/tendermint/types/validator.proto create mode 100644 core-sdk/third_party/proto/tendermint/version/types.proto create mode 100755 core-sdk/third_party/protocgen.sh diff --git a/core-sdk/bank/bank.go b/core-sdk/bank/bank.go index a03459fd..9ba33961 100644 --- a/core-sdk/bank/bank.go +++ b/core-sdk/bank/bank.go @@ -3,12 +3,11 @@ package bank import ( "context" "fmt" - "strings" - "github.com/irisnet/core-sdk-go/common" commoncodec "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" + "strings" ) type bankClient struct { diff --git a/core-sdk/client.go b/core-sdk/client.go index 39a7b3ef..52484637 100644 --- a/core-sdk/client.go +++ b/core-sdk/client.go @@ -1,8 +1,6 @@ package sdk import ( - "github.com/tendermint/tendermint/libs/log" - "github.com/irisnet/core-sdk-go/bank" "github.com/irisnet/core-sdk-go/client" commoncodec "github.com/irisnet/core-sdk-go/common/codec" @@ -10,6 +8,7 @@ import ( commoncryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/types" txtypes "github.com/irisnet/core-sdk-go/types/tx" + "github.com/tendermint/tendermint/libs/log" ) type Client struct { diff --git a/core-sdk/client/account.go b/core-sdk/client/account.go index b5af18a8..1b689d36 100644 --- a/core-sdk/client/account.go +++ b/core-sdk/client/account.go @@ -3,15 +3,13 @@ package client import ( "context" "fmt" - "time" - - "github.com/tendermint/tendermint/libs/log" - "github.com/irisnet/core-sdk-go/bank" cache "github.com/irisnet/core-sdk-go/common/cache" commoncodec "github.com/irisnet/core-sdk-go/common/codec" sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/auth" + "github.com/tendermint/tendermint/libs/log" + "time" ) // Must be used with locker, otherwise there are thread safety issues diff --git a/core-sdk/client/base_client.go b/core-sdk/client/base_client.go index 774bba73..d1ec721f 100644 --- a/core-sdk/client/base_client.go +++ b/core-sdk/client/base_client.go @@ -7,22 +7,20 @@ import ( "encoding/hex" "errors" "fmt" - "strings" - "time" - "github.com/avast/retry-go" "github.com/gogo/protobuf/proto" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - "github.com/tendermint/tendermint/libs/log" - rpcclient "github.com/tendermint/tendermint/rpc/client" - "github.com/irisnet/core-sdk-go/common" commoncache "github.com/irisnet/core-sdk-go/common/cache" commoncodec "github.com/irisnet/core-sdk-go/common/codec" sdklog "github.com/irisnet/core-sdk-go/common/log" sdktypes "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/tx" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + "github.com/tendermint/tendermint/libs/log" + rpcclient "github.com/tendermint/tendermint/rpc/client" + "strings" + "time" ) const ( diff --git a/core-sdk/client/keys.go b/core-sdk/client/keys.go index 7e9955bc..f629e3e6 100644 --- a/core-sdk/client/keys.go +++ b/core-sdk/client/keys.go @@ -2,9 +2,6 @@ package client import ( "fmt" - - tmcrypto "github.com/tendermint/tendermint/crypto" - kmg "github.com/irisnet/core-sdk-go/common/crypto" cryptoamino "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" @@ -12,6 +9,7 @@ import ( commoncryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/store" + tmcrypto "github.com/tendermint/tendermint/crypto" ) type keyManager struct { diff --git a/core-sdk/client/rpc_client.go b/core-sdk/client/rpc_client.go index 936a954f..3ec8751a 100644 --- a/core-sdk/client/rpc_client.go +++ b/core-sdk/client/rpc_client.go @@ -3,15 +3,13 @@ package client import ( "context" "fmt" - + commoncodec "github.com/irisnet/core-sdk-go/common/codec" "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/libs/log" rpc "github.com/tendermint/tendermint/rpc/client" rpchttp "github.com/tendermint/tendermint/rpc/client/http" tmtypes "github.com/tendermint/tendermint/types" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/uuid" sdk "github.com/irisnet/core-sdk-go/types" ) diff --git a/core-sdk/client/store.go b/core-sdk/client/store.go index cdb15ea5..78f6918c 100644 --- a/core-sdk/client/store.go +++ b/core-sdk/client/store.go @@ -3,7 +3,6 @@ package client import ( "context" "errors" - rpcclient "github.com/tendermint/tendermint/rpc/client" ) diff --git a/core-sdk/client/tx.go b/core-sdk/client/tx.go index ad021983..23dfe336 100644 --- a/core-sdk/client/tx.go +++ b/core-sdk/client/tx.go @@ -4,13 +4,11 @@ import ( "context" "encoding/hex" "errors" - "strings" - "time" - "github.com/gogo/protobuf/jsonpb" - ctypes "github.com/tendermint/tendermint/rpc/core/types" - sdk "github.com/irisnet/core-sdk-go/types" + ctypes "github.com/tendermint/tendermint/rpc/core/types" + "strings" + "time" ) // QueryTx returns the tx info diff --git a/core-sdk/common/bech32/bech32.go b/core-sdk/common/bech32/bech32.go index 7ab4b951..8059dfd1 100644 --- a/core-sdk/common/bech32/bech32.go +++ b/core-sdk/common/bech32/bech32.go @@ -3,7 +3,6 @@ package bech32 import ( "errors" "fmt" - "github.com/btcsuite/btcutil/bech32" ) diff --git a/core-sdk/common/commom.go b/core-sdk/common/commom.go index 4f9124ed..3d6cdc9a 100644 --- a/core-sdk/common/commom.go +++ b/core-sdk/common/commom.go @@ -2,7 +2,6 @@ package common import ( "crypto/rand" - "github.com/irisnet/core-sdk-go/types" ) diff --git a/core-sdk/common/common_test.go b/core-sdk/common/common_test.go index 1d8f17e5..3aa85dab 100644 --- a/core-sdk/common/common_test.go +++ b/core-sdk/common/common_test.go @@ -1,9 +1,8 @@ package common import ( - "testing" - "github.com/irisnet/core-sdk-go/types" + "testing" "github.com/stretchr/testify/require" ) diff --git a/core-sdk/common/crypto/keys/ed25519/ed25519.go b/core-sdk/common/crypto/keys/ed25519/ed25519.go index 4611fafa..f19d1289 100644 --- a/core-sdk/common/crypto/keys/ed25519/ed25519.go +++ b/core-sdk/common/crypto/keys/ed25519/ed25519.go @@ -3,16 +3,14 @@ package ed25519 import ( "crypto/subtle" "fmt" - "io" - "github.com/irisnet/core-sdk-go/common/codec" + "io" + cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" "github.com/tendermint/tendermint/crypto" tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/tmhash" "golang.org/x/crypto/ed25519" - - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" ) //------------------------------------- diff --git a/core-sdk/common/crypto/keys/sm2/gm_sm2.go b/core-sdk/common/crypto/keys/sm2/gm_sm2.go index cdddec8c..accdef30 100644 --- a/core-sdk/common/crypto/keys/sm2/gm_sm2.go +++ b/core-sdk/common/crypto/keys/sm2/gm_sm2.go @@ -4,9 +4,8 @@ import ( "bytes" "crypto/rand" "fmt" - "log" - "github.com/tjfoc/gmsm/sm2" + "log" ) //Generate key pair diff --git a/core-sdk/go.mod b/core-sdk/go.mod index cd3cb1ee..366b5b4c 100644 --- a/core-sdk/go.mod +++ b/core-sdk/go.mod @@ -9,6 +9,7 @@ require ( github.com/btcsuite/btcutil v1.0.2 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.4.3 // indirect github.com/magiconair/properties v1.8.1 github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 diff --git a/core-sdk/integration_test/bank_test.go b/core-sdk/integration_test/bank_test.go index 5f94658f..51304a4b 100644 --- a/core-sdk/integration_test/bank_test.go +++ b/core-sdk/integration_test/bank_test.go @@ -3,14 +3,12 @@ package integration_test import ( "encoding/json" "fmt" + "github.com/irisnet/core-sdk-go/bank" + "github.com/irisnet/core-sdk-go/types" + "github.com/stretchr/testify/require" "math/rand" "sync" "time" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/core-sdk-go/bank" - "github.com/irisnet/core-sdk-go/types" ) func (s IntegrationTestSuite) TestBank() { diff --git a/core-sdk/integration_test/integration_test.go b/core-sdk/integration_test/integration_test.go index ceba9da6..b6db86d4 100644 --- a/core-sdk/integration_test/integration_test.go +++ b/core-sdk/integration_test/integration_test.go @@ -1,20 +1,18 @@ package integration_test import ( + sdk "github.com/irisnet/core-sdk-go" + "github.com/irisnet/core-sdk-go/common/crypto" + "github.com/irisnet/core-sdk-go/common/log" + "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/store" + "github.com/stretchr/testify/suite" "io/ioutil" "math/rand" "os" "path/filepath" "testing" "time" - - "github.com/stretchr/testify/suite" - - sdk "github.com/irisnet/core-sdk-go" - "github.com/irisnet/core-sdk-go/common/crypto" - "github.com/irisnet/core-sdk-go/common/log" - "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/store" ) const ( @@ -27,7 +25,7 @@ const ( type IntegrationTestSuite struct { suite.Suite - sdk.Client + sdk.IRISHUBClient r *rand.Rand rootAccount MockAccount randAccounts []MockAccount @@ -61,7 +59,7 @@ func (s *IntegrationTestSuite) SetupSuite() { panic(err) } - s.Client = sdk.NewClient(cfg) + s.IRISHUBClient = sdk.NewIRISHUBClient(cfg) s.r = rand.New(rand.NewSource(time.Now().UnixNano())) s.rootAccount = MockAccount{ Name: "validator", diff --git a/core-sdk/proto/cosmos/auth/v1beta1/auth.proto b/core-sdk/proto/cosmos/auth/v1beta1/auth.proto new file mode 100644 index 00000000..1df1a42a --- /dev/null +++ b/core-sdk/proto/cosmos/auth/v1beta1/auth.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; +package cosmos.auth.v1beta1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/types/auth"; + +// BaseAccount defines a base account type. It contains all the necessary fields +// for basic account functionality. Any custom account type should extend this +// type for additional functionality (e.g. vesting). +message BaseAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.equal) = false; + + option (cosmos_proto.implements_interface) = "AccountI"; + + string address = 1; + google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; + uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""]; + uint64 sequence = 4; +} + +// ModuleAccount defines an account for modules that holds coins on a pool. +message ModuleAccount { + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + option (cosmos_proto.implements_interface) = "ModuleAccountI"; + + BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; + string name = 2; + repeated string permissions = 3; +} + +// Params defines the parameters for the auth module. +message Params { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + uint64 max_memo_characters = 1 [(gogoproto.moretags) = "yaml:\"max_memo_characters\""]; + uint64 tx_sig_limit = 2 [(gogoproto.moretags) = "yaml:\"tx_sig_limit\""]; + uint64 tx_size_cost_per_byte = 3 [(gogoproto.moretags) = "yaml:\"tx_size_cost_per_byte\""]; + uint64 sig_verify_cost_ed25519 = 4 + [(gogoproto.customname) = "SigVerifyCostED25519", (gogoproto.moretags) = "yaml:\"sig_verify_cost_ed25519\""]; + uint64 sig_verify_cost_secp256k1 = 5 + [(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""]; +} diff --git a/core-sdk/proto/cosmos/auth/v1beta1/query.proto b/core-sdk/proto/cosmos/auth/v1beta1/query.proto new file mode 100644 index 00000000..2fdc62fe --- /dev/null +++ b/core-sdk/proto/cosmos/auth/v1beta1/query.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; +package cosmos.auth.v1beta1; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "google/api/annotations.proto"; +import "cosmos/auth/v1beta1/auth.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/types/auth"; + +// Query defines the gRPC querier service. +service Query { + // Account returns account details based on address. + rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { + option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}"; + } + + // Params queries all parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/auth/v1beta1/params"; + } +} + +// QueryAccountRequest is the request type for the Query/Account RPC method. +message QueryAccountRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address defines the address to query for. + string address = 1; +} + +// QueryAccountResponse is the response type for the Query/Account RPC method. +message QueryAccountResponse { + // account defines the account of the corresponding address. + google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; +} + +// 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 defines the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/core-sdk/proto/cosmos/bank/v1beta1/bank.proto b/core-sdk/proto/cosmos/bank/v1beta1/bank.proto new file mode 100644 index 00000000..06214ff6 --- /dev/null +++ b/core-sdk/proto/cosmos/bank/v1beta1/bank.proto @@ -0,0 +1,85 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/bank"; + +// Params defines the parameters for the bank module. +message Params { + option (gogoproto.goproto_stringer) = false; + repeated SendEnabled send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled,omitempty\""]; + bool default_send_enabled = 2 [(gogoproto.moretags) = "yaml:\"default_send_enabled,omitempty\""]; +} + +// SendEnabled maps coin denom to a send_enabled status (whether a denom is +// sendable). +message SendEnabled { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + string denom = 1; + bool enabled = 2; +} + +// Input models transaction input. +message Input { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string address = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; +} + +// Output models transaction outputs. +message Output { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string address = 1; + repeated cosmos.base.v1beta1.Coin coins = 2 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; +} + +// Supply represents a struct that passively keeps track of the total supply +// amounts in the network. +message Supply { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = false; + option (gogoproto.goproto_stringer) = false; + + option (cosmos_proto.implements_interface) = "*github.com/irisnet/core-sdk-go/modules/bank/exported.SupplyI"; + + repeated cosmos.base.v1beta1.Coin total = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; +} + +// DenomUnit represents a struct that describes a given +// denomination unit of the basic token. +message DenomUnit { + // denom represents the string name of the given denom unit (e.g uatom). + string denom = 1; + // exponent represents power of 10 exponent that one must + // raise the base_denom to in order to equal the given DenomUnit's denom + // 1 denom = 1^exponent base_denom + // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + // exponent = 6, thus: 1 atom = 10^6 uatom). + uint32 exponent = 2; + // aliases is a list of string aliases for the given denom + repeated string aliases = 3; +} + +// Metadata represents a struct that describes +// a basic token. +message Metadata { + string description = 1; + // denom_units represents the list of DenomUnit's for a given coin + repeated DenomUnit denom_units = 2; + // base represents the base denom (should be the DenomUnit with exponent = 0). + string base = 3; + // display indicates the suggested denom that should be + // displayed in clients. + string display = 4; +} diff --git a/core-sdk/proto/cosmos/bank/v1beta1/query.proto b/core-sdk/proto/cosmos/bank/v1beta1/query.proto new file mode 100644 index 00000000..84baabd0 --- /dev/null +++ b/core-sdk/proto/cosmos/bank/v1beta1/query.proto @@ -0,0 +1,111 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "cosmos/base/query/v1beta1/pagination.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/bank"; + +// Query defines the gRPC querier service. +service Query { + // Balance queries the balance of a single coin for a single account. + rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/{denom}"; + } + + // AllBalances queries the balance of all coins for a single account. + rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; + } + + // TotalSupply queries the total supply of all coins. + rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; + } + + // SupplyOf queries the supply of a single coin. + rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/supply/{denom}"; + } + + // Params queries the parameters of x/bank module. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/bank/v1beta1/params"; + } +} + +// QueryBalanceRequest is the request type for the Query/Balance RPC method. +message QueryBalanceRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address to query balances for. + string address = 1; + + // denom is the coin denom to query balances for. + string denom = 2; +} + +// QueryBalanceResponse is the response type for the Query/Balance RPC method. +message QueryBalanceResponse { + // balance is the balance of the coin. + cosmos.base.v1beta1.Coin balance = 1; +} + +// QueryBalanceRequest is the request type for the Query/AllBalances RPC method. +message QueryAllBalancesRequest { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // address is the address to query balances for. + string address = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC +// method. +message QueryAllBalancesResponse { + // balances is the balances of all the coins. + repeated cosmos.base.v1beta1.Coin balances = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC +// method. +message QueryTotalSupplyRequest {} + +// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC +// method +message QueryTotalSupplyResponse { + // supply is the supply of the coins + repeated cosmos.base.v1beta1.Coin supply = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; +} + +// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. +message QuerySupplyOfRequest { + // denom is the coin denom to query balances for. + string denom = 1; +} + +// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. +message QuerySupplyOfResponse { + // amount is the supply of the coin. + cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; +} + +// QueryParamsRequest defines the request type for querying x/bank parameters. +message QueryParamsRequest {} + +// QueryParamsResponse defines the response type for querying x/bank parameters. +message QueryParamsResponse { + Params params = 1 [(gogoproto.nullable) = false]; +} diff --git a/core-sdk/proto/cosmos/bank/v1beta1/tx.proto b/core-sdk/proto/cosmos/bank/v1beta1/tx.proto new file mode 100644 index 00000000..2b130d6e --- /dev/null +++ b/core-sdk/proto/cosmos/bank/v1beta1/tx.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package cosmos.bank.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/bank/v1beta1/bank.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/bank"; + +// MsgSend represents a message to send coins from one account to another. +message MsgSend { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; + string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; + repeated cosmos.base.v1beta1.Coin amount = 3 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; +} + +// MsgMultiSend represents an arbitrary multi-in, multi-out send message. +message MsgMultiSend { + option (gogoproto.equal) = false; + + repeated Input inputs = 1 [(gogoproto.nullable) = false]; + repeated Output outputs = 2 [(gogoproto.nullable) = false]; +} diff --git a/core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto b/core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto new file mode 100644 index 00000000..7ddc4350 --- /dev/null +++ b/core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto @@ -0,0 +1,137 @@ +syntax = "proto3"; +package cosmos.base.abci.v1beta1; + +import "gogoproto/gogo.proto"; +import "tendermint/abci/types.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/types"; +option (gogoproto.goproto_stringer_all) = false; + +// TxResponse defines a structure containing relevant tx data and metadata. The +// tags are stringified and the log is JSON decoded. +message TxResponse { + option (gogoproto.goproto_getters) = false; + // The block height + int64 height = 1; + // The transaction hash. + string txhash = 2 [(gogoproto.customname) = "TxHash"]; + // Namespace for the Code + string codespace = 3; + // Response code. + uint32 code = 4; + // Result bytes, if any. + string data = 5; + // The output of the application's logger (raw string). May be + // non-deterministic. + string raw_log = 6; + // The output of the application's logger (typed). May be non-deterministic. + repeated ABCIMessageLog logs = 7 [(gogoproto.castrepeated) = "ABCIMessageLogs", (gogoproto.nullable) = false]; + // Additional information. May be non-deterministic. + string info = 8; + // Amount of gas requested for transaction. + int64 gas_wanted = 9; + // Amount of gas consumed by transaction. + int64 gas_used = 10; + // The request transaction bytes. + google.protobuf.Any tx = 11; + // Time of the previous block. For heights > 1, it's the weighted median of + // the timestamps of the valid votes in the block.LastCommit. For height == 1, + // it's genesis time. + string timestamp = 12; +} + +// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. +message ABCIMessageLog { + option (gogoproto.stringer) = true; + + uint32 msg_index = 1; + string log = 2; + + // Events contains a slice of Event objects that were emitted during some + // execution. + repeated StringEvent events = 3 [(gogoproto.castrepeated) = "StringEvents", (gogoproto.nullable) = false]; +} + +// StringEvent defines en Event object wrapper where all the attributes +// contain key/value pairs that are strings instead of raw bytes. +message StringEvent { + option (gogoproto.stringer) = true; + + string type = 1; + repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; +} + +// Attribute defines an attribute wrapper where the key and value are +// strings instead of raw bytes. +message Attribute { + string key = 1; + string value = 2; +} + +// GasInfo defines tx execution gas context. +message GasInfo { + // GasWanted is the maximum units of work we allow this tx to perform. + uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""]; + + // GasUsed is the amount of gas actually consumed. + uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""]; +} + +// Result is the union of ResponseFormat and ResponseCheckTx. +message Result { + option (gogoproto.goproto_getters) = false; + + // Data is any data returned from message or handler execution. It MUST be + // length prefixed in order to separate data from multiple message executions. + bytes data = 1; + + // Log contains the log information from message or handler execution. + string log = 2; + + // Events contains a slice of Event objects that were emitted during message + // or handler execution. + repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false]; +} + +// SimulationResponse defines the response generated when a transaction is +// successfully simulated. +message SimulationResponse { + GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; + Result result = 2; +} + +// MsgData defines the data returned in a Result object during message +// execution. +message MsgData { + option (gogoproto.stringer) = true; + + string msg_type = 1; + bytes data = 2; +} + +// TxMsgData defines a list of MsgData. A transaction will have a MsgData object +// for each message. +message TxMsgData { + option (gogoproto.stringer) = true; + + repeated MsgData data = 1; +} + +// SearchTxsResult defines a structure for querying txs pageable +message SearchTxsResult { + option (gogoproto.stringer) = true; + + // Count of all txs + uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"]; + // Count of txs in current page + uint64 count = 2; + // Index of current page, start from 1 + uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"]; + // Count of total pages + uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"]; + // Max count txs per page + uint64 limit = 5; + // List of txs in current page + repeated TxResponse txs = 6; +} diff --git a/core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto b/core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto new file mode 100644 index 00000000..0e7a4691 --- /dev/null +++ b/core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package cosmos.base.kv.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/types/kv"; + +// Pairs defines a repeated slice of Pair objects. +message Pairs { + repeated Pair pairs = 1 [(gogoproto.nullable) = false]; +} + +// Pair defines a key/value bytes tuple. +message Pair { + bytes key = 1; + bytes value = 2; +} diff --git a/core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto b/core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto new file mode 100644 index 00000000..592782ee --- /dev/null +++ b/core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +package cosmos.base.query.v1beta1; + +option go_package = "github.com/irisnet/core-sdk-go/types/query"; + +// PageRequest is to be embedded in gRPC request messages for efficient +// pagination. Ex: +// +// message SomeRequest { +// Foo some_parameter = 1; +// PageRequest pagination = 2; +// } +message PageRequest { + // key is a value returned in PageResponse.next_key to begin + // querying the next page most efficiently. Only one of offset or key + // should be set. + bytes key = 1; + + // offset is a numeric offset that can be used when key is unavailable. + // It is less efficient than using key. Only one of offset or key should + // be set. + uint64 offset = 2; + + // limit is the total number of results to be returned in the result page. + // If left empty it will default to a value to be set by each app. + uint64 limit = 3; + + // count_total is set to true to indicate that the result set should include + // a count of the total number of items available for pagination in UIs. + // count_total is only respected when offset is used. It is ignored when key + // is set. + bool count_total = 4; +} + +// PageResponse is to be embedded in gRPC response messages where the +// corresponding request message has used PageRequest. +// +// message SomeResponse { +// repeated Bar results = 1; +// PageResponse page = 2; +// } +message PageResponse { + // next_key is the key to be passed to PageRequest.key to + // query the next page most efficiently + bytes next_key = 1; + + // total is total number of results available if PageRequest.count_total + // was set, its value is undefined otherwise + uint64 total = 2; +} diff --git a/core-sdk/proto/cosmos/base/v1beta1/coin.proto b/core-sdk/proto/cosmos/base/v1beta1/coin.proto new file mode 100644 index 00000000..624e562e --- /dev/null +++ b/core-sdk/proto/cosmos/base/v1beta1/coin.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package cosmos.base.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; + +// Coin defines a token with a denomination and an amount. +// +// NOTE: The amount field is an Int which implements the custom method +// signatures required by gogoproto. +message Coin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecCoin defines a token with a denomination and a decimal amount. +// +// NOTE: The amount field is an Dec which implements the custom method +// signatures required by gogoproto. +message DecCoin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} + +// IntProto defines a Protobuf wrapper around an Int object. +message IntProto { + string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecProto defines a Protobuf wrapper around a Dec object. +message DecProto { + string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} diff --git a/core-sdk/proto/cosmos/crypto/ed25519/keys.proto b/core-sdk/proto/cosmos/crypto/ed25519/keys.proto new file mode 100644 index 00000000..2d997102 --- /dev/null +++ b/core-sdk/proto/cosmos/crypto/ed25519/keys.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package cosmos.crypto.ed25519; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/common/crypto/keys/ed25519"; + +// PubKey defines a ed25519 public key +// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte +// if the y-coordinate is the lexicographically largest of the two associated with +// the x-coordinate. Otherwise the first byte is a 0x03. +// This prefix is followed with the x-coordinate. +message PubKey { + option (gogoproto.goproto_stringer) = false; + + bytes key = 1; +} + +// PrivKey defines a ed25519 private key. +message PrivKey { + bytes key = 1; +} diff --git a/core-sdk/proto/cosmos/crypto/multisig/keys.proto b/core-sdk/proto/cosmos/crypto/multisig/keys.proto new file mode 100644 index 00000000..a389783c --- /dev/null +++ b/core-sdk/proto/cosmos/crypto/multisig/keys.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package cosmos.crypto.multisig; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/common/crypto/keys/multisig"; + +// LegacyAminoPubKey specifies a public key type +// which nests multiple public keys and a threshold, +// it uses legacy amino address rules. +message LegacyAminoPubKey { + option (gogoproto.goproto_getters) = false; + + uint32 threshold = 1 [(gogoproto.moretags) = "yaml:\"threshold\""]; + repeated google.protobuf.Any public_keys = 2 + [(gogoproto.customname) = "PubKeys", (gogoproto.moretags) = "yaml:\"pubkeys\""]; +} diff --git a/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto b/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto new file mode 100644 index 00000000..32d2e703 --- /dev/null +++ b/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package cosmos.crypto.multisig.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/crypto/types"; + +// MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. +// See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers +// signed and with which modes. +message MultiSignature { + option (gogoproto.goproto_unrecognized) = true; + repeated bytes signatures = 1; +} + +// CompactBitArray is an implementation of a space efficient bit array. +// This is used to ensure that the encoded data takes up a minimal amount of +// space after proto encoding. +// This is not thread safe, and is not intended for concurrent usage. +message CompactBitArray { + option (gogoproto.goproto_stringer) = false; + + uint32 extra_bits_stored = 1; + bytes elems = 2; +} diff --git a/core-sdk/proto/cosmos/crypto/secp256k1/keys.proto b/core-sdk/proto/cosmos/crypto/secp256k1/keys.proto new file mode 100644 index 00000000..d6e51b40 --- /dev/null +++ b/core-sdk/proto/cosmos/crypto/secp256k1/keys.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package cosmos.crypto.secp256k1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1"; + +// PubKey defines a secp256k1 public key +// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte +// if the y-coordinate is the lexicographically largest of the two associated with +// the x-coordinate. Otherwise the first byte is a 0x03. +// This prefix is followed with the x-coordinate. +message PubKey { + option (gogoproto.goproto_stringer) = false; + + bytes key = 1; +} + +// PrivKey defines a secp256k1 private key. +message PrivKey { + bytes key = 1; +} diff --git a/core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto b/core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto new file mode 100644 index 00000000..48fe9914 --- /dev/null +++ b/core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; +package cosmos.tx.signing.v1beta1; + +import "cosmos/crypto/multisig/v1beta1/multisig.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/types/tx/signing"; + +// SignMode represents a signing mode with its own security guarantees. +enum SignMode { + // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + // rejected + SIGN_MODE_UNSPECIFIED = 0; + + // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + // verified with raw bytes from Tx + SIGN_MODE_DIRECT = 1; + + // SIGN_MODE_TEXTUAL is a future signing mode that will verify some + // human-readable textual representation on top of the binary representation + // from SIGN_MODE_DIRECT + SIGN_MODE_TEXTUAL = 2; + + // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + // Amino JSON and will be removed in the future + SIGN_MODE_LEGACY_AMINO_JSON = 127; +} + +// SignatureDescriptors wraps multiple SignatureDescriptor's. +message SignatureDescriptors { + // signatures are the signature descriptors + repeated SignatureDescriptor signatures = 1; +} + +// SignatureDescriptor is a convenience type which represents the full data for +// a signature including the public key of the signer, signing modes and the +// signature itself. It is primarily used for coordinating signatures between +// clients. +message SignatureDescriptor { + // public_key is the public key of the signer + google.protobuf.Any public_key = 1; + + Data data = 2; + + // sequence is the sequence of the account, which describes the + // number of committed transactions signed by a given address. It is used to prevent + // replay attacks. + uint64 sequence = 3; + + // Data represents signature data + message Data { + // sum is the oneof that specifies whether this represents single or multi-signature data + oneof sum { + // single represents a single signer + Single single = 1; + + // multi represents a multisig signer + Multi multi = 2; + } + + // Single is the signature data for a single signer + message Single { + // mode is the signing mode of the single signer + SignMode mode = 1; + + // signature is the raw signature bytes + bytes signature = 2; + } + + // Multi is the signature data for a multisig public key + message Multi { + // bitarray specifies which keys within the multisig are signing + cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; + + // signatures is the signatures of the multi-signature + repeated Data signatures = 2; + } + } +} diff --git a/core-sdk/proto/cosmos/tx/v1beta1/tx.proto b/core-sdk/proto/cosmos/tx/v1beta1/tx.proto new file mode 100644 index 00000000..5f63d20c --- /dev/null +++ b/core-sdk/proto/cosmos/tx/v1beta1/tx.proto @@ -0,0 +1,182 @@ +syntax = "proto3"; +package cosmos.tx.v1beta1; + +import "gogoproto/gogo.proto"; +import "cosmos/crypto/multisig/v1beta1/multisig.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/tx/signing/v1beta1/signing.proto"; +import "google/protobuf/any.proto"; + +option go_package = "github.com/irisnet/core-sdk-go/types/tx"; + +// Tx is the standard type used for broadcasting transactions. +message Tx { + // body is the processable content of the transaction + TxBody body = 1; + + // auth_info is the authorization related content of the transaction, + // specifically signers, signer modes and fee + AuthInfo auth_info = 2; + + // signatures is a list of signatures that matches the length and order of + // AuthInfo's signer_infos to allow connecting signature meta information like + // public key and signing mode by position. + repeated bytes signatures = 3; +} + +// TxRaw is a variant of Tx that pins the signer's exact binary representation +// of body and auth_info. This is used for signing, broadcasting and +// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and +// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used +// as the transaction ID. +message TxRaw { + // body_bytes is a protobuf serialization of a TxBody that matches the + // representation in SignDoc. + bytes body_bytes = 1; + + // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + // representation in SignDoc. + bytes auth_info_bytes = 2; + + // signatures is a list of signatures that matches the length and order of + // AuthInfo's signer_infos to allow connecting signature meta information like + // public key and signing mode by position. + repeated bytes signatures = 3; +} + +// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. +message SignDoc { + // body_bytes is protobuf serialization of a TxBody that matches the + // representation in TxRaw. + bytes body_bytes = 1; + + // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + // representation in TxRaw. + bytes auth_info_bytes = 2; + + // chain_id is the unique identifier of the chain this transaction targets. + // It prevents signed transactions from being used on another chain by an + // attacker + string chain_id = 3; + + // account_number is the account number of the account in state + uint64 account_number = 4; +} + +// TxBody is the body of a transaction that all signers sign over. +message TxBody { + // messages is a list of messages to be executed. The required signers of + // those messages define the number and order of elements in AuthInfo's + // signer_infos and Tx's signatures. Each required signer address is added to + // the list only the first time it occurs. + // + // By convention, the first required signer (usually from the first message) + // is referred to as the primary signer and pays the fee for the whole + // transaction. + repeated google.protobuf.Any messages = 1; + + // memo is any arbitrary memo to be added to the transaction + string memo = 2; + + // timeout is the block height after which this transaction will not + // be processed by the chain + uint64 timeout_height = 3; + + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, the transaction will be rejected + repeated google.protobuf.Any extension_options = 1023; + + // extension_options are arbitrary options that can be added by chains + // when the default options are not sufficient. If any of these are present + // and can't be handled, they will be ignored + repeated google.protobuf.Any non_critical_extension_options = 2047; +} + +// AuthInfo describes the fee and signer modes that are used to sign a +// transaction. +message AuthInfo { + // signer_infos defines the signing modes for the required signers. The number + // and order of elements must match the required signers from TxBody's + // messages. The first element is the primary signer and the one which pays + // the fee. + repeated SignerInfo signer_infos = 1; + + // Fee is the fee and gas limit for the transaction. The first signer is the + // primary signer and the one which pays the fee. The fee can be calculated + // based on the cost of evaluating the body and doing signature verification + // of the signers. This can be estimated via simulation. + Fee fee = 2; +} + +// SignerInfo describes the public key and signing mode of a single top-level +// signer. +message SignerInfo { + // public_key is the public key of the signer. It is optional for accounts + // that already exist in state. If unset, the verifier can use the required \ + // signer address for this position and lookup the public key. + google.protobuf.Any public_key = 1; + + // mode_info describes the signing mode of the signer and is a nested + // structure to support nested multisig pubkey's + ModeInfo mode_info = 2; + + // sequence is the sequence of the account, which describes the + // number of committed transactions signed by a given address. It is used to + // prevent replay attacks. + uint64 sequence = 3; +} + +// ModeInfo describes the signing mode of a single or nested multisig signer. +message ModeInfo { + // sum is the oneof that specifies whether this represents a single or nested + // multisig signer + oneof sum { + // single represents a single signer + Single single = 1; + + // multi represents a nested multisig signer + Multi multi = 2; + } + + // Single is the mode info for a single signer. It is structured as a message + // to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + // future + message Single { + // mode is the signing mode of the single signer + cosmos.tx.signing.v1beta1.SignMode mode = 1; + } + + // Multi is the mode info for a multisig public key + message Multi { + // bitarray specifies which keys within the multisig are signing + cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; + + // mode_infos is the corresponding modes of the signers of the multisig + // which could include nested multisig public keys + repeated ModeInfo mode_infos = 2; + } +} + +// Fee includes the amount of coins paid in fees and the maximum +// gas to be used by the transaction. The ratio yields an effective "gasprice", +// which must be above some miminum to be accepted into the mempool. +message Fee { + // amount is the amount of coins to be paid as a fee + repeated cosmos.base.v1beta1.Coin amount = 1 + [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; + + // gas_limit is the maximum gas that can be used in transaction processing + // before an out of gas error occurs + uint64 gas_limit = 2; + + // if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + // the payer must be a tx signer (and thus have signed this field in AuthInfo). + // setting this field does *not* change the ordering of required signers for the transaction. + string payer = 3; + + // if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + // to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + // not support fee grants, this will fail + string granter = 4; +} diff --git a/core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go b/core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go new file mode 100644 index 00000000..a8c7021c --- /dev/null +++ b/core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go @@ -0,0 +1,4590 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: confio/proofs.proto + +package _go + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/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 + +type HashOp int32 + +const ( + // NO_HASH is the default if no data passed. Note this is an illegal argument some places. + HashOp_NO_HASH HashOp = 0 + HashOp_SHA256 HashOp = 1 + HashOp_SHA512 HashOp = 2 + HashOp_KECCAK HashOp = 3 + HashOp_RIPEMD160 HashOp = 4 + HashOp_BITCOIN HashOp = 5 +) + +var HashOp_name = map[int32]string{ + 0: "NO_HASH", + 1: "SHA256", + 2: "SHA512", + 3: "KECCAK", + 4: "RIPEMD160", + 5: "BITCOIN", +} + +var HashOp_value = map[string]int32{ + "NO_HASH": 0, + "SHA256": 1, + "SHA512": 2, + "KECCAK": 3, + "RIPEMD160": 4, + "BITCOIN": 5, +} + +func (x HashOp) String() string { + return proto.EnumName(HashOp_name, int32(x)) +} + +func (HashOp) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{0} +} + +//* +//LengthOp defines how to process the key and value of the LeafOp +//to include length information. After encoding the length with the given +//algorithm, the length will be prepended to the key and value bytes. +//(Each one with it's own encoded length) +type LengthOp int32 + +const ( + // NO_PREFIX don't include any length info + LengthOp_NO_PREFIX LengthOp = 0 + // VAR_PROTO uses protobuf (and go-amino) varint encoding of the length + LengthOp_VAR_PROTO LengthOp = 1 + // VAR_RLP uses rlp int encoding of the length + LengthOp_VAR_RLP LengthOp = 2 + // FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer + LengthOp_FIXED32_BIG LengthOp = 3 + // FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer + LengthOp_FIXED32_LITTLE LengthOp = 4 + // FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer + LengthOp_FIXED64_BIG LengthOp = 5 + // FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer + LengthOp_FIXED64_LITTLE LengthOp = 6 + // REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) + LengthOp_REQUIRE_32_BYTES LengthOp = 7 + // REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) + LengthOp_REQUIRE_64_BYTES LengthOp = 8 +) + +var LengthOp_name = map[int32]string{ + 0: "NO_PREFIX", + 1: "VAR_PROTO", + 2: "VAR_RLP", + 3: "FIXED32_BIG", + 4: "FIXED32_LITTLE", + 5: "FIXED64_BIG", + 6: "FIXED64_LITTLE", + 7: "REQUIRE_32_BYTES", + 8: "REQUIRE_64_BYTES", +} + +var LengthOp_value = map[string]int32{ + "NO_PREFIX": 0, + "VAR_PROTO": 1, + "VAR_RLP": 2, + "FIXED32_BIG": 3, + "FIXED32_LITTLE": 4, + "FIXED64_BIG": 5, + "FIXED64_LITTLE": 6, + "REQUIRE_32_BYTES": 7, + "REQUIRE_64_BYTES": 8, +} + +func (x LengthOp) String() string { + return proto.EnumName(LengthOp_name, int32(x)) +} + +func (LengthOp) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{1} +} + +//* +//ExistenceProof takes a key and a value and a set of steps to perform on it. +//The result of peforming all these steps will provide a "root hash", which can +//be compared to the value in a header. +// +//Since it is computationally infeasible to produce a hash collission for any of the used +//cryptographic hash functions, if someone can provide a series of operations to transform +//a given key and value into a root hash that matches some trusted root, these key and values +//must be in the referenced merkle tree. +// +//The only possible issue is maliablity in LeafOp, such as providing extra prefix data, +//which should be controlled by a spec. Eg. with lengthOp as NONE, +//prefix = FOO, key = BAR, value = CHOICE +//and +//prefix = F, key = OOBAR, value = CHOICE +//would produce the same value. +// +//With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field +//in the ProofSpec is valuable to prevent this mutability. And why all trees should +//length-prefix the data before hashing it. +type ExistenceProof struct { + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Leaf *LeafOp `protobuf:"bytes,3,opt,name=leaf,proto3" json:"leaf,omitempty"` + Path []*InnerOp `protobuf:"bytes,4,rep,name=path,proto3" json:"path,omitempty"` +} + +func (m *ExistenceProof) Reset() { *m = ExistenceProof{} } +func (m *ExistenceProof) String() string { return proto.CompactTextString(m) } +func (*ExistenceProof) ProtoMessage() {} +func (*ExistenceProof) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{0} +} +func (m *ExistenceProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ExistenceProof.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 *ExistenceProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExistenceProof.Merge(m, src) +} +func (m *ExistenceProof) XXX_Size() int { + return m.Size() +} +func (m *ExistenceProof) XXX_DiscardUnknown() { + xxx_messageInfo_ExistenceProof.DiscardUnknown(m) +} + +var xxx_messageInfo_ExistenceProof proto.InternalMessageInfo + +func (m *ExistenceProof) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *ExistenceProof) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *ExistenceProof) GetLeaf() *LeafOp { + if m != nil { + return m.Leaf + } + return nil +} + +func (m *ExistenceProof) GetPath() []*InnerOp { + if m != nil { + return m.Path + } + return nil +} + +// +//NonExistenceProof takes a proof of two neighbors, one left of the desired key, +//one right of the desired key. If both proofs are valid AND they are neighbors, +//then there is no valid proof for the given key. +type NonExistenceProof struct { + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Left *ExistenceProof `protobuf:"bytes,2,opt,name=left,proto3" json:"left,omitempty"` + Right *ExistenceProof `protobuf:"bytes,3,opt,name=right,proto3" json:"right,omitempty"` +} + +func (m *NonExistenceProof) Reset() { *m = NonExistenceProof{} } +func (m *NonExistenceProof) String() string { return proto.CompactTextString(m) } +func (*NonExistenceProof) ProtoMessage() {} +func (*NonExistenceProof) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{1} +} +func (m *NonExistenceProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NonExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NonExistenceProof.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 *NonExistenceProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_NonExistenceProof.Merge(m, src) +} +func (m *NonExistenceProof) XXX_Size() int { + return m.Size() +} +func (m *NonExistenceProof) XXX_DiscardUnknown() { + xxx_messageInfo_NonExistenceProof.DiscardUnknown(m) +} + +var xxx_messageInfo_NonExistenceProof proto.InternalMessageInfo + +func (m *NonExistenceProof) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *NonExistenceProof) GetLeft() *ExistenceProof { + if m != nil { + return m.Left + } + return nil +} + +func (m *NonExistenceProof) GetRight() *ExistenceProof { + if m != nil { + return m.Right + } + return nil +} + +// +//CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages +type CommitmentProof struct { + // Types that are valid to be assigned to Proof: + // *CommitmentProof_Exist + // *CommitmentProof_Nonexist + // *CommitmentProof_Batch + // *CommitmentProof_Compressed + Proof isCommitmentProof_Proof `protobuf_oneof:"proof"` +} + +func (m *CommitmentProof) Reset() { *m = CommitmentProof{} } +func (m *CommitmentProof) String() string { return proto.CompactTextString(m) } +func (*CommitmentProof) ProtoMessage() {} +func (*CommitmentProof) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{2} +} +func (m *CommitmentProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommitmentProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommitmentProof.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 *CommitmentProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitmentProof.Merge(m, src) +} +func (m *CommitmentProof) XXX_Size() int { + return m.Size() +} +func (m *CommitmentProof) XXX_DiscardUnknown() { + xxx_messageInfo_CommitmentProof.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitmentProof proto.InternalMessageInfo + +type isCommitmentProof_Proof interface { + isCommitmentProof_Proof() + MarshalTo([]byte) (int, error) + Size() int +} + +type CommitmentProof_Exist struct { + Exist *ExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` +} +type CommitmentProof_Nonexist struct { + Nonexist *NonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` +} +type CommitmentProof_Batch struct { + Batch *BatchProof `protobuf:"bytes,3,opt,name=batch,proto3,oneof" json:"batch,omitempty"` +} +type CommitmentProof_Compressed struct { + Compressed *CompressedBatchProof `protobuf:"bytes,4,opt,name=compressed,proto3,oneof" json:"compressed,omitempty"` +} + +func (*CommitmentProof_Exist) isCommitmentProof_Proof() {} +func (*CommitmentProof_Nonexist) isCommitmentProof_Proof() {} +func (*CommitmentProof_Batch) isCommitmentProof_Proof() {} +func (*CommitmentProof_Compressed) isCommitmentProof_Proof() {} + +func (m *CommitmentProof) GetProof() isCommitmentProof_Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *CommitmentProof) GetExist() *ExistenceProof { + if x, ok := m.GetProof().(*CommitmentProof_Exist); ok { + return x.Exist + } + return nil +} + +func (m *CommitmentProof) GetNonexist() *NonExistenceProof { + if x, ok := m.GetProof().(*CommitmentProof_Nonexist); ok { + return x.Nonexist + } + return nil +} + +func (m *CommitmentProof) GetBatch() *BatchProof { + if x, ok := m.GetProof().(*CommitmentProof_Batch); ok { + return x.Batch + } + return nil +} + +func (m *CommitmentProof) GetCompressed() *CompressedBatchProof { + if x, ok := m.GetProof().(*CommitmentProof_Compressed); ok { + return x.Compressed + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*CommitmentProof) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*CommitmentProof_Exist)(nil), + (*CommitmentProof_Nonexist)(nil), + (*CommitmentProof_Batch)(nil), + (*CommitmentProof_Compressed)(nil), + } +} + +//* +//LeafOp represents the raw key-value data we wish to prove, and +//must be flexible to represent the internal transformation from +//the original key-value pairs into the basis hash, for many existing +//merkle trees. +// +//key and value are passed in. So that the signature of this operation is: +//leafOp(key, value) -> output +// +//To process this, first prehash the keys and values if needed (ANY means no hash in this case): +//hkey = prehashKey(key) +//hvalue = prehashValue(value) +// +//Then combine the bytes, and hash it +//output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) +type LeafOp struct { + Hash HashOp `protobuf:"varint,1,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` + PrehashKey HashOp `protobuf:"varint,2,opt,name=prehash_key,json=prehashKey,proto3,enum=ics23.HashOp" json:"prehash_key,omitempty"` + PrehashValue HashOp `protobuf:"varint,3,opt,name=prehash_value,json=prehashValue,proto3,enum=ics23.HashOp" json:"prehash_value,omitempty"` + Length LengthOp `protobuf:"varint,4,opt,name=length,proto3,enum=ics23.LengthOp" json:"length,omitempty"` + // prefix is a fixed bytes that may optionally be included at the beginning to differentiate + // a leaf node from an inner node. + Prefix []byte `protobuf:"bytes,5,opt,name=prefix,proto3" json:"prefix,omitempty"` +} + +func (m *LeafOp) Reset() { *m = LeafOp{} } +func (m *LeafOp) String() string { return proto.CompactTextString(m) } +func (*LeafOp) ProtoMessage() {} +func (*LeafOp) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{3} +} +func (m *LeafOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeafOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeafOp.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 *LeafOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeafOp.Merge(m, src) +} +func (m *LeafOp) XXX_Size() int { + return m.Size() +} +func (m *LeafOp) XXX_DiscardUnknown() { + xxx_messageInfo_LeafOp.DiscardUnknown(m) +} + +var xxx_messageInfo_LeafOp proto.InternalMessageInfo + +func (m *LeafOp) GetHash() HashOp { + if m != nil { + return m.Hash + } + return HashOp_NO_HASH +} + +func (m *LeafOp) GetPrehashKey() HashOp { + if m != nil { + return m.PrehashKey + } + return HashOp_NO_HASH +} + +func (m *LeafOp) GetPrehashValue() HashOp { + if m != nil { + return m.PrehashValue + } + return HashOp_NO_HASH +} + +func (m *LeafOp) GetLength() LengthOp { + if m != nil { + return m.Length + } + return LengthOp_NO_PREFIX +} + +func (m *LeafOp) GetPrefix() []byte { + if m != nil { + return m.Prefix + } + return nil +} + +//* +//InnerOp represents a merkle-proof step that is not a leaf. +//It represents concatenating two children and hashing them to provide the next result. +// +//The result of the previous step is passed in, so the signature of this op is: +//innerOp(child) -> output +// +//The result of applying InnerOp should be: +//output = op.hash(op.prefix || child || op.suffix) +// +//where the || operator is concatenation of binary data, +//and child is the result of hashing all the tree below this step. +// +//Any special data, like prepending child with the length, or prepending the entire operation with +//some value to differentiate from leaf nodes, should be included in prefix and suffix. +//If either of prefix or suffix is empty, we just treat it as an empty string +type InnerOp struct { + Hash HashOp `protobuf:"varint,1,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` + Prefix []byte `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` + Suffix []byte `protobuf:"bytes,3,opt,name=suffix,proto3" json:"suffix,omitempty"` +} + +func (m *InnerOp) Reset() { *m = InnerOp{} } +func (m *InnerOp) String() string { return proto.CompactTextString(m) } +func (*InnerOp) ProtoMessage() {} +func (*InnerOp) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{4} +} +func (m *InnerOp) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InnerOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InnerOp.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 *InnerOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_InnerOp.Merge(m, src) +} +func (m *InnerOp) XXX_Size() int { + return m.Size() +} +func (m *InnerOp) XXX_DiscardUnknown() { + xxx_messageInfo_InnerOp.DiscardUnknown(m) +} + +var xxx_messageInfo_InnerOp proto.InternalMessageInfo + +func (m *InnerOp) GetHash() HashOp { + if m != nil { + return m.Hash + } + return HashOp_NO_HASH +} + +func (m *InnerOp) GetPrefix() []byte { + if m != nil { + return m.Prefix + } + return nil +} + +func (m *InnerOp) GetSuffix() []byte { + if m != nil { + return m.Suffix + } + return nil +} + +//* +//ProofSpec defines what the expected parameters are for a given proof type. +//This can be stored in the client and used to validate any incoming proofs. +// +//verify(ProofSpec, Proof) -> Proof | Error +// +//As demonstrated in tests, if we don't fix the algorithm used to calculate the +//LeafHash for a given tree, there are many possible key-value pairs that can +//generate a given hash (by interpretting the preimage differently). +//We need this for proper security, requires client knows a priori what +//tree format server uses. But not in code, rather a configuration object. +type ProofSpec struct { + // any field in the ExistenceProof must be the same as in this spec. + // except Prefix, which is just the first bytes of prefix (spec can be longer) + LeafSpec *LeafOp `protobuf:"bytes,1,opt,name=leaf_spec,json=leafSpec,proto3" json:"leaf_spec,omitempty"` + InnerSpec *InnerSpec `protobuf:"bytes,2,opt,name=inner_spec,json=innerSpec,proto3" json:"inner_spec,omitempty"` + // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) + MaxDepth int32 `protobuf:"varint,3,opt,name=max_depth,json=maxDepth,proto3" json:"max_depth,omitempty"` + // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) + MinDepth int32 `protobuf:"varint,4,opt,name=min_depth,json=minDepth,proto3" json:"min_depth,omitempty"` +} + +func (m *ProofSpec) Reset() { *m = ProofSpec{} } +func (m *ProofSpec) String() string { return proto.CompactTextString(m) } +func (*ProofSpec) ProtoMessage() {} +func (*ProofSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{5} +} +func (m *ProofSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProofSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProofSpec.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 *ProofSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProofSpec.Merge(m, src) +} +func (m *ProofSpec) XXX_Size() int { + return m.Size() +} +func (m *ProofSpec) XXX_DiscardUnknown() { + xxx_messageInfo_ProofSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_ProofSpec proto.InternalMessageInfo + +func (m *ProofSpec) GetLeafSpec() *LeafOp { + if m != nil { + return m.LeafSpec + } + return nil +} + +func (m *ProofSpec) GetInnerSpec() *InnerSpec { + if m != nil { + return m.InnerSpec + } + return nil +} + +func (m *ProofSpec) GetMaxDepth() int32 { + if m != nil { + return m.MaxDepth + } + return 0 +} + +func (m *ProofSpec) GetMinDepth() int32 { + if m != nil { + return m.MinDepth + } + return 0 +} + +// +//InnerSpec contains all store-specific structure info to determine if two proofs from a +//given store are neighbors. +// +//This enables: +// +//isLeftMost(spec: InnerSpec, op: InnerOp) +//isRightMost(spec: InnerSpec, op: InnerOp) +//isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) +type InnerSpec struct { + // Child order is the ordering of the children node, must count from 0 + // iavl tree is [0, 1] (left then right) + // merk is [0, 2, 1] (left, right, here) + ChildOrder []int32 `protobuf:"varint,1,rep,packed,name=child_order,json=childOrder,proto3" json:"child_order,omitempty"` + ChildSize int32 `protobuf:"varint,2,opt,name=child_size,json=childSize,proto3" json:"child_size,omitempty"` + MinPrefixLength int32 `protobuf:"varint,3,opt,name=min_prefix_length,json=minPrefixLength,proto3" json:"min_prefix_length,omitempty"` + MaxPrefixLength int32 `protobuf:"varint,4,opt,name=max_prefix_length,json=maxPrefixLength,proto3" json:"max_prefix_length,omitempty"` + // empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) + EmptyChild []byte `protobuf:"bytes,5,opt,name=empty_child,json=emptyChild,proto3" json:"empty_child,omitempty"` + // hash is the algorithm that must be used for each InnerOp + Hash HashOp `protobuf:"varint,6,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` +} + +func (m *InnerSpec) Reset() { *m = InnerSpec{} } +func (m *InnerSpec) String() string { return proto.CompactTextString(m) } +func (*InnerSpec) ProtoMessage() {} +func (*InnerSpec) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{6} +} +func (m *InnerSpec) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *InnerSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_InnerSpec.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 *InnerSpec) XXX_Merge(src proto.Message) { + xxx_messageInfo_InnerSpec.Merge(m, src) +} +func (m *InnerSpec) XXX_Size() int { + return m.Size() +} +func (m *InnerSpec) XXX_DiscardUnknown() { + xxx_messageInfo_InnerSpec.DiscardUnknown(m) +} + +var xxx_messageInfo_InnerSpec proto.InternalMessageInfo + +func (m *InnerSpec) GetChildOrder() []int32 { + if m != nil { + return m.ChildOrder + } + return nil +} + +func (m *InnerSpec) GetChildSize() int32 { + if m != nil { + return m.ChildSize + } + return 0 +} + +func (m *InnerSpec) GetMinPrefixLength() int32 { + if m != nil { + return m.MinPrefixLength + } + return 0 +} + +func (m *InnerSpec) GetMaxPrefixLength() int32 { + if m != nil { + return m.MaxPrefixLength + } + return 0 +} + +func (m *InnerSpec) GetEmptyChild() []byte { + if m != nil { + return m.EmptyChild + } + return nil +} + +func (m *InnerSpec) GetHash() HashOp { + if m != nil { + return m.Hash + } + return HashOp_NO_HASH +} + +// +//BatchProof is a group of multiple proof types than can be compressed +type BatchProof struct { + Entries []*BatchEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` +} + +func (m *BatchProof) Reset() { *m = BatchProof{} } +func (m *BatchProof) String() string { return proto.CompactTextString(m) } +func (*BatchProof) ProtoMessage() {} +func (*BatchProof) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{7} +} +func (m *BatchProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchProof.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 *BatchProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchProof.Merge(m, src) +} +func (m *BatchProof) XXX_Size() int { + return m.Size() +} +func (m *BatchProof) XXX_DiscardUnknown() { + xxx_messageInfo_BatchProof.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchProof proto.InternalMessageInfo + +func (m *BatchProof) GetEntries() []*BatchEntry { + if m != nil { + return m.Entries + } + return nil +} + +// Use BatchEntry not CommitmentProof, to avoid recursion +type BatchEntry struct { + // Types that are valid to be assigned to Proof: + // *BatchEntry_Exist + // *BatchEntry_Nonexist + Proof isBatchEntry_Proof `protobuf_oneof:"proof"` +} + +func (m *BatchEntry) Reset() { *m = BatchEntry{} } +func (m *BatchEntry) String() string { return proto.CompactTextString(m) } +func (*BatchEntry) ProtoMessage() {} +func (*BatchEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{8} +} +func (m *BatchEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchEntry.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 *BatchEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchEntry.Merge(m, src) +} +func (m *BatchEntry) XXX_Size() int { + return m.Size() +} +func (m *BatchEntry) XXX_DiscardUnknown() { + xxx_messageInfo_BatchEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchEntry proto.InternalMessageInfo + +type isBatchEntry_Proof interface { + isBatchEntry_Proof() + MarshalTo([]byte) (int, error) + Size() int +} + +type BatchEntry_Exist struct { + Exist *ExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` +} +type BatchEntry_Nonexist struct { + Nonexist *NonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` +} + +func (*BatchEntry_Exist) isBatchEntry_Proof() {} +func (*BatchEntry_Nonexist) isBatchEntry_Proof() {} + +func (m *BatchEntry) GetProof() isBatchEntry_Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *BatchEntry) GetExist() *ExistenceProof { + if x, ok := m.GetProof().(*BatchEntry_Exist); ok { + return x.Exist + } + return nil +} + +func (m *BatchEntry) GetNonexist() *NonExistenceProof { + if x, ok := m.GetProof().(*BatchEntry_Nonexist); ok { + return x.Nonexist + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*BatchEntry) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*BatchEntry_Exist)(nil), + (*BatchEntry_Nonexist)(nil), + } +} + +type CompressedBatchProof struct { + Entries []*CompressedBatchEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` + LookupInners []*InnerOp `protobuf:"bytes,2,rep,name=lookup_inners,json=lookupInners,proto3" json:"lookup_inners,omitempty"` +} + +func (m *CompressedBatchProof) Reset() { *m = CompressedBatchProof{} } +func (m *CompressedBatchProof) String() string { return proto.CompactTextString(m) } +func (*CompressedBatchProof) ProtoMessage() {} +func (*CompressedBatchProof) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{9} +} +func (m *CompressedBatchProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CompressedBatchProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CompressedBatchProof.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 *CompressedBatchProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompressedBatchProof.Merge(m, src) +} +func (m *CompressedBatchProof) XXX_Size() int { + return m.Size() +} +func (m *CompressedBatchProof) XXX_DiscardUnknown() { + xxx_messageInfo_CompressedBatchProof.DiscardUnknown(m) +} + +var xxx_messageInfo_CompressedBatchProof proto.InternalMessageInfo + +func (m *CompressedBatchProof) GetEntries() []*CompressedBatchEntry { + if m != nil { + return m.Entries + } + return nil +} + +func (m *CompressedBatchProof) GetLookupInners() []*InnerOp { + if m != nil { + return m.LookupInners + } + return nil +} + +// Use BatchEntry not CommitmentProof, to avoid recursion +type CompressedBatchEntry struct { + // Types that are valid to be assigned to Proof: + // *CompressedBatchEntry_Exist + // *CompressedBatchEntry_Nonexist + Proof isCompressedBatchEntry_Proof `protobuf_oneof:"proof"` +} + +func (m *CompressedBatchEntry) Reset() { *m = CompressedBatchEntry{} } +func (m *CompressedBatchEntry) String() string { return proto.CompactTextString(m) } +func (*CompressedBatchEntry) ProtoMessage() {} +func (*CompressedBatchEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{10} +} +func (m *CompressedBatchEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CompressedBatchEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CompressedBatchEntry.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 *CompressedBatchEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompressedBatchEntry.Merge(m, src) +} +func (m *CompressedBatchEntry) XXX_Size() int { + return m.Size() +} +func (m *CompressedBatchEntry) XXX_DiscardUnknown() { + xxx_messageInfo_CompressedBatchEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_CompressedBatchEntry proto.InternalMessageInfo + +type isCompressedBatchEntry_Proof interface { + isCompressedBatchEntry_Proof() + MarshalTo([]byte) (int, error) + Size() int +} + +type CompressedBatchEntry_Exist struct { + Exist *CompressedExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` +} +type CompressedBatchEntry_Nonexist struct { + Nonexist *CompressedNonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` +} + +func (*CompressedBatchEntry_Exist) isCompressedBatchEntry_Proof() {} +func (*CompressedBatchEntry_Nonexist) isCompressedBatchEntry_Proof() {} + +func (m *CompressedBatchEntry) GetProof() isCompressedBatchEntry_Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *CompressedBatchEntry) GetExist() *CompressedExistenceProof { + if x, ok := m.GetProof().(*CompressedBatchEntry_Exist); ok { + return x.Exist + } + return nil +} + +func (m *CompressedBatchEntry) GetNonexist() *CompressedNonExistenceProof { + if x, ok := m.GetProof().(*CompressedBatchEntry_Nonexist); ok { + return x.Nonexist + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*CompressedBatchEntry) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*CompressedBatchEntry_Exist)(nil), + (*CompressedBatchEntry_Nonexist)(nil), + } +} + +type CompressedExistenceProof struct { + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Leaf *LeafOp `protobuf:"bytes,3,opt,name=leaf,proto3" json:"leaf,omitempty"` + // these are indexes into the lookup_inners table in CompressedBatchProof + Path []int32 `protobuf:"varint,4,rep,packed,name=path,proto3" json:"path,omitempty"` +} + +func (m *CompressedExistenceProof) Reset() { *m = CompressedExistenceProof{} } +func (m *CompressedExistenceProof) String() string { return proto.CompactTextString(m) } +func (*CompressedExistenceProof) ProtoMessage() {} +func (*CompressedExistenceProof) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{11} +} +func (m *CompressedExistenceProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CompressedExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CompressedExistenceProof.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 *CompressedExistenceProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompressedExistenceProof.Merge(m, src) +} +func (m *CompressedExistenceProof) XXX_Size() int { + return m.Size() +} +func (m *CompressedExistenceProof) XXX_DiscardUnknown() { + xxx_messageInfo_CompressedExistenceProof.DiscardUnknown(m) +} + +var xxx_messageInfo_CompressedExistenceProof proto.InternalMessageInfo + +func (m *CompressedExistenceProof) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *CompressedExistenceProof) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *CompressedExistenceProof) GetLeaf() *LeafOp { + if m != nil { + return m.Leaf + } + return nil +} + +func (m *CompressedExistenceProof) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +type CompressedNonExistenceProof struct { + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Left *CompressedExistenceProof `protobuf:"bytes,2,opt,name=left,proto3" json:"left,omitempty"` + Right *CompressedExistenceProof `protobuf:"bytes,3,opt,name=right,proto3" json:"right,omitempty"` +} + +func (m *CompressedNonExistenceProof) Reset() { *m = CompressedNonExistenceProof{} } +func (m *CompressedNonExistenceProof) String() string { return proto.CompactTextString(m) } +func (*CompressedNonExistenceProof) ProtoMessage() {} +func (*CompressedNonExistenceProof) Descriptor() ([]byte, []int) { + return fileDescriptor_b2da35c4bc0b23b9, []int{12} +} +func (m *CompressedNonExistenceProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CompressedNonExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CompressedNonExistenceProof.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 *CompressedNonExistenceProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompressedNonExistenceProof.Merge(m, src) +} +func (m *CompressedNonExistenceProof) XXX_Size() int { + return m.Size() +} +func (m *CompressedNonExistenceProof) XXX_DiscardUnknown() { + xxx_messageInfo_CompressedNonExistenceProof.DiscardUnknown(m) +} + +var xxx_messageInfo_CompressedNonExistenceProof proto.InternalMessageInfo + +func (m *CompressedNonExistenceProof) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *CompressedNonExistenceProof) GetLeft() *CompressedExistenceProof { + if m != nil { + return m.Left + } + return nil +} + +func (m *CompressedNonExistenceProof) GetRight() *CompressedExistenceProof { + if m != nil { + return m.Right + } + return nil +} + +func init() { + proto.RegisterEnum("ics23.HashOp", HashOp_name, HashOp_value) + proto.RegisterEnum("ics23.LengthOp", LengthOp_name, LengthOp_value) + proto.RegisterType((*ExistenceProof)(nil), "ics23.ExistenceProof") + proto.RegisterType((*NonExistenceProof)(nil), "ics23.NonExistenceProof") + proto.RegisterType((*CommitmentProof)(nil), "ics23.CommitmentProof") + proto.RegisterType((*LeafOp)(nil), "ics23.LeafOp") + proto.RegisterType((*InnerOp)(nil), "ics23.InnerOp") + proto.RegisterType((*ProofSpec)(nil), "ics23.ProofSpec") + proto.RegisterType((*InnerSpec)(nil), "ics23.InnerSpec") + proto.RegisterType((*BatchProof)(nil), "ics23.BatchProof") + proto.RegisterType((*BatchEntry)(nil), "ics23.BatchEntry") + proto.RegisterType((*CompressedBatchProof)(nil), "ics23.CompressedBatchProof") + proto.RegisterType((*CompressedBatchEntry)(nil), "ics23.CompressedBatchEntry") + proto.RegisterType((*CompressedExistenceProof)(nil), "ics23.CompressedExistenceProof") + proto.RegisterType((*CompressedNonExistenceProof)(nil), "ics23.CompressedNonExistenceProof") +} + +func init() { proto.RegisterFile("confio/proofs.proto", fileDescriptor_b2da35c4bc0b23b9) } + +var fileDescriptor_b2da35c4bc0b23b9 = []byte{ + // 961 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x4b, 0x6f, 0xeb, 0x44, + 0x14, 0xc7, 0xe3, 0x24, 0xce, 0xe3, 0xa4, 0x0f, 0x77, 0x28, 0xc8, 0xa2, 0x22, 0x2d, 0xde, 0xd0, + 0xdb, 0x2b, 0x52, 0x6e, 0xd2, 0x06, 0xb1, 0x40, 0xa2, 0x49, 0x7d, 0x89, 0xd5, 0xd2, 0x84, 0x49, + 0xee, 0xd5, 0x05, 0x21, 0x59, 0xae, 0x3b, 0x69, 0xac, 0x1b, 0x3f, 0x64, 0xbb, 0x28, 0xb9, 0x02, + 0x21, 0xf1, 0x09, 0x58, 0xc3, 0x8e, 0x2d, 0x5f, 0x84, 0x65, 0x97, 0x2c, 0x51, 0xbb, 0x60, 0xc1, + 0x97, 0x40, 0xf3, 0x88, 0x9b, 0x34, 0x09, 0xed, 0x02, 0xb1, 0x9b, 0xf9, 0x9f, 0xdf, 0x99, 0x39, + 0x73, 0xce, 0x19, 0x8f, 0xe1, 0x2d, 0xdb, 0xf7, 0xfa, 0x8e, 0xbf, 0x1f, 0x84, 0xbe, 0xdf, 0x8f, + 0x2a, 0x41, 0xe8, 0xc7, 0x3e, 0x92, 0x1d, 0x3b, 0xaa, 0xd6, 0xb4, 0x1f, 0x60, 0x4d, 0x1f, 0x39, + 0x51, 0x4c, 0x3c, 0x9b, 0x74, 0xa8, 0x1d, 0x29, 0x90, 0x79, 0x4d, 0xc6, 0xaa, 0xb4, 0x23, 0xed, + 0xae, 0x60, 0x3a, 0x44, 0x9b, 0x20, 0x7f, 0x6b, 0x0d, 0xaf, 0x88, 0x9a, 0x66, 0x1a, 0x9f, 0xa0, + 0xf7, 0x21, 0x3b, 0x24, 0x56, 0x5f, 0xcd, 0xec, 0x48, 0xbb, 0xa5, 0xea, 0x6a, 0x85, 0xad, 0x57, + 0x39, 0x25, 0x56, 0xbf, 0x1d, 0x60, 0x66, 0x42, 0x1a, 0x64, 0x03, 0x2b, 0x1e, 0xa8, 0xd9, 0x9d, + 0xcc, 0x6e, 0xa9, 0xba, 0x26, 0x10, 0xc3, 0xf3, 0x48, 0x48, 0x19, 0x6a, 0xd3, 0xbe, 0x87, 0x8d, + 0x33, 0xdf, 0x7b, 0x30, 0x86, 0x27, 0x74, 0xb7, 0x7e, 0xcc, 0x42, 0x28, 0x55, 0xdf, 0x16, 0x4b, + 0xcd, 0xba, 0x61, 0x86, 0xa0, 0xa7, 0x20, 0x87, 0xce, 0xe5, 0x20, 0x16, 0x91, 0x2d, 0x61, 0x39, + 0xa3, 0xfd, 0x2d, 0xc1, 0x7a, 0xd3, 0x77, 0x5d, 0x27, 0x76, 0x89, 0x17, 0xf3, 0xdd, 0x3f, 0x04, + 0x99, 0x50, 0x98, 0xed, 0xbf, 0x6c, 0x81, 0x56, 0x0a, 0x73, 0x0a, 0xd5, 0xa1, 0xe0, 0xf9, 0x1e, + 0xf7, 0xe0, 0xe1, 0xa9, 0xc2, 0x63, 0xee, 0x60, 0xad, 0x14, 0x4e, 0x58, 0xf4, 0x04, 0xe4, 0x73, + 0x2b, 0xb6, 0x07, 0x22, 0xce, 0x0d, 0xe1, 0xd4, 0xa0, 0x5a, 0xb2, 0x05, 0x23, 0xd0, 0xa7, 0x00, + 0xb6, 0xef, 0x06, 0x21, 0x89, 0x22, 0x72, 0xa1, 0x66, 0x19, 0xbf, 0x25, 0xf8, 0x66, 0x62, 0x98, + 0xf1, 0x9c, 0x72, 0x68, 0xe4, 0x41, 0x66, 0xb5, 0xd7, 0xae, 0x25, 0xc8, 0xf1, 0x0a, 0xd1, 0xf2, + 0x0d, 0xac, 0x68, 0xc0, 0xce, 0xb8, 0x96, 0x94, 0xaf, 0x65, 0x45, 0x03, 0x5a, 0x1a, 0x6a, 0x42, + 0x15, 0x28, 0x05, 0x21, 0xa1, 0x43, 0x93, 0x56, 0x23, 0xbd, 0x88, 0x04, 0x41, 0x9c, 0x90, 0x31, + 0xaa, 0xc2, 0xea, 0x84, 0xe7, 0xfd, 0x92, 0x59, 0xe4, 0xb1, 0x22, 0x98, 0x97, 0xac, 0x8b, 0x3e, + 0x80, 0xdc, 0x90, 0x78, 0x97, 0xac, 0x49, 0x28, 0xbc, 0x9e, 0xf4, 0x11, 0x15, 0xdb, 0x01, 0x16, + 0x66, 0xf4, 0x0e, 0xe4, 0x82, 0x90, 0xf4, 0x9d, 0x91, 0x2a, 0xb3, 0xae, 0x10, 0x33, 0xed, 0x1b, + 0xc8, 0x8b, 0x86, 0x7a, 0xcc, 0x91, 0xee, 0x56, 0x49, 0x4f, 0xaf, 0x42, 0xf5, 0xe8, 0xaa, 0x4f, + 0xf5, 0x0c, 0xd7, 0xf9, 0x4c, 0xfb, 0x55, 0x82, 0x22, 0xcb, 0x68, 0x37, 0x20, 0x36, 0xda, 0x83, + 0x22, 0xed, 0x6b, 0x33, 0x0a, 0x88, 0x2d, 0x9a, 0xe3, 0x5e, 0xdf, 0x17, 0xa8, 0x9d, 0xb1, 0xfb, + 0x00, 0x0e, 0x8d, 0x8b, 0xc3, 0xbc, 0x2f, 0x94, 0xe9, 0x1b, 0x40, 0x29, 0x5c, 0x74, 0x26, 0x43, + 0xb4, 0x05, 0x45, 0xd7, 0x1a, 0x99, 0x17, 0x24, 0x88, 0x79, 0x4b, 0xc8, 0xb8, 0xe0, 0x5a, 0xa3, + 0x63, 0x3a, 0x67, 0x46, 0xc7, 0x13, 0xc6, 0xac, 0x30, 0x3a, 0x1e, 0x33, 0x6a, 0x7f, 0x49, 0x50, + 0x4c, 0x96, 0x44, 0xdb, 0x50, 0xb2, 0x07, 0xce, 0xf0, 0xc2, 0xf4, 0xc3, 0x0b, 0x12, 0xaa, 0xd2, + 0x4e, 0x66, 0x57, 0xc6, 0xc0, 0xa4, 0x36, 0x55, 0xd0, 0x7b, 0xc0, 0x67, 0x66, 0xe4, 0xbc, 0xe1, + 0x77, 0x5a, 0xc6, 0x45, 0xa6, 0x74, 0x9d, 0x37, 0x04, 0xed, 0xc1, 0x06, 0xdd, 0x8a, 0x27, 0xc6, + 0x14, 0xc5, 0xe1, 0xf1, 0xac, 0xbb, 0x8e, 0xd7, 0x61, 0x3a, 0x2f, 0x0f, 0x63, 0xad, 0xd1, 0x3d, + 0x36, 0x2b, 0x58, 0x6b, 0x34, 0xc3, 0x6e, 0x43, 0x89, 0xb8, 0x41, 0x3c, 0x36, 0xd9, 0x56, 0xa2, + 0x8a, 0xc0, 0xa4, 0x26, 0x55, 0x92, 0xf2, 0xe5, 0x96, 0x96, 0x4f, 0xfb, 0x04, 0xe0, 0xae, 0xc9, + 0xd1, 0x53, 0xc8, 0x13, 0x2f, 0x0e, 0x1d, 0x12, 0xb1, 0x53, 0xde, 0xbb, 0x42, 0xba, 0x17, 0x87, + 0x63, 0x3c, 0x21, 0xb4, 0xef, 0x84, 0x2b, 0x93, 0xff, 0xa7, 0x2b, 0x7e, 0x77, 0xf1, 0x7e, 0x94, + 0x60, 0x73, 0xd1, 0x45, 0x45, 0x87, 0xf7, 0xcf, 0xb0, 0xe4, 0x5a, 0xcf, 0x9e, 0x06, 0xd5, 0x60, + 0x75, 0xe8, 0xfb, 0xaf, 0xaf, 0x02, 0x93, 0x35, 0x50, 0xa4, 0xa6, 0x17, 0x7e, 0x62, 0x57, 0x38, + 0xc4, 0xa6, 0x91, 0xf6, 0xf3, 0x7c, 0x10, 0x3c, 0x1b, 0x1f, 0xcf, 0x66, 0x63, 0x7b, 0x2e, 0x84, + 0x65, 0x79, 0xf9, 0x6c, 0x2e, 0x2f, 0xda, 0x9c, 0xef, 0x23, 0x33, 0x34, 0x06, 0x75, 0xd9, 0x7e, + 0xff, 0xe5, 0x93, 0x84, 0xa6, 0x9e, 0x24, 0x59, 0x3c, 0x41, 0xbf, 0x48, 0xb0, 0xf5, 0x2f, 0xf1, + 0x2e, 0xd8, 0xbe, 0x36, 0xf3, 0x1a, 0x3d, 0x94, 0x2f, 0xf1, 0x2e, 0x1d, 0xce, 0xbe, 0x4b, 0x0f, + 0x7a, 0x71, 0x7a, 0xef, 0x05, 0xe4, 0xf8, 0x1d, 0x40, 0x25, 0xc8, 0x9f, 0xb5, 0xcd, 0xd6, 0x51, + 0xb7, 0xa5, 0xa4, 0x10, 0x40, 0xae, 0xdb, 0x3a, 0xaa, 0x1e, 0xd6, 0x15, 0x49, 0x8c, 0x0f, 0x9f, + 0x55, 0x95, 0x34, 0x1d, 0x9f, 0xe8, 0xcd, 0xe6, 0xd1, 0x89, 0x92, 0x41, 0xab, 0x50, 0xc4, 0x46, + 0x47, 0xff, 0xe2, 0xf8, 0x59, 0xfd, 0x23, 0x25, 0x4b, 0xfd, 0x1b, 0x46, 0xaf, 0xd9, 0x36, 0xce, + 0x14, 0x79, 0xef, 0x37, 0x09, 0x0a, 0x93, 0x8f, 0x2c, 0x05, 0xcf, 0xda, 0x66, 0x07, 0xeb, 0xcf, + 0x8d, 0x57, 0x4a, 0x8a, 0x4e, 0x5f, 0x1e, 0x61, 0xb3, 0x83, 0xdb, 0xbd, 0xb6, 0x22, 0x51, 0x3f, + 0x3a, 0xc5, 0xa7, 0x1d, 0x25, 0x8d, 0xd6, 0xa1, 0xf4, 0xdc, 0x78, 0xa5, 0x1f, 0xd7, 0xaa, 0x66, + 0xc3, 0xf8, 0x5c, 0xc9, 0x20, 0x04, 0x6b, 0x13, 0xe1, 0xd4, 0xe8, 0xf5, 0x4e, 0x75, 0x25, 0x9b, + 0x40, 0xf5, 0x03, 0x06, 0xc9, 0x09, 0x54, 0x3f, 0x98, 0x40, 0x39, 0xb4, 0x09, 0x0a, 0xd6, 0xbf, + 0x7c, 0x61, 0x60, 0xdd, 0xa4, 0x8b, 0x7d, 0xd5, 0xd3, 0xbb, 0x4a, 0x7e, 0x5a, 0xa5, 0xde, 0x4c, + 0x2d, 0x34, 0x0e, 0x7e, 0xbf, 0x29, 0x4b, 0xd7, 0x37, 0x65, 0xe9, 0xcf, 0x9b, 0xb2, 0xf4, 0xd3, + 0x6d, 0x39, 0x75, 0x7d, 0x5b, 0x4e, 0xfd, 0x71, 0x5b, 0x4e, 0x7d, 0xfd, 0xee, 0xa5, 0x13, 0x0f, + 0xae, 0xce, 0x2b, 0xb6, 0xef, 0xee, 0x8b, 0xff, 0x1c, 0x96, 0xd7, 0xfd, 0x4b, 0xff, 0x3c, 0xc7, + 0x7e, 0x75, 0x6a, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x80, 0x96, 0x1f, 0xf6, 0x01, 0x09, 0x00, + 0x00, +} + +func (m *ExistenceProof) 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 *ExistenceProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Path) > 0 { + for iNdEx := len(m.Path) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Path[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.Leaf != nil { + { + size, err := m.Leaf.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NonExistenceProof) 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 *NonExistenceProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NonExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Right != nil { + { + size, err := m.Right.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Left != nil { + { + size, err := m.Left.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CommitmentProof) 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 *CommitmentProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitmentProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proof != nil { + { + size := m.Proof.Size() + i -= size + if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *CommitmentProof_Exist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitmentProof_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Exist != nil { + { + size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *CommitmentProof_Nonexist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitmentProof_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Nonexist != nil { + { + size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *CommitmentProof_Batch) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitmentProof_Batch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Batch != nil { + { + size, err := m.Batch.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *CommitmentProof_Compressed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommitmentProof_Compressed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Compressed != nil { + { + size, err := m.Compressed.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func (m *LeafOp) 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 *LeafOp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeafOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Prefix) > 0 { + i -= len(m.Prefix) + copy(dAtA[i:], m.Prefix) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Prefix))) + i-- + dAtA[i] = 0x2a + } + if m.Length != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.Length)) + i-- + dAtA[i] = 0x20 + } + if m.PrehashValue != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.PrehashValue)) + i-- + dAtA[i] = 0x18 + } + if m.PrehashKey != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.PrehashKey)) + i-- + dAtA[i] = 0x10 + } + if m.Hash != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *InnerOp) 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 *InnerOp) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InnerOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Suffix) > 0 { + i -= len(m.Suffix) + copy(dAtA[i:], m.Suffix) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Suffix))) + i-- + dAtA[i] = 0x1a + } + if len(m.Prefix) > 0 { + i -= len(m.Prefix) + copy(dAtA[i:], m.Prefix) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Prefix))) + i-- + dAtA[i] = 0x12 + } + if m.Hash != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ProofSpec) 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 *ProofSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProofSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinDepth != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.MinDepth)) + i-- + dAtA[i] = 0x20 + } + if m.MaxDepth != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.MaxDepth)) + i-- + dAtA[i] = 0x18 + } + if m.InnerSpec != nil { + { + size, err := m.InnerSpec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.LeafSpec != nil { + { + size, err := m.LeafSpec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *InnerSpec) 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 *InnerSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *InnerSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Hash != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) + i-- + dAtA[i] = 0x30 + } + if len(m.EmptyChild) > 0 { + i -= len(m.EmptyChild) + copy(dAtA[i:], m.EmptyChild) + i = encodeVarintProofs(dAtA, i, uint64(len(m.EmptyChild))) + i-- + dAtA[i] = 0x2a + } + if m.MaxPrefixLength != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.MaxPrefixLength)) + i-- + dAtA[i] = 0x20 + } + if m.MinPrefixLength != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.MinPrefixLength)) + i-- + dAtA[i] = 0x18 + } + if m.ChildSize != 0 { + i = encodeVarintProofs(dAtA, i, uint64(m.ChildSize)) + i-- + dAtA[i] = 0x10 + } + if len(m.ChildOrder) > 0 { + dAtA11 := make([]byte, len(m.ChildOrder)*10) + var j10 int + for _, num1 := range m.ChildOrder { + num := uint64(num1) + for num >= 1<<7 { + dAtA11[j10] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j10++ + } + dAtA11[j10] = uint8(num) + j10++ + } + i -= j10 + copy(dAtA[i:], dAtA11[:j10]) + i = encodeVarintProofs(dAtA, i, uint64(j10)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BatchProof) 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 *BatchProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *BatchEntry) 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 *BatchEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proof != nil { + { + size := m.Proof.Size() + i -= size + if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *BatchEntry_Exist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchEntry_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Exist != nil { + { + size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *BatchEntry_Nonexist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchEntry_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Nonexist != nil { + { + size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *CompressedBatchProof) 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 *CompressedBatchProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompressedBatchProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.LookupInners) > 0 { + for iNdEx := len(m.LookupInners) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LookupInners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *CompressedBatchEntry) 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 *CompressedBatchEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompressedBatchEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proof != nil { + { + size := m.Proof.Size() + i -= size + if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *CompressedBatchEntry_Exist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompressedBatchEntry_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Exist != nil { + { + size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *CompressedBatchEntry_Nonexist) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompressedBatchEntry_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Nonexist != nil { + { + size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *CompressedExistenceProof) 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 *CompressedExistenceProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompressedExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Path) > 0 { + dAtA17 := make([]byte, len(m.Path)*10) + var j16 int + for _, num1 := range m.Path { + num := uint64(num1) + for num >= 1<<7 { + dAtA17[j16] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j16++ + } + dAtA17[j16] = uint8(num) + j16++ + } + i -= j16 + copy(dAtA[i:], dAtA17[:j16]) + i = encodeVarintProofs(dAtA, i, uint64(j16)) + i-- + dAtA[i] = 0x22 + } + if m.Leaf != nil { + { + size, err := m.Leaf.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CompressedNonExistenceProof) 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 *CompressedNonExistenceProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompressedNonExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Right != nil { + { + size, err := m.Right.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.Left != nil { + { + size, err := m.Left.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProofs(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintProofs(dAtA []byte, offset int, v uint64) int { + offset -= sovProofs(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ExistenceProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + if m.Leaf != nil { + l = m.Leaf.Size() + n += 1 + l + sovProofs(uint64(l)) + } + if len(m.Path) > 0 { + for _, e := range m.Path { + l = e.Size() + n += 1 + l + sovProofs(uint64(l)) + } + } + return n +} + +func (m *NonExistenceProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + if m.Left != nil { + l = m.Left.Size() + n += 1 + l + sovProofs(uint64(l)) + } + if m.Right != nil { + l = m.Right.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} + +func (m *CommitmentProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proof != nil { + n += m.Proof.Size() + } + return n +} + +func (m *CommitmentProof_Exist) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Exist != nil { + l = m.Exist.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *CommitmentProof_Nonexist) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Nonexist != nil { + l = m.Nonexist.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *CommitmentProof_Batch) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Batch != nil { + l = m.Batch.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *CommitmentProof_Compressed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Compressed != nil { + l = m.Compressed.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *LeafOp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Hash != 0 { + n += 1 + sovProofs(uint64(m.Hash)) + } + if m.PrehashKey != 0 { + n += 1 + sovProofs(uint64(m.PrehashKey)) + } + if m.PrehashValue != 0 { + n += 1 + sovProofs(uint64(m.PrehashValue)) + } + if m.Length != 0 { + n += 1 + sovProofs(uint64(m.Length)) + } + l = len(m.Prefix) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + return n +} + +func (m *InnerOp) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Hash != 0 { + n += 1 + sovProofs(uint64(m.Hash)) + } + l = len(m.Prefix) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + l = len(m.Suffix) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + return n +} + +func (m *ProofSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LeafSpec != nil { + l = m.LeafSpec.Size() + n += 1 + l + sovProofs(uint64(l)) + } + if m.InnerSpec != nil { + l = m.InnerSpec.Size() + n += 1 + l + sovProofs(uint64(l)) + } + if m.MaxDepth != 0 { + n += 1 + sovProofs(uint64(m.MaxDepth)) + } + if m.MinDepth != 0 { + n += 1 + sovProofs(uint64(m.MinDepth)) + } + return n +} + +func (m *InnerSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ChildOrder) > 0 { + l = 0 + for _, e := range m.ChildOrder { + l += sovProofs(uint64(e)) + } + n += 1 + sovProofs(uint64(l)) + l + } + if m.ChildSize != 0 { + n += 1 + sovProofs(uint64(m.ChildSize)) + } + if m.MinPrefixLength != 0 { + n += 1 + sovProofs(uint64(m.MinPrefixLength)) + } + if m.MaxPrefixLength != 0 { + n += 1 + sovProofs(uint64(m.MaxPrefixLength)) + } + l = len(m.EmptyChild) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + if m.Hash != 0 { + n += 1 + sovProofs(uint64(m.Hash)) + } + return n +} + +func (m *BatchProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovProofs(uint64(l)) + } + } + return n +} + +func (m *BatchEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proof != nil { + n += m.Proof.Size() + } + return n +} + +func (m *BatchEntry_Exist) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Exist != nil { + l = m.Exist.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *BatchEntry_Nonexist) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Nonexist != nil { + l = m.Nonexist.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *CompressedBatchProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovProofs(uint64(l)) + } + } + if len(m.LookupInners) > 0 { + for _, e := range m.LookupInners { + l = e.Size() + n += 1 + l + sovProofs(uint64(l)) + } + } + return n +} + +func (m *CompressedBatchEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Proof != nil { + n += m.Proof.Size() + } + return n +} + +func (m *CompressedBatchEntry_Exist) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Exist != nil { + l = m.Exist.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *CompressedBatchEntry_Nonexist) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Nonexist != nil { + l = m.Nonexist.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} +func (m *CompressedExistenceProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + if m.Leaf != nil { + l = m.Leaf.Size() + n += 1 + l + sovProofs(uint64(l)) + } + if len(m.Path) > 0 { + l = 0 + for _, e := range m.Path { + l += sovProofs(uint64(e)) + } + n += 1 + sovProofs(uint64(l)) + l + } + return n +} + +func (m *CompressedNonExistenceProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovProofs(uint64(l)) + } + if m.Left != nil { + l = m.Left.Size() + n += 1 + l + sovProofs(uint64(l)) + } + if m.Right != nil { + l = m.Right.Size() + n += 1 + l + sovProofs(uint64(l)) + } + return n +} + +func sovProofs(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozProofs(x uint64) (n int) { + return sovProofs(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ExistenceProof) 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 ErrIntOverflowProofs + } + 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: ExistenceProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leaf", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Leaf == nil { + m.Leaf = &LeafOp{} + } + if err := m.Leaf.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Path = append(m.Path, &InnerOp{}) + if err := m.Path[len(m.Path)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NonExistenceProof) 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 ErrIntOverflowProofs + } + 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: NonExistenceProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NonExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Left == nil { + m.Left = &ExistenceProof{} + } + if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Right == nil { + m.Right = &ExistenceProof{} + } + if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommitmentProof) 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 ErrIntOverflowProofs + } + 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: CommitmentProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommitmentProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ExistenceProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &CommitmentProof_Exist{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &NonExistenceProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &CommitmentProof_Nonexist{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Batch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &BatchProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &CommitmentProof_Batch{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Compressed", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &CompressedBatchProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &CommitmentProof_Compressed{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LeafOp) 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 ErrIntOverflowProofs + } + 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: LeafOp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LeafOp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + m.Hash = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Hash |= HashOp(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrehashKey", wireType) + } + m.PrehashKey = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrehashKey |= HashOp(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrehashValue", wireType) + } + m.PrehashValue = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrehashValue |= HashOp(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) + } + m.Length = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Length |= LengthOp(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prefix = append(m.Prefix[:0], dAtA[iNdEx:postIndex]...) + if m.Prefix == nil { + m.Prefix = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *InnerOp) 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 ErrIntOverflowProofs + } + 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: InnerOp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InnerOp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + m.Hash = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Hash |= HashOp(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prefix = append(m.Prefix[:0], dAtA[iNdEx:postIndex]...) + if m.Prefix == nil { + m.Prefix = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Suffix", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Suffix = append(m.Suffix[:0], dAtA[iNdEx:postIndex]...) + if m.Suffix == nil { + m.Suffix = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProofSpec) 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 ErrIntOverflowProofs + } + 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: ProofSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProofSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeafSpec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LeafSpec == nil { + m.LeafSpec = &LeafOp{} + } + if err := m.LeafSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InnerSpec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InnerSpec == nil { + m.InnerSpec = &InnerSpec{} + } + if err := m.InnerSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDepth", wireType) + } + m.MaxDepth = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxDepth |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepth", wireType) + } + m.MinDepth = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinDepth |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *InnerSpec) 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 ErrIntOverflowProofs + } + 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: InnerSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: InnerSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ChildOrder = append(m.ChildOrder, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.ChildOrder) == 0 { + m.ChildOrder = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ChildOrder = append(m.ChildOrder, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field ChildOrder", wireType) + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChildSize", wireType) + } + m.ChildSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChildSize |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinPrefixLength", wireType) + } + m.MinPrefixLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinPrefixLength |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxPrefixLength", wireType) + } + m.MaxPrefixLength = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxPrefixLength |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EmptyChild", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.EmptyChild = append(m.EmptyChild[:0], dAtA[iNdEx:postIndex]...) + if m.EmptyChild == nil { + m.EmptyChild = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + m.Hash = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Hash |= HashOp(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchProof) 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 ErrIntOverflowProofs + } + 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: BatchProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, &BatchEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchEntry) 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 ErrIntOverflowProofs + } + 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: BatchEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &ExistenceProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &BatchEntry_Exist{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &NonExistenceProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &BatchEntry_Nonexist{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompressedBatchProof) 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 ErrIntOverflowProofs + } + 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: CompressedBatchProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompressedBatchProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, &CompressedBatchEntry{}) + if err := m.Entries[len(m.Entries)-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 LookupInners", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LookupInners = append(m.LookupInners, &InnerOp{}) + if err := m.LookupInners[len(m.LookupInners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompressedBatchEntry) 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 ErrIntOverflowProofs + } + 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: CompressedBatchEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompressedBatchEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &CompressedExistenceProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &CompressedBatchEntry_Exist{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &CompressedNonExistenceProof{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Proof = &CompressedBatchEntry_Nonexist{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompressedExistenceProof) 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 ErrIntOverflowProofs + } + 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: CompressedExistenceProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompressedExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) + if m.Value == nil { + m.Value = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leaf", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Leaf == nil { + m.Leaf = &LeafOp{} + } + if err := m.Leaf.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Path = append(m.Path, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Path) == 0 { + m.Path = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Path = append(m.Path, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompressedNonExistenceProof) 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 ErrIntOverflowProofs + } + 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: CompressedNonExistenceProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompressedNonExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) + if m.Key == nil { + m.Key = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Left == nil { + m.Left = &CompressedExistenceProof{} + } + if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProofs + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProofs + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProofs + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Right == nil { + m.Right = &CompressedExistenceProof{} + } + if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProofs(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthProofs + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipProofs(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, ErrIntOverflowProofs + } + 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, ErrIntOverflowProofs + } + 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, ErrIntOverflowProofs + } + 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, ErrInvalidLengthProofs + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupProofs + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthProofs + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthProofs = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProofs = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProofs = fmt.Errorf("proto: unexpected end of group") +) diff --git a/core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go new file mode 100644 index 00000000..f079a53b --- /dev/null +++ b/core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go @@ -0,0 +1,888 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: gogoproto/gogo.proto + +package gogoproto + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + math "math" +) + +// 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 + +var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62001, + Name: "gogoproto.goproto_enum_prefix", + Tag: "varint,62001,opt,name=goproto_enum_prefix", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoEnumStringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62021, + Name: "gogoproto.goproto_enum_stringer", + Tag: "varint,62021,opt,name=goproto_enum_stringer", + Filename: "gogoproto/gogo.proto", +} + +var E_EnumStringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62022, + Name: "gogoproto.enum_stringer", + Tag: "varint,62022,opt,name=enum_stringer", + Filename: "gogoproto/gogo.proto", +} + +var E_EnumCustomname = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*string)(nil), + Field: 62023, + Name: "gogoproto.enum_customname", + Tag: "bytes,62023,opt,name=enum_customname", + Filename: "gogoproto/gogo.proto", +} + +var E_Enumdecl = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 62024, + Name: "gogoproto.enumdecl", + Tag: "varint,62024,opt,name=enumdecl", + Filename: "gogoproto/gogo.proto", +} + +var E_EnumvalueCustomname = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.EnumValueOptions)(nil), + ExtensionType: (*string)(nil), + Field: 66001, + Name: "gogoproto.enumvalue_customname", + Tag: "bytes,66001,opt,name=enumvalue_customname", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoGettersAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63001, + Name: "gogoproto.goproto_getters_all", + Tag: "varint,63001,opt,name=goproto_getters_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63002, + Name: "gogoproto.goproto_enum_prefix_all", + Tag: "varint,63002,opt,name=goproto_enum_prefix_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63003, + Name: "gogoproto.goproto_stringer_all", + Tag: "varint,63003,opt,name=goproto_stringer_all", + Filename: "gogoproto/gogo.proto", +} + +var E_VerboseEqualAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63004, + Name: "gogoproto.verbose_equal_all", + Tag: "varint,63004,opt,name=verbose_equal_all", + Filename: "gogoproto/gogo.proto", +} + +var E_FaceAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63005, + Name: "gogoproto.face_all", + Tag: "varint,63005,opt,name=face_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GostringAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63006, + Name: "gogoproto.gostring_all", + Tag: "varint,63006,opt,name=gostring_all", + Filename: "gogoproto/gogo.proto", +} + +var E_PopulateAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63007, + Name: "gogoproto.populate_all", + Tag: "varint,63007,opt,name=populate_all", + Filename: "gogoproto/gogo.proto", +} + +var E_StringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63008, + Name: "gogoproto.stringer_all", + Tag: "varint,63008,opt,name=stringer_all", + Filename: "gogoproto/gogo.proto", +} + +var E_OnlyoneAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63009, + Name: "gogoproto.onlyone_all", + Tag: "varint,63009,opt,name=onlyone_all", + Filename: "gogoproto/gogo.proto", +} + +var E_EqualAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63013, + Name: "gogoproto.equal_all", + Tag: "varint,63013,opt,name=equal_all", + Filename: "gogoproto/gogo.proto", +} + +var E_DescriptionAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63014, + Name: "gogoproto.description_all", + Tag: "varint,63014,opt,name=description_all", + Filename: "gogoproto/gogo.proto", +} + +var E_TestgenAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63015, + Name: "gogoproto.testgen_all", + Tag: "varint,63015,opt,name=testgen_all", + Filename: "gogoproto/gogo.proto", +} + +var E_BenchgenAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63016, + Name: "gogoproto.benchgen_all", + Tag: "varint,63016,opt,name=benchgen_all", + Filename: "gogoproto/gogo.proto", +} + +var E_MarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63017, + Name: "gogoproto.marshaler_all", + Tag: "varint,63017,opt,name=marshaler_all", + Filename: "gogoproto/gogo.proto", +} + +var E_UnmarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63018, + Name: "gogoproto.unmarshaler_all", + Tag: "varint,63018,opt,name=unmarshaler_all", + Filename: "gogoproto/gogo.proto", +} + +var E_StableMarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63019, + Name: "gogoproto.stable_marshaler_all", + Tag: "varint,63019,opt,name=stable_marshaler_all", + Filename: "gogoproto/gogo.proto", +} + +var E_SizerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63020, + Name: "gogoproto.sizer_all", + Tag: "varint,63020,opt,name=sizer_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63021, + Name: "gogoproto.goproto_enum_stringer_all", + Tag: "varint,63021,opt,name=goproto_enum_stringer_all", + Filename: "gogoproto/gogo.proto", +} + +var E_EnumStringerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63022, + Name: "gogoproto.enum_stringer_all", + Tag: "varint,63022,opt,name=enum_stringer_all", + Filename: "gogoproto/gogo.proto", +} + +var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63023, + Name: "gogoproto.unsafe_marshaler_all", + Tag: "varint,63023,opt,name=unsafe_marshaler_all", + Filename: "gogoproto/gogo.proto", +} + +var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63024, + Name: "gogoproto.unsafe_unmarshaler_all", + Tag: "varint,63024,opt,name=unsafe_unmarshaler_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63025, + Name: "gogoproto.goproto_extensions_map_all", + Tag: "varint,63025,opt,name=goproto_extensions_map_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63026, + Name: "gogoproto.goproto_unrecognized_all", + Tag: "varint,63026,opt,name=goproto_unrecognized_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GogoprotoImport = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63027, + Name: "gogoproto.gogoproto_import", + Tag: "varint,63027,opt,name=gogoproto_import", + Filename: "gogoproto/gogo.proto", +} + +var E_ProtosizerAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63028, + Name: "gogoproto.protosizer_all", + Tag: "varint,63028,opt,name=protosizer_all", + Filename: "gogoproto/gogo.proto", +} + +var E_CompareAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63029, + Name: "gogoproto.compare_all", + Tag: "varint,63029,opt,name=compare_all", + Filename: "gogoproto/gogo.proto", +} + +var E_TypedeclAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63030, + Name: "gogoproto.typedecl_all", + Tag: "varint,63030,opt,name=typedecl_all", + Filename: "gogoproto/gogo.proto", +} + +var E_EnumdeclAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63031, + Name: "gogoproto.enumdecl_all", + Tag: "varint,63031,opt,name=enumdecl_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoRegistration = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63032, + Name: "gogoproto.goproto_registration", + Tag: "varint,63032,opt,name=goproto_registration", + Filename: "gogoproto/gogo.proto", +} + +var E_MessagenameAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63033, + Name: "gogoproto.messagename_all", + Tag: "varint,63033,opt,name=messagename_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoSizecacheAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63034, + Name: "gogoproto.goproto_sizecache_all", + Tag: "varint,63034,opt,name=goproto_sizecache_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoUnkeyedAll = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FileOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 63035, + Name: "gogoproto.goproto_unkeyed_all", + Tag: "varint,63035,opt,name=goproto_unkeyed_all", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoGetters = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64001, + Name: "gogoproto.goproto_getters", + Tag: "varint,64001,opt,name=goproto_getters", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoStringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64003, + Name: "gogoproto.goproto_stringer", + Tag: "varint,64003,opt,name=goproto_stringer", + Filename: "gogoproto/gogo.proto", +} + +var E_VerboseEqual = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64004, + Name: "gogoproto.verbose_equal", + Tag: "varint,64004,opt,name=verbose_equal", + Filename: "gogoproto/gogo.proto", +} + +var E_Face = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64005, + Name: "gogoproto.face", + Tag: "varint,64005,opt,name=face", + Filename: "gogoproto/gogo.proto", +} + +var E_Gostring = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64006, + Name: "gogoproto.gostring", + Tag: "varint,64006,opt,name=gostring", + Filename: "gogoproto/gogo.proto", +} + +var E_Populate = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64007, + Name: "gogoproto.populate", + Tag: "varint,64007,opt,name=populate", + Filename: "gogoproto/gogo.proto", +} + +var E_Stringer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 67008, + Name: "gogoproto.stringer", + Tag: "varint,67008,opt,name=stringer", + Filename: "gogoproto/gogo.proto", +} + +var E_Onlyone = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64009, + Name: "gogoproto.onlyone", + Tag: "varint,64009,opt,name=onlyone", + Filename: "gogoproto/gogo.proto", +} + +var E_Equal = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64013, + Name: "gogoproto.equal", + Tag: "varint,64013,opt,name=equal", + Filename: "gogoproto/gogo.proto", +} + +var E_Description = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64014, + Name: "gogoproto.description", + Tag: "varint,64014,opt,name=description", + Filename: "gogoproto/gogo.proto", +} + +var E_Testgen = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64015, + Name: "gogoproto.testgen", + Tag: "varint,64015,opt,name=testgen", + Filename: "gogoproto/gogo.proto", +} + +var E_Benchgen = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64016, + Name: "gogoproto.benchgen", + Tag: "varint,64016,opt,name=benchgen", + Filename: "gogoproto/gogo.proto", +} + +var E_Marshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64017, + Name: "gogoproto.marshaler", + Tag: "varint,64017,opt,name=marshaler", + Filename: "gogoproto/gogo.proto", +} + +var E_Unmarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64018, + Name: "gogoproto.unmarshaler", + Tag: "varint,64018,opt,name=unmarshaler", + Filename: "gogoproto/gogo.proto", +} + +var E_StableMarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64019, + Name: "gogoproto.stable_marshaler", + Tag: "varint,64019,opt,name=stable_marshaler", + Filename: "gogoproto/gogo.proto", +} + +var E_Sizer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64020, + Name: "gogoproto.sizer", + Tag: "varint,64020,opt,name=sizer", + Filename: "gogoproto/gogo.proto", +} + +var E_UnsafeMarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64023, + Name: "gogoproto.unsafe_marshaler", + Tag: "varint,64023,opt,name=unsafe_marshaler", + Filename: "gogoproto/gogo.proto", +} + +var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64024, + Name: "gogoproto.unsafe_unmarshaler", + Tag: "varint,64024,opt,name=unsafe_unmarshaler", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64025, + Name: "gogoproto.goproto_extensions_map", + Tag: "varint,64025,opt,name=goproto_extensions_map", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoUnrecognized = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64026, + Name: "gogoproto.goproto_unrecognized", + Tag: "varint,64026,opt,name=goproto_unrecognized", + Filename: "gogoproto/gogo.proto", +} + +var E_Protosizer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64028, + Name: "gogoproto.protosizer", + Tag: "varint,64028,opt,name=protosizer", + Filename: "gogoproto/gogo.proto", +} + +var E_Compare = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64029, + Name: "gogoproto.compare", + Tag: "varint,64029,opt,name=compare", + Filename: "gogoproto/gogo.proto", +} + +var E_Typedecl = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64030, + Name: "gogoproto.typedecl", + Tag: "varint,64030,opt,name=typedecl", + Filename: "gogoproto/gogo.proto", +} + +var E_Messagename = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64033, + Name: "gogoproto.messagename", + Tag: "varint,64033,opt,name=messagename", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoSizecache = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64034, + Name: "gogoproto.goproto_sizecache", + Tag: "varint,64034,opt,name=goproto_sizecache", + Filename: "gogoproto/gogo.proto", +} + +var E_GoprotoUnkeyed = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 64035, + Name: "gogoproto.goproto_unkeyed", + Tag: "varint,64035,opt,name=goproto_unkeyed", + Filename: "gogoproto/gogo.proto", +} + +var E_Nullable = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65001, + Name: "gogoproto.nullable", + Tag: "varint,65001,opt,name=nullable", + Filename: "gogoproto/gogo.proto", +} + +var E_Embed = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65002, + Name: "gogoproto.embed", + Tag: "varint,65002,opt,name=embed", + Filename: "gogoproto/gogo.proto", +} + +var E_Customtype = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65003, + Name: "gogoproto.customtype", + Tag: "bytes,65003,opt,name=customtype", + Filename: "gogoproto/gogo.proto", +} + +var E_Customname = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65004, + Name: "gogoproto.customname", + Tag: "bytes,65004,opt,name=customname", + Filename: "gogoproto/gogo.proto", +} + +var E_Jsontag = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65005, + Name: "gogoproto.jsontag", + Tag: "bytes,65005,opt,name=jsontag", + Filename: "gogoproto/gogo.proto", +} + +var E_Moretags = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65006, + Name: "gogoproto.moretags", + Tag: "bytes,65006,opt,name=moretags", + Filename: "gogoproto/gogo.proto", +} + +var E_Casttype = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65007, + Name: "gogoproto.casttype", + Tag: "bytes,65007,opt,name=casttype", + Filename: "gogoproto/gogo.proto", +} + +var E_Castkey = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65008, + Name: "gogoproto.castkey", + Tag: "bytes,65008,opt,name=castkey", + Filename: "gogoproto/gogo.proto", +} + +var E_Castvalue = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65009, + Name: "gogoproto.castvalue", + Tag: "bytes,65009,opt,name=castvalue", + Filename: "gogoproto/gogo.proto", +} + +var E_Stdtime = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65010, + Name: "gogoproto.stdtime", + Tag: "varint,65010,opt,name=stdtime", + Filename: "gogoproto/gogo.proto", +} + +var E_Stdduration = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65011, + Name: "gogoproto.stdduration", + Tag: "varint,65011,opt,name=stdduration", + Filename: "gogoproto/gogo.proto", +} + +var E_Wktpointer = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*bool)(nil), + Field: 65012, + Name: "gogoproto.wktpointer", + Tag: "varint,65012,opt,name=wktpointer", + Filename: "gogoproto/gogo.proto", +} + +var E_Castrepeated = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 65013, + Name: "gogoproto.castrepeated", + Tag: "bytes,65013,opt,name=castrepeated", + Filename: "gogoproto/gogo.proto", +} + +func init() { + proto.RegisterExtension(E_GoprotoEnumPrefix) + proto.RegisterExtension(E_GoprotoEnumStringer) + proto.RegisterExtension(E_EnumStringer) + proto.RegisterExtension(E_EnumCustomname) + proto.RegisterExtension(E_Enumdecl) + proto.RegisterExtension(E_EnumvalueCustomname) + proto.RegisterExtension(E_GoprotoGettersAll) + proto.RegisterExtension(E_GoprotoEnumPrefixAll) + proto.RegisterExtension(E_GoprotoStringerAll) + proto.RegisterExtension(E_VerboseEqualAll) + proto.RegisterExtension(E_FaceAll) + proto.RegisterExtension(E_GostringAll) + proto.RegisterExtension(E_PopulateAll) + proto.RegisterExtension(E_StringerAll) + proto.RegisterExtension(E_OnlyoneAll) + proto.RegisterExtension(E_EqualAll) + proto.RegisterExtension(E_DescriptionAll) + proto.RegisterExtension(E_TestgenAll) + proto.RegisterExtension(E_BenchgenAll) + proto.RegisterExtension(E_MarshalerAll) + proto.RegisterExtension(E_UnmarshalerAll) + proto.RegisterExtension(E_StableMarshalerAll) + proto.RegisterExtension(E_SizerAll) + proto.RegisterExtension(E_GoprotoEnumStringerAll) + proto.RegisterExtension(E_EnumStringerAll) + proto.RegisterExtension(E_UnsafeMarshalerAll) + proto.RegisterExtension(E_UnsafeUnmarshalerAll) + proto.RegisterExtension(E_GoprotoExtensionsMapAll) + proto.RegisterExtension(E_GoprotoUnrecognizedAll) + proto.RegisterExtension(E_GogoprotoImport) + proto.RegisterExtension(E_ProtosizerAll) + proto.RegisterExtension(E_CompareAll) + proto.RegisterExtension(E_TypedeclAll) + proto.RegisterExtension(E_EnumdeclAll) + proto.RegisterExtension(E_GoprotoRegistration) + proto.RegisterExtension(E_MessagenameAll) + proto.RegisterExtension(E_GoprotoSizecacheAll) + proto.RegisterExtension(E_GoprotoUnkeyedAll) + proto.RegisterExtension(E_GoprotoGetters) + proto.RegisterExtension(E_GoprotoStringer) + proto.RegisterExtension(E_VerboseEqual) + proto.RegisterExtension(E_Face) + proto.RegisterExtension(E_Gostring) + proto.RegisterExtension(E_Populate) + proto.RegisterExtension(E_Stringer) + proto.RegisterExtension(E_Onlyone) + proto.RegisterExtension(E_Equal) + proto.RegisterExtension(E_Description) + proto.RegisterExtension(E_Testgen) + proto.RegisterExtension(E_Benchgen) + proto.RegisterExtension(E_Marshaler) + proto.RegisterExtension(E_Unmarshaler) + proto.RegisterExtension(E_StableMarshaler) + proto.RegisterExtension(E_Sizer) + proto.RegisterExtension(E_UnsafeMarshaler) + proto.RegisterExtension(E_UnsafeUnmarshaler) + proto.RegisterExtension(E_GoprotoExtensionsMap) + proto.RegisterExtension(E_GoprotoUnrecognized) + proto.RegisterExtension(E_Protosizer) + proto.RegisterExtension(E_Compare) + proto.RegisterExtension(E_Typedecl) + proto.RegisterExtension(E_Messagename) + proto.RegisterExtension(E_GoprotoSizecache) + proto.RegisterExtension(E_GoprotoUnkeyed) + proto.RegisterExtension(E_Nullable) + proto.RegisterExtension(E_Embed) + proto.RegisterExtension(E_Customtype) + proto.RegisterExtension(E_Customname) + proto.RegisterExtension(E_Jsontag) + proto.RegisterExtension(E_Moretags) + proto.RegisterExtension(E_Casttype) + proto.RegisterExtension(E_Castkey) + proto.RegisterExtension(E_Castvalue) + proto.RegisterExtension(E_Stdtime) + proto.RegisterExtension(E_Stdduration) + proto.RegisterExtension(E_Wktpointer) + proto.RegisterExtension(E_Castrepeated) +} + +func init() { proto.RegisterFile("gogoproto/gogo.proto", fileDescriptor_c586470e9b64aee7) } + +var fileDescriptor_c586470e9b64aee7 = []byte{ + // 1382 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x98, 0x49, 0x6c, 0x1c, 0x45, + 0x17, 0x80, 0x63, 0xfd, 0x89, 0x62, 0x97, 0xed, 0x38, 0x5e, 0xfe, 0x10, 0x22, 0x30, 0x81, 0x13, + 0x27, 0xe7, 0x14, 0xa1, 0x94, 0x15, 0x45, 0x8e, 0xe5, 0x58, 0x41, 0x24, 0x18, 0x27, 0x0e, 0x9b, + 0xd0, 0xa8, 0x67, 0xa6, 0xdc, 0x6e, 0xd2, 0xdd, 0xd5, 0x74, 0x57, 0x87, 0x38, 0x37, 0x14, 0x16, + 0x21, 0x04, 0x84, 0x45, 0x82, 0x84, 0x24, 0x10, 0x10, 0xfb, 0x1a, 0xf6, 0xe5, 0xc2, 0x05, 0xc8, + 0x31, 0xdc, 0x38, 0xa2, 0x98, 0x0b, 0x60, 0x76, 0x73, 0xf2, 0x05, 0xbd, 0xee, 0xf7, 0x7a, 0xaa, + 0xdb, 0x23, 0x55, 0xcd, 0x6d, 0x3c, 0xae, 0xef, 0x73, 0xf5, 0x7b, 0x55, 0xef, 0x3d, 0x37, 0x1b, + 0x71, 0xa5, 0x2b, 0xa3, 0x58, 0x2a, 0xb9, 0x03, 0x3e, 0x8d, 0x65, 0x1f, 0x87, 0x7a, 0x8a, 0x6f, + 0xb7, 0x6d, 0x77, 0xa5, 0x74, 0x7d, 0xb1, 0x23, 0xfb, 0xa9, 0x9e, 0xce, 0xef, 0x68, 0x8a, 0xa4, + 0x11, 0x7b, 0x91, 0x92, 0x71, 0xbe, 0x98, 0x1f, 0x64, 0xc3, 0xb8, 0xb8, 0x26, 0xc2, 0x34, 0xa8, + 0x45, 0xb1, 0x98, 0xf7, 0x8e, 0x0f, 0x5d, 0x33, 0x96, 0x93, 0x63, 0x44, 0x8e, 0x4d, 0x85, 0x69, + 0x70, 0x6b, 0xa4, 0x3c, 0x19, 0x26, 0x5b, 0x2f, 0xfe, 0xf4, 0xbf, 0xed, 0x5d, 0x37, 0x76, 0xcf, + 0x0e, 0x22, 0x0a, 0xbf, 0x9b, 0xc9, 0x40, 0x3e, 0xcb, 0xfe, 0x5f, 0xf2, 0x25, 0x2a, 0xf6, 0x42, + 0x57, 0xc4, 0x06, 0xe3, 0x37, 0x68, 0x1c, 0xd6, 0x8c, 0x87, 0x10, 0xe5, 0x93, 0xac, 0xbf, 0x13, + 0xd7, 0xb7, 0xe8, 0xea, 0x13, 0xba, 0x64, 0x9a, 0x0d, 0x64, 0x92, 0x46, 0x9a, 0x28, 0x19, 0x84, + 0x4e, 0x20, 0x0c, 0x9a, 0xef, 0x32, 0x4d, 0xcf, 0xec, 0x26, 0xc0, 0x26, 0x0b, 0x8a, 0x73, 0xd6, + 0x0d, 0xdf, 0x34, 0x45, 0xc3, 0x37, 0x18, 0x2e, 0xe1, 0x46, 0x8a, 0xf5, 0xfc, 0x08, 0x1b, 0x81, + 0xcf, 0xc7, 0x1c, 0x3f, 0x15, 0xfa, 0x4e, 0xae, 0x6f, 0xeb, 0x39, 0x02, 0xcb, 0x48, 0xf6, 0xfd, + 0xc9, 0xf5, 0xd9, 0x76, 0x86, 0x0b, 0x81, 0xb6, 0x27, 0x2d, 0x8b, 0xae, 0x50, 0x4a, 0xc4, 0x49, + 0xcd, 0xf1, 0xdb, 0x6d, 0x6f, 0x9f, 0xe7, 0x17, 0xc6, 0xd3, 0xcb, 0xe5, 0x2c, 0x4e, 0xe7, 0xe4, + 0x84, 0xef, 0xf3, 0x39, 0x76, 0x55, 0x9b, 0x53, 0x61, 0xe1, 0x3c, 0x83, 0xce, 0x91, 0x35, 0x27, + 0x03, 0xb4, 0x33, 0x8c, 0xbe, 0x2f, 0x72, 0x69, 0xe1, 0x7c, 0x01, 0x9d, 0x43, 0xc8, 0x52, 0x4a, + 0xc1, 0x78, 0x33, 0x1b, 0x3c, 0x26, 0xe2, 0xba, 0x4c, 0x44, 0x4d, 0xdc, 0x97, 0x3a, 0xbe, 0x85, + 0xee, 0x2c, 0xea, 0x06, 0x10, 0x9c, 0x02, 0x0e, 0x5c, 0xbb, 0x58, 0xf7, 0xbc, 0xd3, 0x10, 0x16, + 0x8a, 0x73, 0xa8, 0xd8, 0x08, 0xeb, 0x01, 0x9d, 0x60, 0x7d, 0xae, 0xcc, 0x1f, 0xc9, 0x02, 0x3f, + 0x8f, 0x78, 0x2f, 0x31, 0xa8, 0x88, 0x64, 0x94, 0xfa, 0x8e, 0xb2, 0xd9, 0xc1, 0x8b, 0xa4, 0x20, + 0x06, 0x15, 0x1d, 0x84, 0xf5, 0x25, 0x52, 0x24, 0x5a, 0x3c, 0xf7, 0xb0, 0x5e, 0x19, 0xfa, 0x8b, + 0x32, 0xb4, 0xd9, 0xc4, 0x05, 0x34, 0x30, 0x44, 0x40, 0x30, 0xce, 0x7a, 0x6c, 0x13, 0xf1, 0xea, + 0x32, 0x5d, 0x0f, 0xca, 0xc0, 0x34, 0x1b, 0xa0, 0x02, 0xe5, 0xc9, 0xd0, 0x42, 0xf1, 0x1a, 0x2a, + 0x36, 0x69, 0x18, 0x3e, 0x86, 0x12, 0x89, 0x72, 0x85, 0x8d, 0xe4, 0x75, 0x7a, 0x0c, 0x44, 0x30, + 0x94, 0x75, 0x11, 0x36, 0x16, 0xec, 0x0c, 0x6f, 0x50, 0x28, 0x89, 0x01, 0xc5, 0x24, 0xeb, 0x0f, + 0x9c, 0x38, 0x59, 0x70, 0x7c, 0xab, 0x74, 0xbc, 0x89, 0x8e, 0xbe, 0x02, 0xc2, 0x88, 0xa4, 0x61, + 0x27, 0x9a, 0xb7, 0x28, 0x22, 0x1a, 0x86, 0x57, 0x2f, 0x51, 0x4e, 0xdd, 0x17, 0xb5, 0x4e, 0x6c, + 0x6f, 0xd3, 0xd5, 0xcb, 0xd9, 0x03, 0xba, 0x71, 0x9c, 0xf5, 0x24, 0xde, 0x09, 0x2b, 0xcd, 0x3b, + 0x94, 0xe9, 0x0c, 0x00, 0xf8, 0x4e, 0x76, 0x75, 0xdb, 0x36, 0x61, 0x21, 0x7b, 0x17, 0x65, 0x5b, + 0xda, 0xb4, 0x0a, 0x2c, 0x09, 0x9d, 0x2a, 0xdf, 0xa3, 0x92, 0x20, 0x2a, 0xae, 0x19, 0x36, 0x92, + 0x86, 0x89, 0x33, 0xdf, 0x59, 0xd4, 0xde, 0xa7, 0xa8, 0xe5, 0x6c, 0x29, 0x6a, 0x87, 0xd9, 0x16, + 0x34, 0x76, 0x96, 0xd7, 0x0f, 0xa8, 0xb0, 0xe6, 0xf4, 0x5c, 0x39, 0xbb, 0x77, 0xb3, 0x6d, 0x45, + 0x38, 0x8f, 0x2b, 0x11, 0x26, 0xc0, 0xd4, 0x02, 0x27, 0xb2, 0x30, 0x5f, 0x44, 0x33, 0x55, 0xfc, + 0xa9, 0x42, 0x70, 0xc0, 0x89, 0x40, 0x7e, 0x07, 0xdb, 0x4a, 0xf2, 0x34, 0x8c, 0x45, 0x43, 0xba, + 0xa1, 0x77, 0x42, 0x34, 0x2d, 0xd4, 0x1f, 0x56, 0x52, 0x35, 0xa7, 0xe1, 0x60, 0xde, 0xcf, 0x36, + 0x17, 0xb3, 0x4a, 0xcd, 0x0b, 0x22, 0x19, 0x2b, 0x83, 0xf1, 0x23, 0xca, 0x54, 0xc1, 0xed, 0xcf, + 0x30, 0x3e, 0xc5, 0x36, 0x65, 0x3f, 0xda, 0x1e, 0xc9, 0x8f, 0x51, 0xd4, 0xdf, 0xa2, 0xb0, 0x70, + 0x34, 0x64, 0x10, 0x39, 0xb1, 0x4d, 0xfd, 0xfb, 0x84, 0x0a, 0x07, 0x22, 0x58, 0x38, 0xd4, 0x62, + 0x24, 0xa0, 0xdb, 0x5b, 0x18, 0x3e, 0xa5, 0xc2, 0x41, 0x0c, 0x2a, 0x68, 0x60, 0xb0, 0x50, 0x7c, + 0x46, 0x0a, 0x62, 0x40, 0x71, 0x5b, 0xab, 0xd1, 0xc6, 0xc2, 0xf5, 0x12, 0x15, 0x3b, 0xb0, 0xda, + 0xa0, 0xfa, 0x7c, 0xb9, 0x3c, 0x84, 0xcd, 0x6a, 0x28, 0x54, 0xa2, 0x40, 0x24, 0x89, 0xe3, 0x0a, + 0x98, 0x38, 0x2c, 0x36, 0xf6, 0x05, 0x55, 0x22, 0x0d, 0x83, 0xbd, 0x69, 0x13, 0x22, 0x84, 0xbd, + 0xe1, 0x34, 0x16, 0x6c, 0x74, 0x5f, 0x56, 0x36, 0x77, 0x88, 0x58, 0x70, 0x6a, 0xf3, 0x4f, 0x1a, + 0x1e, 0x15, 0x8b, 0x56, 0xa7, 0xf3, 0xab, 0xca, 0xfc, 0x33, 0x97, 0x93, 0x79, 0x0d, 0x19, 0xa8, + 0xcc, 0x53, 0x43, 0xd7, 0xad, 0x71, 0x1d, 0xc8, 0x9f, 0x8b, 0x74, 0x0f, 0xac, 0xe0, 0xf3, 0x96, + 0xc7, 0x29, 0x7e, 0x0b, 0x1c, 0xf2, 0xf2, 0xd0, 0x63, 0x96, 0x9d, 0x5c, 0x29, 0xce, 0x79, 0x69, + 0xe6, 0xe1, 0xfb, 0x58, 0x7f, 0x69, 0xe0, 0x31, 0xab, 0x1e, 0x44, 0x55, 0x9f, 0x3e, 0xef, 0xf0, + 0x9d, 0x6c, 0x3d, 0x0c, 0x2f, 0x66, 0xfc, 0x21, 0xc4, 0xb3, 0xe5, 0x7c, 0x37, 0xeb, 0xa6, 0xa1, + 0xc5, 0x8c, 0x3e, 0x8c, 0x68, 0x81, 0x00, 0x4e, 0x03, 0x8b, 0x19, 0x7f, 0x84, 0x70, 0x42, 0x00, + 0xb7, 0x0f, 0xe1, 0xd7, 0x8f, 0xad, 0xc7, 0xa6, 0x43, 0xb1, 0x1b, 0x67, 0x1b, 0x71, 0x52, 0x31, + 0xd3, 0x8f, 0xe2, 0x1f, 0x27, 0x82, 0xdf, 0xc4, 0x36, 0x58, 0x06, 0xfc, 0x71, 0x44, 0xf3, 0xf5, + 0x7c, 0x92, 0xf5, 0x6a, 0xd3, 0x89, 0x19, 0x7f, 0x02, 0x71, 0x9d, 0x82, 0xad, 0xe3, 0x74, 0x62, + 0x16, 0x3c, 0x49, 0x5b, 0x47, 0x02, 0xc2, 0x46, 0x83, 0x89, 0x99, 0x3e, 0x45, 0x51, 0x27, 0x84, + 0xef, 0x61, 0x3d, 0x45, 0xb3, 0x31, 0xf3, 0x4f, 0x21, 0xdf, 0x62, 0x20, 0x02, 0x5a, 0xb3, 0x33, + 0x2b, 0x9e, 0xa6, 0x08, 0x68, 0x14, 0x5c, 0xa3, 0xea, 0x00, 0x63, 0x36, 0x3d, 0x43, 0xd7, 0xa8, + 0x32, 0xbf, 0x40, 0x36, 0xb3, 0x9a, 0x6f, 0x56, 0x3c, 0x4b, 0xd9, 0xcc, 0xd6, 0xc3, 0x36, 0xaa, + 0x13, 0x81, 0xd9, 0xf1, 0x1c, 0x6d, 0xa3, 0x32, 0x10, 0xf0, 0x19, 0x36, 0xb4, 0x76, 0x1a, 0x30, + 0xfb, 0x9e, 0x47, 0xdf, 0xe0, 0x9a, 0x61, 0x80, 0xdf, 0xce, 0xb6, 0xb4, 0x9f, 0x04, 0xcc, 0xd6, + 0xd3, 0x2b, 0x95, 0xff, 0xdd, 0xf4, 0x41, 0x80, 0x1f, 0x6e, 0xb5, 0x14, 0x7d, 0x0a, 0x30, 0x6b, + 0xcf, 0xac, 0x94, 0x0b, 0xb7, 0x3e, 0x04, 0xf0, 0x09, 0xc6, 0x5a, 0x0d, 0xd8, 0xec, 0x3a, 0x8b, + 0x2e, 0x0d, 0x82, 0xab, 0x81, 0xfd, 0xd7, 0xcc, 0x9f, 0xa3, 0xab, 0x81, 0x04, 0x5c, 0x0d, 0x6a, + 0xbd, 0x66, 0xfa, 0x3c, 0x5d, 0x0d, 0x42, 0xe0, 0x64, 0x6b, 0xdd, 0xcd, 0x6c, 0xb8, 0x40, 0x27, + 0x5b, 0xa3, 0xf8, 0x41, 0x36, 0xb8, 0xa6, 0x21, 0x9a, 0x55, 0x2f, 0xa3, 0x6a, 0x73, 0xb5, 0x1f, + 0xea, 0xcd, 0x0b, 0x9b, 0xa1, 0xd9, 0xf6, 0x4a, 0xa5, 0x79, 0x61, 0x2f, 0xe4, 0xe3, 0xac, 0x3b, + 0x4c, 0x7d, 0x1f, 0x2e, 0xcf, 0xd0, 0xb5, 0x6d, 0xba, 0xa9, 0xf0, 0x9b, 0xa4, 0xf8, 0x79, 0x15, + 0xa3, 0x43, 0x00, 0xdf, 0xc9, 0x36, 0x88, 0xa0, 0x2e, 0x9a, 0x26, 0xf2, 0x97, 0x55, 0x2a, 0x98, + 0xb0, 0x9a, 0xef, 0x61, 0x2c, 0x7f, 0x35, 0x02, 0x61, 0x36, 0xb1, 0xbf, 0xae, 0xe6, 0x6f, 0x69, + 0x34, 0xa4, 0x25, 0xc8, 0x92, 0x62, 0x10, 0x2c, 0x97, 0x05, 0x59, 0x46, 0x76, 0xb1, 0x8d, 0xf7, + 0x26, 0x32, 0x54, 0x8e, 0x6b, 0xa2, 0x7f, 0x43, 0x9a, 0xd6, 0x43, 0xc0, 0x02, 0x19, 0x0b, 0xe5, + 0xb8, 0x89, 0x89, 0xfd, 0x1d, 0xd9, 0x02, 0x00, 0xb8, 0xe1, 0x24, 0xca, 0xe6, 0xb9, 0xff, 0x20, + 0x98, 0x00, 0xd8, 0x34, 0x7c, 0x3e, 0x2a, 0x16, 0x4d, 0xec, 0x9f, 0xb4, 0x69, 0x5c, 0xcf, 0x77, + 0xb3, 0x1e, 0xf8, 0x98, 0xbd, 0x55, 0x32, 0xc1, 0x7f, 0x21, 0xdc, 0x22, 0xe0, 0x2f, 0x27, 0xaa, + 0xa9, 0x3c, 0x73, 0xb0, 0xff, 0xc6, 0x4c, 0xd3, 0x7a, 0x3e, 0xc1, 0x7a, 0x13, 0xd5, 0x6c, 0xa6, + 0x38, 0x9f, 0x1a, 0xf0, 0x7f, 0x56, 0x8b, 0x57, 0x16, 0x05, 0x03, 0xd9, 0xbe, 0xff, 0xa8, 0x8a, + 0xa4, 0x17, 0x2a, 0x11, 0x9b, 0x0c, 0x2b, 0x68, 0xd0, 0x10, 0x3e, 0xc9, 0xfa, 0xe0, 0x59, 0x62, + 0x11, 0x09, 0x47, 0x99, 0x4f, 0xeb, 0xbf, 0x18, 0x80, 0x12, 0xb4, 0xf7, 0x9e, 0x4b, 0x57, 0x46, + 0xbb, 0x2e, 0x5f, 0x19, 0xed, 0xfa, 0xf1, 0xca, 0x68, 0xd7, 0xa9, 0xa5, 0xd1, 0x75, 0x97, 0x97, + 0x46, 0xd7, 0xfd, 0xb0, 0x34, 0xba, 0x8e, 0x0d, 0x37, 0x64, 0x50, 0x35, 0xee, 0x65, 0xd3, 0x72, + 0x5a, 0xce, 0x64, 0x45, 0xec, 0xae, 0x1b, 0x5c, 0x4f, 0x2d, 0xa4, 0xf5, 0xb1, 0x86, 0x0c, 0xb2, + 0xd7, 0xb8, 0xad, 0xb7, 0xb5, 0xc5, 0x3f, 0x39, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xbe, + 0x0f, 0x06, 0xea, 0x15, 0x00, 0x00, +} diff --git a/core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go b/core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go new file mode 100644 index 00000000..e42516d2 --- /dev/null +++ b/core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go @@ -0,0 +1,77 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos_proto/cosmos.proto + +package cosmos_proto + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" + math "math" +) + +// 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 + +var E_InterfaceType = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*string)(nil), + Field: 93001, + Name: "cosmos_proto.interface_type", + Tag: "bytes,93001,opt,name=interface_type", + Filename: "cosmos_proto/cosmos.proto", +} + +var E_ImplementsInterface = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.MessageOptions)(nil), + ExtensionType: (*string)(nil), + Field: 93002, + Name: "cosmos_proto.implements_interface", + Tag: "bytes,93002,opt,name=implements_interface", + Filename: "cosmos_proto/cosmos.proto", +} + +var E_AcceptsInterface = &proto.ExtensionDesc{ + ExtendedType: (*descriptor.FieldOptions)(nil), + ExtensionType: (*string)(nil), + Field: 93001, + Name: "cosmos_proto.accepts_interface", + Tag: "bytes,93001,opt,name=accepts_interface", + Filename: "cosmos_proto/cosmos.proto", +} + +func init() { + proto.RegisterExtension(E_InterfaceType) + proto.RegisterExtension(E_ImplementsInterface) + proto.RegisterExtension(E_AcceptsInterface) +} + +func init() { proto.RegisterFile("cosmos_proto/cosmos.proto", fileDescriptor_706f3b7c96e3f128) } + +var fileDescriptor_706f3b7c96e3f128 = []byte{ + // 250 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xce, 0x2f, 0xce, + 0xcd, 0x2f, 0x8e, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x70, 0xf4, 0xc0, 0x1c, 0x21, 0x1e, + 0x64, 0x29, 0x29, 0x85, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0x30, 0x2f, 0xa9, 0x34, 0x4d, + 0x3f, 0x25, 0xb5, 0x38, 0xb9, 0x28, 0xb3, 0xa0, 0x24, 0xbf, 0x08, 0xa2, 0xde, 0xca, 0x83, 0x8b, + 0x2f, 0x33, 0xaf, 0x24, 0xb5, 0x28, 0x2d, 0x31, 0x39, 0x35, 0xbe, 0xa4, 0xb2, 0x20, 0x55, 0x48, + 0x5e, 0x0f, 0xa2, 0x49, 0x0f, 0xa6, 0x49, 0xcf, 0x37, 0xb5, 0xb8, 0x38, 0x31, 0x3d, 0xd5, 0xbf, + 0xa0, 0x24, 0x33, 0x3f, 0xaf, 0x58, 0xe2, 0xe4, 0x35, 0x56, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x5e, + 0xb8, 0xc6, 0x90, 0xca, 0x82, 0x54, 0xab, 0x10, 0x2e, 0x91, 0xcc, 0xdc, 0x82, 0x9c, 0xd4, 0xdc, + 0xd4, 0xbc, 0x92, 0xe2, 0x78, 0xb8, 0x1c, 0x61, 0xf3, 0x4e, 0x41, 0xcd, 0x13, 0x46, 0x68, 0xf7, + 0x84, 0xe9, 0xb6, 0xf2, 0xe1, 0x12, 0x4c, 0x4c, 0x4e, 0x4e, 0x2d, 0x40, 0x31, 0x52, 0x16, 0xc3, + 0x48, 0xb7, 0xcc, 0xd4, 0x9c, 0x14, 0x74, 0x07, 0x0a, 0x40, 0x75, 0xc2, 0x4d, 0x73, 0xb2, 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, 0xd5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, + 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xa2, 0xd4, 0xf4, 0xd4, 0x3c, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, + 0xfc, 0xa2, 0x6c, 0x68, 0xf0, 0xea, 0x42, 0xac, 0x62, 0x03, 0x53, 0xc6, 0x80, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x2a, 0xa4, 0xbe, 0x80, 0x82, 0x01, 0x00, 0x00, +} diff --git a/core-sdk/third_party/proto/confio/proofs.proto b/core-sdk/third_party/proto/confio/proofs.proto new file mode 100644 index 00000000..da43503e --- /dev/null +++ b/core-sdk/third_party/proto/confio/proofs.proto @@ -0,0 +1,234 @@ +syntax = "proto3"; + +package ics23; +option go_package = "github.com/confio/ics23/go"; + +enum HashOp { + // NO_HASH is the default if no data passed. Note this is an illegal argument some places. + NO_HASH = 0; + SHA256 = 1; + SHA512 = 2; + KECCAK = 3; + RIPEMD160 = 4; + BITCOIN = 5; // ripemd160(sha256(x)) +} + +/** +LengthOp defines how to process the key and value of the LeafOp +to include length information. After encoding the length with the given +algorithm, the length will be prepended to the key and value bytes. +(Each one with it's own encoded length) +*/ +enum LengthOp { + // NO_PREFIX don't include any length info + NO_PREFIX = 0; + // VAR_PROTO uses protobuf (and go-amino) varint encoding of the length + VAR_PROTO = 1; + // VAR_RLP uses rlp int encoding of the length + VAR_RLP = 2; + // FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer + FIXED32_BIG = 3; + // FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer + FIXED32_LITTLE = 4; + // FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer + FIXED64_BIG = 5; + // FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer + FIXED64_LITTLE = 6; + // REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) + REQUIRE_32_BYTES = 7; + // REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) + REQUIRE_64_BYTES = 8; +} + +/** +ExistenceProof takes a key and a value and a set of steps to perform on it. +The result of peforming all these steps will provide a "root hash", which can +be compared to the value in a header. + +Since it is computationally infeasible to produce a hash collission for any of the used +cryptographic hash functions, if someone can provide a series of operations to transform +a given key and value into a root hash that matches some trusted root, these key and values +must be in the referenced merkle tree. + +The only possible issue is maliablity in LeafOp, such as providing extra prefix data, +which should be controlled by a spec. Eg. with lengthOp as NONE, + prefix = FOO, key = BAR, value = CHOICE +and + prefix = F, key = OOBAR, value = CHOICE +would produce the same value. + +With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field +in the ProofSpec is valuable to prevent this mutability. And why all trees should +length-prefix the data before hashing it. +*/ +message ExistenceProof { + bytes key = 1; + bytes value = 2; + LeafOp leaf = 3; + repeated InnerOp path = 4; +} + +/* +NonExistenceProof takes a proof of two neighbors, one left of the desired key, +one right of the desired key. If both proofs are valid AND they are neighbors, +then there is no valid proof for the given key. +*/ +message NonExistenceProof { + bytes key = 1; // TODO: remove this as unnecessary??? we prove a range + ExistenceProof left = 2; + ExistenceProof right = 3; +} + +/* +CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages +*/ +message CommitmentProof { + oneof proof { + ExistenceProof exist = 1; + NonExistenceProof nonexist = 2; + BatchProof batch = 3; + CompressedBatchProof compressed = 4; + } +} + +/** +LeafOp represents the raw key-value data we wish to prove, and +must be flexible to represent the internal transformation from +the original key-value pairs into the basis hash, for many existing +merkle trees. + +key and value are passed in. So that the signature of this operation is: + leafOp(key, value) -> output + +To process this, first prehash the keys and values if needed (ANY means no hash in this case): + hkey = prehashKey(key) + hvalue = prehashValue(value) + +Then combine the bytes, and hash it + output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) +*/ +message LeafOp { + HashOp hash = 1; + HashOp prehash_key = 2; + HashOp prehash_value = 3; + LengthOp length = 4; + // prefix is a fixed bytes that may optionally be included at the beginning to differentiate + // a leaf node from an inner node. + bytes prefix = 5; +} + +/** +InnerOp represents a merkle-proof step that is not a leaf. +It represents concatenating two children and hashing them to provide the next result. + +The result of the previous step is passed in, so the signature of this op is: + innerOp(child) -> output + +The result of applying InnerOp should be: + output = op.hash(op.prefix || child || op.suffix) + + where the || operator is concatenation of binary data, +and child is the result of hashing all the tree below this step. + +Any special data, like prepending child with the length, or prepending the entire operation with +some value to differentiate from leaf nodes, should be included in prefix and suffix. +If either of prefix or suffix is empty, we just treat it as an empty string +*/ +message InnerOp { + HashOp hash = 1; + bytes prefix = 2; + bytes suffix = 3; +} + + +/** +ProofSpec defines what the expected parameters are for a given proof type. +This can be stored in the client and used to validate any incoming proofs. + + verify(ProofSpec, Proof) -> Proof | Error + +As demonstrated in tests, if we don't fix the algorithm used to calculate the +LeafHash for a given tree, there are many possible key-value pairs that can +generate a given hash (by interpretting the preimage differently). +We need this for proper security, requires client knows a priori what +tree format server uses. But not in code, rather a configuration object. +*/ +message ProofSpec { + // any field in the ExistenceProof must be the same as in this spec. + // except Prefix, which is just the first bytes of prefix (spec can be longer) + LeafOp leaf_spec = 1; + InnerSpec inner_spec = 2; + // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) + int32 max_depth = 3; + // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) + int32 min_depth = 4; +} + +/* +InnerSpec contains all store-specific structure info to determine if two proofs from a +given store are neighbors. + +This enables: + + isLeftMost(spec: InnerSpec, op: InnerOp) + isRightMost(spec: InnerSpec, op: InnerOp) + isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) +*/ +message InnerSpec { + // Child order is the ordering of the children node, must count from 0 + // iavl tree is [0, 1] (left then right) + // merk is [0, 2, 1] (left, right, here) + repeated int32 child_order = 1; + int32 child_size = 2; + int32 min_prefix_length = 3; + int32 max_prefix_length = 4; + // empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) + bytes empty_child = 5; + // hash is the algorithm that must be used for each InnerOp + HashOp hash = 6; +} + +/* +BatchProof is a group of multiple proof types than can be compressed +*/ +message BatchProof { + repeated BatchEntry entries = 1; +} + +// Use BatchEntry not CommitmentProof, to avoid recursion +message BatchEntry { + oneof proof { + ExistenceProof exist = 1; + NonExistenceProof nonexist = 2; + } +} + + +/****** all items here are compressed forms *******/ + +message CompressedBatchProof { + repeated CompressedBatchEntry entries = 1; + repeated InnerOp lookup_inners = 2; +} + +// Use BatchEntry not CommitmentProof, to avoid recursion +message CompressedBatchEntry { + oneof proof { + CompressedExistenceProof exist = 1; + CompressedNonExistenceProof nonexist = 2; + } +} + +message CompressedExistenceProof { + bytes key = 1; + bytes value = 2; + LeafOp leaf = 3; + // these are indexes into the lookup_inners table in CompressedBatchProof + repeated int32 path = 4; +} + +message CompressedNonExistenceProof { + bytes key = 1; // TODO: remove this as unnecessary??? we prove a range + CompressedExistenceProof left = 2; + CompressedExistenceProof right = 3; +} diff --git a/core-sdk/third_party/proto/cosmos_proto/cosmos.proto b/core-sdk/third_party/proto/cosmos_proto/cosmos.proto new file mode 100644 index 00000000..167b1707 --- /dev/null +++ b/core-sdk/third_party/proto/cosmos_proto/cosmos.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package cosmos_proto; + +import "google/protobuf/descriptor.proto"; + +option go_package = "github.com/regen-network/cosmos-proto"; + +extend google.protobuf.MessageOptions { + string interface_type = 93001; + + string implements_interface = 93002; +} + +extend google.protobuf.FieldOptions { + string accepts_interface = 93001; +} diff --git a/core-sdk/third_party/proto/gogoproto/gogo.proto b/core-sdk/third_party/proto/gogoproto/gogo.proto new file mode 100644 index 00000000..49e78f99 --- /dev/null +++ b/core-sdk/third_party/proto/gogoproto/gogo.proto @@ -0,0 +1,145 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; +package gogoproto; + +import "google/protobuf/descriptor.proto"; + +option java_package = "com.google.protobuf"; +option java_outer_classname = "GoGoProtos"; +option go_package = "github.com/gogo/protobuf/gogoproto"; + +extend google.protobuf.EnumOptions { + optional bool goproto_enum_prefix = 62001; + optional bool goproto_enum_stringer = 62021; + optional bool enum_stringer = 62022; + optional string enum_customname = 62023; + optional bool enumdecl = 62024; +} + +extend google.protobuf.EnumValueOptions { + optional string enumvalue_customname = 66001; +} + +extend google.protobuf.FileOptions { + optional bool goproto_getters_all = 63001; + optional bool goproto_enum_prefix_all = 63002; + optional bool goproto_stringer_all = 63003; + optional bool verbose_equal_all = 63004; + optional bool face_all = 63005; + optional bool gostring_all = 63006; + optional bool populate_all = 63007; + optional bool stringer_all = 63008; + optional bool onlyone_all = 63009; + + optional bool equal_all = 63013; + optional bool description_all = 63014; + optional bool testgen_all = 63015; + optional bool benchgen_all = 63016; + optional bool marshaler_all = 63017; + optional bool unmarshaler_all = 63018; + optional bool stable_marshaler_all = 63019; + + optional bool sizer_all = 63020; + + optional bool goproto_enum_stringer_all = 63021; + optional bool enum_stringer_all = 63022; + + optional bool unsafe_marshaler_all = 63023; + optional bool unsafe_unmarshaler_all = 63024; + + optional bool goproto_extensions_map_all = 63025; + optional bool goproto_unrecognized_all = 63026; + optional bool gogoproto_import = 63027; + optional bool protosizer_all = 63028; + optional bool compare_all = 63029; + optional bool typedecl_all = 63030; + optional bool enumdecl_all = 63031; + + optional bool goproto_registration = 63032; + optional bool messagename_all = 63033; + + optional bool goproto_sizecache_all = 63034; + optional bool goproto_unkeyed_all = 63035; +} + +extend google.protobuf.MessageOptions { + optional bool goproto_getters = 64001; + optional bool goproto_stringer = 64003; + optional bool verbose_equal = 64004; + optional bool face = 64005; + optional bool gostring = 64006; + optional bool populate = 64007; + optional bool stringer = 67008; + optional bool onlyone = 64009; + + optional bool equal = 64013; + optional bool description = 64014; + optional bool testgen = 64015; + optional bool benchgen = 64016; + optional bool marshaler = 64017; + optional bool unmarshaler = 64018; + optional bool stable_marshaler = 64019; + + optional bool sizer = 64020; + + optional bool unsafe_marshaler = 64023; + optional bool unsafe_unmarshaler = 64024; + + optional bool goproto_extensions_map = 64025; + optional bool goproto_unrecognized = 64026; + + optional bool protosizer = 64028; + optional bool compare = 64029; + + optional bool typedecl = 64030; + + optional bool messagename = 64033; + + optional bool goproto_sizecache = 64034; + optional bool goproto_unkeyed = 64035; +} + +extend google.protobuf.FieldOptions { + optional bool nullable = 65001; + optional bool embed = 65002; + optional string customtype = 65003; + optional string customname = 65004; + optional string jsontag = 65005; + optional string moretags = 65006; + optional string casttype = 65007; + optional string castkey = 65008; + optional string castvalue = 65009; + + optional bool stdtime = 65010; + optional bool stdduration = 65011; + optional bool wktpointer = 65012; + + optional string castrepeated = 65013; +} diff --git a/core-sdk/third_party/proto/google/api/annotations.proto b/core-sdk/third_party/proto/google/api/annotations.proto new file mode 100644 index 00000000..85c361b4 --- /dev/null +++ b/core-sdk/third_party/proto/google/api/annotations.proto @@ -0,0 +1,31 @@ +// Copyright (c) 2015, Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +import "google/api/http.proto"; +import "google/protobuf/descriptor.proto"; + +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "AnnotationsProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +extend google.protobuf.MethodOptions { + // See `HttpRule`. + HttpRule http = 72295728; +} diff --git a/core-sdk/third_party/proto/google/api/http.proto b/core-sdk/third_party/proto/google/api/http.proto new file mode 100644 index 00000000..2bd3a19b --- /dev/null +++ b/core-sdk/third_party/proto/google/api/http.proto @@ -0,0 +1,318 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.api; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; +option java_multiple_files = true; +option java_outer_classname = "HttpProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + + +// Defines the HTTP configuration for an API service. It contains a list of +// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method +// to one or more HTTP REST API methods. +message Http { + // A list of HTTP configuration rules that apply to individual API methods. + // + // **NOTE:** All service configuration rules follow "last one wins" order. + repeated HttpRule rules = 1; + + // When set to true, URL path parmeters will be fully URI-decoded except in + // cases of single segment matches in reserved expansion, where "%2F" will be + // left encoded. + // + // The default behavior is to not decode RFC 6570 reserved characters in multi + // segment matches. + bool fully_decode_reserved_expansion = 2; +} + +// `HttpRule` defines the mapping of an RPC method to one or more HTTP +// REST API methods. The mapping specifies how different portions of the RPC +// request message are mapped to URL path, URL query parameters, and +// HTTP request body. The mapping is typically specified as an +// `google.api.http` annotation on the RPC method, +// see "google/api/annotations.proto" for details. +// +// The mapping consists of a field specifying the path template and +// method kind. The path template can refer to fields in the request +// message, as in the example below which describes a REST GET +// operation on a resource collection of messages: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// SubMessage sub = 2; // `sub.subfield` is url-mapped +// } +// message Message { +// string text = 1; // content of the resource +// } +// +// The same http annotation can alternatively be expressed inside the +// `GRPC API Configuration` YAML file. +// +// http: +// rules: +// - selector: .Messaging.GetMessage +// get: /v1/messages/{message_id}/{sub.subfield} +// +// This definition enables an automatic, bidrectional mapping of HTTP +// JSON to RPC. Example: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` +// +// In general, not only fields but also field paths can be referenced +// from a path pattern. Fields mapped to the path pattern cannot be +// repeated and must have a primitive (non-message) type. +// +// Any fields in the request message which are not bound by the path +// pattern automatically become (optional) HTTP query +// parameters. Assume the following definition of the request message: +// +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http).get = "/v1/messages/{message_id}"; +// } +// } +// message GetMessageRequest { +// message SubMessage { +// string subfield = 1; +// } +// string message_id = 1; // mapped to the URL +// int64 revision = 2; // becomes a parameter +// SubMessage sub = 3; // `sub.subfield` becomes a parameter +// } +// +// +// This enables a HTTP JSON to RPC mapping as below: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` +// +// Note that fields which are mapped to HTTP parameters must have a +// primitive type or a repeated primitive type. Message types are not +// allowed. In the case of a repeated type, the parameter can be +// repeated in the URL, as in `...?param=A¶m=B`. +// +// For HTTP method kinds which allow a request body, the `body` field +// specifies the mapping. Consider a REST update method on the +// message resource collection: +// +// +// service Messaging { +// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "message" +// }; +// } +// } +// message UpdateMessageRequest { +// string message_id = 1; // mapped to the URL +// Message message = 2; // mapped to the body +// } +// +// +// The following HTTP JSON to RPC mapping is enabled, where the +// representation of the JSON in the request body is determined by +// protos JSON encoding: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` +// +// The special name `*` can be used in the body mapping to define that +// every field not bound by the path template should be mapped to the +// request body. This enables the following alternative definition of +// the update method: +// +// service Messaging { +// rpc UpdateMessage(Message) returns (Message) { +// option (google.api.http) = { +// put: "/v1/messages/{message_id}" +// body: "*" +// }; +// } +// } +// message Message { +// string message_id = 1; +// string text = 2; +// } +// +// +// The following HTTP JSON to RPC mapping is enabled: +// +// HTTP | RPC +// -----|----- +// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` +// +// Note that when using `*` in the body mapping, it is not possible to +// have HTTP parameters, as all fields not bound by the path end in +// the body. This makes this option more rarely used in practice of +// defining REST APIs. The common usage of `*` is in custom methods +// which don't use the URL at all for transferring data. +// +// It is possible to define multiple HTTP methods for one RPC by using +// the `additional_bindings` option. Example: +// +// service Messaging { +// rpc GetMessage(GetMessageRequest) returns (Message) { +// option (google.api.http) = { +// get: "/v1/messages/{message_id}" +// additional_bindings { +// get: "/v1/users/{user_id}/messages/{message_id}" +// } +// }; +// } +// } +// message GetMessageRequest { +// string message_id = 1; +// string user_id = 2; +// } +// +// +// This enables the following two alternative HTTP JSON to RPC +// mappings: +// +// HTTP | RPC +// -----|----- +// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` +// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` +// +// # Rules for HTTP mapping +// +// The rules for mapping HTTP path, query parameters, and body fields +// to the request message are as follows: +// +// 1. The `body` field specifies either `*` or a field path, or is +// omitted. If omitted, it indicates there is no HTTP request body. +// 2. Leaf fields (recursive expansion of nested messages in the +// request) can be classified into three types: +// (a) Matched in the URL template. +// (b) Covered by body (if body is `*`, everything except (a) fields; +// else everything under the body field) +// (c) All other fields. +// 3. URL query parameters found in the HTTP request are mapped to (c) fields. +// 4. Any body sent with an HTTP request can contain only (b) fields. +// +// The syntax of the path template is as follows: +// +// Template = "/" Segments [ Verb ] ; +// Segments = Segment { "/" Segment } ; +// Segment = "*" | "**" | LITERAL | Variable ; +// Variable = "{" FieldPath [ "=" Segments ] "}" ; +// FieldPath = IDENT { "." IDENT } ; +// Verb = ":" LITERAL ; +// +// The syntax `*` matches a single path segment. The syntax `**` matches zero +// or more path segments, which must be the last part of the path except the +// `Verb`. The syntax `LITERAL` matches literal text in the path. +// +// The syntax `Variable` matches part of the URL path as specified by its +// template. A variable template must not contain other variables. If a variable +// matches a single path segment, its template may be omitted, e.g. `{var}` +// is equivalent to `{var=*}`. +// +// If a variable contains exactly one path segment, such as `"{var}"` or +// `"{var=*}"`, when such a variable is expanded into a URL path, all characters +// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the +// Discovery Document as `{var}`. +// +// If a variable contains one or more path segments, such as `"{var=foo/*}"` +// or `"{var=**}"`, when such a variable is expanded into a URL path, all +// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables +// show up in the Discovery Document as `{+var}`. +// +// NOTE: While the single segment variable matches the semantics of +// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 +// Simple String Expansion, the multi segment variable **does not** match +// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion +// does not expand special characters like `?` and `#`, which would lead +// to invalid URLs. +// +// NOTE: the field paths in variables and in the `body` must not refer to +// repeated fields or map fields. +message HttpRule { + // Selects methods to which this rule applies. + // + // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + string selector = 1; + + // Determines the URL pattern is matched by this rules. This pattern can be + // used with any of the {get|put|post|delete|patch} methods. A custom method + // can be defined using the 'custom' field. + oneof pattern { + // Used for listing and getting information about resources. + string get = 2; + + // Used for updating a resource. + string put = 3; + + // Used for creating a resource. + string post = 4; + + // Used for deleting a resource. + string delete = 5; + + // Used for updating a resource. + string patch = 6; + + // The custom pattern is used for specifying an HTTP method that is not + // included in the `pattern` field, such as HEAD, or "*" to leave the + // HTTP method unspecified for this rule. The wild-card rule is useful + // for services that provide content to Web (HTML) clients. + CustomHttpPattern custom = 8; + } + + // The name of the request field whose value is mapped to the HTTP body, or + // `*` for mapping all fields not captured by the path pattern to the HTTP + // body. NOTE: the referred field must not be a repeated field and must be + // present at the top-level of request message type. + string body = 7; + + // Optional. The name of the response field whose value is mapped to the HTTP + // body of response. Other response fields are ignored. When + // not set, the response message will be used as HTTP body of response. + string response_body = 12; + + // Additional HTTP bindings for the selector. Nested bindings must + // not contain an `additional_bindings` field themselves (that is, + // the nesting may only be one level deep). + repeated HttpRule additional_bindings = 11; +} + +// A custom pattern is used for defining custom HTTP verb. +message CustomHttpPattern { + // The name of this custom HTTP verb. + string kind = 1; + + // The path matched by this custom verb. + string path = 2; +} diff --git a/core-sdk/third_party/proto/google/api/httpbody.proto b/core-sdk/third_party/proto/google/api/httpbody.proto new file mode 100644 index 00000000..4428515c --- /dev/null +++ b/core-sdk/third_party/proto/google/api/httpbody.proto @@ -0,0 +1,78 @@ +// Copyright 2018 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.api; + +import "google/protobuf/any.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; +option java_multiple_files = true; +option java_outer_classname = "HttpBodyProto"; +option java_package = "com.google.api"; +option objc_class_prefix = "GAPI"; + +// Message that represents an arbitrary HTTP body. It should only be used for +// payload formats that can't be represented as JSON, such as raw binary or +// an HTML page. +// +// +// This message can be used both in streaming and non-streaming API methods in +// the request as well as the response. +// +// It can be used as a top-level request field, which is convenient if one +// wants to extract parameters from either the URL or HTTP template into the +// request fields and also want access to the raw HTTP body. +// +// Example: +// +// message GetResourceRequest { +// // A unique request id. +// string request_id = 1; +// +// // The raw HTTP body is bound to this field. +// google.api.HttpBody http_body = 2; +// } +// +// service ResourceService { +// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +// rpc UpdateResource(google.api.HttpBody) returns +// (google.protobuf.Empty); +// } +// +// Example with streaming methods: +// +// service CaldavService { +// rpc GetCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// rpc UpdateCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// } +// +// Use of this type only changes how the request and response bodies are +// handled, all other features will continue to work unchanged. +message HttpBody { + // The HTTP Content-Type header value specifying the content type of the body. + string content_type = 1; + + // The HTTP request/response body as raw binary. + bytes data = 2; + + // Application specific response metadata. Must be set in the first response + // for streaming APIs. + repeated google.protobuf.Any extensions = 3; +} \ No newline at end of file diff --git a/core-sdk/third_party/proto/google/protobuf/any.proto b/core-sdk/third_party/proto/google/protobuf/any.proto new file mode 100644 index 00000000..1431810e --- /dev/null +++ b/core-sdk/third_party/proto/google/protobuf/any.proto @@ -0,0 +1,161 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package google.protobuf; + +import "gogoproto/gogo.proto"; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option go_package = "types"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "AnyProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; + +// `Any` contains an arbitrary serialized protocol buffer message along with a +// URL that describes the type of the serialized message. +// +// Protobuf library provides support to pack/unpack Any values in the form +// of utility functions or additional generated methods of the Any type. +// +// Example 1: Pack and unpack a message in C++. +// +// Foo foo = ...; +// Any any; +// any.PackFrom(foo); +// ... +// if (any.UnpackTo(&foo)) { +// ... +// } +// +// Example 2: Pack and unpack a message in Java. +// +// Foo foo = ...; +// Any any = Any.pack(foo); +// ... +// if (any.is(Foo.class)) { +// foo = any.unpack(Foo.class); +// } +// +// Example 3: Pack and unpack a message in Python. +// +// foo = Foo(...) +// any = Any() +// any.Pack(foo) +// ... +// if any.Is(Foo.DESCRIPTOR): +// any.Unpack(foo) +// ... +// +// Example 4: Pack and unpack a message in Go +// +// foo := &pb.Foo{...} +// any, err := ptypes.MarshalAny(foo) +// ... +// foo := &pb.Foo{} +// if err := ptypes.UnmarshalAny(any, foo); err != nil { +// ... +// } +// +// The pack methods provided by protobuf library will by default use +// 'type.googleapis.com/full.type.name' as the type URL and the unpack +// methods only use the fully qualified type name after the last '/' +// in the type URL, for example "foo.bar.com/x/y.z" will yield type +// name "y.z". +// +// +// JSON +// ==== +// The JSON representation of an `Any` value uses the regular +// representation of the deserialized, embedded message, with an +// additional field `@type` which contains the type URL. Example: +// +// package google.profile; +// message Person { +// string first_name = 1; +// string last_name = 2; +// } +// +// { +// "@type": "type.googleapis.com/google.profile.Person", +// "firstName": , +// "lastName": +// } +// +// If the embedded message type is well-known and has a custom JSON +// representation, that representation will be embedded adding a field +// `value` which holds the custom JSON in addition to the `@type` +// field. Example (for message [google.protobuf.Duration][]): +// +// { +// "@type": "type.googleapis.com/google.protobuf.Duration", +// "value": "1.212s" +// } +// +message Any { + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. This string must contain at least + // one "/" character. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). + // + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: + // + // * If no scheme is provided, `https` is assumed. + // * An HTTP GET on the URL must yield a [google.protobuf.Type][] + // value in binary format, or produce an error. + // * Applications are allowed to cache lookup results based on the + // URL, or have them precompiled into a binary to avoid any + // lookup. Therefore, binary compatibility needs to be preserved + // on changes to types. (Use versioned type names to manage + // breaking changes.) + // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // + // Schemes other than `http`, `https` (or the empty scheme) might be + // used with implementation specific semantics. + // + string type_url = 1; + + // Must be a valid serialized protocol buffer of the above specified type. + bytes value = 2; + + option (gogoproto.typedecl) = false; +} + +option (gogoproto.goproto_registration) = false; diff --git a/core-sdk/third_party/proto/tendermint/abci/types.proto b/core-sdk/third_party/proto/tendermint/abci/types.proto new file mode 100644 index 00000000..09b96f1d --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/abci/types.proto @@ -0,0 +1,407 @@ +syntax = "proto3"; +package tendermint.abci; + +option go_package = "github.com/tendermint/tendermint/abci/types"; + +// For more information on gogo.proto, see: +// https://github.com/gogo/protobuf/blob/master/extensions.md +import "tendermint/crypto/proof.proto"; +import "tendermint/types/types.proto"; +import "tendermint/crypto/keys.proto"; +import "tendermint/types/params.proto"; +import "google/protobuf/timestamp.proto"; +import "gogoproto/gogo.proto"; + +// This file is copied from http://github.com/tendermint/abci +// NOTE: When using custom types, mind the warnings. +// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues + +//---------------------------------------- +// Request types + +message Request { + oneof value { + RequestEcho echo = 1; + RequestFlush flush = 2; + RequestInfo info = 3; + RequestSetOption set_option = 4; + RequestInitChain init_chain = 5; + RequestQuery query = 6; + RequestBeginBlock begin_block = 7; + RequestCheckTx check_tx = 8; + RequestDeliverTx deliver_tx = 9; + RequestEndBlock end_block = 10; + RequestCommit commit = 11; + RequestListSnapshots list_snapshots = 12; + RequestOfferSnapshot offer_snapshot = 13; + RequestLoadSnapshotChunk load_snapshot_chunk = 14; + RequestApplySnapshotChunk apply_snapshot_chunk = 15; + } +} + +message RequestEcho { + string message = 1; +} + +message RequestFlush {} + +message RequestInfo { + string version = 1; + uint64 block_version = 2; + uint64 p2p_version = 3; +} + +// nondeterministic +message RequestSetOption { + string key = 1; + string value = 2; +} + +message RequestInitChain { + google.protobuf.Timestamp time = 1 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + string chain_id = 2; + ConsensusParams consensus_params = 3; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; + bytes app_state_bytes = 5; + int64 initial_height = 6; +} + +message RequestQuery { + bytes data = 1; + string path = 2; + int64 height = 3; + bool prove = 4; +} + +message RequestBeginBlock { + bytes hash = 1; + tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; + LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; + repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; +} + +enum CheckTxType { + NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; + RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"]; +} + +message RequestCheckTx { + bytes tx = 1; + CheckTxType type = 2; +} + +message RequestDeliverTx { + bytes tx = 1; +} + +message RequestEndBlock { + int64 height = 1; +} + +message RequestCommit {} + +// lists available snapshots +message RequestListSnapshots { +} + +// offers a snapshot to the application +message RequestOfferSnapshot { + Snapshot snapshot = 1; // snapshot offered by peers + bytes app_hash = 2; // light client-verified app hash for snapshot height +} + +// loads a snapshot chunk +message RequestLoadSnapshotChunk { + uint64 height = 1; + uint32 format = 2; + uint32 chunk = 3; +} + +// Applies a snapshot chunk +message RequestApplySnapshotChunk { + uint32 index = 1; + bytes chunk = 2; + string sender = 3; +} + +//---------------------------------------- +// Response types + +message Response { + oneof value { + ResponseException exception = 1; + ResponseEcho echo = 2; + ResponseFlush flush = 3; + ResponseInfo info = 4; + ResponseSetOption set_option = 5; + ResponseInitChain init_chain = 6; + ResponseQuery query = 7; + ResponseBeginBlock begin_block = 8; + ResponseCheckTx check_tx = 9; + ResponseDeliverTx deliver_tx = 10; + ResponseEndBlock end_block = 11; + ResponseCommit commit = 12; + ResponseListSnapshots list_snapshots = 13; + ResponseOfferSnapshot offer_snapshot = 14; + ResponseLoadSnapshotChunk load_snapshot_chunk = 15; + ResponseApplySnapshotChunk apply_snapshot_chunk = 16; + } +} + +// nondeterministic +message ResponseException { + string error = 1; +} + +message ResponseEcho { + string message = 1; +} + +message ResponseFlush {} + +message ResponseInfo { + string data = 1; + + string version = 2; + uint64 app_version = 3; + + int64 last_block_height = 4; + bytes last_block_app_hash = 5; +} + +// nondeterministic +message ResponseSetOption { + uint32 code = 1; + // bytes data = 2; + string log = 3; + string info = 4; +} + +message ResponseInitChain { + ConsensusParams consensus_params = 1; + repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false]; + bytes app_hash = 3; +} + +message ResponseQuery { + uint32 code = 1; + // bytes data = 2; // use "value" instead. + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 index = 5; + bytes key = 6; + bytes value = 7; + tendermint.crypto.ProofOps proof_ops = 8; + int64 height = 9; + string codespace = 10; +} + +message ResponseBeginBlock { + repeated Event events = 1 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; +} + +message ResponseCheckTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; +} + +message ResponseDeliverTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5 [json_name = "gas_wanted"]; + int64 gas_used = 6 [json_name = "gas_used"]; + repeated Event events = 7 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; + string codespace = 8; +} + +message ResponseEndBlock { + repeated ValidatorUpdate validator_updates = 1 + [(gogoproto.nullable) = false]; + ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; +} + +message ResponseCommit { + // reserve 1 + bytes data = 2; + int64 retain_height = 3; +} + +message ResponseListSnapshots { + repeated Snapshot snapshots = 1; +} + +message ResponseOfferSnapshot { + Result result = 1; + + enum Result { + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Snapshot accepted, apply chunks + ABORT = 2; // Abort all snapshot restoration + REJECT = 3; // Reject this specific snapshot, try others + REJECT_FORMAT = 4; // Reject all snapshots of this format, try others + REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others + } +} + +message ResponseLoadSnapshotChunk { + bytes chunk = 1; +} + +message ResponseApplySnapshotChunk { + Result result = 1; + repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply + repeated string reject_senders = 3; // Chunk senders to reject and ban + + enum Result { + UNKNOWN = 0; // Unknown result, abort all snapshot restoration + ACCEPT = 1; // Chunk successfully accepted + ABORT = 2; // Abort all snapshot restoration + RETRY = 3; // Retry chunk (combine with refetch and reject) + RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) + REJECT_SNAPSHOT = 5; // Reject this snapshot, try others + } +} + +//---------------------------------------- +// Misc. + +// ConsensusParams contains all consensus-relevant parameters +// that can be adjusted by the abci app +message ConsensusParams { + BlockParams block = 1; + tendermint.types.EvidenceParams evidence = 2; + tendermint.types.ValidatorParams validator = 3; + tendermint.types.VersionParams version = 4; +} + +// BlockParams contains limits on the block size. +message BlockParams { + // Note: must be greater than 0 + int64 max_bytes = 1; + // Note: must be greater or equal to -1 + int64 max_gas = 2; +} + +message LastCommitInfo { + int32 round = 1; + repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; +} + +// Event allows application developers to attach additional information to +// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. +// Later, transactions may be queried using these events. +message Event { + string type = 1; + repeated EventAttribute attributes = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "attributes,omitempty" + ]; +} + +// EventAttribute is a single key-value pair, associated with an event. +message EventAttribute { + bytes key = 1; + bytes value = 2; + bool index = 3; // nondeterministic +} + +// TxResult contains results of executing the transaction. +// +// One usage is indexing transaction results. +message TxResult { + int64 height = 1; + uint32 index = 2; + bytes tx = 3; + ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; +} + +//---------------------------------------- +// Blockchain Types + +// Validator +message Validator { + bytes address = 1; // The first 20 bytes of SHA256(public key) + // PubKey pub_key = 2 [(gogoproto.nullable)=false]; + int64 power = 3; // The voting power +} + +// ValidatorUpdate +message ValidatorUpdate { + tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; + int64 power = 2; +} + +// VoteInfo +message VoteInfo { + Validator validator = 1 [(gogoproto.nullable) = false]; + bool signed_last_block = 2; +} + +enum EvidenceType { + UNKNOWN = 0; + DUPLICATE_VOTE = 1; + LIGHT_CLIENT_ATTACK = 2; +} + +message Evidence { + EvidenceType type = 1; + // The offending validator + Validator validator = 2 [(gogoproto.nullable) = false]; + // The height when the offense occurred + int64 height = 3; + // The corresponding time where the offense occurred + google.protobuf.Timestamp time = 4 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + // Total voting power of the validator set in case the ABCI application does + // not store historical validators. + // https://github.com/tendermint/tendermint/issues/4581 + int64 total_voting_power = 5; +} + +//---------------------------------------- +// State Sync Types + +message Snapshot { + uint64 height = 1; // The height at which the snapshot was taken + uint32 format = 2; // The application-specific snapshot format + uint32 chunks = 3; // Number of chunks in the snapshot + bytes hash = 4; // Arbitrary snapshot hash, equal only if identical + bytes metadata = 5; // Arbitrary application metadata +} + +//---------------------------------------- +// Service Definition + +service ABCIApplication { + rpc Echo(RequestEcho) returns (ResponseEcho); + rpc Flush(RequestFlush) returns (ResponseFlush); + rpc Info(RequestInfo) returns (ResponseInfo); + rpc SetOption(RequestSetOption) returns (ResponseSetOption); + rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); + rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); + rpc Query(RequestQuery) returns (ResponseQuery); + rpc Commit(RequestCommit) returns (ResponseCommit); + rpc InitChain(RequestInitChain) returns (ResponseInitChain); + rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); + rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); + rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); + rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); + rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); + rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); +} diff --git a/core-sdk/third_party/proto/tendermint/crypto/keys.proto b/core-sdk/third_party/proto/tendermint/crypto/keys.proto new file mode 100644 index 00000000..af9db49f --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/crypto/keys.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package tendermint.crypto; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; + +import "gogoproto/gogo.proto"; + +// PublicKey defines the keys available for use with Tendermint Validators +message PublicKey { + option (gogoproto.compare) = true; + option (gogoproto.equal) = true; + + oneof sum { + bytes ed25519 = 1; + } +} diff --git a/core-sdk/third_party/proto/tendermint/crypto/proof.proto b/core-sdk/third_party/proto/tendermint/crypto/proof.proto new file mode 100644 index 00000000..975df768 --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/crypto/proof.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package tendermint.crypto; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; + +import "gogoproto/gogo.proto"; + +message Proof { + int64 total = 1; + int64 index = 2; + bytes leaf_hash = 3; + repeated bytes aunts = 4; +} + +message ValueOp { + // Encoded in ProofOp.Key. + bytes key = 1; + + // To encode in ProofOp.Data + Proof proof = 2; +} + +message DominoOp { + string key = 1; + string input = 2; + string output = 3; +} + +// ProofOp defines an operation used for calculating Merkle root +// The data could be arbitrary format, providing nessecary data +// for example neighbouring node hash +message ProofOp { + string type = 1; + bytes key = 2; + bytes data = 3; +} + +// ProofOps is Merkle proof defined by the list of ProofOps +message ProofOps { + repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; +} diff --git a/core-sdk/third_party/proto/tendermint/libs/bits/types.proto b/core-sdk/third_party/proto/tendermint/libs/bits/types.proto new file mode 100644 index 00000000..3111d113 --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/libs/bits/types.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package tendermint.libs.bits; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/libs/bits"; + +message BitArray { + int64 bits = 1; + repeated uint64 elems = 2; +} diff --git a/core-sdk/third_party/proto/tendermint/types/evidence.proto b/core-sdk/third_party/proto/tendermint/types/evidence.proto new file mode 100644 index 00000000..3ff10c1b --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/types/evidence.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "tendermint/types/types.proto"; +import "tendermint/crypto/keys.proto"; + +// DuplicateVoteEvidence contains evidence a validator signed two conflicting +// votes. +message DuplicateVoteEvidence { + Vote vote_a = 1; + Vote vote_b = 2; + + google.protobuf.Timestamp timestamp = 3 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +} + +message Evidence { + oneof sum { + DuplicateVoteEvidence duplicate_vote_evidence = 1; + } +} + +// EvidenceData contains any evidence of malicious wrong-doing by validators +message EvidenceData { + repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; + bytes hash = 2; +} diff --git a/core-sdk/third_party/proto/tendermint/types/params.proto b/core-sdk/third_party/proto/tendermint/types/params.proto new file mode 100644 index 00000000..897c07c1 --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/types/params.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; + +option (gogoproto.equal_all) = true; + +// ConsensusParams contains consensus critical parameters that determine the +// validity of blocks. +message ConsensusParams { + BlockParams block = 1 [(gogoproto.nullable) = false]; + EvidenceParams evidence = 2 [(gogoproto.nullable) = false]; + ValidatorParams validator = 3 [(gogoproto.nullable) = false]; + VersionParams version = 4 [(gogoproto.nullable) = false]; +} + +// BlockParams contains limits on the block size. +message BlockParams { + // Max block size, in bytes. + // Note: must be greater than 0 + int64 max_bytes = 1; + // Max gas per block. + // Note: must be greater or equal to -1 + int64 max_gas = 2; + // Minimum time increment between consecutive blocks (in milliseconds) If the + // block header timestamp is ahead of the system clock, decrease this value. + // + // Not exposed to the application. + int64 time_iota_ms = 3; +} + +// EvidenceParams determine how we handle evidence of malfeasance. +message EvidenceParams { + // Max age of evidence, in blocks. + // + // The basic formula for calculating this is: MaxAgeDuration / {average block + // time}. + int64 max_age_num_blocks = 1; + + // Max age of evidence, in time. + // + // It should correspond with an app's "unbonding period" or other similar + // mechanism for handling [Nothing-At-Stake + // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + google.protobuf.Duration max_age_duration = 2 + [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; + + // This sets the maximum number of evidence that can be committed in a single block. + // and should fall comfortably under the max block bytes when we consider the size of + // each evidence (See MaxEvidenceBytes). The maximum number is MaxEvidencePerBlock. + // Default is 50 + uint32 max_num = 3; +} + +// ValidatorParams restrict the public key types validators can use. +// NOTE: uses ABCI pubkey naming, not Amino names. +message ValidatorParams { + option (gogoproto.populate) = true; + option (gogoproto.equal) = true; + + repeated string pub_key_types = 1; +} + +// VersionParams contains the ABCI application version. +message VersionParams { + option (gogoproto.populate) = true; + option (gogoproto.equal) = true; + + uint64 app_version = 1; +} + +// HashedParams is a subset of ConsensusParams. +// +// It is hashed into the Header.ConsensusHash. +message HashedParams { + int64 block_max_bytes = 1; + int64 block_max_gas = 2; +} diff --git a/core-sdk/third_party/proto/tendermint/types/types.proto b/core-sdk/third_party/proto/tendermint/types/types.proto new file mode 100644 index 00000000..2762f4a7 --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/types/types.proto @@ -0,0 +1,162 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "tendermint/libs/bits/types.proto"; +import "tendermint/crypto/proof.proto"; +import "tendermint/version/types.proto"; +import "tendermint/types/validator.proto"; + +// BlockIdFlag indicates which BlcokID the signature is for +enum BlockIDFlag { + option (gogoproto.goproto_enum_stringer) = true; + option (gogoproto.goproto_enum_prefix) = false; + + BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; + BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; + BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; + BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; +} + +// SignedMsgType is a type of signed message in the consensus. +enum SignedMsgType { + option (gogoproto.goproto_enum_stringer) = true; + option (gogoproto.goproto_enum_prefix) = false; + + SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"]; + // Votes + SIGNED_MSG_TYPE_PREVOTE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"]; + SIGNED_MSG_TYPE_PRECOMMIT = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"]; + + // Proposals + SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"]; +} + +// PartsetHeader +message PartSetHeader { + uint32 total = 1; + bytes hash = 2; +} + +message Part { + uint32 index = 1; + bytes bytes = 2; + tendermint.crypto.Proof proof = 3 [(gogoproto.nullable) = false]; +} + +// BlockID +message BlockID { + bytes hash = 1; + PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; +} + +// -------------------------------- + +// Header defines the structure of a Tendermint block header. +message Header { + // basic block info + tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false]; + string chain_id = 2 [(gogoproto.customname) = "ChainID"]; + int64 height = 3; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + + // prev block info + BlockID last_block_id = 5 [(gogoproto.nullable) = false]; + + // hashes of block data + bytes last_commit_hash = 6; // commit from validators from the last block + bytes data_hash = 7; // transactions + + // hashes from the app output from the prev block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = 12; // root hash of all results from the txs from the previous block + + // consensus info + bytes evidence_hash = 13; // evidence included in the block + bytes proposer_address = 14; // original proposer of the block +} + +// Data contains the set of transactions included in the block +message Data { + // Txs that will be applied by state @ block.Height+1. + // NOTE: not all txs here are valid. We're just agreeing on the order first. + // This means that block.AppHash does not include these txs. + repeated bytes txs = 1; + // Volatile + bytes hash = 2; +} + +// Vote represents a prevote, precommit, or commit vote from validators for +// consensus. +message Vote { + SignedMsgType type = 1; + int64 height = 2; + int32 round = 3; + BlockID block_id = 4 + [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. + google.protobuf.Timestamp timestamp = 5 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes validator_address = 6; + int32 validator_index = 7; + bytes signature = 8; +} + +// Commit contains the evidence that a block was committed by a set of validators. +message Commit { + int64 height = 1; + int32 round = 2; + BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; + repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; + bytes hash = 5; + tendermint.libs.bits.BitArray bit_array = 6; +} + +// CommitSig is a part of the Vote included in a Commit. +message CommitSig { + BlockIDFlag block_id_flag = 1; + bytes validator_address = 2; + google.protobuf.Timestamp timestamp = 3 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 4; +} + +message Proposal { + SignedMsgType type = 1; + int64 height = 2; + int32 round = 3; + int32 pol_round = 4; + BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + google.protobuf.Timestamp timestamp = 6 + [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; + bytes signature = 7; +} + +message SignedHeader { + Header header = 1; + Commit commit = 2; +} + +message LightBlock { + SignedHeader signed_header = 1; + tendermint.types.ValidatorSet validator_set = 2; +} + +message BlockMeta { + BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + int64 block_size = 2; + Header header = 3 [(gogoproto.nullable) = false]; + int64 num_txs = 4; +} + +// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. +message TxProof { + bytes root_hash = 1; + bytes data = 2; + tendermint.crypto.Proof proof = 3; +} diff --git a/core-sdk/third_party/proto/tendermint/types/validator.proto b/core-sdk/third_party/proto/tendermint/types/validator.proto new file mode 100644 index 00000000..49860b96 --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/types/validator.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package tendermint.types; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; + +import "gogoproto/gogo.proto"; +import "tendermint/crypto/keys.proto"; + +message ValidatorSet { + repeated Validator validators = 1; + Validator proposer = 2; + int64 total_voting_power = 3; +} + +message Validator { + bytes address = 1; + tendermint.crypto.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; + int64 voting_power = 3; + int64 proposer_priority = 4; +} + +message SimpleValidator { + tendermint.crypto.PublicKey pub_key = 1; + int64 voting_power = 2; +} diff --git a/core-sdk/third_party/proto/tendermint/version/types.proto b/core-sdk/third_party/proto/tendermint/version/types.proto new file mode 100644 index 00000000..6061868b --- /dev/null +++ b/core-sdk/third_party/proto/tendermint/version/types.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package tendermint.version; + +option go_package = "github.com/tendermint/tendermint/proto/tendermint/version"; + +import "gogoproto/gogo.proto"; + +// App includes the protocol and software version for the application. +// This information is included in ResponseInfo. The App.Protocol can be +// updated in ResponseEndBlock. +message App { + uint64 protocol = 1; + string software = 2; +} + +// Consensus captures the consensus rules for processing a block in the blockchain, +// including all blockchain data structures and the rules of the application's +// state transition machine. +message Consensus { + option (gogoproto.equal) = true; + + uint64 block = 1; + uint64 app = 2; +} diff --git a/core-sdk/third_party/protocgen.sh b/core-sdk/third_party/protocgen.sh new file mode 100755 index 00000000..edc53057 --- /dev/null +++ b/core-sdk/third_party/protocgen.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -eo pipefail + +proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) +for dir in $proto_dirs; do + protoc \ + -I "proto" \ + -I "third_party/proto" \ + --gocosmos_out=plugins=interfacetype+grpc,\ +Mgoogle/protobuf/any.proto=github.com/irisnet/irishub-sdk-go/codec/types:. \ + $(find "${dir}" -maxdepth 1 -name '*.proto') + +done + +# move proto files to the right places +cp -r github.com/irisnet/core-sdk-go/* ./ +rm -fr github.com diff --git a/core-sdk/types/address.go b/core-sdk/types/address.go index 1c977838..6e85e2f0 100644 --- a/core-sdk/types/address.go +++ b/core-sdk/types/address.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/irisnet/core-sdk-go/common/bech32" ) diff --git a/core-sdk/types/address_test.go b/core-sdk/types/address_test.go index 3030bce1..26458b09 100644 --- a/core-sdk/types/address_test.go +++ b/core-sdk/types/address_test.go @@ -2,11 +2,9 @@ package types import ( "fmt" - "testing" - - "github.com/stretchr/testify/require" - "github.com/irisnet/core-sdk-go/common/bech32" + "github.com/stretchr/testify/require" + "testing" ) func TestGetFromBech32(t *testing.T) { diff --git a/core-sdk/types/auth/types.go b/core-sdk/types/auth/types.go index 19728b71..4abe4084 100644 --- a/core-sdk/types/auth/types.go +++ b/core-sdk/types/auth/types.go @@ -4,13 +4,11 @@ import ( "encoding/json" "errors" "fmt" - "github.com/gogo/protobuf/proto" - "github.com/tendermint/tendermint/crypto" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" codectypes "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" + "github.com/tendermint/tendermint/crypto" ) // Account is an interface used to store coins at a given address within state. diff --git a/core-sdk/types/block.go b/core-sdk/types/block.go index 99a76a26..6443c9dd 100644 --- a/core-sdk/types/block.go +++ b/core-sdk/types/block.go @@ -2,13 +2,11 @@ package types import ( "encoding/base64" - + commoncodec "github.com/irisnet/core-sdk-go/common/codec" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/encoding" ctypes "github.com/tendermint/tendermint/rpc/core/types" tmtypes "github.com/tendermint/tendermint/types" - - commoncodec "github.com/irisnet/core-sdk-go/common/codec" ) type Block struct { diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go index 2cec49fd..89faf61d 100644 --- a/core-sdk/types/config.go +++ b/core-sdk/types/config.go @@ -2,10 +2,9 @@ package types import ( "fmt" - "os" - "github.com/irisnet/core-sdk-go/common/crypto" "github.com/irisnet/core-sdk-go/types/store" + "os" ) const ( diff --git a/core-sdk/types/events.go b/core-sdk/types/events.go index 7f5508df..3086e1e6 100644 --- a/core-sdk/types/events.go +++ b/core-sdk/types/events.go @@ -2,10 +2,9 @@ package types import ( "fmt" + abci "github.com/tendermint/tendermint/abci/types" "sort" "strings" - - abci "github.com/tendermint/tendermint/abci/types" ) // ---------------------------------------------------------------------------- diff --git a/core-sdk/types/factory.go b/core-sdk/types/factory.go index 77210f39..334ef47a 100644 --- a/core-sdk/types/factory.go +++ b/core-sdk/types/factory.go @@ -3,7 +3,6 @@ package types import ( "errors" "fmt" - "github.com/irisnet/core-sdk-go/types/tx/signing" ) diff --git a/core-sdk/types/module.go b/core-sdk/types/module.go index 7015eca6..f5817b23 100644 --- a/core-sdk/types/module.go +++ b/core-sdk/types/module.go @@ -1,9 +1,8 @@ package types import ( - "github.com/tendermint/tendermint/crypto" - codectypes "github.com/irisnet/core-sdk-go/common/codec/types" + "github.com/tendermint/tendermint/crypto" ) //The purpose of this interface is to convert the irishub system type to the user receiving type diff --git a/core-sdk/types/result.go b/core-sdk/types/result.go index 8137b375..5c0c3784 100644 --- a/core-sdk/types/result.go +++ b/core-sdk/types/result.go @@ -4,11 +4,10 @@ import ( "encoding/hex" "encoding/json" "fmt" + commoncodec "github.com/irisnet/core-sdk-go/common/codec" "math" "strings" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - yaml "gopkg.in/yaml.v2" ctypes "github.com/tendermint/tendermint/rpc/core/types" diff --git a/core-sdk/types/stdtx.go b/core-sdk/types/stdtx.go index db88cf84..0a19441b 100644 --- a/core-sdk/types/stdtx.go +++ b/core-sdk/types/stdtx.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "fmt" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" ) diff --git a/core-sdk/types/store/codec.go b/core-sdk/types/store/codec.go index b90fbf69..0f7e6564 100644 --- a/core-sdk/types/store/codec.go +++ b/core-sdk/types/store/codec.go @@ -1,11 +1,10 @@ package store import ( - "github.com/tendermint/tendermint/crypto" - "github.com/irisnet/core-sdk-go/common/codec" cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/common/crypto/hd" + "github.com/tendermint/tendermint/crypto" ) var cdc *codec.LegacyAmino diff --git a/core-sdk/types/store/types.go b/core-sdk/types/store/types.go index 2f3c9d09..5bd451a3 100644 --- a/core-sdk/types/store/types.go +++ b/core-sdk/types/store/types.go @@ -2,10 +2,8 @@ package store import ( "fmt" - - "github.com/tendermint/tendermint/crypto" - "github.com/irisnet/core-sdk-go/common/crypto/hd" + "github.com/tendermint/tendermint/crypto" ) var ( diff --git a/core-sdk/types/tm_types.go b/core-sdk/types/tm_types.go index 728985fa..873faec2 100644 --- a/core-sdk/types/tm_types.go +++ b/core-sdk/types/tm_types.go @@ -1,13 +1,12 @@ package types import ( + cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" + "github.com/irisnet/core-sdk-go/types/kv" "github.com/tendermint/tendermint/crypto" tmbytes "github.com/tendermint/tendermint/libs/bytes" tmclient "github.com/tendermint/tendermint/rpc/client" tmtypes "github.com/tendermint/tendermint/types" - - cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" - "github.com/irisnet/core-sdk-go/types/kv" ) type ( diff --git a/core-sdk/types/tx.go b/core-sdk/types/tx.go index 7bf8af33..37341095 100644 --- a/core-sdk/types/tx.go +++ b/core-sdk/types/tx.go @@ -1,9 +1,8 @@ package types import ( - "github.com/tendermint/tendermint/crypto" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" + "github.com/tendermint/tendermint/crypto" ) type ( diff --git a/core-sdk/types/tx/types.go b/core-sdk/types/tx/types.go index 033cf53a..91b4274e 100644 --- a/core-sdk/types/tx/types.go +++ b/core-sdk/types/tx/types.go @@ -3,7 +3,6 @@ package tx import ( "errors" "fmt" - "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" From bb204050cf3ae8fd108fa99afd6b5f1c6da5abbd Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 14:17:38 +0800 Subject: [PATCH 02/41] core-sdk-go fix Client name --- core-sdk/integration_test/integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-sdk/integration_test/integration_test.go b/core-sdk/integration_test/integration_test.go index b6db86d4..20db94e0 100644 --- a/core-sdk/integration_test/integration_test.go +++ b/core-sdk/integration_test/integration_test.go @@ -25,7 +25,7 @@ const ( type IntegrationTestSuite struct { suite.Suite - sdk.IRISHUBClient + sdk.Client r *rand.Rand rootAccount MockAccount randAccounts []MockAccount @@ -59,7 +59,7 @@ func (s *IntegrationTestSuite) SetupSuite() { panic(err) } - s.IRISHUBClient = sdk.NewIRISHUBClient(cfg) + s.Client = sdk.NewClient(cfg) s.r = rand.New(rand.NewSource(time.Now().UnixNano())) s.rootAccount = MockAccount{ Name: "validator", From 423d983c9d8c63a47aff5c5c9cf0535dbb520440 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 14:34:25 +0800 Subject: [PATCH 03/41] module-sdk-go add coinswap --- module-sdk/coinswap/coinswap.go | 390 ++++++++++++++++++++++++++++++++ 1 file changed, 390 insertions(+) create mode 100644 module-sdk/coinswap/coinswap.go diff --git a/module-sdk/coinswap/coinswap.go b/module-sdk/coinswap/coinswap.go new file mode 100644 index 00000000..165569ef --- /dev/null +++ b/module-sdk/coinswap/coinswap.go @@ -0,0 +1,390 @@ +package coinswap + +import ( + "context" + "errors" + "fmt" + "strings" + + "github.com/irisnet/irishub-sdk-go/codec" + "github.com/irisnet/irishub-sdk-go/codec/types" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +type coinswapClient struct { + sdk.BaseClient + codec.Marshaler + totalSupply +} + +func NewClient(bc sdk.BaseClient, cdc codec.Marshaler, queryTotalSupply totalSupply) Client { + return coinswapClient{ + BaseClient: bc, + Marshaler: cdc, + totalSupply: queryTotalSupply, + } +} + +func (swap coinswapClient) Name() string { + return ModuleName +} + +func (swap coinswapClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (swap coinswapClient) AddLiquidity(request AddLiquidityRequest, + baseTx sdk.BaseTx) (*AddLiquidityResponse, error) { + creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return nil, sdk.Wrap(err) + } + + msg := &MsgAddLiquidity{ + MaxToken: request.MaxToken, + ExactStandardAmt: request.BaseAmt, + MinLiquidity: request.MinLiquidity, + Deadline: request.Deadline, + Sender: creator.String(), + } + + res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return nil, err + } + + var totalCoins = sdk.NewCoins() + coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) + for _, coinStr := range coinStrs { + coins, er := sdk.ParseCoins(coinStr) + if er != nil { + swap.Logger().Error("Parse coin str failed", "coin", coinStr) + continue + } + totalCoins = totalCoins.Add(coins...) + } + + liquidityDenom, er := GetLiquidityDenomFrom(request.MaxToken.Denom) + if er != nil { + return nil, er + } + response := &AddLiquidityResponse{ + TokenAmt: totalCoins.AmountOf(request.MaxToken.Denom), + BaseAmt: request.BaseAmt, + Liquidity: totalCoins.AmountOf(liquidityDenom), + TxHash: res.Hash, + } + return response, nil +} + +func (swap coinswapClient) RemoveLiquidity(request RemoveLiquidityRequest, + baseTx sdk.BaseTx) (*RemoveLiquidityResponse, error) { + creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return nil, sdk.Wrap(err) + } + + msg := &MsgRemoveLiquidity{ + WithdrawLiquidity: request.Liquidity, + MinToken: request.MinTokenAmt, + MinStandardAmt: request.MinBaseAmt, + Deadline: request.Deadline, + Sender: creator.String(), + } + + res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return nil, err + } + + var totalCoins = sdk.NewCoins() + coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) + for _, coinStr := range coinStrs { + coins, er := sdk.ParseCoins(coinStr) + if er != nil { + swap.Logger().Error("Parse coin str failed", "coin", coinStr) + continue + } + totalCoins = totalCoins.Add(coins...) + } + + tokenDenom, er := GetTokenDenomFrom(request.Liquidity.Denom) + if er != nil { + return nil, er + } + + response := &RemoveLiquidityResponse{ + TokenAmt: totalCoins.AmountOf(tokenDenom), + BaseAmt: totalCoins.AmountOf(sdk.BaseDenom), + Liquidity: request.Liquidity, + TxHash: res.Hash, + } + return response, nil +} + +func (swap coinswapClient) SwapCoin(request SwapCoinRequest, baseTx sdk.BaseTx) (*SwapCoinResponse, error) { + creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return nil, sdk.Wrap(err) + } + + input := Input{ + Address: creator.String(), + Coin: request.Input, + } + + if len(request.Receiver) == 0 { + request.Receiver = input.Address + } + + output := Output{ + Address: request.Receiver, + Coin: request.Output, + } + + msg := &MsgSwapOrder{ + Input: input, + Output: output, + Deadline: request.Deadline, + IsBuyOrder: request.IsBuyOrder, + } + + res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return nil, err + } + + amount, er := res.Events.GetValue(eventTypeSwap, attributeKeyAmount) + if er != nil { + return nil, er + } + + amt, ok := sdk.NewIntFromString(amount) + if !ok { + return nil, sdk.Wrapf("%s can not convert to sdk.Int type", amount) + } + + inputAmt := request.Input.Amount + outputAmt := request.Output.Amount + if request.IsBuyOrder { + inputAmt = amt + } else { + outputAmt = amt + } + + response := &SwapCoinResponse{ + InputAmt: inputAmt, + OutputAmt: outputAmt, + TxHash: res.Hash, + } + return response, nil +} + +func (swap coinswapClient) BuyTokenWithAutoEstimate(paidTokenDenom string, boughtCoin sdk.Coin, + deadline int64, + baseTx sdk.BaseTx, +) (res *SwapCoinResponse, err error) { + var amount = sdk.ZeroInt() + switch { + case paidTokenDenom == sdk.BaseDenom: + amount, err = swap.EstimateBaseForBoughtToken(boughtCoin) + break + case boughtCoin.Denom == sdk.BaseDenom: + amount, err = swap.EstimateTokenForBoughtBase(paidTokenDenom, boughtCoin.Amount) + break + default: + amount, err = swap.EstimateTokenForBoughtToken(paidTokenDenom, boughtCoin) + break + } + + if err != nil { + return nil, err + } + + req := SwapCoinRequest{ + Input: sdk.NewCoin(paidTokenDenom, amount), + Output: boughtCoin, + Deadline: deadline, + IsBuyOrder: true, + } + return swap.SwapCoin(req, baseTx) +} + +func (swap coinswapClient) SellTokenWithAutoEstimate(gotTokenDenom string, soldCoin sdk.Coin, + deadline int64, + baseTx sdk.BaseTx, +) (res *SwapCoinResponse, err error) { + var amount = sdk.ZeroInt() + switch { + case gotTokenDenom == sdk.BaseDenom: + amount, err = swap.EstimateBaseForSoldToken(soldCoin) + break + case soldCoin.Denom == sdk.BaseDenom: + amount, err = swap.EstimateTokenForSoldBase(gotTokenDenom, soldCoin.Amount) + break + default: + amount, err = swap.EstimateTokenForSoldToken(gotTokenDenom, soldCoin) + break + } + + if err != nil { + return nil, err + } + + req := SwapCoinRequest{ + Input: soldCoin, + Output: sdk.NewCoin(gotTokenDenom, amount), + Deadline: deadline, + IsBuyOrder: false, + } + return swap.SwapCoin(req, baseTx) +} + +func (swap coinswapClient) QueryPool(denom string) (*QueryPoolResponse, error) { + conn, err := swap.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Liquidity( + context.Background(), + &QueryLiquidityRequest{Denom: denom}, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + return resp.Convert().(*QueryPoolResponse), err +} + +func (swap coinswapClient) QueryAllPools() (*QueryAllPoolsResponse, error) { + coins, err := swap.totalSupply() + if err != nil { + return nil, sdk.Wrap(err) + } + + var pools []QueryPoolResponse + for _, coin := range coins { + //Compatible with old data + if strings.HasPrefix(coin.Denom, "swap/") { + continue + } + denom, err := GetTokenDenomFrom(coin.Denom) + if err != nil { + continue + } + res, err := swap.QueryPool(denom) + if err != nil { + return nil, sdk.Wrap(err) + } + pools = append(pools, *res) + } + return &QueryAllPoolsResponse{pools}, err +} + +func (swap coinswapClient) EstimateTokenForSoldBase(tokenDenom string, + soldBaseAmt sdk.Int, +) (sdk.Int, error) { + result, err := swap.QueryPool(tokenDenom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getInputPrice(soldBaseAmt, + result.BaseCoin.Amount, result.TokenCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateBaseForSoldToken(soldToken sdk.Coin) (sdk.Int, error) { + result, err := swap.QueryPool(soldToken.Denom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getInputPrice(soldToken.Amount, + result.TokenCoin.Amount, result.BaseCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateTokenForSoldToken(boughtTokenDenom string, + soldToken sdk.Coin) (sdk.Int, error) { + if boughtTokenDenom == soldToken.Denom { + return sdk.ZeroInt(), errors.New("invalid trade") + } + + boughtBaseAmt, err := swap.EstimateBaseForSoldToken(soldToken) + if err != nil { + return sdk.ZeroInt(), err + } + return swap.EstimateTokenForSoldBase(boughtTokenDenom, boughtBaseAmt) +} + +func (swap coinswapClient) EstimateTokenForBoughtBase(soldTokenDenom string, + exactBoughtBaseAmt sdk.Int) (sdk.Int, error) { + result, err := swap.QueryPool(soldTokenDenom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getOutputPrice(exactBoughtBaseAmt, + result.TokenCoin.Amount, result.BaseCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateBaseForBoughtToken(boughtToken sdk.Coin) (sdk.Int, error) { + result, err := swap.QueryPool(boughtToken.Denom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getOutputPrice(boughtToken.Amount, + result.BaseCoin.Amount, result.TokenCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateTokenForBoughtToken(soldTokenDenom string, + boughtToken sdk.Coin) (sdk.Int, error) { + if soldTokenDenom == boughtToken.Denom { + return sdk.ZeroInt(), errors.New("invalid trade") + } + + soldBaseAmt, err := swap.EstimateBaseForBoughtToken(boughtToken) + if err != nil { + return sdk.ZeroInt(), err + } + return swap.EstimateTokenForBoughtBase(soldTokenDenom, soldBaseAmt) +} + +func GetLiquidityDenomFrom(denom string) (string, error) { + if denom == sdk.BaseDenom { + return "", sdk.Wrapf("should not be base denom : %s", denom) + } + return fmt.Sprintf("swap%s", denom), nil +} + +func GetTokenDenomFrom(liquidityDenom string) (string, error) { + if !strings.HasPrefix(liquidityDenom, "swap") { + return "", sdk.Wrapf("wrong liquidity denom : %s", liquidityDenom) + } + return strings.TrimPrefix(liquidityDenom, "swap"), nil +} + +// getInputPrice returns the amount of coins bought (calculated) given the input amount being sold (exact) +// The fee is included in the input coins being bought +// https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf +func getInputPrice(inputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { + deltaFee := sdk.OneDec().Sub(fee) + inputAmtWithFee := inputAmt.Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) + numerator := inputAmtWithFee.Mul(outputReserve) + denominator := inputReserve.Mul(sdk.NewIntWithDecimal(1, sdk.Precision)).Add(inputAmtWithFee) + return numerator.Quo(denominator) +} + +// getOutputPrice returns the amount of coins sold (calculated) given the output amount being bought (exact) +// The fee is included in the output coins being bought +func getOutputPrice(outputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { + deltaFee := sdk.OneDec().Sub(fee) + numerator := inputReserve.Mul(outputAmt).Mul(sdk.NewIntWithDecimal(1, sdk.Precision)) + denominator := (outputReserve.Sub(outputAmt)).Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) + return numerator.Quo(denominator).Add(sdk.OneInt()) +} From ad32c0c2cb99578f57b7f1b9b70d33c3ba6ce632 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 15:54:29 +0800 Subject: [PATCH 04/41] module-sdk-go add coinswap --- module-sdk/coinswap/codec.go | 29 ++ module-sdk/coinswap/coinswap.pb.go | 766 +++++++++++++++++++++++++++++ 2 files changed, 795 insertions(+) create mode 100644 module-sdk/coinswap/codec.go create mode 100644 module-sdk/coinswap/coinswap.pb.go diff --git a/module-sdk/coinswap/codec.go b/module-sdk/coinswap/codec.go new file mode 100644 index 00000000..613fe3bb --- /dev/null +++ b/module-sdk/coinswap/codec.go @@ -0,0 +1,29 @@ +package coinswap + +import ( + + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" + +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgAddLiquidity{}, + &MsgRemoveLiquidity{}, + &MsgSwapOrder{}, + ) +} diff --git a/module-sdk/coinswap/coinswap.pb.go b/module-sdk/coinswap/coinswap.pb.go new file mode 100644 index 00000000..8487a674 --- /dev/null +++ b/module-sdk/coinswap/coinswap.pb.go @@ -0,0 +1,766 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: coinswap/coinswap.proto + +package coinswap + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" + types "github.com/irisnet/irishub-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Input defines the properties of order's input +type Input struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` +} + +func (m *Input) Reset() { *m = Input{} } +func (m *Input) String() string { return proto.CompactTextString(m) } +func (*Input) ProtoMessage() {} +func (*Input) Descriptor() ([]byte, []int) { + return fileDescriptor_ac63172e3bfc925a, []int{0} +} +func (m *Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Input.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 *Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_Input.Merge(m, src) +} +func (m *Input) XXX_Size() int { + return m.Size() +} +func (m *Input) XXX_DiscardUnknown() { + xxx_messageInfo_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_Input proto.InternalMessageInfo + +// Output defines the properties of order's output +type Output struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` +} + +func (m *Output) Reset() { *m = Output{} } +func (m *Output) String() string { return proto.CompactTextString(m) } +func (*Output) ProtoMessage() {} +func (*Output) Descriptor() ([]byte, []int) { + return fileDescriptor_ac63172e3bfc925a, []int{1} +} +func (m *Output) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Output.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 *Output) XXX_Merge(src proto.Message) { + xxx_messageInfo_Output.Merge(m, src) +} +func (m *Output) XXX_Size() int { + return m.Size() +} +func (m *Output) XXX_DiscardUnknown() { + xxx_messageInfo_Output.DiscardUnknown(m) +} + +var xxx_messageInfo_Output proto.InternalMessageInfo + +// Params defines token module's parameters +type Params struct { + Fee github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` +} + +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_ac63172e3bfc925a, []int{2} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Input)(nil), "irismod.coinswap.Input") + proto.RegisterType((*Output)(nil), "irismod.coinswap.Output") + proto.RegisterType((*Params)(nil), "irismod.coinswap.Params") +} + +func init() { proto.RegisterFile("coinswap/coinswap.proto", fileDescriptor_ac63172e3bfc925a) } + +var fileDescriptor_ac63172e3bfc925a = []byte{ + // 298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xce, 0xcf, 0xcc, + 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x87, 0x31, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x32, + 0x8b, 0x32, 0x8b, 0x73, 0xf3, 0x53, 0xf4, 0x60, 0xe2, 0x52, 0x72, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, + 0xc5, 0xfa, 0x49, 0x89, 0xc5, 0xa9, 0xfa, 0x65, 0x86, 0x49, 0xa9, 0x25, 0x89, 0x86, 0x60, 0x5d, + 0x10, 0x1d, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x0a, + 0xe3, 0x62, 0xf5, 0xcc, 0x2b, 0x28, 0x2d, 0x11, 0x92, 0xe0, 0x62, 0x4f, 0x4c, 0x49, 0x29, 0x4a, + 0x2d, 0x2e, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0x8c, 0xb9, 0x58, 0x40, + 0xc6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xea, 0x41, 0xec, 0xd1, 0x03, 0xd9, 0xa3, + 0x07, 0xb5, 0x47, 0xcf, 0x39, 0x3f, 0x33, 0xcf, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xb0, + 0x62, 0xa5, 0x70, 0x2e, 0x36, 0xff, 0xd2, 0x12, 0x1a, 0x18, 0x5c, 0xc2, 0xc5, 0x16, 0x90, 0x58, + 0x94, 0x98, 0x5b, 0x2c, 0x94, 0xc0, 0xc5, 0x9c, 0x96, 0x9a, 0x0a, 0x36, 0x14, 0xaf, 0x6e, 0x63, + 0x90, 0xee, 0x5b, 0xf7, 0xe4, 0xb5, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, + 0xf5, 0x41, 0xa1, 0x97, 0x97, 0x5a, 0x02, 0xa6, 0x33, 0x4a, 0x93, 0x74, 0x8b, 0x53, 0xb2, 0x75, + 0xd3, 0xf3, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0xf5, 0x5c, 0x52, 0x93, 0x83, 0x40, 0x46, 0x5b, + 0x71, 0xcc, 0x58, 0x20, 0xcf, 0xf8, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xc0, 0x89, 0x87, 0x72, 0x0c, + 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, 0x65, 0x44, 0xd8, 0xe4, 0xdc, 0xfc, + 0x94, 0xd2, 0x9c, 0xd4, 0x62, 0x78, 0x34, 0x26, 0xb1, 0x81, 0xc3, 0xdf, 0x18, 0x10, 0x00, 0x00, + 0xff, 0xff, 0x9d, 0x26, 0xc1, 0x1c, 0xe2, 0x01, 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 + } + if !this.Fee.Equal(that1.Fee) { + return false + } + return true +} +func (m *Input) 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 *Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoinswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Output) 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 *Output) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoinswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Fee.Size() + i -= size + if _, err := m.Fee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCoinswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintCoinswap(dAtA []byte, offset int, v uint64) int { + offset -= sovCoinswap(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovCoinswap(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovCoinswap(uint64(l)) + return n +} + +func (m *Output) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovCoinswap(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovCoinswap(uint64(l)) + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovCoinswap(uint64(l)) + return n +} + +func sovCoinswap(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCoinswap(x uint64) (n int) { + return sovCoinswap(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Input) 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 ErrIntOverflowCoinswap + } + 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: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + 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 ErrInvalidLengthCoinswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoinswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoinswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoinswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Output) 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 ErrIntOverflowCoinswap + } + 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: Output: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + 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 ErrInvalidLengthCoinswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoinswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoinswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoinswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoinswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoinswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoinswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCoinswap(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, ErrIntOverflowCoinswap + } + 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, ErrIntOverflowCoinswap + } + 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, ErrIntOverflowCoinswap + } + 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, ErrInvalidLengthCoinswap + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCoinswap + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCoinswap + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCoinswap = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCoinswap = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCoinswap = fmt.Errorf("proto: unexpected end of group") +) From 9f68a8f067cc25f6f8a61e0acd8071c536c1ed16 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 16:05:14 +0800 Subject: [PATCH 05/41] module-sdk-go add coinswap rpc_client.go --- module-sdk/rpc_client.go | 213 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 module-sdk/rpc_client.go diff --git a/module-sdk/rpc_client.go b/module-sdk/rpc_client.go new file mode 100644 index 00000000..bfc26b5b --- /dev/null +++ b/module-sdk/rpc_client.go @@ -0,0 +1,213 @@ +package modules + +import ( + "context" + "fmt" + + "github.com/tendermint/tendermint/crypto/tmhash" + "github.com/tendermint/tendermint/libs/log" + rpc "github.com/tendermint/tendermint/rpc/client" + rpchttp "github.com/tendermint/tendermint/rpc/client/http" + tmtypes "github.com/tendermint/tendermint/types" + + "github.com/irisnet/irishub-sdk-go/codec" + sdk "github.com/irisnet/irishub-sdk-go/types" + "github.com/irisnet/irishub-sdk-go/utils/uuid" +) + +type rpcClient struct { + rpc.Client + log.Logger + cdc *codec.LegacyAmino + txDecoder sdk.TxDecoder +} + +func NewRPCClient( + remote string, + cdc *codec.LegacyAmino, + txDecoder sdk.TxDecoder, + logger log.Logger, + timeout uint, +) sdk.TmClient { + client, err := rpchttp.NewWithTimeout(remote, "/websocket", timeout) + if err != nil { + panic(err) + } + + _ = client.Start() + return rpcClient{ + Client: client, + Logger: logger, + cdc: cdc, + txDecoder: txDecoder, + } +} + +// ============================================================================= +// SubscribeNewBlock implement WSClient interface +func (r rpcClient) SubscribeNewBlock(builder *sdk.EventQueryBuilder, handler sdk.EventNewBlockHandler) (sdk.Subscription, sdk.Error) { + if builder == nil { + builder = sdk.NewEventQueryBuilder() + } + + builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(tmtypes.EventNewBlock)) + query := builder.Build() + + return r.SubscribeAny(query, func(data sdk.EventData) { + handler(data.(sdk.EventDataNewBlock)) + }) +} + +// SubscribeTx implement WSClient interface +func (r rpcClient) SubscribeTx(builder *sdk.EventQueryBuilder, handler sdk.EventTxHandler) (sdk.Subscription, sdk.Error) { + if builder == nil { + builder = sdk.NewEventQueryBuilder() + } + query := builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(sdk.TxValue)).Build() + return r.SubscribeAny(query, func(data sdk.EventData) { + handler(data.(sdk.EventDataTx)) + }) +} + +func (r rpcClient) SubscribeNewBlockHeader(handler sdk.EventNewBlockHeaderHandler) (sdk.Subscription, sdk.Error) { + query := tmtypes.QueryForEvent(tmtypes.EventNewBlockHeader).String() + return r.SubscribeAny(query, func(data sdk.EventData) { + handler(data.(sdk.EventDataNewBlockHeader)) + }) +} + +func (r rpcClient) SubscribeValidatorSetUpdates(handler sdk.EventValidatorSetUpdatesHandler) (sdk.Subscription, sdk.Error) { + query := tmtypes.QueryForEvent(tmtypes.EventValidatorSetUpdates).String() + return r.SubscribeAny(query, func(data sdk.EventData) { + handler(data.(sdk.EventDataValidatorSetUpdates)) + }) +} + +func (r rpcClient) Resubscribe(subscription sdk.Subscription, handler sdk.EventHandler) (err sdk.Error) { + _, err = r.SubscribeAny(subscription.Query, handler) + return +} + +func (r rpcClient) Unsubscribe(subscription sdk.Subscription) sdk.Error { + r.Info("end to subscribe event", "query", subscription.Query, "subscriber", subscription.ID) + err := r.Client.Unsubscribe(subscription.Ctx, subscription.ID, subscription.Query) + if err != nil { + r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) + return sdk.Wrap(err) + } + return nil +} + +func (r rpcClient) SubscribeAny(query string, handler sdk.EventHandler) (subscription sdk.Subscription, err sdk.Error) { + ctx := context.Background() + subscriber := getSubscriber() + ch, e := r.Subscribe(ctx, subscriber, query, 0) + if e != nil { + return subscription, sdk.Wrap(e) + } + + r.Info("subscribe event", "query", query, "subscriber", subscription.ID) + + subscription = sdk.Subscription{ + Ctx: ctx, + Query: query, + ID: subscriber, + } + + go func() { + for { + data := <-ch + go func() { + defer sdk.CatchPanic(func(errMsg string) { + r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) + }) + + switch data := data.Data.(type) { + case tmtypes.EventDataTx: + handler(r.parseTx(data)) + return + case tmtypes.EventDataNewBlock: + handler(r.parseNewBlock(data)) + return + case tmtypes.EventDataNewBlockHeader: + handler(r.parseNewBlockHeader(data)) + return + case tmtypes.EventDataValidatorSetUpdates: + handler(r.parseValidatorSetUpdates(data)) + return + default: + handler(data) + } + }() + } + }() + return +} + +func (r rpcClient) parseTx(data sdk.EventData) sdk.EventDataTx { + dataTx := data.(tmtypes.EventDataTx) + tx, err := r.txDecoder(dataTx.Tx) + if err != nil { + return sdk.EventDataTx{} + } + + hash := sdk.HexBytes(tmhash.Sum(dataTx.Tx)).String() + result := sdk.TxResult{ + Code: dataTx.Result.Code, + Log: dataTx.Result.Log, + GasWanted: dataTx.Result.GasWanted, + GasUsed: dataTx.Result.GasUsed, + Events: sdk.StringifyEvents(dataTx.Result.Events), + } + return sdk.EventDataTx{ + Hash: hash, + Height: dataTx.Height, + Index: dataTx.Index, + Tx: tx, + Result: result, + } +} + +func (r rpcClient) parseNewBlock(data sdk.EventData) sdk.EventDataNewBlock { + block := data.(tmtypes.EventDataNewBlock) + return sdk.EventDataNewBlock{ + Block: sdk.ParseBlock(r.cdc, block.Block), + ResultBeginBlock: sdk.ResultBeginBlock{ + Events: sdk.StringifyEvents(block.ResultBeginBlock.Events), + }, + ResultEndBlock: sdk.ResultEndBlock{ + Events: sdk.StringifyEvents(block.ResultEndBlock.Events), + ValidatorUpdates: sdk.ParseValidatorUpdate(block.ResultEndBlock.ValidatorUpdates), + }, + } +} + +func (r rpcClient) parseNewBlockHeader(data sdk.EventData) sdk.EventDataNewBlockHeader { + blockHeader := data.(tmtypes.EventDataNewBlockHeader) + return sdk.EventDataNewBlockHeader{ + Header: blockHeader.Header, + ResultBeginBlock: sdk.ResultBeginBlock{ + Events: sdk.StringifyEvents(blockHeader.ResultBeginBlock.Events), + }, + ResultEndBlock: sdk.ResultEndBlock{ + Events: sdk.StringifyEvents(blockHeader.ResultEndBlock.Events), + ValidatorUpdates: sdk.ParseValidatorUpdate(blockHeader.ResultEndBlock.ValidatorUpdates), + }, + } +} + +func (r rpcClient) parseValidatorSetUpdates(data sdk.EventData) sdk.EventDataValidatorSetUpdates { + validatorSet := data.(tmtypes.EventDataValidatorSetUpdates) + return sdk.EventDataValidatorSetUpdates{ + ValidatorUpdates: sdk.ParseValidators(r.cdc, validatorSet.ValidatorUpdates), + } +} + +func getSubscriber() string { + subscriber := "irishub-sdk-go" + id, err := uuid.NewV1() + if err == nil { + subscriber = fmt.Sprintf("%s-%s", subscriber, id.String()) + } + return subscriber +} From 57eb98326b232c914530dd088223fdaa39f5951a Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 17:48:49 +0800 Subject: [PATCH 06/41] fix module-sdk-go coinswap --- core-sdk/types/tm_types.go | 19 + module-sdk/coinswap/codec.go | 29 -- module-sdk/coinswap/coinswap.go | 390 --------------- module-sdk/coinswap/coinswap.pb.go | 766 ----------------------------- module-sdk/rpc_client.go | 213 -------- 5 files changed, 19 insertions(+), 1398 deletions(-) delete mode 100644 module-sdk/coinswap/codec.go delete mode 100644 module-sdk/coinswap/coinswap.go delete mode 100644 module-sdk/coinswap/coinswap.pb.go delete mode 100644 module-sdk/rpc_client.go diff --git a/core-sdk/types/tm_types.go b/core-sdk/types/tm_types.go index 873faec2..6fd1ae92 100644 --- a/core-sdk/types/tm_types.go +++ b/core-sdk/types/tm_types.go @@ -1,12 +1,14 @@ package types import ( + "encoding/hex" cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/types/kv" "github.com/tendermint/tendermint/crypto" tmbytes "github.com/tendermint/tendermint/libs/bytes" tmclient "github.com/tendermint/tendermint/rpc/client" tmtypes "github.com/tendermint/tendermint/types" + "strings" ) type ( @@ -24,3 +26,20 @@ type ( var ( PubKeyFromBytes = cryptoAmino.PubKeyFromBytes ) + +func MustHexBytesFrom(hexStr string) HexBytes { + v, _ := hex.DecodeString(hexStr) + return HexBytes(v) +} + +func HexBytesFrom(hexStr string) (HexBytes, error) { + v, err := hex.DecodeString(hexStr) + if err != nil { + return nil, err + } + return HexBytes(v), nil +} + +func HexStringFrom(bz []byte) string { + return strings.ToUpper(hex.EncodeToString(bz)) +} diff --git a/module-sdk/coinswap/codec.go b/module-sdk/coinswap/codec.go deleted file mode 100644 index 613fe3bb..00000000 --- a/module-sdk/coinswap/codec.go +++ /dev/null @@ -1,29 +0,0 @@ -package coinswap - -import ( - - "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/codec/types" - cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" - sdk "github.com/irisnet/core-sdk-go/types" - -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgAddLiquidity{}, - &MsgRemoveLiquidity{}, - &MsgSwapOrder{}, - ) -} diff --git a/module-sdk/coinswap/coinswap.go b/module-sdk/coinswap/coinswap.go deleted file mode 100644 index 165569ef..00000000 --- a/module-sdk/coinswap/coinswap.go +++ /dev/null @@ -1,390 +0,0 @@ -package coinswap - -import ( - "context" - "errors" - "fmt" - "strings" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type coinswapClient struct { - sdk.BaseClient - codec.Marshaler - totalSupply -} - -func NewClient(bc sdk.BaseClient, cdc codec.Marshaler, queryTotalSupply totalSupply) Client { - return coinswapClient{ - BaseClient: bc, - Marshaler: cdc, - totalSupply: queryTotalSupply, - } -} - -func (swap coinswapClient) Name() string { - return ModuleName -} - -func (swap coinswapClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (swap coinswapClient) AddLiquidity(request AddLiquidityRequest, - baseTx sdk.BaseTx) (*AddLiquidityResponse, error) { - creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrap(err) - } - - msg := &MsgAddLiquidity{ - MaxToken: request.MaxToken, - ExactStandardAmt: request.BaseAmt, - MinLiquidity: request.MinLiquidity, - Deadline: request.Deadline, - Sender: creator.String(), - } - - res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, err - } - - var totalCoins = sdk.NewCoins() - coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) - for _, coinStr := range coinStrs { - coins, er := sdk.ParseCoins(coinStr) - if er != nil { - swap.Logger().Error("Parse coin str failed", "coin", coinStr) - continue - } - totalCoins = totalCoins.Add(coins...) - } - - liquidityDenom, er := GetLiquidityDenomFrom(request.MaxToken.Denom) - if er != nil { - return nil, er - } - response := &AddLiquidityResponse{ - TokenAmt: totalCoins.AmountOf(request.MaxToken.Denom), - BaseAmt: request.BaseAmt, - Liquidity: totalCoins.AmountOf(liquidityDenom), - TxHash: res.Hash, - } - return response, nil -} - -func (swap coinswapClient) RemoveLiquidity(request RemoveLiquidityRequest, - baseTx sdk.BaseTx) (*RemoveLiquidityResponse, error) { - creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrap(err) - } - - msg := &MsgRemoveLiquidity{ - WithdrawLiquidity: request.Liquidity, - MinToken: request.MinTokenAmt, - MinStandardAmt: request.MinBaseAmt, - Deadline: request.Deadline, - Sender: creator.String(), - } - - res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, err - } - - var totalCoins = sdk.NewCoins() - coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) - for _, coinStr := range coinStrs { - coins, er := sdk.ParseCoins(coinStr) - if er != nil { - swap.Logger().Error("Parse coin str failed", "coin", coinStr) - continue - } - totalCoins = totalCoins.Add(coins...) - } - - tokenDenom, er := GetTokenDenomFrom(request.Liquidity.Denom) - if er != nil { - return nil, er - } - - response := &RemoveLiquidityResponse{ - TokenAmt: totalCoins.AmountOf(tokenDenom), - BaseAmt: totalCoins.AmountOf(sdk.BaseDenom), - Liquidity: request.Liquidity, - TxHash: res.Hash, - } - return response, nil -} - -func (swap coinswapClient) SwapCoin(request SwapCoinRequest, baseTx sdk.BaseTx) (*SwapCoinResponse, error) { - creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrap(err) - } - - input := Input{ - Address: creator.String(), - Coin: request.Input, - } - - if len(request.Receiver) == 0 { - request.Receiver = input.Address - } - - output := Output{ - Address: request.Receiver, - Coin: request.Output, - } - - msg := &MsgSwapOrder{ - Input: input, - Output: output, - Deadline: request.Deadline, - IsBuyOrder: request.IsBuyOrder, - } - - res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, err - } - - amount, er := res.Events.GetValue(eventTypeSwap, attributeKeyAmount) - if er != nil { - return nil, er - } - - amt, ok := sdk.NewIntFromString(amount) - if !ok { - return nil, sdk.Wrapf("%s can not convert to sdk.Int type", amount) - } - - inputAmt := request.Input.Amount - outputAmt := request.Output.Amount - if request.IsBuyOrder { - inputAmt = amt - } else { - outputAmt = amt - } - - response := &SwapCoinResponse{ - InputAmt: inputAmt, - OutputAmt: outputAmt, - TxHash: res.Hash, - } - return response, nil -} - -func (swap coinswapClient) BuyTokenWithAutoEstimate(paidTokenDenom string, boughtCoin sdk.Coin, - deadline int64, - baseTx sdk.BaseTx, -) (res *SwapCoinResponse, err error) { - var amount = sdk.ZeroInt() - switch { - case paidTokenDenom == sdk.BaseDenom: - amount, err = swap.EstimateBaseForBoughtToken(boughtCoin) - break - case boughtCoin.Denom == sdk.BaseDenom: - amount, err = swap.EstimateTokenForBoughtBase(paidTokenDenom, boughtCoin.Amount) - break - default: - amount, err = swap.EstimateTokenForBoughtToken(paidTokenDenom, boughtCoin) - break - } - - if err != nil { - return nil, err - } - - req := SwapCoinRequest{ - Input: sdk.NewCoin(paidTokenDenom, amount), - Output: boughtCoin, - Deadline: deadline, - IsBuyOrder: true, - } - return swap.SwapCoin(req, baseTx) -} - -func (swap coinswapClient) SellTokenWithAutoEstimate(gotTokenDenom string, soldCoin sdk.Coin, - deadline int64, - baseTx sdk.BaseTx, -) (res *SwapCoinResponse, err error) { - var amount = sdk.ZeroInt() - switch { - case gotTokenDenom == sdk.BaseDenom: - amount, err = swap.EstimateBaseForSoldToken(soldCoin) - break - case soldCoin.Denom == sdk.BaseDenom: - amount, err = swap.EstimateTokenForSoldBase(gotTokenDenom, soldCoin.Amount) - break - default: - amount, err = swap.EstimateTokenForSoldToken(gotTokenDenom, soldCoin) - break - } - - if err != nil { - return nil, err - } - - req := SwapCoinRequest{ - Input: soldCoin, - Output: sdk.NewCoin(gotTokenDenom, amount), - Deadline: deadline, - IsBuyOrder: false, - } - return swap.SwapCoin(req, baseTx) -} - -func (swap coinswapClient) QueryPool(denom string) (*QueryPoolResponse, error) { - conn, err := swap.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Liquidity( - context.Background(), - &QueryLiquidityRequest{Denom: denom}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return resp.Convert().(*QueryPoolResponse), err -} - -func (swap coinswapClient) QueryAllPools() (*QueryAllPoolsResponse, error) { - coins, err := swap.totalSupply() - if err != nil { - return nil, sdk.Wrap(err) - } - - var pools []QueryPoolResponse - for _, coin := range coins { - //Compatible with old data - if strings.HasPrefix(coin.Denom, "swap/") { - continue - } - denom, err := GetTokenDenomFrom(coin.Denom) - if err != nil { - continue - } - res, err := swap.QueryPool(denom) - if err != nil { - return nil, sdk.Wrap(err) - } - pools = append(pools, *res) - } - return &QueryAllPoolsResponse{pools}, err -} - -func (swap coinswapClient) EstimateTokenForSoldBase(tokenDenom string, - soldBaseAmt sdk.Int, -) (sdk.Int, error) { - result, err := swap.QueryPool(tokenDenom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getInputPrice(soldBaseAmt, - result.BaseCoin.Amount, result.TokenCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateBaseForSoldToken(soldToken sdk.Coin) (sdk.Int, error) { - result, err := swap.QueryPool(soldToken.Denom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getInputPrice(soldToken.Amount, - result.TokenCoin.Amount, result.BaseCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateTokenForSoldToken(boughtTokenDenom string, - soldToken sdk.Coin) (sdk.Int, error) { - if boughtTokenDenom == soldToken.Denom { - return sdk.ZeroInt(), errors.New("invalid trade") - } - - boughtBaseAmt, err := swap.EstimateBaseForSoldToken(soldToken) - if err != nil { - return sdk.ZeroInt(), err - } - return swap.EstimateTokenForSoldBase(boughtTokenDenom, boughtBaseAmt) -} - -func (swap coinswapClient) EstimateTokenForBoughtBase(soldTokenDenom string, - exactBoughtBaseAmt sdk.Int) (sdk.Int, error) { - result, err := swap.QueryPool(soldTokenDenom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getOutputPrice(exactBoughtBaseAmt, - result.TokenCoin.Amount, result.BaseCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateBaseForBoughtToken(boughtToken sdk.Coin) (sdk.Int, error) { - result, err := swap.QueryPool(boughtToken.Denom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getOutputPrice(boughtToken.Amount, - result.BaseCoin.Amount, result.TokenCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateTokenForBoughtToken(soldTokenDenom string, - boughtToken sdk.Coin) (sdk.Int, error) { - if soldTokenDenom == boughtToken.Denom { - return sdk.ZeroInt(), errors.New("invalid trade") - } - - soldBaseAmt, err := swap.EstimateBaseForBoughtToken(boughtToken) - if err != nil { - return sdk.ZeroInt(), err - } - return swap.EstimateTokenForBoughtBase(soldTokenDenom, soldBaseAmt) -} - -func GetLiquidityDenomFrom(denom string) (string, error) { - if denom == sdk.BaseDenom { - return "", sdk.Wrapf("should not be base denom : %s", denom) - } - return fmt.Sprintf("swap%s", denom), nil -} - -func GetTokenDenomFrom(liquidityDenom string) (string, error) { - if !strings.HasPrefix(liquidityDenom, "swap") { - return "", sdk.Wrapf("wrong liquidity denom : %s", liquidityDenom) - } - return strings.TrimPrefix(liquidityDenom, "swap"), nil -} - -// getInputPrice returns the amount of coins bought (calculated) given the input amount being sold (exact) -// The fee is included in the input coins being bought -// https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf -func getInputPrice(inputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { - deltaFee := sdk.OneDec().Sub(fee) - inputAmtWithFee := inputAmt.Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) - numerator := inputAmtWithFee.Mul(outputReserve) - denominator := inputReserve.Mul(sdk.NewIntWithDecimal(1, sdk.Precision)).Add(inputAmtWithFee) - return numerator.Quo(denominator) -} - -// getOutputPrice returns the amount of coins sold (calculated) given the output amount being bought (exact) -// The fee is included in the output coins being bought -func getOutputPrice(outputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { - deltaFee := sdk.OneDec().Sub(fee) - numerator := inputReserve.Mul(outputAmt).Mul(sdk.NewIntWithDecimal(1, sdk.Precision)) - denominator := (outputReserve.Sub(outputAmt)).Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) - return numerator.Quo(denominator).Add(sdk.OneInt()) -} diff --git a/module-sdk/coinswap/coinswap.pb.go b/module-sdk/coinswap/coinswap.pb.go deleted file mode 100644 index 8487a674..00000000 --- a/module-sdk/coinswap/coinswap.pb.go +++ /dev/null @@ -1,766 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: coinswap/coinswap.proto - -package coinswap - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Input defines the properties of order's input -type Input struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` -} - -func (m *Input) Reset() { *m = Input{} } -func (m *Input) String() string { return proto.CompactTextString(m) } -func (*Input) ProtoMessage() {} -func (*Input) Descriptor() ([]byte, []int) { - return fileDescriptor_ac63172e3bfc925a, []int{0} -} -func (m *Input) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Input.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 *Input) XXX_Merge(src proto.Message) { - xxx_messageInfo_Input.Merge(m, src) -} -func (m *Input) XXX_Size() int { - return m.Size() -} -func (m *Input) XXX_DiscardUnknown() { - xxx_messageInfo_Input.DiscardUnknown(m) -} - -var xxx_messageInfo_Input proto.InternalMessageInfo - -// Output defines the properties of order's output -type Output struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` -} - -func (m *Output) Reset() { *m = Output{} } -func (m *Output) String() string { return proto.CompactTextString(m) } -func (*Output) ProtoMessage() {} -func (*Output) Descriptor() ([]byte, []int) { - return fileDescriptor_ac63172e3bfc925a, []int{1} -} -func (m *Output) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Output.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 *Output) XXX_Merge(src proto.Message) { - xxx_messageInfo_Output.Merge(m, src) -} -func (m *Output) XXX_Size() int { - return m.Size() -} -func (m *Output) XXX_DiscardUnknown() { - xxx_messageInfo_Output.DiscardUnknown(m) -} - -var xxx_messageInfo_Output proto.InternalMessageInfo - -// Params defines token module's parameters -type Params struct { - Fee github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` -} - -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_ac63172e3bfc925a, []int{2} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Input)(nil), "irismod.coinswap.Input") - proto.RegisterType((*Output)(nil), "irismod.coinswap.Output") - proto.RegisterType((*Params)(nil), "irismod.coinswap.Params") -} - -func init() { proto.RegisterFile("coinswap/coinswap.proto", fileDescriptor_ac63172e3bfc925a) } - -var fileDescriptor_ac63172e3bfc925a = []byte{ - // 298 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xce, 0xcf, 0xcc, - 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x87, 0x31, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x32, - 0x8b, 0x32, 0x8b, 0x73, 0xf3, 0x53, 0xf4, 0x60, 0xe2, 0x52, 0x72, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, - 0xc5, 0xfa, 0x49, 0x89, 0xc5, 0xa9, 0xfa, 0x65, 0x86, 0x49, 0xa9, 0x25, 0x89, 0x86, 0x60, 0x5d, - 0x10, 0x1d, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x0a, - 0xe3, 0x62, 0xf5, 0xcc, 0x2b, 0x28, 0x2d, 0x11, 0x92, 0xe0, 0x62, 0x4f, 0x4c, 0x49, 0x29, 0x4a, - 0x2d, 0x2e, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0x8c, 0xb9, 0x58, 0x40, - 0xc6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xea, 0x41, 0xec, 0xd1, 0x03, 0xd9, 0xa3, - 0x07, 0xb5, 0x47, 0xcf, 0x39, 0x3f, 0x33, 0xcf, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xb0, - 0x62, 0xa5, 0x70, 0x2e, 0x36, 0xff, 0xd2, 0x12, 0x1a, 0x18, 0x5c, 0xc2, 0xc5, 0x16, 0x90, 0x58, - 0x94, 0x98, 0x5b, 0x2c, 0x94, 0xc0, 0xc5, 0x9c, 0x96, 0x9a, 0x0a, 0x36, 0x14, 0xaf, 0x6e, 0x63, - 0x90, 0xee, 0x5b, 0xf7, 0xe4, 0xb5, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, - 0xf5, 0x41, 0xa1, 0x97, 0x97, 0x5a, 0x02, 0xa6, 0x33, 0x4a, 0x93, 0x74, 0x8b, 0x53, 0xb2, 0x75, - 0xd3, 0xf3, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0xf5, 0x5c, 0x52, 0x93, 0x83, 0x40, 0x46, 0x5b, - 0x71, 0xcc, 0x58, 0x20, 0xcf, 0xf8, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xc0, 0x89, 0x87, 0x72, 0x0c, - 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, 0x65, 0x44, 0xd8, 0xe4, 0xdc, 0xfc, - 0x94, 0xd2, 0x9c, 0xd4, 0x62, 0x78, 0x34, 0x26, 0xb1, 0x81, 0xc3, 0xdf, 0x18, 0x10, 0x00, 0x00, - 0xff, 0xff, 0x9d, 0x26, 0xc1, 0x1c, 0xe2, 0x01, 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 - } - if !this.Fee.Equal(that1.Fee) { - return false - } - return true -} -func (m *Input) 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 *Input) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCoinswap(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Output) 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 *Output) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCoinswap(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Fee.Size() - i -= size - if _, err := m.Fee.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoinswap(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintCoinswap(dAtA []byte, offset int, v uint64) int { - offset -= sovCoinswap(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Input) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovCoinswap(uint64(l)) - } - l = m.Coin.Size() - n += 1 + l + sovCoinswap(uint64(l)) - return n -} - -func (m *Output) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovCoinswap(uint64(l)) - } - l = m.Coin.Size() - n += 1 + l + sovCoinswap(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Fee.Size() - n += 1 + l + sovCoinswap(uint64(l)) - return n -} - -func sovCoinswap(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCoinswap(x uint64) (n int) { - return sovCoinswap(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Input) 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 ErrIntOverflowCoinswap - } - 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: Input: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - 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 ErrInvalidLengthCoinswap - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoinswap - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoinswap(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoinswap - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Output) 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 ErrIntOverflowCoinswap - } - 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: Output: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - 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 ErrInvalidLengthCoinswap - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoinswap - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoinswap(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoinswap - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoinswap - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoinswap(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoinswap - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCoinswap(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, ErrIntOverflowCoinswap - } - 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, ErrIntOverflowCoinswap - } - 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, ErrIntOverflowCoinswap - } - 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, ErrInvalidLengthCoinswap - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCoinswap - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCoinswap - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCoinswap = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCoinswap = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCoinswap = fmt.Errorf("proto: unexpected end of group") -) diff --git a/module-sdk/rpc_client.go b/module-sdk/rpc_client.go deleted file mode 100644 index bfc26b5b..00000000 --- a/module-sdk/rpc_client.go +++ /dev/null @@ -1,213 +0,0 @@ -package modules - -import ( - "context" - "fmt" - - "github.com/tendermint/tendermint/crypto/tmhash" - "github.com/tendermint/tendermint/libs/log" - rpc "github.com/tendermint/tendermint/rpc/client" - rpchttp "github.com/tendermint/tendermint/rpc/client/http" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/irisnet/irishub-sdk-go/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/utils/uuid" -) - -type rpcClient struct { - rpc.Client - log.Logger - cdc *codec.LegacyAmino - txDecoder sdk.TxDecoder -} - -func NewRPCClient( - remote string, - cdc *codec.LegacyAmino, - txDecoder sdk.TxDecoder, - logger log.Logger, - timeout uint, -) sdk.TmClient { - client, err := rpchttp.NewWithTimeout(remote, "/websocket", timeout) - if err != nil { - panic(err) - } - - _ = client.Start() - return rpcClient{ - Client: client, - Logger: logger, - cdc: cdc, - txDecoder: txDecoder, - } -} - -// ============================================================================= -// SubscribeNewBlock implement WSClient interface -func (r rpcClient) SubscribeNewBlock(builder *sdk.EventQueryBuilder, handler sdk.EventNewBlockHandler) (sdk.Subscription, sdk.Error) { - if builder == nil { - builder = sdk.NewEventQueryBuilder() - } - - builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(tmtypes.EventNewBlock)) - query := builder.Build() - - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataNewBlock)) - }) -} - -// SubscribeTx implement WSClient interface -func (r rpcClient) SubscribeTx(builder *sdk.EventQueryBuilder, handler sdk.EventTxHandler) (sdk.Subscription, sdk.Error) { - if builder == nil { - builder = sdk.NewEventQueryBuilder() - } - query := builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(sdk.TxValue)).Build() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataTx)) - }) -} - -func (r rpcClient) SubscribeNewBlockHeader(handler sdk.EventNewBlockHeaderHandler) (sdk.Subscription, sdk.Error) { - query := tmtypes.QueryForEvent(tmtypes.EventNewBlockHeader).String() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataNewBlockHeader)) - }) -} - -func (r rpcClient) SubscribeValidatorSetUpdates(handler sdk.EventValidatorSetUpdatesHandler) (sdk.Subscription, sdk.Error) { - query := tmtypes.QueryForEvent(tmtypes.EventValidatorSetUpdates).String() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataValidatorSetUpdates)) - }) -} - -func (r rpcClient) Resubscribe(subscription sdk.Subscription, handler sdk.EventHandler) (err sdk.Error) { - _, err = r.SubscribeAny(subscription.Query, handler) - return -} - -func (r rpcClient) Unsubscribe(subscription sdk.Subscription) sdk.Error { - r.Info("end to subscribe event", "query", subscription.Query, "subscriber", subscription.ID) - err := r.Client.Unsubscribe(subscription.Ctx, subscription.ID, subscription.Query) - if err != nil { - r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) - return sdk.Wrap(err) - } - return nil -} - -func (r rpcClient) SubscribeAny(query string, handler sdk.EventHandler) (subscription sdk.Subscription, err sdk.Error) { - ctx := context.Background() - subscriber := getSubscriber() - ch, e := r.Subscribe(ctx, subscriber, query, 0) - if e != nil { - return subscription, sdk.Wrap(e) - } - - r.Info("subscribe event", "query", query, "subscriber", subscription.ID) - - subscription = sdk.Subscription{ - Ctx: ctx, - Query: query, - ID: subscriber, - } - - go func() { - for { - data := <-ch - go func() { - defer sdk.CatchPanic(func(errMsg string) { - r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) - }) - - switch data := data.Data.(type) { - case tmtypes.EventDataTx: - handler(r.parseTx(data)) - return - case tmtypes.EventDataNewBlock: - handler(r.parseNewBlock(data)) - return - case tmtypes.EventDataNewBlockHeader: - handler(r.parseNewBlockHeader(data)) - return - case tmtypes.EventDataValidatorSetUpdates: - handler(r.parseValidatorSetUpdates(data)) - return - default: - handler(data) - } - }() - } - }() - return -} - -func (r rpcClient) parseTx(data sdk.EventData) sdk.EventDataTx { - dataTx := data.(tmtypes.EventDataTx) - tx, err := r.txDecoder(dataTx.Tx) - if err != nil { - return sdk.EventDataTx{} - } - - hash := sdk.HexBytes(tmhash.Sum(dataTx.Tx)).String() - result := sdk.TxResult{ - Code: dataTx.Result.Code, - Log: dataTx.Result.Log, - GasWanted: dataTx.Result.GasWanted, - GasUsed: dataTx.Result.GasUsed, - Events: sdk.StringifyEvents(dataTx.Result.Events), - } - return sdk.EventDataTx{ - Hash: hash, - Height: dataTx.Height, - Index: dataTx.Index, - Tx: tx, - Result: result, - } -} - -func (r rpcClient) parseNewBlock(data sdk.EventData) sdk.EventDataNewBlock { - block := data.(tmtypes.EventDataNewBlock) - return sdk.EventDataNewBlock{ - Block: sdk.ParseBlock(r.cdc, block.Block), - ResultBeginBlock: sdk.ResultBeginBlock{ - Events: sdk.StringifyEvents(block.ResultBeginBlock.Events), - }, - ResultEndBlock: sdk.ResultEndBlock{ - Events: sdk.StringifyEvents(block.ResultEndBlock.Events), - ValidatorUpdates: sdk.ParseValidatorUpdate(block.ResultEndBlock.ValidatorUpdates), - }, - } -} - -func (r rpcClient) parseNewBlockHeader(data sdk.EventData) sdk.EventDataNewBlockHeader { - blockHeader := data.(tmtypes.EventDataNewBlockHeader) - return sdk.EventDataNewBlockHeader{ - Header: blockHeader.Header, - ResultBeginBlock: sdk.ResultBeginBlock{ - Events: sdk.StringifyEvents(blockHeader.ResultBeginBlock.Events), - }, - ResultEndBlock: sdk.ResultEndBlock{ - Events: sdk.StringifyEvents(blockHeader.ResultEndBlock.Events), - ValidatorUpdates: sdk.ParseValidatorUpdate(blockHeader.ResultEndBlock.ValidatorUpdates), - }, - } -} - -func (r rpcClient) parseValidatorSetUpdates(data sdk.EventData) sdk.EventDataValidatorSetUpdates { - validatorSet := data.(tmtypes.EventDataValidatorSetUpdates) - return sdk.EventDataValidatorSetUpdates{ - ValidatorUpdates: sdk.ParseValidators(r.cdc, validatorSet.ValidatorUpdates), - } -} - -func getSubscriber() string { - subscriber := "irishub-sdk-go" - id, err := uuid.NewV1() - if err == nil { - subscriber = fmt.Sprintf("%s-%s", subscriber, id.String()) - } - return subscriber -} From 557b5b31f83e0f0b6ec70beefd01c10901fd1afd Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 17:51:27 +0800 Subject: [PATCH 07/41] module-sdk-go coinswap refactoring --- module-sdk/coinswap/codec.go | 29 + module-sdk/coinswap/coinswap.go | 389 ++++++ module-sdk/coinswap/coinswap.pb.go | 766 ++++++++++++ module-sdk/coinswap/export.go | 93 ++ module-sdk/coinswap/genesis.pb.go | 375 ++++++ module-sdk/coinswap/go.mod | 13 + module-sdk/coinswap/query.pb.go | 751 ++++++++++++ module-sdk/coinswap/tx.pb.go | 1756 ++++++++++++++++++++++++++++ module-sdk/coinswap/types.go | 164 +++ 9 files changed, 4336 insertions(+) create mode 100644 module-sdk/coinswap/codec.go create mode 100644 module-sdk/coinswap/coinswap.go create mode 100644 module-sdk/coinswap/coinswap.pb.go create mode 100644 module-sdk/coinswap/export.go create mode 100644 module-sdk/coinswap/genesis.pb.go create mode 100644 module-sdk/coinswap/go.mod create mode 100644 module-sdk/coinswap/query.pb.go create mode 100644 module-sdk/coinswap/tx.pb.go create mode 100644 module-sdk/coinswap/types.go diff --git a/module-sdk/coinswap/codec.go b/module-sdk/coinswap/codec.go new file mode 100644 index 00000000..613fe3bb --- /dev/null +++ b/module-sdk/coinswap/codec.go @@ -0,0 +1,29 @@ +package coinswap + +import ( + + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" + +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgAddLiquidity{}, + &MsgRemoveLiquidity{}, + &MsgSwapOrder{}, + ) +} diff --git a/module-sdk/coinswap/coinswap.go b/module-sdk/coinswap/coinswap.go new file mode 100644 index 00000000..e564a628 --- /dev/null +++ b/module-sdk/coinswap/coinswap.go @@ -0,0 +1,389 @@ +package coinswap + +import ( + "context" + "errors" + "fmt" + "strings" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" +) + +type coinswapClient struct { + sdk.BaseClient + codec.Marshaler + totalSupply +} + +func NewClient(bc sdk.BaseClient, cdc codec.Marshaler, queryTotalSupply totalSupply) Client { + return coinswapClient{ + BaseClient: bc, + Marshaler: cdc, + totalSupply: queryTotalSupply, + } +} + +func (swap coinswapClient) Name() string { + return ModuleName +} + +func (swap coinswapClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (swap coinswapClient) AddLiquidity(request AddLiquidityRequest, + baseTx sdk.BaseTx) (*AddLiquidityResponse, error) { + creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return nil, sdk.Wrap(err) + } + + msg := &MsgAddLiquidity{ + MaxToken: request.MaxToken, + ExactStandardAmt: request.BaseAmt, + MinLiquidity: request.MinLiquidity, + Deadline: request.Deadline, + Sender: creator.String(), + } + + res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return nil, err + } + + var totalCoins = sdk.NewCoins() + coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) + for _, coinStr := range coinStrs { + coins, er := sdk.ParseCoins(coinStr) + if er != nil { + swap.Logger().Error("Parse coin str failed", "coin", coinStr) + continue + } + totalCoins = totalCoins.Add(coins...) + } + + liquidityDenom, er := GetLiquidityDenomFrom(request.MaxToken.Denom) + if er != nil { + return nil, er + } + response := &AddLiquidityResponse{ + TokenAmt: totalCoins.AmountOf(request.MaxToken.Denom), + BaseAmt: request.BaseAmt, + Liquidity: totalCoins.AmountOf(liquidityDenom), + TxHash: res.Hash, + } + return response, nil +} + +func (swap coinswapClient) RemoveLiquidity(request RemoveLiquidityRequest, + baseTx sdk.BaseTx) (*RemoveLiquidityResponse, error) { + creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return nil, sdk.Wrap(err) + } + + msg := &MsgRemoveLiquidity{ + WithdrawLiquidity: request.Liquidity, + MinToken: request.MinTokenAmt, + MinStandardAmt: request.MinBaseAmt, + Deadline: request.Deadline, + Sender: creator.String(), + } + + res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return nil, err + } + + var totalCoins = sdk.NewCoins() + coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) + for _, coinStr := range coinStrs { + coins, er := sdk.ParseCoins(coinStr) + if er != nil { + swap.Logger().Error("Parse coin str failed", "coin", coinStr) + continue + } + totalCoins = totalCoins.Add(coins...) + } + + tokenDenom, er := GetTokenDenomFrom(request.Liquidity.Denom) + if er != nil { + return nil, er + } + + response := &RemoveLiquidityResponse{ + TokenAmt: totalCoins.AmountOf(tokenDenom), + BaseAmt: totalCoins.AmountOf(sdk.BaseDenom), + Liquidity: request.Liquidity, + TxHash: res.Hash, + } + return response, nil +} + +func (swap coinswapClient) SwapCoin(request SwapCoinRequest, baseTx sdk.BaseTx) (*SwapCoinResponse, error) { + creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return nil, sdk.Wrap(err) + } + + input := Input{ + Address: creator.String(), + Coin: request.Input, + } + + if len(request.Receiver) == 0 { + request.Receiver = input.Address + } + + output := Output{ + Address: request.Receiver, + Coin: request.Output, + } + + msg := &MsgSwapOrder{ + Input: input, + Output: output, + Deadline: request.Deadline, + IsBuyOrder: request.IsBuyOrder, + } + + res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return nil, err + } + + amount, er := res.Events.GetValue(eventTypeSwap, attributeKeyAmount) + if er != nil { + return nil, er + } + + amt, ok := sdk.NewIntFromString(amount) + if !ok { + return nil, sdk.Wrapf("%s can not convert to sdk.Int type", amount) + } + + inputAmt := request.Input.Amount + outputAmt := request.Output.Amount + if request.IsBuyOrder { + inputAmt = amt + } else { + outputAmt = amt + } + + response := &SwapCoinResponse{ + InputAmt: inputAmt, + OutputAmt: outputAmt, + TxHash: res.Hash, + } + return response, nil +} + +func (swap coinswapClient) BuyTokenWithAutoEstimate(paidTokenDenom string, boughtCoin sdk.Coin, + deadline int64, + baseTx sdk.BaseTx, +) (res *SwapCoinResponse, err error) { + var amount = sdk.ZeroInt() + switch { + case paidTokenDenom == sdk.BaseDenom: + amount, err = swap.EstimateBaseForBoughtToken(boughtCoin) + break + case boughtCoin.Denom == sdk.BaseDenom: + amount, err = swap.EstimateTokenForBoughtBase(paidTokenDenom, boughtCoin.Amount) + break + default: + amount, err = swap.EstimateTokenForBoughtToken(paidTokenDenom, boughtCoin) + break + } + + if err != nil { + return nil, err + } + + req := SwapCoinRequest{ + Input: sdk.NewCoin(paidTokenDenom, amount), + Output: boughtCoin, + Deadline: deadline, + IsBuyOrder: true, + } + return swap.SwapCoin(req, baseTx) +} + +func (swap coinswapClient) SellTokenWithAutoEstimate(gotTokenDenom string, soldCoin sdk.Coin, + deadline int64, + baseTx sdk.BaseTx, +) (res *SwapCoinResponse, err error) { + var amount = sdk.ZeroInt() + switch { + case gotTokenDenom == sdk.BaseDenom: + amount, err = swap.EstimateBaseForSoldToken(soldCoin) + break + case soldCoin.Denom == sdk.BaseDenom: + amount, err = swap.EstimateTokenForSoldBase(gotTokenDenom, soldCoin.Amount) + break + default: + amount, err = swap.EstimateTokenForSoldToken(gotTokenDenom, soldCoin) + break + } + + if err != nil { + return nil, err + } + + req := SwapCoinRequest{ + Input: soldCoin, + Output: sdk.NewCoin(gotTokenDenom, amount), + Deadline: deadline, + IsBuyOrder: false, + } + return swap.SwapCoin(req, baseTx) +} + +func (swap coinswapClient) QueryPool(denom string) (*QueryPoolResponse, error) { + conn, err := swap.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Liquidity( + context.Background(), + &QueryLiquidityRequest{Denom: denom}, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + return resp.Convert().(*QueryPoolResponse), err +} + +func (swap coinswapClient) QueryAllPools() (*QueryAllPoolsResponse, error) { + coins, err := swap.totalSupply() + if err != nil { + return nil, sdk.Wrap(err) + } + + var pools []QueryPoolResponse + for _, coin := range coins { + //Compatible with old data + if strings.HasPrefix(coin.Denom, "swap/") { + continue + } + denom, err := GetTokenDenomFrom(coin.Denom) + if err != nil { + continue + } + res, err := swap.QueryPool(denom) + if err != nil { + return nil, sdk.Wrap(err) + } + pools = append(pools, *res) + } + return &QueryAllPoolsResponse{pools}, err +} + +func (swap coinswapClient) EstimateTokenForSoldBase(tokenDenom string, + soldBaseAmt sdk.Int, +) (sdk.Int, error) { + result, err := swap.QueryPool(tokenDenom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getInputPrice(soldBaseAmt, + result.BaseCoin.Amount, result.TokenCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateBaseForSoldToken(soldToken sdk.Coin) (sdk.Int, error) { + result, err := swap.QueryPool(soldToken.Denom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getInputPrice(soldToken.Amount, + result.TokenCoin.Amount, result.BaseCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateTokenForSoldToken(boughtTokenDenom string, + soldToken sdk.Coin) (sdk.Int, error) { + if boughtTokenDenom == soldToken.Denom { + return sdk.ZeroInt(), errors.New("invalid trade") + } + + boughtBaseAmt, err := swap.EstimateBaseForSoldToken(soldToken) + if err != nil { + return sdk.ZeroInt(), err + } + return swap.EstimateTokenForSoldBase(boughtTokenDenom, boughtBaseAmt) +} + +func (swap coinswapClient) EstimateTokenForBoughtBase(soldTokenDenom string, + exactBoughtBaseAmt sdk.Int) (sdk.Int, error) { + result, err := swap.QueryPool(soldTokenDenom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getOutputPrice(exactBoughtBaseAmt, + result.TokenCoin.Amount, result.BaseCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateBaseForBoughtToken(boughtToken sdk.Coin) (sdk.Int, error) { + result, err := swap.QueryPool(boughtToken.Denom) + if err != nil { + return sdk.ZeroInt(), err + } + fee := sdk.MustNewDecFromStr(result.Fee) + amount := getOutputPrice(boughtToken.Amount, + result.BaseCoin.Amount, result.TokenCoin.Amount, fee) + return amount, nil +} + +func (swap coinswapClient) EstimateTokenForBoughtToken(soldTokenDenom string, + boughtToken sdk.Coin) (sdk.Int, error) { + if soldTokenDenom == boughtToken.Denom { + return sdk.ZeroInt(), errors.New("invalid trade") + } + + soldBaseAmt, err := swap.EstimateBaseForBoughtToken(boughtToken) + if err != nil { + return sdk.ZeroInt(), err + } + return swap.EstimateTokenForBoughtBase(soldTokenDenom, soldBaseAmt) +} + +func GetLiquidityDenomFrom(denom string) (string, error) { + if denom == sdk.BaseDenom { + return "", sdk.Wrapf("should not be base denom : %s", denom) + } + return fmt.Sprintf("swap%s", denom), nil +} + +func GetTokenDenomFrom(liquidityDenom string) (string, error) { + if !strings.HasPrefix(liquidityDenom, "swap") { + return "", sdk.Wrapf("wrong liquidity denom : %s", liquidityDenom) + } + return strings.TrimPrefix(liquidityDenom, "swap"), nil +} + +// getInputPrice returns the amount of coins bought (calculated) given the input amount being sold (exact) +// The fee is included in the input coins being bought +// https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf +func getInputPrice(inputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { + deltaFee := sdk.OneDec().Sub(fee) + inputAmtWithFee := inputAmt.Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) + numerator := inputAmtWithFee.Mul(outputReserve) + denominator := inputReserve.Mul(sdk.NewIntWithDecimal(1, sdk.Precision)).Add(inputAmtWithFee) + return numerator.Quo(denominator) +} + +// getOutputPrice returns the amount of coins sold (calculated) given the output amount being bought (exact) +// The fee is included in the output coins being bought +func getOutputPrice(outputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { + deltaFee := sdk.OneDec().Sub(fee) + numerator := inputReserve.Mul(outputAmt).Mul(sdk.NewIntWithDecimal(1, sdk.Precision)) + denominator := (outputReserve.Sub(outputAmt)).Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) + return numerator.Quo(denominator).Add(sdk.OneInt()) +} diff --git a/module-sdk/coinswap/coinswap.pb.go b/module-sdk/coinswap/coinswap.pb.go new file mode 100644 index 00000000..2d9f7087 --- /dev/null +++ b/module-sdk/coinswap/coinswap.pb.go @@ -0,0 +1,766 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: coinswap/coinswap.proto + +package coinswap + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Input defines the properties of order's input +type Input struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` +} + +func (m *Input) Reset() { *m = Input{} } +func (m *Input) String() string { return proto.CompactTextString(m) } +func (*Input) ProtoMessage() {} +func (*Input) Descriptor() ([]byte, []int) { + return fileDescriptor_ac63172e3bfc925a, []int{0} +} +func (m *Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Input.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 *Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_Input.Merge(m, src) +} +func (m *Input) XXX_Size() int { + return m.Size() +} +func (m *Input) XXX_DiscardUnknown() { + xxx_messageInfo_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_Input proto.InternalMessageInfo + +// Output defines the properties of order's output +type Output struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` +} + +func (m *Output) Reset() { *m = Output{} } +func (m *Output) String() string { return proto.CompactTextString(m) } +func (*Output) ProtoMessage() {} +func (*Output) Descriptor() ([]byte, []int) { + return fileDescriptor_ac63172e3bfc925a, []int{1} +} +func (m *Output) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Output.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 *Output) XXX_Merge(src proto.Message) { + xxx_messageInfo_Output.Merge(m, src) +} +func (m *Output) XXX_Size() int { + return m.Size() +} +func (m *Output) XXX_DiscardUnknown() { + xxx_messageInfo_Output.DiscardUnknown(m) +} + +var xxx_messageInfo_Output proto.InternalMessageInfo + +// Params defines token module's parameters +type Params struct { + Fee github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` +} + +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_ac63172e3bfc925a, []int{2} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Input)(nil), "irismod.coinswap.Input") + proto.RegisterType((*Output)(nil), "irismod.coinswap.Output") + proto.RegisterType((*Params)(nil), "irismod.coinswap.Params") +} + +func init() { proto.RegisterFile("coinswap/coinswap.proto", fileDescriptor_ac63172e3bfc925a) } + +var fileDescriptor_ac63172e3bfc925a = []byte{ + // 298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xce, 0xcf, 0xcc, + 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x87, 0x31, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x32, + 0x8b, 0x32, 0x8b, 0x73, 0xf3, 0x53, 0xf4, 0x60, 0xe2, 0x52, 0x72, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, + 0xc5, 0xfa, 0x49, 0x89, 0xc5, 0xa9, 0xfa, 0x65, 0x86, 0x49, 0xa9, 0x25, 0x89, 0x86, 0x60, 0x5d, + 0x10, 0x1d, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x0a, + 0xe3, 0x62, 0xf5, 0xcc, 0x2b, 0x28, 0x2d, 0x11, 0x92, 0xe0, 0x62, 0x4f, 0x4c, 0x49, 0x29, 0x4a, + 0x2d, 0x2e, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0x8c, 0xb9, 0x58, 0x40, + 0xc6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xea, 0x41, 0xec, 0xd1, 0x03, 0xd9, 0xa3, + 0x07, 0xb5, 0x47, 0xcf, 0x39, 0x3f, 0x33, 0xcf, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xb0, + 0x62, 0xa5, 0x70, 0x2e, 0x36, 0xff, 0xd2, 0x12, 0x1a, 0x18, 0x5c, 0xc2, 0xc5, 0x16, 0x90, 0x58, + 0x94, 0x98, 0x5b, 0x2c, 0x94, 0xc0, 0xc5, 0x9c, 0x96, 0x9a, 0x0a, 0x36, 0x14, 0xaf, 0x6e, 0x63, + 0x90, 0xee, 0x5b, 0xf7, 0xe4, 0xb5, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, + 0xf5, 0x41, 0xa1, 0x97, 0x97, 0x5a, 0x02, 0xa6, 0x33, 0x4a, 0x93, 0x74, 0x8b, 0x53, 0xb2, 0x75, + 0xd3, 0xf3, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0xf5, 0x5c, 0x52, 0x93, 0x83, 0x40, 0x46, 0x5b, + 0x71, 0xcc, 0x58, 0x20, 0xcf, 0xf8, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xc0, 0x89, 0x87, 0x72, 0x0c, + 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, 0x65, 0x44, 0xd8, 0xe4, 0xdc, 0xfc, + 0x94, 0xd2, 0x9c, 0xd4, 0x62, 0x78, 0x34, 0x26, 0xb1, 0x81, 0xc3, 0xdf, 0x18, 0x10, 0x00, 0x00, + 0xff, 0xff, 0x9d, 0x26, 0xc1, 0x1c, 0xe2, 0x01, 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 + } + if !this.Fee.Equal(that1.Fee) { + return false + } + return true +} +func (m *Input) 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 *Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoinswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Output) 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 *Output) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCoinswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Fee.Size() + i -= size + if _, err := m.Fee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintCoinswap(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintCoinswap(dAtA []byte, offset int, v uint64) int { + offset -= sovCoinswap(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovCoinswap(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovCoinswap(uint64(l)) + return n +} + +func (m *Output) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovCoinswap(uint64(l)) + } + l = m.Coin.Size() + n += 1 + l + sovCoinswap(uint64(l)) + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Fee.Size() + n += 1 + l + sovCoinswap(uint64(l)) + return n +} + +func sovCoinswap(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCoinswap(x uint64) (n int) { + return sovCoinswap(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Input) 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 ErrIntOverflowCoinswap + } + 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: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + 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 ErrInvalidLengthCoinswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoinswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoinswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoinswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Output) 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 ErrIntOverflowCoinswap + } + 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: Output: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + 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 ErrInvalidLengthCoinswap + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoinswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoinswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoinswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCoinswap + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCoinswap + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCoinswap + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCoinswap(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCoinswap + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCoinswap(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, ErrIntOverflowCoinswap + } + 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, ErrIntOverflowCoinswap + } + 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, ErrIntOverflowCoinswap + } + 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, ErrInvalidLengthCoinswap + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCoinswap + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCoinswap + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCoinswap = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCoinswap = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCoinswap = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/coinswap/export.go b/module-sdk/coinswap/export.go new file mode 100644 index 00000000..dd33b7c2 --- /dev/null +++ b/module-sdk/coinswap/export.go @@ -0,0 +1,93 @@ +package coinswap + +import ( + sdk "github.com/irisnet/core-sdk-go/types" +) + +// expose Record module api for user +type Client interface { + sdk.Module + AddLiquidity(request AddLiquidityRequest, + baseTx sdk.BaseTx) (*AddLiquidityResponse, error) + RemoveLiquidity(request RemoveLiquidityRequest, + baseTx sdk.BaseTx) (*RemoveLiquidityResponse, error) + SwapCoin(request SwapCoinRequest, + baseTx sdk.BaseTx) (*SwapCoinResponse, error) + + BuyTokenWithAutoEstimate(paidTokenDenom string, boughtCoin sdk.Coin, + deadline int64, + baseTx sdk.BaseTx, + ) (res *SwapCoinResponse, err error) + SellTokenWithAutoEstimate(gotTokenDenom string, soldCoin sdk.Coin, + deadline int64, + baseTx sdk.BaseTx, + ) (res *SwapCoinResponse, err error) + + QueryPool(denom string) (*QueryPoolResponse, error) + QueryAllPools() (*QueryAllPoolsResponse, error) + + EstimateTokenForSoldBase(tokenDenom string, + soldBase sdk.Int, + ) (sdk.Int, error) + EstimateBaseForSoldToken(soldToken sdk.Coin) (sdk.Int, error) + EstimateTokenForSoldToken(boughtTokenDenom string, + soldToken sdk.Coin) (sdk.Int, error) + EstimateTokenForBoughtBase(soldTokenDenom string, + boughtBase sdk.Int) (sdk.Int, error) + EstimateBaseForBoughtToken(boughtToken sdk.Coin) (sdk.Int, error) + EstimateTokenForBoughtToken(soldTokenDenom string, + boughtToken sdk.Coin) (sdk.Int, error) +} + +type AddLiquidityRequest struct { + MaxToken sdk.Coin + BaseAmt sdk.Int + MinLiquidity sdk.Int + Deadline int64 +} + +type AddLiquidityResponse struct { + TokenAmt sdk.Int + BaseAmt sdk.Int + Liquidity sdk.Int + TxHash string +} + +type RemoveLiquidityRequest struct { + MinTokenAmt sdk.Int + MinBaseAmt sdk.Int + Liquidity sdk.Coin + Deadline int64 +} + +type RemoveLiquidityResponse struct { + TokenAmt sdk.Int + BaseAmt sdk.Int + Liquidity sdk.Coin + TxHash string +} + +type SwapCoinRequest struct { + Input sdk.Coin + Output sdk.Coin + Receiver string + Deadline int64 + IsBuyOrder bool +} + +type SwapCoinResponse struct { + InputAmt sdk.Int + OutputAmt sdk.Int + TxHash string +} + +type QueryPoolResponse struct { + BaseCoin sdk.Coin + TokenCoin sdk.Coin + Liquidity sdk.Coin + Fee string +} + +type QueryAllPoolsResponse struct { + Pools []QueryPoolResponse +} diff --git a/module-sdk/coinswap/genesis.pb.go b/module-sdk/coinswap/genesis.pb.go new file mode 100644 index 00000000..a4bac7ed --- /dev/null +++ b/module-sdk/coinswap/genesis.pb.go @@ -0,0 +1,375 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: coinswap/genesis.proto + +package coinswap + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 coinswap module's genesis state +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + StandardDenom string `protobuf:"bytes,2,opt,name=standard_denom,json=standardDenom,proto3" json:"standard_denom,omitempty" yaml:"standard_denom"` +} + +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_2ec819868131a4f8, []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) GetStandardDenom() string { + if m != nil { + return m.StandardDenom + } + return "" +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "irismod.coinswap.GenesisState") +} + +func init() { proto.RegisterFile("coinswap/genesis.proto", fileDescriptor_2ec819868131a4f8) } + +var fileDescriptor_2ec819868131a4f8 = []byte{ + // 246 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xce, 0xcf, 0xcc, + 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0x12, 0xc8, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0xc9, 0x4b, 0x89, + 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf5, 0x41, 0x2c, 0x88, 0x3a, 0x29, 0x71, 0xb8, 0x7e, 0x18, + 0x03, 0x22, 0xa1, 0xd4, 0xc1, 0xc8, 0xc5, 0xe3, 0x0e, 0x31, 0x32, 0xb8, 0x24, 0xb1, 0x24, 0x55, + 0xc8, 0x8c, 0x8b, 0xad, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, + 0x48, 0x42, 0x0f, 0xdd, 0x0a, 0xbd, 0x00, 0xb0, 0xbc, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, + 0x50, 0xd5, 0x42, 0x0e, 0x5c, 0x7c, 0xc5, 0x25, 0x89, 0x79, 0x29, 0x89, 0x45, 0x29, 0xf1, 0x29, + 0xa9, 0x79, 0xf9, 0xb9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x92, 0x9f, 0xee, 0xc9, 0x8b, + 0x56, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xa1, 0xca, 0x2b, 0x05, 0xf1, 0xc2, 0x04, 0x5c, 0x40, 0x7c, + 0x27, 0x9f, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, + 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4a, 0xcf, 0x2c, + 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0xb9, 0x26, 0x2f, 0xb5, 0x04, 0x4c, 0x67, + 0x94, 0x26, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0xa6, 0xe7, 0xeb, 0xe7, 0xe6, 0xa7, 0x94, 0xe6, 0xa4, + 0x16, 0xc3, 0xbd, 0x97, 0xc4, 0x06, 0xf6, 0x9f, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xea, 0xd9, + 0x0a, 0x0d, 0x3a, 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.StandardDenom) > 0 { + i -= len(m.StandardDenom) + copy(dAtA[i:], m.StandardDenom) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.StandardDenom))) + 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)) + l = len(m.StandardDenom) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field 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 StandardDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StandardDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod new file mode 100644 index 00000000..7ed81b63 --- /dev/null +++ b/module-sdk/coinswap/go.mod @@ -0,0 +1,13 @@ +module coinswap + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/coinswap/query.pb.go b/module-sdk/coinswap/query.pb.go new file mode 100644 index 00000000..ab8d933f --- /dev/null +++ b/module-sdk/coinswap/query.pb.go @@ -0,0 +1,751 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: coinswap/query.proto + +package coinswap + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + types "github.com/irisnet/core-sdk-go/types" + _ "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 + +// QueryLiquidityRequest is request type for the Query/Liquidity RPC method +type QueryLiquidityRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryLiquidityRequest) Reset() { *m = QueryLiquidityRequest{} } +func (m *QueryLiquidityRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidityRequest) ProtoMessage() {} +func (*QueryLiquidityRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_2cabf8423404f12f, []int{0} +} +func (m *QueryLiquidityRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidityRequest.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 *QueryLiquidityRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidityRequest.Merge(m, src) +} +func (m *QueryLiquidityRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidityRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidityRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidityRequest proto.InternalMessageInfo + +func (m *QueryLiquidityRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QueryLiquidityResponse is response type for the Query/Liquidity RPC method +type QueryLiquidityResponse struct { + Standard types.Coin `protobuf:"bytes,1,opt,name=standard,proto3" json:"standard"` + Token types.Coin `protobuf:"bytes,2,opt,name=token,proto3" json:"token"` + Liquidity types.Coin `protobuf:"bytes,3,opt,name=liquidity,proto3" json:"liquidity"` + Fee string `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee,omitempty"` +} + +func (m *QueryLiquidityResponse) Reset() { *m = QueryLiquidityResponse{} } +func (m *QueryLiquidityResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidityResponse) ProtoMessage() {} +func (*QueryLiquidityResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2cabf8423404f12f, []int{1} +} +func (m *QueryLiquidityResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidityResponse.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 *QueryLiquidityResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidityResponse.Merge(m, src) +} +func (m *QueryLiquidityResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidityResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidityResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidityResponse proto.InternalMessageInfo + +func (m *QueryLiquidityResponse) GetStandard() types.Coin { + if m != nil { + return m.Standard + } + return types.Coin{} +} + +func (m *QueryLiquidityResponse) GetToken() types.Coin { + if m != nil { + return m.Token + } + return types.Coin{} +} + +func (m *QueryLiquidityResponse) GetLiquidity() types.Coin { + if m != nil { + return m.Liquidity + } + return types.Coin{} +} + +func (m *QueryLiquidityResponse) GetFee() string { + if m != nil { + return m.Fee + } + return "" +} + +func init() { + proto.RegisterType((*QueryLiquidityRequest)(nil), "irismod.coinswap.QueryLiquidityRequest") + proto.RegisterType((*QueryLiquidityResponse)(nil), "irismod.coinswap.QueryLiquidityResponse") +} + +func init() { proto.RegisterFile("coinswap/query.proto", fileDescriptor_2cabf8423404f12f) } + +var fileDescriptor_2cabf8423404f12f = []byte{ + // 380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbf, 0x6b, 0xdb, 0x40, + 0x14, 0xc7, 0x75, 0xfe, 0x51, 0xea, 0xeb, 0x62, 0x0e, 0xb7, 0xa8, 0xa6, 0xa8, 0xc5, 0x50, 0xec, + 0x45, 0x77, 0xd8, 0xa5, 0x53, 0xe9, 0xe2, 0xae, 0x5e, 0xea, 0xb1, 0xdb, 0xc9, 0xba, 0xca, 0x87, + 0xad, 0x7b, 0xb2, 0xee, 0x94, 0x60, 0x42, 0x96, 0xec, 0x81, 0x40, 0x86, 0xfc, 0x4b, 0x1e, 0x0d, + 0x59, 0xb2, 0x24, 0x04, 0x3b, 0x7f, 0x48, 0xd0, 0xc9, 0x56, 0xc0, 0x04, 0xe2, 0x49, 0x4f, 0xf7, + 0xde, 0xe7, 0xde, 0xf7, 0x7d, 0xdf, 0xe1, 0xd6, 0x04, 0xa4, 0xd2, 0xa7, 0x3c, 0x61, 0x8b, 0x4c, + 0xa4, 0x4b, 0x9a, 0xa4, 0x60, 0x80, 0x34, 0x65, 0x2a, 0x75, 0x0c, 0x21, 0xdd, 0x67, 0xdb, 0xde, + 0x04, 0x74, 0x0c, 0x9a, 0x05, 0x5c, 0x0b, 0x76, 0xd2, 0x0f, 0x84, 0xe1, 0x7d, 0x96, 0x67, 0x0b, + 0xa2, 0xdd, 0x8a, 0x20, 0x02, 0x1b, 0xb2, 0x3c, 0xda, 0x9d, 0x7e, 0x89, 0x00, 0xa2, 0xb9, 0x60, + 0x3c, 0x91, 0x8c, 0x2b, 0x05, 0x86, 0x1b, 0x09, 0x4a, 0x17, 0xd9, 0x8e, 0x8f, 0x3f, 0xfe, 0xcd, + 0x9b, 0x8e, 0xe4, 0x22, 0x93, 0xa1, 0x34, 0xcb, 0xb1, 0x58, 0x64, 0x42, 0x1b, 0xd2, 0xc2, 0xf5, + 0x50, 0x28, 0x88, 0x5d, 0xf4, 0x0d, 0xf5, 0x1a, 0xe3, 0xe2, 0xa7, 0x73, 0x8f, 0xf0, 0xa7, 0xc3, + 0x7a, 0x9d, 0x80, 0xd2, 0x82, 0xfc, 0xc2, 0xef, 0xb5, 0xe1, 0x2a, 0xe4, 0x69, 0x68, 0x99, 0x0f, + 0x83, 0xcf, 0xb4, 0x10, 0x4c, 0x73, 0xc1, 0x74, 0x27, 0x98, 0xfe, 0x01, 0xa9, 0x86, 0xb5, 0xd5, + 0xc3, 0x57, 0x67, 0x5c, 0x02, 0xe4, 0x27, 0xae, 0x1b, 0x98, 0x09, 0xe5, 0x56, 0x8e, 0x23, 0x8b, + 0x6a, 0xf2, 0x1b, 0x37, 0xe6, 0x7b, 0x21, 0x6e, 0xf5, 0x38, 0xf4, 0x85, 0x20, 0x4d, 0x5c, 0xfd, + 0x2f, 0x84, 0x5b, 0xb3, 0x13, 0xe6, 0xe1, 0xe0, 0x06, 0xe1, 0xba, 0x9d, 0x8f, 0x5c, 0x22, 0xdc, + 0x28, 0x87, 0x24, 0x5d, 0x7a, 0xb8, 0x0d, 0xfa, 0xaa, 0x6d, 0xed, 0xde, 0xdb, 0x85, 0x85, 0x5f, + 0x1d, 0xff, 0xe2, 0xf6, 0xe9, 0xba, 0xd2, 0x25, 0xdf, 0xd9, 0x8e, 0x60, 0xe5, 0x33, 0xd8, 0x2b, + 0x94, 0x42, 0xb3, 0x33, 0x6b, 0xfc, 0xf9, 0x70, 0xb4, 0xda, 0x78, 0x68, 0xbd, 0xf1, 0xd0, 0xe3, + 0xc6, 0x43, 0x57, 0x5b, 0xcf, 0x59, 0x6f, 0x3d, 0xe7, 0x6e, 0xeb, 0x39, 0xff, 0x06, 0x91, 0x34, + 0xd3, 0x2c, 0xa0, 0x13, 0x88, 0xed, 0x55, 0x4a, 0x18, 0xfb, 0x9d, 0x66, 0x81, 0xaf, 0xc3, 0x99, + 0x1f, 0x01, 0x8b, 0x21, 0xcc, 0xe6, 0x42, 0x97, 0x1d, 0x82, 0x77, 0x76, 0xfb, 0x3f, 0x9e, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x4f, 0x9c, 0xdd, 0x1a, 0x7b, 0x02, 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 { + // Liquidity returns the total liquidity available for the provided + // denomination + Liquidity(ctx context.Context, in *QueryLiquidityRequest, opts ...grpc.CallOption) (*QueryLiquidityResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Liquidity(ctx context.Context, in *QueryLiquidityRequest, opts ...grpc.CallOption) (*QueryLiquidityResponse, error) { + out := new(QueryLiquidityResponse) + err := c.cc.Invoke(ctx, "/irismod.coinswap.Query/Liquidity", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Liquidity returns the total liquidity available for the provided + // denomination + Liquidity(context.Context, *QueryLiquidityRequest) (*QueryLiquidityResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Liquidity(ctx context.Context, req *QueryLiquidityRequest) (*QueryLiquidityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Liquidity not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Liquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLiquidityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Liquidity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.coinswap.Query/Liquidity", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Liquidity(ctx, req.(*QueryLiquidityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.coinswap.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Liquidity", + Handler: _Query_Liquidity_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "coinswap/query.proto", +} + +func (m *QueryLiquidityRequest) 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 *QueryLiquidityRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidityRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryLiquidityResponse) 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 *QueryLiquidityResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Fee) > 0 { + i -= len(m.Fee) + copy(dAtA[i:], m.Fee) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Fee))) + i-- + dAtA[i] = 0x22 + } + { + size, err := m.Liquidity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Standard.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 *QueryLiquidityRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLiquidityResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Standard.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Token.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Liquidity.Size() + n += 1 + l + sovQuery(uint64(l)) + l = len(m.Fee) + if l > 0 { + 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 *QueryLiquidityRequest) 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: QueryLiquidityRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLiquidityRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryLiquidityResponse) 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: QueryLiquidityResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLiquidityResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Standard", 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.Standard.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Liquidity", 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.Liquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", 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.Fee = 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 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/module-sdk/coinswap/tx.pb.go b/module-sdk/coinswap/tx.pb.go new file mode 100644 index 00000000..3ffbad02 --- /dev/null +++ b/module-sdk/coinswap/tx.pb.go @@ -0,0 +1,1756 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: coinswap/tx.proto + +package coinswap + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + 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 + +// MsgAddLiquidity defines a msg for adding liquidity to a reserve pool +type MsgAddLiquidity struct { + MaxToken types.Coin `protobuf:"bytes,1,opt,name=max_token,json=maxToken,proto3" json:"max_token" yaml:"max_token"` + ExactStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=exact_standard_amt,json=exactStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"exact_standard_amt" yaml:"exact_standard_amt"` + MinLiquidity github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_liquidity,json=minLiquidity,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_liquidity" yaml:"min_liquidity"` + Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` + Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgAddLiquidity) Reset() { *m = MsgAddLiquidity{} } +func (m *MsgAddLiquidity) String() string { return proto.CompactTextString(m) } +func (*MsgAddLiquidity) ProtoMessage() {} +func (*MsgAddLiquidity) Descriptor() ([]byte, []int) { + return fileDescriptor_f3a5860d70ca9b75, []int{0} +} +func (m *MsgAddLiquidity) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddLiquidity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddLiquidity.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 *MsgAddLiquidity) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddLiquidity.Merge(m, src) +} +func (m *MsgAddLiquidity) XXX_Size() int { + return m.Size() +} +func (m *MsgAddLiquidity) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddLiquidity.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddLiquidity proto.InternalMessageInfo + +// MsgAddLiquidityResponse defines the Msg/AddLiquidity response type +type MsgAddLiquidityResponse struct { + MintToken *types.Coin `protobuf:"bytes,1,opt,name=mint_token,json=mintToken,proto3" json:"mint_token,omitempty"` +} + +func (m *MsgAddLiquidityResponse) Reset() { *m = MsgAddLiquidityResponse{} } +func (m *MsgAddLiquidityResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddLiquidityResponse) ProtoMessage() {} +func (*MsgAddLiquidityResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f3a5860d70ca9b75, []int{1} +} +func (m *MsgAddLiquidityResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddLiquidityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddLiquidityResponse.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 *MsgAddLiquidityResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddLiquidityResponse.Merge(m, src) +} +func (m *MsgAddLiquidityResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddLiquidityResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddLiquidityResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddLiquidityResponse proto.InternalMessageInfo + +// MsgRemoveLiquidity defines a msg for removing liquidity from a reserve pool +type MsgRemoveLiquidity struct { + WithdrawLiquidity types.Coin `protobuf:"bytes,1,opt,name=withdraw_liquidity,json=withdrawLiquidity,proto3" json:"withdraw_liquidity" yaml:"withdraw_liquidity"` + MinToken github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=min_token,json=minToken,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_token" yaml:"min_token"` + MinStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_standard_amt,json=minStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_standard_amt" yaml:"min_standard_amt"` + Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` + Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgRemoveLiquidity) Reset() { *m = MsgRemoveLiquidity{} } +func (m *MsgRemoveLiquidity) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveLiquidity) ProtoMessage() {} +func (*MsgRemoveLiquidity) Descriptor() ([]byte, []int) { + return fileDescriptor_f3a5860d70ca9b75, []int{2} +} +func (m *MsgRemoveLiquidity) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveLiquidity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveLiquidity.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 *MsgRemoveLiquidity) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveLiquidity.Merge(m, src) +} +func (m *MsgRemoveLiquidity) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveLiquidity) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveLiquidity.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveLiquidity proto.InternalMessageInfo + +// MsgRemoveLiquidityResponse defines the Msg/RemoveLiquidity response type +type MsgRemoveLiquidityResponse struct { + WithdrawCoins []*types.Coin `protobuf:"bytes,1,rep,name=withdraw_coins,json=withdrawCoins,proto3" json:"withdraw_coins,omitempty"` +} + +func (m *MsgRemoveLiquidityResponse) Reset() { *m = MsgRemoveLiquidityResponse{} } +func (m *MsgRemoveLiquidityResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveLiquidityResponse) ProtoMessage() {} +func (*MsgRemoveLiquidityResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f3a5860d70ca9b75, []int{3} +} +func (m *MsgRemoveLiquidityResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveLiquidityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveLiquidityResponse.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 *MsgRemoveLiquidityResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveLiquidityResponse.Merge(m, src) +} +func (m *MsgRemoveLiquidityResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveLiquidityResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveLiquidityResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveLiquidityResponse proto.InternalMessageInfo + +// MsgSwapOrder defines a msg for swap order +type MsgSwapOrder struct { + Input Input `protobuf:"bytes,1,opt,name=input,proto3" json:"input"` + Output Output `protobuf:"bytes,2,opt,name=output,proto3" json:"output"` + Deadline int64 `protobuf:"varint,3,opt,name=deadline,proto3" json:"deadline,omitempty"` + IsBuyOrder bool `protobuf:"varint,4,opt,name=is_buy_order,json=isBuyOrder,proto3" json:"is_buy_order,omitempty" yaml:"is_buy_order"` +} + +func (m *MsgSwapOrder) Reset() { *m = MsgSwapOrder{} } +func (m *MsgSwapOrder) String() string { return proto.CompactTextString(m) } +func (*MsgSwapOrder) ProtoMessage() {} +func (*MsgSwapOrder) Descriptor() ([]byte, []int) { + return fileDescriptor_f3a5860d70ca9b75, []int{4} +} +func (m *MsgSwapOrder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapOrder.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 *MsgSwapOrder) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapOrder.Merge(m, src) +} +func (m *MsgSwapOrder) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapOrder) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapOrder.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapOrder proto.InternalMessageInfo + +// MsgSwapCoinResponse defines the Msg/SwapCoin response type +type MsgSwapCoinResponse struct { +} + +func (m *MsgSwapCoinResponse) Reset() { *m = MsgSwapCoinResponse{} } +func (m *MsgSwapCoinResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSwapCoinResponse) ProtoMessage() {} +func (*MsgSwapCoinResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f3a5860d70ca9b75, []int{5} +} +func (m *MsgSwapCoinResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSwapCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSwapCoinResponse.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 *MsgSwapCoinResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSwapCoinResponse.Merge(m, src) +} +func (m *MsgSwapCoinResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSwapCoinResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSwapCoinResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSwapCoinResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgAddLiquidity)(nil), "irismod.coinswap.MsgAddLiquidity") + proto.RegisterType((*MsgAddLiquidityResponse)(nil), "irismod.coinswap.MsgAddLiquidityResponse") + proto.RegisterType((*MsgRemoveLiquidity)(nil), "irismod.coinswap.MsgRemoveLiquidity") + proto.RegisterType((*MsgRemoveLiquidityResponse)(nil), "irismod.coinswap.MsgRemoveLiquidityResponse") + proto.RegisterType((*MsgSwapOrder)(nil), "irismod.coinswap.MsgSwapOrder") + proto.RegisterType((*MsgSwapCoinResponse)(nil), "irismod.coinswap.MsgSwapCoinResponse") +} + +func init() { proto.RegisterFile("coinswap/tx.proto", fileDescriptor_f3a5860d70ca9b75) } + +var fileDescriptor_f3a5860d70ca9b75 = []byte{ + // 699 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x4f, 0x13, 0x4f, + 0x18, 0xee, 0x52, 0x20, 0x65, 0x7e, 0x05, 0xca, 0xc2, 0xcf, 0x2e, 0x7b, 0xd8, 0x96, 0x8d, 0x26, + 0x18, 0x65, 0x1b, 0x20, 0x31, 0xea, 0x49, 0xea, 0xc1, 0x10, 0xad, 0xe0, 0xe2, 0xc9, 0x18, 0x9b, + 0x6d, 0x67, 0xb2, 0x4c, 0xe8, 0xcc, 0xac, 0x3b, 0xb3, 0xb4, 0xbd, 0x78, 0xf7, 0xe6, 0xc5, 0xa3, + 0xdf, 0x87, 0x23, 0xf1, 0x64, 0x3c, 0x34, 0x0a, 0xdf, 0x80, 0x4f, 0x60, 0x66, 0x77, 0xba, 0xfd, + 0x87, 0x42, 0x7a, 0xea, 0xcc, 0xfb, 0xbe, 0xcf, 0xfb, 0xe7, 0x79, 0xde, 0xe9, 0x82, 0x95, 0x26, + 0xc3, 0x94, 0xb7, 0xbd, 0xa0, 0x22, 0x3a, 0x4e, 0x10, 0x32, 0xc1, 0xf4, 0x02, 0x0e, 0x31, 0x27, + 0x0c, 0x3a, 0x7d, 0x97, 0x59, 0x4c, 0x83, 0xfa, 0x87, 0x24, 0xd4, 0xb4, 0x9a, 0x8c, 0x13, 0xc6, + 0x2b, 0x0d, 0x8f, 0xa3, 0xca, 0xe9, 0x76, 0x03, 0x09, 0x6f, 0x3b, 0x8e, 0x51, 0xfe, 0x35, 0x9f, + 0xf9, 0x2c, 0x3e, 0x56, 0xe4, 0x29, 0xb1, 0xda, 0x9f, 0xb3, 0x60, 0xb9, 0xc6, 0xfd, 0x3d, 0x08, + 0x5f, 0xe1, 0x8f, 0x11, 0x86, 0x58, 0x74, 0xf5, 0x43, 0xb0, 0x40, 0xbc, 0x4e, 0x5d, 0xb0, 0x13, + 0x44, 0x0d, 0xad, 0xac, 0x6d, 0xfe, 0xb7, 0xb3, 0xee, 0x24, 0xd9, 0x1d, 0x99, 0xdd, 0x51, 0xd9, + 0x9d, 0xe7, 0x0c, 0xd3, 0xaa, 0x71, 0xd6, 0x2b, 0x65, 0xae, 0x7a, 0xa5, 0x42, 0xd7, 0x23, 0xad, + 0xa7, 0x76, 0x8a, 0xb4, 0xdd, 0x1c, 0xf1, 0x3a, 0x6f, 0xe5, 0x51, 0xff, 0x04, 0x74, 0xd4, 0xf1, + 0x9a, 0xa2, 0xce, 0x85, 0x47, 0xa1, 0x17, 0xc2, 0xba, 0x47, 0x84, 0x31, 0x53, 0xd6, 0x36, 0x17, + 0xaa, 0x87, 0x12, 0xff, 0xb3, 0x57, 0x7a, 0xe0, 0x63, 0x71, 0x1c, 0x35, 0x9c, 0x26, 0x23, 0x15, + 0x39, 0x35, 0x45, 0x22, 0xfe, 0x3d, 0x8e, 0x1a, 0x5b, 0x1c, 0x9e, 0x6c, 0xf9, 0xac, 0x22, 0xba, + 0x01, 0xe2, 0xce, 0x3e, 0x15, 0x57, 0xbd, 0xd2, 0x7a, 0x52, 0x6e, 0x32, 0xad, 0xed, 0x16, 0x62, + 0xe3, 0x91, 0xb2, 0xed, 0x11, 0xa1, 0x07, 0x60, 0x91, 0x60, 0x5a, 0x6f, 0xf5, 0x47, 0x34, 0xb2, + 0x71, 0xe9, 0x97, 0xd3, 0x95, 0x5e, 0x53, 0x93, 0x0e, 0x67, 0xb4, 0xdd, 0x3c, 0xc1, 0x74, 0xc0, + 0xa1, 0x09, 0x72, 0x10, 0x79, 0xb0, 0x85, 0x29, 0x32, 0x66, 0xcb, 0xda, 0x66, 0xd6, 0x4d, 0xef, + 0xfa, 0x1d, 0x30, 0xcf, 0x11, 0x85, 0x28, 0x34, 0xe6, 0x64, 0x1b, 0xae, 0xba, 0xd9, 0x47, 0xa0, + 0x38, 0x26, 0x85, 0x8b, 0x78, 0xc0, 0x28, 0x47, 0xfa, 0x63, 0x00, 0x08, 0xa6, 0xe2, 0x96, 0x9a, + 0xb8, 0x0b, 0x32, 0x38, 0xa6, 0xde, 0xfe, 0x9a, 0x05, 0x7a, 0x8d, 0xfb, 0x2e, 0x22, 0xec, 0x14, + 0x0d, 0xfa, 0x3b, 0x01, 0x7a, 0x1b, 0x8b, 0x63, 0x18, 0x7a, 0xed, 0x21, 0x5a, 0x6e, 0x14, 0x7b, + 0x43, 0x89, 0xad, 0xd8, 0x9f, 0x4c, 0x61, 0xbb, 0x2b, 0x7d, 0xe3, 0xa0, 0x18, 0x04, 0xb2, 0x21, + 0xd5, 0x7c, 0xa2, 0xfa, 0x8b, 0xe9, 0xa8, 0x2f, 0x0c, 0xa8, 0x4f, 0x97, 0x0c, 0xd3, 0x64, 0xc9, + 0x3a, 0xa0, 0x20, 0xed, 0x23, 0x2b, 0x96, 0xe8, 0xfc, 0x7a, 0xba, 0x62, 0xc5, 0x41, 0xb1, 0xd1, + 0x05, 0x5b, 0x22, 0x98, 0x0e, 0xaf, 0xd7, 0x34, 0x62, 0x7f, 0x00, 0xe6, 0xa4, 0x2c, 0xa9, 0xde, + 0xcf, 0xc0, 0x52, 0xca, 0x6d, 0xfc, 0xce, 0x0d, 0xad, 0x9c, 0xfd, 0xb7, 0xe6, 0x8b, 0x7d, 0x80, + 0xbc, 0x71, 0xfb, 0xbb, 0x06, 0xf2, 0x35, 0xee, 0x1f, 0xb5, 0xbd, 0xe0, 0x20, 0x84, 0x28, 0xd4, + 0x77, 0xc1, 0x1c, 0xa6, 0x41, 0x24, 0x94, 0xc8, 0x45, 0x67, 0xfc, 0xaf, 0xc5, 0xd9, 0x97, 0xee, + 0xea, 0xac, 0x24, 0xcb, 0x4d, 0x62, 0xf5, 0x47, 0x60, 0x9e, 0x45, 0x42, 0xa2, 0x66, 0x62, 0x94, + 0x31, 0x89, 0x3a, 0x88, 0xfd, 0x0a, 0xa6, 0xa2, 0x47, 0x18, 0xc9, 0x8e, 0x31, 0xf2, 0x04, 0xe4, + 0x31, 0xaf, 0x37, 0xa2, 0x6e, 0x9d, 0xc9, 0xc6, 0x62, 0xc6, 0x72, 0xd5, 0xe2, 0x55, 0xaf, 0xb4, + 0x9a, 0x10, 0x3e, 0xec, 0xb5, 0x5d, 0x80, 0x79, 0x35, 0xea, 0xc6, 0x33, 0xd8, 0xff, 0x83, 0x55, + 0x35, 0x53, 0x3c, 0xb2, 0x62, 0x6b, 0xe7, 0xdb, 0x0c, 0xc8, 0xd6, 0xb8, 0xaf, 0xbf, 0x07, 0xf9, + 0x91, 0x3f, 0xb2, 0x8d, 0xc9, 0x6e, 0xc7, 0x1e, 0x98, 0x79, 0xff, 0xc6, 0x90, 0x54, 0x13, 0x04, + 0x96, 0xc7, 0x5f, 0xd1, 0xdd, 0x6b, 0xd1, 0x63, 0x51, 0xe6, 0xc3, 0xdb, 0x44, 0xa5, 0x65, 0xde, + 0x80, 0x5c, 0x7f, 0x40, 0xdd, 0xba, 0x16, 0x99, 0x6a, 0x6a, 0xde, 0xfb, 0xab, 0x7f, 0x98, 0x9f, + 0xea, 0xe1, 0xd9, 0x6f, 0x2b, 0x73, 0x76, 0x61, 0x69, 0xe7, 0x17, 0x96, 0xf6, 0xeb, 0xc2, 0xd2, + 0xbe, 0x5c, 0x5a, 0x99, 0xf3, 0x4b, 0x2b, 0xf3, 0xe3, 0xd2, 0xca, 0xbc, 0xdb, 0xb9, 0xf9, 0x55, + 0x10, 0x06, 0xa3, 0x16, 0xe2, 0xe9, 0x27, 0xa7, 0x31, 0x1f, 0x7f, 0x3d, 0x76, 0xff, 0x04, 0x00, + 0x00, 0xff, 0xff, 0x24, 0x3f, 0x54, 0x92, 0xb3, 0x06, 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 { + // AddLiquidity defines a method for depositing some tokens to the liquidity + // pool + AddLiquidity(ctx context.Context, in *MsgAddLiquidity, opts ...grpc.CallOption) (*MsgAddLiquidityResponse, error) + // RemoveLiquidity defines a method for withdraw some tokens from the + // liquidity pool + RemoveLiquidity(ctx context.Context, in *MsgRemoveLiquidity, opts ...grpc.CallOption) (*MsgRemoveLiquidityResponse, error) + // SwapCoin defines a method for swapping a token with the other token from + // the liquidity pool + SwapCoin(ctx context.Context, in *MsgSwapOrder, opts ...grpc.CallOption) (*MsgSwapCoinResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) AddLiquidity(ctx context.Context, in *MsgAddLiquidity, opts ...grpc.CallOption) (*MsgAddLiquidityResponse, error) { + out := new(MsgAddLiquidityResponse) + err := c.cc.Invoke(ctx, "/irismod.coinswap.Msg/AddLiquidity", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RemoveLiquidity(ctx context.Context, in *MsgRemoveLiquidity, opts ...grpc.CallOption) (*MsgRemoveLiquidityResponse, error) { + out := new(MsgRemoveLiquidityResponse) + err := c.cc.Invoke(ctx, "/irismod.coinswap.Msg/RemoveLiquidity", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SwapCoin(ctx context.Context, in *MsgSwapOrder, opts ...grpc.CallOption) (*MsgSwapCoinResponse, error) { + out := new(MsgSwapCoinResponse) + err := c.cc.Invoke(ctx, "/irismod.coinswap.Msg/SwapCoin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // AddLiquidity defines a method for depositing some tokens to the liquidity + // pool + AddLiquidity(context.Context, *MsgAddLiquidity) (*MsgAddLiquidityResponse, error) + // RemoveLiquidity defines a method for withdraw some tokens from the + // liquidity pool + RemoveLiquidity(context.Context, *MsgRemoveLiquidity) (*MsgRemoveLiquidityResponse, error) + // SwapCoin defines a method for swapping a token with the other token from + // the liquidity pool + SwapCoin(context.Context, *MsgSwapOrder) (*MsgSwapCoinResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) AddLiquidity(ctx context.Context, req *MsgAddLiquidity) (*MsgAddLiquidityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddLiquidity not implemented") +} +func (*UnimplementedMsgServer) RemoveLiquidity(ctx context.Context, req *MsgRemoveLiquidity) (*MsgRemoveLiquidityResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveLiquidity not implemented") +} +func (*UnimplementedMsgServer) SwapCoin(ctx context.Context, req *MsgSwapOrder) (*MsgSwapCoinResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SwapCoin not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_AddLiquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddLiquidity) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddLiquidity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.coinswap.Msg/AddLiquidity", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddLiquidity(ctx, req.(*MsgAddLiquidity)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RemoveLiquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveLiquidity) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveLiquidity(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.coinswap.Msg/RemoveLiquidity", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveLiquidity(ctx, req.(*MsgRemoveLiquidity)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SwapCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSwapOrder) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SwapCoin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.coinswap.Msg/SwapCoin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SwapCoin(ctx, req.(*MsgSwapOrder)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.coinswap.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddLiquidity", + Handler: _Msg_AddLiquidity_Handler, + }, + { + MethodName: "RemoveLiquidity", + Handler: _Msg_RemoveLiquidity_Handler, + }, + { + MethodName: "SwapCoin", + Handler: _Msg_SwapCoin_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "coinswap/tx.proto", +} + +func (m *MsgAddLiquidity) 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 *MsgAddLiquidity) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddLiquidity) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x2a + } + if m.Deadline != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Deadline)) + i-- + dAtA[i] = 0x20 + } + { + size := m.MinLiquidity.Size() + i -= size + if _, err := m.MinLiquidity.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.ExactStandardAmt.Size() + i -= size + if _, err := m.ExactStandardAmt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.MaxToken.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgAddLiquidityResponse) 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 *MsgAddLiquidityResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddLiquidityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MintToken != nil { + { + size, err := m.MintToken.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveLiquidity) 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 *MsgRemoveLiquidity) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveLiquidity) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x2a + } + if m.Deadline != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Deadline)) + i-- + dAtA[i] = 0x20 + } + { + size := m.MinStandardAmt.Size() + i -= size + if _, err := m.MinStandardAmt.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MinToken.Size() + i -= size + if _, err := m.MinToken.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.WithdrawLiquidity.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgRemoveLiquidityResponse) 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 *MsgRemoveLiquidityResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveLiquidityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WithdrawCoins) > 0 { + for iNdEx := len(m.WithdrawCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.WithdrawCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgSwapOrder) 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 *MsgSwapOrder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsBuyOrder { + i-- + if m.IsBuyOrder { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.Deadline != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Deadline)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgSwapCoinResponse) 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 *MsgSwapCoinResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSwapCoinResponse) 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 *MsgAddLiquidity) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.MaxToken.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.ExactStandardAmt.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinLiquidity.Size() + n += 1 + l + sovTx(uint64(l)) + if m.Deadline != 0 { + n += 1 + sovTx(uint64(m.Deadline)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAddLiquidityResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MintToken != nil { + l = m.MintToken.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveLiquidity) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.WithdrawLiquidity.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinToken.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinStandardAmt.Size() + n += 1 + l + sovTx(uint64(l)) + if m.Deadline != 0 { + n += 1 + sovTx(uint64(m.Deadline)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRemoveLiquidityResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.WithdrawCoins) > 0 { + for _, e := range m.WithdrawCoins { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgSwapOrder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Input.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Output.Size() + n += 1 + l + sovTx(uint64(l)) + if m.Deadline != 0 { + n += 1 + sovTx(uint64(m.Deadline)) + } + if m.IsBuyOrder { + n += 2 + } + return n +} + +func (m *MsgSwapCoinResponse) 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 *MsgAddLiquidity) 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: MsgAddLiquidity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddLiquidity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxToken", 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.MaxToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExactStandardAmt", 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 + } + if err := m.ExactStandardAmt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinLiquidity", 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 + } + if err := m.MinLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Deadline", wireType) + } + m.Deadline = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Deadline |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgAddLiquidityResponse) 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: MsgAddLiquidityResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddLiquidityResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintToken", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MintToken == nil { + m.MintToken = &types.Coin{} + } + if err := m.MintToken.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 *MsgRemoveLiquidity) 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: MsgRemoveLiquidity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveLiquidity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawLiquidity", 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.WithdrawLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinToken", 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 + } + if err := m.MinToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinStandardAmt", 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 + } + if err := m.MinStandardAmt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Deadline", wireType) + } + m.Deadline = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Deadline |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgRemoveLiquidityResponse) 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: MsgRemoveLiquidityResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveLiquidityResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawCoins = append(m.WithdrawCoins, &types.Coin{}) + if err := m.WithdrawCoins[len(m.WithdrawCoins)-1].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 *MsgSwapOrder) 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: MsgSwapOrder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapOrder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", 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.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Deadline", wireType) + } + m.Deadline = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Deadline |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsBuyOrder", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsBuyOrder = bool(v != 0) + 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 *MsgSwapCoinResponse) 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: MsgSwapCoinResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSwapCoinResponse: 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/module-sdk/coinswap/types.go b/module-sdk/coinswap/types.go new file mode 100644 index 00000000..9a2a2e0f --- /dev/null +++ b/module-sdk/coinswap/types.go @@ -0,0 +1,164 @@ +package coinswap + +import ( + sdk "github.com/irisnet/core-sdk-go/types" +) + +const ( + ModuleName = "coinswap" + + eventTypeTransfer = "transfer" + eventTypeSwap = "swap" + + attributeKeyAmount = "amount" +) + +var ( + _ sdk.Msg = &MsgAddLiquidity{} + _ sdk.Msg = &MsgRemoveLiquidity{} + _ sdk.Msg = &MsgSwapOrder{} +) + +type totalSupply = func() (sdk.Coins, sdk.Error) + +// Route implements Msg. +func (msg MsgAddLiquidity) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgAddLiquidity) Type() string { return "add_liquidity" } + +// GetSignBytes implements Msg. +func (msg MsgAddLiquidity) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgAddLiquidity) ValidateBasic() error { + if !(msg.MaxToken.IsValid() && msg.MaxToken.IsPositive()) { + return sdk.Wrapf("invalid MaxToken: %s", msg.MaxToken.String()) + } + + if !msg.ExactStandardAmt.IsPositive() { + return sdk.Wrapf("standard token amount must be positive") + } + + if msg.MinLiquidity.IsNegative() { + return sdk.Wrapf("minimum liquidity can not be negative") + } + + if msg.Deadline <= 0 { + return sdk.Wrapf("deadline %d must be greater than 0", msg.Deadline) + } + + if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { + return sdk.Wrap(err) + } + return nil +} + +// GetSigners implements Msg. +func (msg MsgAddLiquidity) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Sender)} +} + +// Route implements Msg. +func (msg MsgRemoveLiquidity) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgRemoveLiquidity) Type() string { return "remove_liquidity" } + +// GetSignBytes implements Msg. +func (msg MsgRemoveLiquidity) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgRemoveLiquidity) ValidateBasic() error { + if msg.MinToken.IsNegative() { + return sdk.Wrapf("minimum token amount can not be negative") + } + if !msg.WithdrawLiquidity.IsValid() || !msg.WithdrawLiquidity.IsPositive() { + return sdk.Wrapf("invalid withdrawLiquidity (%s)", msg.WithdrawLiquidity.String()) + } + if msg.MinStandardAmt.IsNegative() { + return sdk.Wrapf("minimum standard token amount %s can not be negative", msg.MinStandardAmt.String()) + } + if msg.Deadline <= 0 { + return sdk.Wrapf("deadline %d must be greater than 0", msg.Deadline) + } + return nil +} + +// GetSigners implements Msg. +func (msg MsgRemoveLiquidity) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Sender)} +} + +// Route implements Msg. +func (msg MsgSwapOrder) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgSwapOrder) Type() string { return "swap_order" } + +// GetSignBytes implements Msg. +func (msg MsgSwapOrder) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgSwapOrder) ValidateBasic() error { + if !(msg.Input.Coin.IsValid() && msg.Input.Coin.IsPositive()) { + return sdk.Wrapf("invalid input (%s)", msg.Input.Coin.String()) + } + + if _, err := sdk.AccAddressFromBech32(msg.Input.Address); err != nil { + return sdk.Wrap(err) + } + + if !(msg.Output.Coin.IsValid() && msg.Output.Coin.IsPositive()) { + return sdk.Wrapf("invalid output (%s)", msg.Output.Coin.String()) + } + + if _, err := sdk.AccAddressFromBech32(msg.Output.Address); err != nil { + return sdk.Wrap(err) + } + + if msg.Input.Coin.Denom == msg.Output.Coin.Denom { + return sdk.Wrapf("invalid swap") + } + + if msg.Deadline <= 0 { + return sdk.Wrapf("deadline %d must be greater than 0", msg.Deadline) + } + return nil +} + +// GetSigners implements Msg. +func (msg MsgSwapOrder) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(msg.Input.Address) + if err != nil { + panic(err) + } + return []sdk.AccAddress{from} +} + +func (m QueryLiquidityResponse) Convert() interface{} { + return &QueryPoolResponse{ + BaseCoin: m.Standard, + TokenCoin: m.Token, + Liquidity: m.Liquidity, + Fee: m.Fee, + } +} From 8278121c99a61b5692e0b0365227474c16a193e6 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 17:53:41 +0800 Subject: [PATCH 08/41] module-sdk-go gov refactoring --- module-sdk/gov/codec.go | 25 + module-sdk/gov/content.go | 22 + module-sdk/gov/export.go | 91 + module-sdk/gov/go.mod | 13 + module-sdk/gov/gov.go | 268 +++ module-sdk/gov/gov.pb.go | 2569 ++++++++++++++++++++++++ module-sdk/gov/params.go | 33 + module-sdk/gov/proposal.go | 279 +++ module-sdk/gov/query.pb.go | 3859 ++++++++++++++++++++++++++++++++++++ module-sdk/gov/tx.pb.go | 1472 ++++++++++++++ module-sdk/gov/types.go | 289 +++ 11 files changed, 8920 insertions(+) create mode 100644 module-sdk/gov/codec.go create mode 100644 module-sdk/gov/content.go create mode 100644 module-sdk/gov/export.go create mode 100644 module-sdk/gov/go.mod create mode 100644 module-sdk/gov/gov.go create mode 100644 module-sdk/gov/gov.pb.go create mode 100644 module-sdk/gov/params.go create mode 100644 module-sdk/gov/proposal.go create mode 100644 module-sdk/gov/query.pb.go create mode 100644 module-sdk/gov/tx.pb.go create mode 100644 module-sdk/gov/types.go diff --git a/module-sdk/gov/codec.go b/module-sdk/gov/codec.go new file mode 100644 index 00000000..6f9104c8 --- /dev/null +++ b/module-sdk/gov/codec.go @@ -0,0 +1,25 @@ +package gov + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitProposal{}, + &MsgDeposit{}, + &MsgVote{}, + ) +} diff --git a/module-sdk/gov/content.go b/module-sdk/gov/content.go new file mode 100644 index 00000000..bda6e310 --- /dev/null +++ b/module-sdk/gov/content.go @@ -0,0 +1,22 @@ +package gov + +// Constants pertaining to a Content object +const ( + MaxDescriptionLength int = 5000 + MaxTitleLength int = 140 +) + +// Content defines an interface that a proposal must implement. It contains +// information such as the title and description along with the type and routing +// information for the appropriate handler to process the proposal. Content can +// have additional fields, which will handled by a proposal's Handler. +// TODO Try to unify this interface with types/module/simulation +// https://github.com/cosmos/cosmos-sdk/issues/5853 +type Content interface { + GetTitle() string + GetDescription() string + ProposalRoute() string + ProposalType() string + ValidateBasic() error + String() string +} diff --git a/module-sdk/gov/export.go b/module-sdk/gov/export.go new file mode 100644 index 00000000..5c5db4e5 --- /dev/null +++ b/module-sdk/gov/export.go @@ -0,0 +1,91 @@ +package gov + +import ( + "time" + sdk "github.com/irisnet/core-sdk-go/types" +) + +// expose Gov module api for user +type Client interface { + sdk.Module + SubmitProposal(request SubmitProposalRequest, baseTx sdk.BaseTx) (uint64, sdk.ResultTx, sdk.Error) + Deposit(request DepositRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + Vote(request VoteRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + + QueryProposal(proposalId uint64) (QueryProposalResp, sdk.Error) + QueryProposals(proposalStatus string) ([]QueryProposalResp, sdk.Error) + QueryVote(proposalId uint64, voter string) (QueryVoteResp, sdk.Error) + QueryVotes(proposalId uint64) ([]QueryVoteResp, sdk.Error) + QueryParams(paramsType string) (QueryParamsResp, sdk.Error) + QueryDeposit(proposalId uint64, depositor string) (QueryDepositResp, sdk.Error) + QueryDeposits(proposalId uint64) ([]QueryDepositResp, sdk.Error) + QueryTallyResult(proposalId uint64) (QueryTallyResultResp, sdk.Error) +} + +type SubmitProposalRequest struct { + Title string `json:"title"` + Description string `json:"description"` + Type string `json:"type"` + InitialDeposit sdk.DecCoins `json:"initial_deposit"` +} + +type DepositRequest struct { + ProposalId uint64 `json:"proposal_id"` + Amount sdk.DecCoins `json:"amount"` +} + +type VoteRequest struct { + ProposalId uint64 `json:"proposal_id"` + Option string `json:"option"` +} + +type QueryProposalResp struct { + ProposalId uint64 `json:"proposal_id"` + Content Content `json:"content"` + Status string `json:"status"` + FinalTallyResult QueryTallyResultResp `json:"final_tally_result"` + SubmitTime time.Time `json:"submit_time"` + DepositEndTime time.Time `json:"deposit_end_time"` + TotalDeposit sdk.Coins `json:"total_deposit"` + VotingStartTime time.Time `json:"voting_start_time"` + VotingEndTime time.Time `json:"voting_end_time"` +} + +type QueryVoteResp struct { + ProposalId uint64 `json:"proposal_id"` + Voter string `json:"voter"` + Option int32 `json:"option"` +} + +type ( + votingParams struct { + VotingPeriod time.Duration `json:"voting_period"` + } + depositParams struct { + MinDeposit sdk.Coins `json:"min_deposit"` + MaxDepositPeriod time.Duration `json:"max_deposit_period"` + } + tallyParams struct { + Quorum sdk.Dec `json:"quorum"` + Threshold sdk.Dec `json:"threshold"` + VetoThreshold sdk.Dec `json:"veto_threshold"` + } + QueryParamsResp struct { + VotingParams votingParams `json:"voting_params"` + DepositParams depositParams `json:"deposit_params"` + TallyParams tallyParams `json:"tally_params"` + } +) + +type QueryDepositResp struct { + ProposalId uint64 `json:"proposal_id"` + Depositor string `json:"depositor"` + Amount sdk.Coins `json:"amount"` +} + +type QueryTallyResultResp struct { + Yes sdk.Int `json:"yes"` + Abstain sdk.Int `json:"abstain"` + No sdk.Int `json:"no"` + NoWithVeto sdk.Int `json:"no_with_veto"` +} diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod new file mode 100644 index 00000000..63ec5c4e --- /dev/null +++ b/module-sdk/gov/go.mod @@ -0,0 +1,13 @@ +module gov + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/gov/gov.go b/module-sdk/gov/gov.go new file mode 100644 index 00000000..790095ee --- /dev/null +++ b/module-sdk/gov/gov.go @@ -0,0 +1,268 @@ +package gov + +import ( + "context" + "strconv" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/query" +) + +type govClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { + return govClient{ + BaseClient: baseClient, + Marshaler: marshaler, + } +} + +func (gc govClient) Name() string { + return ModuleName +} + +func (gc govClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (gc govClient) SubmitProposal(request SubmitProposalRequest, baseTx sdk.BaseTx) (uint64, sdk.ResultTx, sdk.Error) { + proposer, err := gc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return 0, sdk.ResultTx{}, sdk.Wrap(err) + } + + deposit, err := gc.ToMinCoin(request.InitialDeposit...) + if err != nil { + return 0, sdk.ResultTx{}, sdk.Wrap(err) + } + + content := ContentFromProposalType(request.Title, request.Description, request.Type) + msg, e := NewMsgSubmitProposal(content, deposit, proposer) + if e != nil { + return 0, sdk.ResultTx{}, sdk.Wrap(err) + } + + result, err := gc.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return 0, sdk.ResultTx{}, sdk.Wrap(err) + } + + proposalIdStr, e := result.Events.GetValue(sdk.EventTypeSubmitProposal, AttributeKeyProposalId) + if e != nil { + return 0, result, sdk.Wrap(e) + } + + proposalId, e := strconv.Atoi(proposalIdStr) + if e != nil { + return 0, result, sdk.Wrap(e) + } + return uint64(proposalId), result, err +} + +func (gc govClient) Deposit(request DepositRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + depositor, err := gc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + amount, err := gc.ToMinCoin(request.Amount...) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgDeposit{ + ProposalId: request.ProposalId, + Depositor: depositor.String(), + Amount: amount, + } + return gc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// about VoteRequest.Option see VoteOption_value +func (gc govClient) Vote(request VoteRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + voter, err := gc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + option := VoteOption_value[request.Option] + msg := &MsgVote{ + ProposalId: request.ProposalId, + Voter: voter.String(), + Option: VoteOption(option), + } + return gc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (gc govClient) QueryProposal(proposalId uint64) (QueryProposalResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryProposalResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Proposal( + context.Background(), + &QueryProposalRequest{ + ProposalId: proposalId, + }) + if err != nil { + return QueryProposalResp{}, sdk.Wrap(err) + } + return res.Proposal.Convert().(QueryProposalResp), nil +} + +// if proposalStatus is nil will return all status's proposals +// about proposalStatus see VoteOption_value +func (gc govClient) QueryProposals(proposalStatus string) ([]QueryProposalResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Proposals( + context.Background(), + &QueryProposalsRequest{ + ProposalStatus: ProposalStatus(VoteOption_value[proposalStatus]), + Pagination: &query.PageRequest{ + Offset: 0, + Limit: 100, + CountTotal: true, + }, + }) + if err != nil { + return nil, sdk.Wrap(err) + } + return Proposals(res.Proposals).Convert().([]QueryProposalResp), nil +} + +// about QueryVoteResp.Option see VoteOption_name +func (gc govClient) QueryVote(proposalId uint64, voter string) (QueryVoteResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryVoteResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Vote( + context.Background(), + &QueryVoteRequest{ + ProposalId: proposalId, + Voter: voter, + }) + if err != nil { + return QueryVoteResp{}, sdk.Wrap(err) + } + return res.Vote.Convert().(QueryVoteResp), nil +} + +func (gc govClient) QueryVotes(proposalId uint64) ([]QueryVoteResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Votes( + context.Background(), + &QueryVotesRequest{ + ProposalId: proposalId, + Pagination: &query.PageRequest{ + Offset: 0, + Limit: 100, + CountTotal: true, + }, + }) + if err != nil { + return nil, sdk.Wrap(err) + } + return Votes(res.Votes).Convert().([]QueryVoteResp), nil +} + +// QueryParams params_type("voting", "tallying", "deposit"), if don't pass will return all params_typ res +func (gc govClient) QueryParams(paramsType string) (QueryParamsResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Params( + context.Background(), + &QueryParamsRequest{ + ParamsType: paramsType, + }, + ) + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + return res.Convert().(QueryParamsResp), nil +} + +func (gc govClient) QueryDeposit(proposalId uint64, depositor string) (QueryDepositResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryDepositResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Deposit( + context.Background(), + &QueryDepositRequest{ + ProposalId: proposalId, + Depositor: depositor, + }, + ) + if err != nil { + return QueryDepositResp{}, sdk.Wrap(err) + } + return res.Deposit.Convert().(QueryDepositResp), nil +} + +func (gc govClient) QueryDeposits(proposalId uint64) ([]QueryDepositResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Deposits( + context.Background(), + &QueryDepositsRequest{ + ProposalId: proposalId, + Pagination: &query.PageRequest{ + Offset: 0, + Limit: 100, + CountTotal: true, + }, + }, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + return Deposits(res.Deposits).Convert().([]QueryDepositResp), nil +} + +func (gc govClient) QueryTallyResult(proposalId uint64) (QueryTallyResultResp, sdk.Error) { + conn, err := gc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryTallyResultResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).TallyResult( + context.Background(), + &QueryTallyResultRequest{ + ProposalId: proposalId, + }, + ) + if err != nil { + return QueryTallyResultResp{}, sdk.Wrap(err) + } + return res.Tally.Convert().(QueryTallyResultResp), nil +} diff --git a/module-sdk/gov/gov.pb.go b/module-sdk/gov/gov.pb.go new file mode 100644 index 00000000..3c180d0b --- /dev/null +++ b/module-sdk/gov/gov.pb.go @@ -0,0 +1,2569 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/gov/v1beta1/gov.proto + +package gov + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/duration" + _ "github.com/golang/protobuf/ptypes/timestamp" + types1 "github.com/irisnet/core-sdk-go/common/codec/types" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + _ "github.com/regen-network/cosmos-proto" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// VoteOption enumerates the valid vote options for a given governance proposal. +type VoteOption int32 + +const ( + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + OptionEmpty VoteOption = 0 + // VOTE_OPTION_YES defines a yes vote option. + OptionYes VoteOption = 1 + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + OptionAbstain VoteOption = 2 + // VOTE_OPTION_NO defines a no vote option. + OptionNo VoteOption = 3 + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + OptionNoWithVeto VoteOption = 4 +) + +var VoteOption_name = map[int32]string{ + 0: "VOTE_OPTION_UNSPECIFIED", + 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_ABSTAIN", + 3: "VOTE_OPTION_NO", + 4: "VOTE_OPTION_NO_WITH_VETO", +} + +var VoteOption_value = map[string]int32{ + "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_YES": 1, + "VOTE_OPTION_ABSTAIN": 2, + "VOTE_OPTION_NO": 3, + "VOTE_OPTION_NO_WITH_VETO": 4, +} + +func (x VoteOption) String() string { + return proto.EnumName(VoteOption_name, int32(x)) +} + +func (VoteOption) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{0} +} + +// ProposalStatus enumerates the valid statuses of a proposal. +type ProposalStatus int32 + +const ( + // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + StatusNil ProposalStatus = 0 + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + // period. + StatusDepositPeriod ProposalStatus = 1 + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + // period. + StatusVotingPeriod ProposalStatus = 2 + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + StatusPassed ProposalStatus = 3 + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + StatusRejected ProposalStatus = 4 + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + StatusFailed ProposalStatus = 5 +) + +var ProposalStatus_name = map[int32]string{ + 0: "PROPOSAL_STATUS_UNSPECIFIED", + 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", + 2: "PROPOSAL_STATUS_VOTING_PERIOD", + 3: "PROPOSAL_STATUS_PASSED", + 4: "PROPOSAL_STATUS_REJECTED", + 5: "PROPOSAL_STATUS_FAILED", +} + +var ProposalStatus_value = map[string]int32{ + "PROPOSAL_STATUS_UNSPECIFIED": 0, + "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, + "PROPOSAL_STATUS_VOTING_PERIOD": 2, + "PROPOSAL_STATUS_PASSED": 3, + "PROPOSAL_STATUS_REJECTED": 4, + "PROPOSAL_STATUS_FAILED": 5, +} + +func (x ProposalStatus) String() string { + return proto.EnumName(ProposalStatus_name, int32(x)) +} + +func (ProposalStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{1} +} + +// TextProposal defines a standard text proposal whose changes need to be +// manually updated in case of approval. +type TextProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +} + +func (m *TextProposal) Reset() { *m = TextProposal{} } +func (*TextProposal) ProtoMessage() {} +func (*TextProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{0} +} +func (m *TextProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TextProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TextProposal.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 *TextProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_TextProposal.Merge(m, src) +} +func (m *TextProposal) XXX_Size() int { + return m.Size() +} +func (m *TextProposal) XXX_DiscardUnknown() { + xxx_messageInfo_TextProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_TextProposal proto.InternalMessageInfo + +// Deposit defines an amount deposited by an account address to an active +// proposal. +type Deposit struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` +} + +func (m *Deposit) Reset() { *m = Deposit{} } +func (*Deposit) ProtoMessage() {} +func (*Deposit) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{1} +} +func (m *Deposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Deposit.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 *Deposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_Deposit.Merge(m, src) +} +func (m *Deposit) XXX_Size() int { + return m.Size() +} +func (m *Deposit) XXX_DiscardUnknown() { + xxx_messageInfo_Deposit.DiscardUnknown(m) +} + +var xxx_messageInfo_Deposit proto.InternalMessageInfo + +// Proposal defines the core field members of a governance proposal. +type Proposal struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` + Content *types1.Any `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` + FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` + SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` + DepositEndTime time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time" yaml:"deposit_end_time"` + TotalDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"total_deposit" yaml:"total_deposit"` + VotingStartTime time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` + VotingEndTime time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{2} +} +func (m *Proposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Proposal.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 *Proposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proposal.Merge(m, src) +} +func (m *Proposal) XXX_Size() int { + return m.Size() +} +func (m *Proposal) XXX_DiscardUnknown() { + xxx_messageInfo_Proposal.DiscardUnknown(m) +} + +var xxx_messageInfo_Proposal proto.InternalMessageInfo + +// TallyResult defines a standard tally for a governance proposal. +type TallyResult struct { + Yes github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,1,opt,name=yes,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"yes"` + Abstain github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=abstain,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"abstain"` + No github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=no,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"no"` + NoWithVeto github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=no_with_veto,json=noWithVeto,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"no_with_veto" yaml:"no_with_veto"` +} + +func (m *TallyResult) Reset() { *m = TallyResult{} } +func (*TallyResult) ProtoMessage() {} +func (*TallyResult) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{3} +} +func (m *TallyResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyResult.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 *TallyResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyResult.Merge(m, src) +} +func (m *TallyResult) XXX_Size() int { + return m.Size() +} +func (m *TallyResult) XXX_DiscardUnknown() { + xxx_messageInfo_TallyResult.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyResult proto.InternalMessageInfo + +// Vote defines a vote on a governance proposal. +// A Vote consists of a proposal ID, the voter, and the vote option. +type Vote struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{4} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vote.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 *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return m.Size() +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +var xxx_messageInfo_Vote proto.InternalMessageInfo + +// DepositParams defines the params for deposits on governance proposals. +type DepositParams struct { + // Minimum deposit for a proposal to enter voting period. + MinDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"min_deposit,omitempty" yaml:"min_deposit"` + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + MaxDepositPeriod time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty" yaml:"max_deposit_period"` +} + +func (m *DepositParams) Reset() { *m = DepositParams{} } +func (*DepositParams) ProtoMessage() {} +func (*DepositParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{5} +} +func (m *DepositParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositParams.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 *DepositParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositParams.Merge(m, src) +} +func (m *DepositParams) XXX_Size() int { + return m.Size() +} +func (m *DepositParams) XXX_DiscardUnknown() { + xxx_messageInfo_DepositParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositParams proto.InternalMessageInfo + +// VotingParams defines the params for voting on governance proposals. +type VotingParams struct { + // Length of the voting period. + VotingPeriod time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty" yaml:"voting_period"` +} + +func (m *VotingParams) Reset() { *m = VotingParams{} } +func (*VotingParams) ProtoMessage() {} +func (*VotingParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{6} +} +func (m *VotingParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VotingParams.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 *VotingParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_VotingParams.Merge(m, src) +} +func (m *VotingParams) XXX_Size() int { + return m.Size() +} +func (m *VotingParams) XXX_DiscardUnknown() { + xxx_messageInfo_VotingParams.DiscardUnknown(m) +} + +var xxx_messageInfo_VotingParams proto.InternalMessageInfo + +// TallyParams defines the params for tallying votes on governance proposals. +type TallyParams struct { + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + Quorum github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=quorum,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"quorum,omitempty"` + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + Threshold github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,2,opt,name=threshold,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"threshold,omitempty"` + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + VetoThreshold github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"veto_threshold,omitempty" yaml:"veto_threshold"` +} + +func (m *TallyParams) Reset() { *m = TallyParams{} } +func (*TallyParams) ProtoMessage() {} +func (*TallyParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{7} +} +func (m *TallyParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyParams.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 *TallyParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyParams.Merge(m, src) +} +func (m *TallyParams) XXX_Size() int { + return m.Size() +} +func (m *TallyParams) XXX_DiscardUnknown() { + xxx_messageInfo_TallyParams.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyParams proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("cosmos.gov.v1beta1.VoteOption", VoteOption_name, VoteOption_value) + proto.RegisterEnum("cosmos.gov.v1beta1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterType((*TextProposal)(nil), "cosmos.gov.v1beta1.TextProposal") + proto.RegisterType((*Deposit)(nil), "cosmos.gov.v1beta1.Deposit") + proto.RegisterType((*Proposal)(nil), "cosmos.gov.v1beta1.Proposal") + proto.RegisterType((*TallyResult)(nil), "cosmos.gov.v1beta1.TallyResult") + proto.RegisterType((*Vote)(nil), "cosmos.gov.v1beta1.Vote") + proto.RegisterType((*DepositParams)(nil), "cosmos.gov.v1beta1.DepositParams") + proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1beta1.VotingParams") + proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1beta1.TallyParams") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) } + +var fileDescriptor_6e82113c1a9a4b7c = []byte{ + // 1389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xbf, 0x6f, 0xdb, 0xd6, + 0x16, 0x16, 0xe5, 0xdf, 0x57, 0xb2, 0xcd, 0x5c, 0x3b, 0xb6, 0xcc, 0x97, 0x47, 0xf2, 0xf1, 0x75, + 0x08, 0xd2, 0x58, 0x6e, 0x9c, 0xfe, 0x40, 0x9d, 0x49, 0xb2, 0x98, 0x54, 0x41, 0x62, 0x09, 0x14, + 0xa3, 0x20, 0xed, 0x40, 0x50, 0xe6, 0x8d, 0xc4, 0x96, 0xe4, 0x55, 0xc5, 0x2b, 0x37, 0x42, 0x97, + 0x8e, 0x81, 0x8a, 0xb6, 0xd9, 0x9a, 0x45, 0x80, 0x81, 0x6e, 0x9d, 0xfb, 0x1f, 0x74, 0x09, 0x8a, + 0x0e, 0x41, 0xd1, 0x21, 0x28, 0x0a, 0xa5, 0x71, 0x80, 0x22, 0xf0, 0xe8, 0xb5, 0x4b, 0x41, 0xde, + 0x4b, 0x8b, 0x92, 0x0c, 0x38, 0xf1, 0x14, 0xf2, 0xdc, 0xf3, 0x7d, 0xdf, 0xb9, 0x1f, 0xcf, 0x39, + 0x8a, 0xc1, 0x85, 0x5d, 0xec, 0xbb, 0xd8, 0xdf, 0xa8, 0xe3, 0xbd, 0x8d, 0xbd, 0x2b, 0x35, 0x44, + 0xcc, 0x2b, 0xc1, 0x73, 0xb6, 0xd9, 0xc2, 0x04, 0x43, 0x48, 0x4f, 0xb3, 0x41, 0x84, 0x9d, 0x0a, + 0x22, 0x43, 0xd4, 0x4c, 0x1f, 0x1d, 0x43, 0x76, 0xb1, 0xed, 0x51, 0x8c, 0xb0, 0x5c, 0xc7, 0x75, + 0x1c, 0x3e, 0x6e, 0x04, 0x4f, 0x2c, 0xba, 0x46, 0x51, 0x06, 0x3d, 0x60, 0xb4, 0xf4, 0x48, 0xaa, + 0x63, 0x5c, 0x77, 0xd0, 0x46, 0xf8, 0x56, 0x6b, 0xdf, 0xdf, 0x20, 0xb6, 0x8b, 0x7c, 0x62, 0xba, + 0xcd, 0x08, 0x3b, 0x9a, 0x60, 0x7a, 0x1d, 0x76, 0x24, 0x8e, 0x1e, 0x59, 0xed, 0x96, 0x49, 0x6c, + 0xcc, 0x8a, 0x51, 0xee, 0x82, 0xb4, 0x8e, 0x1e, 0x90, 0x72, 0x0b, 0x37, 0xb1, 0x6f, 0x3a, 0x70, + 0x19, 0x4c, 0x11, 0x9b, 0x38, 0x28, 0xc3, 0xc9, 0xdc, 0xc5, 0x39, 0x8d, 0xbe, 0x40, 0x19, 0xa4, + 0x2c, 0xe4, 0xef, 0xb6, 0xec, 0x66, 0x00, 0xcd, 0x24, 0xc3, 0xb3, 0x78, 0x68, 0x6b, 0xf1, 0xd5, + 0xbe, 0xc4, 0xfd, 0xf6, 0xd3, 0xfa, 0xcc, 0x36, 0xf6, 0x08, 0xf2, 0x88, 0xf2, 0x3b, 0x07, 0x66, + 0x0a, 0xa8, 0x89, 0x7d, 0x9b, 0xc0, 0x0f, 0x40, 0xaa, 0xc9, 0x04, 0x0c, 0xdb, 0x0a, 0xa9, 0x27, + 0xf3, 0x2b, 0x47, 0x7d, 0x09, 0x76, 0x4c, 0xd7, 0xd9, 0x52, 0x62, 0x87, 0x8a, 0x06, 0xa2, 0xb7, + 0xa2, 0x05, 0x2f, 0x80, 0x39, 0x8b, 0x72, 0xe0, 0x16, 0x53, 0x1d, 0x04, 0x60, 0x03, 0x4c, 0x9b, + 0x2e, 0x6e, 0x7b, 0x24, 0x33, 0x21, 0x4f, 0x5c, 0x4c, 0x6d, 0xae, 0x65, 0x99, 0x6d, 0x81, 0xf3, + 0xd1, 0xe7, 0xc8, 0x6e, 0x63, 0xdb, 0xcb, 0xbf, 0xf7, 0xa4, 0x2f, 0x25, 0x7e, 0x7c, 0x2e, 0xad, + 0xd7, 0x6d, 0xd2, 0x68, 0xd7, 0xb2, 0xbb, 0xd8, 0xdd, 0xb0, 0x5b, 0xb6, 0xef, 0x21, 0x12, 0xfe, + 0xdb, 0x68, 0xd7, 0xd6, 0x7d, 0xeb, 0xb3, 0xf5, 0x3a, 0xde, 0x20, 0x9d, 0x26, 0xf2, 0x43, 0x94, + 0xaf, 0x31, 0xfe, 0xad, 0xd9, 0x87, 0xfb, 0x52, 0xe2, 0xd5, 0xbe, 0x94, 0x50, 0xfe, 0x99, 0x06, + 0xb3, 0xc7, 0x66, 0xbd, 0x7b, 0xd2, 0xbd, 0x96, 0x0e, 0xfb, 0x52, 0xd2, 0xb6, 0x8e, 0xfa, 0xd2, + 0x1c, 0xbd, 0xdd, 0xe8, 0xa5, 0xae, 0x81, 0x99, 0x5d, 0x6a, 0x52, 0x78, 0xa5, 0xd4, 0xe6, 0x72, + 0x96, 0x7e, 0xa4, 0x6c, 0xf4, 0x91, 0xb2, 0x39, 0xaf, 0x93, 0x4f, 0xfd, 0x32, 0x70, 0x53, 0x8b, + 0x10, 0xb0, 0x0a, 0xa6, 0x7d, 0x62, 0x92, 0xb6, 0x9f, 0x99, 0x90, 0xb9, 0x8b, 0x0b, 0x9b, 0x4a, + 0x76, 0xbc, 0x03, 0xb3, 0x51, 0x81, 0x95, 0x30, 0x33, 0x2f, 0x1c, 0xf5, 0xa5, 0x95, 0x11, 0xa7, + 0x29, 0x89, 0xa2, 0x31, 0x36, 0xd8, 0x04, 0xf0, 0xbe, 0xed, 0x99, 0x8e, 0x41, 0x4c, 0xc7, 0xe9, + 0x18, 0x2d, 0xe4, 0xb7, 0x1d, 0x92, 0x99, 0x0c, 0xeb, 0x93, 0x4e, 0xd2, 0xd0, 0x83, 0x3c, 0x2d, + 0x4c, 0xcb, 0xff, 0x2f, 0x70, 0xf7, 0xa8, 0x2f, 0xad, 0x51, 0x91, 0x71, 0x22, 0x45, 0xe3, 0xc3, + 0x60, 0x0c, 0x04, 0x3f, 0x01, 0x29, 0xbf, 0x5d, 0x73, 0x6d, 0x62, 0x04, 0xed, 0x9c, 0x99, 0x0a, + 0xa5, 0x84, 0x31, 0x2b, 0xf4, 0xa8, 0xd7, 0xf3, 0x22, 0x53, 0x61, 0x4d, 0x13, 0x03, 0x2b, 0x8f, + 0x9e, 0x4b, 0x9c, 0x06, 0x68, 0x24, 0x00, 0x40, 0x1b, 0xf0, 0xac, 0x4f, 0x0c, 0xe4, 0x59, 0x54, + 0x61, 0xfa, 0x54, 0x85, 0xff, 0x33, 0x85, 0x55, 0xaa, 0x30, 0xca, 0x40, 0x65, 0x16, 0x58, 0x58, + 0xf5, 0xac, 0x50, 0xea, 0x1b, 0x0e, 0xcc, 0x13, 0x4c, 0x4c, 0xc7, 0x60, 0x07, 0x99, 0x99, 0xd3, + 0xba, 0xf1, 0x36, 0xd3, 0x59, 0xa6, 0x3a, 0x43, 0x68, 0xe5, 0xcd, 0xbb, 0x34, 0x1d, 0x12, 0x44, + 0xc3, 0xe6, 0x80, 0x73, 0x7b, 0x98, 0xd8, 0x5e, 0x3d, 0xf8, 0xc6, 0x2d, 0xe6, 0xee, 0xec, 0xa9, + 0x77, 0x7f, 0x8b, 0xd5, 0x94, 0xa1, 0x35, 0x8d, 0x51, 0xd0, 0xcb, 0x2f, 0xd2, 0x78, 0x25, 0x08, + 0x87, 0xb7, 0xbf, 0x0f, 0x58, 0x68, 0xe0, 0xf3, 0xdc, 0xa9, 0x5a, 0x0a, 0xd3, 0x5a, 0x19, 0xd2, + 0x1a, 0xb6, 0x79, 0x9e, 0x46, 0x99, 0xcb, 0x5b, 0x93, 0xc1, 0x7e, 0x51, 0xfe, 0x4c, 0x82, 0x54, + 0xbc, 0x87, 0x54, 0x30, 0xd1, 0x41, 0x3e, 0xdd, 0x55, 0xf9, 0xab, 0x01, 0xeb, 0x1f, 0x7d, 0xe9, + 0xed, 0xd7, 0x75, 0xaf, 0xe8, 0x11, 0x2d, 0xc0, 0xc3, 0xdb, 0x60, 0xc6, 0xac, 0xf9, 0xc4, 0xb4, + 0xd9, 0x6a, 0x3b, 0x1b, 0x55, 0xc4, 0x01, 0xb7, 0x41, 0xd2, 0xc3, 0xe1, 0x7c, 0x9e, 0x91, 0x29, + 0xe9, 0x61, 0xe8, 0x80, 0xb4, 0x87, 0x8d, 0x2f, 0x6c, 0xd2, 0x30, 0xf6, 0x10, 0xc1, 0xe1, 0x28, + 0xce, 0xe5, 0x6f, 0x9e, 0x81, 0xee, 0xa8, 0x2f, 0x2d, 0x51, 0xa3, 0xe3, 0x84, 0x8a, 0x06, 0x3c, + 0x7c, 0xd7, 0x26, 0x8d, 0x2a, 0x22, 0x98, 0xd9, 0xfb, 0x3d, 0x07, 0x26, 0xab, 0x98, 0xa0, 0xb3, + 0x2f, 0xec, 0x65, 0x30, 0xb5, 0x87, 0x09, 0x8a, 0x96, 0x35, 0x7d, 0x81, 0xef, 0x83, 0x69, 0x4c, + 0x7f, 0x39, 0xe8, 0xd2, 0x12, 0x4f, 0x5a, 0x28, 0x81, 0x70, 0x29, 0xcc, 0xd2, 0x58, 0xf6, 0xd6, + 0xec, 0xe3, 0x68, 0xed, 0xfe, 0x9c, 0x04, 0xf3, 0xac, 0xc1, 0xcb, 0x66, 0xcb, 0x74, 0x7d, 0xb8, + 0xcf, 0x81, 0x94, 0x6b, 0x7b, 0xc7, 0x43, 0xc7, 0x9d, 0x36, 0x74, 0x56, 0x60, 0xdd, 0x61, 0x5f, + 0x3a, 0x1f, 0x43, 0x5d, 0xc6, 0xae, 0x4d, 0x90, 0xdb, 0x24, 0x9d, 0xc1, 0xdd, 0x62, 0xc7, 0x67, + 0x98, 0x45, 0xe0, 0xda, 0x5e, 0x34, 0x89, 0xdf, 0x72, 0x00, 0xba, 0xe6, 0x83, 0x88, 0xcd, 0x68, + 0xa2, 0x96, 0x8d, 0x2d, 0xb6, 0xf4, 0xd7, 0xc6, 0xe6, 0xa3, 0xc0, 0x7e, 0x99, 0xf3, 0x2a, 0xab, + 0xf4, 0xc2, 0x38, 0x78, 0xa8, 0x60, 0xb6, 0x6e, 0xc7, 0xb3, 0x94, 0xc7, 0xc1, 0x04, 0xf1, 0xae, + 0xf9, 0x20, 0xf2, 0x8c, 0x86, 0xbf, 0xe6, 0x40, 0xba, 0x1a, 0x8e, 0x15, 0x33, 0xf1, 0x4b, 0xc0, + 0xc6, 0x2c, 0xaa, 0x8d, 0x3b, 0xad, 0xb6, 0x6b, 0xac, 0xb6, 0xd5, 0x21, 0xdc, 0x50, 0x59, 0xcb, + 0x43, 0x53, 0x1d, 0xaf, 0x28, 0x4d, 0x63, 0xac, 0x9a, 0xc3, 0x68, 0x98, 0x59, 0x31, 0x06, 0x98, + 0xfe, 0xbc, 0x8d, 0x5b, 0x6d, 0x37, 0xac, 0x22, 0x9d, 0xbf, 0xf1, 0xa6, 0xbd, 0x5e, 0x40, 0xbb, + 0x87, 0x7d, 0x89, 0xa7, 0x24, 0x83, 0x92, 0x34, 0x46, 0x0b, 0x1b, 0x60, 0x8e, 0x34, 0x5a, 0xc8, + 0x6f, 0x60, 0x87, 0x7e, 0x85, 0xf4, 0x9b, 0xcf, 0x13, 0xd5, 0x58, 0x3a, 0xe6, 0x89, 0xc9, 0x0c, + 0xc8, 0xe1, 0x77, 0x1c, 0x58, 0x08, 0x86, 0xcc, 0x18, 0xe8, 0x4d, 0x84, 0x7a, 0x8d, 0xb3, 0xe9, + 0x65, 0x86, 0xc9, 0x86, 0xec, 0x3e, 0xcf, 0xec, 0x1e, 0xca, 0x50, 0xb4, 0xf9, 0x20, 0xa0, 0x47, + 0xef, 0x97, 0xfe, 0xe6, 0x00, 0x18, 0x4c, 0x18, 0xbc, 0x0c, 0x56, 0xab, 0x25, 0x5d, 0x35, 0x4a, + 0x65, 0xbd, 0x58, 0xda, 0x31, 0xee, 0xec, 0x54, 0xca, 0xea, 0x76, 0xf1, 0x7a, 0x51, 0x2d, 0xf0, + 0x09, 0x61, 0xb1, 0xdb, 0x93, 0x53, 0x34, 0x51, 0x0d, 0x44, 0xa0, 0x02, 0x16, 0xe3, 0xd9, 0xf7, + 0xd4, 0x0a, 0xcf, 0x09, 0xf3, 0xdd, 0x9e, 0x3c, 0x47, 0xb3, 0xee, 0x21, 0x1f, 0x5e, 0x02, 0x4b, + 0xf1, 0x9c, 0x5c, 0xbe, 0xa2, 0xe7, 0x8a, 0x3b, 0x7c, 0x52, 0x38, 0xd7, 0xed, 0xc9, 0xf3, 0x34, + 0x2f, 0xc7, 0x16, 0xa4, 0x0c, 0x16, 0xe2, 0xb9, 0x3b, 0x25, 0x7e, 0x42, 0x48, 0x77, 0x7b, 0xf2, + 0x2c, 0x4d, 0xdb, 0xc1, 0x70, 0x13, 0x64, 0x86, 0x33, 0x8c, 0xbb, 0x45, 0xfd, 0x23, 0xa3, 0xaa, + 0xea, 0x25, 0x7e, 0x52, 0x58, 0xee, 0xf6, 0x64, 0x3e, 0xca, 0x8d, 0x76, 0x98, 0x30, 0xf9, 0xf0, + 0x07, 0x31, 0x71, 0xe9, 0xd7, 0x24, 0x58, 0x18, 0xfe, 0xff, 0x0f, 0xcc, 0x82, 0xff, 0x94, 0xb5, + 0x52, 0xb9, 0x54, 0xc9, 0xdd, 0x32, 0x2a, 0x7a, 0x4e, 0xbf, 0x53, 0x19, 0xb9, 0x70, 0x78, 0x15, + 0x9a, 0xbc, 0x63, 0x3b, 0xf0, 0x1a, 0x10, 0x47, 0xf3, 0x0b, 0x6a, 0xb9, 0x54, 0x29, 0xea, 0x46, + 0x59, 0xd5, 0x8a, 0xa5, 0x02, 0xcf, 0x09, 0xab, 0xdd, 0x9e, 0xbc, 0x44, 0x21, 0x43, 0x33, 0x06, + 0x3f, 0x04, 0xff, 0x1d, 0x05, 0x57, 0x4b, 0x7a, 0x71, 0xe7, 0x46, 0x84, 0x4d, 0x0a, 0x2b, 0xdd, + 0x9e, 0x0c, 0x29, 0xb6, 0x1a, 0x1b, 0x08, 0x78, 0x19, 0xac, 0x8c, 0x42, 0xcb, 0xb9, 0x4a, 0x45, + 0x2d, 0xf0, 0x13, 0x02, 0xdf, 0xed, 0xc9, 0x69, 0x8a, 0x29, 0x9b, 0xbe, 0x8f, 0x2c, 0xf8, 0x0e, + 0xc8, 0x8c, 0x66, 0x6b, 0xea, 0x4d, 0x75, 0x5b, 0x57, 0x0b, 0xfc, 0xa4, 0x00, 0xbb, 0x3d, 0x79, + 0x81, 0xe6, 0x6b, 0xe8, 0x53, 0xb4, 0x4b, 0xd0, 0x89, 0xfc, 0xd7, 0x73, 0xc5, 0x5b, 0x6a, 0x81, + 0x9f, 0x8a, 0xf3, 0x5f, 0x37, 0x6d, 0x07, 0x59, 0xd4, 0xce, 0x7c, 0xe5, 0xc9, 0x0b, 0x31, 0xf1, + 0xec, 0x85, 0x98, 0xf8, 0xea, 0x40, 0x4c, 0x3c, 0x39, 0x10, 0xb9, 0xa7, 0x07, 0x22, 0xf7, 0xd7, + 0x81, 0xc8, 0x3d, 0x7a, 0x29, 0x26, 0x9e, 0xbe, 0x14, 0x13, 0xcf, 0x5e, 0x8a, 0x89, 0x8f, 0x5f, + 0x63, 0x49, 0xba, 0xd8, 0x6a, 0x3b, 0x28, 0xfc, 0x3b, 0xaa, 0x36, 0x1d, 0xee, 0x95, 0xab, 0xff, + 0x06, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x5b, 0xda, 0x9c, 0x5c, 0x0d, 0x00, 0x00, +} + +func (this *TextProposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TextProposal) + if !ok { + that2, ok := that.(TextProposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Title != that1.Title { + return false + } + if this.Description != that1.Description { + return false + } + return true +} +func (this *Proposal) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Proposal) + if !ok { + that2, ok := that.(Proposal) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ProposalId != that1.ProposalId { + return false + } + if !this.Content.Equal(that1.Content) { + return false + } + if this.Status != that1.Status { + return false + } + if !this.FinalTallyResult.Equal(&that1.FinalTallyResult) { + return false + } + if !this.SubmitTime.Equal(that1.SubmitTime) { + return false + } + if !this.DepositEndTime.Equal(that1.DepositEndTime) { + return false + } + if len(this.TotalDeposit) != len(that1.TotalDeposit) { + return false + } + for i := range this.TotalDeposit { + if !this.TotalDeposit[i].Equal(&that1.TotalDeposit[i]) { + return false + } + } + if !this.VotingStartTime.Equal(that1.VotingStartTime) { + return false + } + if !this.VotingEndTime.Equal(that1.VotingEndTime) { + return false + } + return true +} +func (this *TallyResult) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*TallyResult) + if !ok { + that2, ok := that.(TallyResult) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Yes.Equal(that1.Yes) { + return false + } + if !this.Abstain.Equal(that1.Abstain) { + return false + } + if !this.No.Equal(that1.No) { + return false + } + if !this.NoWithVeto.Equal(that1.NoWithVeto) { + return false + } + return true +} +func (m *TextProposal) 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 *TextProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TextProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Deposit) 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 *Deposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintGov(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Proposal) 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 *Proposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintGov(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x4a + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x42 + if len(m.TotalDeposit) > 0 { + for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TotalDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x32 + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintGov(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x2a + { + size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if m.Status != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x18 + } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TallyResult) 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 *TallyResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.NoWithVeto.Size() + i -= size + if _, err := m.NoWithVeto.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.No.Size() + i -= size + if _, err := m.No.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.Abstain.Size() + i -= size + if _, err := m.Abstain.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Yes.Size() + i -= size + if _, err := m.Yes.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Vote) 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 *Vote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Option != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintGov(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *DepositParams) 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 *DepositParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintGov(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x12 + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *VotingParams) 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 *VotingParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintGov(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TallyParams) 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 *TallyParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.VetoThreshold.Size() + i -= size + if _, err := m.VetoThreshold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.Threshold.Size() + i -= size + if _, err := m.Threshold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Quorum.Size() + i -= size + if _, err := m.Quorum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *TextProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Deposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func (m *Proposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovGov(uint64(m.Status)) + } + l = m.FinalTallyResult.Size() + n += 1 + l + sovGov(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime) + n += 1 + l + sovGov(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime) + n += 1 + l + sovGov(uint64(l)) + if len(m.TotalDeposit) > 0 { + for _, e := range m.TotalDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime) + n += 1 + l + sovGov(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime) + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *TallyResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Yes.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.Abstain.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.No.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.NoWithVeto.Size() + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *Vote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovGov(uint64(m.Option)) + } + return n +} + +func (m *DepositParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *VotingParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + return n +} + +func (m *TallyParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Quorum.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.Threshold.Size() + n += 1 + l + sovGov(uint64(l)) + l = m.VetoThreshold.Size() + n += 1 + l + sovGov(uint64(l)) + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TextProposal) 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 ErrIntOverflowGov + } + 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: TextProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TextProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Deposit) 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 ErrIntOverflowGov + } + 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: Deposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Proposal) 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 ErrIntOverflowGov + } + 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: Proposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types1.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + 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 ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) + if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyResult) 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 ErrIntOverflowGov + } + 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: TallyResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Yes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Yes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Abstain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Abstain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field No", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.No.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoWithVeto", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NoWithVeto.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Vote) 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 ErrIntOverflowGov + } + 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: Vote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + 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 ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DepositParams) 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 ErrIntOverflowGov + } + 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: DepositParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DepositParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-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 MaxDepositPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VotingParams) 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 ErrIntOverflowGov + } + 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: VotingParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VotingParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyParams) 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 ErrIntOverflowGov + } + 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: TallyParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Quorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Threshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.VetoThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGov(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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrIntOverflowGov + } + 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, ErrInvalidLengthGov + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGov + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGov + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/gov/params.go b/module-sdk/gov/params.go new file mode 100644 index 00000000..01c582a6 --- /dev/null +++ b/module-sdk/gov/params.go @@ -0,0 +1,33 @@ +package gov + +import yaml "gopkg.in/yaml.v2" + +func (d Deposit) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + +func (tr TallyResult) String() string { + out, _ := yaml.Marshal(tr) + return string(out) +} + +func (v Vote) String() string { + out, _ := yaml.Marshal(v) + return string(out) +} + +func (dp DepositParams) String() string { + out, _ := yaml.Marshal(dp) + return string(out) +} + +func (vp VotingParams) String() string { + out, _ := yaml.Marshal(vp) + return string(out) +} + +func (tp TallyParams) String() string { + out, _ := yaml.Marshal(tp) + return string(out) +} diff --git a/module-sdk/gov/proposal.go b/module-sdk/gov/proposal.go new file mode 100644 index 00000000..8fbc39e2 --- /dev/null +++ b/module-sdk/gov/proposal.go @@ -0,0 +1,279 @@ +package gov + +import ( + "fmt" + "strings" + "time" + "github.com/gogo/protobuf/proto" + yaml "gopkg.in/yaml.v2" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" +) + +// DefaultStartingProposalID is 1 +const DefaultStartingProposalID uint64 = 1 + +// NewProposal creates a new Proposal instance +func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { + p := Proposal{ + ProposalId: id, + Status: StatusDepositPeriod, + FinalTallyResult: TallyResult{ + Yes: sdk.ZeroInt(), + Abstain: sdk.ZeroInt(), + No: sdk.ZeroInt(), + NoWithVeto: sdk.ZeroInt(), + }, + TotalDeposit: sdk.NewCoins(), + SubmitTime: submitTime, + DepositEndTime: depositEndTime, + } + + msg, ok := content.(proto.Message) + if !ok { + return Proposal{}, fmt.Errorf("%T does not implement proto.Message", content) + } + + any, err := types.NewAnyWithValue(msg) + if err != nil { + return Proposal{}, err + } + + p.Content = any + + return p, nil +} + +// String implements stringer interface +func (p Proposal) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// GetContent returns the proposal Content +func (p Proposal) GetContent() Content { + content, ok := p.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} + +func (p Proposal) ProposalType() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.ProposalType() +} + +func (p Proposal) ProposalRoute() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.ProposalRoute() +} + +func (p Proposal) GetTitle() string { + content := p.GetContent() + if content == nil { + return "" + } + return content.GetTitle() +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(p.Content, &content) +} + +var _ types.UnpackInterfacesMessage = Proposals{} + +// Equal returns true if two slices (order-dependant) of proposals are equal. +func (p Proposals) Equal(other Proposals) bool { + if len(p) != len(other) { + return false + } + + for i, proposal := range p { + if !proposal.Equal(other[i]) { + return false + } + } + + return true +} + +// String implements stringer interface +func (p Proposals) String() string { + out := "ID - (Status) [Type] Title\n" + for _, prop := range p { + out += fmt.Sprintf("%d - (%s) [%s] %s\n", + prop.ProposalId, prop.Status, + prop.ProposalType(), prop.GetTitle()) + } + return strings.TrimSpace(out) +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (p Proposals) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, x := range p { + err := x.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} + +type ( + // ProposalQueue defines a queue for proposal ids + ProposalQueue []uint64 +) + +// ProposalStatusFromString turns a string into a ProposalStatus +func ProposalStatusFromString(str string) (ProposalStatus, error) { + num, ok := ProposalStatus_value[str] + if !ok { + return StatusNil, fmt.Errorf("'%s' is not a valid proposal status", str) + } + return ProposalStatus(num), nil +} + +// ValidProposalStatus returns true if the proposal status is valid and false +// otherwise. +func ValidProposalStatus(status ProposalStatus) bool { + if status == StatusDepositPeriod || + status == StatusVotingPeriod || + status == StatusPassed || + status == StatusRejected || + status == StatusFailed { + return true + } + return false +} + +// Marshal needed for protobuf compatibility +func (status ProposalStatus) Marshal() ([]byte, error) { + return []byte{byte(status)}, nil +} + +// Unmarshal needed for protobuf compatibility +func (status *ProposalStatus) Unmarshal(data []byte) error { + *status = ProposalStatus(data[0]) + return nil +} + +// Format implements the fmt.Formatter interface. +// nolint: errcheck +func (status ProposalStatus) Format(s fmt.State, verb rune) { + switch verb { + case 's': + s.Write([]byte(status.String())) + default: + // TODO: Do this conversion more directly + s.Write([]byte(fmt.Sprintf("%v", byte(status)))) + } +} + +// Proposal types +const ( + ProposalTypeText string = "Text" +) + +// Implements Content Interface +var _ Content = &TextProposal{} + +// NewTextProposal creates a text proposal Content +func NewTextProposal(title, description string) Content { + return &TextProposal{title, description} +} + +// GetTitle returns the proposal title +func (tp *TextProposal) GetTitle() string { return tp.Title } + +// GetDescription returns the proposal description +func (tp *TextProposal) GetDescription() string { return tp.Description } + +// ProposalRoute returns the proposal router key +func (tp *TextProposal) ProposalRoute() string { return ModuleName } + +// ProposalType is "Text" +func (tp *TextProposal) ProposalType() string { return ProposalTypeText } + +// ValidateBasic validates the content's title and description of the proposal +func (tp *TextProposal) ValidateBasic() error { + title := tp.GetTitle() + if len(strings.TrimSpace(title)) == 0 { + return sdk.Wrapf("proposal title cannot be blank") + } + if len(title) > MaxTitleLength { + return sdk.Wrapf("proposal title is longer than max length of %d", MaxTitleLength) + } + + description := tp.GetDescription() + if len(description) == 0 { + return sdk.Wrapf("proposal description cannot be blank") + } + if len(description) > MaxDescriptionLength { + return sdk.Wrapf("proposal description is longer than max length of %d", MaxDescriptionLength) + } + return nil +} + +// String implements Stringer interface +func (tp TextProposal) String() string { + out, _ := yaml.Marshal(tp) + return string(out) +} + +var validProposalTypes = map[string]struct{}{ + ProposalTypeText: {}, +} + +// RegisterProposalType registers a proposal type. It will panic if the type is +// already registered. +func RegisterProposalType(ty string) { + if _, ok := validProposalTypes[ty]; ok { + panic(fmt.Sprintf("already registered proposal type: %s", ty)) + } + + validProposalTypes[ty] = struct{}{} +} + +// ContentFromProposalType returns a Content object based on the proposal type. +func ContentFromProposalType(title, desc, ty string) Content { + switch ty { + case ProposalTypeText: + return NewTextProposal(title, desc) + + default: + return nil + } +} + +// IsValidProposalType returns a boolean determining if the proposal type is +// valid. +// +// NOTE: Modules with their own proposal types must register them. +func IsValidProposalType(ty string) bool { + _, ok := validProposalTypes[ty] + return ok +} + +// ProposalHandler implements the Handler interface for governance module-based +// proposals (ie. TextProposal ). Since these are +// merely signaling mechanisms at the moment and do not affect state, it +// performs a no-op. +//func ProposalHandler(_ sdk.Context, c Content) error { +// switch c.ProposalType() { +// case ProposalTypeText: +// // both proposal types do not change state so this performs a no-op +// return nil +// +// default: +// return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized gov proposal type: %s", c.ProposalType()) +// } +//} diff --git a/module-sdk/gov/query.pb.go b/module-sdk/gov/query.pb.go new file mode 100644 index 00000000..ae7aace8 --- /dev/null +++ b/module-sdk/gov/query.pb.go @@ -0,0 +1,3859 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/gov/v1beta1/query.proto + +package gov + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + query "github.com/irisnet/core-sdk-go/types/query" + _ "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 + +// QueryProposalRequest is the request type for the Query/Proposal RPC method. +type QueryProposalRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } +func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProposalRequest) ProtoMessage() {} +func (*QueryProposalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{0} +} +func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalRequest.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 *QueryProposalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalRequest.Merge(m, src) +} +func (m *QueryProposalRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo + +func (m *QueryProposalRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// QueryProposalResponse is the response type for the Query/Proposal RPC method. +type QueryProposalResponse struct { + Proposal Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` +} + +func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } +func (m *QueryProposalResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProposalResponse) ProtoMessage() {} +func (*QueryProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{1} +} +func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalResponse.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 *QueryProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalResponse.Merge(m, src) +} +func (m *QueryProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo + +func (m *QueryProposalResponse) GetProposal() Proposal { + if m != nil { + return m.Proposal + } + return Proposal{} +} + +// QueryProposalsRequest is the request type for the Query/Proposals RPC method. +type QueryProposalsRequest struct { + // proposal_status defines the status of the proposals. + ProposalStatus ProposalStatus `protobuf:"varint,1,opt,name=proposal_status,json=proposalStatus,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"proposal_status,omitempty"` + // voter defines the voter address for the proposals. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + // depositor defines the deposit addresses from the proposals. + Depositor string `protobuf:"bytes,3,opt,name=depositor,proto3" json:"depositor,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryProposalsRequest) Reset() { *m = QueryProposalsRequest{} } +func (m *QueryProposalsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProposalsRequest) ProtoMessage() {} +func (*QueryProposalsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{2} +} +func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalsRequest.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 *QueryProposalsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalsRequest.Merge(m, src) +} +func (m *QueryProposalsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalsRequest proto.InternalMessageInfo + +// QueryProposalsResponse is the response type for the Query/Proposals RPC +// method. +type QueryProposalsResponse struct { + Proposals []Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} } +func (m *QueryProposalsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProposalsResponse) ProtoMessage() {} +func (*QueryProposalsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{3} +} +func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalsResponse.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 *QueryProposalsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalsResponse.Merge(m, src) +} +func (m *QueryProposalsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo + +func (m *QueryProposalsResponse) GetProposals() []Proposal { + if m != nil { + return m.Proposals + } + return nil +} + +func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryVoteRequest is the request type for the Query/Vote RPC method. +type QueryVoteRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // voter defines the oter address for the proposals. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` +} + +func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} } +func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVoteRequest) ProtoMessage() {} +func (*QueryVoteRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{4} +} +func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteRequest.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 *QueryVoteRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteRequest.Merge(m, src) +} +func (m *QueryVoteRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo + +// QueryVoteResponse is the response type for the Query/Vote RPC method. +type QueryVoteResponse struct { + // vote defined the queried vote. + Vote Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` +} + +func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } +func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVoteResponse) ProtoMessage() {} +func (*QueryVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{5} +} +func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVoteResponse.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 *QueryVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVoteResponse.Merge(m, src) +} +func (m *QueryVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo + +func (m *QueryVoteResponse) GetVote() Vote { + if m != nil { + return m.Vote + } + return Vote{} +} + +// QueryVotesRequest is the request type for the Query/Votes RPC method. +type QueryVotesRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} } +func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryVotesRequest) ProtoMessage() {} +func (*QueryVotesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{6} +} +func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesRequest.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 *QueryVotesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesRequest.Merge(m, src) +} +func (m *QueryVotesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesRequest proto.InternalMessageInfo + +func (m *QueryVotesRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryVotesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryVotesResponse is the response type for the Query/Votes RPC method. +type QueryVotesResponse struct { + // votes defined the queried votes. + Votes []Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} } +func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryVotesResponse) ProtoMessage() {} +func (*QueryVotesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{7} +} +func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryVotesResponse.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 *QueryVotesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryVotesResponse.Merge(m, src) +} +func (m *QueryVotesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryVotesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryVotesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo + +func (m *QueryVotesResponse) GetVotes() []Vote { + if m != nil { + return m.Votes + } + return nil +} + +func (m *QueryVotesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryParamsRequest is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { + // params_type defines which parameters to query for, can be one of "voting", + // "tallying" or "deposit". + ParamsType string `protobuf:"bytes,1,opt,name=params_type,json=paramsType,proto3" json:"params_type,omitempty"` +} + +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_e35c0d133e91c0a2, []int{8} +} +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 + +func (m *QueryParamsRequest) GetParamsType() string { + if m != nil { + return m.ParamsType + } + return "" +} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // voting_params defines the parameters related to voting. + VotingParams VotingParams `protobuf:"bytes,1,opt,name=voting_params,json=votingParams,proto3" json:"voting_params"` + // deposit_params defines the parameters related to deposit. + DepositParams DepositParams `protobuf:"bytes,2,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params"` + // tally_params defines the parameters related to tally. + TallyParams TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_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_e35c0d133e91c0a2, []int{9} +} +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) GetVotingParams() VotingParams { + if m != nil { + return m.VotingParams + } + return VotingParams{} +} + +func (m *QueryParamsResponse) GetDepositParams() DepositParams { + if m != nil { + return m.DepositParams + } + return DepositParams{} +} + +func (m *QueryParamsResponse) GetTallyParams() TallyParams { + if m != nil { + return m.TallyParams + } + return TallyParams{} +} + +// QueryDepositRequest is the request type for the Query/Deposit RPC method. +type QueryDepositRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // depositor defines the deposit addresses from the proposals. + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` +} + +func (m *QueryDepositRequest) Reset() { *m = QueryDepositRequest{} } +func (m *QueryDepositRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDepositRequest) ProtoMessage() {} +func (*QueryDepositRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{10} +} +func (m *QueryDepositRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositRequest.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 *QueryDepositRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositRequest.Merge(m, src) +} +func (m *QueryDepositRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositRequest proto.InternalMessageInfo + +// QueryDepositResponse is the response type for the Query/Deposit RPC method. +type QueryDepositResponse struct { + // deposit defines the requested deposit. + Deposit Deposit `protobuf:"bytes,1,opt,name=deposit,proto3" json:"deposit"` +} + +func (m *QueryDepositResponse) Reset() { *m = QueryDepositResponse{} } +func (m *QueryDepositResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDepositResponse) ProtoMessage() {} +func (*QueryDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{11} +} +func (m *QueryDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositResponse.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 *QueryDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositResponse.Merge(m, src) +} +func (m *QueryDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositResponse proto.InternalMessageInfo + +func (m *QueryDepositResponse) GetDeposit() Deposit { + if m != nil { + return m.Deposit + } + return Deposit{} +} + +// QueryDepositsRequest is the request type for the Query/Deposits RPC method. +type QueryDepositsRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDepositsRequest) Reset() { *m = QueryDepositsRequest{} } +func (m *QueryDepositsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDepositsRequest) ProtoMessage() {} +func (*QueryDepositsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{12} +} +func (m *QueryDepositsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositsRequest.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 *QueryDepositsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositsRequest.Merge(m, src) +} +func (m *QueryDepositsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositsRequest proto.InternalMessageInfo + +func (m *QueryDepositsRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *QueryDepositsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDepositsResponse is the response type for the Query/Deposits RPC method. +type QueryDepositsResponse struct { + Deposits []Deposit `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDepositsResponse) Reset() { *m = QueryDepositsResponse{} } +func (m *QueryDepositsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDepositsResponse) ProtoMessage() {} +func (*QueryDepositsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{13} +} +func (m *QueryDepositsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDepositsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDepositsResponse.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 *QueryDepositsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDepositsResponse.Merge(m, src) +} +func (m *QueryDepositsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDepositsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDepositsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDepositsResponse proto.InternalMessageInfo + +func (m *QueryDepositsResponse) GetDeposits() []Deposit { + if m != nil { + return m.Deposits + } + return nil +} + +func (m *QueryDepositsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryTallyResultRequest is the request type for the Query/Tally RPC method. +type QueryTallyResultRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryTallyResultRequest) Reset() { *m = QueryTallyResultRequest{} } +func (m *QueryTallyResultRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTallyResultRequest) ProtoMessage() {} +func (*QueryTallyResultRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{14} +} +func (m *QueryTallyResultRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTallyResultRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTallyResultRequest.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 *QueryTallyResultRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTallyResultRequest.Merge(m, src) +} +func (m *QueryTallyResultRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTallyResultRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTallyResultRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTallyResultRequest proto.InternalMessageInfo + +func (m *QueryTallyResultRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// QueryTallyResultResponse is the response type for the Query/Tally RPC method. +type QueryTallyResultResponse struct { + // tally defines the requested tally. + Tally TallyResult `protobuf:"bytes,1,opt,name=tally,proto3" json:"tally"` +} + +func (m *QueryTallyResultResponse) Reset() { *m = QueryTallyResultResponse{} } +func (m *QueryTallyResultResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTallyResultResponse) ProtoMessage() {} +func (*QueryTallyResultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e35c0d133e91c0a2, []int{15} +} +func (m *QueryTallyResultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTallyResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTallyResultResponse.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 *QueryTallyResultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTallyResultResponse.Merge(m, src) +} +func (m *QueryTallyResultResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTallyResultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTallyResultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTallyResultResponse proto.InternalMessageInfo + +func (m *QueryTallyResultResponse) GetTally() TallyResult { + if m != nil { + return m.Tally + } + return TallyResult{} +} + +func init() { + proto.RegisterType((*QueryProposalRequest)(nil), "cosmos.gov.v1beta1.QueryProposalRequest") + proto.RegisterType((*QueryProposalResponse)(nil), "cosmos.gov.v1beta1.QueryProposalResponse") + proto.RegisterType((*QueryProposalsRequest)(nil), "cosmos.gov.v1beta1.QueryProposalsRequest") + proto.RegisterType((*QueryProposalsResponse)(nil), "cosmos.gov.v1beta1.QueryProposalsResponse") + proto.RegisterType((*QueryVoteRequest)(nil), "cosmos.gov.v1beta1.QueryVoteRequest") + proto.RegisterType((*QueryVoteResponse)(nil), "cosmos.gov.v1beta1.QueryVoteResponse") + proto.RegisterType((*QueryVotesRequest)(nil), "cosmos.gov.v1beta1.QueryVotesRequest") + proto.RegisterType((*QueryVotesResponse)(nil), "cosmos.gov.v1beta1.QueryVotesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.gov.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.gov.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryDepositRequest)(nil), "cosmos.gov.v1beta1.QueryDepositRequest") + proto.RegisterType((*QueryDepositResponse)(nil), "cosmos.gov.v1beta1.QueryDepositResponse") + proto.RegisterType((*QueryDepositsRequest)(nil), "cosmos.gov.v1beta1.QueryDepositsRequest") + proto.RegisterType((*QueryDepositsResponse)(nil), "cosmos.gov.v1beta1.QueryDepositsResponse") + proto.RegisterType((*QueryTallyResultRequest)(nil), "cosmos.gov.v1beta1.QueryTallyResultRequest") + proto.RegisterType((*QueryTallyResultResponse)(nil), "cosmos.gov.v1beta1.QueryTallyResultResponse") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta1/query.proto", fileDescriptor_e35c0d133e91c0a2) } + +var fileDescriptor_e35c0d133e91c0a2 = []byte{ + // 973 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0x24, 0x4e, 0x6b, 0xbf, 0xb4, 0x01, 0x1e, 0x01, 0xac, 0x25, 0xd8, 0x61, 0x45, 0x5b, + 0x93, 0x12, 0x2f, 0x49, 0x0a, 0xa8, 0x2d, 0xa0, 0x12, 0xa1, 0xa6, 0xa8, 0x12, 0x2a, 0x4e, 0x05, + 0x12, 0x07, 0xa2, 0x75, 0xbd, 0xda, 0xae, 0x70, 0x76, 0xb6, 0x9e, 0xb1, 0xa5, 0x28, 0x44, 0x48, + 0x9c, 0x40, 0x5c, 0x40, 0x45, 0xdc, 0x10, 0x95, 0x2a, 0xf1, 0x5b, 0x7a, 0xac, 0x04, 0x07, 0x4e, + 0x08, 0x25, 0x1c, 0x10, 0xbf, 0x81, 0x03, 0xda, 0xd9, 0x37, 0xeb, 0x5d, 0x67, 0x9d, 0xdd, 0x94, + 0xaa, 0xa7, 0xd8, 0x33, 0xdf, 0x7b, 0xef, 0xfb, 0xde, 0x9b, 0xf9, 0x26, 0x86, 0xfa, 0x2d, 0x2e, + 0xb6, 0xb9, 0xb0, 0x5c, 0x3e, 0xb4, 0x86, 0x2b, 0x1d, 0x47, 0xda, 0x2b, 0xd6, 0x9d, 0x81, 0xd3, + 0xdf, 0x69, 0x05, 0x7d, 0x2e, 0x39, 0x62, 0xb4, 0xdf, 0x72, 0xf9, 0xb0, 0x45, 0xfb, 0xc6, 0x12, + 0xc5, 0x74, 0x6c, 0xe1, 0x44, 0xe0, 0x38, 0x34, 0xb0, 0x5d, 0xcf, 0xb7, 0xa5, 0xc7, 0xfd, 0x28, + 0xde, 0x98, 0x77, 0xb9, 0xcb, 0xd5, 0x47, 0x2b, 0xfc, 0x44, 0xab, 0x0b, 0x2e, 0xe7, 0x6e, 0xcf, + 0xb1, 0xec, 0xc0, 0xb3, 0x6c, 0xdf, 0xe7, 0x52, 0x85, 0x08, 0xbd, 0x9b, 0xc1, 0x29, 0xac, 0xaf, + 0x76, 0xcd, 0xb7, 0x60, 0xfe, 0xa3, 0xb0, 0xe6, 0x8d, 0x3e, 0x0f, 0xb8, 0xb0, 0x7b, 0x6d, 0xe7, + 0xce, 0xc0, 0x11, 0x12, 0x1b, 0x30, 0x1b, 0xd0, 0xd2, 0x96, 0xd7, 0xad, 0xb1, 0x45, 0xd6, 0x2c, + 0xb7, 0x41, 0x2f, 0x7d, 0xd0, 0x35, 0x3f, 0x81, 0xe7, 0xc6, 0x02, 0x45, 0xc0, 0x7d, 0xe1, 0xe0, + 0xbb, 0x50, 0xd1, 0x30, 0x15, 0x36, 0xbb, 0xba, 0xd0, 0x3a, 0x2c, 0xbb, 0xa5, 0xe3, 0xd6, 0xcb, + 0x0f, 0xfe, 0x68, 0x94, 0xda, 0x71, 0x8c, 0xf9, 0x0f, 0x1b, 0xcb, 0x2c, 0x34, 0xa7, 0xeb, 0xf0, + 0x54, 0xcc, 0x49, 0x48, 0x5b, 0x0e, 0x84, 0x2a, 0x30, 0xb7, 0x6a, 0x1e, 0x55, 0x60, 0x53, 0x21, + 0xdb, 0x73, 0x41, 0xea, 0x3b, 0xce, 0xc3, 0xcc, 0x90, 0x4b, 0xa7, 0x5f, 0x9b, 0x5a, 0x64, 0xcd, + 0x6a, 0x3b, 0xfa, 0x82, 0x0b, 0x50, 0xed, 0x3a, 0x01, 0x17, 0x9e, 0xe4, 0xfd, 0xda, 0xb4, 0xda, + 0x19, 0x2d, 0xe0, 0x55, 0x80, 0xd1, 0x48, 0x6a, 0x65, 0x25, 0xee, 0xac, 0xae, 0x1d, 0xce, 0xaf, + 0x15, 0x0d, 0x3b, 0xa6, 0x60, 0xbb, 0x0e, 0x91, 0x6f, 0x27, 0x22, 0x2f, 0x55, 0xbe, 0xbe, 0xd7, + 0x28, 0xfd, 0x7d, 0xaf, 0x51, 0x32, 0xef, 0x33, 0x78, 0x7e, 0x5c, 0x2c, 0xf5, 0xf1, 0x0a, 0x54, + 0x35, 0xe5, 0x50, 0xe7, 0x74, 0xc1, 0x46, 0x8e, 0x82, 0x70, 0x23, 0x45, 0x77, 0x4a, 0xd1, 0x3d, + 0x97, 0x4b, 0x37, 0x2a, 0x9f, 0xe4, 0x6b, 0x6e, 0xc2, 0xd3, 0x8a, 0xe4, 0xc7, 0x5c, 0x3a, 0x45, + 0x0f, 0x48, 0x76, 0x83, 0x13, 0xd2, 0x37, 0xe0, 0x99, 0x44, 0x52, 0x12, 0xbd, 0x0a, 0xe5, 0x10, + 0x47, 0x07, 0xa7, 0x96, 0xa5, 0x37, 0xc4, 0x93, 0x56, 0x85, 0x35, 0xbf, 0x48, 0x24, 0x12, 0x85, + 0xe9, 0x5d, 0xcd, 0x68, 0xce, 0x23, 0xcc, 0xd2, 0xbc, 0xcb, 0x00, 0x93, 0xe5, 0x49, 0xc8, 0x85, + 0x48, 0xbd, 0x9e, 0x5c, 0x9e, 0x92, 0x08, 0xfc, 0xf8, 0x26, 0xf6, 0x06, 0x91, 0xba, 0x61, 0xf7, + 0xed, 0xed, 0x54, 0x53, 0xd4, 0xc2, 0x96, 0xdc, 0x09, 0xa2, 0x26, 0x57, 0xc3, 0xb0, 0x70, 0xe9, + 0xe6, 0x4e, 0xe0, 0x98, 0xff, 0x32, 0x78, 0x36, 0x15, 0x47, 0x6a, 0xae, 0xc3, 0xe9, 0x21, 0x97, + 0x9e, 0xef, 0x6e, 0x45, 0x60, 0x9a, 0xcf, 0xe2, 0x04, 0x55, 0x9e, 0xef, 0x46, 0x09, 0x48, 0xdd, + 0xa9, 0x61, 0x62, 0x0d, 0x3f, 0x84, 0x39, 0xba, 0x52, 0x3a, 0x5b, 0x24, 0xf4, 0xe5, 0xac, 0x6c, + 0xef, 0x47, 0xc8, 0x54, 0xba, 0xd3, 0xdd, 0xe4, 0x22, 0x5e, 0x83, 0x53, 0xd2, 0xee, 0xf5, 0x76, + 0x74, 0xb6, 0x69, 0x95, 0xad, 0x91, 0x95, 0xed, 0x66, 0x88, 0x4b, 0xe5, 0x9a, 0x95, 0xa3, 0x25, + 0xf3, 0x33, 0x52, 0x4f, 0x45, 0x0b, 0x9f, 0xa5, 0x94, 0x6b, 0x4c, 0x8d, 0xb9, 0x46, 0xe2, 0xc8, + 0x6f, 0x92, 0xd9, 0xc6, 0xf9, 0xa9, 0xbd, 0x97, 0xe1, 0x24, 0xc1, 0xa9, 0xb1, 0x2f, 0x1e, 0xd1, + 0x0a, 0x22, 0xae, 0x23, 0xcc, 0x2f, 0xd3, 0x49, 0x9f, 0xfc, 0x0d, 0xf8, 0x59, 0x1b, 0xf6, 0x88, + 0x01, 0xe9, 0x7a, 0x07, 0x2a, 0xc4, 0x52, 0xdf, 0x83, 0x02, 0xc2, 0xe2, 0x90, 0xc7, 0x77, 0x1b, + 0x2e, 0xc1, 0x0b, 0x8a, 0xa0, 0x1a, 0x7f, 0xdb, 0x11, 0x83, 0x9e, 0x3c, 0xc6, 0x3b, 0x57, 0x3b, + 0x1c, 0x1b, 0xcf, 0x6d, 0x46, 0x1d, 0x1f, 0x9a, 0xda, 0xe4, 0x23, 0x17, 0xc5, 0xe9, 0xbb, 0xae, + 0x62, 0x56, 0x7f, 0xab, 0xc2, 0x8c, 0xca, 0x8c, 0x3f, 0x30, 0xa8, 0x68, 0x17, 0xc7, 0x66, 0x56, + 0x92, 0xac, 0x27, 0xda, 0x78, 0xb5, 0x00, 0x32, 0x22, 0x6a, 0xae, 0x7d, 0xf5, 0xeb, 0x5f, 0x77, + 0xa7, 0x96, 0xf1, 0xbc, 0x95, 0xf1, 0xcf, 0x40, 0xfc, 0x60, 0x58, 0xbb, 0x89, 0x56, 0xec, 0xe1, + 0x37, 0x0c, 0xaa, 0xf1, 0xb3, 0x84, 0xf9, 0xd5, 0xf4, 0xc9, 0x33, 0x96, 0x8a, 0x40, 0x89, 0xd9, + 0x19, 0xc5, 0xac, 0x81, 0x2f, 0x1d, 0xc9, 0x0c, 0x7f, 0x64, 0x50, 0x0e, 0xed, 0x12, 0x5f, 0x99, + 0x98, 0x3b, 0xf1, 0x38, 0x19, 0x67, 0x72, 0x50, 0x54, 0xfc, 0x3d, 0x55, 0xfc, 0x32, 0x5e, 0x3c, + 0x46, 0x5b, 0x2c, 0xe5, 0xd4, 0xd6, 0xae, 0x7a, 0xce, 0xf6, 0xf0, 0x7b, 0x06, 0x33, 0xca, 0xf9, + 0xf1, 0xe8, 0x9a, 0x71, 0x73, 0xce, 0xe6, 0xc1, 0x88, 0xdb, 0x45, 0xc5, 0x6d, 0x0d, 0x57, 0x8e, + 0xcd, 0x0d, 0xbf, 0x65, 0x70, 0x82, 0xbc, 0x71, 0x72, 0xb5, 0xd4, 0xcb, 0x60, 0x9c, 0xcb, 0xc5, + 0x11, 0xad, 0xd7, 0x15, 0xad, 0x25, 0x6c, 0x66, 0xd2, 0x52, 0x58, 0x6b, 0x37, 0xf1, 0xc8, 0xec, + 0xe1, 0x2f, 0x0c, 0x4e, 0xd2, 0x0d, 0xc7, 0xc9, 0x65, 0xd2, 0x96, 0x6b, 0x34, 0xf3, 0x81, 0x44, + 0xe8, 0x9a, 0x22, 0xb4, 0x8e, 0x57, 0x8e, 0xd3, 0x27, 0x6d, 0x31, 0xd6, 0x6e, 0x6c, 0xd3, 0x7b, + 0xf8, 0x13, 0x83, 0x8a, 0xb6, 0x30, 0xcc, 0x25, 0x20, 0xf2, 0xaf, 0xe1, 0xb8, 0x1f, 0x9a, 0x6f, + 0x2b, 0xae, 0x6f, 0xe2, 0x85, 0x47, 0xe1, 0x8a, 0xf7, 0x19, 0xcc, 0x26, 0xdc, 0x04, 0xcf, 0x4f, + 0x2c, 0x7c, 0xd8, 0xe7, 0x8c, 0xd7, 0x8a, 0x81, 0xff, 0xcf, 0xe1, 0x53, 0xb6, 0xb6, 0xbe, 0xf1, + 0x60, 0xbf, 0xce, 0x1e, 0xee, 0xd7, 0xd9, 0x9f, 0xfb, 0x75, 0xf6, 0xdd, 0x41, 0xbd, 0xf4, 0xf0, + 0xa0, 0x5e, 0xfa, 0xfd, 0xa0, 0x5e, 0xfa, 0x74, 0xd9, 0xf5, 0xe4, 0xed, 0x41, 0xa7, 0x75, 0x8b, + 0x6f, 0x5b, 0x5e, 0xdf, 0x13, 0xbe, 0x23, 0xd5, 0xdf, 0xdb, 0x83, 0xce, 0xb2, 0xe8, 0x7e, 0xbe, + 0xec, 0x72, 0x6b, 0x9b, 0x77, 0x07, 0x3d, 0x47, 0x95, 0xeb, 0x9c, 0x50, 0x3f, 0x50, 0xd6, 0xfe, + 0x0b, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xea, 0x9d, 0xde, 0x54, 0x0d, 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 { + // Proposal queries proposal details based on ProposalID. + Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { + out := new(QueryProposalResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { + out := new(QueryProposalsResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposals", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { + out := new(QueryVoteResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { + out := new(QueryVotesResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Votes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { + out := new(QueryDepositResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { + out := new(QueryDepositsResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposits", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { + out := new(QueryTallyResultResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/TallyResult", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Proposal queries proposal details based on ProposalID. + Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) + // Proposals queries all proposals based on given status. + Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) + // Vote queries voted information based on proposalID, voterAddr. + Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) + // Votes queries votes of a given proposal. + Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) + // Params queries all parameters of the gov module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Deposit queries single deposit information based proposalID, depositAddr. + Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) + // Deposits queries all deposits of a single proposal. + Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) + // TallyResult queries the tally of a proposal vote. + TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") +} +func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") +} +func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} +func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") +} +func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Proposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Proposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Proposals(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Proposals", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVotesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Votes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Votes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(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: "/cosmos.gov.v1beta1.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_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDepositsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deposits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/Deposits", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTallyResultRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TallyResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Query/TallyResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.gov.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Proposal", + Handler: _Query_Proposal_Handler, + }, + { + MethodName: "Proposals", + Handler: _Query_Proposals_Handler, + }, + { + MethodName: "Vote", + Handler: _Query_Vote_Handler, + }, + { + MethodName: "Votes", + Handler: _Query_Votes_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "Deposit", + Handler: _Query_Deposit_Handler, + }, + { + MethodName: "Deposits", + Handler: _Query_Deposits_Handler, + }, + { + MethodName: "TallyResult", + Handler: _Query_TallyResult_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/gov/v1beta1/query.proto", +} + +func (m *QueryProposalRequest) 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 *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalResponse) 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 *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Proposal.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 *QueryProposalsRequest) 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 *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalsRequest) 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] = 0x22 + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x1a + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalStatus != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryProposalsResponse) 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 *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalsResponse) 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.Proposals) > 0 { + for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Proposals[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 *QueryVoteRequest) 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 *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryVoteResponse) 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 *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Vote.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 *QueryVotesRequest) 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 *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotesRequest) 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 m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryVotesResponse) 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 *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryVotesResponse) 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.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[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 *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 + if len(m.ParamsType) > 0 { + i -= len(m.ParamsType) + copy(dAtA[i:], m.ParamsType) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) + i-- + dAtA[i] = 0xa + } + 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.TallyParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.VotingParams.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 *QueryDepositRequest) 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 *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositResponse) 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 *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Deposit.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 *QueryDepositsRequest) 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 *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsRequest) 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 m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryDepositsResponse) 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 *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDepositsResponse) 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.Deposits) > 0 { + for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposits[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 *QueryTallyResultRequest) 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 *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTallyResultResponse) 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 *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Tally.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 *QueryProposalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Proposal.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryProposalsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalStatus != 0 { + n += 1 + sovQuery(uint64(m.ProposalStatus)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryProposalsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + 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 *QueryVoteRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Vote.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryVotesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryVotesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Votes) > 0 { + for _, e := range m.Votes { + 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 *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ParamsType) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.VotingParams.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.DepositParams.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.TallyParams.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDepositRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Deposit.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDepositsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDepositsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + 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 *QueryTallyResultRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryTallyResultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Tally.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 *QueryProposalRequest) 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: QueryProposalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryProposalResponse) 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: QueryProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposal", 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.Proposal.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 *QueryProposalsRequest) 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: QueryProposalsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) + } + m.ProposalStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalStatus |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 *QueryProposalsResponse) 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: QueryProposalsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", 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.Proposals = append(m.Proposals, Proposal{}) + if err := m.Proposals[len(m.Proposals)-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 *QueryVoteRequest) 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: QueryVoteRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = 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 *QueryVoteResponse) 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: QueryVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Vote", 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.Vote.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 *QueryVotesRequest) 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: QueryVotesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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.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 *QueryVotesResponse) 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: QueryVotesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", 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.Votes = append(m.Votes, Vote{}) + if err := m.Votes[len(m.Votes)-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 *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 { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", 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.ParamsType = 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 *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 VotingParams", 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.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", 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.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", 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.TallyParams.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 *QueryDepositRequest) 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: QueryDepositRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = 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 *QueryDepositResponse) 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: QueryDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", 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.Deposit.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 *QueryDepositsRequest) 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: QueryDepositsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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.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 *QueryDepositsResponse) 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: QueryDepositsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposits", 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.Deposits = append(m.Deposits, Deposit{}) + if err := m.Deposits[len(m.Deposits)-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 *QueryTallyResultRequest) 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: QueryTallyResultRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTallyResultResponse) 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: QueryTallyResultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tally", 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.Tally.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/module-sdk/gov/tx.pb.go b/module-sdk/gov/tx.pb.go new file mode 100644 index 00000000..37582dfe --- /dev/null +++ b/module-sdk/gov/tx.pb.go @@ -0,0 +1,1472 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/gov/v1beta1/tx.proto + +package gov + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + types "github.com/irisnet/core-sdk-go/common/codec/types" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types1 "github.com/irisnet/core-sdk-go/types" + _ "github.com/regen-network/cosmos-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 + +// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary +// proposal Content. +type MsgSubmitProposal struct { + Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` + InitialDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"initial_deposit" yaml:"initial_deposit"` + Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` +} + +func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } +func (*MsgSubmitProposal) ProtoMessage() {} +func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{0} +} +func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposal.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 *MsgSubmitProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposal.Merge(m, src) +} +func (m *MsgSubmitProposal) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo + +// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. +type MsgSubmitProposalResponse struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` +} + +func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResponse{} } +func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitProposalResponse) ProtoMessage() {} +func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{1} +} +func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposalResponse.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 *MsgSubmitProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposalResponse.Merge(m, src) +} +func (m *MsgSubmitProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposalResponse proto.InternalMessageInfo + +func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// MsgVote defines a message to cast a vote. +type MsgVote struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` +} + +func (m *MsgVote) Reset() { *m = MsgVote{} } +func (*MsgVote) ProtoMessage() {} +func (*MsgVote) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{2} +} +func (m *MsgVote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVote.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 *MsgVote) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVote.Merge(m, src) +} +func (m *MsgVote) XXX_Size() int { + return m.Size() +} +func (m *MsgVote) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVote.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVote proto.InternalMessageInfo + +// MsgVoteResponse defines the Msg/Vote response type. +type MsgVoteResponse struct { +} + +func (m *MsgVoteResponse) Reset() { *m = MsgVoteResponse{} } +func (m *MsgVoteResponse) String() string { return proto.CompactTextString(m) } +func (*MsgVoteResponse) ProtoMessage() {} +func (*MsgVoteResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{3} +} +func (m *MsgVoteResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVoteResponse.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 *MsgVoteResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVoteResponse.Merge(m, src) +} +func (m *MsgVoteResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgVoteResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVoteResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVoteResponse proto.InternalMessageInfo + +// MsgDeposit defines a message to submit a deposit to an existing proposal. +type MsgDeposit struct { + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` +} + +func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } +func (*MsgDeposit) ProtoMessage() {} +func (*MsgDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{4} +} +func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeposit.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 *MsgDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeposit.Merge(m, src) +} +func (m *MsgDeposit) XXX_Size() int { + return m.Size() +} +func (m *MsgDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo + +// MsgDepositResponse defines the Msg/Deposit response type. +type MsgDepositResponse struct { +} + +func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } +func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDepositResponse) ProtoMessage() {} +func (*MsgDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_3c053992595e3dce, []int{5} +} +func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositResponse.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 *MsgDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositResponse.Merge(m, src) +} +func (m *MsgDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1beta1.MsgSubmitProposal") + proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1beta1.MsgSubmitProposalResponse") + proto.RegisterType((*MsgVote)(nil), "cosmos.gov.v1beta1.MsgVote") + proto.RegisterType((*MsgVoteResponse)(nil), "cosmos.gov.v1beta1.MsgVoteResponse") + proto.RegisterType((*MsgDeposit)(nil), "cosmos.gov.v1beta1.MsgDeposit") + proto.RegisterType((*MsgDepositResponse)(nil), "cosmos.gov.v1beta1.MsgDepositResponse") +} + +func init() { proto.RegisterFile("cosmos/gov/v1beta1/tx.proto", fileDescriptor_3c053992595e3dce) } + +var fileDescriptor_3c053992595e3dce = []byte{ + // 600 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xb6, 0x93, 0xd2, 0xd0, 0x8b, 0xd4, 0xd2, 0x53, 0x84, 0x52, 0xb7, 0xb2, 0x23, 0xa3, 0xa2, + 0x2e, 0xb1, 0xd5, 0x20, 0x18, 0xca, 0x44, 0x8a, 0xf8, 0x31, 0x44, 0x05, 0x23, 0x31, 0xb0, 0x54, + 0x76, 0x72, 0xbd, 0x9e, 0x88, 0xfd, 0xac, 0xdc, 0x39, 0x22, 0x1b, 0x23, 0x62, 0x42, 0x82, 0x81, + 0xb1, 0x33, 0x1b, 0x12, 0x7f, 0x44, 0xc5, 0xd4, 0x91, 0x01, 0x05, 0xd4, 0x2c, 0x88, 0x81, 0xa1, + 0x7f, 0x01, 0xf2, 0x9d, 0x9d, 0x56, 0x4d, 0x5a, 0x8a, 0xd4, 0x29, 0x79, 0xef, 0x7b, 0xdf, 0xa7, + 0xfb, 0xbe, 0x7b, 0x3e, 0xb4, 0xdc, 0x06, 0x1e, 0x02, 0x77, 0x29, 0xf4, 0xdd, 0xfe, 0x7a, 0x40, + 0x84, 0xbf, 0xee, 0x8a, 0x57, 0x4e, 0xdc, 0x03, 0x01, 0x18, 0x2b, 0xd0, 0xa1, 0xd0, 0x77, 0x32, + 0xd0, 0x30, 0x33, 0x42, 0xe0, 0x73, 0x32, 0x66, 0xb4, 0x81, 0x45, 0x8a, 0x63, 0xac, 0x4c, 0x11, + 0x4c, 0xf9, 0x0a, 0x5d, 0x52, 0xe8, 0xb6, 0xac, 0xdc, 0x4c, 0x5e, 0x41, 0x15, 0x0a, 0x14, 0x54, + 0x3f, 0xfd, 0x97, 0x13, 0x28, 0x00, 0xed, 0x12, 0x57, 0x56, 0x41, 0xb2, 0xe3, 0xfa, 0xd1, 0x40, + 0x41, 0xf6, 0x87, 0x02, 0x5a, 0x6c, 0x71, 0xfa, 0x2c, 0x09, 0x42, 0x26, 0x9e, 0xf4, 0x20, 0x06, + 0xee, 0x77, 0xf1, 0x5d, 0x54, 0x6a, 0x43, 0x24, 0x48, 0x24, 0xaa, 0x7a, 0x4d, 0x5f, 0x2b, 0x37, + 0x2a, 0x8e, 0x92, 0x70, 0x72, 0x09, 0xe7, 0x5e, 0x34, 0x68, 0x96, 0xbf, 0x7e, 0xa9, 0x97, 0x36, + 0xd5, 0xa0, 0x97, 0x33, 0xf0, 0x7b, 0x1d, 0x2d, 0xb0, 0x88, 0x09, 0xe6, 0x77, 0xb7, 0x3b, 0x24, + 0x06, 0xce, 0x44, 0xb5, 0x50, 0x2b, 0xae, 0x95, 0x1b, 0x4b, 0x4e, 0x76, 0xd8, 0xd4, 0x77, 0x1e, + 0x86, 0xb3, 0x09, 0x2c, 0x6a, 0x6e, 0xed, 0x0f, 0x2d, 0xed, 0x68, 0x68, 0x5d, 0x1f, 0xf8, 0x61, + 0x77, 0xc3, 0x3e, 0xc5, 0xb7, 0x3f, 0xfd, 0xb0, 0xea, 0x94, 0x89, 0xdd, 0x24, 0x70, 0xda, 0x10, + 0xba, 0xac, 0xc7, 0x78, 0x44, 0x84, 0xfc, 0xdd, 0x4d, 0x82, 0x3a, 0xef, 0xbc, 0xac, 0x53, 0x70, + 0xc5, 0x20, 0x26, 0x5c, 0xea, 0x71, 0x6f, 0x3e, 0x93, 0xb8, 0xaf, 0x14, 0xb0, 0x81, 0xae, 0xc6, + 0xd2, 0x1e, 0xe9, 0x55, 0x8b, 0x35, 0x7d, 0x6d, 0xce, 0x1b, 0xd7, 0x1b, 0xd7, 0xde, 0xec, 0x59, + 0xda, 0xc7, 0x3d, 0x4b, 0xfb, 0xb5, 0x67, 0x69, 0xaf, 0xbf, 0xd7, 0x34, 0xbb, 0x8d, 0x96, 0x26, + 0x52, 0xf1, 0x08, 0x8f, 0x21, 0xe2, 0x04, 0x3f, 0x40, 0xe5, 0x38, 0xeb, 0x6d, 0xb3, 0x8e, 0x4c, + 0x68, 0xa6, 0xb9, 0xfa, 0x7b, 0x68, 0x9d, 0x6c, 0x1f, 0x0d, 0x2d, 0xac, 0xbc, 0x9c, 0x68, 0xda, + 0x1e, 0xca, 0xab, 0xc7, 0x1d, 0xfb, 0xb3, 0x8e, 0x4a, 0x2d, 0x4e, 0x9f, 0x83, 0xb8, 0x34, 0x4d, + 0x5c, 0x41, 0x57, 0xfa, 0x20, 0x48, 0xaf, 0x5a, 0x90, 0x1e, 0x55, 0x81, 0xef, 0xa0, 0x59, 0x88, + 0x05, 0x83, 0x48, 0x5a, 0x9f, 0x6f, 0x98, 0xce, 0xe4, 0x52, 0x3a, 0xe9, 0x39, 0xb6, 0xe4, 0x94, + 0x97, 0x4d, 0x4f, 0x09, 0x66, 0x11, 0x2d, 0x64, 0x47, 0xce, 0xe3, 0xb0, 0xff, 0xe8, 0x08, 0xb5, + 0x38, 0xcd, 0x83, 0xbe, 0x2c, 0x27, 0x2b, 0x68, 0x2e, 0xbb, 0x7d, 0xc8, 0xdd, 0x1c, 0x37, 0xf0, + 0x2e, 0x9a, 0xf5, 0x43, 0x48, 0x22, 0x51, 0x2d, 0xfe, 0x6b, 0xb5, 0x6e, 0xa7, 0xab, 0xf5, 0xff, + 0x0b, 0x94, 0xe9, 0x4f, 0xc9, 0xa0, 0x82, 0xf0, 0xb1, 0xdf, 0x3c, 0x86, 0xc6, 0xdb, 0x02, 0x2a, + 0xb6, 0x38, 0xc5, 0x3b, 0x68, 0xfe, 0xd4, 0xd7, 0xb4, 0x3a, 0x2d, 0xed, 0x89, 0xf5, 0x32, 0xea, + 0x17, 0x1a, 0x1b, 0x6f, 0xe1, 0x23, 0x34, 0x23, 0x37, 0x67, 0xf9, 0x0c, 0x5a, 0x0a, 0x1a, 0x37, + 0xce, 0x01, 0xc7, 0x4a, 0x4f, 0x51, 0x29, 0xbf, 0x3c, 0xf3, 0x8c, 0xf9, 0x0c, 0x37, 0x6e, 0x9e, + 0x8f, 0xe7, 0x92, 0xcd, 0x87, 0xfb, 0x87, 0xa6, 0x7e, 0x70, 0x68, 0xea, 0x3f, 0x0f, 0x4d, 0xfd, + 0xdd, 0xc8, 0xd4, 0x0e, 0x46, 0xa6, 0xf6, 0x6d, 0x64, 0x6a, 0x2f, 0x2e, 0x70, 0x0b, 0x21, 0x74, + 0x92, 0x2e, 0x91, 0xaf, 0x5f, 0x30, 0x2b, 0x1f, 0x9c, 0x5b, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0xdd, 0x15, 0xe5, 0x99, 0x63, 0x05, 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 { + // SubmitProposal defines a method to create new proposal given a content. + SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) + // Vote defines a method to add a vote on a specific proposal. + Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) + // Deposit defines a method to add deposit on a specific proposal. + Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) { + out := new(MsgSubmitProposalResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/SubmitProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) { + out := new(MsgVoteResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { + out := new(MsgDepositResponse) + err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Deposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // SubmitProposal defines a method to create new proposal given a content. + SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) + // Vote defines a method to add a vote on a specific proposal. + Vote(context.Context, *MsgVote) (*MsgVoteResponse, error) + // Deposit defines a method to add deposit on a specific proposal. + Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") +} +func (*UnimplementedMsgServer) Vote(ctx context.Context, req *MsgVote) (*MsgVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitProposal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Msg/SubmitProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitProposal(ctx, req.(*MsgSubmitProposal)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgVote) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Msg/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Vote(ctx, req.(*MsgVote)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeposit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.gov.v1beta1.Msg/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.gov.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitProposal", + Handler: _Msg_SubmitProposal_Handler, + }, + { + MethodName: "Vote", + Handler: _Msg_Vote_Handler, + }, + { + MethodName: "Deposit", + Handler: _Msg_Deposit_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/gov/v1beta1/tx.proto", +} + +func (m *MsgSubmitProposal) 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 *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x1a + } + if len(m.InitialDeposit) > 0 { + for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Content != nil { + { + size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitProposalResponse) 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 *MsgSubmitProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgVote) 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 *MsgVote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Option != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x18 + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgVoteResponse) 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 *MsgVoteResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeposit) 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 *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgDepositResponse) 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 *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositResponse) 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 *MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Content != nil { + l = m.Content.Size() + n += 1 + l + sovTx(uint64(l)) + } + if len(m.InitialDeposit) > 0 { + for _, e := range m.InitialDeposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + return n +} + +func (m *MsgVote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Option != 0 { + n += 1 + sovTx(uint64(m.Option)) + } + return n +} + +func (m *MsgVoteResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgDepositResponse) 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 *MsgSubmitProposal) 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: MsgSubmitProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Content == nil { + m.Content = &types.Any{} + } + if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) + if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", 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.Proposer = 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 *MsgSubmitProposalResponse) 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: MsgSubmitProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(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 *MsgVote) 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: MsgVote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(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 *MsgVoteResponse) 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: MsgVoteResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVoteResponse: 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 *MsgDeposit) 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: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types1.Coin{}) + if err := m.Amount[len(m.Amount)-1].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 *MsgDepositResponse) 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: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositResponse: 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/module-sdk/gov/types.go b/module-sdk/gov/types.go new file mode 100644 index 00000000..c4486bf3 --- /dev/null +++ b/module-sdk/gov/types.go @@ -0,0 +1,289 @@ +package gov + +import ( + "fmt" + "github.com/gogo/protobuf/proto" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" + yaml "gopkg.in/yaml.v2" +) + +const ( + ModuleName = "gov" + AttributeKeyProposalId = "proposal_id" +) + +var ( + _ sdk.Msg = &MsgSubmitProposal{} + _ sdk.Msg = &MsgDeposit{} + _ sdk.Msg = &MsgVote{} +) + +// NewMsgSubmitProposal creates a new MsgSubmitProposal. +//nolint:interfacer +func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { + m := &MsgSubmitProposal{ + InitialDeposit: initialDeposit, + Proposer: proposer.String(), + } + err := m.SetContent(content) + if err != nil { + return nil, err + } + return m, nil +} + +func (m *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return m.InitialDeposit } + +func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress { + proposer, _ := sdk.AccAddressFromBech32(m.Proposer) + return proposer +} + +func (m *MsgSubmitProposal) SetContent(content Content) error { + msg, ok := content.(proto.Message) + if !ok { + return fmt.Errorf("can't proto marshal %T", msg) + } + any, err := types.NewAnyWithValue(msg) + if err != nil { + return err + } + m.Content = any + return nil +} + +func (m *MsgSubmitProposal) GetContent() Content { + content, ok := m.Content.GetCachedValue().(Content) + if !ok { + return nil + } + return content +} + +func (m MsgSubmitProposal) Route() string { return ModuleName } + +// Type implements Msg +func (m MsgSubmitProposal) Type() string { return "submit_proposal" } + +// ValidateBasic implements Msg +func (m MsgSubmitProposal) ValidateBasic() error { + if m.Proposer == "" { + return sdk.Wrapf("missing Proposer") + } + if !m.InitialDeposit.IsValid() { + return sdk.Wrapf("invalidCoins coins, %s", m.InitialDeposit.String()) + } + if m.InitialDeposit.IsAnyNegative() { + return sdk.Wrapf("invalidCoins coins, %s", m.InitialDeposit.String()) + } + + content := m.GetContent() + if content == nil { + return sdk.Wrapf("missing content") + } + + if err := content.ValidateBasic(); err != nil { + return err + } + + return nil +} + +// GetSignBytes implements Msg +func (m MsgSubmitProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&m) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements Msg +func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { + proposer, _ := sdk.AccAddressFromBech32(m.Proposer) + return []sdk.AccAddress{proposer} +} + +// String implements the Stringer interface +func (m MsgSubmitProposal) String() string { + out, _ := yaml.Marshal(m) + return string(out) +} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { + var content Content + return unpacker.UnpackAny(m.Content, &content) +} + +func (msg MsgDeposit) Route() string { return ModuleName } + +// Type implements Msg +func (msg MsgDeposit) Type() string { return "deposit" } + +// ValidateBasic implements Msg +func (msg MsgDeposit) ValidateBasic() error { + if msg.Depositor == "" { + return sdk.Wrapf("missing Proposer") + } + if !msg.Amount.IsValid() { + return sdk.Wrapf("invalidCoins coins, %s", msg.Amount.String()) + } + if msg.Amount.IsAnyNegative() { + return sdk.Wrapf("invalidCoins coins, %s", msg.Amount.String()) + } + + return nil +} + +// String implements the Stringer interface +func (msg MsgDeposit) String() string { + out, _ := yaml.Marshal(msg) + return string(out) +} + +// GetSignBytes implements Msg +func (msg MsgDeposit) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements Msg +func (msg MsgDeposit) GetSigners() []sdk.AccAddress { + depositor, _ := sdk.AccAddressFromBech32(msg.Depositor) + return []sdk.AccAddress{depositor} +} + +func (msg MsgVote) Route() string { return ModuleName } + +// Type implements Msg +func (msg MsgVote) Type() string { return "vote" } + +// ValidateBasic implements Msg +func (msg MsgVote) ValidateBasic() error { + if msg.Voter == "" { + return sdk.Wrapf("missing Proposer") + } + + if !ValidVoteOption(msg.Option) { + return sdk.Wrapf("invalid vote option %s", msg.Option.String()) + } + + return nil +} + +func ValidVoteOption(option VoteOption) bool { + if option == OptionYes || + option == OptionAbstain || + option == OptionNo || + option == OptionNoWithVeto { + return true + } + return false +} + +// String implements the Stringer interface +func (msg MsgVote) String() string { + out, _ := yaml.Marshal(msg) + return string(out) +} + +// GetSignBytes implements Msg +func (msg MsgVote) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners implements Msg +func (msg MsgVote) GetSigners() []sdk.AccAddress { + voter, _ := sdk.AccAddressFromBech32(msg.Voter) + return []sdk.AccAddress{voter} +} + +func (q Proposal) Convert() interface{} { + return QueryProposalResp{ + ProposalId: q.ProposalId, + Status: ProposalStatus_name[int32(q.Status)], + FinalTallyResult: QueryTallyResultResp{ + Yes: q.FinalTallyResult.Yes, + Abstain: q.FinalTallyResult.Abstain, + No: q.FinalTallyResult.No, + NoWithVeto: q.FinalTallyResult.NoWithVeto, + }, + SubmitTime: q.SubmitTime, + DepositEndTime: q.DepositEndTime, + TotalDeposit: q.TotalDeposit, + VotingStartTime: q.VotingStartTime, + VotingEndTime: q.VotingEndTime, + } +} + +type Proposals []Proposal + +func (qs Proposals) Convert() interface{} { + var res []QueryProposalResp + for _, q := range qs { + res = append(res, q.Convert().(QueryProposalResp)) + } + return res +} + +func (v Vote) Convert() interface{} { + return QueryVoteResp{ + ProposalId: v.ProposalId, + Voter: v.Voter, + Option: int32(v.Option), + } +} + +type Votes []Vote + +func (vs Votes) Convert() interface{} { + var res []QueryVoteResp + for _, v := range vs { + res = append(res, v.Convert().(QueryVoteResp)) + } + return res +} + +func (q QueryParamsResponse) Convert() interface{} { + return QueryParamsResp{ + VotingParams: votingParams{ + VotingPeriod: q.VotingParams.VotingPeriod, + }, + DepositParams: depositParams{ + MinDeposit: q.DepositParams.MinDeposit, + MaxDepositPeriod: q.DepositParams.MaxDepositPeriod, + }, + TallyParams: tallyParams{ + Quorum: q.TallyParams.Quorum, + Threshold: q.TallyParams.Threshold, + VetoThreshold: q.TallyParams.VetoThreshold, + }, + } +} + +func (d Deposit) Convert() interface{} { + return QueryDepositResp{ + ProposalId: d.ProposalId, + Depositor: d.Depositor, + Amount: d.Amount, + } +} + +type Deposits []Deposit + +func (ds Deposits) Convert() interface{} { + var res []QueryDepositResp + for _, d := range ds { + res = append(res, d.Convert().(QueryDepositResp)) + } + return res +} + +func (t TallyResult) Convert() interface{} { + return QueryTallyResultResp{ + Yes: t.Yes, + Abstain: t.Abstain, + No: t.No, + NoWithVeto: t.NoWithVeto, + } +} From 610f65a331d941c6bf5bafdcc342cd4f9cf20c60 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 17:59:18 +0800 Subject: [PATCH 09/41] module-sdk-go refactoring --- module-sdk/coinswap/go.mod | 4 +- module-sdk/htlc/codec.go | 25 + module-sdk/htlc/export.go | 61 + module-sdk/htlc/go.mod | 13 + module-sdk/htlc/htlc.go | 110 ++ module-sdk/htlc/htlc.pb.go | 2417 +++++++++++++++++++++++++++++ module-sdk/htlc/query.pb.go | 1668 ++++++++++++++++++++ module-sdk/htlc/tx.pb.go | 1358 ++++++++++++++++ module-sdk/htlc/types.go | 140 ++ module-sdk/keys/doc.go | 17 + module-sdk/keys/export.go | 15 + module-sdk/keys/keys.go | 51 + module-sdk/nft/codec.go | 29 + module-sdk/nft/export.go | 90 ++ module-sdk/nft/go.mod | 13 + module-sdk/nft/nft.go | 267 ++++ module-sdk/nft/nft.pb.go | 1615 +++++++++++++++++++ module-sdk/nft/query.pb.go | 2642 ++++++++++++++++++++++++++++++++ module-sdk/nft/tx.pb.go | 2133 ++++++++++++++++++++++++++ module-sdk/nft/types.go | 282 ++++ module-sdk/oracle/codec.go | 26 + module-sdk/oracle/export.go | 71 + module-sdk/oracle/go.mod | 15 + module-sdk/oracle/oracle.go | 172 +++ module-sdk/oracle/oracle.pb.go | 857 +++++++++++ module-sdk/oracle/query.pb.go | 1958 +++++++++++++++++++++++ module-sdk/oracle/tx.pb.go | 2598 +++++++++++++++++++++++++++++++ module-sdk/oracle/types.go | 333 ++++ 28 files changed, 18978 insertions(+), 2 deletions(-) create mode 100644 module-sdk/htlc/codec.go create mode 100644 module-sdk/htlc/export.go create mode 100644 module-sdk/htlc/go.mod create mode 100644 module-sdk/htlc/htlc.go create mode 100644 module-sdk/htlc/htlc.pb.go create mode 100644 module-sdk/htlc/query.pb.go create mode 100644 module-sdk/htlc/tx.pb.go create mode 100644 module-sdk/htlc/types.go create mode 100644 module-sdk/keys/doc.go create mode 100644 module-sdk/keys/export.go create mode 100644 module-sdk/keys/keys.go create mode 100644 module-sdk/nft/codec.go create mode 100644 module-sdk/nft/export.go create mode 100644 module-sdk/nft/go.mod create mode 100644 module-sdk/nft/nft.go create mode 100644 module-sdk/nft/nft.pb.go create mode 100644 module-sdk/nft/query.pb.go create mode 100644 module-sdk/nft/tx.pb.go create mode 100644 module-sdk/nft/types.go create mode 100644 module-sdk/oracle/codec.go create mode 100644 module-sdk/oracle/export.go create mode 100644 module-sdk/oracle/go.mod create mode 100644 module-sdk/oracle/oracle.go create mode 100644 module-sdk/oracle/oracle.pb.go create mode 100644 module-sdk/oracle/query.pb.go create mode 100644 module-sdk/oracle/tx.pb.go create mode 100644 module-sdk/oracle/types.go diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index 7ed81b63..067e7325 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -3,8 +3,8 @@ module coinswap go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 +github.com/gogo/protobuf v1.3.3 +github.com/irisnet/core-sdk-go v0.1.0 ) replace ( diff --git a/module-sdk/htlc/codec.go b/module-sdk/htlc/codec.go new file mode 100644 index 00000000..5ff4727c --- /dev/null +++ b/module-sdk/htlc/codec.go @@ -0,0 +1,25 @@ +package htlc + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateHTLC{}, + &MsgClaimHTLC{}, + ) +} diff --git a/module-sdk/htlc/export.go b/module-sdk/htlc/export.go new file mode 100644 index 00000000..5311c38e --- /dev/null +++ b/module-sdk/htlc/export.go @@ -0,0 +1,61 @@ +package htlc + +import sdk "github.com/irisnet/core-sdk-go/types" + +// expose HTLC module api for user +type Client interface { + sdk.Module + + CreateHTLC(request CreateHTLCRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + ClaimHTLC(hashLock string, secret string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + + QueryHTLC(hashLock string) (QueryHTLCResp, sdk.Error) + QueryParams() (QueryParamsResp, sdk.Error) +} + +type CreateHTLCRequest struct { + To string `json:"to"` + ReceiverOnOtherChain string `json:"receiver_on_other_chain"` + SenderOnOtherChain string `json:"sender_on_other_chain"` + Amount sdk.DecCoins `json:"amount"` + HashLock string `json:"hash_lock"` + Timestamp uint64 `json:"timestamp"` + TimeLock uint64 `json:"time_lock"` + Transfer bool ` json:"transfer"` +} + +type QueryHTLCResp struct { + Sender string `json:"sender"` + To string `json:"to"` + ReceiverOnOtherChain string `json:"receiver_on_other_chain"` + SenderOnOtherChain string `json:"sender_on_other_chain"` + Amount sdk.Coins `json:"amount"` + Secret string `json:"secret"` + Timestamp uint64 `json:"timestamp"` + ExpirationHeight uint64 `json:"expiration_height"` + State int32 `json:"state"` + Transfer bool ` json:"transfer"` +} + +type QueryParamsResp struct { + AssetParams []AssetParamDto `json:"asset_params"` +} + +type AssetParamDto struct { + Denom string `json:"denom"` + SupplyLimit SupplyLimitDto `json:"supply_limit"` + Active bool `json:"active"` + DeputyAddress string `json:"deputy_address"` + FixedFee uint64 `json:"fixed_fee"` + MinSwapAmount uint64 `json:"min_swap_amount"` + MaxSwapAmount uint64 `json:"max_swap_amount"` + MinBlockLock uint64 `json:"min_block_lock"` + MaxBlockLock uint64 `json:"max_block_lock"` +} + +type SupplyLimitDto struct { + Limit uint64 `json:"limit"` + TimeLimited bool `json:"time_limited"` + TimePeriod int64 `json:"time_period"` + TimeBasedLimit uint64 `json:"time_based_limit"` +} diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod new file mode 100644 index 00000000..bba94cfa --- /dev/null +++ b/module-sdk/htlc/go.mod @@ -0,0 +1,13 @@ +module htlc + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/htlc/htlc.go b/module-sdk/htlc/htlc.go new file mode 100644 index 00000000..cf01a95b --- /dev/null +++ b/module-sdk/htlc/htlc.go @@ -0,0 +1,110 @@ +package htlc + +import ( + "context" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" +) + +type htlcClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { + return htlcClient{ + BaseClient: baseClient, + Marshaler: marshaler, + } +} + +func (hc htlcClient) Name() string { + return ModuleName +} + +func (hc htlcClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (hc htlcClient) CreateHTLC(request CreateHTLCRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := hc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + if request.TimeLock == 0 { + request.TimeLock = MinTimeLock + } + + amount, err := hc.ToMinCoin(request.Amount...) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgCreateHTLC{ + Sender: sender.String(), + To: request.To, + ReceiverOnOtherChain: request.ReceiverOnOtherChain, + SenderOnOtherChain: request.SenderOnOtherChain, + Amount: amount, + HashLock: request.HashLock, + Timestamp: request.Timestamp, + TimeLock: request.TimeLock, + Transfer: request.Transfer, + } + return hc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (hc htlcClient) ClaimHTLC(hashLockId string, secret string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := hc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgClaimHTLC{ + Sender: sender.String(), + Id: hashLockId, + Secret: secret, + } + return hc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (hc htlcClient) QueryHTLC(hashLockId string) (QueryHTLCResp, sdk.Error) { + if len(hashLockId) == 0 { + return QueryHTLCResp{}, sdk.Wrapf("hashLock id is required") + } + + conn, err := hc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryHTLCResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).HTLC( + context.Background(), + &QueryHTLCRequest{ + Id: hashLockId, + }) + if err != nil { + return QueryHTLCResp{}, sdk.Wrap(err) + } + return res.Htlc.Convert().(QueryHTLCResp), nil +} + +func (hc htlcClient) QueryParams() (QueryParamsResp, sdk.Error) { + + conn, err := hc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Params( + context.Background(), + &QueryParamsRequest{}) + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + return res.Params.Convert().(QueryParamsResp), nil +} diff --git a/module-sdk/htlc/htlc.pb.go b/module-sdk/htlc/htlc.pb.go new file mode 100644 index 00000000..ba092eab --- /dev/null +++ b/module-sdk/htlc/htlc.pb.go @@ -0,0 +1,2417 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: htlc/htlc.proto + +package htlc + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/duration" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// HTLCState defines the state of an HTLC +type HTLCState int32 + +const ( + // HTLC_STATE_OPEN defines an open state. + Open HTLCState = 0 + // HTLC_STATE_COMPLETED defines a completed state. + Completed HTLCState = 1 + // HTLC_STATE_REFUNDED defines a refunded state. + Refunded HTLCState = 2 +) + +var HTLCState_name = map[int32]string{ + 0: "HTLC_STATE_OPEN", + 1: "HTLC_STATE_COMPLETED", + 2: "HTLC_STATE_REFUNDED", +} + +var HTLCState_value = map[string]int32{ + "HTLC_STATE_OPEN": 0, + "HTLC_STATE_COMPLETED": 1, + "HTLC_STATE_REFUNDED": 2, +} + +func (x HTLCState) String() string { + return proto.EnumName(HTLCState_name, int32(x)) +} + +func (HTLCState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c03699801a204f8b, []int{0} +} + +// SwapDirection defines the direction of an HTLT +type SwapDirection int32 + +const ( + // INVALID defines an htlt invalid direction. + Invalid SwapDirection = 0 + // INCOMING defines an htlt incoming direction. + Incoming SwapDirection = 1 + // OUTGOING defines an htlt outgoing direction. + Outgoing SwapDirection = 2 +) + +var SwapDirection_name = map[int32]string{ + 0: "INVALID", + 1: "INCOMING", + 2: "OUTGOING", +} + +var SwapDirection_value = map[string]int32{ + "INVALID": 0, + "INCOMING": 1, + "OUTGOING": 2, +} + +func (x SwapDirection) String() string { + return proto.EnumName(SwapDirection_name, int32(x)) +} + +func (SwapDirection) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c03699801a204f8b, []int{1} +} + +// HTLC defines the struct of an HTLC +type HTLC struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` + ReceiverOnOtherChain string `protobuf:"bytes,4,opt,name=receiver_on_other_chain,json=receiverOnOtherChain,proto3" json:"receiver_on_other_chain,omitempty" yaml:"receiver_on_other_chain"` + SenderOnOtherChain string `protobuf:"bytes,5,opt,name=sender_on_other_chain,json=senderOnOtherChain,proto3" json:"sender_on_other_chain,omitempty" yaml:"sender_on_other_chain"` + Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` + HashLock string `protobuf:"bytes,7,opt,name=hash_lock,json=hashLock,proto3" json:"hash_lock,omitempty" yaml:"hash_lock"` + Secret string `protobuf:"bytes,8,opt,name=secret,proto3" json:"secret,omitempty"` + Timestamp uint64 `protobuf:"varint,9,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + ExpirationHeight uint64 `protobuf:"varint,10,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height,omitempty" yaml:"expiration_height"` + State HTLCState `protobuf:"varint,11,opt,name=state,proto3,enum=irismod.htlc.HTLCState" json:"state,omitempty"` + ClosedBlock uint64 `protobuf:"varint,12,opt,name=closed_block,json=closedBlock,proto3" json:"closed_block,omitempty" yaml:"closed_block"` + Transfer bool `protobuf:"varint,13,opt,name=transfer,proto3" json:"transfer,omitempty"` + Direction SwapDirection `protobuf:"varint,14,opt,name=direction,proto3,enum=irismod.htlc.SwapDirection" json:"direction,omitempty"` +} + +func (m *HTLC) Reset() { *m = HTLC{} } +func (m *HTLC) String() string { return proto.CompactTextString(m) } +func (*HTLC) ProtoMessage() {} +func (*HTLC) Descriptor() ([]byte, []int) { + return fileDescriptor_c03699801a204f8b, []int{0} +} +func (m *HTLC) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HTLC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HTLC.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 *HTLC) XXX_Merge(src proto.Message) { + xxx_messageInfo_HTLC.Merge(m, src) +} +func (m *HTLC) XXX_Size() int { + return m.Size() +} +func (m *HTLC) XXX_DiscardUnknown() { + xxx_messageInfo_HTLC.DiscardUnknown(m) +} + +var xxx_messageInfo_HTLC proto.InternalMessageInfo + +type AssetSupply struct { + IncomingSupply types.Coin `protobuf:"bytes,1,opt,name=incoming_supply,json=incomingSupply,proto3" json:"incoming_supply" yaml:"incoming_supply"` + OutgoingSupply types.Coin `protobuf:"bytes,2,opt,name=outgoing_supply,json=outgoingSupply,proto3" json:"outgoing_supply" yaml:"assetoutgoing_supply_params"` + CurrentSupply types.Coin `protobuf:"bytes,3,opt,name=current_supply,json=currentSupply,proto3" json:"current_supply" yaml:"current_supply"` + TimeLimitedCurrentSupply types.Coin `protobuf:"bytes,4,opt,name=time_limited_current_supply,json=timeLimitedCurrentSupply,proto3" json:"time_limited_current_supply" yaml:"time_limited_current_supply"` + TimeElapsed time.Duration `protobuf:"bytes,5,opt,name=time_elapsed,json=timeElapsed,proto3,stdduration" json:"time_elapsed" yaml:"time_elapsed"` +} + +func (m *AssetSupply) Reset() { *m = AssetSupply{} } +func (m *AssetSupply) String() string { return proto.CompactTextString(m) } +func (*AssetSupply) ProtoMessage() {} +func (*AssetSupply) Descriptor() ([]byte, []int) { + return fileDescriptor_c03699801a204f8b, []int{1} +} +func (m *AssetSupply) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AssetSupply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AssetSupply.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 *AssetSupply) XXX_Merge(src proto.Message) { + xxx_messageInfo_AssetSupply.Merge(m, src) +} +func (m *AssetSupply) XXX_Size() int { + return m.Size() +} +func (m *AssetSupply) XXX_DiscardUnknown() { + xxx_messageInfo_AssetSupply.DiscardUnknown(m) +} + +var xxx_messageInfo_AssetSupply proto.InternalMessageInfo + +// Params defines token module's parameters +type Params struct { + AssetParams []AssetParam `protobuf:"bytes,1,rep,name=asset_params,json=assetParams,proto3" json:"asset_params" yaml:"asset_params"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_c03699801a204f8b, []int{2} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +type AssetParam struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + SupplyLimit SupplyLimit `protobuf:"bytes,2,opt,name=supply_limit,json=supplyLimit,proto3" json:"supply_limit" yaml:"supply_limit"` + Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` + DeputyAddress string `protobuf:"bytes,4,opt,name=deputy_address,json=deputyAddress,proto3" json:"deputy_address,omitempty" yaml:"deputy_address"` + FixedFee github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,5,opt,name=fixed_fee,json=fixedFee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"fixed_fee"` + MinSwapAmount github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,6,opt,name=min_swap_amount,json=minSwapAmount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_swap_amount"` + MaxSwapAmount github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,7,opt,name=max_swap_amount,json=maxSwapAmount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"max_swap_amount"` + MinBlockLock uint64 `protobuf:"varint,8,opt,name=min_block_lock,json=minBlockLock,proto3" json:"min_block_lock,omitempty" yaml:"min_block_lock"` + MaxBlockLock uint64 `protobuf:"varint,9,opt,name=max_block_lock,json=maxBlockLock,proto3" json:"max_block_lock,omitempty" yaml:"max_block_lock"` +} + +func (m *AssetParam) Reset() { *m = AssetParam{} } +func (m *AssetParam) String() string { return proto.CompactTextString(m) } +func (*AssetParam) ProtoMessage() {} +func (*AssetParam) Descriptor() ([]byte, []int) { + return fileDescriptor_c03699801a204f8b, []int{3} +} +func (m *AssetParam) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AssetParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AssetParam.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 *AssetParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_AssetParam.Merge(m, src) +} +func (m *AssetParam) XXX_Size() int { + return m.Size() +} +func (m *AssetParam) XXX_DiscardUnknown() { + xxx_messageInfo_AssetParam.DiscardUnknown(m) +} + +var xxx_messageInfo_AssetParam proto.InternalMessageInfo + +type SupplyLimit struct { + Limit github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,1,opt,name=limit,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"limit"` + TimeLimited bool `protobuf:"varint,2,opt,name=time_limited,json=timeLimited,proto3" json:"time_limited,omitempty" yaml:"time_limited"` + TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period" yaml:"time_period"` + TimeBasedLimit github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=time_based_limit,json=timeBasedLimit,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"time_based_limit"` +} + +func (m *SupplyLimit) Reset() { *m = SupplyLimit{} } +func (m *SupplyLimit) String() string { return proto.CompactTextString(m) } +func (*SupplyLimit) ProtoMessage() {} +func (*SupplyLimit) Descriptor() ([]byte, []int) { + return fileDescriptor_c03699801a204f8b, []int{4} +} +func (m *SupplyLimit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SupplyLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SupplyLimit.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 *SupplyLimit) XXX_Merge(src proto.Message) { + xxx_messageInfo_SupplyLimit.Merge(m, src) +} +func (m *SupplyLimit) XXX_Size() int { + return m.Size() +} +func (m *SupplyLimit) XXX_DiscardUnknown() { + xxx_messageInfo_SupplyLimit.DiscardUnknown(m) +} + +var xxx_messageInfo_SupplyLimit proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("irismod.htlc.HTLCState", HTLCState_name, HTLCState_value) + proto.RegisterEnum("irismod.htlc.SwapDirection", SwapDirection_name, SwapDirection_value) + proto.RegisterType((*HTLC)(nil), "irismod.htlc.HTLC") + proto.RegisterType((*AssetSupply)(nil), "irismod.htlc.AssetSupply") + proto.RegisterType((*Params)(nil), "irismod.htlc.Params") + proto.RegisterType((*AssetParam)(nil), "irismod.htlc.AssetParam") + proto.RegisterType((*SupplyLimit)(nil), "irismod.htlc.SupplyLimit") +} + +func init() { proto.RegisterFile("htlc/htlc.proto", fileDescriptor_c03699801a204f8b) } + +var fileDescriptor_c03699801a204f8b = []byte{ + // 1245 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0x13, 0xc7, + 0x1b, 0xf6, 0x06, 0x27, 0xb1, 0xc7, 0x8e, 0xe3, 0xdf, 0x10, 0x60, 0x31, 0x60, 0x5b, 0x2b, 0xfd, + 0xd4, 0x88, 0x2a, 0xb6, 0x00, 0xf5, 0x50, 0x2e, 0x6d, 0xec, 0x18, 0xb0, 0x14, 0xe2, 0x68, 0x12, + 0xaa, 0x42, 0x85, 0x56, 0xe3, 0xdd, 0x89, 0x3d, 0xc2, 0xbb, 0xb3, 0xda, 0x19, 0x87, 0xe4, 0xd6, + 0x43, 0x0f, 0x55, 0x4e, 0x3d, 0xf6, 0x12, 0xa9, 0x52, 0x2f, 0x55, 0x3f, 0x09, 0x47, 0x0e, 0xad, + 0x54, 0xf5, 0x60, 0x5a, 0xb8, 0x54, 0xea, 0x2d, 0x9f, 0xa0, 0x9a, 0x3f, 0x76, 0x76, 0x43, 0x81, + 0x96, 0x5e, 0xc0, 0xef, 0xbf, 0xe7, 0x79, 0xf7, 0x9d, 0x77, 0x9e, 0x09, 0x58, 0x1e, 0x8a, 0x91, + 0xd7, 0x94, 0xff, 0x34, 0xa2, 0x98, 0x09, 0x06, 0x8b, 0x34, 0xa6, 0x3c, 0x60, 0x7e, 0x43, 0xfa, + 0x2a, 0x55, 0x8f, 0xf1, 0x80, 0xf1, 0x66, 0x1f, 0x73, 0xd2, 0xdc, 0xbf, 0xd1, 0x27, 0x02, 0xdf, + 0x68, 0x7a, 0x8c, 0x86, 0x3a, 0xbb, 0xb2, 0x32, 0x60, 0x03, 0xa6, 0x7e, 0x36, 0xe5, 0x2f, 0xe3, + 0xad, 0x0e, 0x18, 0x1b, 0x8c, 0x48, 0x53, 0x59, 0xfd, 0xf1, 0x5e, 0xd3, 0x1f, 0xc7, 0x58, 0x50, + 0x66, 0xaa, 0x9c, 0x9f, 0xe6, 0x41, 0xf6, 0xde, 0xee, 0x66, 0x1b, 0x96, 0xc0, 0x1c, 0xf5, 0x6d, + 0xab, 0x6e, 0xad, 0xe6, 0xd1, 0x1c, 0xf5, 0xe1, 0x45, 0xb0, 0xc0, 0x49, 0xe8, 0x93, 0xd8, 0x9e, + 0x53, 0x3e, 0x63, 0xc9, 0x3c, 0xc1, 0xec, 0x73, 0x3a, 0x4f, 0x30, 0xf8, 0x10, 0x5c, 0x8a, 0x89, + 0x47, 0xe8, 0x3e, 0x89, 0x5d, 0x16, 0xba, 0x4c, 0x0c, 0x49, 0xec, 0x7a, 0x43, 0x4c, 0x43, 0x3b, + 0x2b, 0x93, 0x5a, 0xce, 0xc9, 0xa4, 0x56, 0x3d, 0xc4, 0xc1, 0xe8, 0xb6, 0xf3, 0x86, 0x44, 0x07, + 0xad, 0x4c, 0x23, 0xbd, 0xb0, 0x27, 0xfd, 0x6d, 0xe9, 0x86, 0x3b, 0xe0, 0x82, 0x26, 0x3d, 0x0b, + 0x3c, 0xaf, 0x80, 0xeb, 0x27, 0x93, 0xda, 0x55, 0x0d, 0xfc, 0xb7, 0x69, 0x0e, 0x82, 0xda, 0x9f, + 0x02, 0x1d, 0x82, 0x05, 0x1c, 0xb0, 0x71, 0x28, 0xec, 0x85, 0xfa, 0xb9, 0xd5, 0xc2, 0xcd, 0xcb, + 0x0d, 0x3d, 0xd7, 0x86, 0x9c, 0x6b, 0xc3, 0xcc, 0xb5, 0xd1, 0x66, 0x34, 0x6c, 0x7d, 0xf4, 0x6c, + 0x52, 0xcb, 0xfc, 0xf8, 0xa2, 0xb6, 0x36, 0xa0, 0x62, 0x38, 0xee, 0x37, 0x3c, 0x16, 0x34, 0xe5, + 0x91, 0x84, 0x44, 0xa8, 0xff, 0x87, 0xe3, 0xfe, 0x1a, 0xf7, 0x9f, 0xac, 0x0d, 0x58, 0x53, 0x1c, + 0x46, 0x84, 0xab, 0x2a, 0x8e, 0x0c, 0x3e, 0xbc, 0x01, 0xf2, 0x43, 0xcc, 0x87, 0xee, 0x88, 0x79, + 0x4f, 0xec, 0x45, 0xd5, 0xf2, 0xca, 0xc9, 0xa4, 0x56, 0xd6, 0x2d, 0xcf, 0x42, 0x0e, 0xca, 0xc9, + 0xdf, 0x9b, 0xcc, 0x7b, 0xa2, 0x87, 0xee, 0xc5, 0x44, 0xd8, 0xb9, 0xe9, 0xd0, 0xa5, 0x05, 0xaf, + 0x82, 0xbc, 0xa0, 0x01, 0xe1, 0x02, 0x07, 0x91, 0x9d, 0xaf, 0x5b, 0xab, 0x59, 0x74, 0xea, 0x80, + 0x5d, 0xf0, 0x3f, 0x72, 0x10, 0x51, 0x7d, 0xae, 0xee, 0x90, 0xd0, 0xc1, 0x50, 0xd8, 0x40, 0x66, + 0xb5, 0xae, 0x9e, 0x4c, 0x6a, 0xb6, 0x26, 0x7c, 0x2d, 0xc5, 0x41, 0xe5, 0x53, 0xdf, 0x3d, 0xe5, + 0x82, 0x6b, 0x60, 0x9e, 0x0b, 0x2c, 0x88, 0x5d, 0xa8, 0x5b, 0xab, 0xa5, 0x9b, 0x97, 0x1a, 0xc9, + 0x15, 0x6c, 0xc8, 0x45, 0xd9, 0x91, 0x61, 0xa4, 0xb3, 0xe0, 0x6d, 0x50, 0xf4, 0x46, 0x8c, 0x13, + 0xdf, 0xed, 0xab, 0xaf, 0x2c, 0x2a, 0xd2, 0x4b, 0x27, 0x93, 0xda, 0x79, 0x4d, 0x9a, 0x8c, 0x3a, + 0xa8, 0xa0, 0xcd, 0x96, 0xb4, 0x60, 0x05, 0xe4, 0x44, 0x8c, 0x43, 0xbe, 0x47, 0x62, 0x7b, 0xa9, + 0x6e, 0xad, 0xe6, 0xd0, 0xcc, 0x86, 0x1f, 0x83, 0xbc, 0x4f, 0x63, 0xe2, 0xc9, 0xce, 0xec, 0x92, + 0x6a, 0xe5, 0x4a, 0xba, 0x95, 0x9d, 0xa7, 0x38, 0xda, 0x98, 0xa6, 0xa0, 0xd3, 0xec, 0xdb, 0xd9, + 0x3f, 0xbe, 0xab, 0x59, 0xce, 0x0f, 0x59, 0x50, 0x58, 0xe7, 0x9c, 0x88, 0x9d, 0x71, 0x14, 0x8d, + 0x0e, 0x61, 0x1f, 0x2c, 0xd3, 0xd0, 0x63, 0x01, 0x0d, 0x07, 0x2e, 0x57, 0x2e, 0xb5, 0xea, 0x6f, + 0x3d, 0xfe, 0xaa, 0x3c, 0xfe, 0x93, 0x49, 0xed, 0xa2, 0xfe, 0x94, 0x33, 0xf5, 0x0e, 0x2a, 0x4d, + 0x3d, 0x86, 0x23, 0x04, 0xcb, 0x6c, 0x2c, 0x06, 0x2c, 0xc1, 0x31, 0xf7, 0x2e, 0x8e, 0xeb, 0x86, + 0xc3, 0xd1, 0x1c, 0x58, 0xb6, 0x7c, 0x06, 0xc4, 0x8d, 0x70, 0x8c, 0x03, 0xee, 0xa0, 0xd2, 0x34, + 0x60, 0xf8, 0x5c, 0x50, 0xf2, 0xc6, 0x71, 0x4c, 0x42, 0x31, 0xa5, 0x3b, 0xf7, 0x2e, 0xba, 0x6b, + 0x86, 0xee, 0x82, 0x39, 0x9d, 0x54, 0xb9, 0x83, 0x96, 0x8c, 0xc3, 0x10, 0x7c, 0x65, 0x81, 0x2b, + 0x72, 0xcb, 0xdc, 0x11, 0x0d, 0xa8, 0x20, 0xbe, 0x7b, 0x86, 0x2e, 0xfb, 0x2f, 0xbf, 0xee, 0x2d, + 0x58, 0x0e, 0xb2, 0x65, 0x74, 0x53, 0x07, 0xdb, 0xa9, 0x36, 0x1e, 0x83, 0xa2, 0xaa, 0x24, 0x23, + 0x1c, 0x71, 0xe2, 0xab, 0xdb, 0x2f, 0x69, 0xb5, 0xb2, 0x35, 0xa6, 0xca, 0xd6, 0xd8, 0x30, 0xca, + 0xd6, 0xaa, 0x19, 0xda, 0xf3, 0x09, 0x5a, 0x53, 0xec, 0x7c, 0xfb, 0xa2, 0x66, 0xa1, 0x82, 0x74, + 0x75, 0x8c, 0x67, 0x08, 0x16, 0xb6, 0xd5, 0x84, 0xe1, 0xe7, 0xa0, 0xa8, 0x0e, 0xc0, 0x4c, 0xdc, + 0xb6, 0x94, 0x40, 0xd8, 0xe9, 0xc5, 0x53, 0x5b, 0xa5, 0x0a, 0x5a, 0x57, 0xd2, 0x3c, 0xc9, 0x5a, + 0x07, 0x15, 0xf0, 0x2c, 0x91, 0x9b, 0xa5, 0xfc, 0x33, 0x0b, 0xc0, 0x69, 0x39, 0x5c, 0x01, 0xf3, + 0x3e, 0x09, 0x59, 0x60, 0x44, 0x57, 0x1b, 0xf0, 0x21, 0x28, 0x9a, 0x73, 0x57, 0x93, 0x9a, 0xad, + 0x50, 0x7a, 0xfb, 0x55, 0x86, 0x9a, 0xd6, 0xd9, 0x2e, 0x92, 0xc5, 0x0e, 0x2a, 0xf0, 0xd3, 0x4c, + 0xa9, 0x2e, 0xd8, 0x13, 0x74, 0x9f, 0xa8, 0x45, 0xc9, 0x21, 0x63, 0xc1, 0x4f, 0x41, 0xc9, 0x27, + 0xd1, 0x58, 0x1c, 0xba, 0xd8, 0xf7, 0x63, 0xc2, 0xb9, 0x51, 0xee, 0xcb, 0xa7, 0x9b, 0x92, 0x8e, + 0x3b, 0x68, 0x49, 0x3b, 0xd6, 0xb5, 0x0d, 0xb7, 0x41, 0x7e, 0x8f, 0x1e, 0x10, 0xdf, 0xdd, 0x23, + 0xc4, 0xa8, 0xf3, 0x2d, 0xd9, 0xd6, 0xaf, 0x93, 0xda, 0x87, 0xff, 0x54, 0x3c, 0xbb, 0xa1, 0x40, + 0x39, 0x85, 0x72, 0x87, 0x10, 0xf8, 0x05, 0x58, 0x0e, 0x68, 0xe8, 0xf2, 0xa7, 0x38, 0x72, 0x67, + 0x7a, 0xfd, 0xde, 0xb8, 0x4b, 0x01, 0x0d, 0xa5, 0x62, 0xac, 0x6b, 0x65, 0x96, 0xe0, 0xf8, 0x20, + 0x05, 0xbe, 0xf8, 0x5f, 0xc0, 0xf1, 0x41, 0x02, 0xfc, 0x13, 0x50, 0x92, 0x9d, 0x2b, 0xc9, 0xd3, + 0xda, 0x9f, 0x53, 0xaa, 0x98, 0x98, 0x66, 0x3a, 0xee, 0xa0, 0x62, 0x40, 0x43, 0x25, 0x8a, 0xea, + 0x11, 0x90, 0x00, 0xf8, 0x20, 0x09, 0x90, 0x7f, 0x0d, 0x20, 0x15, 0x97, 0x00, 0xf8, 0x60, 0x06, + 0x60, 0xb6, 0xed, 0xe7, 0x39, 0x50, 0x48, 0xec, 0x09, 0xec, 0x82, 0x79, 0xbd, 0x51, 0xd6, 0xfb, + 0x7f, 0xaa, 0x46, 0x90, 0xb2, 0x9f, 0xbc, 0xcb, 0x6a, 0x47, 0x73, 0x49, 0xd9, 0x4f, 0x46, 0x1d, + 0x7d, 0xdd, 0xcc, 0xd5, 0x86, 0x8f, 0x80, 0x32, 0xdd, 0x88, 0xc4, 0x94, 0xf9, 0x33, 0xc9, 0x7a, + 0xe3, 0x65, 0x9e, 0xaa, 0x30, 0x4c, 0x20, 0xeb, 0x5a, 0x7d, 0x97, 0x81, 0xf4, 0x6c, 0x2b, 0x07, + 0x7c, 0x0c, 0xca, 0x2a, 0x2e, 0x95, 0xc8, 0x37, 0xf7, 0x27, 0xfb, 0xfe, 0x5f, 0x5b, 0x92, 0x60, + 0x2d, 0x89, 0xa5, 0x9a, 0xd7, 0x73, 0xbd, 0xfe, 0xa5, 0x05, 0xf2, 0xb3, 0x87, 0x10, 0x5e, 0x03, + 0xcb, 0xd2, 0x70, 0x77, 0x76, 0xd7, 0x77, 0x3b, 0x6e, 0x6f, 0xbb, 0xb3, 0x55, 0xce, 0x54, 0x72, + 0x47, 0xc7, 0xf5, 0x6c, 0x2f, 0x22, 0x21, 0xfc, 0x00, 0xac, 0x24, 0xc2, 0xed, 0xde, 0xfd, 0xed, + 0xcd, 0xce, 0x6e, 0x67, 0xa3, 0x6c, 0x55, 0x96, 0x8e, 0x8e, 0xeb, 0xf9, 0x36, 0x0b, 0xa2, 0x11, + 0x91, 0x63, 0xf9, 0x3f, 0x38, 0x9f, 0x48, 0x44, 0x9d, 0x3b, 0x0f, 0xb6, 0x36, 0x3a, 0x1b, 0xe5, + 0xb9, 0x4a, 0xf1, 0xe8, 0xb8, 0x9e, 0x43, 0x64, 0x6f, 0x1c, 0xfa, 0xc4, 0xaf, 0x64, 0xbf, 0xfe, + 0xbe, 0x9a, 0xb9, 0x3e, 0x00, 0x4b, 0xa9, 0xf7, 0x0f, 0xda, 0x60, 0xb1, 0xbb, 0xf5, 0xd9, 0xfa, + 0x66, 0x77, 0xa3, 0x9c, 0xa9, 0x14, 0x8e, 0x8e, 0xeb, 0x8b, 0xdd, 0x70, 0x1f, 0x8f, 0xa8, 0x2f, + 0x5f, 0xd9, 0xee, 0x56, 0xbb, 0x77, 0xbf, 0xbb, 0x75, 0xb7, 0x6c, 0x69, 0xb0, 0xae, 0x79, 0xb6, + 0x64, 0xac, 0xf7, 0x60, 0xf7, 0x6e, 0x4f, 0xc6, 0x0c, 0x51, 0xcf, 0x3c, 0x31, 0x9a, 0xa8, 0xb5, + 0xf9, 0xec, 0xf7, 0x6a, 0xe6, 0xd9, 0xcb, 0xaa, 0xf5, 0xfc, 0x65, 0xd5, 0xfa, 0xed, 0x65, 0xd5, + 0xfa, 0xe6, 0x55, 0x35, 0xf3, 0xfc, 0x55, 0x35, 0xf3, 0xcb, 0xab, 0x6a, 0xe6, 0x51, 0xe3, 0xdd, + 0xc3, 0x0c, 0x98, 0x3f, 0x1e, 0x11, 0xae, 0xfe, 0xaa, 0xed, 0x2f, 0xa8, 0xd3, 0xbd, 0xf5, 0x57, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xd6, 0xc2, 0x45, 0xe9, 0x0a, 0x00, 0x00, +} + +func (this *HTLC) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HTLC) + if !ok { + that2, ok := that.(HTLC) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Sender != that1.Sender { + return false + } + if this.To != that1.To { + return false + } + if this.ReceiverOnOtherChain != that1.ReceiverOnOtherChain { + return false + } + if this.SenderOnOtherChain != that1.SenderOnOtherChain { + return false + } + if len(this.Amount) != len(that1.Amount) { + return false + } + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + if this.HashLock != that1.HashLock { + return false + } + if this.Secret != that1.Secret { + return false + } + if this.Timestamp != that1.Timestamp { + return false + } + if this.ExpirationHeight != that1.ExpirationHeight { + return false + } + if this.State != that1.State { + return false + } + if this.ClosedBlock != that1.ClosedBlock { + return false + } + if this.Transfer != that1.Transfer { + return false + } + if this.Direction != that1.Direction { + return false + } + return true +} +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 + } + if len(this.AssetParams) != len(that1.AssetParams) { + return false + } + for i := range this.AssetParams { + if !this.AssetParams[i].Equal(&that1.AssetParams[i]) { + return false + } + } + return true +} +func (this *AssetParam) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*AssetParam) + if !ok { + that2, ok := that.(AssetParam) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Denom != that1.Denom { + return false + } + if !this.SupplyLimit.Equal(&that1.SupplyLimit) { + return false + } + if this.Active != that1.Active { + return false + } + if this.DeputyAddress != that1.DeputyAddress { + return false + } + if !this.FixedFee.Equal(that1.FixedFee) { + return false + } + if !this.MinSwapAmount.Equal(that1.MinSwapAmount) { + return false + } + if !this.MaxSwapAmount.Equal(that1.MaxSwapAmount) { + return false + } + if this.MinBlockLock != that1.MinBlockLock { + return false + } + if this.MaxBlockLock != that1.MaxBlockLock { + return false + } + return true +} +func (this *SupplyLimit) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SupplyLimit) + if !ok { + that2, ok := that.(SupplyLimit) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Limit.Equal(that1.Limit) { + return false + } + if this.TimeLimited != that1.TimeLimited { + return false + } + if this.TimePeriod != that1.TimePeriod { + return false + } + if !this.TimeBasedLimit.Equal(that1.TimeBasedLimit) { + return false + } + return true +} +func (m *HTLC) 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 *HTLC) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HTLC) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Direction != 0 { + i = encodeVarintHtlc(dAtA, i, uint64(m.Direction)) + i-- + dAtA[i] = 0x70 + } + if m.Transfer { + i-- + if m.Transfer { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } + if m.ClosedBlock != 0 { + i = encodeVarintHtlc(dAtA, i, uint64(m.ClosedBlock)) + i-- + dAtA[i] = 0x60 + } + if m.State != 0 { + i = encodeVarintHtlc(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x58 + } + if m.ExpirationHeight != 0 { + i = encodeVarintHtlc(dAtA, i, uint64(m.ExpirationHeight)) + i-- + dAtA[i] = 0x50 + } + if m.Timestamp != 0 { + i = encodeVarintHtlc(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x48 + } + if len(m.Secret) > 0 { + i -= len(m.Secret) + copy(dAtA[i:], m.Secret) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.Secret))) + i-- + dAtA[i] = 0x42 + } + if len(m.HashLock) > 0 { + i -= len(m.HashLock) + copy(dAtA[i:], m.HashLock) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.HashLock))) + i-- + dAtA[i] = 0x3a + } + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.SenderOnOtherChain) > 0 { + i -= len(m.SenderOnOtherChain) + copy(dAtA[i:], m.SenderOnOtherChain) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.SenderOnOtherChain))) + i-- + dAtA[i] = 0x2a + } + if len(m.ReceiverOnOtherChain) > 0 { + i -= len(m.ReceiverOnOtherChain) + copy(dAtA[i:], m.ReceiverOnOtherChain) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.ReceiverOnOtherChain))) + i-- + dAtA[i] = 0x22 + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AssetSupply) 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 *AssetSupply) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AssetSupply) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TimeElapsed, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimeElapsed):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintHtlc(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x2a + { + size, err := m.TimeLimitedCurrentSupply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.CurrentSupply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.OutgoingSupply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.IncomingSupply.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AssetParams) > 0 { + for iNdEx := len(m.AssetParams) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AssetParams[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *AssetParam) 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 *AssetParam) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AssetParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxBlockLock != 0 { + i = encodeVarintHtlc(dAtA, i, uint64(m.MaxBlockLock)) + i-- + dAtA[i] = 0x48 + } + if m.MinBlockLock != 0 { + i = encodeVarintHtlc(dAtA, i, uint64(m.MinBlockLock)) + i-- + dAtA[i] = 0x40 + } + { + size := m.MaxSwapAmount.Size() + i -= size + if _, err := m.MaxSwapAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.MinSwapAmount.Size() + i -= size + if _, err := m.MinSwapAmount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.FixedFee.Size() + i -= size + if _, err := m.FixedFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.DeputyAddress) > 0 { + i -= len(m.DeputyAddress) + copy(dAtA[i:], m.DeputyAddress) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.DeputyAddress))) + i-- + dAtA[i] = 0x22 + } + if m.Active { + i-- + if m.Active { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + { + size, err := m.SupplyLimit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintHtlc(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SupplyLimit) 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 *SupplyLimit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SupplyLimit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.TimeBasedLimit.Size() + i -= size + if _, err := m.TimeBasedLimit.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TimePeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimePeriod):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintHtlc(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x1a + if m.TimeLimited { + i-- + if m.TimeLimited { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + { + size := m.Limit.Size() + i -= size + if _, err := m.Limit.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintHtlc(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintHtlc(dAtA []byte, offset int, v uint64) int { + offset -= sovHtlc(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *HTLC) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + l = len(m.ReceiverOnOtherChain) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + l = len(m.SenderOnOtherChain) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovHtlc(uint64(l)) + } + } + l = len(m.HashLock) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + l = len(m.Secret) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + sovHtlc(uint64(m.Timestamp)) + } + if m.ExpirationHeight != 0 { + n += 1 + sovHtlc(uint64(m.ExpirationHeight)) + } + if m.State != 0 { + n += 1 + sovHtlc(uint64(m.State)) + } + if m.ClosedBlock != 0 { + n += 1 + sovHtlc(uint64(m.ClosedBlock)) + } + if m.Transfer { + n += 2 + } + if m.Direction != 0 { + n += 1 + sovHtlc(uint64(m.Direction)) + } + return n +} + +func (m *AssetSupply) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.IncomingSupply.Size() + n += 1 + l + sovHtlc(uint64(l)) + l = m.OutgoingSupply.Size() + n += 1 + l + sovHtlc(uint64(l)) + l = m.CurrentSupply.Size() + n += 1 + l + sovHtlc(uint64(l)) + l = m.TimeLimitedCurrentSupply.Size() + n += 1 + l + sovHtlc(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimeElapsed) + n += 1 + l + sovHtlc(uint64(l)) + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AssetParams) > 0 { + for _, e := range m.AssetParams { + l = e.Size() + n += 1 + l + sovHtlc(uint64(l)) + } + } + return n +} + +func (m *AssetParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + l = m.SupplyLimit.Size() + n += 1 + l + sovHtlc(uint64(l)) + if m.Active { + n += 2 + } + l = len(m.DeputyAddress) + if l > 0 { + n += 1 + l + sovHtlc(uint64(l)) + } + l = m.FixedFee.Size() + n += 1 + l + sovHtlc(uint64(l)) + l = m.MinSwapAmount.Size() + n += 1 + l + sovHtlc(uint64(l)) + l = m.MaxSwapAmount.Size() + n += 1 + l + sovHtlc(uint64(l)) + if m.MinBlockLock != 0 { + n += 1 + sovHtlc(uint64(m.MinBlockLock)) + } + if m.MaxBlockLock != 0 { + n += 1 + sovHtlc(uint64(m.MaxBlockLock)) + } + return n +} + +func (m *SupplyLimit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Limit.Size() + n += 1 + l + sovHtlc(uint64(l)) + if m.TimeLimited { + n += 2 + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimePeriod) + n += 1 + l + sovHtlc(uint64(l)) + l = m.TimeBasedLimit.Size() + n += 1 + l + sovHtlc(uint64(l)) + return n +} + +func sovHtlc(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozHtlc(x uint64) (n int) { + return sovHtlc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *HTLC) 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 ErrIntOverflowHtlc + } + 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: HTLC: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HTLC: 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 ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + 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 Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReceiverOnOtherChain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReceiverOnOtherChain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SenderOnOtherChain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SenderOnOtherChain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HashLock", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HashLock = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Secret", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Secret = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationHeight", wireType) + } + m.ExpirationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + 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 ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= HTLCState(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClosedBlock", wireType) + } + m.ClosedBlock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClosedBlock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Transfer", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Transfer = bool(v != 0) + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Direction", wireType) + } + m.Direction = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Direction |= SwapDirection(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipHtlc(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHtlc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AssetSupply) 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 ErrIntOverflowHtlc + } + 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: AssetSupply: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AssetSupply: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IncomingSupply", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.IncomingSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutgoingSupply", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OutgoingSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentSupply", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CurrentSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeLimitedCurrentSupply", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TimeLimitedCurrentSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeElapsed", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.TimeElapsed, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHtlc(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHtlc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AssetParams = append(m.AssetParams, AssetParam{}) + if err := m.AssetParams[len(m.AssetParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHtlc(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHtlc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AssetParam) 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 ErrIntOverflowHtlc + } + 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: AssetParam: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AssetParam: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SupplyLimit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SupplyLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Active = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeputyAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DeputyAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FixedFee", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.FixedFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSwapAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinSwapAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSwapAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxSwapAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinBlockLock", wireType) + } + m.MinBlockLock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinBlockLock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBlockLock", wireType) + } + m.MaxBlockLock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBlockLock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipHtlc(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHtlc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SupplyLimit) 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 ErrIntOverflowHtlc + } + 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: SupplyLimit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SupplyLimit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Limit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeLimited", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TimeLimited = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimePeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthHtlc + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.TimePeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeBasedLimit", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHtlc + } + 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 ErrInvalidLengthHtlc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthHtlc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TimeBasedLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipHtlc(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHtlc + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHtlc(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, ErrIntOverflowHtlc + } + 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, ErrIntOverflowHtlc + } + 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, ErrIntOverflowHtlc + } + 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, ErrInvalidLengthHtlc + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupHtlc + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthHtlc + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthHtlc = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHtlc = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupHtlc = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/htlc/query.pb.go b/module-sdk/htlc/query.pb.go new file mode 100644 index 00000000..c420684b --- /dev/null +++ b/module-sdk/htlc/query.pb.go @@ -0,0 +1,1668 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: htlc/query.proto + +package htlc + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// QueryHTLCRequest is the request type for the Query/HTLC RPC method +type QueryHTLCRequest struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *QueryHTLCRequest) Reset() { *m = QueryHTLCRequest{} } +func (m *QueryHTLCRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHTLCRequest) ProtoMessage() {} +func (*QueryHTLCRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a99e89fd1d8bb804, []int{0} +} +func (m *QueryHTLCRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHTLCRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHTLCRequest.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 *QueryHTLCRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHTLCRequest.Merge(m, src) +} +func (m *QueryHTLCRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryHTLCRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHTLCRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHTLCRequest proto.InternalMessageInfo + +func (m *QueryHTLCRequest) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +// QueryBalanceResponse is the response type for the Query/HTLC RPC method +type QueryHTLCResponse struct { + Htlc *HTLC `protobuf:"bytes,1,opt,name=htlc,proto3" json:"htlc,omitempty"` +} + +func (m *QueryHTLCResponse) Reset() { *m = QueryHTLCResponse{} } +func (m *QueryHTLCResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHTLCResponse) ProtoMessage() {} +func (*QueryHTLCResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a99e89fd1d8bb804, []int{1} +} +func (m *QueryHTLCResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHTLCResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHTLCResponse.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 *QueryHTLCResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHTLCResponse.Merge(m, src) +} +func (m *QueryHTLCResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryHTLCResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHTLCResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHTLCResponse proto.InternalMessageInfo + +func (m *QueryHTLCResponse) GetHtlc() *HTLC { + if m != nil { + return m.Htlc + } + return nil +} + +// QueryAssetSupplyRequest is request type for the Query/AssetSupply RPC method +type QueryAssetSupplyRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryAssetSupplyRequest) Reset() { *m = QueryAssetSupplyRequest{} } +func (m *QueryAssetSupplyRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAssetSupplyRequest) ProtoMessage() {} +func (*QueryAssetSupplyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a99e89fd1d8bb804, []int{2} +} +func (m *QueryAssetSupplyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAssetSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAssetSupplyRequest.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 *QueryAssetSupplyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAssetSupplyRequest.Merge(m, src) +} +func (m *QueryAssetSupplyRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAssetSupplyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAssetSupplyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAssetSupplyRequest proto.InternalMessageInfo + +func (m *QueryAssetSupplyRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QueryAssetSupplyResponse is response type for the Query/AssetSupply RPC method +type QueryAssetSupplyResponse struct { + AssetSupply *AssetSupply `protobuf:"bytes,1,opt,name=asset_supply,json=assetSupply,proto3" json:"asset_supply,omitempty" yaml:"asset_supply"` +} + +func (m *QueryAssetSupplyResponse) Reset() { *m = QueryAssetSupplyResponse{} } +func (m *QueryAssetSupplyResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAssetSupplyResponse) ProtoMessage() {} +func (*QueryAssetSupplyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a99e89fd1d8bb804, []int{3} +} +func (m *QueryAssetSupplyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAssetSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAssetSupplyResponse.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 *QueryAssetSupplyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAssetSupplyResponse.Merge(m, src) +} +func (m *QueryAssetSupplyResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAssetSupplyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAssetSupplyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAssetSupplyResponse proto.InternalMessageInfo + +func (m *QueryAssetSupplyResponse) GetAssetSupply() *AssetSupply { + if m != nil { + return m.AssetSupply + } + return nil +} + +// QueryAssetSuppliesRequest is request type for the Query/AssetSupplies RPC method +type QueryAssetSuppliesRequest struct { +} + +func (m *QueryAssetSuppliesRequest) Reset() { *m = QueryAssetSuppliesRequest{} } +func (m *QueryAssetSuppliesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAssetSuppliesRequest) ProtoMessage() {} +func (*QueryAssetSuppliesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a99e89fd1d8bb804, []int{4} +} +func (m *QueryAssetSuppliesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAssetSuppliesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAssetSuppliesRequest.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 *QueryAssetSuppliesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAssetSuppliesRequest.Merge(m, src) +} +func (m *QueryAssetSuppliesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAssetSuppliesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAssetSuppliesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAssetSuppliesRequest proto.InternalMessageInfo + +// QueryAssetSuppliesResponse is response type for the Query/AssetSupplies RPC method +type QueryAssetSuppliesResponse struct { + AssetSupplies []AssetSupply `protobuf:"bytes,1,rep,name=asset_supplies,json=assetSupplies,proto3" json:"asset_supplies" yaml:"asset_supplies"` +} + +func (m *QueryAssetSuppliesResponse) Reset() { *m = QueryAssetSuppliesResponse{} } +func (m *QueryAssetSuppliesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAssetSuppliesResponse) ProtoMessage() {} +func (*QueryAssetSuppliesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a99e89fd1d8bb804, []int{5} +} +func (m *QueryAssetSuppliesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAssetSuppliesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAssetSuppliesResponse.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 *QueryAssetSuppliesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAssetSuppliesResponse.Merge(m, src) +} +func (m *QueryAssetSuppliesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAssetSuppliesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAssetSuppliesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAssetSuppliesResponse proto.InternalMessageInfo + +func (m *QueryAssetSuppliesResponse) GetAssetSupplies() []AssetSupply { + if m != nil { + return m.AssetSupplies + } + return nil +} + +// QueryParamsRequest is request type for the Query/Parameters 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_a99e89fd1d8bb804, []int{6} +} +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 response type for the Query/Parameters 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_a99e89fd1d8bb804, []int{7} +} +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{} +} + +func init() { + proto.RegisterType((*QueryHTLCRequest)(nil), "irismod.htlc.QueryHTLCRequest") + proto.RegisterType((*QueryHTLCResponse)(nil), "irismod.htlc.QueryHTLCResponse") + proto.RegisterType((*QueryAssetSupplyRequest)(nil), "irismod.htlc.QueryAssetSupplyRequest") + proto.RegisterType((*QueryAssetSupplyResponse)(nil), "irismod.htlc.QueryAssetSupplyResponse") + proto.RegisterType((*QueryAssetSuppliesRequest)(nil), "irismod.htlc.QueryAssetSuppliesRequest") + proto.RegisterType((*QueryAssetSuppliesResponse)(nil), "irismod.htlc.QueryAssetSuppliesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "irismod.htlc.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "irismod.htlc.QueryParamsResponse") +} + +func init() { proto.RegisterFile("htlc/query.proto", fileDescriptor_a99e89fd1d8bb804) } + +var fileDescriptor_a99e89fd1d8bb804 = []byte{ + // 535 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xe3, 0x36, 0x8d, 0xc4, 0x4b, 0x5b, 0xca, 0xd5, 0xb4, 0xae, 0x29, 0x8e, 0x39, 0x89, + 0xd0, 0xa5, 0x3e, 0x29, 0x6c, 0x30, 0x11, 0x96, 0x22, 0x31, 0x80, 0x81, 0x85, 0xa5, 0x72, 0xea, + 0x93, 0x73, 0xaa, 0xed, 0x73, 0x72, 0xf6, 0x10, 0x55, 0x59, 0x2a, 0x3e, 0x00, 0x12, 0x5f, 0xaa, + 0x63, 0x25, 0x16, 0xa6, 0x08, 0x25, 0x6c, 0x6c, 0xfd, 0x04, 0xc8, 0xe7, 0x6b, 0x6b, 0x37, 0x21, + 0x5d, 0xec, 0xf3, 0x7b, 0xff, 0xf7, 0xfe, 0x3f, 0xdd, 0x7b, 0x32, 0x6c, 0xf5, 0xd3, 0xf0, 0x84, + 0x0c, 0x32, 0x3a, 0x1c, 0x39, 0xc9, 0x90, 0xa7, 0x1c, 0xad, 0xb3, 0x21, 0x13, 0x11, 0xf7, 0x9d, + 0x3c, 0x63, 0xee, 0x07, 0x9c, 0x07, 0x21, 0x25, 0x5e, 0xc2, 0x88, 0x17, 0xc7, 0x3c, 0xf5, 0x52, + 0xc6, 0x63, 0x51, 0x68, 0xcd, 0x87, 0xb2, 0x3a, 0x7f, 0xa8, 0x80, 0x1e, 0xf0, 0x80, 0xcb, 0x23, + 0xc9, 0x4f, 0x45, 0x14, 0x63, 0xd8, 0xfa, 0x98, 0x3b, 0x1c, 0x7d, 0x7e, 0xff, 0xd6, 0xa5, 0x83, + 0x8c, 0x8a, 0x14, 0x6d, 0xc2, 0x0a, 0xf3, 0x0d, 0xcd, 0xd6, 0x0e, 0x1e, 0xb8, 0x2b, 0xcc, 0xc7, + 0xaf, 0xe1, 0x51, 0x49, 0x23, 0x12, 0x1e, 0x0b, 0x8a, 0xda, 0x50, 0xcf, 0x9b, 0x4b, 0x59, 0xb3, + 0x83, 0x9c, 0x32, 0x9a, 0x23, 0x95, 0x32, 0x8f, 0x09, 0xec, 0xca, 0xe2, 0x37, 0x42, 0xd0, 0xf4, + 0x53, 0x96, 0x24, 0xe1, 0xe8, 0xda, 0x47, 0x87, 0x35, 0x9f, 0xc6, 0x3c, 0x52, 0x56, 0xc5, 0x07, + 0x1e, 0x80, 0x31, 0x5f, 0xa0, 0x4c, 0xbf, 0xc0, 0xba, 0x97, 0x87, 0x8f, 0x85, 0x8c, 0x2b, 0xf3, + 0xbd, 0xaa, 0x79, 0xa9, 0xb0, 0xbb, 0x7b, 0x35, 0x69, 0x6d, 0x8f, 0xbc, 0x28, 0x7c, 0x85, 0xcb, + 0x85, 0xd8, 0x6d, 0x7a, 0xb7, 0x2a, 0xfc, 0x04, 0xf6, 0xee, 0x58, 0x32, 0x2a, 0x14, 0x25, 0x1e, + 0x83, 0xb9, 0x28, 0xa9, 0x88, 0x8e, 0x61, 0xb3, 0xd4, 0x98, 0x51, 0x61, 0x68, 0xf6, 0xea, 0x72, + 0xa6, 0xa7, 0x17, 0x93, 0x56, 0xed, 0x6a, 0xd2, 0x7a, 0x3c, 0xc7, 0xc5, 0xa8, 0xc0, 0xee, 0x86, + 0x57, 0x36, 0xc2, 0x3a, 0x20, 0x69, 0xff, 0xc1, 0x1b, 0x7a, 0xd1, 0x0d, 0xd4, 0x3b, 0xd8, 0xae, + 0x44, 0x15, 0x4d, 0x07, 0x1a, 0x89, 0x8c, 0xa8, 0x9b, 0xd1, 0xab, 0x14, 0x85, 0xba, 0x5b, 0xcf, + 0x01, 0x5c, 0xa5, 0xec, 0xfc, 0x5d, 0x85, 0x35, 0xd9, 0x0b, 0x31, 0xa8, 0xe7, 0x83, 0x43, 0x56, + 0xb5, 0xea, 0xee, 0x7e, 0x98, 0xad, 0xff, 0xe6, 0x0b, 0x0c, 0x6c, 0x9f, 0xff, 0xfc, 0xf3, 0x63, + 0xc5, 0x44, 0x06, 0x51, 0x42, 0x72, 0xb3, 0x8c, 0x82, 0x9c, 0x31, 0x7f, 0x8c, 0xbe, 0x69, 0xd0, + 0x2c, 0xdd, 0x09, 0x7a, 0xbe, 0xa0, 0xe5, 0xfc, 0xc6, 0x98, 0xed, 0xfb, 0x64, 0x0a, 0xa0, 0x2d, + 0x01, 0x6c, 0x64, 0x55, 0x01, 0xae, 0x2f, 0x99, 0x9c, 0xc9, 0x55, 0x1b, 0xa3, 0x73, 0x0d, 0x36, + 0x2a, 0x73, 0x45, 0x2f, 0x96, 0x3a, 0xdc, 0xae, 0x85, 0x79, 0x70, 0xbf, 0x50, 0xc1, 0x58, 0x12, + 0xc6, 0x40, 0x3b, 0x8b, 0x61, 0xd0, 0x29, 0x34, 0x8a, 0xc1, 0x20, 0x7b, 0x41, 0xcf, 0xca, 0xdc, + 0xcd, 0x67, 0x4b, 0x14, 0xca, 0x6e, 0x5f, 0xda, 0xed, 0x20, 0xbd, 0x6a, 0x57, 0x4c, 0xbb, 0x7b, + 0x74, 0x31, 0xb5, 0xb4, 0xcb, 0xa9, 0xa5, 0xfd, 0x9e, 0x5a, 0xda, 0xf7, 0x99, 0x55, 0xbb, 0x9c, + 0x59, 0xb5, 0x5f, 0x33, 0xab, 0xf6, 0xd5, 0x09, 0x58, 0xda, 0xcf, 0x7a, 0xce, 0x09, 0x8f, 0x64, + 0x65, 0x4c, 0x53, 0xf9, 0xee, 0x67, 0xbd, 0x43, 0xe1, 0x9f, 0x1e, 0x06, 0x9c, 0x44, 0xdc, 0xcf, + 0x42, 0x2a, 0x64, 0xc3, 0x5e, 0x43, 0xfe, 0x40, 0x5e, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x98, + 0x3c, 0x8c, 0x8c, 0xa7, 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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 { + // HTLC queries the HTLC by the specified hash lock + HTLC(ctx context.Context, in *QueryHTLCRequest, opts ...grpc.CallOption) (*QueryHTLCResponse, error) + // AssetSupply queries the supply of an asset + AssetSupply(ctx context.Context, in *QueryAssetSupplyRequest, opts ...grpc.CallOption) (*QueryAssetSupplyResponse, error) + // AssetSupplies queries the supplies of all assets + AssetSupplies(ctx context.Context, in *QueryAssetSuppliesRequest, opts ...grpc.CallOption) (*QueryAssetSuppliesResponse, error) + // Params queries the htlc parameters + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) HTLC(ctx context.Context, in *QueryHTLCRequest, opts ...grpc.CallOption) (*QueryHTLCResponse, error) { + out := new(QueryHTLCResponse) + err := c.cc.Invoke(ctx, "/irismod.htlc.Query/HTLC", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AssetSupply(ctx context.Context, in *QueryAssetSupplyRequest, opts ...grpc.CallOption) (*QueryAssetSupplyResponse, error) { + out := new(QueryAssetSupplyResponse) + err := c.cc.Invoke(ctx, "/irismod.htlc.Query/AssetSupply", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AssetSupplies(ctx context.Context, in *QueryAssetSuppliesRequest, opts ...grpc.CallOption) (*QueryAssetSuppliesResponse, error) { + out := new(QueryAssetSuppliesResponse) + err := c.cc.Invoke(ctx, "/irismod.htlc.Query/AssetSupplies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/irismod.htlc.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // HTLC queries the HTLC by the specified hash lock + HTLC(context.Context, *QueryHTLCRequest) (*QueryHTLCResponse, error) + // AssetSupply queries the supply of an asset + AssetSupply(context.Context, *QueryAssetSupplyRequest) (*QueryAssetSupplyResponse, error) + // AssetSupplies queries the supplies of all assets + AssetSupplies(context.Context, *QueryAssetSuppliesRequest) (*QueryAssetSuppliesResponse, error) + // Params queries the htlc parameters + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) HTLC(ctx context.Context, req *QueryHTLCRequest) (*QueryHTLCResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HTLC not implemented") +} +func (*UnimplementedQueryServer) AssetSupply(ctx context.Context, req *QueryAssetSupplyRequest) (*QueryAssetSupplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AssetSupply not implemented") +} +func (*UnimplementedQueryServer) AssetSupplies(ctx context.Context, req *QueryAssetSuppliesRequest) (*QueryAssetSuppliesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AssetSupplies not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_HTLC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHTLCRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HTLC(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.htlc.Query/HTLC", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HTLC(ctx, req.(*QueryHTLCRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AssetSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAssetSupplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AssetSupply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.htlc.Query/AssetSupply", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AssetSupply(ctx, req.(*QueryAssetSupplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AssetSupplies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAssetSuppliesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AssetSupplies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.htlc.Query/AssetSupplies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AssetSupplies(ctx, req.(*QueryAssetSuppliesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(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: "/irismod.htlc.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.htlc.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "HTLC", + Handler: _Query_HTLC_Handler, + }, + { + MethodName: "AssetSupply", + Handler: _Query_AssetSupply_Handler, + }, + { + MethodName: "AssetSupplies", + Handler: _Query_AssetSupplies_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "htlc/query.proto", +} + +func (m *QueryHTLCRequest) 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 *QueryHTLCRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHTLCRequest) 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 *QueryHTLCResponse) 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 *QueryHTLCResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHTLCResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Htlc != nil { + { + size, err := m.Htlc.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 *QueryAssetSupplyRequest) 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 *QueryAssetSupplyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAssetSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAssetSupplyResponse) 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 *QueryAssetSupplyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAssetSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AssetSupply != nil { + { + size, err := m.AssetSupply.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 *QueryAssetSuppliesRequest) 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 *QueryAssetSuppliesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAssetSuppliesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAssetSuppliesResponse) 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 *QueryAssetSuppliesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAssetSuppliesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AssetSupplies) > 0 { + for iNdEx := len(m.AssetSupplies) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AssetSupplies[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 *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 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 *QueryHTLCRequest) 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 *QueryHTLCResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Htlc != nil { + l = m.Htlc.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAssetSupplyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAssetSupplyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.AssetSupply != nil { + l = m.AssetSupply.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAssetSuppliesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAssetSuppliesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AssetSupplies) > 0 { + for _, e := range m.AssetSupplies { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +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 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 *QueryHTLCRequest) 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: QueryHTLCRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHTLCRequest: 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 *QueryHTLCResponse) 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: QueryHTLCResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHTLCResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Htlc", 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.Htlc == nil { + m.Htlc = &HTLC{} + } + if err := m.Htlc.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 *QueryAssetSupplyRequest) 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: QueryAssetSupplyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAssetSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryAssetSupplyResponse) 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: QueryAssetSupplyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAssetSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetSupply", 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.AssetSupply == nil { + m.AssetSupply = &AssetSupply{} + } + if err := m.AssetSupply.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 *QueryAssetSuppliesRequest) 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: QueryAssetSuppliesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAssetSuppliesRequest: 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 *QueryAssetSuppliesResponse) 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: QueryAssetSuppliesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAssetSuppliesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AssetSupplies", 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.AssetSupplies = append(m.AssetSupplies, AssetSupply{}) + if err := m.AssetSupplies[len(m.AssetSupplies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *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 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/module-sdk/htlc/tx.pb.go b/module-sdk/htlc/tx.pb.go new file mode 100644 index 00000000..01ce5c63 --- /dev/null +++ b/module-sdk/htlc/tx.pb.go @@ -0,0 +1,1358 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: htlc/tx.proto + +package htlc + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + 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 + +// MsgCreateHTLC defines a message to create an HTLC +type MsgCreateHTLC struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` + ReceiverOnOtherChain string `protobuf:"bytes,3,opt,name=receiver_on_other_chain,json=receiverOnOtherChain,proto3" json:"receiver_on_other_chain,omitempty" yaml:"receiver_on_other_chain"` + SenderOnOtherChain string `protobuf:"bytes,4,opt,name=sender_on_other_chain,json=senderOnOtherChain,proto3" json:"sender_on_other_chain,omitempty" yaml:"sender_on_other_chain"` + Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` + HashLock string `protobuf:"bytes,6,opt,name=hash_lock,json=hashLock,proto3" json:"hash_lock,omitempty" yaml:"hash_lock"` + Timestamp uint64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + TimeLock uint64 `protobuf:"varint,8,opt,name=time_lock,json=timeLock,proto3" json:"time_lock,omitempty" yaml:"time_lock"` + Transfer bool `protobuf:"varint,9,opt,name=transfer,proto3" json:"transfer,omitempty"` +} + +func (m *MsgCreateHTLC) Reset() { *m = MsgCreateHTLC{} } +func (m *MsgCreateHTLC) String() string { return proto.CompactTextString(m) } +func (*MsgCreateHTLC) ProtoMessage() {} +func (*MsgCreateHTLC) Descriptor() ([]byte, []int) { + return fileDescriptor_07729a8273c903af, []int{0} +} +func (m *MsgCreateHTLC) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateHTLC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateHTLC.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 *MsgCreateHTLC) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateHTLC.Merge(m, src) +} +func (m *MsgCreateHTLC) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateHTLC) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateHTLC.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateHTLC proto.InternalMessageInfo + +// MsgCreateHTLCResponse defines the Msg/CreateHTLC response type +type MsgCreateHTLCResponse struct { +} + +func (m *MsgCreateHTLCResponse) Reset() { *m = MsgCreateHTLCResponse{} } +func (m *MsgCreateHTLCResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateHTLCResponse) ProtoMessage() {} +func (*MsgCreateHTLCResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_07729a8273c903af, []int{1} +} +func (m *MsgCreateHTLCResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateHTLCResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateHTLCResponse.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 *MsgCreateHTLCResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateHTLCResponse.Merge(m, src) +} +func (m *MsgCreateHTLCResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateHTLCResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateHTLCResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateHTLCResponse proto.InternalMessageInfo + +// MsgClaimHTLC defines a message to claim an HTLC +type MsgClaimHTLC struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` + Secret string `protobuf:"bytes,3,opt,name=secret,proto3" json:"secret,omitempty"` +} + +func (m *MsgClaimHTLC) Reset() { *m = MsgClaimHTLC{} } +func (m *MsgClaimHTLC) String() string { return proto.CompactTextString(m) } +func (*MsgClaimHTLC) ProtoMessage() {} +func (*MsgClaimHTLC) Descriptor() ([]byte, []int) { + return fileDescriptor_07729a8273c903af, []int{2} +} +func (m *MsgClaimHTLC) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaimHTLC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaimHTLC.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 *MsgClaimHTLC) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimHTLC.Merge(m, src) +} +func (m *MsgClaimHTLC) XXX_Size() int { + return m.Size() +} +func (m *MsgClaimHTLC) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimHTLC.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaimHTLC proto.InternalMessageInfo + +// MsgClaimHTLCResponse defines the Msg/ClaimHTLC response type +type MsgClaimHTLCResponse struct { +} + +func (m *MsgClaimHTLCResponse) Reset() { *m = MsgClaimHTLCResponse{} } +func (m *MsgClaimHTLCResponse) String() string { return proto.CompactTextString(m) } +func (*MsgClaimHTLCResponse) ProtoMessage() {} +func (*MsgClaimHTLCResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_07729a8273c903af, []int{3} +} +func (m *MsgClaimHTLCResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClaimHTLCResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClaimHTLCResponse.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 *MsgClaimHTLCResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimHTLCResponse.Merge(m, src) +} +func (m *MsgClaimHTLCResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgClaimHTLCResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimHTLCResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClaimHTLCResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateHTLC)(nil), "irismod.htlc.MsgCreateHTLC") + proto.RegisterType((*MsgCreateHTLCResponse)(nil), "irismod.htlc.MsgCreateHTLCResponse") + proto.RegisterType((*MsgClaimHTLC)(nil), "irismod.htlc.MsgClaimHTLC") + proto.RegisterType((*MsgClaimHTLCResponse)(nil), "irismod.htlc.MsgClaimHTLCResponse") +} + +func init() { proto.RegisterFile("htlc/tx.proto", fileDescriptor_07729a8273c903af) } + +var fileDescriptor_07729a8273c903af = []byte{ + // 547 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x31, 0x8f, 0xd3, 0x4c, + 0x10, 0x8d, 0x93, 0x7c, 0xf9, 0xe2, 0xe5, 0x82, 0x90, 0x95, 0xbb, 0x33, 0xe6, 0xb0, 0xa3, 0xa5, + 0x49, 0x13, 0x5b, 0x39, 0x44, 0x73, 0x65, 0xd2, 0x20, 0x91, 0xe3, 0xa4, 0x85, 0x06, 0x9a, 0xc8, + 0xb1, 0x17, 0x7b, 0x95, 0xd8, 0x13, 0x79, 0x37, 0x27, 0xee, 0x5f, 0xf0, 0x13, 0x10, 0x25, 0xbf, + 0x24, 0xe5, 0x95, 0x54, 0x01, 0x92, 0x86, 0x3a, 0x0d, 0x2d, 0x5a, 0x6f, 0x9c, 0x4b, 0x80, 0x3b, + 0x2a, 0xcf, 0xbc, 0x37, 0xf3, 0x66, 0x3c, 0x7e, 0x46, 0x8d, 0x58, 0x4c, 0x02, 0x4f, 0xbc, 0x77, + 0xa7, 0x19, 0x08, 0x30, 0x0e, 0x58, 0xc6, 0x78, 0x02, 0xa1, 0x2b, 0x61, 0xcb, 0x0e, 0x80, 0x27, + 0xc0, 0xbd, 0x91, 0xcf, 0xa9, 0x77, 0xd9, 0x1d, 0x51, 0xe1, 0x77, 0xbd, 0x00, 0x58, 0xaa, 0xaa, + 0xad, 0x66, 0x04, 0x11, 0xe4, 0xa1, 0x27, 0x23, 0x85, 0xe2, 0x9f, 0x15, 0xd4, 0x38, 0xe7, 0x51, + 0x3f, 0xa3, 0xbe, 0xa0, 0xcf, 0x5f, 0x0f, 0xfa, 0xc6, 0x11, 0xaa, 0x71, 0x9a, 0x86, 0x34, 0x33, + 0xb5, 0x96, 0xd6, 0xd6, 0xc9, 0x26, 0x33, 0xee, 0xa3, 0xb2, 0x00, 0xb3, 0x9c, 0x63, 0x65, 0x01, + 0xc6, 0x1b, 0x74, 0x9c, 0xd1, 0x80, 0xb2, 0x4b, 0x9a, 0x0d, 0x21, 0x1d, 0x82, 0x88, 0x69, 0x36, + 0x0c, 0x62, 0x9f, 0xa5, 0x66, 0x45, 0x16, 0xf5, 0xf0, 0x7a, 0xe1, 0xd8, 0x57, 0x7e, 0x32, 0x39, + 0xc3, 0xb7, 0x14, 0x62, 0xd2, 0x2c, 0x98, 0x8b, 0xf4, 0x42, 0xe2, 0x7d, 0x09, 0x1b, 0xaf, 0xd0, + 0xa1, 0x1a, 0xfa, 0xbb, 0x70, 0x35, 0x17, 0x6e, 0xad, 0x17, 0xce, 0x89, 0x12, 0xfe, 0x6b, 0x19, + 0x26, 0x86, 0xc2, 0xf7, 0x44, 0x63, 0x54, 0xf3, 0x13, 0x98, 0xa5, 0xc2, 0xfc, 0xaf, 0x55, 0x69, + 0xdf, 0x3b, 0x7d, 0xe8, 0xaa, 0x83, 0xb9, 0xf2, 0x60, 0xee, 0xe6, 0x60, 0x6e, 0x1f, 0x58, 0xda, + 0x7b, 0x36, 0x5f, 0x38, 0xa5, 0xcf, 0x5f, 0x9d, 0x4e, 0xc4, 0x44, 0x3c, 0x1b, 0xb9, 0x01, 0x24, + 0x9e, 0xbc, 0x75, 0x4a, 0x45, 0xfe, 0x8c, 0x67, 0xa3, 0x0e, 0x0f, 0xc7, 0x9d, 0x08, 0x3c, 0x71, + 0x35, 0xa5, 0x3c, 0xef, 0xe2, 0x64, 0xa3, 0x6f, 0x74, 0x91, 0x1e, 0xfb, 0x3c, 0x1e, 0x4e, 0x20, + 0x18, 0x9b, 0xb5, 0x7c, 0xe5, 0xe6, 0x7a, 0xe1, 0x3c, 0x50, 0x2b, 0x6f, 0x29, 0x4c, 0xea, 0x32, + 0x1e, 0x40, 0x30, 0x36, 0x4e, 0x90, 0x2e, 0x58, 0x42, 0xb9, 0xf0, 0x93, 0xa9, 0xf9, 0x7f, 0x4b, + 0x6b, 0x57, 0xc9, 0x0d, 0x20, 0x05, 0x65, 0xa2, 0x04, 0xeb, 0x92, 0xdd, 0x15, 0xdc, 0x52, 0x98, + 0xd4, 0x65, 0x9c, 0x0b, 0x5a, 0xa8, 0x2e, 0x32, 0x3f, 0xe5, 0xef, 0x68, 0x66, 0xea, 0x2d, 0xad, + 0x5d, 0x27, 0xdb, 0xfc, 0xac, 0xfa, 0xe3, 0xa3, 0xa3, 0xe1, 0x63, 0x74, 0xb8, 0xf7, 0xe1, 0x09, + 0xe5, 0x53, 0x48, 0x39, 0xc5, 0x01, 0x3a, 0x90, 0xc4, 0xc4, 0x67, 0xc9, 0x9d, 0x86, 0x78, 0x8c, + 0xca, 0x2c, 0x54, 0x86, 0xe8, 0x35, 0xd6, 0x0b, 0x47, 0x57, 0xeb, 0xb0, 0x10, 0x93, 0x32, 0x0b, + 0x55, 0x5b, 0x90, 0x51, 0xa1, 0xec, 0x40, 0x36, 0xd9, 0x66, 0xfa, 0x11, 0x6a, 0xee, 0x0e, 0x29, + 0x86, 0x9f, 0x7e, 0xd2, 0x50, 0xe5, 0x9c, 0x47, 0xc6, 0x4b, 0x84, 0x76, 0x3c, 0xf9, 0xc8, 0xdd, + 0xb5, 0xba, 0xbb, 0xb7, 0xb7, 0xf5, 0xe4, 0x0e, 0xb2, 0xd0, 0x35, 0x5e, 0x20, 0xfd, 0xe6, 0x8d, + 0xac, 0x3f, 0x3b, 0x0a, 0xce, 0xc2, 0xb7, 0x73, 0x85, 0x58, 0x6f, 0x30, 0xff, 0x6e, 0x97, 0xe6, + 0x4b, 0x5b, 0xbb, 0x5e, 0xda, 0xda, 0xb7, 0xa5, 0xad, 0x7d, 0x58, 0xd9, 0xa5, 0xeb, 0x95, 0x5d, + 0xfa, 0xb2, 0xb2, 0x4b, 0x6f, 0xdd, 0x7f, 0xbb, 0x26, 0x81, 0x70, 0x36, 0xa1, 0xdc, 0x93, 0x23, + 0x46, 0xb5, 0xfc, 0x4f, 0x7c, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x41, 0xc1, 0x22, 0x85, 0xde, + 0x03, 0x00, 0x00, +} + +func (this *MsgCreateHTLC) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgCreateHTLC) + if !ok { + that2, ok := that.(MsgCreateHTLC) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Sender != that1.Sender { + return false + } + if this.To != that1.To { + return false + } + if this.ReceiverOnOtherChain != that1.ReceiverOnOtherChain { + return false + } + if this.SenderOnOtherChain != that1.SenderOnOtherChain { + return false + } + if len(this.Amount) != len(that1.Amount) { + return false + } + for i := range this.Amount { + if !this.Amount[i].Equal(&that1.Amount[i]) { + return false + } + } + if this.HashLock != that1.HashLock { + return false + } + if this.Timestamp != that1.Timestamp { + return false + } + if this.TimeLock != that1.TimeLock { + return false + } + if this.Transfer != that1.Transfer { + return false + } + return true +} +func (this *MsgClaimHTLC) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgClaimHTLC) + if !ok { + that2, ok := that.(MsgClaimHTLC) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Sender != that1.Sender { + return false + } + if this.Id != that1.Id { + return false + } + if this.Secret != that1.Secret { + return false + } + return true +} + +// 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 { + // CreateHTLC defines a method for creating a HTLC + CreateHTLC(ctx context.Context, in *MsgCreateHTLC, opts ...grpc.CallOption) (*MsgCreateHTLCResponse, error) + // ClaimHTLC defines a method for claiming a HTLC + ClaimHTLC(ctx context.Context, in *MsgClaimHTLC, opts ...grpc.CallOption) (*MsgClaimHTLCResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateHTLC(ctx context.Context, in *MsgCreateHTLC, opts ...grpc.CallOption) (*MsgCreateHTLCResponse, error) { + out := new(MsgCreateHTLCResponse) + err := c.cc.Invoke(ctx, "/irismod.htlc.Msg/CreateHTLC", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ClaimHTLC(ctx context.Context, in *MsgClaimHTLC, opts ...grpc.CallOption) (*MsgClaimHTLCResponse, error) { + out := new(MsgClaimHTLCResponse) + err := c.cc.Invoke(ctx, "/irismod.htlc.Msg/ClaimHTLC", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateHTLC defines a method for creating a HTLC + CreateHTLC(context.Context, *MsgCreateHTLC) (*MsgCreateHTLCResponse, error) + // ClaimHTLC defines a method for claiming a HTLC + ClaimHTLC(context.Context, *MsgClaimHTLC) (*MsgClaimHTLCResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateHTLC(ctx context.Context, req *MsgCreateHTLC) (*MsgCreateHTLCResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateHTLC not implemented") +} +func (*UnimplementedMsgServer) ClaimHTLC(ctx context.Context, req *MsgClaimHTLC) (*MsgClaimHTLCResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClaimHTLC not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateHTLC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateHTLC) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateHTLC(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.htlc.Msg/CreateHTLC", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateHTLC(ctx, req.(*MsgCreateHTLC)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ClaimHTLC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClaimHTLC) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ClaimHTLC(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.htlc.Msg/ClaimHTLC", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ClaimHTLC(ctx, req.(*MsgClaimHTLC)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.htlc.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateHTLC", + Handler: _Msg_CreateHTLC_Handler, + }, + { + MethodName: "ClaimHTLC", + Handler: _Msg_ClaimHTLC_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "htlc/tx.proto", +} + +func (m *MsgCreateHTLC) 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 *MsgCreateHTLC) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateHTLC) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Transfer { + i-- + if m.Transfer { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if m.TimeLock != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TimeLock)) + i-- + dAtA[i] = 0x40 + } + if m.Timestamp != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Timestamp)) + i-- + dAtA[i] = 0x38 + } + if len(m.HashLock) > 0 { + i -= len(m.HashLock) + copy(dAtA[i:], m.HashLock) + i = encodeVarintTx(dAtA, i, uint64(len(m.HashLock))) + i-- + dAtA[i] = 0x32 + } + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.SenderOnOtherChain) > 0 { + i -= len(m.SenderOnOtherChain) + copy(dAtA[i:], m.SenderOnOtherChain) + i = encodeVarintTx(dAtA, i, uint64(len(m.SenderOnOtherChain))) + i-- + dAtA[i] = 0x22 + } + if len(m.ReceiverOnOtherChain) > 0 { + i -= len(m.ReceiverOnOtherChain) + copy(dAtA[i:], m.ReceiverOnOtherChain) + i = encodeVarintTx(dAtA, i, uint64(len(m.ReceiverOnOtherChain))) + i-- + dAtA[i] = 0x1a + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTx(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateHTLCResponse) 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 *MsgCreateHTLCResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateHTLCResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgClaimHTLC) 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 *MsgClaimHTLC) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaimHTLC) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Secret) > 0 { + i -= len(m.Secret) + copy(dAtA[i:], m.Secret) + i = encodeVarintTx(dAtA, i, uint64(len(m.Secret))) + i-- + dAtA[i] = 0x1a + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgClaimHTLCResponse) 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 *MsgClaimHTLCResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClaimHTLCResponse) 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 *MsgCreateHTLC) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ReceiverOnOtherChain) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.SenderOnOtherChain) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.HashLock) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Timestamp != 0 { + n += 1 + sovTx(uint64(m.Timestamp)) + } + if m.TimeLock != 0 { + n += 1 + sovTx(uint64(m.TimeLock)) + } + if m.Transfer { + n += 2 + } + return n +} + +func (m *MsgCreateHTLCResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgClaimHTLC) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Secret) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgClaimHTLCResponse) 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 *MsgCreateHTLC) 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: MsgCreateHTLC: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateHTLC: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReceiverOnOtherChain", 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.ReceiverOnOtherChain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SenderOnOtherChain", 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.SenderOnOtherChain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HashLock", 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.HashLock = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + m.Timestamp = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timestamp |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeLock", wireType) + } + m.TimeLock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeLock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Transfer", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Transfer = bool(v != 0) + 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 *MsgCreateHTLCResponse) 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: MsgCreateHTLCResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateHTLCResponse: 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 *MsgClaimHTLC) 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: MsgClaimHTLC: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaimHTLC: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Secret", 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.Secret = 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 *MsgClaimHTLCResponse) 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: MsgClaimHTLCResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClaimHTLCResponse: 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/module-sdk/htlc/types.go b/module-sdk/htlc/types.go new file mode 100644 index 00000000..7bb895ee --- /dev/null +++ b/module-sdk/htlc/types.go @@ -0,0 +1,140 @@ +package htlc + +import ( + "encoding/hex" + sdk "github.com/irisnet/core-sdk-go/types" +) + +const ( + ModuleName = "htlc" + + SecretLength = 64 // length for the secret in bytes + HashLockLength = 64 // length for the hash lock in bytes + HTLCIDLength = 64 // HTLCIDLength is the length for the hash lock in hex string + MaxLengthForAddressOnOtherChain = 128 // maximum length for the address on other chains + MinTimeLock = 50 // minimum time span for HTLC + MaxTimeLock = 25480 // maximum time span for HTLC +) + +var ( + _ sdk.Msg = &MsgCreateHTLC{} + _ sdk.Msg = &MsgClaimHTLC{} +) + +func (msg MsgCreateHTLC) Route() string { return ModuleName } + +func (msg MsgCreateHTLC) Type() string { return "create_htlc" } + +func (msg MsgCreateHTLC) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { + return sdk.Wrapf("invalid sender address (%s)", err) + } + if len(msg.To) == 0 { + return sdk.Wrapf("recipient missing") + } + if len(msg.ReceiverOnOtherChain) > MaxLengthForAddressOnOtherChain { + return sdk.Wrapf("length of the receiver on other chain must be between [0,%d]", MaxLengthForAddressOnOtherChain) + } + if !msg.Amount.IsValid() || !msg.Amount.IsAllPositive() { + return sdk.Wrapf("the transferred amount must be valid") + } + if _, err := hex.DecodeString(msg.HashLock); err != nil { + return sdk.Wrapf("hash lock must be a hex encoded string") + } + if len(msg.HashLock) != HashLockLength { + return sdk.Wrapf("length of the hash lock must be %d in bytes", HashLockLength) + } + if msg.TimeLock < MinTimeLock || msg.TimeLock > MaxTimeLock { + return sdk.Wrapf("the time lock must be between [%d,%d]", MinTimeLock, MaxTimeLock) + } + return nil +} + +func (msg MsgCreateHTLC) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgCreateHTLC) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{from} +} + +func (msg MsgClaimHTLC) Route() string { return ModuleName } + +func (msg MsgClaimHTLC) Type() string { return "claim_htlc" } + +func (msg MsgClaimHTLC) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { + return sdk.Wrapf("invalid sender address (%s)", err) + } + if _, err := hex.DecodeString(msg.Id); err != nil { + return sdk.Wrapf("htlc id must be a hex encoded string") + } + if len(msg.Id) != HTLCIDLength { + return sdk.Wrapf("length of the htlc id must be %d in bytes", HashLockLength) + } + if _, err := hex.DecodeString(msg.Secret); err != nil { + return sdk.Wrapf("secret must be a hex encoded string") + } + if len(msg.Secret) != SecretLength { + return sdk.Wrapf("length of the secret must be %d in bytes", SecretLength) + } + return nil +} + +func (msg MsgClaimHTLC) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgClaimHTLC) GetSigners() []sdk.AccAddress { + from, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{from} +} + +func (h HTLC) Convert() interface{} { + return QueryHTLCResp{ + Sender: h.Sender, + To: h.To, + ReceiverOnOtherChain: h.ReceiverOnOtherChain, + SenderOnOtherChain: h.SenderOnOtherChain, + Amount: h.Amount, + Secret: h.Secret, + Timestamp: h.Timestamp, + ExpirationHeight: h.ExpirationHeight, + State: int32(h.State), + Transfer: h.Transfer, + } +} + +func (h Params) Convert() interface{} { + var params []AssetParamDto + for _, val := range h.AssetParams { + params = append(params, AssetParamDto{ + Denom: val.Denom, + Active: val.Active, + DeputyAddress: val.DeputyAddress, + FixedFee: val.FixedFee.Uint64(), + MinSwapAmount: val.MinSwapAmount.Uint64(), + MinBlockLock: val.MinBlockLock, + MaxSwapAmount: val.MaxSwapAmount.Uint64(), + MaxBlockLock: val.MaxBlockLock, + SupplyLimit: SupplyLimitDto{ + Limit: val.SupplyLimit.Limit.Uint64(), + TimeLimited: val.SupplyLimit.TimeLimited, + TimePeriod: int64(val.SupplyLimit.TimePeriod), + TimeBasedLimit: val.SupplyLimit.TimeBasedLimit.Uint64(), + }, + }) + } + return QueryParamsResp{ + AssetParams: params, + } +} diff --git a/module-sdk/keys/doc.go b/module-sdk/keys/doc.go new file mode 100644 index 00000000..1ce83fdf --- /dev/null +++ b/module-sdk/keys/doc.go @@ -0,0 +1,17 @@ +// Package keys allows you to manage your local tendermint keystore (wallets) for iris. +// +// **NOTE:** You need to implement the [[KeyDAO]] Interface first. +// +// As a quick start: +// +// CreateRecord a new key. +// +// client := test.NewClient() +// name, password := "test2", "1234567890" +// +// address, mnemonic, err := client.KeyI.Add(name, password) +// require.NoError(client.T(), err) +// require.NotEmpty(client.T(), address) +// require.NotEmpty(client.T(), mnemonic) +// +package keys diff --git a/module-sdk/keys/export.go b/module-sdk/keys/export.go new file mode 100644 index 00000000..5e6c7e61 --- /dev/null +++ b/module-sdk/keys/export.go @@ -0,0 +1,15 @@ +package keys + +import ( + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +type Client interface { + Add(name, password string) (address string, mnemonic string, err sdk.Error) + Recover(name, password, mnemonic string) (address string, err sdk.Error) + RecoverWithHDPath(name, password, mnemonic, hdPath string) (address string, err sdk.Error) + Import(name, password, privKeyArmor string) (address string, err sdk.Error) + Export(name, password string) (privKeyArmor string, err sdk.Error) + Delete(name, password string) sdk.Error + Show(name, password string) (string, sdk.Error) +} diff --git a/module-sdk/keys/keys.go b/module-sdk/keys/keys.go new file mode 100644 index 00000000..8fae3719 --- /dev/null +++ b/module-sdk/keys/keys.go @@ -0,0 +1,51 @@ +package keys + +import ( + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +type keysClient struct { + sdk.KeyManager +} + +func NewClient(keyManager sdk.KeyManager) Client { + return keysClient{keyManager} +} + +func (k keysClient) Add(name, password string) (string, string, sdk.Error) { + address, mnemonic, err := k.Insert(name, password) + return address, mnemonic, sdk.Wrap(err) +} + +func (k keysClient) Recover(name, password, mnemonic string) (string, sdk.Error) { + address, err := k.KeyManager.Recover(name, password, mnemonic, "") + return address, sdk.Wrap(err) +} + +func (k keysClient) RecoverWithHDPath(name, password, mnemonic, hdPath string) (string, sdk.Error) { + address, err := k.KeyManager.Recover(name, password, mnemonic, hdPath) + return address, sdk.Wrap(err) +} + +func (k keysClient) Import(name, password, privKeyArmor string) (string, sdk.Error) { + address, err := k.KeyManager.Import(name, password, privKeyArmor) + return address, sdk.Wrap(err) +} + +func (k keysClient) Export(name, password string) (string, sdk.Error) { + keystore, err := k.KeyManager.Export(name, password) + return keystore, sdk.Wrap(err) +} + +func (k keysClient) Delete(name, password string) sdk.Error { + err := k.KeyManager.Delete(name, password) + return sdk.Wrap(err) +} + +func (k keysClient) Show(name, password string) (string, sdk.Error) { + _, address, err := k.KeyManager.Find(name, password) + if err != nil { + return "", sdk.Wrap(err) + } + return address.String(), nil +} diff --git a/module-sdk/nft/codec.go b/module-sdk/nft/codec.go new file mode 100644 index 00000000..3c847453 --- /dev/null +++ b/module-sdk/nft/codec.go @@ -0,0 +1,29 @@ +package nft + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgIssueDenom{}, + &MsgMintNFT{}, + &MsgEditNFT{}, + &MsgTransferNFT{}, + &MsgBurnNFT{}, + ) +} diff --git a/module-sdk/nft/export.go b/module-sdk/nft/export.go new file mode 100644 index 00000000..1abc4c92 --- /dev/null +++ b/module-sdk/nft/export.go @@ -0,0 +1,90 @@ +package nft + +import sdk "github.com/irisnet/core-sdk-go/types" + +// expose NFT module api for user +type Client interface { + sdk.Module + + IssueDenom(request IssueDenomRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + MintNFT(request MintNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + EditNFT(request EditNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + TransferNFT(request TransferNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + BurnNFT(request BurnNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + + QuerySupply(denomID, creator string) (uint64, sdk.Error) + QueryOwner(creator, denomID string) (QueryOwnerResp, sdk.Error) + QueryCollection(denomID string) (QueryCollectionResp, sdk.Error) + QueryDenom(denomID string) (QueryDenomResp, sdk.Error) + QueryDenoms() ([]QueryDenomResp, sdk.Error) + QueryNFT(denomID, tokenID string) (QueryNFTResp, sdk.Error) +} + +type IssueDenomRequest struct { + ID string `json:"id"` + Name string `json:"name"` + Schema string `json:"schema"` +} + +type MintNFTRequest struct { + Denom string `json:"denom"` + ID string `json:"id"` + Name string `json:"name"` + URI string `json:"uri"` + Data string `json:"data"` + Recipient string `json:"recipient"` +} + +type EditNFTRequest struct { + Denom string `json:"denom"` + ID string `json:"id"` + Name string `json:"name"` + URI string `json:"uri"` + Data string `json:"data"` +} + +type TransferNFTRequest struct { + Denom string `json:"denom"` + ID string `json:"id"` + URI string `json:"uri"` + Data string `json:"data"` + Name string `json:"name"` + Recipient string `json:"recipient"` +} + +type BurnNFTRequest struct { + Denom string `json:"denom"` + ID string `json:"id"` +} + +// IDC defines a set of nft ids that belong to a specific +type IDC struct { + Denom string `json:"denom" yaml:"denom"` + TokenIDs []string `json:"token_ids" yaml:"token_ids"` +} + +type QueryOwnerResp struct { + Address string `json:"address" yaml:"address"` + IDCs []IDC `json:"idcs" yaml:"idcs"` +} + +// BaseNFT non fungible token definition +type QueryNFTResp struct { + ID string `json:"id"` + Name string `json:"name"` + URI string `json:"uri"` + Data string `json:"data"` + Creator string `json:"creator"` +} + +type QueryDenomResp struct { + ID string `json:"id"` + Name string `json:"name"` + Schema string `json:"schema"` + Creator string `json:"creator"` +} + +type QueryCollectionResp struct { + Denom QueryDenomResp `json:"denom" yaml:"denom"` + NFTs []QueryNFTResp `json:"nfts" yaml:"nfts"` +} diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod new file mode 100644 index 00000000..476e77c2 --- /dev/null +++ b/module-sdk/nft/go.mod @@ -0,0 +1,13 @@ +module nft + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/nft/nft.go b/module-sdk/nft/nft.go new file mode 100644 index 00000000..523fb77c --- /dev/null +++ b/module-sdk/nft/nft.go @@ -0,0 +1,267 @@ +package nft + +import ( + "context" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" +) + +type nftClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { + return nftClient{ + BaseClient: bc, + Marshaler: cdc, + } +} + +func (nc nftClient) Name() string { + return ModuleName +} + +func (nc nftClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (nc nftClient) IssueDenom(request IssueDenomRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgIssueDenom{ + Id: request.ID, + Name: request.Name, + Schema: request.Schema, + Sender: sender.String(), + } + return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (nc nftClient) MintNFT(request MintNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + var recipient = sender.String() + if len(request.Recipient) > 0 { + if err := sdk.ValidateAccAddress(request.Recipient); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + recipient = request.Recipient + } + + msg := &MsgMintNFT{ + Id: request.ID, + DenomId: request.Denom, + Name: request.Name, + URI: request.URI, + Data: request.Data, + Sender: sender.String(), + Recipient: recipient, + } + return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (nc nftClient) EditNFT(request EditNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgEditNFT{ + Id: request.ID, + Name: request.Name, + DenomId: request.Denom, + URI: request.URI, + Data: request.Data, + Sender: sender.String(), + } + return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (nc nftClient) TransferNFT(request TransferNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + if err := sdk.ValidateAccAddress(request.Recipient); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgTransferNFT{ + Id: request.ID, + Name: request.Name, + DenomId: request.Denom, + URI: request.URI, + Data: request.Data, + Sender: sender.String(), + Recipient: request.Recipient, + } + return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (nc nftClient) BurnNFT(request BurnNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgBurnNFT{ + Sender: sender.String(), + Id: request.ID, + DenomId: request.Denom, + } + return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (nc nftClient) QuerySupply(denom, creator string) (uint64, sdk.Error) { + if len(denom) == 0 { + return 0, sdk.Wrapf("denom is required") + } + + if err := sdk.ValidateAccAddress(creator); err != nil { + return 0, sdk.Wrap(err) + } + + conn, err := nc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return 0, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Supply( + context.Background(), + &QuerySupplyRequest{ + Owner: creator, + DenomId: denom, + }, + ) + if err != nil { + return 0, sdk.Wrap(err) + } + + return res.Amount, nil +} + +func (nc nftClient) QueryOwner(creator, denom string) (QueryOwnerResp, sdk.Error) { + if len(denom) == 0 { + return QueryOwnerResp{}, sdk.Wrapf("denom is required") + } + + if err := sdk.ValidateAccAddress(creator); err != nil { + return QueryOwnerResp{}, sdk.Wrap(err) + } + + conn, err := nc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryOwnerResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Owner( + context.Background(), + &QueryOwnerRequest{ + Owner: creator, + DenomId: denom, + }, + ) + if err != nil { + return QueryOwnerResp{}, sdk.Wrap(err) + } + + return res.Owner.Convert().(QueryOwnerResp), nil +} + +func (nc nftClient) QueryCollection(denom string) (QueryCollectionResp, sdk.Error) { + if len(denom) == 0 { + return QueryCollectionResp{}, sdk.Wrapf("denom is required") + } + + conn, err := nc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryCollectionResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Collection( + context.Background(), + &QueryCollectionRequest{DenomId: denom}, + ) + if err != nil { + return QueryCollectionResp{}, sdk.Wrap(err) + } + + return res.Collection.Convert().(QueryCollectionResp), nil +} + +func (nc nftClient) QueryDenoms() ([]QueryDenomResp, sdk.Error) { + conn, err := nc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Denoms( + context.Background(), + &QueryDenomsRequest{}, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + + return denoms(res.Denoms).Convert().([]QueryDenomResp), nil +} + +func (nc nftClient) QueryDenom(denom string) (QueryDenomResp, sdk.Error) { + conn, err := nc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryDenomResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Denom( + context.Background(), + &QueryDenomRequest{DenomId: denom}, + ) + if err != nil { + return QueryDenomResp{}, sdk.Wrap(err) + } + + return res.Denom.Convert().(QueryDenomResp), nil +} + +func (nc nftClient) QueryNFT(denom, tokenID string) (QueryNFTResp, sdk.Error) { + if len(denom) == 0 { + return QueryNFTResp{}, sdk.Wrapf("denom is required") + } + + if len(tokenID) == 0 { + return QueryNFTResp{}, sdk.Wrapf("tokenID is required") + } + + conn, err := nc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryNFTResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).NFT( + context.Background(), + &QueryNFTRequest{ + DenomId: denom, + TokenId: tokenID, + }, + ) + if err != nil { + return QueryNFTResp{}, sdk.Wrap(err) + } + + return res.NFT.Convert().(QueryNFTResp), nil +} diff --git a/module-sdk/nft/nft.pb.go b/module-sdk/nft/nft.pb.go new file mode 100644 index 00000000..7ee31434 --- /dev/null +++ b/module-sdk/nft/nft.pb.go @@ -0,0 +1,1615 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nft/nft.proto + +package nft + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +// BaseNFT defines a non fungible token. +type BaseNFT struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + URI string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"` + Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *BaseNFT) Reset() { *m = BaseNFT{} } +func (m *BaseNFT) String() string { return proto.CompactTextString(m) } +func (*BaseNFT) ProtoMessage() {} +func (*BaseNFT) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{0} +} +func (m *BaseNFT) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BaseNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BaseNFT.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 *BaseNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_BaseNFT.Merge(m, src) +} +func (m *BaseNFT) XXX_Size() int { + return m.Size() +} +func (m *BaseNFT) XXX_DiscardUnknown() { + xxx_messageInfo_BaseNFT.DiscardUnknown(m) +} + +var xxx_messageInfo_BaseNFT proto.InternalMessageInfo + +// Denom defines a type of NFT. +type Denom struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Schema string `protobuf:"bytes,3,opt,name=schema,proto3" json:"schema,omitempty"` + Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *Denom) Reset() { *m = Denom{} } +func (m *Denom) String() string { return proto.CompactTextString(m) } +func (*Denom) ProtoMessage() {} +func (*Denom) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{1} +} +func (m *Denom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Denom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Denom.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 *Denom) XXX_Merge(src proto.Message) { + xxx_messageInfo_Denom.Merge(m, src) +} +func (m *Denom) XXX_Size() int { + return m.Size() +} +func (m *Denom) XXX_DiscardUnknown() { + xxx_messageInfo_Denom.DiscardUnknown(m) +} + +var xxx_messageInfo_Denom proto.InternalMessageInfo + +type IDCollection struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + TokenIds []string `protobuf:"bytes,2,rep,name=token_ids,json=tokenIds,proto3" json:"token_ids,omitempty" yaml:"token_ids"` +} + +func (m *IDCollection) Reset() { *m = IDCollection{} } +func (m *IDCollection) String() string { return proto.CompactTextString(m) } +func (*IDCollection) ProtoMessage() {} +func (*IDCollection) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{2} +} +func (m *IDCollection) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IDCollection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IDCollection.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 *IDCollection) XXX_Merge(src proto.Message) { + xxx_messageInfo_IDCollection.Merge(m, src) +} +func (m *IDCollection) XXX_Size() int { + return m.Size() +} +func (m *IDCollection) XXX_DiscardUnknown() { + xxx_messageInfo_IDCollection.DiscardUnknown(m) +} + +var xxx_messageInfo_IDCollection proto.InternalMessageInfo + +type Owner struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + IDCollections []IDCollection `protobuf:"bytes,2,rep,name=id_collections,json=idCollections,proto3" json:"id_collections" yaml:"idcs"` +} + +func (m *Owner) Reset() { *m = Owner{} } +func (m *Owner) String() string { return proto.CompactTextString(m) } +func (*Owner) ProtoMessage() {} +func (*Owner) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{3} +} +func (m *Owner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Owner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Owner.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 *Owner) XXX_Merge(src proto.Message) { + xxx_messageInfo_Owner.Merge(m, src) +} +func (m *Owner) XXX_Size() int { + return m.Size() +} +func (m *Owner) XXX_DiscardUnknown() { + xxx_messageInfo_Owner.DiscardUnknown(m) +} + +var xxx_messageInfo_Owner proto.InternalMessageInfo + +type Collection struct { + Denom Denom `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom"` + NFTs []BaseNFT `protobuf:"bytes,2,rep,name=nfts,proto3" json:"nfts"` +} + +func (m *Collection) Reset() { *m = Collection{} } +func (m *Collection) String() string { return proto.CompactTextString(m) } +func (*Collection) ProtoMessage() {} +func (*Collection) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{4} +} +func (m *Collection) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Collection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Collection.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 *Collection) XXX_Merge(src proto.Message) { + xxx_messageInfo_Collection.Merge(m, src) +} +func (m *Collection) XXX_Size() int { + return m.Size() +} +func (m *Collection) XXX_DiscardUnknown() { + xxx_messageInfo_Collection.DiscardUnknown(m) +} + +var xxx_messageInfo_Collection proto.InternalMessageInfo + +func init() { + proto.RegisterType((*BaseNFT)(nil), "irismod.nft.BaseNFT") + proto.RegisterType((*Denom)(nil), "irismod.nft.Denom") + proto.RegisterType((*IDCollection)(nil), "irismod.nft.IDCollection") + proto.RegisterType((*Owner)(nil), "irismod.nft.Owner") + proto.RegisterType((*Collection)(nil), "irismod.nft.Collection") +} + +func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } + +var fileDescriptor_fe8ab7e15b7f0646 = []byte{ + // 472 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6e, 0xd3, 0x30, + 0x18, 0xc7, 0x93, 0x36, 0x59, 0x57, 0x77, 0x1d, 0xc8, 0x54, 0x28, 0xe3, 0x90, 0x4c, 0x11, 0x87, + 0x5d, 0x9a, 0x8a, 0x21, 0x71, 0xd8, 0x31, 0x4c, 0x93, 0x2a, 0xa4, 0x21, 0x59, 0xe3, 0xc2, 0xa5, + 0x4a, 0x63, 0xa7, 0xb5, 0xd6, 0xd8, 0x28, 0x76, 0x35, 0xe0, 0x25, 0xe0, 0x11, 0x78, 0x9c, 0x1e, + 0x77, 0xe4, 0x14, 0x41, 0x7a, 0xe1, 0xdc, 0x27, 0x40, 0xb6, 0x93, 0x2a, 0xbd, 0xed, 0x94, 0xef, + 0xfb, 0xfb, 0x9f, 0xfc, 0xfe, 0x5f, 0xfc, 0x81, 0x21, 0xcb, 0xe4, 0x84, 0x65, 0x32, 0xfa, 0x52, + 0x70, 0xc9, 0xe1, 0x80, 0x16, 0x54, 0xe4, 0x1c, 0x47, 0x2c, 0x93, 0xaf, 0x46, 0x0b, 0xbe, 0xe0, + 0x5a, 0x9f, 0xa8, 0xca, 0x58, 0xc2, 0xaf, 0xa0, 0x17, 0x27, 0x82, 0xdc, 0xde, 0xdc, 0xc1, 0x53, + 0xd0, 0xa1, 0xd8, 0xb3, 0xcf, 0xed, 0x8b, 0x3e, 0xea, 0x50, 0x0c, 0x21, 0x70, 0x58, 0x92, 0x13, + 0xaf, 0xa3, 0x15, 0x5d, 0xc3, 0x33, 0xd0, 0x5d, 0x17, 0xd4, 0xeb, 0x2a, 0x29, 0xee, 0x55, 0x65, + 0xd0, 0xfd, 0x84, 0xa6, 0x48, 0x69, 0xca, 0x8e, 0x13, 0x99, 0x78, 0x8e, 0xb1, 0xab, 0x1a, 0x8e, + 0x80, 0xcb, 0x1f, 0x18, 0x29, 0x3c, 0x57, 0x8b, 0xa6, 0xb9, 0x72, 0xfe, 0xfd, 0x0a, 0xec, 0x30, + 0x05, 0xee, 0x35, 0x61, 0x3c, 0x7f, 0x12, 0xf7, 0x25, 0x38, 0x12, 0xe9, 0x92, 0xe4, 0x89, 0x41, + 0xa3, 0xba, 0x83, 0x1e, 0xe8, 0xa5, 0x05, 0x49, 0x24, 0x2f, 0x6a, 0x6e, 0xd3, 0xd6, 0x90, 0x07, + 0x70, 0x32, 0xbd, 0x7e, 0xcf, 0x57, 0x2b, 0x92, 0x4a, 0xca, 0x19, 0x8c, 0xc0, 0x31, 0x56, 0xd0, + 0x59, 0x43, 0x8c, 0x5f, 0xec, 0xca, 0xe0, 0xd9, 0xb7, 0x24, 0x5f, 0x5d, 0x85, 0xcd, 0x49, 0x88, + 0x7a, 0xba, 0x9c, 0x62, 0xf8, 0x06, 0xf4, 0x25, 0xbf, 0x27, 0x6c, 0x46, 0xb1, 0xf0, 0x3a, 0xe7, + 0xdd, 0x8b, 0x7e, 0x3c, 0xda, 0x95, 0xc1, 0x73, 0xf3, 0xc2, 0xfe, 0x28, 0x44, 0xc7, 0xba, 0x9e, + 0x62, 0x51, 0x83, 0x7f, 0xd8, 0xc0, 0xfd, 0xa8, 0xa6, 0x55, 0x11, 0x13, 0x8c, 0x0b, 0x22, 0x44, + 0x3d, 0x63, 0xd3, 0xc2, 0x0c, 0x9c, 0x52, 0x3c, 0x4b, 0xf7, 0xe9, 0x0c, 0x61, 0x70, 0x79, 0x16, + 0xb5, 0xee, 0x2d, 0x6a, 0xe7, 0x8f, 0x5f, 0x6f, 0xca, 0xc0, 0xaa, 0xca, 0x60, 0xd8, 0x56, 0xc5, + 0xae, 0x0c, 0x06, 0x26, 0x11, 0xc5, 0xa9, 0x08, 0xd1, 0x90, 0xe2, 0xd6, 0x69, 0x9d, 0xe8, 0x3b, + 0x00, 0x07, 0x3f, 0xc2, 0xd5, 0x33, 0xea, 0x4c, 0x83, 0x4b, 0x78, 0x80, 0xd4, 0xf7, 0x12, 0x3b, + 0x8a, 0x85, 0x8c, 0x0d, 0xbe, 0x03, 0x0e, 0xcb, 0x64, 0x93, 0x70, 0x74, 0x60, 0xaf, 0x17, 0x28, + 0x3e, 0xa9, 0xc3, 0x39, 0xb7, 0x37, 0x77, 0x02, 0x69, 0xbf, 0x61, 0xc7, 0x1f, 0x36, 0x7f, 0x7d, + 0x6b, 0x53, 0xf9, 0xf6, 0x63, 0xe5, 0xdb, 0x7f, 0x2a, 0xdf, 0xfe, 0xb9, 0xf5, 0xad, 0xc7, 0xad, + 0x6f, 0xfd, 0xde, 0xfa, 0xd6, 0xe7, 0xf1, 0x82, 0xca, 0xe5, 0x7a, 0x1e, 0xa5, 0x3c, 0x9f, 0xa8, + 0xef, 0x32, 0x22, 0xf5, 0x73, 0xb9, 0x9e, 0x8f, 0x05, 0xbe, 0x1f, 0x2f, 0xf8, 0x24, 0xe7, 0x78, + 0xbd, 0x22, 0x42, 0xed, 0xf6, 0xfc, 0x48, 0x6f, 0xee, 0xdb, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x67, 0xaa, 0x4a, 0x2a, 0xed, 0x02, 0x00, 0x00, +} + +func (this *BaseNFT) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BaseNFT) + if !ok { + that2, ok := that.(BaseNFT) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Name != that1.Name { + return false + } + if this.URI != that1.URI { + return false + } + if this.Data != that1.Data { + return false + } + if this.Owner != that1.Owner { + return false + } + return true +} +func (this *Denom) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Denom) + if !ok { + that2, ok := that.(Denom) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Name != that1.Name { + return false + } + if this.Schema != that1.Schema { + return false + } + if this.Creator != that1.Creator { + return false + } + return true +} +func (this *IDCollection) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*IDCollection) + if !ok { + that2, ok := that.(IDCollection) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.DenomId != that1.DenomId { + return false + } + if len(this.TokenIds) != len(that1.TokenIds) { + return false + } + for i := range this.TokenIds { + if this.TokenIds[i] != that1.TokenIds[i] { + return false + } + } + return true +} +func (this *Owner) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Owner) + if !ok { + that2, ok := that.(Owner) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Address != that1.Address { + return false + } + if len(this.IDCollections) != len(that1.IDCollections) { + return false + } + for i := range this.IDCollections { + if !this.IDCollections[i].Equal(&that1.IDCollections[i]) { + return false + } + } + return true +} +func (this *Collection) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Collection) + if !ok { + that2, ok := that.(Collection) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Denom.Equal(&that1.Denom) { + return false + } + if len(this.NFTs) != len(that1.NFTs) { + return false + } + for i := range this.NFTs { + if !this.NFTs[i].Equal(&that1.NFTs[i]) { + return false + } + } + return true +} +func (m *BaseNFT) 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 *BaseNFT) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BaseNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintNft(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x2a + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintNft(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x22 + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintNft(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintNft(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintNft(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Denom) 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 *Denom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintNft(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x22 + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarintNft(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintNft(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintNft(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IDCollection) 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 *IDCollection) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IDCollection) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenIds) > 0 { + for iNdEx := len(m.TokenIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.TokenIds[iNdEx]) + copy(dAtA[i:], m.TokenIds[iNdEx]) + i = encodeVarintNft(dAtA, i, uint64(len(m.TokenIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintNft(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Owner) 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 *Owner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Owner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.IDCollections) > 0 { + for iNdEx := len(m.IDCollections) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.IDCollections[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintNft(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Collection) 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 *Collection) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Collection) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NFTs) > 0 { + for iNdEx := len(m.NFTs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NFTs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Denom.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintNft(dAtA []byte, offset int, v uint64) int { + offset -= sovNft(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BaseNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + return n +} + +func (m *Denom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + l = len(m.Schema) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + return n +} + +func (m *IDCollection) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + if len(m.TokenIds) > 0 { + for _, s := range m.TokenIds { + l = len(s) + n += 1 + l + sovNft(uint64(l)) + } + } + return n +} + +func (m *Owner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + if len(m.IDCollections) > 0 { + for _, e := range m.IDCollections { + l = e.Size() + n += 1 + l + sovNft(uint64(l)) + } + } + return n +} + +func (m *Collection) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Denom.Size() + n += 1 + l + sovNft(uint64(l)) + if len(m.NFTs) > 0 { + for _, e := range m.NFTs { + l = e.Size() + n += 1 + l + sovNft(uint64(l)) + } + } + return n +} + +func sovNft(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozNft(x uint64) (n int) { + return sovNft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BaseNFT) 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 ErrIntOverflowNft + } + 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: BaseNFT: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BaseNFT: 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 ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + 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 Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + 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 ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Denom) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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: Denom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Denom: 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 ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + 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 Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IDCollection) 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 ErrIntOverflowNft + } + 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: IDCollection: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IDCollection: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenIds = append(m.TokenIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Owner) 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 ErrIntOverflowNft + } + 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: Owner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Owner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IDCollections", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IDCollections = append(m.IDCollections, IDCollection{}) + if err := m.IDCollections[len(m.IDCollections)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Collection) 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 ErrIntOverflowNft + } + 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: Collection: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Collection: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Denom.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NFTs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NFTs = append(m.NFTs, BaseNFT{}) + if err := m.NFTs[len(m.NFTs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipNft(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, ErrIntOverflowNft + } + 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, ErrIntOverflowNft + } + 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, ErrIntOverflowNft + } + 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, ErrInvalidLengthNft + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupNft + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthNft + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthNft = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowNft = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupNft = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/nft/query.pb.go b/module-sdk/nft/query.pb.go new file mode 100644 index 00000000..6e11ef7c --- /dev/null +++ b/module-sdk/nft/query.pb.go @@ -0,0 +1,2642 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nft/query.proto + +package nft + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// QuerySupplyRequest is the request type for the Query/HTLC RPC method +type QuerySupplyRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *QuerySupplyRequest) Reset() { *m = QuerySupplyRequest{} } +func (m *QuerySupplyRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySupplyRequest) ProtoMessage() {} +func (*QuerySupplyRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{0} +} +func (m *QuerySupplyRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySupplyRequest.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 *QuerySupplyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupplyRequest.Merge(m, src) +} +func (m *QuerySupplyRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySupplyRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupplyRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySupplyRequest proto.InternalMessageInfo + +func (m *QuerySupplyRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +func (m *QuerySupplyRequest) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +// QuerySupplyResponse is the response type for the Query/Supply RPC method +type QuerySupplyResponse struct { + Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *QuerySupplyResponse) Reset() { *m = QuerySupplyResponse{} } +func (m *QuerySupplyResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySupplyResponse) ProtoMessage() {} +func (*QuerySupplyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{1} +} +func (m *QuerySupplyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySupplyResponse.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 *QuerySupplyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySupplyResponse.Merge(m, src) +} +func (m *QuerySupplyResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySupplyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySupplyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySupplyResponse proto.InternalMessageInfo + +func (m *QuerySupplyResponse) GetAmount() uint64 { + if m != nil { + return m.Amount + } + return 0 +} + +// QueryOwnerRequest is the request type for the Query/Owner RPC method +type QueryOwnerRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *QueryOwnerRequest) Reset() { *m = QueryOwnerRequest{} } +func (m *QueryOwnerRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOwnerRequest) ProtoMessage() {} +func (*QueryOwnerRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{2} +} +func (m *QueryOwnerRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOwnerRequest.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 *QueryOwnerRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOwnerRequest.Merge(m, src) +} +func (m *QueryOwnerRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOwnerRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOwnerRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOwnerRequest proto.InternalMessageInfo + +func (m *QueryOwnerRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +func (m *QueryOwnerRequest) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +// QueryOwnerResponse is the response type for the Query/Owner RPC method +type QueryOwnerResponse struct { + Owner *Owner `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *QueryOwnerResponse) Reset() { *m = QueryOwnerResponse{} } +func (m *QueryOwnerResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOwnerResponse) ProtoMessage() {} +func (*QueryOwnerResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{3} +} +func (m *QueryOwnerResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOwnerResponse.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 *QueryOwnerResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOwnerResponse.Merge(m, src) +} +func (m *QueryOwnerResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOwnerResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOwnerResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOwnerResponse proto.InternalMessageInfo + +func (m *QueryOwnerResponse) GetOwner() *Owner { + if m != nil { + return m.Owner + } + return nil +} + +// QueryCollectionRequest is the request type for the Query/Collection RPC +// method +type QueryCollectionRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` +} + +func (m *QueryCollectionRequest) Reset() { *m = QueryCollectionRequest{} } +func (m *QueryCollectionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryCollectionRequest) ProtoMessage() {} +func (*QueryCollectionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{4} +} +func (m *QueryCollectionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCollectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCollectionRequest.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 *QueryCollectionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCollectionRequest.Merge(m, src) +} +func (m *QueryCollectionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryCollectionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCollectionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCollectionRequest proto.InternalMessageInfo + +func (m *QueryCollectionRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +// QueryCollectionResponse is the response type for the Query/Collection RPC +// method +type QueryCollectionResponse struct { + Collection *Collection `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` +} + +func (m *QueryCollectionResponse) Reset() { *m = QueryCollectionResponse{} } +func (m *QueryCollectionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCollectionResponse) ProtoMessage() {} +func (*QueryCollectionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{5} +} +func (m *QueryCollectionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCollectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCollectionResponse.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 *QueryCollectionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCollectionResponse.Merge(m, src) +} +func (m *QueryCollectionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCollectionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCollectionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCollectionResponse proto.InternalMessageInfo + +func (m *QueryCollectionResponse) GetCollection() *Collection { + if m != nil { + return m.Collection + } + return nil +} + +// QueryDenomRequest is the request type for the Query/Denom RPC method +type QueryDenomRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` +} + +func (m *QueryDenomRequest) Reset() { *m = QueryDenomRequest{} } +func (m *QueryDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDenomRequest) ProtoMessage() {} +func (*QueryDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{6} +} +func (m *QueryDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomRequest.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 *QueryDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomRequest.Merge(m, src) +} +func (m *QueryDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomRequest proto.InternalMessageInfo + +func (m *QueryDenomRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +// QueryDenomResponse is the response type for the Query/Denom RPC method +type QueryDenomResponse struct { + Denom *Denom `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryDenomResponse) Reset() { *m = QueryDenomResponse{} } +func (m *QueryDenomResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDenomResponse) ProtoMessage() {} +func (*QueryDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{7} +} +func (m *QueryDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomResponse.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 *QueryDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomResponse.Merge(m, src) +} +func (m *QueryDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomResponse proto.InternalMessageInfo + +func (m *QueryDenomResponse) GetDenom() *Denom { + if m != nil { + return m.Denom + } + return nil +} + +// QueryDenomsRequest is the request type for the Query/Denoms RPC method +type QueryDenomsRequest struct { +} + +func (m *QueryDenomsRequest) Reset() { *m = QueryDenomsRequest{} } +func (m *QueryDenomsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDenomsRequest) ProtoMessage() {} +func (*QueryDenomsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{8} +} +func (m *QueryDenomsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomsRequest.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 *QueryDenomsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomsRequest.Merge(m, src) +} +func (m *QueryDenomsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomsRequest proto.InternalMessageInfo + +// QueryDenomsResponse is the response type for the Query/Denoms RPC method +type QueryDenomsResponse struct { + Denoms []Denom `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms"` +} + +func (m *QueryDenomsResponse) Reset() { *m = QueryDenomsResponse{} } +func (m *QueryDenomsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDenomsResponse) ProtoMessage() {} +func (*QueryDenomsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{9} +} +func (m *QueryDenomsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDenomsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDenomsResponse.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 *QueryDenomsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDenomsResponse.Merge(m, src) +} +func (m *QueryDenomsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDenomsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDenomsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDenomsResponse proto.InternalMessageInfo + +func (m *QueryDenomsResponse) GetDenoms() []Denom { + if m != nil { + return m.Denoms + } + return nil +} + +// QueryNFTRequest is the request type for the Query/NFT RPC method +type QueryNFTRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + TokenId string `protobuf:"bytes,2,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty" yaml:"token_id"` +} + +func (m *QueryNFTRequest) Reset() { *m = QueryNFTRequest{} } +func (m *QueryNFTRequest) String() string { return proto.CompactTextString(m) } +func (*QueryNFTRequest) ProtoMessage() {} +func (*QueryNFTRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{10} +} +func (m *QueryNFTRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNFTRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNFTRequest.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 *QueryNFTRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNFTRequest.Merge(m, src) +} +func (m *QueryNFTRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryNFTRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNFTRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNFTRequest proto.InternalMessageInfo + +func (m *QueryNFTRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +func (m *QueryNFTRequest) GetTokenId() string { + if m != nil { + return m.TokenId + } + return "" +} + +// QueryNFTResponse is the response type for the Query/NFT RPC method +type QueryNFTResponse struct { + NFT *BaseNFT `protobuf:"bytes,1,opt,name=nft,proto3" json:"nft,omitempty"` +} + +func (m *QueryNFTResponse) Reset() { *m = QueryNFTResponse{} } +func (m *QueryNFTResponse) String() string { return proto.CompactTextString(m) } +func (*QueryNFTResponse) ProtoMessage() {} +func (*QueryNFTResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{11} +} +func (m *QueryNFTResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryNFTResponse.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 *QueryNFTResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryNFTResponse.Merge(m, src) +} +func (m *QueryNFTResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryNFTResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryNFTResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryNFTResponse proto.InternalMessageInfo + +func (m *QueryNFTResponse) GetNFT() *BaseNFT { + if m != nil { + return m.NFT + } + return nil +} + +func init() { + proto.RegisterType((*QuerySupplyRequest)(nil), "irismod.nft.QuerySupplyRequest") + proto.RegisterType((*QuerySupplyResponse)(nil), "irismod.nft.QuerySupplyResponse") + proto.RegisterType((*QueryOwnerRequest)(nil), "irismod.nft.QueryOwnerRequest") + proto.RegisterType((*QueryOwnerResponse)(nil), "irismod.nft.QueryOwnerResponse") + proto.RegisterType((*QueryCollectionRequest)(nil), "irismod.nft.QueryCollectionRequest") + proto.RegisterType((*QueryCollectionResponse)(nil), "irismod.nft.QueryCollectionResponse") + proto.RegisterType((*QueryDenomRequest)(nil), "irismod.nft.QueryDenomRequest") + proto.RegisterType((*QueryDenomResponse)(nil), "irismod.nft.QueryDenomResponse") + proto.RegisterType((*QueryDenomsRequest)(nil), "irismod.nft.QueryDenomsRequest") + proto.RegisterType((*QueryDenomsResponse)(nil), "irismod.nft.QueryDenomsResponse") + proto.RegisterType((*QueryNFTRequest)(nil), "irismod.nft.QueryNFTRequest") + proto.RegisterType((*QueryNFTResponse)(nil), "irismod.nft.QueryNFTResponse") +} + +func init() { proto.RegisterFile("nft/query.proto", fileDescriptor_ce02d034d3adf2e9) } + +var fileDescriptor_ce02d034d3adf2e9 = []byte{ + // 665 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x4f, 0x13, 0x41, + 0x18, 0xee, 0x02, 0x2d, 0xf8, 0x12, 0x83, 0x0e, 0x15, 0x48, 0x81, 0x6d, 0x33, 0xf8, 0x81, 0x1f, + 0xdd, 0x31, 0x78, 0x30, 0xf1, 0xe0, 0xa1, 0x18, 0x90, 0x0b, 0xc6, 0x95, 0x8b, 0x5c, 0x4c, 0x61, + 0xa7, 0xa5, 0x61, 0x77, 0x66, 0xe9, 0xcc, 0xc6, 0x10, 0x42, 0x4c, 0x8c, 0x3f, 0xc0, 0xc4, 0x3f, + 0xc5, 0x4d, 0x12, 0x2f, 0x9e, 0x88, 0x29, 0xfe, 0x02, 0x7f, 0x81, 0x99, 0xd9, 0x59, 0xbb, 0xeb, + 0xb6, 0xc4, 0x34, 0x9e, 0x76, 0x3e, 0x9e, 0xf7, 0x79, 0x9e, 0x79, 0xfb, 0x3e, 0x29, 0xcc, 0xb0, + 0x96, 0x24, 0x47, 0x11, 0xed, 0x1e, 0x3b, 0x61, 0x97, 0x4b, 0x8e, 0xa6, 0x3b, 0xdd, 0x8e, 0x08, + 0xb8, 0xe7, 0xb0, 0x96, 0xac, 0x94, 0xdb, 0xbc, 0xcd, 0xf5, 0x39, 0x51, 0xab, 0x18, 0x52, 0x59, + 0x6a, 0x73, 0xde, 0xf6, 0x29, 0x69, 0x86, 0x1d, 0xd2, 0x64, 0x8c, 0xcb, 0xa6, 0xec, 0x70, 0x26, + 0xcc, 0xed, 0x75, 0xc5, 0xc8, 0x5a, 0x32, 0xde, 0xe2, 0x5d, 0x40, 0xaf, 0x15, 0xfd, 0x9b, 0x28, + 0x0c, 0xfd, 0x63, 0x97, 0x1e, 0x45, 0x54, 0x48, 0xe4, 0xc0, 0x94, 0x47, 0x19, 0x0f, 0xde, 0x75, + 0xbc, 0x05, 0xab, 0x66, 0xad, 0x5e, 0x6b, 0xcc, 0xfe, 0xba, 0xa8, 0xce, 0x1c, 0x37, 0x03, 0xff, + 0x19, 0x4e, 0x6e, 0xb0, 0x3b, 0xa9, 0x97, 0x5b, 0x1e, 0x2a, 0x43, 0x91, 0xbf, 0x67, 0xb4, 0xbb, + 0x30, 0xa6, 0xc0, 0x6e, 0xbc, 0xc1, 0x75, 0x98, 0xcd, 0x70, 0x8b, 0x90, 0x33, 0x41, 0xd1, 0x1c, + 0x94, 0x9a, 0x01, 0x8f, 0x98, 0xd4, 0xd4, 0x13, 0xae, 0xd9, 0xe1, 0xb7, 0x70, 0x53, 0xc3, 0x5f, + 0xa9, 0xe2, 0xff, 0xeb, 0xe4, 0xb9, 0x79, 0xa5, 0xa1, 0x36, 0x46, 0x56, 0x13, 0xac, 0x22, 0x9e, + 0x5e, 0x43, 0x4e, 0xaa, 0xb7, 0x4e, 0x0c, 0x35, 0xf5, 0x2f, 0x61, 0x4e, 0xd7, 0xaf, 0x73, 0xdf, + 0xa7, 0xfb, 0xaa, 0x9d, 0x23, 0xfa, 0xc3, 0x2e, 0xcc, 0xe7, 0x98, 0x8c, 0x9d, 0xa7, 0x00, 0xfb, + 0x7f, 0x4e, 0x8d, 0xa7, 0xf9, 0x8c, 0xa7, 0x54, 0x51, 0x0a, 0x8a, 0xd7, 0x4d, 0xe3, 0x5e, 0x28, + 0x8d, 0x51, 0x8d, 0x25, 0x2d, 0x32, 0x24, 0xfd, 0x16, 0x69, 0xc0, 0xc0, 0x16, 0xc5, 0xd0, 0x18, + 0x80, 0xcb, 0xe9, 0x7a, 0x61, 0x5c, 0xe0, 0x4d, 0x33, 0x02, 0xc9, 0xa9, 0xa1, 0x7d, 0x0c, 0x25, + 0x5d, 0x25, 0x16, 0xac, 0xda, 0xf8, 0x60, 0xde, 0xc6, 0xc4, 0xd9, 0x45, 0xb5, 0xe0, 0x1a, 0x1c, + 0x3e, 0x82, 0x19, 0x4d, 0xb4, 0xbd, 0xb1, 0x33, 0xea, 0x68, 0x38, 0x30, 0x25, 0xf9, 0x21, 0x65, + 0x0a, 0x3f, 0xf6, 0x37, 0x3e, 0xb9, 0xc1, 0xee, 0xa4, 0x5e, 0x6e, 0x79, 0x78, 0x1d, 0x6e, 0xf4, + 0x25, 0x8d, 0x71, 0x02, 0xe3, 0xac, 0x25, 0x4d, 0x37, 0xca, 0x19, 0xd7, 0x8d, 0xa6, 0xa0, 0xdb, + 0x1b, 0x3b, 0x8d, 0xc9, 0xde, 0x45, 0x75, 0x5c, 0xd5, 0x28, 0xe4, 0xda, 0xd7, 0x22, 0x14, 0x35, + 0x0b, 0xfa, 0x00, 0xa5, 0x38, 0x08, 0xa8, 0x9a, 0xa9, 0xcb, 0xc7, 0xaf, 0x52, 0x1b, 0x0e, 0x88, + 0x7d, 0xe0, 0xb5, 0x8f, 0xdf, 0x7e, 0x7e, 0x19, 0x7b, 0x84, 0x1e, 0x10, 0x83, 0x54, 0x91, 0x26, + 0xfd, 0x99, 0x10, 0xe4, 0x24, 0xe9, 0xc0, 0x29, 0x11, 0xb1, 0x6c, 0x00, 0x45, 0x3d, 0xd4, 0xc8, + 0xce, 0xd3, 0xa7, 0x33, 0x57, 0xa9, 0x0e, 0xbd, 0x37, 0xea, 0x2b, 0x5a, 0x7d, 0x19, 0x2d, 0x66, + 0xd4, 0x75, 0x54, 0x04, 0x39, 0xd1, 0xdf, 0x53, 0xf4, 0xc9, 0x02, 0xe8, 0x0f, 0x2c, 0x5a, 0xc9, + 0x93, 0xe6, 0xd2, 0x54, 0xb9, 0x7d, 0x35, 0xc8, 0xc8, 0x3f, 0xd4, 0xf2, 0x77, 0xd0, 0xca, 0x3f, + 0x3c, 0x1e, 0x85, 0x50, 0xd4, 0xf3, 0x34, 0xe8, 0xd5, 0xe9, 0xc0, 0x0c, 0x7a, 0x75, 0x26, 0x0b, + 0xf8, 0xae, 0x96, 0xad, 0x21, 0x3b, 0x23, 0x1b, 0xcf, 0x67, 0x5a, 0xf1, 0x00, 0x4a, 0xf1, 0xb8, + 0xa3, 0x61, 0x94, 0xe2, 0x8a, 0x1f, 0x3a, 0x9b, 0x14, 0xbc, 0xa8, 0x45, 0x6f, 0xa1, 0xd9, 0x01, + 0xa2, 0x48, 0x80, 0x1a, 0x34, 0xb4, 0x94, 0x67, 0xe9, 0xc7, 0xa4, 0xb2, 0x3c, 0xe4, 0xd6, 0x08, + 0x10, 0x2d, 0x70, 0x1f, 0xdd, 0xcb, 0x08, 0xb0, 0x96, 0xcc, 0x8c, 0xd0, 0x49, 0x92, 0x8f, 0xd3, + 0xc6, 0xe6, 0x59, 0xcf, 0xb6, 0xce, 0x7b, 0xb6, 0xf5, 0xa3, 0x67, 0x5b, 0x9f, 0x2f, 0xed, 0xc2, + 0xf9, 0xa5, 0x5d, 0xf8, 0x7e, 0x69, 0x17, 0x76, 0xeb, 0xed, 0x8e, 0x3c, 0x88, 0xf6, 0x9c, 0x7d, + 0x1e, 0x68, 0x32, 0x46, 0xa5, 0xfe, 0x1e, 0x44, 0x7b, 0x75, 0xe1, 0x1d, 0xd6, 0xdb, 0x9c, 0x04, + 0xdc, 0x8b, 0x7c, 0x2a, 0x14, 0xff, 0x5e, 0x49, 0xff, 0x03, 0x3d, 0xf9, 0x1d, 0x00, 0x00, 0xff, + 0xff, 0x40, 0xb6, 0x0e, 0xd9, 0xe4, 0x06, 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 { + // Supply queries the total supply of a given denom or owner + Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) + // Owner queries the NFTs of the specified owner + Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) + // Collection queries the NFTs of the specified denom + Collection(ctx context.Context, in *QueryCollectionRequest, opts ...grpc.CallOption) (*QueryCollectionResponse, error) + // Denom queries the definition of a given denom + Denom(ctx context.Context, in *QueryDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) + // Denoms queries all the denoms + Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) + // NFT queries the NFT for the given denom and token ID + NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) { + out := new(QuerySupplyResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/Supply", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) { + out := new(QueryOwnerResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/Owner", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Collection(ctx context.Context, in *QueryCollectionRequest, opts ...grpc.CallOption) (*QueryCollectionResponse, error) { + out := new(QueryCollectionResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/Collection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Denom(ctx context.Context, in *QueryDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) { + out := new(QueryDenomResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/Denom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) { + out := new(QueryDenomsResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/Denoms", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) { + out := new(QueryNFTResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/NFT", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Supply queries the total supply of a given denom or owner + Supply(context.Context, *QuerySupplyRequest) (*QuerySupplyResponse, error) + // Owner queries the NFTs of the specified owner + Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) + // Collection queries the NFTs of the specified denom + Collection(context.Context, *QueryCollectionRequest) (*QueryCollectionResponse, error) + // Denom queries the definition of a given denom + Denom(context.Context, *QueryDenomRequest) (*QueryDenomResponse, error) + // Denoms queries all the denoms + Denoms(context.Context, *QueryDenomsRequest) (*QueryDenomsResponse, error) + // NFT queries the NFT for the given denom and token ID + NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Supply(ctx context.Context, req *QuerySupplyRequest) (*QuerySupplyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Supply not implemented") +} +func (*UnimplementedQueryServer) Owner(ctx context.Context, req *QueryOwnerRequest) (*QueryOwnerResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Owner not implemented") +} +func (*UnimplementedQueryServer) Collection(ctx context.Context, req *QueryCollectionRequest) (*QueryCollectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Collection not implemented") +} +func (*UnimplementedQueryServer) Denom(ctx context.Context, req *QueryDenomRequest) (*QueryDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Denom not implemented") +} +func (*UnimplementedQueryServer) Denoms(ctx context.Context, req *QueryDenomsRequest) (*QueryDenomsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Denoms not implemented") +} +func (*UnimplementedQueryServer) NFT(ctx context.Context, req *QueryNFTRequest) (*QueryNFTResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NFT not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Supply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySupplyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Supply(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/Supply", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Supply(ctx, req.(*QuerySupplyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Owner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOwnerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Owner(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/Owner", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Owner(ctx, req.(*QueryOwnerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Collection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCollectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Collection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/Collection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Collection(ctx, req.(*QueryCollectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Denom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDenomRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Denom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/Denom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Denom(ctx, req.(*QueryDenomRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Denoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDenomsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Denoms(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/Denoms", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Denoms(ctx, req.(*QueryDenomsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_NFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryNFTRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).NFT(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/NFT", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).NFT(ctx, req.(*QueryNFTRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.nft.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Supply", + Handler: _Query_Supply_Handler, + }, + { + MethodName: "Owner", + Handler: _Query_Owner_Handler, + }, + { + MethodName: "Collection", + Handler: _Query_Collection_Handler, + }, + { + MethodName: "Denom", + Handler: _Query_Denom_Handler, + }, + { + MethodName: "Denoms", + Handler: _Query_Denoms_Handler, + }, + { + MethodName: "NFT", + Handler: _Query_NFT_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nft/query.proto", +} + +func (m *QuerySupplyRequest) 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 *QuerySupplyRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySupplyResponse) 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 *QuerySupplyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Amount != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryOwnerRequest) 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 *QueryOwnerRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOwnerResponse) 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 *QueryOwnerResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Owner != nil { + { + size, err := m.Owner.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 *QueryCollectionRequest) 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 *QueryCollectionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCollectionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCollectionResponse) 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 *QueryCollectionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCollectionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Collection != nil { + { + size, err := m.Collection.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 *QueryDenomRequest) 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 *QueryDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDenomResponse) 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 *QueryDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Denom != nil { + { + size, err := m.Denom.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 *QueryDenomsRequest) 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 *QueryDenomsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryDenomsResponse) 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 *QueryDenomsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denoms) > 0 { + for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Denoms[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 *QueryNFTRequest) 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 *QueryNFTRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNFTRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TokenId) > 0 { + i -= len(m.TokenId) + copy(dAtA[i:], m.TokenId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TokenId))) + i-- + dAtA[i] = 0x12 + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryNFTResponse) 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 *QueryNFTResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NFT != nil { + { + size, err := m.NFT.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 *QuerySupplyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySupplyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Amount != 0 { + n += 1 + sovQuery(uint64(m.Amount)) + } + return n +} + +func (m *QueryOwnerRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOwnerResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Owner != nil { + l = m.Owner.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCollectionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCollectionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Collection != nil { + l = m.Collection.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Denom != nil { + l = m.Denom.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDenomsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryDenomsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Denoms) > 0 { + for _, e := range m.Denoms { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryNFTRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.TokenId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryNFTResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NFT != nil { + l = m.NFT.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 *QuerySupplyRequest) 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: QuerySupplyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 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.Owner = 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 *QuerySupplyResponse) 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: QuerySupplyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOwnerRequest) 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: QueryOwnerRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 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.Owner = 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 *QueryOwnerResponse) 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: QueryOwnerResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner == nil { + m.Owner = &Owner{} + } + if err := m.Owner.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 *QueryCollectionRequest) 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: QueryCollectionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCollectionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 *QueryCollectionResponse) 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: QueryCollectionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCollectionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Collection", 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.Collection == nil { + m.Collection = &Collection{} + } + if err := m.Collection.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 *QueryDenomRequest) 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: QueryDenomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 *QueryDenomResponse) 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: QueryDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom == nil { + m.Denom = &Denom{} + } + if err := m.Denom.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 *QueryDenomsRequest) 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: QueryDenomsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomsRequest: 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 *QueryDenomsResponse) 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: QueryDenomsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", 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.Denoms = append(m.Denoms, Denom{}) + if err := m.Denoms[len(m.Denoms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryNFTRequest) 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: QueryNFTRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNFTRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenId", 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.TokenId = 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 *QueryNFTResponse) 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: QueryNFTResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NFT", 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.NFT == nil { + m.NFT = &BaseNFT{} + } + if err := m.NFT.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/module-sdk/nft/tx.pb.go b/module-sdk/nft/tx.pb.go new file mode 100644 index 00000000..96891f85 --- /dev/null +++ b/module-sdk/nft/tx.pb.go @@ -0,0 +1,2133 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nft/tx.proto + +package nft + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +// MsgIssueDenom defines an SDK message for creating a new denom. +type MsgIssueDenom struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Schema string `protobuf:"bytes,3,opt,name=schema,proto3" json:"schema,omitempty"` + Sender string `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgIssueDenom) Reset() { *m = MsgIssueDenom{} } +func (m *MsgIssueDenom) String() string { return proto.CompactTextString(m) } +func (*MsgIssueDenom) ProtoMessage() {} +func (*MsgIssueDenom) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{0} +} +func (m *MsgIssueDenom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIssueDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIssueDenom.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 *MsgIssueDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIssueDenom.Merge(m, src) +} +func (m *MsgIssueDenom) XXX_Size() int { + return m.Size() +} +func (m *MsgIssueDenom) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIssueDenom.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIssueDenom proto.InternalMessageInfo + +// MsgTransferNFT defines an SDK message for transferring an NFT to recipient. +type MsgTransferNFT struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + URI string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` + Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + Sender string `protobuf:"bytes,6,opt,name=sender,proto3" json:"sender,omitempty"` + Recipient string `protobuf:"bytes,7,opt,name=recipient,proto3" json:"recipient,omitempty"` +} + +func (m *MsgTransferNFT) Reset() { *m = MsgTransferNFT{} } +func (m *MsgTransferNFT) String() string { return proto.CompactTextString(m) } +func (*MsgTransferNFT) ProtoMessage() {} +func (*MsgTransferNFT) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{1} +} +func (m *MsgTransferNFT) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferNFT.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 *MsgTransferNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferNFT.Merge(m, src) +} +func (m *MsgTransferNFT) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferNFT) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferNFT.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferNFT proto.InternalMessageInfo + +// MsgEditNFT defines an SDK message for editing a nft. +type MsgEditNFT struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + URI string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` + Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + Sender string `protobuf:"bytes,6,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgEditNFT) Reset() { *m = MsgEditNFT{} } +func (m *MsgEditNFT) String() string { return proto.CompactTextString(m) } +func (*MsgEditNFT) ProtoMessage() {} +func (*MsgEditNFT) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{2} +} +func (m *MsgEditNFT) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditNFT.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 *MsgEditNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditNFT.Merge(m, src) +} +func (m *MsgEditNFT) XXX_Size() int { + return m.Size() +} +func (m *MsgEditNFT) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditNFT.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditNFT proto.InternalMessageInfo + +// MsgMintNFT defines an SDK message for creating a new NFT. +type MsgMintNFT struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + URI string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` + Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + Sender string `protobuf:"bytes,6,opt,name=sender,proto3" json:"sender,omitempty"` + Recipient string `protobuf:"bytes,7,opt,name=recipient,proto3" json:"recipient,omitempty"` +} + +func (m *MsgMintNFT) Reset() { *m = MsgMintNFT{} } +func (m *MsgMintNFT) String() string { return proto.CompactTextString(m) } +func (*MsgMintNFT) ProtoMessage() {} +func (*MsgMintNFT) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{3} +} +func (m *MsgMintNFT) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintNFT.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 *MsgMintNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintNFT.Merge(m, src) +} +func (m *MsgMintNFT) XXX_Size() int { + return m.Size() +} +func (m *MsgMintNFT) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintNFT.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintNFT proto.InternalMessageInfo + +// MsgBurnNFT defines an SDK message for burning a NFT. +type MsgBurnNFT struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgBurnNFT) Reset() { *m = MsgBurnNFT{} } +func (m *MsgBurnNFT) String() string { return proto.CompactTextString(m) } +func (*MsgBurnNFT) ProtoMessage() {} +func (*MsgBurnNFT) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{4} +} +func (m *MsgBurnNFT) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnNFT.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 *MsgBurnNFT) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnNFT.Merge(m, src) +} +func (m *MsgBurnNFT) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnNFT) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnNFT.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnNFT proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgIssueDenom)(nil), "irismod.nft.MsgIssueDenom") + proto.RegisterType((*MsgTransferNFT)(nil), "irismod.nft.MsgTransferNFT") + proto.RegisterType((*MsgEditNFT)(nil), "irismod.nft.MsgEditNFT") + proto.RegisterType((*MsgMintNFT)(nil), "irismod.nft.MsgMintNFT") + proto.RegisterType((*MsgBurnNFT)(nil), "irismod.nft.MsgBurnNFT") +} + +func init() { proto.RegisterFile("nft/tx.proto", fileDescriptor_09d30374d974e015) } + +var fileDescriptor_09d30374d974e015 = []byte{ + // 377 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0xb1, 0x4a, 0xc3, 0x40, + 0x18, 0xc7, 0x73, 0x4d, 0x6d, 0xed, 0xa9, 0x15, 0xa2, 0x48, 0x14, 0x49, 0x25, 0x93, 0x4b, 0x93, + 0xc1, 0xad, 0x63, 0x50, 0xa1, 0x48, 0x1c, 0x42, 0x5d, 0x5c, 0x24, 0xed, 0x5d, 0xd2, 0xd3, 0xe6, + 0xae, 0xdc, 0x5d, 0x40, 0xdf, 0xc2, 0x47, 0xf0, 0x05, 0x7c, 0x8f, 0x82, 0x83, 0x1d, 0x9d, 0x8a, + 0xa6, 0x8b, 0xb3, 0x4f, 0x20, 0xb9, 0x44, 0x5a, 0xe8, 0xea, 0x20, 0x4e, 0xf7, 0xbf, 0xff, 0xf7, + 0xc1, 0xf7, 0xfb, 0x7f, 0xf0, 0xc1, 0x4d, 0x1a, 0x49, 0x57, 0xde, 0x3b, 0x63, 0xce, 0x24, 0x33, + 0x36, 0x08, 0x27, 0x22, 0x61, 0xc8, 0xa1, 0x91, 0x3c, 0xd8, 0x8d, 0x59, 0xcc, 0x94, 0xef, 0xe6, + 0xaa, 0x68, 0xb1, 0x09, 0xdc, 0xf2, 0x45, 0xdc, 0x15, 0x22, 0xc5, 0xa7, 0x98, 0xb2, 0xc4, 0x68, + 0xc2, 0x0a, 0x41, 0x26, 0x38, 0x02, 0xc7, 0x8d, 0xa0, 0x42, 0x90, 0x61, 0xc0, 0x2a, 0x0d, 0x13, + 0x6c, 0x56, 0x94, 0xa3, 0xb4, 0xb1, 0x07, 0x6b, 0x62, 0x30, 0xc4, 0x49, 0x68, 0xea, 0xca, 0x2d, + 0x7f, 0xca, 0xc7, 0x14, 0x61, 0x6e, 0x56, 0x4b, 0x5f, 0xfd, 0x3a, 0xd5, 0xcf, 0xa7, 0x16, 0xb0, + 0x5f, 0x01, 0x6c, 0xfa, 0x22, 0xee, 0xf1, 0x90, 0x8a, 0x08, 0xf3, 0xcb, 0xf3, 0xde, 0xca, 0x30, + 0x07, 0xae, 0xa3, 0x9c, 0xe2, 0x86, 0xa0, 0x62, 0xa0, 0xb7, 0xf3, 0x35, 0x6b, 0x6d, 0x3f, 0x84, + 0xc9, 0xa8, 0x63, 0xff, 0x54, 0xec, 0xa0, 0xae, 0x64, 0x77, 0x01, 0xa7, 0x2f, 0xc1, 0xed, 0x43, + 0x3d, 0xe5, 0xa4, 0x20, 0xf0, 0xea, 0xd9, 0xac, 0xa5, 0x5f, 0x05, 0xdd, 0x20, 0xf7, 0xf2, 0x76, + 0x14, 0xca, 0xd0, 0x5c, 0x2b, 0xda, 0x73, 0xbd, 0xc4, 0x5c, 0x5b, 0x66, 0x36, 0x0e, 0x61, 0x83, + 0xe3, 0x01, 0x19, 0x13, 0x4c, 0xa5, 0x59, 0x57, 0xa5, 0x85, 0x51, 0x26, 0x7a, 0x06, 0x10, 0xfa, + 0x22, 0x3e, 0x43, 0x44, 0xfe, 0xed, 0x34, 0x25, 0xef, 0x4b, 0xc1, 0xeb, 0x13, 0x2a, 0xff, 0xc1, + 0xf6, 0x6f, 0x55, 0x18, 0x2f, 0xe5, 0xf4, 0x37, 0xc2, 0x2c, 0x48, 0xf4, 0xd5, 0xcd, 0x79, 0x17, + 0x93, 0x0f, 0x4b, 0x9b, 0x64, 0x16, 0x98, 0x66, 0x16, 0x78, 0xcf, 0x2c, 0xf0, 0x38, 0xb7, 0xb4, + 0xe9, 0xdc, 0xd2, 0xde, 0xe6, 0x96, 0x76, 0xdd, 0x8e, 0x89, 0x1c, 0xa6, 0x7d, 0x67, 0xc0, 0x12, + 0x37, 0x3f, 0x39, 0x8a, 0xa5, 0x7a, 0x87, 0x69, 0xbf, 0x2d, 0xd0, 0x5d, 0x3b, 0x66, 0x6e, 0xc2, + 0x50, 0x3a, 0xc2, 0xc2, 0xa5, 0x91, 0xec, 0xd7, 0xd4, 0xe9, 0x9d, 0x7c, 0x07, 0x00, 0x00, 0xff, + 0xff, 0x75, 0x7b, 0x7b, 0x3c, 0xad, 0x03, 0x00, 0x00, +} + +func (this *MsgIssueDenom) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgIssueDenom) + if !ok { + that2, ok := that.(MsgIssueDenom) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Name != that1.Name { + return false + } + if this.Schema != that1.Schema { + return false + } + if this.Sender != that1.Sender { + return false + } + return true +} +func (this *MsgTransferNFT) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgTransferNFT) + if !ok { + that2, ok := that.(MsgTransferNFT) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.DenomId != that1.DenomId { + return false + } + if this.Name != that1.Name { + return false + } + if this.URI != that1.URI { + return false + } + if this.Data != that1.Data { + return false + } + if this.Sender != that1.Sender { + return false + } + if this.Recipient != that1.Recipient { + return false + } + return true +} +func (this *MsgEditNFT) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgEditNFT) + if !ok { + that2, ok := that.(MsgEditNFT) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.DenomId != that1.DenomId { + return false + } + if this.Name != that1.Name { + return false + } + if this.URI != that1.URI { + return false + } + if this.Data != that1.Data { + return false + } + if this.Sender != that1.Sender { + return false + } + return true +} +func (this *MsgMintNFT) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgMintNFT) + if !ok { + that2, ok := that.(MsgMintNFT) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.DenomId != that1.DenomId { + return false + } + if this.Name != that1.Name { + return false + } + if this.URI != that1.URI { + return false + } + if this.Data != that1.Data { + return false + } + if this.Sender != that1.Sender { + return false + } + if this.Recipient != that1.Recipient { + return false + } + return true +} +func (this *MsgBurnNFT) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgBurnNFT) + if !ok { + that2, ok := that.(MsgBurnNFT) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.DenomId != that1.DenomId { + return false + } + if this.Sender != that1.Sender { + return false + } + return true +} +func (m *MsgIssueDenom) 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 *MsgIssueDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIssueDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x22 + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarintTx(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferNFT) 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 *MsgTransferNFT) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x3a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x32 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x2a + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintTx(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x22 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEditNFT) 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 *MsgEditNFT) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x32 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x2a + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintTx(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x22 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMintNFT) 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 *MsgMintNFT) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x3a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x32 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x2a + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintTx(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x22 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBurnNFT) 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 *MsgBurnNFT) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x1a + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + 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 *MsgIssueDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Schema) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTransferNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgEditNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMintNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgBurnNFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(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 *MsgIssueDenom) 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: MsgIssueDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIssueDenom: 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 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", 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.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgTransferNFT) 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: MsgTransferNFT: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", 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.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", 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.Recipient = 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 *MsgEditNFT) 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: MsgEditNFT: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", 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.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgMintNFT) 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: MsgMintNFT: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", 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.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", 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.Recipient = 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 *MsgBurnNFT) 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: MsgBurnNFT: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 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/module-sdk/nft/types.go b/module-sdk/nft/types.go new file mode 100644 index 00000000..ebda11b4 --- /dev/null +++ b/module-sdk/nft/types.go @@ -0,0 +1,282 @@ +package nft + +import ( + sdk "github.com/irisnet/core-sdk-go/types" + "strings" +) + +const ( + ModuleName = "nft" +) + +var ( + _ sdk.Msg = &MsgIssueDenom{} + _ sdk.Msg = &MsgTransferNFT{} + _ sdk.Msg = &MsgEditNFT{} + _ sdk.Msg = &MsgMintNFT{} + _ sdk.Msg = &MsgBurnNFT{} +) + +func (m MsgIssueDenom) Route() string { + return ModuleName +} + +func (m MsgIssueDenom) Type() string { + return "issue_denom" +} + +func (m MsgIssueDenom) ValidateBasic() error { + if len(m.Sender) == 0 { + return sdk.Wrapf("missing sender address") + } + + if err := sdk.ValidateAccAddress(m.Sender); err != nil { + return sdk.Wrap(err) + } + id := strings.TrimSpace(m.Id) + if len(id) == 0 { + return sdk.Wrapf("missing id") + } + return nil +} + +func (m MsgIssueDenom) GetSignBytes() []byte { + bz, err := ModuleCdc.MarshalJSON(&m) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(bz) +} + +func (m MsgIssueDenom) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} +} + +func (m MsgTransferNFT) Route() string { + return ModuleName +} + +func (m MsgTransferNFT) Type() string { + return "transfer_nft" +} + +func (m MsgTransferNFT) ValidateBasic() error { + if len(m.Sender) == 0 { + return sdk.Wrapf("missing sender address") + } + if err := sdk.ValidateAccAddress(m.Sender); err != nil { + return sdk.Wrap(err) + } + + if len(m.Recipient) == 0 { + return sdk.Wrapf("missing recipient address") + } + if err := sdk.ValidateAccAddress(m.Recipient); err != nil { + return sdk.Wrap(err) + } + + denom := strings.TrimSpace(m.DenomId) + if len(denom) == 0 { + return sdk.Wrapf("missing denom") + } + + tokenID := strings.TrimSpace(m.Id) + if len(tokenID) == 0 { + return sdk.Wrapf("missing ID") + } + return nil +} + +func (m MsgTransferNFT) GetSignBytes() []byte { + bz, err := ModuleCdc.MarshalJSON(&m) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(bz) +} + +func (m MsgTransferNFT) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} +} + +func (m MsgEditNFT) Route() string { + return ModuleName +} + +func (m MsgEditNFT) Type() string { + return "edit_nft" +} + +func (m MsgEditNFT) ValidateBasic() error { + if len(m.Sender) == 0 { + return sdk.Wrapf("missing sender address") + } + if err := sdk.ValidateAccAddress(m.Sender); err != nil { + return sdk.Wrap(err) + } + + denom := strings.TrimSpace(m.DenomId) + if len(denom) == 0 { + return sdk.Wrapf("missing denom") + } + + tokenID := strings.TrimSpace(m.Id) + if len(tokenID) == 0 { + return sdk.Wrapf("missing ID") + } + return nil +} + +func (m MsgEditNFT) GetSignBytes() []byte { + bz, err := ModuleCdc.MarshalJSON(&m) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(bz) +} + +func (m MsgEditNFT) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} +} + +func (m MsgMintNFT) Route() string { + return ModuleName +} + +func (m MsgMintNFT) Type() string { + return "mint_nft" +} + +func (m MsgMintNFT) ValidateBasic() error { + if len(m.Sender) == 0 { + return sdk.Wrapf("missing sender address") + } + if err := sdk.ValidateAccAddress(m.Sender); err != nil { + return sdk.Wrap(err) + } + + denom := strings.TrimSpace(m.DenomId) + if len(denom) == 0 { + return sdk.Wrapf("missing denom") + } + + tokenID := strings.TrimSpace(m.Id) + if len(tokenID) == 0 { + return sdk.Wrapf("missing ID") + } + return nil +} + +func (m MsgMintNFT) GetSignBytes() []byte { + bz, err := ModuleCdc.MarshalJSON(&m) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(bz) +} + +func (m MsgMintNFT) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} +} + +func (m MsgBurnNFT) Route() string { + return ModuleName +} + +func (m MsgBurnNFT) Type() string { + return "burn_nft" +} + +func (m MsgBurnNFT) ValidateBasic() error { + if len(m.Sender) == 0 { + return sdk.Wrapf("missing sender address") + } + if err := sdk.ValidateAccAddress(m.Sender); err != nil { + return sdk.Wrap(err) + } + + denom := strings.TrimSpace(m.DenomId) + if len(denom) == 0 { + return sdk.Wrapf("missing denom") + } + + tokenID := strings.TrimSpace(m.Id) + if len(tokenID) == 0 { + return sdk.Wrapf("missing ID") + } + return nil +} + +func (m MsgBurnNFT) GetSignBytes() []byte { + bz, err := ModuleCdc.MarshalJSON(&m) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(bz) +} + +func (m MsgBurnNFT) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} +} + +func (o Owner) Convert() interface{} { + var idcs []IDC + for _, idc := range o.IDCollections { + idcs = append(idcs, IDC{ + Denom: idc.DenomId, + TokenIDs: idc.TokenIds, + }) + } + return QueryOwnerResp{ + Address: o.Address, + IDCs: idcs, + } +} + +func (this BaseNFT) Convert() interface{} { + return QueryNFTResp{ + ID: this.Id, + Name: this.Name, + URI: this.URI, + Data: this.Data, + Creator: this.Owner, + } +} + +type NFTs []BaseNFT + +func (this Denom) Convert() interface{} { + return QueryDenomResp{ + ID: this.Id, + Name: this.Name, + Schema: this.Schema, + Creator: this.Creator, + } +} + +type denoms []Denom + +func (this denoms) Convert() interface{} { + var denoms []QueryDenomResp + for _, denom := range this { + denoms = append(denoms, denom.Convert().(QueryDenomResp)) + } + return denoms +} + +func (c Collection) Convert() interface{} { + var nfts []QueryNFTResp + for _, nft := range c.NFTs { + nfts = append(nfts, QueryNFTResp{ + ID: nft.Id, + Name: nft.Name, + URI: nft.URI, + Data: nft.Data, + Creator: nft.Owner, + }) + } + return QueryCollectionResp{ + Denom: c.Denom.Convert().(QueryDenomResp), + NFTs: nfts, + } +} diff --git a/module-sdk/oracle/codec.go b/module-sdk/oracle/codec.go new file mode 100644 index 00000000..d37dd574 --- /dev/null +++ b/module-sdk/oracle/codec.go @@ -0,0 +1,26 @@ +package oracle + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateFeed{}, + &MsgStartFeed{}, + &MsgPauseFeed{}, + &MsgEditFeed{}, + ) +} diff --git a/module-sdk/oracle/export.go b/module-sdk/oracle/export.go new file mode 100644 index 00000000..5c26f90f --- /dev/null +++ b/module-sdk/oracle/export.go @@ -0,0 +1,71 @@ +package oracle + +import ( + "time" + sdk "github.com/irisnet/core-sdk-go/types" +) + +// expose Oracle module api for user +type Client interface { + sdk.Module + + CreateFeed(request CreateFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + StartFeed(feedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + PauseFeed(FeedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + EditFeed(request EditFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + + QueryFeed(feedName string) (QueryFeedResp, sdk.Error) + QueryFeeds(state string) ([]QueryFeedResp, sdk.Error) + QueryFeedValue(feedName string) ([]QueryFeedValueResp, sdk.Error) +} + +type CreateFeedRequest struct { + FeedName string `json:"feed_name"` + LatestHistory uint64 `json:"latest_history"` + Description string `json:"description"` + ServiceName string `json:"service_name"` + Providers []string `json:"providers"` + Input string `json:"input"` + Timeout int64 `json:"timeout"` + ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` + RepeatedFrequency uint64 `json:"repeated_frequency"` + AggregateFunc string `json:"aggregate_func"` + ValueJsonPath string `json:"value_json_path"` + ResponseThreshold uint32 `json:"response_threshold"` +} + +type EditFeedRequest struct { + FeedName string `json:"feed_name"` + Description string `json:"description"` + LatestHistory uint64 `json:"latest_history"` + Providers []string `json:"providers"` + Timeout int64 `json:"timeout"` + ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` + RepeatedFrequency uint64 `json:"repeated_frequency"` + ResponseThreshold uint32 `json:"response_threshold"` +} + +type QueryFeedResp struct { + Feed struct { + FeedName string `json:"feed_name"` + Description string `json:"description"` + AggregateFunc string `json:"aggregate_func"` + ValueJsonPath string `json:"value_json_path"` + LatestHistory uint64 `json:"latest_history"` + RequestContextID string `json:"request_context_id"` + Creator string `json:"creator"` + } `json:"feed"` + ServiceName string `json:"service_name"` + Providers []string `json:"providers"` + Input string `json:"input"` + Timeout int64 `json:"timeout"` + ServiceFeeCap sdk.Coins `json:"service_fee_cap"` + RepeatedFrequency uint64 `json:"repeated_frequency"` + ResponseThreshold uint32 `json:"response_threshold"` + State int32 `json:"state"` +} + +type QueryFeedValueResp struct { + Data string `json:"data"` + Timestamp time.Time `json:"timestamp"` +} diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod new file mode 100644 index 00000000..59e7e4d7 --- /dev/null +++ b/module-sdk/oracle/go.mod @@ -0,0 +1,15 @@ +module oracle + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/module-sdk/service v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/module-sdk/service => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/service +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/oracle/oracle.go b/module-sdk/oracle/oracle.go new file mode 100644 index 00000000..08604fda --- /dev/null +++ b/module-sdk/oracle/oracle.go @@ -0,0 +1,172 @@ +package oracle + +import ( + "context" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" +) + +type oracleClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { + return oracleClient{ + BaseClient: baseClient, + Marshaler: marshaler, + } +} + +func (oc oracleClient) Name() string { + return ModuleName +} + +func (oc oracleClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (oc oracleClient) CreateFeed(request CreateFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + serviceFeeCap, e := oc.ToMinCoin(request.ServiceFeeCap...) + if e != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgCreateFeed{ + FeedName: request.FeedName, + LatestHistory: request.LatestHistory, + Description: request.Description, + Creator: sender.String(), + ServiceName: request.ServiceName, + Providers: request.Providers, + Input: request.Input, + Timeout: request.Timeout, + ServiceFeeCap: serviceFeeCap, + RepeatedFrequency: request.RepeatedFrequency, + AggregateFunc: request.AggregateFunc, + ValueJsonPath: request.ValueJsonPath, + ResponseThreshold: request.ResponseThreshold, + } + return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (oc oracleClient) StartFeed(feedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgStartFeed{ + FeedName: feedName, + Creator: sender.String(), + } + return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (oc oracleClient) PauseFeed(feedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgPauseFeed{ + FeedName: feedName, + Creator: sender.String(), + } + return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (oc oracleClient) EditFeed(request EditFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + serviceFeeCap, e := oc.ToMinCoin(request.ServiceFeeCap...) + if e != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgEditFeed{ + FeedName: request.FeedName, + Description: request.Description, + LatestHistory: request.LatestHistory, + Providers: request.Providers, + Timeout: request.Timeout, + ServiceFeeCap: serviceFeeCap, + RepeatedFrequency: request.RepeatedFrequency, + ResponseThreshold: request.ResponseThreshold, + Creator: sender.String(), + } + return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (oc oracleClient) QueryFeed(feedName string) (QueryFeedResp, sdk.Error) { + if len(feedName) == 0 { + return QueryFeedResp{}, sdk.Wrapf("feedName is required") + } + + conn, err := oc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryFeedResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Feed( + context.Background(), + &QueryFeedRequest{FeedName: feedName}, + ) + if err != nil { + return QueryFeedResp{}, sdk.Wrap(err) + } + return res.Feed.Convert().(QueryFeedResp), nil +} + +func (oc oracleClient) QueryFeeds(state string) ([]QueryFeedResp, sdk.Error) { + // todo state (whether state is required) + if len(state) == 0 { + return nil, sdk.Wrapf("state is required") + } + + conn, err := oc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Feeds( + context.Background(), + &QueryFeedsRequest{State: state}, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + return feedContexts(res.Feeds).Convert().([]QueryFeedResp), nil +} + +func (oc oracleClient) QueryFeedValue(feedName string) ([]QueryFeedValueResp, sdk.Error) { + if len(feedName) == 0 { + return nil, sdk.Wrapf("feedName is required") + } + + conn, err := oc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).FeedValue( + context.Background(), + &QueryFeedValueRequest{FeedName: feedName}, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + return feedValues(res.FeedValues).Convert().([]QueryFeedValueResp), nil +} diff --git a/module-sdk/oracle/oracle.pb.go b/module-sdk/oracle/oracle.pb.go new file mode 100644 index 00000000..115f1fd3 --- /dev/null +++ b/module-sdk/oracle/oracle.pb.go @@ -0,0 +1,857 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/oracle.proto + +package oracle + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/timestamp" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Feed defines the feed standard +type Feed struct { + FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + AggregateFunc string `protobuf:"bytes,3,opt,name=aggregate_func,json=aggregateFunc,proto3" json:"aggregate_func,omitempty" yaml:"aggregate_func"` + ValueJsonPath string `protobuf:"bytes,4,opt,name=value_json_path,json=valueJsonPath,proto3" json:"value_json_path,omitempty" yaml:"value_json_path"` + LatestHistory uint64 `protobuf:"varint,5,opt,name=latest_history,json=latestHistory,proto3" json:"latest_history,omitempty" yaml:"latest_history"` + RequestContextID string `protobuf:"bytes,6,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + Creator string `protobuf:"bytes,7,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *Feed) Reset() { *m = Feed{} } +func (m *Feed) String() string { return proto.CompactTextString(m) } +func (*Feed) ProtoMessage() {} +func (*Feed) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{0} +} +func (m *Feed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Feed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Feed.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 *Feed) XXX_Merge(src proto.Message) { + xxx_messageInfo_Feed.Merge(m, src) +} +func (m *Feed) XXX_Size() int { + return m.Size() +} +func (m *Feed) XXX_DiscardUnknown() { + xxx_messageInfo_Feed.DiscardUnknown(m) +} + +var xxx_messageInfo_Feed proto.InternalMessageInfo + +func (m *Feed) GetFeedName() string { + if m != nil { + return m.FeedName + } + return "" +} + +func (m *Feed) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *Feed) GetAggregateFunc() string { + if m != nil { + return m.AggregateFunc + } + return "" +} + +func (m *Feed) GetValueJsonPath() string { + if m != nil { + return m.ValueJsonPath + } + return "" +} + +func (m *Feed) GetLatestHistory() uint64 { + if m != nil { + return m.LatestHistory + } + return 0 +} + +func (m *Feed) GetRequestContextID() string { + if m != nil { + return m.RequestContextID + } + return "" +} + +func (m *Feed) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +// FeedValue defines the feed result standard +type FeedValue struct { + Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"` +} + +func (m *FeedValue) Reset() { *m = FeedValue{} } +func (m *FeedValue) String() string { return proto.CompactTextString(m) } +func (*FeedValue) ProtoMessage() {} +func (*FeedValue) Descriptor() ([]byte, []int) { + return fileDescriptor_dc470b50b143d488, []int{1} +} +func (m *FeedValue) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FeedValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FeedValue.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 *FeedValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_FeedValue.Merge(m, src) +} +func (m *FeedValue) XXX_Size() int { + return m.Size() +} +func (m *FeedValue) XXX_DiscardUnknown() { + xxx_messageInfo_FeedValue.DiscardUnknown(m) +} + +var xxx_messageInfo_FeedValue proto.InternalMessageInfo + +func (m *FeedValue) GetData() string { + if m != nil { + return m.Data + } + return "" +} + +func (m *FeedValue) GetTimestamp() time.Time { + if m != nil { + return m.Timestamp + } + return time.Time{} +} + +func init() { + proto.RegisterType((*Feed)(nil), "irismod.oracle.Feed") + proto.RegisterType((*FeedValue)(nil), "irismod.oracle.FeedValue") +} + +func init() { proto.RegisterFile("oracle/oracle.proto", fileDescriptor_dc470b50b143d488) } + +var fileDescriptor_dc470b50b143d488 = []byte{ + // 456 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x52, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0x8d, 0x69, 0x68, 0x9b, 0xad, 0x52, 0xa2, 0xa5, 0x20, 0x37, 0x07, 0x3b, 0xf2, 0xa9, 0x97, + 0xda, 0x14, 0x6e, 0x9c, 0x90, 0x41, 0x15, 0xf4, 0x80, 0x90, 0x85, 0x38, 0x70, 0xb1, 0x36, 0xde, + 0xc9, 0xda, 0x60, 0x7b, 0xc2, 0xee, 0x1a, 0xd1, 0xbf, 0xe8, 0x17, 0xf0, 0x3d, 0x3d, 0xf6, 0xc8, + 0xc9, 0xa0, 0xe4, 0x0f, 0xf2, 0x05, 0xc8, 0xbb, 0x24, 0x24, 0x70, 0xda, 0x99, 0xf7, 0xde, 0x3c, + 0x8f, 0xf7, 0x2d, 0x79, 0x88, 0x92, 0x65, 0x25, 0x44, 0xf6, 0x08, 0xe7, 0x12, 0x35, 0xd2, 0xe3, + 0x42, 0x16, 0xaa, 0x42, 0x1e, 0x5a, 0x74, 0x7c, 0x22, 0x50, 0xa0, 0xa1, 0xa2, 0xae, 0xb2, 0xaa, + 0xb1, 0x2f, 0x10, 0x45, 0x09, 0x91, 0xe9, 0xa6, 0xcd, 0x2c, 0xd2, 0x45, 0x05, 0x4a, 0xb3, 0x6a, + 0x6e, 0x05, 0xc1, 0xf7, 0x3d, 0xd2, 0xbf, 0x04, 0xe0, 0xf4, 0x82, 0x0c, 0x66, 0x00, 0x3c, 0xad, + 0x59, 0x05, 0xae, 0x33, 0x71, 0xce, 0x06, 0xf1, 0xc9, 0xaa, 0xf5, 0x47, 0xd7, 0xac, 0x2a, 0x9f, + 0x07, 0x1b, 0x2a, 0x48, 0x0e, 0xbb, 0xfa, 0x2d, 0xab, 0x80, 0x4e, 0xc8, 0x11, 0x07, 0x95, 0xc9, + 0x62, 0xae, 0x0b, 0xac, 0xdd, 0x7b, 0xdd, 0x50, 0xb2, 0x0d, 0xd1, 0x17, 0xe4, 0x98, 0x09, 0x21, + 0x41, 0x30, 0x0d, 0xe9, 0xac, 0xa9, 0x33, 0x77, 0xcf, 0x38, 0x9f, 0xae, 0x5a, 0xff, 0x91, 0x75, + 0xde, 0xe5, 0x83, 0x64, 0xb8, 0x01, 0x2e, 0x9b, 0x3a, 0xa3, 0x31, 0x79, 0xf0, 0x95, 0x95, 0x0d, + 0xa4, 0x9f, 0x14, 0xd6, 0xe9, 0x9c, 0xe9, 0xdc, 0xed, 0x1b, 0x8b, 0xf1, 0xaa, 0xf5, 0x1f, 0x5b, + 0x8b, 0x7f, 0x04, 0x41, 0x32, 0x34, 0xc8, 0x95, 0xc2, 0xfa, 0x1d, 0xd3, 0x79, 0xb7, 0x45, 0xc9, + 0x34, 0x28, 0x9d, 0xe6, 0x85, 0xd2, 0x28, 0xaf, 0xdd, 0xfb, 0x13, 0xe7, 0xac, 0xbf, 0xbd, 0xc5, + 0x2e, 0x1f, 0x24, 0x43, 0x0b, 0xbc, 0xb6, 0x3d, 0x4d, 0x09, 0x95, 0xf0, 0xa5, 0xe9, 0x24, 0x19, + 0xd6, 0x1a, 0xbe, 0xe9, 0xb4, 0xe0, 0xee, 0xbe, 0x59, 0xe4, 0x62, 0xd1, 0xfa, 0xa3, 0xc4, 0xb2, + 0x2f, 0x2d, 0xf9, 0xe6, 0xd5, 0xaa, 0xf5, 0x4f, 0xad, 0xf3, 0xff, 0x73, 0x41, 0x32, 0x92, 0xbb, + 0x72, 0x4e, 0x5d, 0x72, 0x90, 0x49, 0x60, 0x1a, 0xa5, 0x7b, 0x60, 0xae, 0x71, 0xdd, 0x06, 0x19, + 0x19, 0x74, 0xf9, 0x7c, 0xe8, 0xfe, 0x88, 0x52, 0xd2, 0xe7, 0x4c, 0x33, 0x9b, 0x4f, 0x62, 0x6a, + 0x1a, 0x93, 0xc1, 0x26, 0x54, 0x93, 0xc1, 0xd1, 0xd3, 0x71, 0x68, 0x63, 0x0f, 0xd7, 0xb1, 0x87, + 0xef, 0xd7, 0x8a, 0xf8, 0xf0, 0xb6, 0xf5, 0x7b, 0x37, 0x3f, 0x7d, 0x27, 0xf9, 0x3b, 0x16, 0x5f, + 0xdd, 0x2e, 0x3c, 0xe7, 0x6e, 0xe1, 0x39, 0xbf, 0x16, 0x9e, 0x73, 0xb3, 0xf4, 0x7a, 0x77, 0x4b, + 0xaf, 0xf7, 0x63, 0xe9, 0xf5, 0x3e, 0x3e, 0x11, 0x85, 0xce, 0x9b, 0x69, 0x98, 0x61, 0x15, 0x75, + 0x2f, 0xae, 0x06, 0x6d, 0xce, 0xbc, 0x99, 0x9e, 0x2b, 0xfe, 0xf9, 0x5c, 0x60, 0x54, 0x21, 0x6f, + 0x4a, 0x50, 0x7f, 0x9e, 0xe7, 0x74, 0xdf, 0x7c, 0xf4, 0xd9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x07, 0xc2, 0x17, 0x7c, 0xb6, 0x02, 0x00, 0x00, +} + +func (m *Feed) 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 *Feed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Feed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x3a + } + if len(m.RequestContextID) > 0 { + i -= len(m.RequestContextID) + copy(dAtA[i:], m.RequestContextID) + i = encodeVarintOracle(dAtA, i, uint64(len(m.RequestContextID))) + i-- + dAtA[i] = 0x32 + } + if m.LatestHistory != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.LatestHistory)) + i-- + dAtA[i] = 0x28 + } + if len(m.ValueJsonPath) > 0 { + i -= len(m.ValueJsonPath) + copy(dAtA[i:], m.ValueJsonPath) + i = encodeVarintOracle(dAtA, i, uint64(len(m.ValueJsonPath))) + i-- + dAtA[i] = 0x22 + } + if len(m.AggregateFunc) > 0 { + i -= len(m.AggregateFunc) + copy(dAtA[i:], m.AggregateFunc) + i = encodeVarintOracle(dAtA, i, uint64(len(m.AggregateFunc))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.FeedName) > 0 { + i -= len(m.FeedName) + copy(dAtA[i:], m.FeedName) + i = encodeVarintOracle(dAtA, i, uint64(len(m.FeedName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FeedValue) 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 *FeedValue) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FeedValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintOracle(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x12 + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintOracle(dAtA []byte, offset int, v uint64) int { + offset -= sovOracle(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Feed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeedName) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.AggregateFunc) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.ValueJsonPath) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.LatestHistory != 0 { + n += 1 + sovOracle(uint64(m.LatestHistory)) + } + l = len(m.RequestContextID) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func (m *FeedValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + n += 1 + l + sovOracle(uint64(l)) + return n +} + +func sovOracle(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozOracle(x uint64) (n int) { + return sovOracle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Feed) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Feed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Feed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeedName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregateFunc", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AggregateFunc = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueJsonPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValueJsonPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestHistory", wireType) + } + m.LatestHistory = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestHistory |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestContextID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + 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 ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FeedValue) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FeedValue: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FeedValue: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipOracle(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, ErrIntOverflowOracle + } + 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, ErrIntOverflowOracle + } + 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, ErrIntOverflowOracle + } + 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, ErrInvalidLengthOracle + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOracle + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthOracle + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthOracle = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOracle = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOracle = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/oracle/query.pb.go b/module-sdk/oracle/query.pb.go new file mode 100644 index 00000000..af56f5c4 --- /dev/null +++ b/module-sdk/oracle/query.pb.go @@ -0,0 +1,1958 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/query.proto + +package oracle + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + service "github.com/irisnet/module-sdk/service" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + _ "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 + +// QueryFeedRequest is request type for the Query/Feed RPC method +type QueryFeedRequest struct { + FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty"` +} + +func (m *QueryFeedRequest) Reset() { *m = QueryFeedRequest{} } +func (m *QueryFeedRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFeedRequest) ProtoMessage() {} +func (*QueryFeedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{0} +} +func (m *QueryFeedRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedRequest.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 *QueryFeedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedRequest.Merge(m, src) +} +func (m *QueryFeedRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedRequest proto.InternalMessageInfo + +func (m *QueryFeedRequest) GetFeedName() string { + if m != nil { + return m.FeedName + } + return "" +} + +// QueryFeedResponse is response type for the Query/Feed RPC method +type QueryFeedResponse struct { + Feed FeedContext `protobuf:"bytes,1,opt,name=feed,proto3" json:"feed"` +} + +func (m *QueryFeedResponse) Reset() { *m = QueryFeedResponse{} } +func (m *QueryFeedResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFeedResponse) ProtoMessage() {} +func (*QueryFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{1} +} +func (m *QueryFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedResponse.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 *QueryFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedResponse.Merge(m, src) +} +func (m *QueryFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedResponse proto.InternalMessageInfo + +func (m *QueryFeedResponse) GetFeed() FeedContext { + if m != nil { + return m.Feed + } + return FeedContext{} +} + +// QueryFeedsRequest is request type for the Query/Feeds RPC method +type QueryFeedsRequest struct { + State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` +} + +func (m *QueryFeedsRequest) Reset() { *m = QueryFeedsRequest{} } +func (m *QueryFeedsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFeedsRequest) ProtoMessage() {} +func (*QueryFeedsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{2} +} +func (m *QueryFeedsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedsRequest.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 *QueryFeedsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedsRequest.Merge(m, src) +} +func (m *QueryFeedsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedsRequest proto.InternalMessageInfo + +func (m *QueryFeedsRequest) GetState() string { + if m != nil { + return m.State + } + return "" +} + +// QueryFeedsResponse is response type for the Query/Feeds RPC method +type QueryFeedsResponse struct { + Feeds []FeedContext `protobuf:"bytes,1,rep,name=feeds,proto3" json:"feeds"` +} + +func (m *QueryFeedsResponse) Reset() { *m = QueryFeedsResponse{} } +func (m *QueryFeedsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFeedsResponse) ProtoMessage() {} +func (*QueryFeedsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{3} +} +func (m *QueryFeedsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedsResponse.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 *QueryFeedsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedsResponse.Merge(m, src) +} +func (m *QueryFeedsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedsResponse proto.InternalMessageInfo + +func (m *QueryFeedsResponse) GetFeeds() []FeedContext { + if m != nil { + return m.Feeds + } + return nil +} + +// QueryFeedValueRequest is request type for the Query/FeedValue RPC method +type QueryFeedValueRequest struct { + FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty"` +} + +func (m *QueryFeedValueRequest) Reset() { *m = QueryFeedValueRequest{} } +func (m *QueryFeedValueRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFeedValueRequest) ProtoMessage() {} +func (*QueryFeedValueRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{4} +} +func (m *QueryFeedValueRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedValueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedValueRequest.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 *QueryFeedValueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedValueRequest.Merge(m, src) +} +func (m *QueryFeedValueRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedValueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedValueRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedValueRequest proto.InternalMessageInfo + +func (m *QueryFeedValueRequest) GetFeedName() string { + if m != nil { + return m.FeedName + } + return "" +} + +// QueryFeedValueResponse is response type for the Query/FeedValue RPC method +type QueryFeedValueResponse struct { + FeedValues []FeedValue `protobuf:"bytes,1,rep,name=feed_values,json=feedValues,proto3" json:"feed_values"` +} + +func (m *QueryFeedValueResponse) Reset() { *m = QueryFeedValueResponse{} } +func (m *QueryFeedValueResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFeedValueResponse) ProtoMessage() {} +func (*QueryFeedValueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{5} +} +func (m *QueryFeedValueResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeedValueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeedValueResponse.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 *QueryFeedValueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeedValueResponse.Merge(m, src) +} +func (m *QueryFeedValueResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFeedValueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeedValueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeedValueResponse proto.InternalMessageInfo + +func (m *QueryFeedValueResponse) GetFeedValues() []FeedValue { + if m != nil { + return m.FeedValues + } + return nil +} + +// FeedContext defines the feed context struct +type FeedContext struct { + Feed *Feed `protobuf:"bytes,1,opt,name=feed,proto3" json:"feed,omitempty"` + ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Providers []string `protobuf:"bytes,3,rep,name=providers,proto3" json:"providers,omitempty"` + Input string `protobuf:"bytes,4,opt,name=input,proto3" json:"input,omitempty"` + Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` + RepeatedFrequency uint64 `protobuf:"varint,7,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` + ResponseThreshold uint32 `protobuf:"varint,8,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` + State service.RequestContextState `protobuf:"varint,9,opt,name=state,proto3,enum=irismod.service.RequestContextState" json:"state,omitempty"` +} + +func (m *FeedContext) Reset() { *m = FeedContext{} } +func (*FeedContext) ProtoMessage() {} +func (*FeedContext) Descriptor() ([]byte, []int) { + return fileDescriptor_562b782cb9ac197e, []int{6} +} +func (m *FeedContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FeedContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FeedContext.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 *FeedContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_FeedContext.Merge(m, src) +} +func (m *FeedContext) XXX_Size() int { + return m.Size() +} +func (m *FeedContext) XXX_DiscardUnknown() { + xxx_messageInfo_FeedContext.DiscardUnknown(m) +} + +var xxx_messageInfo_FeedContext proto.InternalMessageInfo + +func (m *FeedContext) GetFeed() *Feed { + if m != nil { + return m.Feed + } + return nil +} + +func (m *FeedContext) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +func (m *FeedContext) GetProviders() []string { + if m != nil { + return m.Providers + } + return nil +} + +func (m *FeedContext) GetInput() string { + if m != nil { + return m.Input + } + return "" +} + +func (m *FeedContext) GetTimeout() int64 { + if m != nil { + return m.Timeout + } + return 0 +} + +func (m *FeedContext) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { + if m != nil { + return m.ServiceFeeCap + } + return nil +} + +func (m *FeedContext) GetRepeatedFrequency() uint64 { + if m != nil { + return m.RepeatedFrequency + } + return 0 +} + +func (m *FeedContext) GetResponseThreshold() uint32 { + if m != nil { + return m.ResponseThreshold + } + return 0 +} + +func (m *FeedContext) GetState() service.RequestContextState { + if m != nil { + return m.State + } + return service.RUNNING +} + +func init() { + proto.RegisterType((*QueryFeedRequest)(nil), "irismod.oracle.QueryFeedRequest") + proto.RegisterType((*QueryFeedResponse)(nil), "irismod.oracle.QueryFeedResponse") + proto.RegisterType((*QueryFeedsRequest)(nil), "irismod.oracle.QueryFeedsRequest") + proto.RegisterType((*QueryFeedsResponse)(nil), "irismod.oracle.QueryFeedsResponse") + proto.RegisterType((*QueryFeedValueRequest)(nil), "irismod.oracle.QueryFeedValueRequest") + proto.RegisterType((*QueryFeedValueResponse)(nil), "irismod.oracle.QueryFeedValueResponse") + proto.RegisterType((*FeedContext)(nil), "irismod.oracle.FeedContext") +} + +func init() { proto.RegisterFile("oracle/query.proto", fileDescriptor_562b782cb9ac197e) } + +var fileDescriptor_562b782cb9ac197e = []byte{ + // 745 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xbd, 0x6f, 0xdb, 0x38, + 0x1c, 0xb5, 0x62, 0x3b, 0x89, 0xe9, 0x4b, 0xee, 0xc2, 0x7c, 0x29, 0x4e, 0x62, 0x2b, 0xba, 0x0f, + 0x28, 0x07, 0x44, 0x4a, 0x72, 0x77, 0x38, 0xc0, 0xd3, 0xc1, 0x01, 0x32, 0x04, 0xf7, 0x81, 0x53, + 0x8b, 0x0e, 0x59, 0x0c, 0xd9, 0xfa, 0xd9, 0x16, 0x6a, 0x89, 0x8a, 0x48, 0x19, 0x35, 0x8a, 0x2e, + 0x9d, 0x3b, 0x14, 0xed, 0xd2, 0xb1, 0x73, 0xe7, 0xfe, 0x11, 0x19, 0x03, 0x74, 0xe9, 0xe4, 0x16, + 0x49, 0xff, 0x82, 0xec, 0x05, 0x0a, 0x8a, 0x94, 0x6b, 0xbb, 0xf9, 0x9a, 0x28, 0xfe, 0xf8, 0xf8, + 0xde, 0x8f, 0xe4, 0x7b, 0x42, 0x98, 0x44, 0x4e, 0xb3, 0x0b, 0xd6, 0x49, 0x0c, 0x51, 0xdf, 0x0c, + 0x23, 0xc2, 0x08, 0x9e, 0xf7, 0x22, 0x8f, 0xfa, 0xc4, 0x35, 0xc5, 0x5a, 0x69, 0x51, 0x62, 0xc4, + 0x20, 0x40, 0xa5, 0x65, 0x0a, 0x51, 0xcf, 0x6b, 0x82, 0x25, 0x47, 0x59, 0x5e, 0x6a, 0x93, 0x36, + 0x49, 0x3e, 0x2d, 0xfe, 0x25, 0xab, 0x1b, 0x6d, 0x42, 0xda, 0x5d, 0xb0, 0x9c, 0xd0, 0xb3, 0x9c, + 0x20, 0x20, 0xcc, 0x61, 0x1e, 0x09, 0xa8, 0x5c, 0x2d, 0x37, 0x09, 0xf5, 0x09, 0xb5, 0x1a, 0x0e, + 0x05, 0xab, 0xb7, 0xd7, 0x00, 0xe6, 0xec, 0x59, 0x4d, 0xe2, 0x05, 0x62, 0x5d, 0xb7, 0xd0, 0x0f, + 0xff, 0xf3, 0xf6, 0x0e, 0x01, 0x5c, 0x1b, 0x4e, 0x62, 0xa0, 0x0c, 0xaf, 0xa3, 0x42, 0x0b, 0xc0, + 0xad, 0x07, 0x8e, 0x0f, 0xaa, 0xa2, 0x29, 0x46, 0xc1, 0x9e, 0xe5, 0x85, 0x7f, 0x1d, 0x1f, 0xf4, + 0x23, 0xb4, 0x30, 0xb2, 0x81, 0x86, 0x24, 0xa0, 0x80, 0xff, 0x40, 0x39, 0x0e, 0x48, 0xc0, 0xc5, + 0xfd, 0x75, 0x73, 0xfc, 0x90, 0x26, 0xc7, 0x1e, 0x90, 0x80, 0xc1, 0x23, 0x56, 0xcb, 0x9d, 0x0e, + 0x2a, 0x19, 0x3b, 0x81, 0xeb, 0xdb, 0x23, 0x5c, 0x34, 0x55, 0x5f, 0x42, 0x79, 0xca, 0x1c, 0x96, + 0x2a, 0x8b, 0x89, 0xfe, 0x0f, 0xc2, 0xa3, 0x50, 0xa9, 0xfb, 0x27, 0xca, 0x73, 0x22, 0xaa, 0x2a, + 0x5a, 0xf6, 0x6e, 0xc2, 0x02, 0xaf, 0xff, 0x8e, 0x96, 0x87, 0x74, 0x0f, 0x9c, 0x6e, 0x0c, 0x77, + 0x3a, 0xfb, 0x31, 0x5a, 0x99, 0xdc, 0x25, 0x1b, 0xf9, 0x0b, 0x15, 0x93, 0x6d, 0x3d, 0x5e, 0x4d, + 0xdb, 0x59, 0xbb, 0xaa, 0x9d, 0x64, 0x9f, 0x6c, 0x06, 0xb5, 0xd2, 0x02, 0xd5, 0xdf, 0xe6, 0x50, + 0x71, 0xa4, 0x5d, 0x6c, 0x8c, 0x5d, 0xe9, 0xd2, 0x55, 0x54, 0xe2, 0x16, 0x71, 0x15, 0x7d, 0x27, + 0x7d, 0x22, 0xba, 0x9e, 0xe2, 0x5d, 0xd7, 0x56, 0x2f, 0x07, 0x95, 0xc5, 0xbe, 0xe3, 0x77, 0xab, + 0xfa, 0xe8, 0xaa, 0x6e, 0x17, 0xe5, 0x94, 0x9f, 0x08, 0x6f, 0xa0, 0x42, 0x18, 0x91, 0x9e, 0xe7, + 0x42, 0x44, 0xd5, 0xac, 0x96, 0x35, 0x0a, 0xf6, 0xd7, 0x02, 0x7f, 0x0a, 0x2f, 0x08, 0x63, 0xa6, + 0xe6, 0xc4, 0x53, 0x24, 0x13, 0xac, 0xa2, 0x19, 0xe6, 0xf9, 0x40, 0x62, 0xa6, 0xe6, 0x35, 0xc5, + 0xc8, 0xda, 0xe9, 0x14, 0xbf, 0x50, 0xd0, 0xf7, 0xa9, 0x58, 0x0b, 0xa0, 0xde, 0x74, 0x42, 0x75, + 0x5a, 0x5e, 0x85, 0xf0, 0xa1, 0xc9, 0x7d, 0x68, 0x4a, 0x1f, 0x9a, 0x07, 0xc4, 0x0b, 0x6a, 0xff, + 0xf1, 0xab, 0xb8, 0x1c, 0x54, 0x56, 0xc6, 0x9b, 0x95, 0xfb, 0xf5, 0x37, 0x1f, 0x2a, 0x3b, 0x6d, + 0x8f, 0x75, 0xe2, 0x86, 0xd9, 0x24, 0xbe, 0xc5, 0xaf, 0x21, 0x00, 0x96, 0x8c, 0x9d, 0xb8, 0xb1, + 0x43, 0xdd, 0x87, 0x3b, 0x6d, 0x62, 0xb1, 0x7e, 0x08, 0x34, 0xe1, 0xa3, 0xf6, 0x9c, 0xa4, 0x38, + 0x04, 0x38, 0x70, 0x42, 0xfc, 0x37, 0xc2, 0x11, 0x84, 0xe0, 0x30, 0x70, 0xeb, 0xad, 0x88, 0x3f, + 0x73, 0xd0, 0xec, 0xab, 0x33, 0x9a, 0x62, 0xe4, 0x6a, 0x9b, 0x97, 0x83, 0xca, 0x9a, 0xd0, 0xfd, + 0x16, 0xa3, 0xdb, 0x0b, 0x69, 0xf1, 0x30, 0xad, 0x09, 0x36, 0xf1, 0xe8, 0x75, 0xd6, 0x89, 0x80, + 0x76, 0x48, 0xd7, 0x55, 0x67, 0x35, 0xc5, 0x98, 0x1b, 0x67, 0x9b, 0xc4, 0x24, 0x6c, 0xa2, 0x78, + 0x3f, 0xad, 0xe1, 0x6a, 0xea, 0xf5, 0x82, 0xa6, 0x18, 0xf3, 0xfb, 0x3f, 0x0d, 0x5f, 0x39, 0x0d, + 0xbe, 0xb4, 0xa5, 0x34, 0xc5, 0x3d, 0x8e, 0x95, 0x89, 0xa8, 0xe6, 0x5e, 0xbd, 0xae, 0x64, 0xf6, + 0x3f, 0x4f, 0xa1, 0x7c, 0xe2, 0x49, 0xdc, 0x43, 0x39, 0x6e, 0x0a, 0xac, 0x4d, 0x5a, 0x65, 0x32, + 0xdf, 0xa5, 0xad, 0x1b, 0x10, 0xa2, 0x43, 0x7d, 0xfb, 0xe9, 0xbb, 0x4f, 0x2f, 0xa7, 0x7e, 0xc4, + 0x5b, 0x96, 0x84, 0xca, 0x1f, 0x94, 0x95, 0xc4, 0xc7, 0x7a, 0x3c, 0xcc, 0xc8, 0x13, 0xec, 0xa3, + 0x7c, 0x12, 0x4a, 0x7c, 0x3d, 0x6d, 0x9a, 0xed, 0x92, 0x7e, 0x13, 0x44, 0x4a, 0x6f, 0x26, 0xd2, + 0xab, 0x78, 0xf9, 0x4a, 0x69, 0xfc, 0x4c, 0x41, 0x85, 0x61, 0x8e, 0xf0, 0xcf, 0xd7, 0x12, 0x8e, + 0xa6, 0xba, 0xf4, 0xcb, 0x6d, 0x30, 0xa9, 0xbd, 0x9b, 0x68, 0xff, 0x8a, 0x8d, 0x5b, 0x8f, 0x6d, + 0x89, 0xa4, 0xd7, 0x8e, 0x4e, 0xcf, 0xcb, 0xca, 0xd9, 0x79, 0x59, 0xf9, 0x78, 0x5e, 0x56, 0x9e, + 0x5f, 0x94, 0x33, 0x67, 0x17, 0xe5, 0xcc, 0xfb, 0x8b, 0x72, 0xe6, 0x78, 0xf7, 0x76, 0xd7, 0xfa, + 0xc4, 0x8d, 0xbb, 0x40, 0xa5, 0x48, 0x63, 0x3a, 0xf9, 0x25, 0xff, 0xf6, 0x25, 0x00, 0x00, 0xff, + 0xff, 0xb7, 0xe1, 0x19, 0x0d, 0x38, 0x06, 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 { + // Feed queries the feed + Feed(ctx context.Context, in *QueryFeedRequest, opts ...grpc.CallOption) (*QueryFeedResponse, error) + // QueryFeedsRequest queries the feed list + Feeds(ctx context.Context, in *QueryFeedsRequest, opts ...grpc.CallOption) (*QueryFeedsResponse, error) + // FeedValue queries the feed value + FeedValue(ctx context.Context, in *QueryFeedValueRequest, opts ...grpc.CallOption) (*QueryFeedValueResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Feed(ctx context.Context, in *QueryFeedRequest, opts ...grpc.CallOption) (*QueryFeedResponse, error) { + out := new(QueryFeedResponse) + err := c.cc.Invoke(ctx, "/irismod.oracle.Query/Feed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Feeds(ctx context.Context, in *QueryFeedsRequest, opts ...grpc.CallOption) (*QueryFeedsResponse, error) { + out := new(QueryFeedsResponse) + err := c.cc.Invoke(ctx, "/irismod.oracle.Query/Feeds", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) FeedValue(ctx context.Context, in *QueryFeedValueRequest, opts ...grpc.CallOption) (*QueryFeedValueResponse, error) { + out := new(QueryFeedValueResponse) + err := c.cc.Invoke(ctx, "/irismod.oracle.Query/FeedValue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Feed queries the feed + Feed(context.Context, *QueryFeedRequest) (*QueryFeedResponse, error) + // QueryFeedsRequest queries the feed list + Feeds(context.Context, *QueryFeedsRequest) (*QueryFeedsResponse, error) + // FeedValue queries the feed value + FeedValue(context.Context, *QueryFeedValueRequest) (*QueryFeedValueResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Feed(ctx context.Context, req *QueryFeedRequest) (*QueryFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Feed not implemented") +} +func (*UnimplementedQueryServer) Feeds(ctx context.Context, req *QueryFeedsRequest) (*QueryFeedsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Feeds not implemented") +} +func (*UnimplementedQueryServer) FeedValue(ctx context.Context, req *QueryFeedValueRequest) (*QueryFeedValueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FeedValue not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Feed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFeedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Feed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.oracle.Query/Feed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Feed(ctx, req.(*QueryFeedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Feeds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFeedsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Feeds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.oracle.Query/Feeds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Feeds(ctx, req.(*QueryFeedsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_FeedValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFeedValueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).FeedValue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.oracle.Query/FeedValue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).FeedValue(ctx, req.(*QueryFeedValueRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.oracle.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Feed", + Handler: _Query_Feed_Handler, + }, + { + MethodName: "Feeds", + Handler: _Query_Feeds_Handler, + }, + { + MethodName: "FeedValue", + Handler: _Query_FeedValue_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "oracle/query.proto", +} + +func (m *QueryFeedRequest) 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 *QueryFeedRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeedName) > 0 { + i -= len(m.FeedName) + copy(dAtA[i:], m.FeedName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FeedName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFeedResponse) 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 *QueryFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Feed.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 *QueryFeedsRequest) 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 *QueryFeedsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintQuery(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFeedsResponse) 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 *QueryFeedsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Feeds) > 0 { + for iNdEx := len(m.Feeds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Feeds[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 *QueryFeedValueRequest) 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 *QueryFeedValueRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedValueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeedName) > 0 { + i -= len(m.FeedName) + copy(dAtA[i:], m.FeedName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.FeedName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFeedValueResponse) 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 *QueryFeedValueResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeedValueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeedValues) > 0 { + for iNdEx := len(m.FeedValues) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeedValues[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 *FeedContext) 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 *FeedContext) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FeedContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.State != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x48 + } + if m.ResponseThreshold != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ResponseThreshold)) + i-- + dAtA[i] = 0x40 + } + if m.RepeatedFrequency != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.RepeatedFrequency)) + i-- + dAtA[i] = 0x38 + } + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.Timeout != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Timeout)) + i-- + dAtA[i] = 0x28 + } + if len(m.Input) > 0 { + i -= len(m.Input) + copy(dAtA[i:], m.Input) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Input))) + i-- + dAtA[i] = 0x22 + } + if len(m.Providers) > 0 { + for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Providers[iNdEx]) + copy(dAtA[i:], m.Providers[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Providers[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0x12 + } + if m.Feed != nil { + { + size, err := m.Feed.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 *QueryFeedRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeedName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Feed.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryFeedsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.State) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFeedsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Feeds) > 0 { + for _, e := range m.Feeds { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryFeedValueRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeedName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFeedValueResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.FeedValues) > 0 { + for _, e := range m.FeedValues { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *FeedContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Feed != nil { + l = m.Feed.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if len(m.Providers) > 0 { + for _, s := range m.Providers { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + l = len(m.Input) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Timeout != 0 { + n += 1 + sovQuery(uint64(m.Timeout)) + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.RepeatedFrequency != 0 { + n += 1 + sovQuery(uint64(m.RepeatedFrequency)) + } + if m.ResponseThreshold != 0 { + n += 1 + sovQuery(uint64(m.ResponseThreshold)) + } + if m.State != 0 { + n += 1 + sovQuery(uint64(m.State)) + } + 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 *QueryFeedRequest) 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: QueryFeedRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeedResponse) 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: QueryFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Feed", 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.Feed.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeedsRequest) 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: QueryFeedsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", 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.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeedsResponse) 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: QueryFeedsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Feeds", 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.Feeds = append(m.Feeds, FeedContext{}) + if err := m.Feeds[len(m.Feeds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeedValueRequest) 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: QueryFeedValueRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedValueRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeedValueResponse) 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: QueryFeedValueResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeedValueResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedValues", 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.FeedValues = append(m.FeedValues, FeedValue{}) + if err := m.FeedValues[len(m.FeedValues)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FeedContext) 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: FeedContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FeedContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Feed", 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.Feed == nil { + m.Feed = &Feed{} + } + if err := m.Feed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + m.Timeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", 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.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) + } + m.RepeatedFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedFrequency |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) + } + m.ResponseThreshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResponseThreshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + 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 ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= service.RequestContextState(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (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/module-sdk/oracle/tx.pb.go b/module-sdk/oracle/tx.pb.go new file mode 100644 index 00000000..ef598851 --- /dev/null +++ b/module-sdk/oracle/tx.pb.go @@ -0,0 +1,2598 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: oracle/tx.proto + +package oracle + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + 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 + +// MsgCreateFeed defines an sdk.Msg type that supports creating a feed +type MsgCreateFeed struct { + FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` + LatestHistory uint64 `protobuf:"varint,2,opt,name=latest_history,json=latestHistory,proto3" json:"latest_history,omitempty" yaml:"latest_history"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` + ServiceName string `protobuf:"bytes,5,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Providers []string `protobuf:"bytes,6,rep,name=providers,proto3" json:"providers,omitempty"` + Input string `protobuf:"bytes,7,opt,name=input,proto3" json:"input,omitempty"` + Timeout int64 `protobuf:"varint,8,opt,name=timeout,proto3" json:"timeout,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,9,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` + RepeatedFrequency uint64 `protobuf:"varint,10,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` + AggregateFunc string `protobuf:"bytes,11,opt,name=aggregate_func,json=aggregateFunc,proto3" json:"aggregate_func,omitempty" yaml:"aggregate_func"` + ValueJsonPath string `protobuf:"bytes,12,opt,name=value_json_path,json=valueJsonPath,proto3" json:"value_json_path,omitempty" yaml:"value_json_path"` + ResponseThreshold uint32 `protobuf:"varint,13,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` +} + +func (m *MsgCreateFeed) Reset() { *m = MsgCreateFeed{} } +func (m *MsgCreateFeed) String() string { return proto.CompactTextString(m) } +func (*MsgCreateFeed) ProtoMessage() {} +func (*MsgCreateFeed) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{0} +} +func (m *MsgCreateFeed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateFeed.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 *MsgCreateFeed) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateFeed.Merge(m, src) +} +func (m *MsgCreateFeed) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateFeed) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateFeed.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateFeed proto.InternalMessageInfo + +func (m *MsgCreateFeed) GetFeedName() string { + if m != nil { + return m.FeedName + } + return "" +} + +func (m *MsgCreateFeed) GetLatestHistory() uint64 { + if m != nil { + return m.LatestHistory + } + return 0 +} + +func (m *MsgCreateFeed) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MsgCreateFeed) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreateFeed) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +func (m *MsgCreateFeed) GetProviders() []string { + if m != nil { + return m.Providers + } + return nil +} + +func (m *MsgCreateFeed) GetInput() string { + if m != nil { + return m.Input + } + return "" +} + +func (m *MsgCreateFeed) GetTimeout() int64 { + if m != nil { + return m.Timeout + } + return 0 +} + +func (m *MsgCreateFeed) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { + if m != nil { + return m.ServiceFeeCap + } + return nil +} + +func (m *MsgCreateFeed) GetRepeatedFrequency() uint64 { + if m != nil { + return m.RepeatedFrequency + } + return 0 +} + +func (m *MsgCreateFeed) GetAggregateFunc() string { + if m != nil { + return m.AggregateFunc + } + return "" +} + +func (m *MsgCreateFeed) GetValueJsonPath() string { + if m != nil { + return m.ValueJsonPath + } + return "" +} + +func (m *MsgCreateFeed) GetResponseThreshold() uint32 { + if m != nil { + return m.ResponseThreshold + } + return 0 +} + +// MsgCreateFeedResponse defines the Msg/CreateFeed response type. +type MsgCreateFeedResponse struct { +} + +func (m *MsgCreateFeedResponse) Reset() { *m = MsgCreateFeedResponse{} } +func (m *MsgCreateFeedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateFeedResponse) ProtoMessage() {} +func (*MsgCreateFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{1} +} +func (m *MsgCreateFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateFeedResponse.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 *MsgCreateFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateFeedResponse.Merge(m, src) +} +func (m *MsgCreateFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateFeedResponse proto.InternalMessageInfo + +// MsgPauseFeed defines an sdk.Msg type that supports stating a feed +type MsgStartFeed struct { + FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgStartFeed) Reset() { *m = MsgStartFeed{} } +func (m *MsgStartFeed) String() string { return proto.CompactTextString(m) } +func (*MsgStartFeed) ProtoMessage() {} +func (*MsgStartFeed) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{2} +} +func (m *MsgStartFeed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStartFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStartFeed.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 *MsgStartFeed) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStartFeed.Merge(m, src) +} +func (m *MsgStartFeed) XXX_Size() int { + return m.Size() +} +func (m *MsgStartFeed) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStartFeed.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStartFeed proto.InternalMessageInfo + +func (m *MsgStartFeed) GetFeedName() string { + if m != nil { + return m.FeedName + } + return "" +} + +func (m *MsgStartFeed) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +// MsgStartFeedResponse defines the Msg/StartFeed response type. +type MsgStartFeedResponse struct { +} + +func (m *MsgStartFeedResponse) Reset() { *m = MsgStartFeedResponse{} } +func (m *MsgStartFeedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgStartFeedResponse) ProtoMessage() {} +func (*MsgStartFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{3} +} +func (m *MsgStartFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStartFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStartFeedResponse.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 *MsgStartFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStartFeedResponse.Merge(m, src) +} +func (m *MsgStartFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgStartFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStartFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStartFeedResponse proto.InternalMessageInfo + +// MsgPauseFeed defines an sdk.Msg type that supports pausing a feed +type MsgPauseFeed struct { + FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgPauseFeed) Reset() { *m = MsgPauseFeed{} } +func (m *MsgPauseFeed) String() string { return proto.CompactTextString(m) } +func (*MsgPauseFeed) ProtoMessage() {} +func (*MsgPauseFeed) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{4} +} +func (m *MsgPauseFeed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPauseFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPauseFeed.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 *MsgPauseFeed) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPauseFeed.Merge(m, src) +} +func (m *MsgPauseFeed) XXX_Size() int { + return m.Size() +} +func (m *MsgPauseFeed) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPauseFeed.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPauseFeed proto.InternalMessageInfo + +func (m *MsgPauseFeed) GetFeedName() string { + if m != nil { + return m.FeedName + } + return "" +} + +func (m *MsgPauseFeed) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +// MsgPauseFeedResponse defines the Msg/PauseFeed response type. +type MsgPauseFeedResponse struct { +} + +func (m *MsgPauseFeedResponse) Reset() { *m = MsgPauseFeedResponse{} } +func (m *MsgPauseFeedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPauseFeedResponse) ProtoMessage() {} +func (*MsgPauseFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{5} +} +func (m *MsgPauseFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPauseFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPauseFeedResponse.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 *MsgPauseFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPauseFeedResponse.Merge(m, src) +} +func (m *MsgPauseFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPauseFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPauseFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPauseFeedResponse proto.InternalMessageInfo + +// MsgEditFeed defines an sdk.Msg type that supports editing a feed +type MsgEditFeed struct { + FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + LatestHistory uint64 `protobuf:"varint,3,opt,name=latest_history,json=latestHistory,proto3" json:"latest_history,omitempty" yaml:"latest_history"` + Providers []string `protobuf:"bytes,4,rep,name=providers,proto3" json:"providers,omitempty"` + Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` + RepeatedFrequency uint64 `protobuf:"varint,7,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` + ResponseThreshold uint32 `protobuf:"varint,8,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` + Creator string `protobuf:"bytes,9,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgEditFeed) Reset() { *m = MsgEditFeed{} } +func (m *MsgEditFeed) String() string { return proto.CompactTextString(m) } +func (*MsgEditFeed) ProtoMessage() {} +func (*MsgEditFeed) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{6} +} +func (m *MsgEditFeed) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditFeed.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 *MsgEditFeed) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditFeed.Merge(m, src) +} +func (m *MsgEditFeed) XXX_Size() int { + return m.Size() +} +func (m *MsgEditFeed) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditFeed.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditFeed proto.InternalMessageInfo + +func (m *MsgEditFeed) GetFeedName() string { + if m != nil { + return m.FeedName + } + return "" +} + +func (m *MsgEditFeed) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MsgEditFeed) GetLatestHistory() uint64 { + if m != nil { + return m.LatestHistory + } + return 0 +} + +func (m *MsgEditFeed) GetProviders() []string { + if m != nil { + return m.Providers + } + return nil +} + +func (m *MsgEditFeed) GetTimeout() int64 { + if m != nil { + return m.Timeout + } + return 0 +} + +func (m *MsgEditFeed) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { + if m != nil { + return m.ServiceFeeCap + } + return nil +} + +func (m *MsgEditFeed) GetRepeatedFrequency() uint64 { + if m != nil { + return m.RepeatedFrequency + } + return 0 +} + +func (m *MsgEditFeed) GetResponseThreshold() uint32 { + if m != nil { + return m.ResponseThreshold + } + return 0 +} + +func (m *MsgEditFeed) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +// MsgEditFeedResponse defines the Msg/EditFeed response type. +type MsgEditFeedResponse struct { +} + +func (m *MsgEditFeedResponse) Reset() { *m = MsgEditFeedResponse{} } +func (m *MsgEditFeedResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEditFeedResponse) ProtoMessage() {} +func (*MsgEditFeedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cb5390096518ffda, []int{7} +} +func (m *MsgEditFeedResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditFeedResponse.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 *MsgEditFeedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditFeedResponse.Merge(m, src) +} +func (m *MsgEditFeedResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEditFeedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditFeedResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditFeedResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateFeed)(nil), "irismod.oracle.MsgCreateFeed") + proto.RegisterType((*MsgCreateFeedResponse)(nil), "irismod.oracle.MsgCreateFeedResponse") + proto.RegisterType((*MsgStartFeed)(nil), "irismod.oracle.MsgStartFeed") + proto.RegisterType((*MsgStartFeedResponse)(nil), "irismod.oracle.MsgStartFeedResponse") + proto.RegisterType((*MsgPauseFeed)(nil), "irismod.oracle.MsgPauseFeed") + proto.RegisterType((*MsgPauseFeedResponse)(nil), "irismod.oracle.MsgPauseFeedResponse") + proto.RegisterType((*MsgEditFeed)(nil), "irismod.oracle.MsgEditFeed") + proto.RegisterType((*MsgEditFeedResponse)(nil), "irismod.oracle.MsgEditFeedResponse") +} + +func init() { proto.RegisterFile("oracle/tx.proto", fileDescriptor_cb5390096518ffda) } + +var fileDescriptor_cb5390096518ffda = []byte{ + // 764 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x6f, 0xda, 0x48, + 0x14, 0xc6, 0x40, 0x08, 0x0c, 0x21, 0xd9, 0x75, 0x48, 0xe2, 0xb0, 0x09, 0x20, 0xef, 0xae, 0xc4, + 0x25, 0xf6, 0x26, 0x7b, 0xcb, 0x69, 0x45, 0xb4, 0x68, 0x15, 0x85, 0x4d, 0xe4, 0xdd, 0x53, 0x7b, + 0xb0, 0x06, 0xfb, 0x61, 0xdc, 0x62, 0x8f, 0xeb, 0x19, 0xa3, 0x72, 0xec, 0x3f, 0xa8, 0xfa, 0x27, + 0x2a, 0xf5, 0x97, 0xa4, 0xb7, 0x1c, 0x7b, 0xa2, 0x55, 0xf2, 0x0f, 0xf8, 0x05, 0x95, 0x6d, 0x6c, + 0x6c, 0x40, 0x89, 0x8a, 0x54, 0xa9, 0x27, 0x7b, 0xde, 0xf7, 0xe6, 0xfb, 0xde, 0xf8, 0xbd, 0xcf, + 0x83, 0x76, 0x88, 0x8b, 0xb5, 0x21, 0xc8, 0xec, 0xb5, 0xe4, 0xb8, 0x84, 0x11, 0x7e, 0xdb, 0x74, + 0x4d, 0x6a, 0x11, 0x5d, 0x0a, 0x81, 0x5a, 0xd5, 0x20, 0x06, 0x09, 0x20, 0xd9, 0x7f, 0x0b, 0xb3, + 0x6a, 0x75, 0x8d, 0x50, 0x8b, 0x50, 0xb9, 0x87, 0x29, 0xc8, 0xa3, 0xd3, 0x1e, 0x30, 0x7c, 0x2a, + 0x6b, 0xc4, 0xb4, 0x43, 0x5c, 0x7c, 0x53, 0x40, 0x95, 0x2e, 0x35, 0x2e, 0x5c, 0xc0, 0x0c, 0x3a, + 0x00, 0x3a, 0x7f, 0x8a, 0x4a, 0x7d, 0x00, 0x5d, 0xb5, 0xb1, 0x05, 0x02, 0xd7, 0xe4, 0x5a, 0xa5, + 0x76, 0x75, 0x3a, 0x69, 0xfc, 0x34, 0xc6, 0xd6, 0xf0, 0x5c, 0x8c, 0x21, 0x51, 0x29, 0xfa, 0xef, + 0xff, 0x62, 0x0b, 0xf8, 0xbf, 0xd0, 0xf6, 0x10, 0x33, 0xa0, 0x4c, 0x1d, 0x98, 0x94, 0x11, 0x77, + 0x2c, 0x64, 0x9b, 0x5c, 0x2b, 0xdf, 0x3e, 0x9c, 0x4e, 0x1a, 0x7b, 0xe1, 0xbe, 0x34, 0x2e, 0x2a, + 0x95, 0x30, 0xf0, 0x4f, 0xb8, 0xe6, 0x9b, 0xa8, 0xac, 0x03, 0xd5, 0x5c, 0xd3, 0x61, 0x26, 0xb1, + 0x85, 0x9c, 0x2f, 0xab, 0x24, 0x43, 0xbc, 0x80, 0x36, 0x35, 0xbf, 0x48, 0xe2, 0x0a, 0xf9, 0x00, + 0x8d, 0x96, 0xfc, 0x39, 0xda, 0xa2, 0xe0, 0x8e, 0x4c, 0x0d, 0xc2, 0x9a, 0x37, 0x82, 0x9a, 0x0f, + 0xa6, 0x93, 0xc6, 0x6e, 0xa8, 0x9d, 0x44, 0x45, 0xa5, 0x3c, 0x5b, 0x06, 0x95, 0x1f, 0xa1, 0x92, + 0xe3, 0x92, 0x91, 0xa9, 0x83, 0x4b, 0x85, 0x42, 0x33, 0xd7, 0x2a, 0x29, 0xf3, 0x00, 0x5f, 0x45, + 0x1b, 0xa6, 0xed, 0x78, 0x4c, 0xd8, 0x0c, 0x14, 0xc3, 0x85, 0x5f, 0x09, 0x33, 0x2d, 0x20, 0x1e, + 0x13, 0x8a, 0x4d, 0xae, 0x95, 0x53, 0xa2, 0x25, 0xff, 0x8e, 0x43, 0x3b, 0x91, 0x58, 0x1f, 0x40, + 0xd5, 0xb0, 0x23, 0x94, 0x9a, 0xb9, 0x56, 0xf9, 0xec, 0x50, 0x0a, 0xfb, 0x20, 0xf9, 0x7d, 0x90, + 0x66, 0x7d, 0x90, 0x2e, 0x88, 0x69, 0xb7, 0xaf, 0x6f, 0x27, 0x8d, 0xcc, 0x74, 0xd2, 0xd8, 0x4f, + 0x17, 0x3b, 0xdb, 0x2f, 0x7e, 0xf8, 0xdc, 0x38, 0x31, 0x4c, 0x36, 0xf0, 0x7a, 0x92, 0x46, 0x2c, + 0xd9, 0x6f, 0xba, 0x0d, 0x2c, 0x78, 0x0e, 0xbc, 0xde, 0x09, 0xd5, 0x5f, 0x9e, 0x18, 0x44, 0x66, + 0x63, 0x07, 0x68, 0xc0, 0x47, 0x95, 0xca, 0x8c, 0xa2, 0x03, 0x70, 0x81, 0x1d, 0xfe, 0x0a, 0xf1, + 0x2e, 0x38, 0x7e, 0x7b, 0x75, 0xb5, 0xef, 0xc2, 0x2b, 0x0f, 0x6c, 0x6d, 0x2c, 0xa0, 0xa0, 0x41, + 0xc7, 0xd3, 0x49, 0xe3, 0x30, 0xd4, 0x5d, 0xce, 0x11, 0x95, 0x9f, 0xa3, 0x60, 0x27, 0x8a, 0xf9, + 0xad, 0xc6, 0x86, 0xe1, 0x82, 0x81, 0x19, 0xa8, 0x7d, 0xcf, 0xd6, 0x84, 0x72, 0xf0, 0xb9, 0x13, + 0xad, 0x4e, 0xe3, 0xa2, 0x52, 0x89, 0x03, 0x1d, 0xcf, 0xd6, 0xf8, 0x36, 0xda, 0x19, 0xe1, 0xa1, + 0x07, 0xea, 0x0b, 0x4a, 0x6c, 0xd5, 0xc1, 0x6c, 0x20, 0x6c, 0x05, 0x14, 0xb5, 0xf9, 0x47, 0x58, + 0x48, 0x10, 0x95, 0x4a, 0x10, 0xb9, 0xa4, 0xc4, 0xbe, 0xc1, 0x6c, 0x10, 0x9e, 0x89, 0x3a, 0xc4, + 0xa6, 0xa0, 0xb2, 0x81, 0x0b, 0x74, 0x40, 0x86, 0xba, 0x50, 0x69, 0x72, 0xad, 0x4a, 0xfa, 0x4c, + 0x8b, 0x39, 0xc1, 0x99, 0xc2, 0xe0, 0xff, 0x71, 0xec, 0x00, 0xed, 0xa5, 0x2c, 0xa0, 0xcc, 0x32, + 0xc4, 0xe7, 0x68, 0xab, 0x4b, 0x8d, 0xff, 0x18, 0x76, 0xd9, 0xba, 0xd6, 0x48, 0x8c, 0x6d, 0x36, + 0x35, 0xb6, 0xe2, 0x3e, 0xaa, 0x26, 0xc9, 0x17, 0x44, 0x6f, 0xb0, 0x47, 0xe1, 0x7b, 0x89, 0xc6, + 0xe4, 0xb1, 0xe8, 0xfb, 0x3c, 0x2a, 0x77, 0xa9, 0xf1, 0xb7, 0x6e, 0xae, 0x7d, 0xd2, 0x05, 0x0b, + 0x67, 0x97, 0x2d, 0xbc, 0xfc, 0x9b, 0xc8, 0x7d, 0xe3, 0x6f, 0x22, 0x65, 0xd7, 0xfc, 0xa2, 0x5d, + 0x13, 0xc6, 0xdc, 0x78, 0xda, 0x98, 0x85, 0x1f, 0xd3, 0x98, 0x9b, 0x6b, 0x1a, 0x73, 0xb5, 0x25, + 0x8a, 0xeb, 0x59, 0x22, 0x39, 0x41, 0xa5, 0xf4, 0x04, 0xed, 0xa1, 0xdd, 0xc4, 0xa0, 0x44, 0x03, + 0x74, 0xf6, 0x31, 0x8b, 0x72, 0x5d, 0x6a, 0xf0, 0x0a, 0x42, 0x89, 0xbb, 0xe4, 0x58, 0x4a, 0x5f, + 0x52, 0x52, 0xca, 0x67, 0xb5, 0xdf, 0x1f, 0x85, 0x23, 0x6e, 0xfe, 0x0a, 0x15, 0xe3, 0xc1, 0xfc, + 0x65, 0xc5, 0x96, 0x08, 0xac, 0xfd, 0xfa, 0x08, 0x18, 0xb3, 0x5d, 0xa3, 0xd2, 0xdc, 0xd1, 0x47, + 0x2b, 0x76, 0xc4, 0x68, 0xed, 0xb7, 0xc7, 0xd0, 0x24, 0xe1, 0xdc, 0xad, 0xab, 0x08, 0x63, 0x74, + 0x25, 0xe1, 0x92, 0x19, 0xdb, 0x97, 0xb7, 0xf7, 0x75, 0xee, 0xee, 0xbe, 0xce, 0x7d, 0xb9, 0xaf, + 0x73, 0x6f, 0x1f, 0xea, 0x99, 0xbb, 0x87, 0x7a, 0xe6, 0xd3, 0x43, 0x3d, 0xf3, 0xec, 0x8f, 0xa7, + 0x07, 0xce, 0x22, 0xba, 0x37, 0x04, 0x2a, 0x87, 0x02, 0xbd, 0x42, 0x70, 0xcd, 0xff, 0xf9, 0x35, + 0x00, 0x00, 0xff, 0xff, 0xdb, 0xb1, 0xa2, 0xd8, 0x3f, 0x08, 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 { + // CreateFeed defines a method for creating a new feed. + CreateFeed(ctx context.Context, in *MsgCreateFeed, opts ...grpc.CallOption) (*MsgCreateFeedResponse, error) + // EditFeed defines a method for editing a feed. + EditFeed(ctx context.Context, in *MsgEditFeed, opts ...grpc.CallOption) (*MsgEditFeedResponse, error) + // StartFeed defines a method for starting a feed + StartFeed(ctx context.Context, in *MsgStartFeed, opts ...grpc.CallOption) (*MsgStartFeedResponse, error) + // PauseFeed defines a method for pausing a feed. + PauseFeed(ctx context.Context, in *MsgPauseFeed, opts ...grpc.CallOption) (*MsgPauseFeedResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateFeed(ctx context.Context, in *MsgCreateFeed, opts ...grpc.CallOption) (*MsgCreateFeedResponse, error) { + out := new(MsgCreateFeedResponse) + err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/CreateFeed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) EditFeed(ctx context.Context, in *MsgEditFeed, opts ...grpc.CallOption) (*MsgEditFeedResponse, error) { + out := new(MsgEditFeedResponse) + err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/EditFeed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) StartFeed(ctx context.Context, in *MsgStartFeed, opts ...grpc.CallOption) (*MsgStartFeedResponse, error) { + out := new(MsgStartFeedResponse) + err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/StartFeed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) PauseFeed(ctx context.Context, in *MsgPauseFeed, opts ...grpc.CallOption) (*MsgPauseFeedResponse, error) { + out := new(MsgPauseFeedResponse) + err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/PauseFeed", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateFeed defines a method for creating a new feed. + CreateFeed(context.Context, *MsgCreateFeed) (*MsgCreateFeedResponse, error) + // EditFeed defines a method for editing a feed. + EditFeed(context.Context, *MsgEditFeed) (*MsgEditFeedResponse, error) + // StartFeed defines a method for starting a feed + StartFeed(context.Context, *MsgStartFeed) (*MsgStartFeedResponse, error) + // PauseFeed defines a method for pausing a feed. + PauseFeed(context.Context, *MsgPauseFeed) (*MsgPauseFeedResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateFeed(ctx context.Context, req *MsgCreateFeed) (*MsgCreateFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateFeed not implemented") +} +func (*UnimplementedMsgServer) EditFeed(ctx context.Context, req *MsgEditFeed) (*MsgEditFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EditFeed not implemented") +} +func (*UnimplementedMsgServer) StartFeed(ctx context.Context, req *MsgStartFeed) (*MsgStartFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StartFeed not implemented") +} +func (*UnimplementedMsgServer) PauseFeed(ctx context.Context, req *MsgPauseFeed) (*MsgPauseFeedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PauseFeed not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateFeed) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateFeed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.oracle.Msg/CreateFeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateFeed(ctx, req.(*MsgCreateFeed)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_EditFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEditFeed) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EditFeed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.oracle.Msg/EditFeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EditFeed(ctx, req.(*MsgEditFeed)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_StartFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgStartFeed) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).StartFeed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.oracle.Msg/StartFeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).StartFeed(ctx, req.(*MsgStartFeed)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_PauseFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPauseFeed) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).PauseFeed(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.oracle.Msg/PauseFeed", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).PauseFeed(ctx, req.(*MsgPauseFeed)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.oracle.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateFeed", + Handler: _Msg_CreateFeed_Handler, + }, + { + MethodName: "EditFeed", + Handler: _Msg_EditFeed_Handler, + }, + { + MethodName: "StartFeed", + Handler: _Msg_StartFeed_Handler, + }, + { + MethodName: "PauseFeed", + Handler: _Msg_PauseFeed_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "oracle/tx.proto", +} + +func (m *MsgCreateFeed) 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 *MsgCreateFeed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResponseThreshold != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ResponseThreshold)) + i-- + dAtA[i] = 0x68 + } + if len(m.ValueJsonPath) > 0 { + i -= len(m.ValueJsonPath) + copy(dAtA[i:], m.ValueJsonPath) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValueJsonPath))) + i-- + dAtA[i] = 0x62 + } + if len(m.AggregateFunc) > 0 { + i -= len(m.AggregateFunc) + copy(dAtA[i:], m.AggregateFunc) + i = encodeVarintTx(dAtA, i, uint64(len(m.AggregateFunc))) + i-- + dAtA[i] = 0x5a + } + if m.RepeatedFrequency != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) + i-- + dAtA[i] = 0x50 + } + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if m.Timeout != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) + i-- + dAtA[i] = 0x40 + } + if len(m.Input) > 0 { + i -= len(m.Input) + copy(dAtA[i:], m.Input) + i = encodeVarintTx(dAtA, i, uint64(len(m.Input))) + i-- + dAtA[i] = 0x3a + } + if len(m.Providers) > 0 { + for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Providers[iNdEx]) + copy(dAtA[i:], m.Providers[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) + i-- + dAtA[i] = 0x32 + } + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0x2a + } + 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] = 0x22 + } + 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] = 0x1a + } + if m.LatestHistory != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.LatestHistory)) + i-- + dAtA[i] = 0x10 + } + if len(m.FeedName) > 0 { + i -= len(m.FeedName) + copy(dAtA[i:], m.FeedName) + i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateFeedResponse) 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 *MsgCreateFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgStartFeed) 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 *MsgStartFeed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStartFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 0x12 + } + if len(m.FeedName) > 0 { + i -= len(m.FeedName) + copy(dAtA[i:], m.FeedName) + i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgStartFeedResponse) 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 *MsgStartFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStartFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgPauseFeed) 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 *MsgPauseFeed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPauseFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 0x12 + } + if len(m.FeedName) > 0 { + i -= len(m.FeedName) + copy(dAtA[i:], m.FeedName) + i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPauseFeedResponse) 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 *MsgPauseFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPauseFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEditFeed) 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 *MsgEditFeed) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 0x4a + } + if m.ResponseThreshold != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ResponseThreshold)) + i-- + dAtA[i] = 0x40 + } + if m.RepeatedFrequency != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) + i-- + dAtA[i] = 0x38 + } + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.Timeout != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) + i-- + dAtA[i] = 0x28 + } + if len(m.Providers) > 0 { + for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Providers[iNdEx]) + copy(dAtA[i:], m.Providers[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if m.LatestHistory != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.LatestHistory)) + i-- + dAtA[i] = 0x18 + } + 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] = 0x12 + } + if len(m.FeedName) > 0 { + i -= len(m.FeedName) + copy(dAtA[i:], m.FeedName) + i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEditFeedResponse) 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 *MsgEditFeedResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditFeedResponse) 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 *MsgCreateFeed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeedName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.LatestHistory != 0 { + n += 1 + sovTx(uint64(m.LatestHistory)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Providers) > 0 { + for _, s := range m.Providers { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Input) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Timeout != 0 { + n += 1 + sovTx(uint64(m.Timeout)) + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.RepeatedFrequency != 0 { + n += 1 + sovTx(uint64(m.RepeatedFrequency)) + } + l = len(m.AggregateFunc) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValueJsonPath) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.ResponseThreshold != 0 { + n += 1 + sovTx(uint64(m.ResponseThreshold)) + } + return n +} + +func (m *MsgCreateFeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgStartFeed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeedName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgStartFeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgPauseFeed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeedName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgPauseFeedResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEditFeed) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FeedName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.LatestHistory != 0 { + n += 1 + sovTx(uint64(m.LatestHistory)) + } + if len(m.Providers) > 0 { + for _, s := range m.Providers { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Timeout != 0 { + n += 1 + sovTx(uint64(m.Timeout)) + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.RepeatedFrequency != 0 { + n += 1 + sovTx(uint64(m.RepeatedFrequency)) + } + if m.ResponseThreshold != 0 { + n += 1 + sovTx(uint64(m.ResponseThreshold)) + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgEditFeedResponse) 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 *MsgCreateFeed) 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: MsgCreateFeed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateFeed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestHistory", wireType) + } + m.LatestHistory = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestHistory |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + 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 4: + 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 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + m.Timeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) + } + m.RepeatedFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedFrequency |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregateFunc", 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.AggregateFunc = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueJsonPath", 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.ValueJsonPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) + } + m.ResponseThreshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResponseThreshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateFeedResponse) 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: MsgCreateFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateFeedResponse: 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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgStartFeed) 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: MsgStartFeed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStartFeed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgStartFeedResponse) 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: MsgStartFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStartFeedResponse: 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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPauseFeed) 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: MsgPauseFeed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPauseFeed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPauseFeedResponse) 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: MsgPauseFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPauseFeedResponse: 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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgEditFeed) 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: MsgEditFeed: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditFeed: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LatestHistory", wireType) + } + m.LatestHistory = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LatestHistory |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + m.Timeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) + } + m.RepeatedFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedFrequency |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) + } + m.ResponseThreshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResponseThreshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + 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 + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgEditFeedResponse) 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: MsgEditFeedResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditFeedResponse: 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 { + return ErrInvalidLengthTx + } + if (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/module-sdk/oracle/types.go b/module-sdk/oracle/types.go new file mode 100644 index 00000000..ee3bb12d --- /dev/null +++ b/module-sdk/oracle/types.go @@ -0,0 +1,333 @@ +package oracle + +import ( + "bytes" + "fmt" + sdk "github.com/irisnet/core-sdk-go/types" + "regexp" + "strings" +) + +const ( + ModuleName = "oracle" +) + +var ( + _ sdk.Msg = &MsgCreateFeed{} + _ sdk.Msg = &MsgStartFeed{} + _ sdk.Msg = &MsgPauseFeed{} + _ sdk.Msg = &MsgEditFeed{} + + // the feed/service name only accepts alphanumeric characters, _ and - + regPlainText = regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_-]*$`) +) + +// Route implements Msg. +func (msg MsgCreateFeed) Route() string { + return ModuleName +} + +// Type implements Msg. +func (msg MsgCreateFeed) Type() string { + return "create_feed" +} + +// ValidateBasic implements Msg. +func (msg MsgCreateFeed) ValidateBasic() error { + feedName := strings.TrimSpace(msg.FeedName) + if len(feedName) == 0 { + return sdk.Wrapf("missing feed name") + } + if !regPlainText.MatchString(feedName) { + return sdk.Wrapf("invalid feed name: %s", feedName) + } + + if len(msg.Description) == 0 { + return sdk.Wrapf("missing description") + } + + if len(msg.ServiceName) == 0 { + return sdk.Wrapf("missing name") + } + if !regPlainText.MatchString(msg.ServiceName) { + return sdk.Wrapf("invalid service name %s", msg.ServiceName) + } + + if msg.LatestHistory == 0 { + return sdk.Wrapf("missing latest history") + } + + if err := validateTimeout(msg.Timeout, msg.RepeatedFrequency); err != nil { + return err + } + if len(msg.Providers) == 0 { + return sdk.Wrapf("providers missing") + } + + if len(msg.AggregateFunc) == 0 { + return sdk.Wrapf("missing aggregateFunc") + } + + if len(msg.ValueJsonPath) == 0 { + return sdk.Wrapf("missing valueJsonPath") + } + + if !msg.ServiceFeeCap.IsValid() { + return sdk.Wrapf(msg.ServiceFeeCap.String()) + } + + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return sdk.Wrapf("invalid creator") + } + + return validateResponseThreshold(msg.ResponseThreshold, len(msg.Providers)) +} + +// GetSignBytes implements Msg. +func (msg MsgCreateFeed) GetSignBytes() []byte { + if len(msg.Providers) == 0 { + msg.Providers = nil + } + if msg.ServiceFeeCap.Empty() { + msg.ServiceFeeCap = nil + } + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners implements Msg. +func (msg MsgCreateFeed) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg MsgStartFeed) Route() string { + return ModuleName +} + +func (msg MsgStartFeed) Type() string { + return "start_feed" +} + +func (msg MsgStartFeed) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return sdk.Wrapf("invalid creator") + } + + feedName := strings.TrimSpace(msg.FeedName) + if len(feedName) == 0 { + return sdk.Wrapf("missing feed name") + } + if !regPlainText.MatchString(feedName) { + return sdk.Wrapf("invalid feed name: %s", feedName) + } + return nil +} + +func (msg MsgStartFeed) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgStartFeed) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg MsgPauseFeed) Route() string { + return ModuleName +} + +func (msg MsgPauseFeed) Type() string { + return "pause_feed" +} + +func (msg MsgPauseFeed) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return sdk.Wrapf("invalid creator") + } + + feedName := strings.TrimSpace(msg.FeedName) + if len(feedName) == 0 { + return sdk.Wrapf("missing feed name") + } + if !regPlainText.MatchString(feedName) { + return sdk.Wrapf("invalid feed name: %s", feedName) + } + return nil +} + +func (msg MsgPauseFeed) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgPauseFeed) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg MsgEditFeed) Route() string { + return ModuleName +} + +func (msg MsgEditFeed) Type() string { + return "edit_feed" +} + +func (msg MsgEditFeed) ValidateBasic() error { + feedName := strings.TrimSpace(msg.FeedName) + if len(feedName) == 0 { + return sdk.Wrapf("missing feed name") + } + if !regPlainText.MatchString(feedName) { + return sdk.Wrapf("invalid feed name: %s", feedName) + } + + if len(msg.Description) == 0 { + return sdk.Wrapf("missing description") + } + + if msg.ServiceFeeCap != nil && !msg.ServiceFeeCap.IsValid() { + return sdk.Wrapf(msg.ServiceFeeCap.String()) + } + if msg.Timeout != 0 && msg.RepeatedFrequency != 0 { + if err := validateTimeout(msg.Timeout, msg.RepeatedFrequency); err != nil { + return err + } + } + if msg.ResponseThreshold != 0 { + if err := validateResponseThreshold(msg.ResponseThreshold, len(msg.Providers)); err != nil { + return err + } + } + + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return sdk.Wrapf("invalid creator") + } + return nil +} + +func (msg MsgEditFeed) GetSignBytes() []byte { + if len(msg.Providers) == 0 { + msg.Providers = nil + } + if msg.ServiceFeeCap.Empty() { + msg.ServiceFeeCap = nil + } + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgEditFeed) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func validateResponseThreshold(responseThreshold uint32, maxCnt int) error { + if (maxCnt != 0 && int(responseThreshold) > maxCnt) || responseThreshold < 1 { + return sdk.Wrapf("response threshold should be between 1 and %d", maxCnt) + } + return nil +} + +func validateTimeout(timeout int64, frequency uint64) error { + if frequency < uint64(timeout) { + return sdk.Wrapf("timeout [%d] should be no more than frequency [%d]", timeout, frequency) + } + return nil +} + +// String implements fmt.Stringer +func (f FeedContext) String() string { + var bf bytes.Buffer + for _, addr := range f.Providers { + bf.WriteString(addr) + bf.WriteString(",") + } + return fmt.Sprintf(` FeedContext: + %s + ServiceName: %s + Providers: %s + Input: %s + Timeout: %d + ServiceFeeCap: %s + RepeatedFrequency: %d + ResponseThreshold: %d + State: %s`, + f.Feed.String(), + f.ServiceName, + bf.String(), + f.Input, + f.Timeout, + f.ServiceFeeCap, + f.RepeatedFrequency, + f.ResponseThreshold, + f.State.String(), + ) +} + +func (f FeedContext) Convert() interface{} { + return QueryFeedResp{ + Feed: struct { + FeedName string `json:"feed_name"` + Description string `json:"description"` + AggregateFunc string `json:"aggregate_func"` + ValueJsonPath string `json:"value_json_path"` + LatestHistory uint64 `json:"latest_history"` + RequestContextID string `json:"request_context_id"` + Creator string `json:"creator"` + }{ + f.Feed.FeedName, + f.Feed.Description, + f.Feed.AggregateFunc, + f.Feed.ValueJsonPath, + f.Feed.LatestHistory, + f.Feed.RequestContextID, + f.Feed.Creator, + }, + ServiceName: f.ServiceName, + Providers: f.Providers, + Input: f.Input, + Timeout: f.Timeout, + ServiceFeeCap: f.ServiceFeeCap, + RepeatedFrequency: f.RepeatedFrequency, + ResponseThreshold: f.ResponseThreshold, + State: int32(f.State), + } +} + +type feedContexts []FeedContext + +func (fs feedContexts) Convert() interface{} { + var res []QueryFeedResp + for _, f := range fs { + res = append(res, f.Convert().(QueryFeedResp)) + } + return res +} + +type feedValues []FeedValue + +func (f FeedValue) Convert() interface{} { + return QueryFeedValueResp{ + Data: f.Data, + Timestamp: f.Timestamp, + } +} + +func (fs feedValues) Convert() interface{} { + var res []QueryFeedValueResp + for _, f := range fs { + res = append(res, f.Convert().(QueryFeedValueResp)) + } + return res +} From ef7818959ca78a8ddb68c67f6eb38df51174cb5d Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 29 Jun 2021 18:01:14 +0800 Subject: [PATCH 10/41] module-sdk-go refactoring --- module-sdk/random/codec.go | 24 + module-sdk/random/export.go | 39 + module-sdk/random/go.mod | 13 + module-sdk/random/query.pb.go | 974 +++++ module-sdk/random/random.go | 107 + module-sdk/random/random.pb.go | 831 ++++ module-sdk/random/tx.pb.go | 468 +++ module-sdk/random/types.go | 76 + module-sdk/record/codec.go | 25 + module-sdk/record/export.go | 35 + module-sdk/record/go.mod | 13 + module-sdk/record/query.pb.go | 593 +++ module-sdk/record/record.go | 86 + module-sdk/record/record.pb.go | 782 ++++ module-sdk/record/tx.pb.go | 401 ++ module-sdk/record/types.go | 78 + module-sdk/service/codec.go | 38 + module-sdk/service/doc.go | 106 + module-sdk/service/export.go | 198 + module-sdk/service/go.mod | 13 + module-sdk/service/params.go | 11 + module-sdk/service/query.go | 196 + module-sdk/service/query.pb.go | 6105 +++++++++++++++++++++++++++ module-sdk/service/service.go | 746 ++++ module-sdk/service/service.pb.go | 4440 ++++++++++++++++++++ module-sdk/service/tx.pb.go | 4609 ++++++++++++++++++++ module-sdk/service/types.go | 821 ++++ module-sdk/staking/codec.go | 27 + module-sdk/staking/delegation.go | 381 ++ module-sdk/staking/export.go | 214 + module-sdk/staking/go.mod | 13 + module-sdk/staking/params.go | 35 + module-sdk/staking/query.pb.go | 6728 ++++++++++++++++++++++++++++++ module-sdk/staking/staking.go | 469 +++ module-sdk/staking/staking.pb.go | 6577 +++++++++++++++++++++++++++++ module-sdk/staking/tx.pb.go | 2751 ++++++++++++ module-sdk/staking/types.go | 515 +++ module-sdk/token/codec.go | 29 + module-sdk/token/export.go | 50 + module-sdk/token/go.mod | 13 + module-sdk/token/params.go | 16 + module-sdk/token/query.pb.go | 1880 +++++++++ module-sdk/token/token.go | 191 + module-sdk/token/token.pb.go | 873 ++++ module-sdk/token/tx.pb.go | 1436 +++++++ module-sdk/token/types.go | 316 ++ 46 files changed, 44342 insertions(+) create mode 100644 module-sdk/random/codec.go create mode 100644 module-sdk/random/export.go create mode 100644 module-sdk/random/go.mod create mode 100644 module-sdk/random/query.pb.go create mode 100644 module-sdk/random/random.go create mode 100644 module-sdk/random/random.pb.go create mode 100644 module-sdk/random/tx.pb.go create mode 100644 module-sdk/random/types.go create mode 100644 module-sdk/record/codec.go create mode 100644 module-sdk/record/export.go create mode 100644 module-sdk/record/go.mod create mode 100644 module-sdk/record/query.pb.go create mode 100644 module-sdk/record/record.go create mode 100644 module-sdk/record/record.pb.go create mode 100644 module-sdk/record/tx.pb.go create mode 100644 module-sdk/record/types.go create mode 100644 module-sdk/service/codec.go create mode 100644 module-sdk/service/doc.go create mode 100644 module-sdk/service/export.go create mode 100644 module-sdk/service/go.mod create mode 100644 module-sdk/service/params.go create mode 100644 module-sdk/service/query.go create mode 100644 module-sdk/service/query.pb.go create mode 100644 module-sdk/service/service.go create mode 100644 module-sdk/service/service.pb.go create mode 100644 module-sdk/service/tx.pb.go create mode 100644 module-sdk/service/types.go create mode 100644 module-sdk/staking/codec.go create mode 100644 module-sdk/staking/delegation.go create mode 100644 module-sdk/staking/export.go create mode 100644 module-sdk/staking/go.mod create mode 100644 module-sdk/staking/params.go create mode 100644 module-sdk/staking/query.pb.go create mode 100644 module-sdk/staking/staking.go create mode 100644 module-sdk/staking/staking.pb.go create mode 100644 module-sdk/staking/tx.pb.go create mode 100644 module-sdk/staking/types.go create mode 100644 module-sdk/token/codec.go create mode 100644 module-sdk/token/export.go create mode 100644 module-sdk/token/go.mod create mode 100644 module-sdk/token/params.go create mode 100644 module-sdk/token/query.pb.go create mode 100644 module-sdk/token/token.go create mode 100644 module-sdk/token/token.pb.go create mode 100644 module-sdk/token/tx.pb.go create mode 100644 module-sdk/token/types.go diff --git a/module-sdk/random/codec.go b/module-sdk/random/codec.go new file mode 100644 index 00000000..671cf939 --- /dev/null +++ b/module-sdk/random/codec.go @@ -0,0 +1,24 @@ +package random + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgRequestRandom{}, + ) +} diff --git a/module-sdk/random/export.go b/module-sdk/random/export.go new file mode 100644 index 00000000..e3e02f61 --- /dev/null +++ b/module-sdk/random/export.go @@ -0,0 +1,39 @@ +package random + +import sdk "github.com/irisnet/core-sdk-go/types" + +// expose Random module api for user +type Client interface { + sdk.Module + + RequestRandom(request RequestRandomRequest, basTx sdk.BaseTx) (RequestRandomResp, sdk.ResultTx, sdk.Error) + + QueryRandom(ReqId string) (QueryRandomResp, sdk.Error) + QueryRandomRequestQueue(height int64) ([]QueryRandomRequestQueueResp, sdk.Error) +} + +type RequestRandomRequest struct { + BlockInterval uint64 `json:"block_interval"` + Oracle bool `json:"oracle"` + ServiceFeeCap sdk.Coins `json:"service_fee_cap"` +} + +type RequestRandomResp struct { + Height int64 `json:"height"` + ReqID string `json:"req_id"` +} + +type QueryRandomResp struct { + RequestTxHash string `json:"request_tx_hash" yaml:"request_tx_hash"` + Height int64 `json:"height" yaml:"height"` + Value string `json:"value" yaml:"value"` +} + +type QueryRandomRequestQueueResp struct { + Height int64 `json:"height" yaml:"height"` + Consumer string `json:"consumer" yaml:"consumer"` + TxHash string `json:"tx_hash" yaml:"tx_hash"` + Oracle bool `json:"oracle" yaml:"oracle"` + ServiceFeeCap sdk.Coins `json:"service_fee_cap" yaml:"service_fee_cap"` + ServiceContextId string `json:"service_context_id" yaml:"service_context_id"` +} diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod new file mode 100644 index 00000000..0c90ce30 --- /dev/null +++ b/module-sdk/random/go.mod @@ -0,0 +1,13 @@ +module random + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/random/query.pb.go b/module-sdk/random/query.pb.go new file mode 100644 index 00000000..985a22da --- /dev/null +++ b/module-sdk/random/query.pb.go @@ -0,0 +1,974 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: random/query.proto + +package random + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// QueryRandomRequest is request type for the Query/Random RPC method +type QueryRandomRequest struct { + ReqId string `protobuf:"bytes,1,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` +} + +func (m *QueryRandomRequest) Reset() { *m = QueryRandomRequest{} } +func (m *QueryRandomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRandomRequest) ProtoMessage() {} +func (*QueryRandomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0e7e1fe88061ff84, []int{0} +} +func (m *QueryRandomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRandomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRandomRequest.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 *QueryRandomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRandomRequest.Merge(m, src) +} +func (m *QueryRandomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRandomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRandomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRandomRequest proto.InternalMessageInfo + +func (m *QueryRandomRequest) GetReqId() string { + if m != nil { + return m.ReqId + } + return "" +} + +// QueryParametersResponse is response type for the Query/Random RPC method +type QueryRandomResponse struct { + Random *Random `protobuf:"bytes,1,opt,name=random,proto3" json:"random,omitempty"` +} + +func (m *QueryRandomResponse) Reset() { *m = QueryRandomResponse{} } +func (m *QueryRandomResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRandomResponse) ProtoMessage() {} +func (*QueryRandomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0e7e1fe88061ff84, []int{1} +} +func (m *QueryRandomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRandomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRandomResponse.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 *QueryRandomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRandomResponse.Merge(m, src) +} +func (m *QueryRandomResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRandomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRandomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRandomResponse proto.InternalMessageInfo + +func (m *QueryRandomResponse) GetRandom() *Random { + if m != nil { + return m.Random + } + return nil +} + +// QueryRandomRequestQueueRequest is request type for the Query/RandomRequestQueue RPC method +type QueryRandomRequestQueueRequest struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryRandomRequestQueueRequest) Reset() { *m = QueryRandomRequestQueueRequest{} } +func (m *QueryRandomRequestQueueRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRandomRequestQueueRequest) ProtoMessage() {} +func (*QueryRandomRequestQueueRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_0e7e1fe88061ff84, []int{2} +} +func (m *QueryRandomRequestQueueRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRandomRequestQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRandomRequestQueueRequest.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 *QueryRandomRequestQueueRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRandomRequestQueueRequest.Merge(m, src) +} +func (m *QueryRandomRequestQueueRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRandomRequestQueueRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRandomRequestQueueRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRandomRequestQueueRequest proto.InternalMessageInfo + +func (m *QueryRandomRequestQueueRequest) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +// QueryRandomRequestQueueResponse is response type for the Query/RandomRequestQueue RPC method +type QueryRandomRequestQueueResponse struct { + Requests []Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests"` +} + +func (m *QueryRandomRequestQueueResponse) Reset() { *m = QueryRandomRequestQueueResponse{} } +func (m *QueryRandomRequestQueueResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRandomRequestQueueResponse) ProtoMessage() {} +func (*QueryRandomRequestQueueResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0e7e1fe88061ff84, []int{3} +} +func (m *QueryRandomRequestQueueResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRandomRequestQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRandomRequestQueueResponse.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 *QueryRandomRequestQueueResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRandomRequestQueueResponse.Merge(m, src) +} +func (m *QueryRandomRequestQueueResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRandomRequestQueueResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRandomRequestQueueResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRandomRequestQueueResponse proto.InternalMessageInfo + +func (m *QueryRandomRequestQueueResponse) GetRequests() []Request { + if m != nil { + return m.Requests + } + return nil +} + +func init() { + proto.RegisterType((*QueryRandomRequest)(nil), "irismod.random.QueryRandomRequest") + proto.RegisterType((*QueryRandomResponse)(nil), "irismod.random.QueryRandomResponse") + proto.RegisterType((*QueryRandomRequestQueueRequest)(nil), "irismod.random.QueryRandomRequestQueueRequest") + proto.RegisterType((*QueryRandomRequestQueueResponse)(nil), "irismod.random.QueryRandomRequestQueueResponse") +} + +func init() { proto.RegisterFile("random/query.proto", fileDescriptor_0e7e1fe88061ff84) } + +var fileDescriptor_0e7e1fe88061ff84 = []byte{ + // 387 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcd, 0x4a, 0xeb, 0x40, + 0x14, 0xc7, 0x93, 0xf6, 0x36, 0xdc, 0x3b, 0x85, 0xbb, 0x98, 0xde, 0x7e, 0x10, 0xae, 0x69, 0x89, + 0x9b, 0x82, 0x34, 0x23, 0x75, 0xa3, 0xdb, 0x82, 0x0b, 0xdd, 0x35, 0x4b, 0x11, 0x24, 0x35, 0x43, + 0x12, 0x6c, 0x72, 0x9a, 0x4c, 0x66, 0x21, 0xc5, 0x8d, 0x4f, 0x20, 0xe8, 0xce, 0x17, 0xea, 0xb2, + 0xe0, 0xc6, 0x95, 0x48, 0xeb, 0x83, 0x48, 0x67, 0x46, 0xb1, 0x0d, 0x7e, 0xac, 0x66, 0x32, 0xe7, + 0x77, 0xce, 0xff, 0x97, 0x49, 0x10, 0xce, 0xbc, 0xc4, 0x87, 0x98, 0xa4, 0x9c, 0x66, 0x97, 0xce, + 0x24, 0x83, 0x1c, 0xf0, 0xdf, 0x28, 0x8b, 0x58, 0x0c, 0xbe, 0x23, 0x6b, 0x66, 0x4d, 0x31, 0x72, + 0x91, 0x90, 0xf9, 0x2f, 0x80, 0x00, 0xc4, 0x96, 0xac, 0x76, 0xea, 0xf4, 0x7f, 0x00, 0x10, 0x8c, + 0x29, 0xf1, 0x26, 0x11, 0xf1, 0x92, 0x04, 0x72, 0x2f, 0x8f, 0x20, 0x61, 0xb2, 0x6a, 0xef, 0x20, + 0x3c, 0x5c, 0xe5, 0xb8, 0x62, 0x90, 0x4b, 0x53, 0x4e, 0x59, 0x8e, 0xeb, 0xc8, 0xc8, 0x68, 0x7a, + 0x16, 0xf9, 0x2d, 0xbd, 0xa3, 0x77, 0xff, 0xb8, 0x95, 0x8c, 0xa6, 0x47, 0xbe, 0x7d, 0x88, 0x6a, + 0x6b, 0x30, 0x9b, 0x40, 0xc2, 0x28, 0x76, 0x90, 0x21, 0x3d, 0x04, 0x5d, 0xed, 0x37, 0x9c, 0x75, + 0x5b, 0x47, 0xf1, 0x8a, 0xb2, 0xf7, 0x91, 0x55, 0xcc, 0x1c, 0x72, 0xca, 0xe9, 0x5b, 0x7e, 0x03, + 0x19, 0x21, 0x8d, 0x82, 0x30, 0x17, 0x13, 0xcb, 0xae, 0x7a, 0xb2, 0x4f, 0x51, 0xfb, 0xd3, 0x4e, + 0x25, 0x73, 0x80, 0x7e, 0x67, 0xf2, 0x9c, 0xb5, 0xf4, 0x4e, 0xb9, 0x5b, 0xed, 0x37, 0x0b, 0x3a, + 0xb2, 0x3e, 0xf8, 0x35, 0x7b, 0x6a, 0x6b, 0xee, 0x3b, 0xde, 0xbf, 0x2f, 0xa1, 0x8a, 0x18, 0x8f, + 0xa7, 0xc8, 0x90, 0x11, 0xd8, 0xde, 0x6c, 0x2e, 0xe6, 0x9b, 0xdb, 0x5f, 0x32, 0xd2, 0xcb, 0xee, + 0x5e, 0x3f, 0xbc, 0xdc, 0x96, 0x6c, 0xdc, 0x21, 0x0a, 0x26, 0x6b, 0x9f, 0x90, 0x91, 0xa9, 0xbc, + 0xf1, 0x2b, 0x7c, 0xa7, 0x23, 0x5c, 0x7c, 0x41, 0xec, 0x7c, 0x6f, 0xf2, 0xf1, 0x0e, 0x4d, 0xf2, + 0x63, 0x5e, 0x19, 0x6e, 0x09, 0xc3, 0x26, 0xae, 0x6f, 0x1a, 0xa6, 0x2b, 0x6c, 0x70, 0x3c, 0x5b, + 0x58, 0xfa, 0x7c, 0x61, 0xe9, 0xcf, 0x0b, 0x4b, 0xbf, 0x59, 0x5a, 0xda, 0x7c, 0x69, 0x69, 0x8f, + 0x4b, 0x4b, 0x3b, 0xd9, 0x0d, 0xa2, 0x3c, 0xe4, 0x23, 0xe7, 0x1c, 0x62, 0xd1, 0x9a, 0xd0, 0x5c, + 0xac, 0x21, 0x1f, 0xf5, 0x98, 0x7f, 0xd1, 0x0b, 0x80, 0xc4, 0xe0, 0xf3, 0x31, 0x65, 0x6a, 0xe2, + 0xc8, 0x10, 0x3f, 0xdf, 0xde, 0x6b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xc9, 0x52, 0x3e, 0xeb, + 0x02, 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 { + // Random queries the random result + Random(ctx context.Context, in *QueryRandomRequest, opts ...grpc.CallOption) (*QueryRandomResponse, error) + // RandomRequestQueue queries the random request queue + RandomRequestQueue(ctx context.Context, in *QueryRandomRequestQueueRequest, opts ...grpc.CallOption) (*QueryRandomRequestQueueResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Random(ctx context.Context, in *QueryRandomRequest, opts ...grpc.CallOption) (*QueryRandomResponse, error) { + out := new(QueryRandomResponse) + err := c.cc.Invoke(ctx, "/irismod.random.Query/Random", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RandomRequestQueue(ctx context.Context, in *QueryRandomRequestQueueRequest, opts ...grpc.CallOption) (*QueryRandomRequestQueueResponse, error) { + out := new(QueryRandomRequestQueueResponse) + err := c.cc.Invoke(ctx, "/irismod.random.Query/RandomRequestQueue", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Random queries the random result + Random(context.Context, *QueryRandomRequest) (*QueryRandomResponse, error) + // RandomRequestQueue queries the random request queue + RandomRequestQueue(context.Context, *QueryRandomRequestQueueRequest) (*QueryRandomRequestQueueResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Random(ctx context.Context, req *QueryRandomRequest) (*QueryRandomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Random not implemented") +} +func (*UnimplementedQueryServer) RandomRequestQueue(ctx context.Context, req *QueryRandomRequestQueueRequest) (*QueryRandomRequestQueueResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RandomRequestQueue not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Random_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRandomRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Random(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.random.Query/Random", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Random(ctx, req.(*QueryRandomRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RandomRequestQueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRandomRequestQueueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RandomRequestQueue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.random.Query/RandomRequestQueue", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RandomRequestQueue(ctx, req.(*QueryRandomRequestQueueRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.random.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Random", + Handler: _Query_Random_Handler, + }, + { + MethodName: "RandomRequestQueue", + Handler: _Query_RandomRequestQueue_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "random/query.proto", +} + +func (m *QueryRandomRequest) 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 *QueryRandomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRandomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ReqId) > 0 { + i -= len(m.ReqId) + copy(dAtA[i:], m.ReqId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ReqId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRandomResponse) 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 *QueryRandomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRandomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Random != nil { + { + size, err := m.Random.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 *QueryRandomRequestQueueRequest) 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 *QueryRandomRequestQueueRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRandomRequestQueueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryRandomRequestQueueResponse) 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 *QueryRandomRequestQueueResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRandomRequestQueueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *QueryRandomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ReqId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRandomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Random != nil { + l = m.Random.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRandomRequestQueueRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryRandomRequestQueueResponse) 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)) + } + } + 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 *QueryRandomRequest) 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: QueryRandomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRandomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ReqId", 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.ReqId = 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 *QueryRandomResponse) 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: QueryRandomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRandomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Random", 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.Random == nil { + m.Random = &Random{} + } + if err := m.Random.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 *QueryRandomRequestQueueRequest) 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: QueryRandomRequestQueueRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRandomRequestQueueRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRandomRequestQueueResponse) 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: QueryRandomRequestQueueResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRandomRequestQueueResponse: 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, Request{}) + if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/random/random.go b/module-sdk/random/random.go new file mode 100644 index 00000000..2e30721a --- /dev/null +++ b/module-sdk/random/random.go @@ -0,0 +1,107 @@ +package random + +import ( + "context" + "github.com/irisnet/core-sdk-go/common/codec" + cdctypes "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" + "strconv" +) + +type randomClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) *randomClient { + return &randomClient{ + BaseClient: baseClient, + Marshaler: marshaler, + } +} + +func (rc randomClient) Name() string { + return ModuleName +} + +func (rc randomClient) RegisterInterfaceTypes(registry cdctypes.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (rc randomClient) RequestRandom(request RequestRandomRequest, basTx sdk.BaseTx) (RequestRandomResp, sdk.ResultTx, sdk.Error) { + author, err := rc.QueryAddress(basTx.From, basTx.Password) + if err != nil { + return RequestRandomResp{}, sdk.ResultTx{}, nil + } + + msg := &MsgRequestRandom{ + BlockInterval: request.BlockInterval, + Consumer: author.String(), + Oracle: request.Oracle, + ServiceFeeCap: request.ServiceFeeCap, + } + result, err := rc.BuildAndSend([]sdk.Msg{msg}, basTx) + if err != nil { + return RequestRandomResp{}, sdk.ResultTx{}, err + } + + reqID, e := result.Events.GetValue(eventTypeRequestRequestRandom, attributeKeyRequestID) + if e != nil { + return RequestRandomResp{}, result, sdk.Wrap(e) + } + generateHeight, e := result.Events.GetValue(eventTypeRequestRequestRandom, attributeKeyGenerateHeight) + if e != nil { + return RequestRandomResp{}, result, sdk.Wrap(e) + } + height, e := strconv.Atoi(generateHeight) + if e != nil { + return RequestRandomResp{}, result, sdk.Wrap(e) + } + + res := RequestRandomResp{ + Height: int64(height), + ReqID: reqID, + } + return res, result, nil +} + +func (rc randomClient) QueryRandom(reqID string) (QueryRandomResp, sdk.Error) { + if len(reqID) == 0 { + return QueryRandomResp{}, sdk.Wrapf("reqId is required") + } + + conn, err := rc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryRandomResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Random( + context.Background(), + &QueryRandomRequest{ReqId: reqID}, + ) + if err != nil { + return QueryRandomResp{}, sdk.Wrap(err) + } + return res.Random.Convert().(QueryRandomResp), nil +} + +func (rc randomClient) QueryRandomRequestQueue(height int64) ([]QueryRandomRequestQueueResp, sdk.Error) { + if height == 0 { + return []QueryRandomRequestQueueResp{}, nil + } + + conn, err := rc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return []QueryRandomRequestQueueResp{}, sdk.Wrap(err) + } + res, err := NewQueryClient(conn).RandomRequestQueue( + context.Background(), + &QueryRandomRequestQueueRequest{Height: height}, + ) + if err != nil { + return []QueryRandomRequestQueueResp{}, sdk.Wrap(err) + } + return Requests(res.Requests).Convert().([]QueryRandomRequestQueueResp), nil +} diff --git a/module-sdk/random/random.pb.go b/module-sdk/random/random.pb.go new file mode 100644 index 00000000..43a53989 --- /dev/null +++ b/module-sdk/random/random.pb.go @@ -0,0 +1,831 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: random/random.proto + +package random + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Random defines the feed standard +type Random struct { + RequestTxHash string `protobuf:"bytes,1,opt,name=request_tx_hash,json=requestTxHash,proto3" json:"request_tx_hash,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *Random) Reset() { *m = Random{} } +func (m *Random) String() string { return proto.CompactTextString(m) } +func (*Random) ProtoMessage() {} +func (*Random) Descriptor() ([]byte, []int) { + return fileDescriptor_e5da2919a686585f, []int{0} +} +func (m *Random) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Random) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Random.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 *Random) XXX_Merge(src proto.Message) { + xxx_messageInfo_Random.Merge(m, src) +} +func (m *Random) XXX_Size() int { + return m.Size() +} +func (m *Random) XXX_DiscardUnknown() { + xxx_messageInfo_Random.DiscardUnknown(m) +} + +var xxx_messageInfo_Random proto.InternalMessageInfo + +func (m *Random) GetRequestTxHash() string { + if m != nil { + return m.RequestTxHash + } + return "" +} + +func (m *Random) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *Random) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// Request defines the random request standard +type Request struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"tx_hash"` + Oracle bool `protobuf:"varint,4,opt,name=oracle,proto3" json:"oracle,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` + ServiceContextId string `protobuf:"bytes,6,opt,name=service_context_id,json=serviceContextId,proto3" json:"service_context_id,omitempty"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { + return fileDescriptor_e5da2919a686585f, []int{1} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Request.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 *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(m, src) +} +func (m *Request) XXX_Size() int { + return m.Size() +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_Request proto.InternalMessageInfo + +func (m *Request) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *Request) GetConsumer() string { + if m != nil { + return m.Consumer + } + return "" +} + +func (m *Request) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + +func (m *Request) GetOracle() bool { + if m != nil { + return m.Oracle + } + return false +} + +func (m *Request) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { + if m != nil { + return m.ServiceFeeCap + } + return nil +} + +func (m *Request) GetServiceContextId() string { + if m != nil { + return m.ServiceContextId + } + return "" +} + +func init() { + proto.RegisterType((*Random)(nil), "irismod.random.Random") + proto.RegisterType((*Request)(nil), "irismod.random.Request") +} + +func init() { proto.RegisterFile("random/random.proto", fileDescriptor_e5da2919a686585f) } + +var fileDescriptor_e5da2919a686585f = []byte{ + // 414 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0xcd, 0x36, 0xd4, 0x6d, 0x17, 0xb5, 0x45, 0x4b, 0x55, 0x99, 0x1c, 0x9c, 0xc8, 0x07, 0x14, + 0x09, 0x62, 0x53, 0xb8, 0x71, 0x4c, 0x24, 0x04, 0x5c, 0x90, 0x2c, 0x4e, 0x1c, 0xb0, 0xd6, 0xeb, + 0xc1, 0x5e, 0x11, 0x7b, 0x8c, 0x77, 0x1d, 0xa5, 0x7f, 0x81, 0xf8, 0x0c, 0xfe, 0x03, 0xa9, 0xc7, + 0x1e, 0x39, 0x05, 0x94, 0xfc, 0x41, 0xbf, 0x00, 0x65, 0x77, 0x1b, 0x01, 0x97, 0x9e, 0xc6, 0x6f, + 0x9e, 0xdf, 0xdb, 0xd9, 0x37, 0x4b, 0x1f, 0xb6, 0xbc, 0xce, 0xb1, 0x8a, 0x6d, 0x89, 0x9a, 0x16, + 0x35, 0xb2, 0x13, 0xd9, 0x4a, 0x55, 0x61, 0x1e, 0xd9, 0xee, 0xe0, 0xac, 0xc0, 0x02, 0x0d, 0x15, + 0x6f, 0xbf, 0xec, 0x5f, 0x83, 0x40, 0xa0, 0xaa, 0x50, 0xc5, 0x19, 0x57, 0x10, 0x2f, 0x2e, 0x32, + 0xd0, 0xfc, 0x22, 0x16, 0x28, 0x6b, 0xcb, 0x87, 0x1f, 0xa9, 0x97, 0x18, 0x3d, 0x7b, 0x4c, 0x4f, + 0x5b, 0xf8, 0xd2, 0x81, 0xd2, 0xa9, 0x5e, 0xa6, 0x25, 0x57, 0xa5, 0x4f, 0x46, 0x64, 0x7c, 0x94, + 0x1c, 0xbb, 0xf6, 0xfb, 0xe5, 0x6b, 0xae, 0x4a, 0x76, 0x4e, 0xbd, 0x12, 0x64, 0x51, 0x6a, 0x7f, + 0x6f, 0x44, 0xc6, 0xfd, 0xc4, 0x21, 0x76, 0x46, 0xf7, 0x17, 0x7c, 0xde, 0x81, 0xdf, 0x37, 0x2a, + 0x0b, 0xc2, 0x1f, 0x7b, 0xf4, 0x20, 0xb1, 0xfa, 0xbf, 0x94, 0xe4, 0x1f, 0xe5, 0x80, 0x1e, 0x0a, + 0xac, 0x55, 0x57, 0x41, 0x6b, 0x3c, 0x8f, 0x92, 0x1d, 0x66, 0x4f, 0xe8, 0xc1, 0xed, 0x34, 0xc6, + 0x77, 0xca, 0x6e, 0x56, 0xc3, 0x93, 0x4b, 0x5e, 0xcd, 0x5f, 0x86, 0x8e, 0x08, 0x13, 0x4f, 0xef, + 0x46, 0xc3, 0x96, 0x8b, 0x39, 0xf8, 0xf7, 0x46, 0x64, 0x7c, 0x98, 0x38, 0xc4, 0xbe, 0x11, 0x7a, + 0xaa, 0xa0, 0x5d, 0x48, 0x01, 0xe9, 0x27, 0x80, 0x54, 0xf0, 0xc6, 0xdf, 0x1f, 0xf5, 0xc7, 0xf7, + 0x9f, 0x3f, 0x8a, 0x6c, 0x3e, 0xd1, 0x36, 0x9f, 0xc8, 0xe5, 0x13, 0xcd, 0x50, 0xd6, 0xd3, 0x77, + 0x57, 0xab, 0x61, 0xef, 0x66, 0x35, 0x3c, 0xb7, 0x87, 0xfd, 0xa7, 0x0f, 0xbf, 0xff, 0x1a, 0x4e, + 0x0a, 0xa9, 0xcb, 0x2e, 0x8b, 0x04, 0x56, 0xf1, 0x76, 0x19, 0x35, 0x68, 0x53, 0xcb, 0x2e, 0x9b, + 0xa8, 0xfc, 0xf3, 0xa4, 0xc0, 0x58, 0x5f, 0x36, 0xa0, 0x8c, 0x9f, 0x4a, 0x8e, 0x9d, 0xc5, 0x2b, + 0x80, 0x19, 0x6f, 0xd8, 0x53, 0xca, 0x6e, 0x3d, 0x05, 0xd6, 0x1a, 0x96, 0x3a, 0x95, 0xb9, 0xef, + 0x99, 0xfb, 0x3f, 0x70, 0xcc, 0xcc, 0x12, 0x6f, 0xf2, 0xe9, 0xdb, 0xab, 0x75, 0x40, 0xae, 0xd7, + 0x01, 0xf9, 0xbd, 0x0e, 0xc8, 0xd7, 0x4d, 0xd0, 0xbb, 0xde, 0x04, 0xbd, 0x9f, 0x9b, 0xa0, 0xf7, + 0xe1, 0xd9, 0xdd, 0x53, 0x54, 0x98, 0x77, 0x73, 0x50, 0xee, 0xfd, 0x64, 0x9e, 0x59, 0xfd, 0x8b, + 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x4a, 0xf9, 0x5b, 0x57, 0x02, 0x00, 0x00, +} + +func (m *Random) 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 *Random) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Random) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintRandom(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x1a + } + if m.Height != 0 { + i = encodeVarintRandom(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.RequestTxHash) > 0 { + i -= len(m.RequestTxHash) + copy(dAtA[i:], m.RequestTxHash) + i = encodeVarintRandom(dAtA, i, uint64(len(m.RequestTxHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Request) 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 *Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ServiceContextId) > 0 { + i -= len(m.ServiceContextId) + copy(dAtA[i:], m.ServiceContextId) + i = encodeVarintRandom(dAtA, i, uint64(len(m.ServiceContextId))) + i-- + dAtA[i] = 0x32 + } + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRandom(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.Oracle { + i-- + if m.Oracle { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintRandom(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintRandom(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x12 + } + if m.Height != 0 { + i = encodeVarintRandom(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintRandom(dAtA []byte, offset int, v uint64) int { + offset -= sovRandom(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Random) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestTxHash) + if l > 0 { + n += 1 + l + sovRandom(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovRandom(uint64(m.Height)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovRandom(uint64(l)) + } + return n +} + +func (m *Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovRandom(uint64(m.Height)) + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovRandom(uint64(l)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovRandom(uint64(l)) + } + if m.Oracle { + n += 2 + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovRandom(uint64(l)) + } + } + l = len(m.ServiceContextId) + if l > 0 { + n += 1 + l + sovRandom(uint64(l)) + } + return n +} + +func sovRandom(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRandom(x uint64) (n int) { + return sovRandom(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Random) 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 ErrIntOverflowRandom + } + 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: Random: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Random: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestTxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + 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 ErrInvalidLengthRandom + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRandom + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestTxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + 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 ErrInvalidLengthRandom + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRandom + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRandom(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRandom + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Request) 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 ErrIntOverflowRandom + } + 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: Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + 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 ErrInvalidLengthRandom + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRandom + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Consumer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + 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 ErrInvalidLengthRandom + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRandom + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Oracle", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Oracle = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRandom + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRandom + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceContextId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRandom + } + 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 ErrInvalidLengthRandom + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRandom + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRandom(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRandom + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRandom(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, ErrIntOverflowRandom + } + 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, ErrIntOverflowRandom + } + 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, ErrIntOverflowRandom + } + 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, ErrInvalidLengthRandom + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRandom + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRandom + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRandom = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRandom = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRandom = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/random/tx.pb.go b/module-sdk/random/tx.pb.go new file mode 100644 index 00000000..022363e2 --- /dev/null +++ b/module-sdk/random/tx.pb.go @@ -0,0 +1,468 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: random/tx.proto + +package random + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgRequestRandom defines an sdk.Msg type that supports requesting a random number +type MsgRequestRandom struct { + BlockInterval uint64 `protobuf:"varint,1,opt,name=block_interval,json=blockInterval,proto3" json:"block_interval,omitempty" yaml:"block_interval"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + Oracle bool `protobuf:"varint,3,opt,name=oracle,proto3" json:"oracle,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,4,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` +} + +func (m *MsgRequestRandom) Reset() { *m = MsgRequestRandom{} } +func (m *MsgRequestRandom) String() string { return proto.CompactTextString(m) } +func (*MsgRequestRandom) ProtoMessage() {} +func (*MsgRequestRandom) Descriptor() ([]byte, []int) { + return fileDescriptor_8734007206ce5490, []int{0} +} +func (m *MsgRequestRandom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRequestRandom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRequestRandom.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 *MsgRequestRandom) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRequestRandom.Merge(m, src) +} +func (m *MsgRequestRandom) XXX_Size() int { + return m.Size() +} +func (m *MsgRequestRandom) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRequestRandom.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRequestRandom proto.InternalMessageInfo + +func (m *MsgRequestRandom) GetBlockInterval() uint64 { + if m != nil { + return m.BlockInterval + } + return 0 +} + +func (m *MsgRequestRandom) GetConsumer() string { + if m != nil { + return m.Consumer + } + return "" +} + +func (m *MsgRequestRandom) GetOracle() bool { + if m != nil { + return m.Oracle + } + return false +} + +func (m *MsgRequestRandom) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { + if m != nil { + return m.ServiceFeeCap + } + return nil +} + +func init() { + proto.RegisterType((*MsgRequestRandom)(nil), "irismod.random.MsgRequestRandom") +} + +func init() { proto.RegisterFile("random/tx.proto", fileDescriptor_8734007206ce5490) } + +var fileDescriptor_8734007206ce5490 = []byte{ + // 351 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xc1, 0x6a, 0xe2, 0x40, + 0x1c, 0xc6, 0x33, 0x2a, 0xe2, 0x66, 0x51, 0x97, 0xb0, 0x2b, 0xd1, 0x43, 0x12, 0x72, 0xca, 0xc5, + 0xcc, 0xba, 0x7b, 0xdb, 0xd3, 0xa2, 0x50, 0x68, 0xa1, 0x14, 0x72, 0xec, 0x45, 0x26, 0x93, 0x7f, + 0x63, 0x30, 0xc9, 0x3f, 0xcd, 0x4c, 0xa4, 0xbe, 0x45, 0xe9, 0xbd, 0x2f, 0xd0, 0x27, 0xf1, 0xe8, + 0xb1, 0x27, 0x5b, 0xf4, 0x0d, 0x7c, 0x82, 0x62, 0x12, 0x0a, 0xed, 0xa5, 0xa7, 0x99, 0x6f, 0xbe, + 0x99, 0x1f, 0xf3, 0x7d, 0x7f, 0xb5, 0x9f, 0xb3, 0x34, 0xc0, 0x84, 0xca, 0x3b, 0x37, 0xcb, 0x51, + 0xa2, 0xd6, 0x8b, 0xf2, 0x48, 0x24, 0x18, 0xb8, 0x95, 0x31, 0xfa, 0x19, 0x62, 0x88, 0xa5, 0x45, + 0x4f, 0xbb, 0xea, 0xd6, 0xc8, 0xe0, 0x28, 0x12, 0x14, 0xd4, 0x67, 0x02, 0xe8, 0x6a, 0xe2, 0x83, + 0x64, 0x13, 0xca, 0x31, 0x4a, 0x2b, 0xdf, 0x7e, 0x6c, 0xa8, 0x3f, 0x2e, 0x45, 0xe8, 0xc1, 0x6d, + 0x01, 0x42, 0x7a, 0x25, 0x4a, 0xfb, 0xaf, 0xf6, 0xfc, 0x18, 0xf9, 0x72, 0x1e, 0xa5, 0x12, 0xf2, + 0x15, 0x8b, 0x75, 0x62, 0x11, 0xa7, 0x35, 0x1d, 0x1e, 0x77, 0xe6, 0xaf, 0x35, 0x4b, 0xe2, 0x7f, + 0xf6, 0x47, 0xdf, 0xf6, 0xba, 0xe5, 0xc1, 0x79, 0xad, 0xb5, 0x91, 0xda, 0xe1, 0x98, 0x8a, 0x22, + 0x81, 0x5c, 0x6f, 0x58, 0xc4, 0xf9, 0xe6, 0xbd, 0x6b, 0x6d, 0xa0, 0xb6, 0x31, 0x67, 0x3c, 0x06, + 0xbd, 0x69, 0x11, 0xa7, 0xe3, 0xd5, 0x4a, 0x7b, 0x20, 0x6a, 0x5f, 0x40, 0xbe, 0x8a, 0x38, 0xcc, + 0x6f, 0x00, 0xe6, 0x9c, 0x65, 0x7a, 0xcb, 0x6a, 0x3a, 0xdf, 0xff, 0x0c, 0xdd, 0x2a, 0x85, 0x7b, + 0x4a, 0xe1, 0xd6, 0x29, 0xdc, 0x19, 0x46, 0xe9, 0xf4, 0x6a, 0xb3, 0x33, 0x95, 0xe3, 0xce, 0x1c, + 0x54, 0xdf, 0xfa, 0xf4, 0xde, 0x7e, 0x7a, 0x31, 0xc7, 0x61, 0x24, 0x17, 0x85, 0xef, 0x72, 0x4c, + 0xe8, 0xa9, 0xb2, 0x14, 0x64, 0xb9, 0x2e, 0x0a, 0x7f, 0x2c, 0x82, 0xe5, 0x38, 0x44, 0x2a, 0xd7, + 0x19, 0x88, 0x92, 0x27, 0xbc, 0x6e, 0x8d, 0x38, 0x03, 0x98, 0xb1, 0x6c, 0x7a, 0xb1, 0xd9, 0x1b, + 0x64, 0xbb, 0x37, 0xc8, 0xeb, 0xde, 0x20, 0xf7, 0x07, 0x43, 0xd9, 0x1e, 0x0c, 0xe5, 0xf9, 0x60, + 0x28, 0xd7, 0xbf, 0xbf, 0xe6, 0x26, 0x18, 0x14, 0x31, 0x08, 0x5a, 0x4d, 0xc8, 0x6f, 0x97, 0x95, + 0xff, 0x7d, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x60, 0xe4, 0x82, 0xe7, 0xcb, 0x01, 0x00, 0x00, +} + +func (m *MsgRequestRandom) 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 *MsgRequestRandom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRequestRandom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.Oracle { + i-- + if m.Oracle { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x12 + } + if m.BlockInterval != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.BlockInterval)) + i-- + dAtA[i] = 0x8 + } + 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 *MsgRequestRandom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockInterval != 0 { + n += 1 + sovTx(uint64(m.BlockInterval)) + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Oracle { + n += 2 + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovTx(uint64(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 *MsgRequestRandom) 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: MsgRequestRandom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRequestRandom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockInterval", wireType) + } + m.BlockInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockInterval |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Oracle", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Oracle = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].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 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/module-sdk/random/types.go b/module-sdk/random/types.go new file mode 100644 index 00000000..b31a93df --- /dev/null +++ b/module-sdk/random/types.go @@ -0,0 +1,76 @@ +package random + +import ( + sdk "github.com/irisnet/core-sdk-go/types" +) + +const ( + ModuleName = "random" + + eventTypeRequestRequestRandom = "request_random" + attributeKeyRequestID = "request_id" + attributeKeyGenerateHeight = "generate_height" +) + +var ( + _ sdk.Msg = &MsgRequestRandom{} +) + +// Route implements Msg. +func (msg MsgRequestRandom) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgRequestRandom) Type() string { return "request_rand" } + +// ValidateBasic implements Msg. +func (msg MsgRequestRandom) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { + return sdk.Wrapf("invalid consumer address (%s)", err) + } + return nil +} + +// GetSignBytes implements Msg. +func (msg MsgRequestRandom) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(b) +} + +// GetSigners implements Msg. +func (msg MsgRequestRandom) GetSigners() []sdk.AccAddress { + consumer, err := sdk.AccAddressFromBech32(msg.Consumer) + if err != nil { + panic(err) + } + return []sdk.AccAddress{consumer} +} + +func (m Random) Convert() interface{} { + return QueryRandomResp{ + RequestTxHash: m.RequestTxHash, + Height: m.Height, + Value: m.Value, + } +} + +type Requests []Request + +func (m Requests) Convert() interface{} { + var res []QueryRandomRequestQueueResp + + for _, request := range m { + q := QueryRandomRequestQueueResp{ + Height: request.Height, + Consumer: request.Consumer, + TxHash: request.TxHash, + Oracle: request.Oracle, + ServiceFeeCap: request.ServiceFeeCap, + ServiceContextId: request.ServiceContextId, + } + res = append(res, q) + } + return res +} diff --git a/module-sdk/record/codec.go b/module-sdk/record/codec.go new file mode 100644 index 00000000..dfb03d04 --- /dev/null +++ b/module-sdk/record/codec.go @@ -0,0 +1,25 @@ +package record + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgCreateRecord{}, + ) +} diff --git a/module-sdk/record/export.go b/module-sdk/record/export.go new file mode 100644 index 00000000..868decde --- /dev/null +++ b/module-sdk/record/export.go @@ -0,0 +1,35 @@ +package record + +import ( + sdk "github.com/irisnet/core-sdk-go/types" +) + +// expose Record module api for user +type Client interface { + sdk.Module + + CreateRecord(request CreateRecordRequest, baseTx sdk.BaseTx) (string, sdk.Error) + QueryRecord(request QueryRecordReq) (QueryRecordResp, sdk.Error) +} + +type CreateRecordRequest struct { + Contents []Content +} + +type QueryRecordReq struct { + RecordID string `json:"record_id"` + Prove bool `json:"prove"` + Height int64 `json:"height"` +} + +type QueryRecordResp struct { + Record Data `json:"record"` + Proof sdk.ProofValue `json:"proof"` + Height int64 `json:"height"` +} + +type Data struct { + TxHash string `json:"tx_hash" yaml:"tx_hash"` + Contents []Content `json:"contents" yaml:"contents"` + Creator string `json:"creator" yaml:"creator"` +} diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod new file mode 100644 index 00000000..63ec5c4e --- /dev/null +++ b/module-sdk/record/go.mod @@ -0,0 +1,13 @@ +module gov + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/record/query.pb.go b/module-sdk/record/query.pb.go new file mode 100644 index 00000000..3ade2f2d --- /dev/null +++ b/module-sdk/record/query.pb.go @@ -0,0 +1,593 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: record/query.proto + +package record + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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 + +// QueryRecordRequest is the request type for the Query/Record RPC method +type QueryRecordRequest struct { + RecordId []byte `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty"` +} + +func (m *QueryRecordRequest) Reset() { *m = QueryRecordRequest{} } +func (m *QueryRecordRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRecordRequest) ProtoMessage() {} +func (*QueryRecordRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_45fc26642889837f, []int{0} +} +func (m *QueryRecordRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecordRequest.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 *QueryRecordRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordRequest.Merge(m, src) +} +func (m *QueryRecordRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRecordRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecordRequest proto.InternalMessageInfo + +func (m *QueryRecordRequest) GetRecordId() []byte { + if m != nil { + return m.RecordId + } + return nil +} + +// QueryRecordResponse is the response type for the Query/Record RPC method +type QueryRecordResponse struct { + Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` +} + +func (m *QueryRecordResponse) Reset() { *m = QueryRecordResponse{} } +func (m *QueryRecordResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRecordResponse) ProtoMessage() {} +func (*QueryRecordResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_45fc26642889837f, []int{1} +} +func (m *QueryRecordResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRecordResponse.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 *QueryRecordResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRecordResponse.Merge(m, src) +} +func (m *QueryRecordResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRecordResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRecordResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRecordResponse proto.InternalMessageInfo + +func (m *QueryRecordResponse) GetRecord() *Record { + if m != nil { + return m.Record + } + return nil +} + +func init() { + proto.RegisterType((*QueryRecordRequest)(nil), "irismod.record.QueryRecordRequest") + proto.RegisterType((*QueryRecordResponse)(nil), "irismod.record.QueryRecordResponse") +} + +func init() { proto.RegisterFile("record/query.proto", fileDescriptor_45fc26642889837f) } + +var fileDescriptor_45fc26642889837f = []byte{ + // 280 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4a, 0x4d, 0xce, + 0x2f, 0x4a, 0xd1, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, + 0xcb, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0xc8, 0x49, 0x09, 0x43, 0xd5, 0x40, 0x28, + 0x88, 0x22, 0x29, 0x99, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0xfd, 0xc4, 0x82, 0x4c, 0xfd, 0xc4, + 0xbc, 0xbc, 0xfc, 0x92, 0xc4, 0x92, 0xcc, 0xfc, 0xbc, 0x62, 0x88, 0xac, 0x92, 0x21, 0x97, 0x50, + 0x20, 0xc8, 0xc4, 0x20, 0xb0, 0x96, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x21, 0x69, 0x2e, + 0x4e, 0x88, 0x19, 0xf1, 0x99, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x1c, 0x10, 0x01, + 0xcf, 0x14, 0x25, 0x57, 0x2e, 0x61, 0x14, 0x2d, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x7a, + 0x5c, 0x6c, 0x10, 0x25, 0x60, 0x0d, 0xdc, 0x46, 0x62, 0x7a, 0xa8, 0xae, 0xd3, 0x83, 0xaa, 0x87, + 0xaa, 0x32, 0x6a, 0x67, 0xe4, 0x62, 0x05, 0x9b, 0x23, 0x54, 0xc7, 0xc5, 0x06, 0x91, 0x13, 0x52, + 0x42, 0xd7, 0x83, 0xe9, 0x36, 0x29, 0x65, 0xbc, 0x6a, 0x20, 0x8e, 0x51, 0xd2, 0x6e, 0xba, 0xfc, + 0x64, 0x32, 0x93, 0xaa, 0x90, 0xb2, 0x3e, 0x54, 0xb1, 0x3e, 0x4a, 0xd0, 0x14, 0xeb, 0x57, 0xc3, + 0xfd, 0x57, 0xeb, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, + 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, + 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0x60, 0x83, 0xf2, 0x52, 0x4b, 0xc0, + 0x74, 0x46, 0x69, 0x92, 0x6e, 0x71, 0x4a, 0xb6, 0x6e, 0x7a, 0xbe, 0x7e, 0x6e, 0x7e, 0x4a, 0x69, + 0x4e, 0x6a, 0x31, 0xd4, 0xe0, 0x24, 0x36, 0x70, 0xb0, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, + 0x5b, 0x6a, 0xea, 0xc1, 0xaf, 0x01, 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 { + // Record queries the record by the given record ID + Record(ctx context.Context, in *QueryRecordRequest, opts ...grpc.CallOption) (*QueryRecordResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Record(ctx context.Context, in *QueryRecordRequest, opts ...grpc.CallOption) (*QueryRecordResponse, error) { + out := new(QueryRecordResponse) + err := c.cc.Invoke(ctx, "/irismod.record.Query/Record", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Record queries the record by the given record ID + Record(context.Context, *QueryRecordRequest) (*QueryRecordResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Record(ctx context.Context, req *QueryRecordRequest) (*QueryRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Record not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Record_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRecordRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Record(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.record.Query/Record", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Record(ctx, req.(*QueryRecordRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.record.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Record", + Handler: _Query_Record_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "record/query.proto", +} + +func (m *QueryRecordRequest) 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 *QueryRecordRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRecordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RecordId) > 0 { + i -= len(m.RecordId) + copy(dAtA[i:], m.RecordId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RecordId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRecordResponse) 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 *QueryRecordResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Record != nil { + { + size, err := m.Record.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 *QueryRecordRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RecordId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRecordResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Record != nil { + l = m.Record.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 *QueryRecordRequest) 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: QueryRecordRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRecordRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RecordId", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RecordId = append(m.RecordId[:0], dAtA[iNdEx:postIndex]...) + if m.RecordId == nil { + m.RecordId = []byte{} + } + 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 *QueryRecordResponse) 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: QueryRecordResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Record", 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.Record == nil { + m.Record = &Record{} + } + if err := m.Record.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/module-sdk/record/record.go b/module-sdk/record/record.go new file mode 100644 index 00000000..2a013256 --- /dev/null +++ b/module-sdk/record/record.go @@ -0,0 +1,86 @@ +package record + +import ( + "encoding/hex" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" +) + +type recordClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { + return recordClient{ + BaseClient: bc, + Marshaler: cdc, + } +} + +func (r recordClient) Name() string { + return ModuleName +} + +func (r recordClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (r recordClient) CreateRecord(request CreateRecordRequest, baseTx sdk.BaseTx) (string, sdk.Error) { + creator, err := r.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return "", sdk.Wrap(err) + } + + msg := &MsgCreateRecord{ + Contents: request.Contents, + Creator: creator.String(), + } + + res, err := r.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return "", err + } + + recordID, er := res.Events.GetValue(eventTypeCreateRecord, attributeKeyRecordID) + if er != nil { + return "", sdk.Wrap(er) + } + + return recordID, nil +} + +func (r recordClient) QueryRecord(request QueryRecordReq) (QueryRecordResp, sdk.Error) { + rID, err := hex.DecodeString(request.RecordID) + if err != nil { + return QueryRecordResp{}, sdk.Wrapf("invalid record id, must be hex encoded string,but got %s", request.RecordID) + } + + recordKey := GetRecordKey(rID) + + res, err := r.QueryStore(recordKey, ModuleName, request.Height, request.Prove) + if err != nil { + return QueryRecordResp{}, sdk.Wrap(err) + } + + var record Record + if err := r.Marshaler.UnmarshalBinaryBare(res.Value, &record); err != nil { + return QueryRecordResp{}, sdk.Wrap(err) + } + + result := record.Convert().(QueryRecordResp) + + var proof []byte + if request.Prove { + proof = r.MustMarshalJSON(res.ProofOps) + } + + result.Proof = sdk.ProofValue{ + Proof: proof, + Path: []string{ModuleName, string(recordKey)}, + Value: res.Value, + } + result.Height = res.Height + return result, nil +} diff --git a/module-sdk/record/record.pb.go b/module-sdk/record/record.pb.go new file mode 100644 index 00000000..f0b0e46f --- /dev/null +++ b/module-sdk/record/record.pb.go @@ -0,0 +1,782 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: record/record.proto + +package record + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +// Content defines the detailed information for a record. +type Content struct { + Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` + DigestAlgo string `protobuf:"bytes,2,opt,name=digest_algo,json=digestAlgo,proto3" json:"digest_algo,omitempty" yaml:"digest_algo"` + URI string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"` + Meta string `protobuf:"bytes,4,opt,name=meta,proto3" json:"meta,omitempty"` +} + +func (m *Content) Reset() { *m = Content{} } +func (m *Content) String() string { return proto.CompactTextString(m) } +func (*Content) ProtoMessage() {} +func (*Content) Descriptor() ([]byte, []int) { + return fileDescriptor_197cabccbeb2a7b7, []int{0} +} +func (m *Content) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Content.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 *Content) XXX_Merge(src proto.Message) { + xxx_messageInfo_Content.Merge(m, src) +} +func (m *Content) XXX_Size() int { + return m.Size() +} +func (m *Content) XXX_DiscardUnknown() { + xxx_messageInfo_Content.DiscardUnknown(m) +} + +var xxx_messageInfo_Content proto.InternalMessageInfo + +type Record struct { + TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"tx_hash"` + Contents []Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents"` + Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *Record) Reset() { *m = Record{} } +func (m *Record) String() string { return proto.CompactTextString(m) } +func (*Record) ProtoMessage() {} +func (*Record) Descriptor() ([]byte, []int) { + return fileDescriptor_197cabccbeb2a7b7, []int{1} +} +func (m *Record) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Record.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 *Record) XXX_Merge(src proto.Message) { + xxx_messageInfo_Record.Merge(m, src) +} +func (m *Record) XXX_Size() int { + return m.Size() +} +func (m *Record) XXX_DiscardUnknown() { + xxx_messageInfo_Record.DiscardUnknown(m) +} + +var xxx_messageInfo_Record proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Content)(nil), "irismod.record.Content") + proto.RegisterType((*Record)(nil), "irismod.record.Record") +} + +func init() { proto.RegisterFile("record/record.proto", fileDescriptor_197cabccbeb2a7b7) } + +var fileDescriptor_197cabccbeb2a7b7 = []byte{ + // 336 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x51, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x8d, 0x9b, 0x28, 0x01, 0x57, 0xea, 0x60, 0x50, 0x09, 0x0c, 0x49, 0x95, 0xa9, 0x12, 0x6a, + 0x82, 0x60, 0x40, 0x74, 0x23, 0x2c, 0xb0, 0x30, 0x58, 0x62, 0x61, 0xa9, 0xd2, 0x24, 0x72, 0x22, + 0x92, 0x1a, 0xd9, 0x8e, 0x54, 0xbe, 0x82, 0x7e, 0x02, 0x9f, 0xd3, 0xb1, 0x23, 0x53, 0x04, 0xe9, + 0xc2, 0xdc, 0x2f, 0x40, 0xb1, 0x03, 0x82, 0xe9, 0xde, 0xbb, 0x77, 0xd6, 0x7b, 0x77, 0x86, 0x07, + 0x2c, 0x8d, 0x29, 0x4b, 0x02, 0x55, 0xfc, 0x67, 0x46, 0x05, 0x45, 0x83, 0x9c, 0xe5, 0xbc, 0xa4, + 0x89, 0xaf, 0xba, 0x27, 0x87, 0x84, 0x12, 0x2a, 0xa5, 0xa0, 0x45, 0x6a, 0xca, 0x7b, 0x05, 0xd0, + 0xba, 0xa1, 0x0b, 0x91, 0x2e, 0x04, 0x1a, 0x42, 0x33, 0xc9, 0x49, 0xca, 0x85, 0x0d, 0x46, 0x60, + 0xbc, 0x8f, 0x3b, 0x86, 0x2e, 0x61, 0x5f, 0xa1, 0x59, 0x54, 0x10, 0x6a, 0xf7, 0x5a, 0x31, 0x1c, + 0xee, 0x6a, 0x17, 0xbd, 0x44, 0x65, 0x31, 0xf5, 0xfe, 0x88, 0x1e, 0x86, 0x8a, 0x5d, 0x17, 0x84, + 0xa2, 0x63, 0xa8, 0x57, 0x2c, 0xb7, 0x75, 0xf9, 0xc0, 0x6a, 0x6a, 0x57, 0x7f, 0xc0, 0x77, 0xb8, + 0xed, 0x21, 0x04, 0x8d, 0x32, 0x15, 0x91, 0x6d, 0x48, 0x27, 0x89, 0xa7, 0xc6, 0xd7, 0x9b, 0x0b, + 0xbc, 0x15, 0x80, 0x26, 0x96, 0x91, 0xd1, 0x29, 0xb4, 0xc4, 0x72, 0x96, 0x45, 0x3c, 0x53, 0x89, + 0x42, 0xb4, 0xab, 0xdd, 0x81, 0x32, 0xed, 0x04, 0x0f, 0x9b, 0x62, 0x79, 0x1b, 0xf1, 0x0c, 0x5d, + 0xc1, 0xbd, 0x58, 0x2d, 0xc2, 0xed, 0xde, 0x48, 0x1f, 0xf7, 0xcf, 0x8f, 0xfc, 0xff, 0x27, 0xf0, + 0xbb, 0x45, 0x43, 0x63, 0x5d, 0xbb, 0x1a, 0xfe, 0x1d, 0x47, 0x36, 0xb4, 0x62, 0x96, 0x46, 0x82, + 0x32, 0x95, 0x15, 0xff, 0x50, 0x15, 0x29, 0xbc, 0x5f, 0x7f, 0x3a, 0xda, 0xba, 0x71, 0xc0, 0xa6, + 0x71, 0xc0, 0x47, 0xe3, 0x80, 0xd5, 0xd6, 0xd1, 0x36, 0x5b, 0x47, 0x7b, 0xdf, 0x3a, 0xda, 0xe3, + 0x19, 0xc9, 0x45, 0x56, 0xcd, 0xfd, 0x98, 0x96, 0x41, 0x6b, 0xb8, 0x48, 0x85, 0xac, 0x59, 0x35, + 0x9f, 0xf0, 0xe4, 0x69, 0x42, 0x68, 0x50, 0xd2, 0xa4, 0x2a, 0x52, 0xde, 0x7d, 0xd0, 0xdc, 0x94, + 0xb7, 0xbf, 0xf8, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x4e, 0x10, 0xde, 0xb8, 0x01, 0x00, 0x00, +} + +func (this *Content) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Content) + if !ok { + that2, ok := that.(Content) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Digest != that1.Digest { + return false + } + if this.DigestAlgo != that1.DigestAlgo { + return false + } + if this.URI != that1.URI { + return false + } + if this.Meta != that1.Meta { + return false + } + return true +} +func (this *Record) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Record) + if !ok { + that2, ok := that.(Record) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.TxHash != that1.TxHash { + return false + } + if len(this.Contents) != len(that1.Contents) { + return false + } + for i := range this.Contents { + if !this.Contents[i].Equal(&that1.Contents[i]) { + return false + } + } + if this.Creator != that1.Creator { + return false + } + return true +} +func (m *Content) 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 *Content) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Content) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Meta) > 0 { + i -= len(m.Meta) + copy(dAtA[i:], m.Meta) + i = encodeVarintRecord(dAtA, i, uint64(len(m.Meta))) + i-- + dAtA[i] = 0x22 + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintRecord(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x1a + } + if len(m.DigestAlgo) > 0 { + i -= len(m.DigestAlgo) + copy(dAtA[i:], m.DigestAlgo) + i = encodeVarintRecord(dAtA, i, uint64(len(m.DigestAlgo))) + i-- + dAtA[i] = 0x12 + } + if len(m.Digest) > 0 { + i -= len(m.Digest) + copy(dAtA[i:], m.Digest) + i = encodeVarintRecord(dAtA, i, uint64(len(m.Digest))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Record) 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 *Record) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintRecord(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0x1a + } + if len(m.Contents) > 0 { + for iNdEx := len(m.Contents) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Contents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintRecord(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintRecord(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRecord(dAtA []byte, offset int, v uint64) int { + offset -= sovRecord(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Content) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Digest) + if l > 0 { + n += 1 + l + sovRecord(uint64(l)) + } + l = len(m.DigestAlgo) + if l > 0 { + n += 1 + l + sovRecord(uint64(l)) + } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovRecord(uint64(l)) + } + l = len(m.Meta) + if l > 0 { + n += 1 + l + sovRecord(uint64(l)) + } + return n +} + +func (m *Record) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovRecord(uint64(l)) + } + if len(m.Contents) > 0 { + for _, e := range m.Contents { + l = e.Size() + n += 1 + l + sovRecord(uint64(l)) + } + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovRecord(uint64(l)) + } + return n +} + +func sovRecord(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRecord(x uint64) (n int) { + return sovRecord(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Content) 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 ErrIntOverflowRecord + } + 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: Content: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Digest", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } + 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 ErrInvalidLengthRecord + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Digest = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DigestAlgo", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } + 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 ErrInvalidLengthRecord + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DigestAlgo = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } + 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 ErrInvalidLengthRecord + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } + 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 ErrInvalidLengthRecord + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Meta = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRecord(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRecord + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Record) 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 ErrIntOverflowRecord + } + 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: Record: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } + 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 ErrInvalidLengthRecord + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRecord + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contents = append(m.Contents, Content{}) + if err := m.Contents[len(m.Contents)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRecord + } + 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 ErrInvalidLengthRecord + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRecord + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRecord(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRecord + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRecord(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, ErrIntOverflowRecord + } + 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, ErrIntOverflowRecord + } + 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, ErrIntOverflowRecord + } + 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, ErrInvalidLengthRecord + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRecord + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRecord + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRecord = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRecord = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/record/tx.pb.go b/module-sdk/record/tx.pb.go new file mode 100644 index 00000000..578c569e --- /dev/null +++ b/module-sdk/record/tx.pb.go @@ -0,0 +1,401 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: record/tx.proto + +package record + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +// MsgCreateValidator defines an SDK message for creating a new validator. +type MsgCreateRecord struct { + Contents []Content `protobuf:"bytes,1,rep,name=contents,proto3" json:"contents"` + Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgCreateRecord) Reset() { *m = MsgCreateRecord{} } +func (m *MsgCreateRecord) String() string { return proto.CompactTextString(m) } +func (*MsgCreateRecord) ProtoMessage() {} +func (*MsgCreateRecord) Descriptor() ([]byte, []int) { + return fileDescriptor_81225f4a7a6988bf, []int{0} +} +func (m *MsgCreateRecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateRecord.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 *MsgCreateRecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateRecord.Merge(m, src) +} +func (m *MsgCreateRecord) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateRecord) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateRecord.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateRecord proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateRecord)(nil), "irismod.record.MsgCreateRecord") +} + +func init() { proto.RegisterFile("record/tx.proto", fileDescriptor_81225f4a7a6988bf) } + +var fileDescriptor_81225f4a7a6988bf = []byte{ + // 226 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x4a, 0x4d, 0xce, + 0x2f, 0x4a, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x2c, 0xca, + 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0x48, 0x48, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xa5, 0xf4, + 0x41, 0x2c, 0x88, 0x2a, 0x29, 0x61, 0xa8, 0x36, 0x08, 0x05, 0x11, 0x54, 0xca, 0xe1, 0xe2, 0xf7, + 0x2d, 0x4e, 0x77, 0x2e, 0x4a, 0x4d, 0x2c, 0x49, 0x0d, 0x02, 0x4b, 0x08, 0x59, 0x72, 0x71, 0x24, + 0xe7, 0xe7, 0x95, 0xa4, 0xe6, 0x95, 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0x89, 0xeb, + 0xa1, 0x5a, 0xa0, 0xe7, 0x0c, 0x91, 0x77, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xae, 0x5c, + 0x48, 0x82, 0x8b, 0x3d, 0x19, 0x64, 0x54, 0x7e, 0x91, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x67, 0x10, + 0x8c, 0x6b, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x93, 0xdf, 0x89, 0x87, 0x72, 0x0c, 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, 0x65, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, + 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xb2, 0x30, 0x2f, 0xb5, 0x04, 0x4c, 0x67, 0x94, 0x26, 0xe9, 0x16, + 0xa7, 0x64, 0xeb, 0xa6, 0xe7, 0xeb, 0xe7, 0xe6, 0xa7, 0x94, 0xe6, 0xa4, 0x16, 0x43, 0xfd, 0x90, + 0xc4, 0x06, 0xf6, 0x84, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x67, 0xaa, 0xf5, 0x96, 0x12, 0x01, + 0x00, 0x00, +} + +func (this *MsgCreateRecord) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgCreateRecord) + if !ok { + that2, ok := that.(MsgCreateRecord) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Contents) != len(that1.Contents) { + return false + } + for i := range this.Contents { + if !this.Contents[i].Equal(&that1.Contents[i]) { + return false + } + } + if this.Creator != that1.Creator { + return false + } + return true +} +func (m *MsgCreateRecord) 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 *MsgCreateRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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] = 0x12 + } + if len(m.Contents) > 0 { + for iNdEx := len(m.Contents) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Contents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func 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 *MsgCreateRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Contents) > 0 { + for _, e := range m.Contents { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(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 *MsgCreateRecord) 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: MsgCreateRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contents = append(m.Contents, Content{}) + if err := m.Contents[len(m.Contents)-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 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 + 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/module-sdk/record/types.go b/module-sdk/record/types.go new file mode 100644 index 00000000..68044e57 --- /dev/null +++ b/module-sdk/record/types.go @@ -0,0 +1,78 @@ +package record + +import ( + "fmt" + sdk "github.com/irisnet/core-sdk-go/types" +) + +const ( + ModuleName = "record" + + attributeKeyRecordID = "record_id" + eventTypeCreateRecord = "create_record" +) + +var ( + _ sdk.Msg = &MsgCreateRecord{} + + recordKey = []byte{0x01} // record key +) + +// Route implements Msg. +func (msg MsgCreateRecord) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgCreateRecord) Type() string { return "create_record" } + +// GetSignBytes implements Msg. +func (msg MsgCreateRecord) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgCreateRecord) ValidateBasic() error { + if len(msg.Contents) == 0 { + return fmt.Errorf("contents missing") + } + if len(msg.Creator) == 0 { + return fmt.Errorf("creator missing") + } + + if err := sdk.ValidateAccAddress(msg.Creator); err != nil { + return sdk.Wrap(err) + } + + for i, content := range msg.Contents { + if len(content.Digest) == 0 { + return fmt.Errorf("content[%d] digest missing", i) + } + if len(content.DigestAlgo) == 0 { + return fmt.Errorf("content[%d] digest algo missing", i) + } + } + return nil +} + +// GetSigners implements Msg. +func (msg MsgCreateRecord) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Creator)} +} + +func (this Record) Convert() interface{} { + return QueryRecordResp{ + Record: Data{ + TxHash: this.TxHash, + Contents: this.Contents, + Creator: this.Creator, + }, + } +} + +// GetRecordKey returns record key bytes +func GetRecordKey(recordID []byte) []byte { + return append(recordKey, recordID...) +} diff --git a/module-sdk/service/codec.go b/module-sdk/service/codec.go new file mode 100644 index 00000000..4e3ccf91 --- /dev/null +++ b/module-sdk/service/codec.go @@ -0,0 +1,38 @@ +package service + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgDefineService{}, + &MsgBindService{}, + &MsgUpdateServiceBinding{}, + &MsgSetWithdrawAddress{}, + &MsgDisableServiceBinding{}, + &MsgEnableServiceBinding{}, + &MsgRefundServiceDeposit{}, + &MsgCallService{}, + &MsgRespondService{}, + &MsgPauseRequestContext{}, + &MsgStartRequestContext{}, + &MsgKillRequestContext{}, + &MsgUpdateRequestContext{}, + &MsgWithdrawEarnedFees{}, + ) +} diff --git a/module-sdk/service/doc.go b/module-sdk/service/doc.go new file mode 100644 index 00000000..15fe8ffc --- /dev/null +++ b/module-sdk/service/doc.go @@ -0,0 +1,106 @@ +// Package service bridge the gap between the blockchain world and the conventional business application world, +// by mediating a complete lifecycle of off-chain services -- from their definition, binding (provider registration), invocation, to their governance (profiling and dispute resolution). +// +// By enhancing the IBC processing logic to support service semantics, the SDK is intended to allow distributed business services to be available across the internet of blockchains. +// The Interface description language (IDL) we introduced is to work with the service standardized definitions to satisfy service invocations across different programming languages. The currently supported IDL language is protobuf +// +// As a quick start: +// +// schemas := `{"input":{"type":"object"},"output":{"type":"object"},"error":{"type":"object"}}` +// pricing := `{"price":"1point"}` +// testResult := `{"code":200,"message":""}` +// +// baseTx := sdk.BaseTx{ +// From: "test1", +// Gas: 20000, +// Memo: "test", +// Mode: sdk.Commit, +// } +// +// definition := rpc.ServiceDefinitionRequest{ +// ServiceName: generateServiceName(), +// Description: "this is a test service", +// Event: nil, +// AuthorDescription: "service provider", +// Schemas: schemas, +// } +// +// result, err := sts.ServiceI.DefineService(definition, baseTx) +// require.NoError(sts.T(), err) +// require.NotEmpty(sts.T(), result.Hash) +// +// defi, err := sts.ServiceI.QueryServiceDefinition(definition.ServiceName) +// require.NoError(sts.T(), err) +// require.Equal(sts.T(), definition.ServiceName, defi.Name) +// require.Equal(sts.T(), definition.Description, defi.Description) +// require.EqualValues(sts.T(), definition.Event, defi.Event) +// require.Equal(sts.T(), definition.AuthorDescription, defi.AuthorDescription) +// require.Equal(sts.T(), definition.Schemas, defi.Schemas) +// require.Equal(sts.T(), sts.Sender(), defi.Author) +// +// deposit, _ := sdk.ParseCoins("20000000000000000000000point") +// binding := rpc.ServiceBindingRequest{ +// ServiceName: definition.ServiceName, +// Deposit: deposit, +// Pricing: pricing, +// } +// result, err = sts.ServiceI.BindService(binding, baseTx) +// require.NoError(sts.T(), err) +// require.NotEmpty(sts.T(), result.Hash) +// +// bindResp, err := sts.ServiceI.QueryServiceBinding(definition.ServiceName, sts.Sender()) +// require.NoError(sts.T(), err) +// require.Equal(sts.T(), binding.ServiceName, bindResp.ServiceName) +// require.Equal(sts.T(), sts.Sender(), bindResp.Provider) +// require.Equal(sts.T(), binding.Deposit.String(), bindResp.Deposit.String()) +// require.Equal(sts.T(), binding.Pricing, bindResp.Pricing) +// +// input := `{"pair":"point-usdt"}` +// output := `{"last":"1:100"}` +// +// err = sts.ServiceI.SubscribeSingleServiceRequest(definition.ServiceName, +// func(reqCtxID, reqID, input string) (string, string) { +// sts.Info(). +// Str("input", input). +// Str("output", output). +// Msg("provider received request") +// return output, testResult +// }, baseTx) +// require.NoError(sts.T(), err) +// +// serviceFeeCap, _ := sdk.ParseCoins("1000000000000000000point") +// invocation := rpc.ServiceInvocationRequest{ +// ServiceName: definition.ServiceName, +// Providers: []string{sts.Sender().String()}, +// Input: input, +// ServiceFeeCap: serviceFeeCap, +// Timeout: 3, +// Repeated: true, +// RepeatedFrequency: 5, +// RepeatedTotal: -1, +// } +// var requestContextID string +// var exit = make(chan int, 0) +// requestContextID, err = sts.ServiceI.InvokeService(invocation, func(reqCtxID, reqID, responses string) { +// require.Equal(sts.T(), reqCtxID, requestContextID) +// require.Equal(sts.T(), output, response) +// sts.Info(). +// Str("requestContextID", requestContextID). +// Str("response", response). +// Msg("consumer received response") +// exit <- 1 +// }, baseTx) +// +// sts.Info(). +// Str("requestContextID", requestContextID). +// Msg("ServiceRequest service success") +// require.NoError(sts.T(), err) +// +// request, err := sts.ServiceI.QueryRequestContext(requestContextID) +// require.NoError(sts.T(), err) +// require.Equal(sts.T(), request.ServiceName, invocation.ServiceName) +// require.Equal(sts.T(), request.Input, invocation.Input) +// +// <-exit +// +package service diff --git a/module-sdk/service/export.go b/module-sdk/service/export.go new file mode 100644 index 00000000..e66d11ff --- /dev/null +++ b/module-sdk/service/export.go @@ -0,0 +1,198 @@ +package service + +import ( + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/query" + "time" +) + +// Tx defines a set of transaction interfaces in the service module +type Tx interface { + DefineService(request DefineServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + BindService(request BindServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + InvokeService(request InvokeServiceRequest, baseTx sdk.BaseTx) (string, sdk.ResultTx, sdk.Error) + InvokeServiceResponse(request InvokeServiceResponseRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + SetWithdrawAddress(withdrawAddress string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + UpdateServiceBinding(request UpdateServiceBindingRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + DisableServiceBinding(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + EnableServiceBinding(serviceName, provider string, deposit sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + RefundServiceDeposit(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + PauseRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + StartRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + KillRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + UpdateRequestContext(request UpdateRequestContextRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + WithdrawEarnedFees(provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + SubscribeServiceRequest(serviceName string, callback RespondCallback, baseTx sdk.BaseTx) (sdk.Subscription, sdk.Error) + SubscribeServiceResponse(reqCtxID string, callback InvokeCallback) (sdk.Subscription, sdk.Error) +} + +// Query defines a set of query interfaces in the service module +type Query interface { + QueryServiceDefinition(serviceName string) (QueryServiceDefinitionResponse, sdk.Error) + QueryServiceBinding(serviceName string, provider string) (QueryServiceBindingResponse, sdk.Error) + QueryServiceBindings(serviceName string, pageReq *query.PageRequest) ([]QueryServiceBindingResponse, sdk.Error) + QueryServiceRequest(requestID string) (QueryServiceRequestResponse, sdk.Error) + QueryServiceRequests(serviceName string, provider string, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) + QueryRequestsByReqCtx(requestContextID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) + QueryServiceResponse(requestID string) (QueryServiceResponseResponse, sdk.Error) + QueryServiceResponses(requestContextID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceResponseResponse, sdk.Error) + QueryRequestContext(requestContextID string) (QueryRequestContextResp, sdk.Error) + QueryFees(provider string) (sdk.Coins, sdk.Error) + QueryParams() (QueryParamsResp, sdk.Error) +} + +// Client defines a set of interfaces in the service module +type Client interface { + sdk.Module + Tx + Query +} + +// InvokeCallback defines the callback function for service calls +type InvokeCallback func(reqCtxID, reqID, responses string) + +// RespondCallback defines the callback function of the service response +type RespondCallback func(reqCtxID, reqID, input string) (output string, result string) + +// Registry defines a set of service invocation interfaces +type Registry map[string]RespondCallback + +// Request defines a request which contains the detailed request data +type QueryServiceRequestResponse struct { + ID string `json:"id"` + ServiceName string `json:"service_name"` + Provider string `json:"provider"` + Consumer string `json:"consumer"` + Input string `json:"input"` + ServiceFee sdk.Coins `json:"service_fee"` + SuperMode bool `json:"super_mode"` + RequestHeight int64 `json:"request_height"` + ExpirationHeight int64 `json:"expiration_height"` + RequestContextID string `json:"request_context_id"` + RequestContextBatchCounter uint64 `json:"request_context_batch_counter"` +} + +// Response defines a response +type QueryServiceResponseResponse struct { + Provider string `json:"provider"` + Consumer string `json:"consumer"` + Output string `json:"output"` + Result string `json:"error"` + RequestContextID string `json:"request_context_id"` + RequestContextBatchCounter uint64 `json:"request_context_batch_counter"` +} + +// DefineServiceRequest defines the request parameters of the service definition +type DefineServiceRequest struct { + ServiceName string `json:"service_name"` + Description string `json:"description"` + Tags []string `json:"tags"` + AuthorDescription string `json:"author_description"` + Schemas string `json:"schemas"` +} + +// QueryServiceDefinitionResponse represents a service definition +type QueryServiceDefinitionResponse struct { + Name string `json:"name"` + Description string `json:"description"` + Tags []string `json:"tags"` + Author string `json:"author"` + AuthorDescription string `json:"author_description"` + Schemas string `json:"schemas"` +} + +// BindServiceRequest defines the request parameters of the service binding +type BindServiceRequest struct { + ServiceName string `json:"service_name"` + Deposit sdk.DecCoins `json:"deposit"` + Pricing string `json:"pricing"` + QoS uint64 `json:"qos"` + Options string `json:"options"` + Provider string `json:"provider"` +} + +// UpdateServiceBindingRequest defines a message to update a service binding +type UpdateServiceBindingRequest struct { + ServiceName string `json:"service_name"` + Deposit sdk.DecCoins `json:"deposit"` + Pricing string `json:"pricing"` + QoS uint64 `json:"qos"` + Provider string `json:"provider"` +} + +// QueryServiceBindingResponse defines a struct for service binding +type QueryServiceBindingResponse struct { + ServiceName string `json:"service_name"` + Provider string `json:"provider"` + Deposit sdk.Coins `json:"deposit"` + Pricing string `json:"pricing"` + QoS uint64 `json:"qos"` + Options string `json:"options"` + Available bool `json:"available"` + DisabledTime time.Time `json:"disabled_time"` + Owner string `json:"owner"` +} + +// InvokeServiceRequest defines the request parameters of the service call +type InvokeServiceRequest struct { + ServiceName string `json:"service_name"` + Providers []string `json:"providers"` + Input string `json:"input"` + ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` + Timeout int64 `json:"timeout"` + SuperMode bool `json:"super_mode"` + Repeated bool `json:"repeated"` + RepeatedFrequency uint64 `json:"repeated_frequency"` + RepeatedTotal int64 `json:"repeated_total"` + Callback InvokeCallback +} + +// InvokeServiceResponseRequest defines the request parameters of the service response +type InvokeServiceResponseRequest struct { + RequestId string `json:"request_id"` + Output string `json:"output"` + Result string `json:"result"` +} + +// UpdateRequestContextRequest defines a message to update a request context +type UpdateRequestContextRequest struct { + RequestContextID string `json:"request_context_id"` + Providers []string `json:"providers"` + ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` + Timeout int64 `json:"timeout"` + RepeatedFrequency uint64 `json:"repeated_frequency"` + RepeatedTotal int64 `json:"repeated_total"` +} + +// QueryRequestContextResp defines a context which holds request-related data +type QueryRequestContextResp struct { + ServiceName string `json:"service_name"` + Providers []string `json:"providers"` + Consumer string `json:"consumer"` + Input string `json:"input"` + ServiceFeeCap sdk.Coins `json:"service_fee_cap"` + Timeout int64 `json:"timeout"` + SuperMode bool `json:"super_mode"` + Repeated bool `json:"repeated"` + RepeatedFrequency uint64 `json:"repeated_frequency"` + RepeatedTotal int64 `json:"repeated_total"` + BatchCounter uint64 `json:"batch_counter"` + BatchRequestCount uint32 `json:"batch_request_count"` + BatchResponseCount uint32 `json:"batch_response_count"` + BatchState string `json:"batch_state"` + State string `json:"state"` + ResponseThreshold uint32 `json:"response_threshold"` + ModuleName string `json:"module_name"` +} + +type QueryParamsResp struct { + MaxRequestTimeout int64 `json:"max_request_timeout"` + MinDepositMultiple int64 `json:"min_deposit_multiple"` + MinDeposit string `json:"min_deposit"` + ServiceFeeTax string `json:"service_fee_tax"` + SlashFraction string `json:"slash_fraction"` + ComplaintRetrospect time.Duration `json:"complaint_retrospect"` + ArbitrationTimeLimit time.Duration `json:"arbitration_time_limit"` + TxSizeLimit uint64 `json:"tx_size_limit"` + BaseDenom string `json:"base_denom"` +} diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod new file mode 100644 index 00000000..63ec5c4e --- /dev/null +++ b/module-sdk/service/go.mod @@ -0,0 +1,13 @@ +module gov + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/service/params.go b/module-sdk/service/params.go new file mode 100644 index 00000000..c973feb3 --- /dev/null +++ b/module-sdk/service/params.go @@ -0,0 +1,11 @@ +package service + +import ( + yaml "gopkg.in/yaml.v2" +) + +// String implements the stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} diff --git a/module-sdk/service/query.go b/module-sdk/service/query.go new file mode 100644 index 00000000..4bee8b27 --- /dev/null +++ b/module-sdk/service/query.go @@ -0,0 +1,196 @@ +package service + +import ( + "context" + "encoding/binary" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + sdk "github.com/irisnet/core-sdk-go/types" +) + +// queryRequestContextByTxQuery will query for a single request context via a direct txs tags query. +func (s serviceClient) queryRequestContextByTxQuery(reqCtxID string) (RequestContext, error) { + txHash, msgIndex, err := splitRequestContextID(reqCtxID) + if err != nil { + return RequestContext{}, err + } + + txInfo, err := s.QueryTx(hex.EncodeToString(txHash)) + if err != nil { + return RequestContext{}, err + } + + if int64(len(txInfo.Tx.GetMsgs())) > msgIndex { + msg := txInfo.Tx.GetMsgs()[msgIndex] + if msg, ok := msg.(*MsgCallService); ok { + return RequestContext{ + ServiceName: msg.ServiceName, + Providers: msg.Providers, + Consumer: msg.Consumer, + Input: msg.Input, + ServiceFeeCap: msg.ServiceFeeCap, + Timeout: msg.Timeout, + Repeated: msg.Repeated, + RepeatedFrequency: msg.RepeatedFrequency, + RepeatedTotal: msg.RepeatedTotal, + BatchCounter: uint64(msg.RepeatedTotal), + BatchRequestCount: 0, + BatchResponseCount: 0, + BatchState: BATCHCOMPLETED, + State: COMPLETED, + ResponseThreshold: 0, + ModuleName: "", + }, nil + } + } + return RequestContext{}, fmt.Errorf("invalid reqCtxID:%s", reqCtxID) +} + +// queryRequestByTxQuery will query for a single request via a direct txs tags query. +func (s serviceClient) queryRequestByTxQuery(requestID string) (Request, error) { + reqCtxID, _, requestHeight, batchRequestIndex, err := splitRequestID(requestID) + if err != nil { + return Request{}, err + } + + // query request context + reqCtx, err := s.QueryRequestContext(hex.EncodeToString(reqCtxID)) + if err != nil { + return Request{}, err + } + + blockResult, err := s.BlockResults(context.Background(), &requestHeight) + if err != nil { + return Request{}, err + } + + for _, event := range blockResult.EndBlockEvents { + if event.Type == eventTypeNewBatchRequest { + var found bool + var requestsBz []byte + for _, attribute := range event.Attributes { + if string(attribute.Key) == attributeKeyRequests { + requestsBz = attribute.GetValue() + } + if string(attribute.Key) == attributeKeyRequestContextID && + string(attribute.GetValue()) == reqCtxID.String() { + found = true + } + } + + if found { + var requests []CompactRequest + if err := json.Unmarshal(requestsBz, &requests); err != nil { + return Request{}, err + } + if len(requests) > int(batchRequestIndex) { + compactRequest := requests[batchRequestIndex] + return Request{ + Id: sdk.MustHexBytesFrom(requestID).String(), + ServiceName: reqCtx.ServiceName, + Provider: compactRequest.Provider, + Consumer: reqCtx.Consumer, + Input: reqCtx.Input, + ServiceFee: compactRequest.ServiceFee, + RequestHeight: compactRequest.RequestHeight, + ExpirationHeight: compactRequest.RequestHeight + reqCtx.Timeout, + RequestContextId: compactRequest.RequestContextId, + RequestContextBatchCounter: compactRequest.RequestContextBatchCounter, + }, nil + } + } + } + } + return Request{}, fmt.Errorf("invalid requestID:%s", requestID) +} + +// queryResponseByTxQuery will query for a single request via a direct txs tags query. +func (s serviceClient) queryResponseByTxQuery(requestID string) (Response, error) { + builder := sdk.NewEventQueryBuilder().AddCondition( + sdk.NewCond( + sdk.EventTypeMessage, + sdk.AttributeKeyAction, + ).EQ("respond_service"), + ).AddCondition( + sdk.NewCond( + sdk.EventTypeMessage, + sdk.AttributeKeyAction, + ).EQ(attributeKeyRequestID), + ) + + result, err := s.QueryTxs(builder, nil, nil) + if err != nil { + return Response{}, err + } + + if len(result.Txs) == 0 { + return Response{}, fmt.Errorf("unknown response: %s", requestID) + } + + reqCtxID, batchCounter, _, _, err := splitRequestID(requestID) + if err != nil { + return Response{}, err + } + + // query request context + reqCtx, err := s.QueryRequestContext(hex.EncodeToString(reqCtxID)) + if err != nil { + return Response{}, err + } + + for _, msg := range result.Txs[0].Tx.GetMsgs() { + if responseMsg, ok := msg.(*MsgRespondService); ok { + if responseMsg.RequestId != requestID { + continue + } + return Response{ + Provider: responseMsg.Provider, + Consumer: reqCtx.Consumer, + Output: responseMsg.Output, + Result: responseMsg.Result, + RequestContextId: sdk.HexStringFrom(reqCtxID), + RequestContextBatchCounter: batchCounter, + }, nil + } + } + + return Response{}, nil +} + +// SplitRequestContextID splits the given contextID to txHash and msgIndex +func splitRequestContextID(reqCtxID string) (sdk.HexBytes, int64, error) { + contextID, err := hex.DecodeString(reqCtxID) + if err != nil { + return nil, 0, errors.New("invalid request context id") + } + + if len(contextID) != contextIDLen { + return nil, 0, fmt.Errorf("invalid request context id:%s", reqCtxID) + } + + txHash := contextID[0:32] + msgIndex := int64(binary.BigEndian.Uint64(contextID[32:40])) + + return txHash, msgIndex, nil +} + +// SplitRequestID splits the given contextID to contextID, batchCounter, requestHeight, batchRequestIndex +func splitRequestID(reqID string) (sdk.HexBytes, uint64, int64, int16, error) { + requestID, err := hex.DecodeString(reqID) + if err != nil { + return nil, 0, 0, 0, errors.New("invalid request id") + } + + if len(requestID) != requestIDLen { + return nil, 0, 0, 0, errors.New("invalid request id") + } + + reqCtxID := requestID[0:40] + batchCounter := binary.BigEndian.Uint64(requestID[40:48]) + requestHeight := int64(binary.BigEndian.Uint64(requestID[48:56])) + batchRequestIndex := int16(binary.BigEndian.Uint16(requestID[56:])) + + return reqCtxID, batchCounter, requestHeight, batchRequestIndex, nil +} diff --git a/module-sdk/service/query.pb.go b/module-sdk/service/query.pb.go new file mode 100644 index 00000000..113df9fd --- /dev/null +++ b/module-sdk/service/query.pb.go @@ -0,0 +1,6105 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/query.proto + +package service + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + query "github.com/irisnet/core-sdk-go/types/query" + _ "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 + +// QueryDefinitionRequest is request type for the Query/Definition RPC method +type QueryDefinitionRequest struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` +} + +func (m *QueryDefinitionRequest) Reset() { *m = QueryDefinitionRequest{} } +func (m *QueryDefinitionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDefinitionRequest) ProtoMessage() {} +func (*QueryDefinitionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{0} +} +func (m *QueryDefinitionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDefinitionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDefinitionRequest.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 *QueryDefinitionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDefinitionRequest.Merge(m, src) +} +func (m *QueryDefinitionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDefinitionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDefinitionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDefinitionRequest proto.InternalMessageInfo + +func (m *QueryDefinitionRequest) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +// QueryDefinitionResponse is response type for the Query/Definition RPC method +type QueryDefinitionResponse struct { + ServiceDefinition *ServiceDefinition `protobuf:"bytes,1,opt,name=service_definition,json=serviceDefinition,proto3" json:"service_definition,omitempty"` +} + +func (m *QueryDefinitionResponse) Reset() { *m = QueryDefinitionResponse{} } +func (m *QueryDefinitionResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDefinitionResponse) ProtoMessage() {} +func (*QueryDefinitionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{1} +} +func (m *QueryDefinitionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDefinitionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDefinitionResponse.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 *QueryDefinitionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDefinitionResponse.Merge(m, src) +} +func (m *QueryDefinitionResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDefinitionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDefinitionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDefinitionResponse proto.InternalMessageInfo + +func (m *QueryDefinitionResponse) GetServiceDefinition() *ServiceDefinition { + if m != nil { + return m.ServiceDefinition + } + return nil +} + +// QueryBindingRequest is request type for the Query/Binding RPC method +type QueryBindingRequest struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` +} + +func (m *QueryBindingRequest) Reset() { *m = QueryBindingRequest{} } +func (m *QueryBindingRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBindingRequest) ProtoMessage() {} +func (*QueryBindingRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{2} +} +func (m *QueryBindingRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBindingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBindingRequest.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 *QueryBindingRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBindingRequest.Merge(m, src) +} +func (m *QueryBindingRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBindingRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBindingRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBindingRequest proto.InternalMessageInfo + +func (m *QueryBindingRequest) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +func (m *QueryBindingRequest) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +// QueryDefinitionResponse is response type for the Query/Binding RPC method +type QueryBindingResponse struct { + ServiceBinding *ServiceBinding `protobuf:"bytes,1,opt,name=service_binding,json=serviceBinding,proto3" json:"service_binding,omitempty"` +} + +func (m *QueryBindingResponse) Reset() { *m = QueryBindingResponse{} } +func (m *QueryBindingResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBindingResponse) ProtoMessage() {} +func (*QueryBindingResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{3} +} +func (m *QueryBindingResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBindingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBindingResponse.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 *QueryBindingResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBindingResponse.Merge(m, src) +} +func (m *QueryBindingResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBindingResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBindingResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBindingResponse proto.InternalMessageInfo + +func (m *QueryBindingResponse) GetServiceBinding() *ServiceBinding { + if m != nil { + return m.ServiceBinding + } + return nil +} + +// QueryBindingsRequest is request type for the Query/Bindings RPC method +type QueryBindingsRequest struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBindingsRequest) Reset() { *m = QueryBindingsRequest{} } +func (m *QueryBindingsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBindingsRequest) ProtoMessage() {} +func (*QueryBindingsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{4} +} +func (m *QueryBindingsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBindingsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBindingsRequest.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 *QueryBindingsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBindingsRequest.Merge(m, src) +} +func (m *QueryBindingsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBindingsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBindingsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBindingsRequest proto.InternalMessageInfo + +func (m *QueryBindingsRequest) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +func (m *QueryBindingsRequest) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *QueryBindingsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDefinitionsResponse is response type for the Query/Bindings RPC method +type QueryBindingsResponse struct { + ServiceBindings []*ServiceBinding `protobuf:"bytes,1,rep,name=service_bindings,json=serviceBindings,proto3" json:"service_bindings,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBindingsResponse) Reset() { *m = QueryBindingsResponse{} } +func (m *QueryBindingsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBindingsResponse) ProtoMessage() {} +func (*QueryBindingsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{5} +} +func (m *QueryBindingsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBindingsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBindingsResponse.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 *QueryBindingsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBindingsResponse.Merge(m, src) +} +func (m *QueryBindingsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBindingsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBindingsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBindingsResponse proto.InternalMessageInfo + +func (m *QueryBindingsResponse) GetServiceBindings() []*ServiceBinding { + if m != nil { + return m.ServiceBindings + } + return nil +} + +func (m *QueryBindingsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryWithdrawAddressRequest is request type for the Query/WithdrawAddress RPC method +type QueryWithdrawAddressRequest struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *QueryWithdrawAddressRequest) Reset() { *m = QueryWithdrawAddressRequest{} } +func (m *QueryWithdrawAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryWithdrawAddressRequest) ProtoMessage() {} +func (*QueryWithdrawAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{6} +} +func (m *QueryWithdrawAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryWithdrawAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWithdrawAddressRequest.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 *QueryWithdrawAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWithdrawAddressRequest.Merge(m, src) +} +func (m *QueryWithdrawAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryWithdrawAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWithdrawAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWithdrawAddressRequest proto.InternalMessageInfo + +func (m *QueryWithdrawAddressRequest) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +// QueryWithdrawAddressResponse is response type for the Query/WithdrawAddress RPC method +type QueryWithdrawAddressResponse struct { + WithdrawAddress string `protobuf:"bytes,1,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty"` +} + +func (m *QueryWithdrawAddressResponse) Reset() { *m = QueryWithdrawAddressResponse{} } +func (m *QueryWithdrawAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryWithdrawAddressResponse) ProtoMessage() {} +func (*QueryWithdrawAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{7} +} +func (m *QueryWithdrawAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryWithdrawAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWithdrawAddressResponse.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 *QueryWithdrawAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWithdrawAddressResponse.Merge(m, src) +} +func (m *QueryWithdrawAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryWithdrawAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWithdrawAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWithdrawAddressResponse proto.InternalMessageInfo + +func (m *QueryWithdrawAddressResponse) GetWithdrawAddress() string { + if m != nil { + return m.WithdrawAddress + } + return "" +} + +// QueryRequestContextRequest is request type for the Query/RequestContext RPC method +type QueryRequestContextRequest struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty"` +} + +func (m *QueryRequestContextRequest) Reset() { *m = QueryRequestContextRequest{} } +func (m *QueryRequestContextRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRequestContextRequest) ProtoMessage() {} +func (*QueryRequestContextRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{8} +} +func (m *QueryRequestContextRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestContextRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestContextRequest.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 *QueryRequestContextRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestContextRequest.Merge(m, src) +} +func (m *QueryRequestContextRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestContextRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestContextRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestContextRequest proto.InternalMessageInfo + +func (m *QueryRequestContextRequest) GetRequestContextId() string { + if m != nil { + return m.RequestContextId + } + return "" +} + +// QueryRequestContextResponse is response type for the Query/RequestContext RPC method +type QueryRequestContextResponse struct { + RequestContext *RequestContext `protobuf:"bytes,1,opt,name=request_context,json=requestContext,proto3" json:"request_context,omitempty"` +} + +func (m *QueryRequestContextResponse) Reset() { *m = QueryRequestContextResponse{} } +func (m *QueryRequestContextResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRequestContextResponse) ProtoMessage() {} +func (*QueryRequestContextResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{9} +} +func (m *QueryRequestContextResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestContextResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestContextResponse.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 *QueryRequestContextResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestContextResponse.Merge(m, src) +} +func (m *QueryRequestContextResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestContextResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestContextResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestContextResponse proto.InternalMessageInfo + +func (m *QueryRequestContextResponse) GetRequestContext() *RequestContext { + if m != nil { + return m.RequestContext + } + return nil +} + +// QueryRequestRequest is request type for the Query/Request RPC method +type QueryRequestRequest struct { + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (m *QueryRequestRequest) Reset() { *m = QueryRequestRequest{} } +func (m *QueryRequestRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRequestRequest) ProtoMessage() {} +func (*QueryRequestRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{10} +} +func (m *QueryRequestRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestRequest.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 *QueryRequestRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestRequest.Merge(m, src) +} +func (m *QueryRequestRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestRequest proto.InternalMessageInfo + +func (m *QueryRequestRequest) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +// QueryRequestResponse is response type for the Query/Request RPC method +type QueryRequestResponse struct { + Request *Request `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` +} + +func (m *QueryRequestResponse) Reset() { *m = QueryRequestResponse{} } +func (m *QueryRequestResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRequestResponse) ProtoMessage() {} +func (*QueryRequestResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{11} +} +func (m *QueryRequestResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestResponse.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 *QueryRequestResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestResponse.Merge(m, src) +} +func (m *QueryRequestResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestResponse proto.InternalMessageInfo + +func (m *QueryRequestResponse) GetRequest() *Request { + if m != nil { + return m.Request + } + return nil +} + +// QueryRequestsRequest is request type for the Query/Requests RPC method +type QueryRequestsRequest struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRequestsRequest) Reset() { *m = QueryRequestsRequest{} } +func (m *QueryRequestsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRequestsRequest) ProtoMessage() {} +func (*QueryRequestsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{12} +} +func (m *QueryRequestsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestsRequest.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 *QueryRequestsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestsRequest.Merge(m, src) +} +func (m *QueryRequestsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestsRequest proto.InternalMessageInfo + +func (m *QueryRequestsRequest) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +func (m *QueryRequestsRequest) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +func (m *QueryRequestsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRequestsResponse is response type for the Query/Requests RPC method +type QueryRequestsResponse struct { + Requests []*Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRequestsResponse) Reset() { *m = QueryRequestsResponse{} } +func (m *QueryRequestsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRequestsResponse) ProtoMessage() {} +func (*QueryRequestsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{13} +} +func (m *QueryRequestsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestsResponse.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 *QueryRequestsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestsResponse.Merge(m, src) +} +func (m *QueryRequestsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestsResponse proto.InternalMessageInfo + +func (m *QueryRequestsResponse) GetRequests() []*Request { + if m != nil { + return m.Requests + } + return nil +} + +func (m *QueryRequestsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRequestsByReqCtxRequest is request type for the Query/RequestsByReqCtx RPC method +type QueryRequestsByReqCtxRequest struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty"` + BatchCounter uint64 `protobuf:"varint,2,opt,name=batch_counter,json=batchCounter,proto3" json:"batch_counter,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRequestsByReqCtxRequest) Reset() { *m = QueryRequestsByReqCtxRequest{} } +func (m *QueryRequestsByReqCtxRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRequestsByReqCtxRequest) ProtoMessage() {} +func (*QueryRequestsByReqCtxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{14} +} +func (m *QueryRequestsByReqCtxRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestsByReqCtxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestsByReqCtxRequest.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 *QueryRequestsByReqCtxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestsByReqCtxRequest.Merge(m, src) +} +func (m *QueryRequestsByReqCtxRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestsByReqCtxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestsByReqCtxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestsByReqCtxRequest proto.InternalMessageInfo + +func (m *QueryRequestsByReqCtxRequest) GetRequestContextId() string { + if m != nil { + return m.RequestContextId + } + return "" +} + +func (m *QueryRequestsByReqCtxRequest) GetBatchCounter() uint64 { + if m != nil { + return m.BatchCounter + } + return 0 +} + +func (m *QueryRequestsByReqCtxRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRequestsByReqCtxResponse is response type for the Query/RequestsByReqCtx RPC method +type QueryRequestsByReqCtxResponse struct { + Requests []*Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRequestsByReqCtxResponse) Reset() { *m = QueryRequestsByReqCtxResponse{} } +func (m *QueryRequestsByReqCtxResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRequestsByReqCtxResponse) ProtoMessage() {} +func (*QueryRequestsByReqCtxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{15} +} +func (m *QueryRequestsByReqCtxResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRequestsByReqCtxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRequestsByReqCtxResponse.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 *QueryRequestsByReqCtxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRequestsByReqCtxResponse.Merge(m, src) +} +func (m *QueryRequestsByReqCtxResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRequestsByReqCtxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRequestsByReqCtxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRequestsByReqCtxResponse proto.InternalMessageInfo + +func (m *QueryRequestsByReqCtxResponse) GetRequests() []*Request { + if m != nil { + return m.Requests + } + return nil +} + +func (m *QueryRequestsByReqCtxResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryResponseRequest is request type for the Query/Response RPC method +type QueryResponseRequest struct { + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` +} + +func (m *QueryResponseRequest) Reset() { *m = QueryResponseRequest{} } +func (m *QueryResponseRequest) String() string { return proto.CompactTextString(m) } +func (*QueryResponseRequest) ProtoMessage() {} +func (*QueryResponseRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{16} +} +func (m *QueryResponseRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResponseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResponseRequest.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 *QueryResponseRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResponseRequest.Merge(m, src) +} +func (m *QueryResponseRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryResponseRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResponseRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResponseRequest proto.InternalMessageInfo + +func (m *QueryResponseRequest) GetRequestId() string { + if m != nil { + return m.RequestId + } + return "" +} + +// QueryResponseResponse is response type for the Query/Response RPC method +type QueryResponseResponse struct { + Response *Response `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` +} + +func (m *QueryResponseResponse) Reset() { *m = QueryResponseResponse{} } +func (m *QueryResponseResponse) String() string { return proto.CompactTextString(m) } +func (*QueryResponseResponse) ProtoMessage() {} +func (*QueryResponseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{17} +} +func (m *QueryResponseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResponseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResponseResponse.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 *QueryResponseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResponseResponse.Merge(m, src) +} +func (m *QueryResponseResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryResponseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResponseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResponseResponse proto.InternalMessageInfo + +func (m *QueryResponseResponse) GetResponse() *Response { + if m != nil { + return m.Response + } + return nil +} + +// QueryResponsesRequest is request type for the Query/Responses RPC method +type QueryResponsesRequest struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty"` + BatchCounter uint64 `protobuf:"varint,2,opt,name=batch_counter,json=batchCounter,proto3" json:"batch_counter,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryResponsesRequest) Reset() { *m = QueryResponsesRequest{} } +func (m *QueryResponsesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryResponsesRequest) ProtoMessage() {} +func (*QueryResponsesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{18} +} +func (m *QueryResponsesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResponsesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResponsesRequest.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 *QueryResponsesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResponsesRequest.Merge(m, src) +} +func (m *QueryResponsesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryResponsesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResponsesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResponsesRequest proto.InternalMessageInfo + +func (m *QueryResponsesRequest) GetRequestContextId() string { + if m != nil { + return m.RequestContextId + } + return "" +} + +func (m *QueryResponsesRequest) GetBatchCounter() uint64 { + if m != nil { + return m.BatchCounter + } + return 0 +} + +func (m *QueryResponsesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryResponsesResponse is response type for the Query/Responses RPC method +type QueryResponsesResponse struct { + Responses []*Response `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryResponsesResponse) Reset() { *m = QueryResponsesResponse{} } +func (m *QueryResponsesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryResponsesResponse) ProtoMessage() {} +func (*QueryResponsesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{19} +} +func (m *QueryResponsesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryResponsesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryResponsesResponse.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 *QueryResponsesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryResponsesResponse.Merge(m, src) +} +func (m *QueryResponsesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryResponsesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryResponsesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryResponsesResponse proto.InternalMessageInfo + +func (m *QueryResponsesResponse) GetResponses() []*Response { + if m != nil { + return m.Responses + } + return nil +} + +func (m *QueryResponsesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryEarnedFeesRequest is request type for the Query/EarnedFees RPC method +type QueryEarnedFeesRequest struct { + Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` +} + +func (m *QueryEarnedFeesRequest) Reset() { *m = QueryEarnedFeesRequest{} } +func (m *QueryEarnedFeesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEarnedFeesRequest) ProtoMessage() {} +func (*QueryEarnedFeesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{20} +} +func (m *QueryEarnedFeesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEarnedFeesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEarnedFeesRequest.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 *QueryEarnedFeesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEarnedFeesRequest.Merge(m, src) +} +func (m *QueryEarnedFeesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryEarnedFeesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEarnedFeesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEarnedFeesRequest proto.InternalMessageInfo + +func (m *QueryEarnedFeesRequest) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +// QueryEarnedFeesResponse is response type for the Query/EarnedFees RPC method +type QueryEarnedFeesResponse struct { + Fees github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=fees,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"fees" yaml:"service_fee"` +} + +func (m *QueryEarnedFeesResponse) Reset() { *m = QueryEarnedFeesResponse{} } +func (m *QueryEarnedFeesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEarnedFeesResponse) ProtoMessage() {} +func (*QueryEarnedFeesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{21} +} +func (m *QueryEarnedFeesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryEarnedFeesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryEarnedFeesResponse.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 *QueryEarnedFeesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEarnedFeesResponse.Merge(m, src) +} +func (m *QueryEarnedFeesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryEarnedFeesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEarnedFeesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryEarnedFeesResponse proto.InternalMessageInfo + +func (m *QueryEarnedFeesResponse) GetFees() github_com_irisnet_irishub_sdk_go_types.Coins { + if m != nil { + return m.Fees + } + return nil +} + +// QuerySchemaRequest is request type for the Query/Schema RPC method +type QuerySchemaRequest struct { + SchemaName string `protobuf:"bytes,1,opt,name=schema_name,json=schemaName,proto3" json:"schema_name,omitempty"` +} + +func (m *QuerySchemaRequest) Reset() { *m = QuerySchemaRequest{} } +func (m *QuerySchemaRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySchemaRequest) ProtoMessage() {} +func (*QuerySchemaRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{22} +} +func (m *QuerySchemaRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySchemaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySchemaRequest.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 *QuerySchemaRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySchemaRequest.Merge(m, src) +} +func (m *QuerySchemaRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySchemaRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySchemaRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySchemaRequest proto.InternalMessageInfo + +func (m *QuerySchemaRequest) GetSchemaName() string { + if m != nil { + return m.SchemaName + } + return "" +} + +// QuerySchemaResponse is response type for the Query/Schema RPC method +type QuerySchemaResponse struct { + Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` +} + +func (m *QuerySchemaResponse) Reset() { *m = QuerySchemaResponse{} } +func (m *QuerySchemaResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySchemaResponse) ProtoMessage() {} +func (*QuerySchemaResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d141bb1b35a55f92, []int{23} +} +func (m *QuerySchemaResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySchemaResponse.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 *QuerySchemaResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySchemaResponse.Merge(m, src) +} +func (m *QuerySchemaResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySchemaResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySchemaResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySchemaResponse proto.InternalMessageInfo + +func (m *QuerySchemaResponse) GetSchema() string { + if m != nil { + return m.Schema + } + return "" +} + +// QueryParametersRequest is request type for the Query/Parameters 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_d141bb1b35a55f92, []int{24} +} +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 + +// QueryParametersResponse is response type for the Query/Parameters RPC method +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` +} + +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_d141bb1b35a55f92, []int{25} +} +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{} +} + +func (m *QueryParamsResponse) GetRes() *query.PageResponse { + if m != nil { + return m.Res + } + return nil +} + +func init() { + proto.RegisterType((*QueryDefinitionRequest)(nil), "irismod.service.QueryDefinitionRequest") + proto.RegisterType((*QueryDefinitionResponse)(nil), "irismod.service.QueryDefinitionResponse") + proto.RegisterType((*QueryBindingRequest)(nil), "irismod.service.QueryBindingRequest") + proto.RegisterType((*QueryBindingResponse)(nil), "irismod.service.QueryBindingResponse") + proto.RegisterType((*QueryBindingsRequest)(nil), "irismod.service.QueryBindingsRequest") + proto.RegisterType((*QueryBindingsResponse)(nil), "irismod.service.QueryBindingsResponse") + proto.RegisterType((*QueryWithdrawAddressRequest)(nil), "irismod.service.QueryWithdrawAddressRequest") + proto.RegisterType((*QueryWithdrawAddressResponse)(nil), "irismod.service.QueryWithdrawAddressResponse") + proto.RegisterType((*QueryRequestContextRequest)(nil), "irismod.service.QueryRequestContextRequest") + proto.RegisterType((*QueryRequestContextResponse)(nil), "irismod.service.QueryRequestContextResponse") + proto.RegisterType((*QueryRequestRequest)(nil), "irismod.service.QueryRequestRequest") + proto.RegisterType((*QueryRequestResponse)(nil), "irismod.service.QueryRequestResponse") + proto.RegisterType((*QueryRequestsRequest)(nil), "irismod.service.QueryRequestsRequest") + proto.RegisterType((*QueryRequestsResponse)(nil), "irismod.service.QueryRequestsResponse") + proto.RegisterType((*QueryRequestsByReqCtxRequest)(nil), "irismod.service.QueryRequestsByReqCtxRequest") + proto.RegisterType((*QueryRequestsByReqCtxResponse)(nil), "irismod.service.QueryRequestsByReqCtxResponse") + proto.RegisterType((*QueryResponseRequest)(nil), "irismod.service.QueryResponseRequest") + proto.RegisterType((*QueryResponseResponse)(nil), "irismod.service.QueryResponseResponse") + proto.RegisterType((*QueryResponsesRequest)(nil), "irismod.service.QueryResponsesRequest") + proto.RegisterType((*QueryResponsesResponse)(nil), "irismod.service.QueryResponsesResponse") + proto.RegisterType((*QueryEarnedFeesRequest)(nil), "irismod.service.QueryEarnedFeesRequest") + proto.RegisterType((*QueryEarnedFeesResponse)(nil), "irismod.service.QueryEarnedFeesResponse") + proto.RegisterType((*QuerySchemaRequest)(nil), "irismod.service.QuerySchemaRequest") + proto.RegisterType((*QuerySchemaResponse)(nil), "irismod.service.QuerySchemaResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "irismod.service.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "irismod.service.QueryParamsResponse") +} + +func init() { proto.RegisterFile("service/query.proto", fileDescriptor_d141bb1b35a55f92) } + +var fileDescriptor_d141bb1b35a55f92 = []byte{ + // 1335 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xc0, 0x33, 0xfd, 0x48, 0x93, 0xd7, 0x52, 0x87, 0x69, 0xda, 0xa6, 0xa6, 0xb5, 0xcb, 0xb4, + 0x34, 0xe9, 0x87, 0x77, 0x9b, 0x2f, 0xbe, 0x2a, 0x01, 0x4d, 0x20, 0x25, 0xa9, 0x54, 0xb5, 0x2e, + 0x12, 0x12, 0x97, 0xb0, 0xf6, 0x4e, 0x9c, 0x85, 0x78, 0xd7, 0xdd, 0x59, 0x27, 0x0d, 0x91, 0x2f, + 0x20, 0x81, 0x80, 0x0b, 0x52, 0xa1, 0x48, 0x48, 0x70, 0x41, 0x48, 0x08, 0x21, 0x0e, 0xdc, 0xfa, + 0x1f, 0xf4, 0x58, 0x89, 0x0b, 0xa7, 0x82, 0x12, 0xfe, 0x02, 0xfe, 0x02, 0xb4, 0xb3, 0x6f, 0xd6, + 0xfb, 0xe1, 0xb5, 0x5d, 0x94, 0x03, 0x9c, 0xbc, 0x3b, 0xf3, 0x3e, 0x7e, 0xef, 0xcd, 0x9b, 0x7d, + 0x4f, 0x86, 0x23, 0x82, 0xbb, 0xeb, 0x56, 0x95, 0xeb, 0x77, 0x9a, 0xdc, 0xdd, 0xd4, 0x1a, 0xae, + 0xe3, 0x39, 0x34, 0x67, 0xb9, 0x96, 0xa8, 0x3b, 0xa6, 0x86, 0x9b, 0xf9, 0x42, 0xd5, 0x11, 0x75, + 0x47, 0xe8, 0x15, 0x43, 0x70, 0x7d, 0x7d, 0xb2, 0xc2, 0x3d, 0x63, 0x52, 0xaf, 0x3a, 0x96, 0x1d, + 0x28, 0xe4, 0x2f, 0x44, 0xf7, 0xa5, 0xa5, 0x50, 0xaa, 0x61, 0xd4, 0x2c, 0xdb, 0xf0, 0x2c, 0x47, + 0xc9, 0x8e, 0xd6, 0x9c, 0x9a, 0x23, 0x1f, 0x75, 0xff, 0x09, 0x57, 0x4f, 0xd6, 0x1c, 0xa7, 0xb6, + 0xc6, 0x75, 0xa3, 0x61, 0xe9, 0x86, 0x6d, 0x3b, 0x9e, 0x54, 0x11, 0xb8, 0x7b, 0x54, 0x51, 0xe2, + 0x6f, 0xb0, 0xcc, 0xae, 0xc0, 0xb1, 0x5b, 0xbe, 0xb3, 0xd7, 0xf9, 0x8a, 0x65, 0x5b, 0xbe, 0x42, + 0x99, 0xdf, 0x69, 0x72, 0xe1, 0xd1, 0x67, 0xe1, 0x10, 0x8a, 0x2e, 0xdb, 0x46, 0x9d, 0x8f, 0x91, + 0xd3, 0x64, 0x62, 0xb8, 0x7c, 0x10, 0xd7, 0x6e, 0x18, 0x75, 0xce, 0xd6, 0xe0, 0x78, 0x4a, 0x59, + 0x34, 0x1c, 0x5b, 0x70, 0x7a, 0x0b, 0xa8, 0xd2, 0x36, 0xc3, 0x5d, 0x69, 0xe3, 0xe0, 0x14, 0xd3, + 0x12, 0xc9, 0xd1, 0x6e, 0x07, 0xbf, 0x11, 0x3b, 0x4f, 0x8b, 0xe4, 0x12, 0x7b, 0x0b, 0x8e, 0x48, + 0x6f, 0x73, 0x96, 0x6d, 0x5a, 0x76, 0xad, 0x7f, 0x4e, 0x9a, 0x87, 0xa1, 0x86, 0xeb, 0xac, 0x5b, + 0x26, 0x77, 0xc7, 0xf6, 0xc8, 0xed, 0xf0, 0x9d, 0xbd, 0x0b, 0xa3, 0x71, 0xab, 0x18, 0xc0, 0x9b, + 0x90, 0x53, 0x66, 0x2b, 0xc1, 0x16, 0xd2, 0x17, 0xb3, 0xe8, 0x95, 0x85, 0xc3, 0x22, 0xf6, 0xce, + 0xbe, 0x26, 0x71, 0x17, 0xe2, 0x09, 0xc8, 0x47, 0x61, 0xbf, 0xb3, 0x61, 0x87, 0xd8, 0xc1, 0x0b, + 0x5d, 0x00, 0x68, 0xd7, 0xc4, 0xd8, 0x5e, 0x89, 0x75, 0x4e, 0x0b, 0x0a, 0x48, 0xf3, 0x0b, 0x48, + 0x0b, 0x4a, 0x11, 0x0b, 0x48, 0xbb, 0x69, 0xd4, 0x38, 0x3a, 0x2d, 0x47, 0x34, 0xd9, 0xcf, 0x04, + 0x8e, 0x26, 0xc8, 0x30, 0xfa, 0x25, 0x18, 0x49, 0x44, 0x2f, 0xc6, 0xc8, 0xe9, 0xbd, 0xfd, 0x84, + 0x9f, 0x8b, 0x87, 0x2f, 0xe8, 0xb5, 0x18, 0xed, 0x1e, 0x49, 0x3b, 0xde, 0x93, 0x36, 0x00, 0x89, + 0xe1, 0x4e, 0xc3, 0x33, 0x92, 0xf6, 0x6d, 0xcb, 0x5b, 0x35, 0x5d, 0x63, 0xe3, 0xaa, 0x69, 0xba, + 0x5c, 0x84, 0xe9, 0x0c, 0x73, 0x45, 0x22, 0xb9, 0x62, 0x8b, 0x70, 0xb2, 0xb3, 0x12, 0x46, 0x7a, + 0x1e, 0x46, 0x36, 0x70, 0x6b, 0xd9, 0x08, 0xf6, 0xd0, 0x40, 0x6e, 0x23, 0xae, 0xc2, 0x96, 0x20, + 0x2f, 0x4d, 0xa1, 0xc3, 0x79, 0xc7, 0xf6, 0xf8, 0x5d, 0x4f, 0xb9, 0xbf, 0x04, 0xd4, 0x0d, 0x1e, + 0x97, 0xab, 0xc1, 0xce, 0xb2, 0x65, 0xa2, 0xa9, 0x11, 0x37, 0xa6, 0xb2, 0x68, 0xb2, 0x1a, 0xc6, + 0x92, 0xb4, 0xd5, 0xae, 0xbe, 0x84, 0xb1, 0xcc, 0xea, 0x4b, 0x58, 0x38, 0x1c, 0x77, 0xc5, 0x66, + 0xf0, 0xd6, 0xa8, 0xf3, 0x47, 0xda, 0x53, 0x00, 0xca, 0x41, 0x48, 0x39, 0x8c, 0x2b, 0x8b, 0x26, + 0x5b, 0xc2, 0x92, 0x0d, 0xb5, 0x90, 0x6b, 0x0a, 0x0e, 0xa0, 0x10, 0xf2, 0x8c, 0x65, 0xf1, 0x94, + 0x95, 0x20, 0xfb, 0x96, 0xc4, 0x8d, 0x89, 0xdd, 0xb9, 0xb9, 0xbb, 0x76, 0x0b, 0xee, 0xab, 0x5b, + 0xd0, 0xe6, 0xc3, 0x68, 0x67, 0x60, 0x08, 0x83, 0x50, 0xd5, 0x9f, 0x1d, 0x6e, 0x28, 0xb9, 0x7b, + 0xf5, 0xfe, 0x80, 0x60, 0xed, 0x2a, 0xb0, 0x39, 0xff, 0x69, 0xde, 0xbb, 0xfb, 0xaf, 0x4a, 0x8e, + 0x9e, 0x81, 0xa7, 0x2a, 0x86, 0x57, 0x5d, 0x5d, 0xae, 0x3a, 0x4d, 0xdb, 0xc3, 0x84, 0xee, 0x2b, + 0x1f, 0x92, 0x8b, 0xf3, 0xc1, 0xda, 0xae, 0x25, 0xf5, 0x3b, 0x02, 0xa7, 0x32, 0xd8, 0xff, 0x1b, + 0xc9, 0x9d, 0x0d, 0x8b, 0x12, 0x37, 0xfb, 0xbb, 0x18, 0x37, 0xc2, 0x5a, 0x51, 0x6a, 0x18, 0xce, + 0xac, 0x1f, 0x4e, 0xf0, 0x8c, 0x57, 0xe3, 0x44, 0x87, 0x70, 0x50, 0x29, 0x14, 0x65, 0xbf, 0x92, + 0x84, 0x41, 0xf1, 0x3f, 0x38, 0xdc, 0x6f, 0x08, 0x4e, 0x0d, 0x11, 0x68, 0x4c, 0xc3, 0x0b, 0x30, + 0xac, 0x62, 0x53, 0xc7, 0xda, 0x25, 0x0f, 0x6d, 0xd9, 0xdd, 0x3b, 0xd8, 0x19, 0x64, 0x7b, 0xc3, + 0x70, 0x6d, 0x6e, 0x2e, 0xf0, 0x76, 0x46, 0xa3, 0x1f, 0x13, 0x92, 0x18, 0x03, 0xbe, 0x22, 0x38, + 0xcb, 0x44, 0xd5, 0x30, 0xa6, 0x0f, 0x60, 0xdf, 0x0a, 0x8f, 0x84, 0x13, 0x85, 0x52, 0x38, 0xf3, + 0x8e, 0x65, 0xcf, 0x5d, 0x7f, 0xf8, 0xb8, 0x38, 0xf0, 0xf7, 0xe3, 0x22, 0xdd, 0x34, 0xea, 0x6b, + 0x2f, 0x33, 0xf5, 0x71, 0x5b, 0xe1, 0x9c, 0xfd, 0xf4, 0x47, 0xb1, 0x54, 0xb3, 0xbc, 0xd5, 0x66, + 0x45, 0xab, 0x3a, 0x75, 0xbd, 0x62, 0x19, 0xf6, 0x7b, 0x16, 0x37, 0x2c, 0xdd, 0x72, 0x2d, 0xcf, + 0x28, 0x09, 0xf3, 0xfd, 0x52, 0xcd, 0xd1, 0xbd, 0xcd, 0x06, 0x17, 0xd2, 0x96, 0x28, 0x4b, 0x9f, + 0x6c, 0x16, 0xa8, 0xc4, 0xba, 0x5d, 0x5d, 0xe5, 0x75, 0x43, 0x45, 0x52, 0x84, 0x83, 0x42, 0x2e, + 0x44, 0x3f, 0x9c, 0x10, 0x2c, 0xc9, 0xc9, 0xac, 0x84, 0x5f, 0x7d, 0xa5, 0x86, 0x91, 0x1c, 0x83, + 0xc1, 0x40, 0x08, 0x55, 0xf0, 0x8d, 0x8d, 0xa2, 0x97, 0x9b, 0x86, 0x6b, 0xd4, 0x55, 0xbe, 0xd8, + 0x27, 0x04, 0xad, 0xa8, 0xe5, 0xb0, 0xd4, 0x07, 0x1b, 0x72, 0x05, 0x0b, 0xfd, 0x78, 0xea, 0x80, + 0x03, 0x85, 0xb9, 0x7d, 0x7e, 0x3e, 0xca, 0x28, 0x4c, 0x5f, 0x82, 0xbd, 0x2e, 0x17, 0x4f, 0x7a, + 0xb4, 0xbe, 0xce, 0xd4, 0x2f, 0x39, 0xd8, 0x2f, 0x49, 0xe8, 0x97, 0x04, 0xa0, 0x3d, 0x13, 0xd2, + 0xf1, 0x94, 0xeb, 0xce, 0xd3, 0x6c, 0x7e, 0xa2, 0xb7, 0x20, 0xde, 0xc8, 0xe9, 0x0f, 0x7f, 0xfb, + 0xeb, 0xde, 0x9e, 0x12, 0xbd, 0xa8, 0xa3, 0x86, 0x9a, 0x98, 0xf5, 0xf6, 0x20, 0x2b, 0xf4, 0xad, + 0x68, 0xe7, 0x6a, 0xd1, 0x7b, 0x04, 0x0e, 0xe0, 0xc0, 0x43, 0xcf, 0x76, 0x76, 0x15, 0x1f, 0x5b, + 0xf3, 0xcf, 0xf5, 0x90, 0x42, 0x9a, 0x2b, 0x92, 0x66, 0x96, 0x4e, 0xa7, 0x68, 0xd4, 0x5c, 0x96, + 0x40, 0xd1, 0xb7, 0x54, 0x4d, 0xb7, 0xe8, 0xe7, 0x04, 0x86, 0xc2, 0x31, 0xac, 0xbb, 0x43, 0x75, + 0xe8, 0xf9, 0x73, 0xbd, 0xc4, 0x10, 0xec, 0xb2, 0x04, 0xbb, 0x40, 0x27, 0xfa, 0x05, 0xa3, 0x3f, + 0x12, 0xc8, 0x25, 0xa6, 0x30, 0x7a, 0xa9, 0xb3, 0xb7, 0xce, 0x13, 0x5e, 0xbe, 0xd4, 0xa7, 0x34, + 0x22, 0xbe, 0x28, 0x11, 0xa7, 0xe8, 0xe5, 0x14, 0xa2, 0x1c, 0x0d, 0x85, 0xbe, 0x25, 0x7f, 0x5b, + 0xba, 0x1a, 0xf4, 0x4a, 0x38, 0x00, 0xd2, 0xef, 0x09, 0x1c, 0x8e, 0xcf, 0x55, 0xf4, 0x62, 0x67, + 0xdf, 0x1d, 0x67, 0xc1, 0xfc, 0xa5, 0xfe, 0x84, 0x91, 0xf3, 0x79, 0xc9, 0x79, 0x99, 0x6a, 0x29, + 0x4e, 0xfc, 0xf0, 0x0b, 0x7d, 0x2b, 0xdd, 0x0a, 0x5a, 0xf4, 0x63, 0x02, 0x07, 0xd4, 0x17, 0xe1, + 0x6c, 0x57, 0x8f, 0x3d, 0x8a, 0x2e, 0x31, 0xe5, 0x31, 0x4d, 0x02, 0x4d, 0xd0, 0x73, 0x29, 0x20, + 0xd5, 0x87, 0xdb, 0x40, 0x3e, 0xc8, 0x7d, 0x02, 0x43, 0xaa, 0xcf, 0xd3, 0xee, 0x3e, 0x7a, 0xd5, + 0x59, 0x72, 0x06, 0xeb, 0x72, 0x01, 0xda, 0x2c, 0x99, 0x17, 0xe0, 0x01, 0x81, 0x91, 0xe4, 0x00, + 0x42, 0x4b, 0xdd, 0x3d, 0x27, 0x86, 0xac, 0xbc, 0xd6, 0xaf, 0x38, 0x02, 0x2f, 0x48, 0xe0, 0xd7, + 0xe8, 0x2b, 0x7d, 0x24, 0x2f, 0x72, 0x9a, 0xfa, 0x56, 0xac, 0x7f, 0xb7, 0xe8, 0x67, 0x32, 0xa9, + 0xf8, 0xc9, 0xcd, 0x4c, 0x6a, 0x6c, 0x78, 0xc9, 0x4e, 0x6a, 0x7c, 0x58, 0x61, 0xba, 0x64, 0x3c, + 0x4f, 0xc7, 0x3b, 0x30, 0x62, 0x43, 0x8e, 0x9f, 0xf0, 0x0f, 0x04, 0x86, 0xc3, 0x66, 0x4f, 0x7b, + 0xb8, 0x09, 0xcf, 0x78, 0xbc, 0xa7, 0x1c, 0xf2, 0x5c, 0x93, 0x3c, 0x57, 0xe9, 0xab, 0xfd, 0xf0, + 0x74, 0x4b, 0xda, 0xa7, 0x04, 0xa0, 0xdd, 0xc1, 0xb3, 0xda, 0x43, 0x6a, 0x34, 0xc8, 0x6a, 0x0f, + 0xe9, 0x61, 0x80, 0x4d, 0x48, 0x54, 0x46, 0x4f, 0xa7, 0x50, 0xfd, 0x7e, 0x1d, 0x2d, 0xbe, 0x8f, + 0x08, 0x0c, 0x06, 0xfd, 0x97, 0x9e, 0xe9, 0x6c, 0x3e, 0xd6, 0xd4, 0xf3, 0x67, 0xbb, 0x0b, 0xf5, + 0xbc, 0x9b, 0x41, 0x2f, 0xf7, 0xaf, 0x43, 0x7b, 0x34, 0x68, 0x51, 0x0f, 0x06, 0x83, 0x6e, 0x9c, + 0x05, 0x11, 0xeb, 0xf9, 0x59, 0x10, 0xf1, 0x09, 0x80, 0x15, 0x25, 0xc4, 0x09, 0x7a, 0x3c, 0x05, + 0x11, 0xf4, 0xfa, 0xb9, 0xeb, 0x0f, 0xb7, 0x0b, 0xe4, 0xd1, 0x76, 0x81, 0xfc, 0xb9, 0x5d, 0x20, + 0x5f, 0xec, 0x14, 0x06, 0x1e, 0xed, 0x14, 0x06, 0x7e, 0xdf, 0x29, 0x0c, 0xbc, 0x33, 0x19, 0x99, + 0x82, 0x7c, 0x65, 0x9b, 0x7b, 0xf2, 0x77, 0xb5, 0x59, 0x51, 0x53, 0x50, 0xdd, 0x31, 0x9b, 0x6b, + 0x5c, 0x28, 0x9b, 0x95, 0x41, 0xf9, 0x57, 0xd5, 0xf4, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd2, + 0xf4, 0x83, 0x94, 0x69, 0x13, 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 { + // Definition returns service definition + Definition(ctx context.Context, in *QueryDefinitionRequest, opts ...grpc.CallOption) (*QueryDefinitionResponse, error) + // Binding returns service Binding with service name and provider + Binding(ctx context.Context, in *QueryBindingRequest, opts ...grpc.CallOption) (*QueryBindingResponse, error) + // Bindings returns all service Bindings with service name and owner + Bindings(ctx context.Context, in *QueryBindingsRequest, opts ...grpc.CallOption) (*QueryBindingsResponse, error) + // WithdrawAddress returns the withdraw address of the binding owner + WithdrawAddress(ctx context.Context, in *QueryWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryWithdrawAddressResponse, error) + // RequestContext returns the request context + RequestContext(ctx context.Context, in *QueryRequestContextRequest, opts ...grpc.CallOption) (*QueryRequestContextResponse, error) + // Request returns the request + Request(ctx context.Context, in *QueryRequestRequest, opts ...grpc.CallOption) (*QueryRequestResponse, error) + // Request returns all requests of one service with provider + Requests(ctx context.Context, in *QueryRequestsRequest, opts ...grpc.CallOption) (*QueryRequestsResponse, error) + // RequestsByReqCtx returns all requests of one service call batch + RequestsByReqCtx(ctx context.Context, in *QueryRequestsByReqCtxRequest, opts ...grpc.CallOption) (*QueryRequestsByReqCtxResponse, error) + // Response returns the response of request + Response(ctx context.Context, in *QueryResponseRequest, opts ...grpc.CallOption) (*QueryResponseResponse, error) + // Responses returns all responses of one service call batch + Responses(ctx context.Context, in *QueryResponsesRequest, opts ...grpc.CallOption) (*QueryResponsesResponse, error) + // EarnedFees returns the earned service fee of one provider + EarnedFees(ctx context.Context, in *QueryEarnedFeesRequest, opts ...grpc.CallOption) (*QueryEarnedFeesResponse, error) + // Schema returns the schema + Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) + // Params queries the service parameters + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Definition(ctx context.Context, in *QueryDefinitionRequest, opts ...grpc.CallOption) (*QueryDefinitionResponse, error) { + out := new(QueryDefinitionResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Definition", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Binding(ctx context.Context, in *QueryBindingRequest, opts ...grpc.CallOption) (*QueryBindingResponse, error) { + out := new(QueryBindingResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Binding", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Bindings(ctx context.Context, in *QueryBindingsRequest, opts ...grpc.CallOption) (*QueryBindingsResponse, error) { + out := new(QueryBindingsResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Bindings", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) WithdrawAddress(ctx context.Context, in *QueryWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryWithdrawAddressResponse, error) { + out := new(QueryWithdrawAddressResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/WithdrawAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RequestContext(ctx context.Context, in *QueryRequestContextRequest, opts ...grpc.CallOption) (*QueryRequestContextResponse, error) { + out := new(QueryRequestContextResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/RequestContext", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Request(ctx context.Context, in *QueryRequestRequest, opts ...grpc.CallOption) (*QueryRequestResponse, error) { + out := new(QueryRequestResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Request", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Requests(ctx context.Context, in *QueryRequestsRequest, opts ...grpc.CallOption) (*QueryRequestsResponse, error) { + out := new(QueryRequestsResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Requests", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) RequestsByReqCtx(ctx context.Context, in *QueryRequestsByReqCtxRequest, opts ...grpc.CallOption) (*QueryRequestsByReqCtxResponse, error) { + out := new(QueryRequestsByReqCtxResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/RequestsByReqCtx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Response(ctx context.Context, in *QueryResponseRequest, opts ...grpc.CallOption) (*QueryResponseResponse, error) { + out := new(QueryResponseResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Response", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Responses(ctx context.Context, in *QueryResponsesRequest, opts ...grpc.CallOption) (*QueryResponsesResponse, error) { + out := new(QueryResponsesResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Responses", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) EarnedFees(ctx context.Context, in *QueryEarnedFeesRequest, opts ...grpc.CallOption) (*QueryEarnedFeesResponse, error) { + out := new(QueryEarnedFeesResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/EarnedFees", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) { + out := new(QuerySchemaResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Schema", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/irismod.service.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Definition returns service definition + Definition(context.Context, *QueryDefinitionRequest) (*QueryDefinitionResponse, error) + // Binding returns service Binding with service name and provider + Binding(context.Context, *QueryBindingRequest) (*QueryBindingResponse, error) + // Bindings returns all service Bindings with service name and owner + Bindings(context.Context, *QueryBindingsRequest) (*QueryBindingsResponse, error) + // WithdrawAddress returns the withdraw address of the binding owner + WithdrawAddress(context.Context, *QueryWithdrawAddressRequest) (*QueryWithdrawAddressResponse, error) + // RequestContext returns the request context + RequestContext(context.Context, *QueryRequestContextRequest) (*QueryRequestContextResponse, error) + // Request returns the request + Request(context.Context, *QueryRequestRequest) (*QueryRequestResponse, error) + // Request returns all requests of one service with provider + Requests(context.Context, *QueryRequestsRequest) (*QueryRequestsResponse, error) + // RequestsByReqCtx returns all requests of one service call batch + RequestsByReqCtx(context.Context, *QueryRequestsByReqCtxRequest) (*QueryRequestsByReqCtxResponse, error) + // Response returns the response of request + Response(context.Context, *QueryResponseRequest) (*QueryResponseResponse, error) + // Responses returns all responses of one service call batch + Responses(context.Context, *QueryResponsesRequest) (*QueryResponsesResponse, error) + // EarnedFees returns the earned service fee of one provider + EarnedFees(context.Context, *QueryEarnedFeesRequest) (*QueryEarnedFeesResponse, error) + // Schema returns the schema + Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) + // Params queries the service parameters + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Definition(ctx context.Context, req *QueryDefinitionRequest) (*QueryDefinitionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Definition not implemented") +} +func (*UnimplementedQueryServer) Binding(ctx context.Context, req *QueryBindingRequest) (*QueryBindingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Binding not implemented") +} +func (*UnimplementedQueryServer) Bindings(ctx context.Context, req *QueryBindingsRequest) (*QueryBindingsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bindings not implemented") +} +func (*UnimplementedQueryServer) WithdrawAddress(ctx context.Context, req *QueryWithdrawAddressRequest) (*QueryWithdrawAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawAddress not implemented") +} +func (*UnimplementedQueryServer) RequestContext(ctx context.Context, req *QueryRequestContextRequest) (*QueryRequestContextResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RequestContext not implemented") +} +func (*UnimplementedQueryServer) Request(ctx context.Context, req *QueryRequestRequest) (*QueryRequestResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Request not implemented") +} +func (*UnimplementedQueryServer) Requests(ctx context.Context, req *QueryRequestsRequest) (*QueryRequestsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Requests not implemented") +} +func (*UnimplementedQueryServer) RequestsByReqCtx(ctx context.Context, req *QueryRequestsByReqCtxRequest) (*QueryRequestsByReqCtxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RequestsByReqCtx not implemented") +} +func (*UnimplementedQueryServer) Response(ctx context.Context, req *QueryResponseRequest) (*QueryResponseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Response not implemented") +} +func (*UnimplementedQueryServer) Responses(ctx context.Context, req *QueryResponsesRequest) (*QueryResponsesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Responses not implemented") +} +func (*UnimplementedQueryServer) EarnedFees(ctx context.Context, req *QueryEarnedFeesRequest) (*QueryEarnedFeesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EarnedFees not implemented") +} +func (*UnimplementedQueryServer) Schema(ctx context.Context, req *QuerySchemaRequest) (*QuerySchemaResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Definition_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDefinitionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Definition(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Definition", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Definition(ctx, req.(*QueryDefinitionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Binding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBindingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Binding(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Binding", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Binding(ctx, req.(*QueryBindingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Bindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBindingsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Bindings(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Bindings", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Bindings(ctx, req.(*QueryBindingsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_WithdrawAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryWithdrawAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).WithdrawAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/WithdrawAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).WithdrawAddress(ctx, req.(*QueryWithdrawAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RequestContext_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRequestContextRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RequestContext(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/RequestContext", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RequestContext(ctx, req.(*QueryRequestContextRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Request_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRequestRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Request(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Request", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Request(ctx, req.(*QueryRequestRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Requests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRequestsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Requests(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Requests", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Requests(ctx, req.(*QueryRequestsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_RequestsByReqCtx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRequestsByReqCtxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RequestsByReqCtx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/RequestsByReqCtx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RequestsByReqCtx(ctx, req.(*QueryRequestsByReqCtxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Response_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryResponseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Response(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Response", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Response(ctx, req.(*QueryResponseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Responses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryResponsesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Responses(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Responses", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Responses(ctx, req.(*QueryResponsesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_EarnedFees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEarnedFeesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).EarnedFees(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/EarnedFees", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).EarnedFees(ctx, req.(*QueryEarnedFeesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Schema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySchemaRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Schema(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.service.Query/Schema", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Schema(ctx, req.(*QuerySchemaRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(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: "/irismod.service.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.service.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Definition", + Handler: _Query_Definition_Handler, + }, + { + MethodName: "Binding", + Handler: _Query_Binding_Handler, + }, + { + MethodName: "Bindings", + Handler: _Query_Bindings_Handler, + }, + { + MethodName: "WithdrawAddress", + Handler: _Query_WithdrawAddress_Handler, + }, + { + MethodName: "RequestContext", + Handler: _Query_RequestContext_Handler, + }, + { + MethodName: "Request", + Handler: _Query_Request_Handler, + }, + { + MethodName: "Requests", + Handler: _Query_Requests_Handler, + }, + { + MethodName: "RequestsByReqCtx", + Handler: _Query_RequestsByReqCtx_Handler, + }, + { + MethodName: "Response", + Handler: _Query_Response_Handler, + }, + { + MethodName: "Responses", + Handler: _Query_Responses_Handler, + }, + { + MethodName: "EarnedFees", + Handler: _Query_EarnedFees_Handler, + }, + { + MethodName: "Schema", + Handler: _Query_Schema_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service/query.proto", +} + +func (m *QueryDefinitionRequest) 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 *QueryDefinitionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDefinitionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDefinitionResponse) 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 *QueryDefinitionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDefinitionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ServiceDefinition != nil { + { + size, err := m.ServiceDefinition.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 *QueryBindingRequest) 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 *QueryBindingRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBindingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBindingResponse) 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 *QueryBindingResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBindingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ServiceBinding != nil { + { + size, err := m.ServiceBinding.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 *QueryBindingsRequest) 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 *QueryBindingsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBindingsRequest) 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] = 0x1a + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBindingsResponse) 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 *QueryBindingsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBindingsResponse) 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.ServiceBindings) > 0 { + for iNdEx := len(m.ServiceBindings) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceBindings[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 *QueryWithdrawAddressRequest) 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 *QueryWithdrawAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWithdrawAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryWithdrawAddressResponse) 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 *QueryWithdrawAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWithdrawAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WithdrawAddress) > 0 { + i -= len(m.WithdrawAddress) + copy(dAtA[i:], m.WithdrawAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.WithdrawAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRequestContextRequest) 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 *QueryRequestContextRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestContextRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRequestContextResponse) 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 *QueryRequestContextResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestContextResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RequestContext != nil { + { + size, err := m.RequestContext.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 *QueryRequestRequest) 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 *QueryRequestRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestRequest) 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 *QueryRequestResponse) 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 *QueryRequestResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Request != nil { + { + 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 *QueryRequestsRequest) 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 *QueryRequestsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestsRequest) 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] = 0x1a + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRequestsResponse) 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 *QueryRequestsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestsResponse) 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 (m *QueryRequestsByReqCtxRequest) 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 *QueryRequestsByReqCtxRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestsByReqCtxRequest) 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] = 0x1a + } + if m.BatchCounter != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BatchCounter)) + i-- + dAtA[i] = 0x10 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRequestsByReqCtxResponse) 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 *QueryRequestsByReqCtxResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRequestsByReqCtxResponse) 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 (m *QueryResponseRequest) 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 *QueryResponseRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResponseRequest) 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 *QueryResponseResponse) 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 *QueryResponseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResponseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Response != nil { + { + size, err := m.Response.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 *QueryResponsesRequest) 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 *QueryResponsesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResponsesRequest) 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] = 0x1a + } + if m.BatchCounter != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BatchCounter)) + i-- + dAtA[i] = 0x10 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryResponsesResponse) 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 *QueryResponsesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryResponsesResponse) 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.Responses) > 0 { + for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Responses[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 *QueryEarnedFeesRequest) 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 *QueryEarnedFeesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEarnedFeesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryEarnedFeesResponse) 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 *QueryEarnedFeesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryEarnedFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Fees) > 0 { + for iNdEx := len(m.Fees) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Fees[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 *QuerySchemaRequest) 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 *QuerySchemaRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SchemaName) > 0 { + i -= len(m.SchemaName) + copy(dAtA[i:], m.SchemaName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SchemaName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySchemaResponse) 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 *QuerySchemaResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +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 + if m.Res != nil { + { + size, err := m.Res.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryDefinitionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDefinitionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ServiceDefinition != nil { + l = m.ServiceDefinition.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBindingRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBindingResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ServiceBinding != nil { + l = m.ServiceBinding.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBindingsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBindingsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ServiceBindings) > 0 { + for _, e := range m.ServiceBindings { + 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 *QueryWithdrawAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryWithdrawAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WithdrawAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRequestContextRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRequestContextResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RequestContext != nil { + l = m.RequestContext.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRequestRequest) 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 *QueryRequestResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Request != nil { + l = m.Request.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRequestsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRequestsResponse) 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 (m *QueryRequestsByReqCtxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.BatchCounter != 0 { + n += 1 + sovQuery(uint64(m.BatchCounter)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRequestsByReqCtxResponse) 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 (m *QueryResponseRequest) 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 *QueryResponseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Response != nil { + l = m.Response.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryResponsesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.BatchCounter != 0 { + n += 1 + sovQuery(uint64(m.BatchCounter)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryResponsesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Responses) > 0 { + for _, e := range m.Responses { + 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 *QueryEarnedFeesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryEarnedFeesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Fees) > 0 { + for _, e := range m.Fees { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QuerySchemaRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SchemaName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySchemaResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Schema) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +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)) + if m.Res != nil { + l = m.Res.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 *QueryDefinitionRequest) 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: QueryDefinitionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDefinitionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDefinitionResponse) 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: QueryDefinitionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDefinitionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceDefinition", 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.ServiceDefinition == nil { + m.ServiceDefinition = &ServiceDefinition{} + } + if err := m.ServiceDefinition.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBindingRequest) 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: QueryBindingRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBindingRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBindingResponse) 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: QueryBindingResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBindingResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceBinding", 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.ServiceBinding == nil { + m.ServiceBinding = &ServiceBinding{} + } + if err := m.ServiceBinding.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBindingsRequest) 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: QueryBindingsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBindingsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = 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 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.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBindingsResponse) 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: QueryBindingsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBindingsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceBindings", 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.ServiceBindings = append(m.ServiceBindings, &ServiceBinding{}) + if err := m.ServiceBindings[len(m.ServiceBindings)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryWithdrawAddressRequest) 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: QueryWithdrawAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWithdrawAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryWithdrawAddressResponse) 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: QueryWithdrawAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWithdrawAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", 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.WithdrawAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestContextRequest) 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: QueryRequestContextRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestContextRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestContextResponse) 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: QueryRequestContextResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestContextResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContext", 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.RequestContext == nil { + m.RequestContext = &RequestContext{} + } + if err := m.RequestContext.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestRequest) 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: QueryRequestRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestRequest: 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestResponse) 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: QueryRequestResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestResponse: 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 m.Request == nil { + m.Request = &Request{} + } + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestsRequest) 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: QueryRequestsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestsResponse) 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: QueryRequestsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestsResponse: 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, &Request{}) + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestsByReqCtxRequest) 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: QueryRequestsByReqCtxRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestsByReqCtxRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchCounter", wireType) + } + m.BatchCounter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchCounter |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRequestsByReqCtxResponse) 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: QueryRequestsByReqCtxResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRequestsByReqCtxResponse: 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, &Request{}) + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryResponseRequest) 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: QueryResponseRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResponseRequest: 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryResponseResponse) 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: QueryResponseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResponseResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Response", 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.Response == nil { + m.Response = &Response{} + } + if err := m.Response.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryResponsesRequest) 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: QueryResponsesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResponsesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchCounter", wireType) + } + m.BatchCounter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchCounter |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryResponsesResponse) 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: QueryResponsesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryResponsesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Responses", 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.Responses = append(m.Responses, &Response{}) + if err := m.Responses[len(m.Responses)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEarnedFeesRequest) 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: QueryEarnedFeesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEarnedFeesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryEarnedFeesResponse) 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: QueryEarnedFeesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryEarnedFeesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fees", 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.Fees = append(m.Fees, types.Coin{}) + if err := m.Fees[len(m.Fees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySchemaRequest) 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: QuerySchemaRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchemaName", 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.SchemaName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySchemaResponse) 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: QuerySchemaResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schema", 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.Schema = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +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 { + return ErrInvalidLengthQuery + } + if (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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Res", 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.Res == nil { + m.Res = &query.PageResponse{} + } + if err := m.Res.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 { + return ErrInvalidLengthQuery + } + if (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/module-sdk/service/service.go b/module-sdk/service/service.go new file mode 100644 index 00000000..289ddff3 --- /dev/null +++ b/module-sdk/service/service.go @@ -0,0 +1,746 @@ +package service + +import ( + "context" + "encoding/json" + "strings" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + "github.com/irisnet/core-sdk-go/types/query" + sdk "github.com/irisnet/core-sdk-go/types" +) + +type serviceClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { + return serviceClient{ + BaseClient: bc, + Marshaler: cdc, + } +} + +func (s serviceClient) Name() string { + return ModuleName +} + +func (s serviceClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +//DefineService is responsible for creating a new service definition +func (s serviceClient) DefineService(request DefineServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + author, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + msg := &MsgDefineService{ + Name: request.ServiceName, + Description: request.Description, + Tags: request.Tags, + Author: author.String(), + AuthorDescription: request.AuthorDescription, + Schemas: request.Schemas, + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +//BindService is responsible for binding a new service definition +func (s serviceClient) BindService(request BindServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + var provider = owner.String() + if len(request.Provider) > 0 { + if err := sdk.ValidateAccAddress(request.Provider); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + provider = request.Provider + } + + amt, err := s.ToMinCoin(request.Deposit...) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgBindService{ + ServiceName: request.ServiceName, + Provider: provider, + Deposit: amt, + Pricing: request.Pricing, + QoS: request.QoS, + Options: request.Options, + Owner: owner.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +//UpdateServiceBinding updates the specified service binding +func (s serviceClient) UpdateServiceBinding(request UpdateServiceBindingRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + var provider = owner.String() + if len(request.Provider) > 0 { + if err := sdk.ValidateAccAddress(request.Provider); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + provider = request.Provider + } + + amt, err := s.ToMinCoin(request.Deposit...) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgUpdateServiceBinding{ + ServiceName: request.ServiceName, + Provider: provider, + Deposit: amt, + Pricing: request.Pricing, + QoS: request.QoS, + Owner: owner.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// DisableServiceBinding disables the specified service binding +func (s serviceClient) DisableServiceBinding(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + var providerAddr = owner.String() + if len(provider) > 0 { + if err := sdk.ValidateAccAddress(provider); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + providerAddr = provider + } + + msg := &MsgDisableServiceBinding{ + ServiceName: serviceName, + Provider: providerAddr, + Owner: owner.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// EnableServiceBinding enables the specified service binding +func (s serviceClient) EnableServiceBinding(serviceName, provider string, deposit sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + var providerAddr = owner.String() + if len(provider) > 0 { + if err := sdk.ValidateAccAddress(provider); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + providerAddr = provider + } + + amt, err := s.ToMinCoin(deposit...) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgEnableServiceBinding{ + ServiceName: serviceName, + Provider: providerAddr, + Deposit: amt, + Owner: owner.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +//InvokeService is responsible for invoke a new service and callback `handler` +func (s serviceClient) InvokeService(request InvokeServiceRequest, baseTx sdk.BaseTx) (string, sdk.ResultTx, sdk.Error) { + consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return "", sdk.ResultTx{}, sdk.Wrap(err) + } + + var providers []string + for _, provider := range request.Providers { + if err := sdk.ValidateAccAddress(provider); err != nil { + return "", sdk.ResultTx{}, sdk.Wrap(err) + } + providers = append(providers, provider) + } + + amt, err := s.ToMinCoin(request.ServiceFeeCap...) + if err != nil { + return "", sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgCallService{ + ServiceName: request.ServiceName, + Providers: providers, + Consumer: consumer.String(), + Input: request.Input, + ServiceFeeCap: amt, + Timeout: request.Timeout, + Repeated: request.Repeated, + RepeatedFrequency: request.RepeatedFrequency, + RepeatedTotal: request.RepeatedTotal, + } + + //mode must be set to commit + baseTx.Mode = sdk.Commit + + result, err := s.BuildAndSend([]sdk.Msg{msg}, baseTx) + if err != nil { + return "", sdk.ResultTx{}, sdk.Wrap(err) + } + + reqCtxID, e := result.Events.GetValue(sdk.EventTypeCreateContext, attributeKeyRequestContextID) + if e != nil { + return reqCtxID, result, sdk.Wrap(e) + } + + if request.Callback == nil { + return reqCtxID, result, nil + } + + _, err = s.SubscribeServiceResponse(reqCtxID, request.Callback) + return reqCtxID, result, sdk.Wrap(err) +} + +func (s serviceClient) InvokeServiceResponse(req InvokeServiceResponseRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + provider, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, err + } + + reqId := req.RequestId + _, err = s.QueryServiceRequest(reqId) + if err != nil { + return sdk.ResultTx{}, err + } + + msg := &MsgRespondService{ + RequestId: reqId, + Provider: provider.String(), + Result: req.Result, + Output: req.Output, + } + + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (s serviceClient) SubscribeServiceResponse(reqCtxID string, + callback InvokeCallback) (subscription sdk.Subscription, err sdk.Error) { + if len(reqCtxID) == 0 { + return subscription, sdk.Wrapf("reqCtxID %s should not be empty", reqCtxID) + } + + builder := sdk.NewEventQueryBuilder().AddCondition( + sdk.NewCond(sdk.EventTypeResponseService, attributeKeyRequestContextID).EQ(sdk.EventValue(reqCtxID)), + ) + + return s.SubscribeTx(builder, func(tx sdk.EventDataTx) { + s.Logger().Debug( + "consumer received response transaction sent by provider", + "tx_hash", tx.Hash, + "height", tx.Height, + "reqCtxID", reqCtxID, + ) + for _, msg := range tx.Tx.GetMsgs() { + msg, ok := msg.(*MsgRespondService) + if ok { + reqCtxID2, _, _, _, err := splitRequestID(msg.RequestId) + if err != nil { + s.Logger().Error( + "invalid requestID", + "requestID", msg.RequestId, + "errMsg", err.Error(), + ) + continue + } + if reqCtxID2.String() == strings.ToUpper(reqCtxID) { + callback(reqCtxID, msg.RequestId, msg.Output) + } + } + } + reqCtx, err := s.QueryRequestContext(reqCtxID) + if err != nil || reqCtx.State == RequestContextStateToStringMap[COMPLETED] { + _ = s.Unsubscribe(subscription) + } + }) +} + +// SetWithdrawAddress sets a new withdrawal address for the specified service binding +func (s serviceClient) SetWithdrawAddress(withdrawAddress string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + if err := sdk.ValidateAccAddress(withdrawAddress); err != nil { + return sdk.ResultTx{}, sdk.Wrapf("%s invalid address", withdrawAddress) + } + msg := &MsgSetWithdrawAddress{ + Owner: owner.String(), + WithdrawAddress: withdrawAddress, + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// RefundServiceDeposit refunds the deposit from the specified service binding +func (s serviceClient) RefundServiceDeposit(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + if err := sdk.ValidateAccAddress(provider); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgRefundServiceDeposit{ + ServiceName: serviceName, + Provider: provider, + Owner: owner.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// StartRequestContext starts the specified request context +func (s serviceClient) StartRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + msg := &MsgStartRequestContext{ + RequestContextId: requestContextID, + Consumer: consumer.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// PauseRequestContext suspends the specified request context +func (s serviceClient) PauseRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + msg := &MsgPauseRequestContext{ + RequestContextId: requestContextID, + Consumer: consumer.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// KillRequestContext terminates the specified request context +func (s serviceClient) KillRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + msg := &MsgKillRequestContext{ + RequestContextId: requestContextID, + Consumer: consumer.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// UpdateRequestContext updates the specified request context +func (s serviceClient) UpdateRequestContext(request UpdateRequestContextRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + for _, provider := range request.Providers { + if err := sdk.ValidateAccAddress(provider); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + } + + amt, err := s.ToMinCoin(request.ServiceFeeCap...) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgUpdateRequestContext{ + RequestContextId: request.RequestContextID, + Providers: request.Providers, + ServiceFeeCap: amt, + Timeout: request.Timeout, + RepeatedFrequency: request.RepeatedFrequency, + RepeatedTotal: request.RepeatedTotal, + Consumer: consumer.String(), + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// WithdrawEarnedFees withdraws the earned fees to the specified provider +func (s serviceClient) WithdrawEarnedFees(provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := s.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + var providerAddr = owner.String() + if len(provider) > 0 { + if err := sdk.ValidateAccAddress(provider); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + providerAddr = provider + } + + msg := &MsgWithdrawEarnedFees{ + Owner: owner.String(), + Provider: providerAddr, + } + return s.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +//SubscribeServiceRequest is responsible for registering a single service handler +func (s serviceClient) SubscribeServiceRequest(serviceName string, + callback RespondCallback, + baseTx sdk.BaseTx) (subscription sdk.Subscription, err sdk.Error) { + provider, e := s.QueryAddress(baseTx.From, baseTx.Password) + if e != nil { + return sdk.Subscription{}, sdk.Wrap(e) + } + + builder := sdk.NewEventQueryBuilder().AddCondition( + sdk.NewCond(eventTypeNewBatchRequestProvider, attributeKeyServiceName).EQ(sdk.EventValue(serviceName)), + ).AddCondition( + sdk.NewCond(eventTypeNewBatchRequestProvider, attributeKeyProvider).EQ(sdk.EventValue(provider.String())), + ) + + return s.SubscribeNewBlock(builder, func(block sdk.EventDataNewBlock) { + msgs := s.GenServiceResponseMsgs(block.ResultEndBlock.Events, serviceName, provider, callback) + if msgs == nil || len(msgs) == 0 { + s.Logger().Error("no message created", + "serviceName", serviceName, + "provider", provider, + ) + } + if _, err = s.SendBatch(msgs, baseTx); err != nil { + s.Logger().Error("provider respond failed", "errMsg", err.Error()) + } + }) +} + +// QueryServiceDefinition return a service definition of the specified name +func (s serviceClient) QueryServiceDefinition(serviceName string) (QueryServiceDefinitionResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryServiceDefinitionResponse{}, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Definition( + context.Background(), + &QueryDefinitionRequest{ServiceName: serviceName}, + ) + if err != nil { + return QueryServiceDefinitionResponse{}, sdk.Wrap(err) + } + + return resp.ServiceDefinition.Convert().(QueryServiceDefinitionResponse), nil +} + +// QueryServiceBinding return the specified service binding +func (s serviceClient) QueryServiceBinding(serviceName string, provider string) (QueryServiceBindingResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryServiceBindingResponse{}, sdk.Wrap(err) + } + + if err := sdk.ValidateAccAddress(provider); err != nil { + return QueryServiceBindingResponse{}, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Binding( + context.Background(), + &QueryBindingRequest{ + ServiceName: serviceName, + Provider: provider, + }, + ) + if err != nil { + return QueryServiceBindingResponse{}, sdk.Wrap(err) + } + + return resp.ServiceBinding.Convert().(QueryServiceBindingResponse), nil +} + +// QueryServiceBindings returns all bindings of the specified service +func (s serviceClient) QueryServiceBindings(serviceName string, pageReq *query.PageRequest) ([]QueryServiceBindingResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Bindings( + context.Background(), + &QueryBindingsRequest{ + ServiceName: serviceName, + Pagination: pageReq, + }, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + + return serviceBindings(resp.ServiceBindings).Convert().([]QueryServiceBindingResponse), nil +} + +// QueryServiceRequest returns the active request of the specified requestID +func (s serviceClient) QueryServiceRequest(requestID string) (QueryServiceRequestResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryServiceRequestResponse{}, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Request( + context.Background(), + &QueryRequestRequest{RequestId: requestID}, + ) + + if err == nil && !resp.Request.Empty() { + return resp.Request.Convert().(QueryServiceRequestResponse), nil + } + + //query service Request by block + request, err := s.queryRequestByTxQuery(requestID) + if err != nil { + return QueryServiceRequestResponse{}, sdk.Wrap(err) + } + + return request.Convert().(QueryServiceRequestResponse), nil +} + +// QueryServiceRequests returns all the active requests of the specified service binding +func (s serviceClient) QueryServiceRequests(serviceName string, provider string, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + if err := sdk.ValidateAccAddress(provider); err != nil { + return nil, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Requests( + context.Background(), + &QueryRequestsRequest{ + ServiceName: serviceName, + Provider: provider, + Pagination: pageReq, + }, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + + return requests(resp.Requests).Convert().([]QueryServiceRequestResponse), nil +} + +// QueryRequestsByReqCtx returns all requests of the specified request context ID and batch counter +func (s serviceClient) QueryRequestsByReqCtx(reqCtxID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).RequestsByReqCtx( + context.Background(), + &QueryRequestsByReqCtxRequest{ + RequestContextId: reqCtxID, + BatchCounter: batchCounter, + Pagination: pageReq, + }, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + + return requests(resp.Requests).Convert().([]QueryServiceRequestResponse), nil +} + +// QueryServiceResponse returns a response with the speicified request ID +func (s serviceClient) QueryServiceResponse(requestID string) (QueryServiceResponseResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryServiceResponseResponse{}, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Response( + context.Background(), + &QueryResponseRequest{RequestId: requestID}, + ) + + if err == nil { + return resp.Response.Convert().(QueryServiceResponseResponse), nil + } + + response, err := s.queryResponseByTxQuery(requestID) + if err != nil { + return QueryServiceResponseResponse{}, sdk.Wrap(nil) + } + + return response.Convert().(QueryServiceResponseResponse), nil +} + +// QueryServiceResponses returns all responses of the specified request context and batch counter +func (s serviceClient) QueryServiceResponses(reqCtxID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceResponseResponse, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).Responses( + context.Background(), + &QueryResponsesRequest{ + RequestContextId: reqCtxID, + BatchCounter: batchCounter, + Pagination: pageReq, + }, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + + return responses(resp.Responses).Convert().([]QueryServiceResponseResponse), nil +} + +// QueryRequestContext return the specified request context +func (s serviceClient) QueryRequestContext(reqCtxID string) (QueryRequestContextResp, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryRequestContextResp{}, sdk.Wrap(err) + } + + resp, err := NewQueryClient(conn).RequestContext( + context.Background(), + &QueryRequestContextRequest{RequestContextId: reqCtxID}, + ) + if err == nil && !resp.RequestContext.Empty() { + return resp.RequestContext.Convert().(QueryRequestContextResp), nil + } + + reqCtx, err := s.queryRequestContextByTxQuery(reqCtxID) + if err != nil { + return QueryRequestContextResp{}, sdk.Wrap(err) + } + + return reqCtx.Convert().(QueryRequestContextResp), nil +} + +//QueryFees return the earned fees for a provider +func (s serviceClient) QueryFees(provider string) (sdk.Coins, sdk.Error) { + if err := sdk.ValidateAccAddress(provider); err != nil { + return nil, sdk.Wrap(err) + } + + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return nil, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).EarnedFees( + context.Background(), + &QueryEarnedFeesRequest{Provider: provider}, + ) + if err != nil { + return nil, sdk.Wrap(err) + } + return res.Fees, nil +} + +func (s serviceClient) QueryParams() (QueryParamsResp, sdk.Error) { + conn, err := s.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Params( + context.Background(), + &QueryParamsRequest{}, + ) + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + + return res.Params.Convert().(QueryParamsResp), nil +} + +func (s serviceClient) GenServiceResponseMsgs(events sdk.StringEvents, serviceName string, + provider sdk.AccAddress, + handler RespondCallback) (msgs []sdk.Msg) { + + var ids []string + for _, e := range events { + if e.Type != eventTypeNewBatchRequestProvider { + continue + } + attributes := sdk.Attributes(e.Attributes) + svcName := attributes.GetValue(attributeKeyServiceName) + prov := attributes.GetValue(attributeKeyProvider) + if svcName == serviceName && prov == provider.String() { + reqIDsStr := attributes.GetValue(attributeKeyRequests) + var idsTemp []string + if err := json.Unmarshal([]byte(reqIDsStr), &idsTemp); err != nil { + s.Logger().Error( + "service request don't exist", + attributeKeyRequestID, reqIDsStr, + attributeKeyServiceName, serviceName, + attributeKeyProvider, provider.String(), + "errMsg", err.Error(), + ) + return + } + ids = append(ids, idsTemp...) + } + } + + for _, reqID := range ids { + request, err := s.QueryServiceRequest(reqID) + if err != nil { + s.Logger().Error( + "service request don't exist", + attributeKeyRequestID, reqID, + attributeKeyServiceName, serviceName, + attributeKeyProvider, provider.String(), + "errMsg", err.Error(), + ) + continue + } + //check again + providerStr := provider.String() + if providerStr == request.Provider && request.ServiceName == serviceName { + output, result := handler(request.RequestContextID, reqID, request.Input) + msgs = append(msgs, &MsgRespondService{ + RequestId: reqID, + Provider: providerStr, + Output: output, + Result: result, + }) + } + } + return msgs +} diff --git a/module-sdk/service/service.pb.go b/module-sdk/service/service.pb.go new file mode 100644 index 00000000..dc87d0f8 --- /dev/null +++ b/module-sdk/service/service.pb.go @@ -0,0 +1,4440 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/service.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/duration" + _ "github.com/golang/protobuf/ptypes/timestamp" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" + strconv "strconv" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// RequestContextBatchState is a type alias that represents a request batch status as a byte +type RequestContextBatchState int32 + +const ( + // BATCH_RUNNING defines the running batch status. + BATCHRUNNING RequestContextBatchState = 0 + // BATCH_COMPLETED defines the completed batch status. + BATCHCOMPLETED RequestContextBatchState = 1 +) + +var RequestContextBatchState_name = map[int32]string{ + 0: "BATCH_RUNNING", + 1: "BATCH_COMPLETED", +} + +var RequestContextBatchState_value = map[string]int32{ + "BATCH_RUNNING": 0, + "BATCH_COMPLETED": 1, +} + +func (RequestContextBatchState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{0} +} + +// RequestContextState is a type alias that represents a request status as a byte +type RequestContextState int32 + +const ( + // RUNNING defines the running request context status. + RUNNING RequestContextState = 0 + // PAUSED defines the paused request context status. + PAUSED RequestContextState = 1 + // COMPLETED defines the completed request context status. + COMPLETED RequestContextState = 2 +) + +var RequestContextState_name = map[int32]string{ + 0: "RUNNING", + 1: "PAUSED", + 2: "COMPLETED", +} + +var RequestContextState_value = map[string]int32{ + "RUNNING": 0, + "PAUSED": 1, + "COMPLETED": 2, +} + +func (RequestContextState) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{1} +} + +// ServiceDefinition defines a standard for service definition. +type ServiceDefinition struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Tags []string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty"` + Author string `protobuf:"bytes,4,opt,name=author,proto3" json:"author,omitempty"` + AuthorDescription string `protobuf:"bytes,5,opt,name=author_description,json=authorDescription,proto3" json:"author_description,omitempty" yaml:"author_description"` + Schemas string `protobuf:"bytes,6,opt,name=schemas,proto3" json:"schemas,omitempty"` +} + +func (m *ServiceDefinition) Reset() { *m = ServiceDefinition{} } +func (m *ServiceDefinition) String() string { return proto.CompactTextString(m) } +func (*ServiceDefinition) ProtoMessage() {} +func (*ServiceDefinition) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{0} +} +func (m *ServiceDefinition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ServiceDefinition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ServiceDefinition.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 *ServiceDefinition) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceDefinition.Merge(m, src) +} +func (m *ServiceDefinition) XXX_Size() int { + return m.Size() +} +func (m *ServiceDefinition) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceDefinition.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceDefinition proto.InternalMessageInfo + +// ServiceBinding defines a standard for service binding. +type ServiceBinding struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` + Pricing string `protobuf:"bytes,4,opt,name=pricing,proto3" json:"pricing,omitempty"` + QoS uint64 `protobuf:"varint,5,opt,name=qos,proto3" json:"qos,omitempty"` + Options string `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` + Available bool `protobuf:"varint,7,opt,name=available,proto3" json:"available,omitempty"` + DisabledTime time.Time `protobuf:"bytes,8,opt,name=disabled_time,json=disabledTime,proto3,stdtime" json:"disabled_time" yaml:"disabled_time"` + Owner string `protobuf:"bytes,9,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *ServiceBinding) Reset() { *m = ServiceBinding{} } +func (m *ServiceBinding) String() string { return proto.CompactTextString(m) } +func (*ServiceBinding) ProtoMessage() {} +func (*ServiceBinding) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{1} +} +func (m *ServiceBinding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ServiceBinding.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 *ServiceBinding) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceBinding.Merge(m, src) +} +func (m *ServiceBinding) XXX_Size() int { + return m.Size() +} +func (m *ServiceBinding) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceBinding.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceBinding proto.InternalMessageInfo + +// RequestContext defines a standard for request context. +type RequestContext struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Providers []string `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"` + Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` + Input string `protobuf:"bytes,4,opt,name=input,proto3" json:"input,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` + ModuleName string `protobuf:"bytes,6,opt,name=module_name,json=moduleName,proto3" json:"module_name,omitempty" yaml:"module_name"` + Timeout int64 `protobuf:"varint,7,opt,name=timeout,proto3" json:"timeout,omitempty"` + Repeated bool `protobuf:"varint,8,opt,name=repeated,proto3" json:"repeated,omitempty"` + RepeatedFrequency uint64 `protobuf:"varint,9,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` + RepeatedTotal int64 `protobuf:"varint,10,opt,name=repeated_total,json=repeatedTotal,proto3" json:"repeated_total,omitempty" yaml:"repeated_total"` + BatchCounter uint64 `protobuf:"varint,11,opt,name=batch_counter,json=batchCounter,proto3" json:"batch_counter,omitempty" yaml:"batch_counter"` + BatchRequestCount uint32 `protobuf:"varint,12,opt,name=batch_request_count,json=batchRequestCount,proto3" json:"batch_request_count,omitempty" yaml:"batch_request_count"` + BatchResponseCount uint32 `protobuf:"varint,13,opt,name=batch_response_count,json=batchResponseCount,proto3" json:"batch_response_count,omitempty" yaml:"batch_response_count"` + BatchResponseThreshold uint32 `protobuf:"varint,14,opt,name=batch_response_threshold,json=batchResponseThreshold,proto3" json:"batch_response_threshold,omitempty" yaml:"batch_response_threshold"` + ResponseThreshold uint32 `protobuf:"varint,15,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` + BatchState RequestContextBatchState `protobuf:"varint,16,opt,name=batch_state,json=batchState,proto3,enum=irismod.service.RequestContextBatchState" json:"batch_state,omitempty" yaml:"batch_state"` + State RequestContextState `protobuf:"varint,17,opt,name=state,proto3,enum=irismod.service.RequestContextState" json:"state,omitempty"` +} + +func (m *RequestContext) Reset() { *m = RequestContext{} } +func (m *RequestContext) String() string { return proto.CompactTextString(m) } +func (*RequestContext) ProtoMessage() {} +func (*RequestContext) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{2} +} +func (m *RequestContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RequestContext.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 *RequestContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestContext.Merge(m, src) +} +func (m *RequestContext) XXX_Size() int { + return m.Size() +} +func (m *RequestContext) XXX_DiscardUnknown() { + xxx_messageInfo_RequestContext.DiscardUnknown(m) +} + +var xxx_messageInfo_RequestContext proto.InternalMessageInfo + +// Request defines a standard for request. +type Request struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Provider string `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` + Consumer string `protobuf:"bytes,4,opt,name=consumer,proto3" json:"consumer,omitempty"` + Input string `protobuf:"bytes,5,opt,name=input,proto3" json:"input,omitempty"` + ServiceFee github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=service_fee,json=serviceFee,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee" yaml:"service_fee"` + RequestHeight int64 `protobuf:"varint,7,opt,name=request_height,json=requestHeight,proto3" json:"request_height,omitempty" yaml:"request_height"` + ExpirationHeight int64 `protobuf:"varint,8,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height,omitempty" yaml:"expiration_height"` + RequestContextId string `protobuf:"bytes,9,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + RequestContextBatchCounter uint64 `protobuf:"varint,10,opt,name=request_context_batch_counter,json=requestContextBatchCounter,proto3" json:"request_context_batch_counter,omitempty" yaml:"request_context_batch_counter"` +} + +func (m *Request) Reset() { *m = Request{} } +func (m *Request) String() string { return proto.CompactTextString(m) } +func (*Request) ProtoMessage() {} +func (*Request) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{3} +} +func (m *Request) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Request.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 *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(m, src) +} +func (m *Request) XXX_Size() int { + return m.Size() +} +func (m *Request) XXX_DiscardUnknown() { + xxx_messageInfo_Request.DiscardUnknown(m) +} + +var xxx_messageInfo_Request proto.InternalMessageInfo + +// CompactRequest defines a standard for compact request. +type CompactRequest struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + RequestContextBatchCounter uint64 `protobuf:"varint,2,opt,name=request_context_batch_counter,json=requestContextBatchCounter,proto3" json:"request_context_batch_counter,omitempty" yaml:"request_context_batch_counter"` + Provider string `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` + ServiceFee github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,4,rep,name=service_fee,json=serviceFee,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee" yaml:"service_fee"` + RequestHeight int64 `protobuf:"varint,5,opt,name=request_height,json=requestHeight,proto3" json:"request_height,omitempty" yaml:"request_height"` + ExpirationHeight int64 `protobuf:"varint,6,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height,omitempty" yaml:"expiration_height"` +} + +func (m *CompactRequest) Reset() { *m = CompactRequest{} } +func (m *CompactRequest) String() string { return proto.CompactTextString(m) } +func (*CompactRequest) ProtoMessage() {} +func (*CompactRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{4} +} +func (m *CompactRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CompactRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CompactRequest.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 *CompactRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CompactRequest.Merge(m, src) +} +func (m *CompactRequest) XXX_Size() int { + return m.Size() +} +func (m *CompactRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CompactRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CompactRequest proto.InternalMessageInfo + +// Response defines a standard for response. +type Response struct { + Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + Result string `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` + Output string `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` + RequestContextId string `protobuf:"bytes,5,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + RequestContextBatchCounter uint64 `protobuf:"varint,6,opt,name=request_context_batch_counter,json=requestContextBatchCounter,proto3" json:"request_context_batch_counter,omitempty" yaml:"request_context_batch_counter"` +} + +func (m *Response) Reset() { *m = Response{} } +func (m *Response) String() string { return proto.CompactTextString(m) } +func (*Response) ProtoMessage() {} +func (*Response) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{5} +} +func (m *Response) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Response.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 *Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_Response.Merge(m, src) +} +func (m *Response) XXX_Size() int { + return m.Size() +} +func (m *Response) XXX_DiscardUnknown() { + xxx_messageInfo_Response.DiscardUnknown(m) +} + +var xxx_messageInfo_Response proto.InternalMessageInfo + +// Pricing defines a standard for service pricing. +type Pricing struct { + Price github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=price,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"price"` + PromotionsByTime []PromotionByTime `protobuf:"bytes,2,rep,name=promotions_by_time,json=promotionsByTime,proto3" json:"promotions_by_time" yaml:"promotions_by_time"` + PromotionsByVolume []PromotionByVolume `protobuf:"bytes,3,rep,name=promotions_by_volume,json=promotionsByVolume,proto3" json:"promotions_by_volume" yaml:"promotions_by_volume"` +} + +func (m *Pricing) Reset() { *m = Pricing{} } +func (m *Pricing) String() string { return proto.CompactTextString(m) } +func (*Pricing) ProtoMessage() {} +func (*Pricing) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{6} +} +func (m *Pricing) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pricing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pricing.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 *Pricing) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pricing.Merge(m, src) +} +func (m *Pricing) XXX_Size() int { + return m.Size() +} +func (m *Pricing) XXX_DiscardUnknown() { + xxx_messageInfo_Pricing.DiscardUnknown(m) +} + +var xxx_messageInfo_Pricing proto.InternalMessageInfo + +// PromotionByTime defines a standard for service promotion by time. +type PromotionByTime struct { + StartTime time.Time `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"start_time"` + EndTime time.Time `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time" yaml:"end_time"` + Discount github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=discount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"discount"` +} + +func (m *PromotionByTime) Reset() { *m = PromotionByTime{} } +func (m *PromotionByTime) String() string { return proto.CompactTextString(m) } +func (*PromotionByTime) ProtoMessage() {} +func (*PromotionByTime) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{7} +} +func (m *PromotionByTime) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PromotionByTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PromotionByTime.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 *PromotionByTime) XXX_Merge(src proto.Message) { + xxx_messageInfo_PromotionByTime.Merge(m, src) +} +func (m *PromotionByTime) XXX_Size() int { + return m.Size() +} +func (m *PromotionByTime) XXX_DiscardUnknown() { + xxx_messageInfo_PromotionByTime.DiscardUnknown(m) +} + +var xxx_messageInfo_PromotionByTime proto.InternalMessageInfo + +// PromotionByVolume defines a standard for service promotion by volume. +type PromotionByVolume struct { + Volume uint64 `protobuf:"varint,1,opt,name=volume,proto3" json:"volume,omitempty"` + Discount github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,2,opt,name=discount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"discount"` +} + +func (m *PromotionByVolume) Reset() { *m = PromotionByVolume{} } +func (m *PromotionByVolume) String() string { return proto.CompactTextString(m) } +func (*PromotionByVolume) ProtoMessage() {} +func (*PromotionByVolume) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{8} +} +func (m *PromotionByVolume) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PromotionByVolume) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PromotionByVolume.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 *PromotionByVolume) XXX_Merge(src proto.Message) { + xxx_messageInfo_PromotionByVolume.Merge(m, src) +} +func (m *PromotionByVolume) XXX_Size() int { + return m.Size() +} +func (m *PromotionByVolume) XXX_DiscardUnknown() { + xxx_messageInfo_PromotionByVolume.DiscardUnknown(m) +} + +var xxx_messageInfo_PromotionByVolume proto.InternalMessageInfo + +// service parameters +type Params struct { + MaxRequestTimeout int64 `protobuf:"varint,1,opt,name=max_request_timeout,json=maxRequestTimeout,proto3" json:"max_request_timeout,omitempty" yaml:"max_request_timeout"` + MinDepositMultiple int64 `protobuf:"varint,2,opt,name=min_deposit_multiple,json=minDepositMultiple,proto3" json:"min_deposit_multiple,omitempty" yaml:"min_deposit_multiple"` + MinDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"min_deposit"` + ServiceFeeTax github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,4,opt,name=service_fee_tax,json=serviceFeeTax,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"service_fee_tax" yaml:"service_fee_tax"` + SlashFraction github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,5,opt,name=slash_fraction,json=slashFraction,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"slash_fraction" yaml:"slash_fraction"` + ComplaintRetrospect time.Duration `protobuf:"bytes,6,opt,name=complaint_retrospect,json=complaintRetrospect,proto3,stdduration" json:"complaint_retrospect" yaml:"complaint_retrospect"` + ArbitrationTimeLimit time.Duration `protobuf:"bytes,7,opt,name=arbitration_time_limit,json=arbitrationTimeLimit,proto3,stdduration" json:"arbitration_time_limit" yaml:"arbitration_time_limit"` + TxSizeLimit uint64 `protobuf:"varint,8,opt,name=tx_size_limit,json=txSizeLimit,proto3" json:"tx_size_limit,omitempty" yaml:"tx_size_limit"` + BaseDenom string `protobuf:"bytes,9,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty" yaml:"base_denom"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_e51e679f9ae460e2, []int{9} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("irismod.service.RequestContextBatchState", RequestContextBatchState_name, RequestContextBatchState_value) + proto.RegisterEnum("irismod.service.RequestContextState", RequestContextState_name, RequestContextState_value) + proto.RegisterType((*ServiceDefinition)(nil), "irismod.service.ServiceDefinition") + proto.RegisterType((*ServiceBinding)(nil), "irismod.service.ServiceBinding") + proto.RegisterType((*RequestContext)(nil), "irismod.service.RequestContext") + proto.RegisterType((*Request)(nil), "irismod.service.Request") + proto.RegisterType((*CompactRequest)(nil), "irismod.service.CompactRequest") + proto.RegisterType((*Response)(nil), "irismod.service.Response") + proto.RegisterType((*Pricing)(nil), "irismod.service.Pricing") + proto.RegisterType((*PromotionByTime)(nil), "irismod.service.PromotionByTime") + proto.RegisterType((*PromotionByVolume)(nil), "irismod.service.PromotionByVolume") + proto.RegisterType((*Params)(nil), "irismod.service.Params") +} + +func init() { proto.RegisterFile("service/service.proto", fileDescriptor_e51e679f9ae460e2) } + +var fileDescriptor_e51e679f9ae460e2 = []byte{ + // 1802 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6f, 0xdb, 0xc8, + 0x15, 0x17, 0x25, 0x5b, 0x96, 0x47, 0x96, 0x6c, 0x4d, 0x1c, 0x97, 0x51, 0x12, 0x51, 0x65, 0x16, + 0x58, 0xef, 0x16, 0x91, 0x90, 0x6c, 0x8b, 0x02, 0x41, 0x0b, 0x74, 0x69, 0x6f, 0xba, 0xc1, 0x26, + 0x8e, 0x43, 0x7b, 0x8b, 0xa2, 0x40, 0x21, 0x50, 0xe4, 0x58, 0x9a, 0xae, 0xc8, 0x61, 0x38, 0x43, + 0x57, 0x0e, 0x7a, 0x6f, 0xe1, 0x53, 0xd0, 0xd3, 0x5e, 0x0c, 0x2c, 0xd0, 0x3d, 0x14, 0x45, 0x0f, + 0x3d, 0xf7, 0x2f, 0xc8, 0x71, 0x8f, 0x45, 0x81, 0x2a, 0x6d, 0x72, 0xe9, 0x59, 0xe8, 0xad, 0x28, + 0x50, 0xcc, 0x07, 0x25, 0x52, 0x52, 0xe2, 0xad, 0x9b, 0x00, 0x7b, 0xd2, 0xbc, 0xaf, 0xdf, 0xe3, + 0xbc, 0xf7, 0xe6, 0xcd, 0x1b, 0x81, 0xcb, 0x14, 0x45, 0xc7, 0xd8, 0x45, 0x6d, 0xf5, 0xdb, 0x0a, + 0x23, 0xc2, 0x08, 0x5c, 0xc7, 0x11, 0xa6, 0x3e, 0xf1, 0x5a, 0x8a, 0x5d, 0x6f, 0xb8, 0x84, 0xfa, + 0x84, 0xb6, 0xbb, 0x0e, 0x45, 0xed, 0xe3, 0x5b, 0x5d, 0xc4, 0x9c, 0x5b, 0x6d, 0x97, 0xe0, 0x40, + 0x1a, 0xd4, 0x37, 0x7b, 0xa4, 0x47, 0xc4, 0xb2, 0xcd, 0x57, 0x8a, 0xdb, 0xe8, 0x11, 0xd2, 0x1b, + 0xa0, 0xb6, 0xa0, 0xba, 0xf1, 0x51, 0xdb, 0x8b, 0x23, 0x87, 0x61, 0x92, 0x58, 0x19, 0xb3, 0x72, + 0x86, 0x7d, 0x44, 0x99, 0xe3, 0x87, 0x52, 0xc1, 0xfc, 0x9b, 0x06, 0x6a, 0x07, 0xf2, 0x13, 0x76, + 0xd1, 0x11, 0x0e, 0x30, 0x37, 0x86, 0x10, 0x2c, 0x05, 0x8e, 0x8f, 0x74, 0xad, 0xa9, 0x6d, 0xaf, + 0xda, 0x62, 0x0d, 0x9b, 0xa0, 0xec, 0x21, 0xea, 0x46, 0x38, 0xe4, 0x2a, 0x7a, 0x5e, 0x88, 0xd2, + 0x2c, 0x6e, 0xc5, 0x9c, 0x1e, 0xd5, 0x0b, 0xcd, 0x02, 0xb7, 0xe2, 0x6b, 0xb8, 0x05, 0x8a, 0x4e, + 0xcc, 0xfa, 0x24, 0xd2, 0x97, 0x84, 0x81, 0xa2, 0xe0, 0x7d, 0x00, 0xe5, 0xaa, 0x93, 0x06, 0x5d, + 0xe6, 0x3a, 0xd6, 0xf5, 0xf1, 0xc8, 0xb8, 0x72, 0xe2, 0xf8, 0x83, 0x3b, 0xe6, 0xbc, 0x8e, 0x69, + 0xd7, 0x24, 0x73, 0x37, 0xe5, 0x59, 0x07, 0x2b, 0xd4, 0xed, 0x23, 0xdf, 0xa1, 0x7a, 0x51, 0xb8, + 0x49, 0x48, 0xf3, 0xcf, 0x05, 0x50, 0x55, 0xfb, 0xb3, 0x70, 0xe0, 0xe1, 0xa0, 0x07, 0xef, 0x80, + 0x35, 0x15, 0xf4, 0xce, 0x74, 0x93, 0xd6, 0xb7, 0xc6, 0x23, 0xe3, 0x92, 0x74, 0x9a, 0x96, 0x9a, + 0x76, 0x59, 0x91, 0x7b, 0x3c, 0x08, 0x75, 0x50, 0x0a, 0x23, 0x72, 0x8c, 0x3d, 0x14, 0xa9, 0x08, + 0x4c, 0x68, 0xf8, 0x0b, 0xb0, 0xe2, 0xa1, 0x90, 0x50, 0xcc, 0x44, 0x04, 0xca, 0xb7, 0xaf, 0xb4, + 0x64, 0x4e, 0x5b, 0x3c, 0xa7, 0x2d, 0x95, 0xd3, 0xd6, 0x0e, 0xc1, 0x81, 0xf5, 0xbd, 0x67, 0x23, + 0x23, 0xf7, 0x87, 0xe7, 0xc6, 0xcd, 0x1e, 0x66, 0xfd, 0xb8, 0xdb, 0x72, 0x89, 0xdf, 0xe6, 0x15, + 0x11, 0x20, 0x26, 0x7e, 0xfb, 0x71, 0xf7, 0x26, 0xf5, 0x3e, 0xbb, 0xd9, 0x23, 0x6d, 0x76, 0x12, + 0x22, 0x2a, 0xac, 0xa8, 0x9d, 0x38, 0xe0, 0x1b, 0x0e, 0x23, 0xec, 0xe2, 0xa0, 0xa7, 0xe2, 0x9a, + 0x90, 0xf0, 0x0a, 0x28, 0x3c, 0x26, 0x54, 0x44, 0x72, 0xc9, 0x5a, 0x79, 0x31, 0x32, 0x0a, 0x8f, + 0xc8, 0x81, 0xcd, 0x79, 0xdc, 0x88, 0x88, 0x78, 0x4d, 0xa2, 0xa4, 0x48, 0x78, 0x0d, 0xac, 0x3a, + 0xc7, 0x0e, 0x1e, 0x38, 0xdd, 0x01, 0xd2, 0x57, 0x9a, 0xda, 0x76, 0xc9, 0x9e, 0x32, 0xa0, 0x03, + 0x2a, 0x1e, 0xa6, 0x7c, 0xe9, 0x75, 0x78, 0xfd, 0xe8, 0xa5, 0xa6, 0xb6, 0x5d, 0xbe, 0x5d, 0x6f, + 0xc9, 0xe2, 0x6a, 0x25, 0xc5, 0xd5, 0x3a, 0x4c, 0x8a, 0xcb, 0x6a, 0xf2, 0xfd, 0x8d, 0x47, 0xc6, + 0xa6, 0x8c, 0x68, 0xc6, 0xdc, 0x7c, 0xfa, 0xdc, 0xd0, 0xec, 0xb5, 0x84, 0xc7, 0x8d, 0xe0, 0x26, + 0x58, 0x26, 0xbf, 0x0c, 0x50, 0xa4, 0xaf, 0x8a, 0x0f, 0x93, 0x84, 0xf9, 0xbc, 0x04, 0xaa, 0x36, + 0x7a, 0x1c, 0x23, 0xca, 0x76, 0x48, 0xc0, 0xd0, 0x90, 0xfd, 0x5f, 0xc9, 0xbb, 0x06, 0x56, 0x93, + 0x64, 0x51, 0x3d, 0x2f, 0x8a, 0x74, 0xca, 0xe0, 0xa9, 0x75, 0x49, 0x40, 0x63, 0x1f, 0x45, 0x7a, + 0x41, 0xa6, 0x36, 0xa1, 0xf9, 0xe7, 0xe1, 0x20, 0x8c, 0x99, 0x0a, 0xb6, 0x24, 0xe0, 0x6f, 0x35, + 0xb0, 0x9e, 0xb8, 0x3b, 0x42, 0xa8, 0xe3, 0x3a, 0xa1, 0xbe, 0x7c, 0x5e, 0xe6, 0x1f, 0xaa, 0xc8, + 0x6c, 0x65, 0x3f, 0x57, 0xd9, 0x9b, 0xff, 0x7b, 0x4d, 0x54, 0x14, 0xc4, 0x5d, 0x84, 0x76, 0x9c, + 0x10, 0x7e, 0x1f, 0x94, 0x7d, 0xe2, 0xc5, 0x03, 0x15, 0x1f, 0x91, 0x68, 0x6b, 0x6b, 0x3c, 0x32, + 0xa0, 0x74, 0x98, 0x12, 0x9a, 0x36, 0x90, 0x94, 0x88, 0x8e, 0x0e, 0x56, 0x78, 0x76, 0x48, 0xcc, + 0x44, 0x05, 0x14, 0xec, 0x84, 0xe4, 0x91, 0x89, 0x50, 0x88, 0x1c, 0x86, 0x3c, 0x91, 0xfa, 0x92, + 0x3d, 0xa1, 0xf9, 0x39, 0x4e, 0xd6, 0x9d, 0xa3, 0x88, 0xe7, 0x2a, 0x70, 0x4f, 0x44, 0x16, 0x97, + 0xd2, 0xe7, 0x78, 0x5e, 0xc7, 0xb4, 0x6b, 0x09, 0xf3, 0x6e, 0xc2, 0x83, 0x3f, 0x02, 0xd5, 0x89, + 0x26, 0x23, 0xcc, 0x19, 0xe8, 0x80, 0x7f, 0x8a, 0x75, 0x65, 0x3c, 0x32, 0x2e, 0xcf, 0x20, 0x09, + 0xb9, 0x69, 0x57, 0x12, 0xc6, 0x21, 0xa7, 0xe1, 0x0f, 0x41, 0xa5, 0xeb, 0x30, 0xb7, 0xdf, 0x71, + 0x49, 0x1c, 0x30, 0x14, 0xe9, 0x65, 0xf1, 0x29, 0xfa, 0xb4, 0x16, 0x33, 0x62, 0xd3, 0x5e, 0x13, + 0xf4, 0x8e, 0x24, 0xe1, 0x1e, 0xb8, 0x24, 0xe5, 0x91, 0x2c, 0x3b, 0xa9, 0xa7, 0xaf, 0x35, 0xb5, + 0xed, 0x8a, 0xd5, 0x18, 0x8f, 0x8c, 0x7a, 0x1a, 0x24, 0xa3, 0x64, 0xda, 0x35, 0xc1, 0x9d, 0x14, + 0x6c, 0x1c, 0x30, 0xf8, 0x08, 0x6c, 0x26, 0xaa, 0x34, 0x24, 0x01, 0x45, 0x0a, 0xb0, 0x22, 0x00, + 0x8d, 0xf1, 0xc8, 0xb8, 0x9a, 0x05, 0x4c, 0x6b, 0x99, 0x36, 0x54, 0x88, 0x92, 0x2b, 0x21, 0x7f, + 0x0e, 0xf4, 0x19, 0x65, 0xd6, 0x8f, 0x10, 0xed, 0x93, 0x81, 0xa7, 0x57, 0x05, 0xec, 0x8d, 0xf1, + 0xc8, 0x30, 0x16, 0xc2, 0x4e, 0x34, 0x4d, 0x7b, 0x2b, 0x03, 0x7d, 0x98, 0x08, 0x64, 0x42, 0xe7, + 0x80, 0xd7, 0x05, 0x70, 0x26, 0xa1, 0xf3, 0x90, 0xb5, 0x68, 0x0e, 0xad, 0x0b, 0xca, 0xf2, 0x13, + 0x28, 0x73, 0x18, 0xd2, 0x37, 0x9a, 0xda, 0x76, 0xf5, 0xf6, 0x7b, 0xad, 0x99, 0xcb, 0xaf, 0x95, + 0x3d, 0xe4, 0x16, 0xb7, 0x38, 0xe0, 0x06, 0xe9, 0xc2, 0x4d, 0xe1, 0x98, 0x36, 0xe8, 0x4e, 0x74, + 0xe0, 0x1d, 0xb0, 0x2c, 0xd1, 0x6b, 0x02, 0xfd, 0x9d, 0x73, 0xd0, 0x85, 0x91, 0x2d, 0x4d, 0xcc, + 0x7f, 0x2d, 0x81, 0x15, 0x25, 0x86, 0x55, 0x90, 0xc7, 0x9e, 0xba, 0xf2, 0xf2, 0xd8, 0x9b, 0x6b, + 0x35, 0xf9, 0x0b, 0xde, 0x13, 0x85, 0x99, 0x7b, 0x22, 0xdd, 0x68, 0x96, 0x5e, 0xd5, 0x68, 0x96, + 0xd3, 0x8d, 0xe6, 0xd7, 0x1a, 0x28, 0xa7, 0x1a, 0x85, 0x5e, 0x3c, 0xaf, 0xc9, 0x7c, 0xa2, 0x9a, + 0x0c, 0x9c, 0x6b, 0x32, 0x17, 0x68, 0x30, 0x60, 0xda, 0x60, 0xe4, 0x01, 0x95, 0x45, 0xdf, 0x47, + 0xb8, 0xd7, 0x57, 0xbd, 0x22, 0x7b, 0x40, 0xd3, 0x72, 0x71, 0x40, 0x05, 0xe3, 0x63, 0x41, 0xc3, + 0x7b, 0xa0, 0x86, 0x86, 0x21, 0x96, 0x53, 0x4a, 0x02, 0x52, 0x12, 0x20, 0xd7, 0xc6, 0x23, 0x43, + 0x97, 0x20, 0x73, 0x2a, 0xa6, 0xbd, 0x31, 0xe5, 0x29, 0xa8, 0x4f, 0x78, 0xa9, 0x26, 0x27, 0x50, + 0xe4, 0xb6, 0x83, 0x3d, 0x79, 0x83, 0x64, 0x4b, 0x75, 0x56, 0xc7, 0xb4, 0x37, 0xa2, 0x4c, 0x4d, + 0xdc, 0xf3, 0xe0, 0x67, 0xe0, 0xfa, 0xac, 0x62, 0xb6, 0x91, 0x00, 0xd1, 0x48, 0xb6, 0xc7, 0x23, + 0xe3, 0x9d, 0xc5, 0xb8, 0x33, 0x8d, 0xa5, 0x1e, 0xcd, 0x17, 0xb5, 0x6a, 0x33, 0xe6, 0x7f, 0x0a, + 0xa0, 0xba, 0x43, 0xfc, 0xd0, 0x71, 0x59, 0x52, 0x7d, 0x8b, 0x37, 0xa3, 0xbd, 0xa5, 0xcd, 0xe4, + 0xdf, 0xdc, 0x66, 0x5e, 0x5b, 0xeb, 0xb3, 0x95, 0xbb, 0xf4, 0x0d, 0xaa, 0xdc, 0xe5, 0x37, 0x51, + 0xb9, 0xc5, 0x8b, 0x54, 0xae, 0xf9, 0xc7, 0x3c, 0x28, 0x25, 0xad, 0x37, 0x13, 0x3f, 0xed, 0x35, + 0xbd, 0x22, 0x3f, 0xd3, 0x2b, 0xb6, 0x40, 0x31, 0x42, 0x34, 0x1e, 0x30, 0x15, 0x75, 0x45, 0x71, + 0x3e, 0x89, 0xd9, 0x74, 0x5a, 0x51, 0xd4, 0x2b, 0x2a, 0x6c, 0xf9, 0x2d, 0x55, 0x58, 0xf1, 0x0d, + 0x1e, 0x97, 0xe7, 0x79, 0xb0, 0xb2, 0xaf, 0xe6, 0xdb, 0x23, 0xb0, 0xcc, 0x47, 0xdd, 0xaf, 0xd1, + 0x04, 0x2f, 0x38, 0x63, 0x4b, 0x78, 0xf8, 0x18, 0xc0, 0x30, 0x22, 0x3e, 0x11, 0x03, 0x72, 0xa7, + 0x7b, 0x22, 0x27, 0xdf, 0xbc, 0x70, 0xda, 0x9c, 0xbb, 0x62, 0xf6, 0x13, 0x55, 0xeb, 0x84, 0xcf, + 0xb3, 0xd6, 0xb7, 0x55, 0x19, 0xab, 0x98, 0xce, 0x23, 0x99, 0xf6, 0xc6, 0x94, 0x29, 0x8d, 0xe0, + 0x09, 0xd8, 0xcc, 0x2a, 0x1e, 0x93, 0x41, 0xec, 0x23, 0xf5, 0x9a, 0x30, 0x5f, 0xe7, 0xf4, 0x27, + 0x42, 0xd3, 0xba, 0xa1, 0xdc, 0x5e, 0x5d, 0xe4, 0x56, 0xa2, 0x99, 0x36, 0x4c, 0x3b, 0x96, 0x86, + 0xe6, 0xd3, 0x3c, 0x58, 0x9f, 0xd9, 0x03, 0xfc, 0x29, 0x00, 0x94, 0x39, 0x11, 0x93, 0x3b, 0xd7, + 0xce, 0x9d, 0xf9, 0xaf, 0x2b, 0xe7, 0x35, 0x75, 0x74, 0x27, 0xb6, 0x72, 0xe0, 0x5f, 0x15, 0x0c, + 0x81, 0x6c, 0x83, 0x12, 0x0a, 0xbc, 0x24, 0xa2, 0xe7, 0xe1, 0x5e, 0x55, 0xb8, 0xeb, 0xea, 0x80, + 0x05, 0xe9, 0x67, 0xc4, 0x0a, 0x0a, 0xe4, 0x0b, 0xe2, 0x21, 0x28, 0x79, 0x98, 0xca, 0xe9, 0x4a, + 0x9c, 0x07, 0xeb, 0x03, 0x6e, 0xf7, 0xd7, 0x91, 0xf1, 0x9d, 0xaf, 0x9b, 0xff, 0x5d, 0xe4, 0xda, + 0x13, 0x10, 0xf3, 0x57, 0xa0, 0x36, 0x17, 0x60, 0x7e, 0xb6, 0x54, 0x52, 0x78, 0x3c, 0x96, 0x6c, + 0x45, 0x65, 0xbc, 0xe7, 0xdf, 0x84, 0xf7, 0x7f, 0x17, 0x41, 0x71, 0xdf, 0x89, 0x1c, 0x9f, 0xf2, + 0x99, 0xd4, 0x77, 0x86, 0x93, 0x61, 0x33, 0x19, 0xd2, 0x35, 0xd1, 0x79, 0x52, 0x33, 0xe9, 0x02, + 0x25, 0xd3, 0xae, 0xf9, 0xce, 0x50, 0x5d, 0x31, 0x87, 0x6a, 0x9c, 0x7f, 0x04, 0x36, 0x7d, 0x1c, + 0x74, 0xd4, 0x53, 0xb2, 0xe3, 0xc7, 0x03, 0x86, 0xc3, 0x81, 0xcc, 0x44, 0x21, 0x3d, 0x93, 0x2e, + 0xd2, 0x32, 0x6d, 0xe8, 0xe3, 0x60, 0x57, 0x72, 0x1f, 0x28, 0x26, 0x7c, 0x0c, 0xca, 0x29, 0xe5, + 0xb7, 0xf6, 0xfc, 0x05, 0x53, 0xd7, 0x30, 0xce, 0xbe, 0xbd, 0x98, 0x33, 0x94, 0xed, 0xce, 0x7a, + 0x70, 0x81, 0xc0, 0x2f, 0x7e, 0x8f, 0x31, 0x67, 0x68, 0xa6, 0x9f, 0x57, 0x87, 0xce, 0x10, 0x52, + 0x50, 0xa5, 0x03, 0x87, 0xf6, 0x3b, 0x47, 0x91, 0xe3, 0xa6, 0xfe, 0xb3, 0xb8, 0x7f, 0x31, 0xaf, + 0xea, 0xe6, 0xc9, 0x42, 0x72, 0xa7, 0x9c, 0x71, 0x57, 0xd1, 0x30, 0x06, 0x9b, 0x2e, 0xf1, 0xc3, + 0x81, 0x83, 0x03, 0xd6, 0x89, 0x10, 0x8b, 0x08, 0x0d, 0x91, 0x2b, 0x2f, 0x1f, 0x1e, 0xe7, 0xd9, + 0xb3, 0xb3, 0xab, 0xfe, 0x04, 0xb2, 0xde, 0xcd, 0xf6, 0x83, 0x45, 0x20, 0xe6, 0xe7, 0xfc, 0x18, + 0x5d, 0x9a, 0x88, 0xec, 0x89, 0x04, 0x3e, 0x01, 0x5b, 0x4e, 0xd4, 0xc5, 0x4c, 0x5d, 0x67, 0xbc, + 0xa6, 0x3a, 0x03, 0xec, 0x63, 0x39, 0xf4, 0xbd, 0xd6, 0xf1, 0x7b, 0xca, 0xf1, 0x75, 0xf5, 0x37, + 0xce, 0x42, 0x18, 0xe9, 0x7a, 0x33, 0x25, 0xe4, 0x25, 0x7a, 0x9f, 0x8b, 0xe0, 0x0f, 0x40, 0x85, + 0x0d, 0x3b, 0x14, 0x3f, 0x49, 0x5c, 0x96, 0x66, 0xdf, 0x71, 0x19, 0xb1, 0x69, 0x97, 0xd9, 0xf0, + 0x00, 0x3f, 0x51, 0xd6, 0xdf, 0x05, 0x80, 0x17, 0x5d, 0xc7, 0x43, 0x01, 0xf1, 0xd5, 0x44, 0x78, + 0x79, 0xda, 0x9a, 0xa6, 0x32, 0xd3, 0x5e, 0xe5, 0xc4, 0x2e, 0x5f, 0xdf, 0x29, 0x7d, 0xfe, 0x85, + 0x91, 0xfb, 0xe7, 0x17, 0x86, 0xf6, 0xfe, 0x31, 0xd0, 0x5f, 0xf5, 0x24, 0x81, 0x37, 0x40, 0xc5, + 0xfa, 0xf0, 0x70, 0xe7, 0xe3, 0x8e, 0xfd, 0xe9, 0xde, 0xde, 0xbd, 0xbd, 0x1f, 0x6f, 0xe4, 0xea, + 0x1b, 0xa7, 0x67, 0xcd, 0x35, 0xc1, 0x54, 0x3c, 0xf8, 0x2e, 0x58, 0x97, 0x4a, 0x3b, 0x0f, 0x1f, + 0xec, 0xdf, 0xff, 0xe8, 0xf0, 0xa3, 0xdd, 0x0d, 0xad, 0x0e, 0x4f, 0xcf, 0x9a, 0x55, 0xc1, 0x9e, + 0x70, 0xeb, 0x6b, 0xbf, 0xf9, 0x5d, 0x23, 0xf7, 0xfb, 0x2f, 0x1b, 0xb9, 0x3f, 0x7d, 0xd9, 0xd0, + 0xde, 0xa7, 0xe0, 0xd2, 0x82, 0xc7, 0x0a, 0x7f, 0x9a, 0x4f, 0x9d, 0x95, 0x4f, 0xcf, 0x9a, 0x09, + 0xc9, 0xfb, 0xd1, 0xfe, 0x87, 0x9f, 0x1e, 0x08, 0x78, 0x70, 0x7a, 0xd6, 0x54, 0x14, 0xbc, 0x06, + 0x56, 0xa7, 0x9e, 0xf3, 0xf5, 0xca, 0xe9, 0x59, 0x73, 0xf5, 0x15, 0x4e, 0xad, 0x87, 0xcf, 0xfe, + 0xd1, 0xc8, 0x3d, 0x7b, 0xd1, 0xd0, 0xbe, 0x7a, 0xd1, 0xd0, 0xfe, 0xfe, 0xa2, 0xa1, 0x3d, 0x7d, + 0xd9, 0xc8, 0x7d, 0xf5, 0xb2, 0x91, 0xfb, 0xcb, 0xcb, 0x46, 0xee, 0x67, 0xb7, 0xce, 0x2f, 0x68, + 0xf9, 0x27, 0x02, 0x4d, 0xfe, 0xe1, 0xec, 0x16, 0x45, 0x3d, 0x7c, 0xf0, 0xdf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xde, 0x8c, 0x32, 0x8f, 0xfb, 0x14, 0x00, 0x00, +} + +func (x RequestContextBatchState) String() string { + s, ok := RequestContextBatchState_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x RequestContextState) String() string { + s, ok := RequestContextState_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +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 + } + if this.MaxRequestTimeout != that1.MaxRequestTimeout { + return false + } + if this.MinDepositMultiple != that1.MinDepositMultiple { + return false + } + if len(this.MinDeposit) != len(that1.MinDeposit) { + return false + } + for i := range this.MinDeposit { + if !this.MinDeposit[i].Equal(&that1.MinDeposit[i]) { + return false + } + } + if !this.ServiceFeeTax.Equal(that1.ServiceFeeTax) { + return false + } + if !this.SlashFraction.Equal(that1.SlashFraction) { + return false + } + if this.ComplaintRetrospect != that1.ComplaintRetrospect { + return false + } + if this.ArbitrationTimeLimit != that1.ArbitrationTimeLimit { + return false + } + if this.TxSizeLimit != that1.TxSizeLimit { + return false + } + if this.BaseDenom != that1.BaseDenom { + return false + } + return true +} +func (m *ServiceDefinition) 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 *ServiceDefinition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ServiceDefinition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Schemas) > 0 { + i -= len(m.Schemas) + copy(dAtA[i:], m.Schemas) + i = encodeVarintService(dAtA, i, uint64(len(m.Schemas))) + i-- + dAtA[i] = 0x32 + } + if len(m.AuthorDescription) > 0 { + i -= len(m.AuthorDescription) + copy(dAtA[i:], m.AuthorDescription) + i = encodeVarintService(dAtA, i, uint64(len(m.AuthorDescription))) + i-- + dAtA[i] = 0x2a + } + if len(m.Author) > 0 { + i -= len(m.Author) + copy(dAtA[i:], m.Author) + i = encodeVarintService(dAtA, i, uint64(len(m.Author))) + i-- + dAtA[i] = 0x22 + } + if len(m.Tags) > 0 { + for iNdEx := len(m.Tags) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Tags[iNdEx]) + copy(dAtA[i:], m.Tags[iNdEx]) + i = encodeVarintService(dAtA, i, uint64(len(m.Tags[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintService(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintService(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ServiceBinding) 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 *ServiceBinding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintService(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x4a + } + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DisabledTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DisabledTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintService(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x42 + if m.Available { + i-- + if m.Available { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if len(m.Options) > 0 { + i -= len(m.Options) + copy(dAtA[i:], m.Options) + i = encodeVarintService(dAtA, i, uint64(len(m.Options))) + i-- + dAtA[i] = 0x32 + } + if m.QoS != 0 { + i = encodeVarintService(dAtA, i, uint64(m.QoS)) + i-- + dAtA[i] = 0x28 + } + if len(m.Pricing) > 0 { + i -= len(m.Pricing) + copy(dAtA[i:], m.Pricing) + i = encodeVarintService(dAtA, i, uint64(len(m.Pricing))) + i-- + dAtA[i] = 0x22 + } + if len(m.Deposit) > 0 { + for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintService(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RequestContext) 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 *RequestContext) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.State != 0 { + i = encodeVarintService(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } + if m.BatchState != 0 { + i = encodeVarintService(dAtA, i, uint64(m.BatchState)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x80 + } + if m.ResponseThreshold != 0 { + i = encodeVarintService(dAtA, i, uint64(m.ResponseThreshold)) + i-- + dAtA[i] = 0x78 + } + if m.BatchResponseThreshold != 0 { + i = encodeVarintService(dAtA, i, uint64(m.BatchResponseThreshold)) + i-- + dAtA[i] = 0x70 + } + if m.BatchResponseCount != 0 { + i = encodeVarintService(dAtA, i, uint64(m.BatchResponseCount)) + i-- + dAtA[i] = 0x68 + } + if m.BatchRequestCount != 0 { + i = encodeVarintService(dAtA, i, uint64(m.BatchRequestCount)) + i-- + dAtA[i] = 0x60 + } + if m.BatchCounter != 0 { + i = encodeVarintService(dAtA, i, uint64(m.BatchCounter)) + i-- + dAtA[i] = 0x58 + } + if m.RepeatedTotal != 0 { + i = encodeVarintService(dAtA, i, uint64(m.RepeatedTotal)) + i-- + dAtA[i] = 0x50 + } + if m.RepeatedFrequency != 0 { + i = encodeVarintService(dAtA, i, uint64(m.RepeatedFrequency)) + i-- + dAtA[i] = 0x48 + } + if m.Repeated { + i-- + if m.Repeated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.Timeout != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Timeout)) + i-- + dAtA[i] = 0x38 + } + if len(m.ModuleName) > 0 { + i -= len(m.ModuleName) + copy(dAtA[i:], m.ModuleName) + i = encodeVarintService(dAtA, i, uint64(len(m.ModuleName))) + i-- + dAtA[i] = 0x32 + } + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.Input) > 0 { + i -= len(m.Input) + copy(dAtA[i:], m.Input) + i = encodeVarintService(dAtA, i, uint64(len(m.Input))) + i-- + dAtA[i] = 0x22 + } + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintService(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x1a + } + if len(m.Providers) > 0 { + for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Providers[iNdEx]) + copy(dAtA[i:], m.Providers[iNdEx]) + i = encodeVarintService(dAtA, i, uint64(len(m.Providers[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintService(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Request) 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 *Request) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RequestContextBatchCounter != 0 { + i = encodeVarintService(dAtA, i, uint64(m.RequestContextBatchCounter)) + i-- + dAtA[i] = 0x50 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintService(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0x4a + } + if m.ExpirationHeight != 0 { + i = encodeVarintService(dAtA, i, uint64(m.ExpirationHeight)) + i-- + dAtA[i] = 0x40 + } + if m.RequestHeight != 0 { + i = encodeVarintService(dAtA, i, uint64(m.RequestHeight)) + i-- + dAtA[i] = 0x38 + } + if len(m.ServiceFee) > 0 { + for iNdEx := len(m.ServiceFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.Input) > 0 { + i -= len(m.Input) + copy(dAtA[i:], m.Input) + i = encodeVarintService(dAtA, i, uint64(len(m.Input))) + i-- + dAtA[i] = 0x2a + } + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintService(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x22 + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x1a + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintService(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintService(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CompactRequest) 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 *CompactRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CompactRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ExpirationHeight != 0 { + i = encodeVarintService(dAtA, i, uint64(m.ExpirationHeight)) + i-- + dAtA[i] = 0x30 + } + if m.RequestHeight != 0 { + i = encodeVarintService(dAtA, i, uint64(m.RequestHeight)) + i-- + dAtA[i] = 0x28 + } + if len(m.ServiceFee) > 0 { + for iNdEx := len(m.ServiceFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x1a + } + if m.RequestContextBatchCounter != 0 { + i = encodeVarintService(dAtA, i, uint64(m.RequestContextBatchCounter)) + i-- + dAtA[i] = 0x10 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintService(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Response) 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 *Response) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RequestContextBatchCounter != 0 { + i = encodeVarintService(dAtA, i, uint64(m.RequestContextBatchCounter)) + i-- + dAtA[i] = 0x30 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintService(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0x2a + } + if len(m.Output) > 0 { + i -= len(m.Output) + copy(dAtA[i:], m.Output) + i = encodeVarintService(dAtA, i, uint64(len(m.Output))) + i-- + dAtA[i] = 0x22 + } + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintService(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x1a + } + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintService(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x12 + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Pricing) 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 *Pricing) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pricing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Price) > 0 { + for iNdEx := len(m.Price) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Price[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.PromotionsByVolume) > 0 { + for iNdEx := len(m.PromotionsByVolume) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PromotionsByVolume[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.PromotionsByTime) > 0 { + for iNdEx := len(m.PromotionsByTime) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PromotionsByTime[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + return len(dAtA) - i, nil +} + +func (m *PromotionByTime) 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 *PromotionByTime) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PromotionByTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Discount.Size() + i -= size + if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintService(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintService(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PromotionByVolume) 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 *PromotionByVolume) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PromotionByVolume) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Discount.Size() + i -= size + if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Volume != 0 { + i = encodeVarintService(dAtA, i, uint64(m.Volume)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BaseDenom) > 0 { + i -= len(m.BaseDenom) + copy(dAtA[i:], m.BaseDenom) + i = encodeVarintService(dAtA, i, uint64(len(m.BaseDenom))) + i-- + dAtA[i] = 0x4a + } + if m.TxSizeLimit != 0 { + i = encodeVarintService(dAtA, i, uint64(m.TxSizeLimit)) + i-- + dAtA[i] = 0x40 + } + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.ArbitrationTimeLimit, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.ArbitrationTimeLimit):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintService(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x3a + n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.ComplaintRetrospect, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.ComplaintRetrospect):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintService(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x32 + { + size := m.SlashFraction.Size() + i -= size + if _, err := m.SlashFraction.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.ServiceFeeTax.Size() + i -= size + if _, err := m.ServiceFeeTax.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.MinDepositMultiple != 0 { + i = encodeVarintService(dAtA, i, uint64(m.MinDepositMultiple)) + i-- + dAtA[i] = 0x10 + } + if m.MaxRequestTimeout != 0 { + i = encodeVarintService(dAtA, i, uint64(m.MaxRequestTimeout)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ServiceDefinition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if len(m.Tags) > 0 { + for _, s := range m.Tags { + l = len(s) + n += 1 + l + sovService(uint64(l)) + } + } + l = len(m.Author) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.AuthorDescription) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Schemas) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *ServiceBinding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if len(m.Deposit) > 0 { + for _, e := range m.Deposit { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + l = len(m.Pricing) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.QoS != 0 { + n += 1 + sovService(uint64(m.QoS)) + } + l = len(m.Options) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.Available { + n += 2 + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.DisabledTime) + n += 1 + l + sovService(uint64(l)) + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *RequestContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if len(m.Providers) > 0 { + for _, s := range m.Providers { + l = len(s) + n += 1 + l + sovService(uint64(l)) + } + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Input) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + l = len(m.ModuleName) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.Timeout != 0 { + n += 1 + sovService(uint64(m.Timeout)) + } + if m.Repeated { + n += 2 + } + if m.RepeatedFrequency != 0 { + n += 1 + sovService(uint64(m.RepeatedFrequency)) + } + if m.RepeatedTotal != 0 { + n += 1 + sovService(uint64(m.RepeatedTotal)) + } + if m.BatchCounter != 0 { + n += 1 + sovService(uint64(m.BatchCounter)) + } + if m.BatchRequestCount != 0 { + n += 1 + sovService(uint64(m.BatchRequestCount)) + } + if m.BatchResponseCount != 0 { + n += 1 + sovService(uint64(m.BatchResponseCount)) + } + if m.BatchResponseThreshold != 0 { + n += 1 + sovService(uint64(m.BatchResponseThreshold)) + } + if m.ResponseThreshold != 0 { + n += 1 + sovService(uint64(m.ResponseThreshold)) + } + if m.BatchState != 0 { + n += 2 + sovService(uint64(m.BatchState)) + } + if m.State != 0 { + n += 2 + sovService(uint64(m.State)) + } + return n +} + +func (m *Request) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Input) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if len(m.ServiceFee) > 0 { + for _, e := range m.ServiceFee { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.RequestHeight != 0 { + n += 1 + sovService(uint64(m.RequestHeight)) + } + if m.ExpirationHeight != 0 { + n += 1 + sovService(uint64(m.ExpirationHeight)) + } + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.RequestContextBatchCounter != 0 { + n += 1 + sovService(uint64(m.RequestContextBatchCounter)) + } + return n +} + +func (m *CompactRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.RequestContextBatchCounter != 0 { + n += 1 + sovService(uint64(m.RequestContextBatchCounter)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if len(m.ServiceFee) > 0 { + for _, e := range m.ServiceFee { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if m.RequestHeight != 0 { + n += 1 + sovService(uint64(m.RequestHeight)) + } + if m.ExpirationHeight != 0 { + n += 1 + sovService(uint64(m.ExpirationHeight)) + } + return n +} + +func (m *Response) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.Output) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + if m.RequestContextBatchCounter != 0 { + n += 1 + sovService(uint64(m.RequestContextBatchCounter)) + } + return n +} + +func (m *Pricing) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PromotionsByTime) > 0 { + for _, e := range m.PromotionsByTime { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if len(m.PromotionsByVolume) > 0 { + for _, e := range m.PromotionsByVolume { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + if len(m.Price) > 0 { + for _, e := range m.Price { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + return n +} + +func (m *PromotionByTime) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime) + n += 1 + l + sovService(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime) + n += 1 + l + sovService(uint64(l)) + l = m.Discount.Size() + n += 1 + l + sovService(uint64(l)) + return n +} + +func (m *PromotionByVolume) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Volume != 0 { + n += 1 + sovService(uint64(m.Volume)) + } + l = m.Discount.Size() + n += 1 + l + sovService(uint64(l)) + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MaxRequestTimeout != 0 { + n += 1 + sovService(uint64(m.MaxRequestTimeout)) + } + if m.MinDepositMultiple != 0 { + n += 1 + sovService(uint64(m.MinDepositMultiple)) + } + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovService(uint64(l)) + } + } + l = m.ServiceFeeTax.Size() + n += 1 + l + sovService(uint64(l)) + l = m.SlashFraction.Size() + n += 1 + l + sovService(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.ComplaintRetrospect) + n += 1 + l + sovService(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.ArbitrationTimeLimit) + n += 1 + l + sovService(uint64(l)) + if m.TxSizeLimit != 0 { + n += 1 + sovService(uint64(m.TxSizeLimit)) + } + l = len(m.BaseDenom) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ServiceDefinition) 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 ErrIntOverflowService + } + 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: ServiceDefinition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServiceDefinition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tags = append(m.Tags, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Author = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorDescription", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AuthorDescription = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schemas", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Schemas = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ServiceBinding) 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 ErrIntOverflowService + } + 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: ServiceBinding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deposit = append(m.Deposit, types.Coin{}) + if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pricing", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pricing = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QoS", wireType) + } + m.QoS = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QoS |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Available", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Available = bool(v != 0) + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisabledTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DisabledTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + 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 ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RequestContext) 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 ErrIntOverflowService + } + 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: RequestContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RequestContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Providers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Consumer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Input = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ModuleName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + m.Timeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Repeated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Repeated = bool(v != 0) + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) + } + m.RepeatedFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedFrequency |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedTotal", wireType) + } + m.RepeatedTotal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedTotal |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchCounter", wireType) + } + m.BatchCounter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchCounter |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchRequestCount", wireType) + } + m.BatchRequestCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchRequestCount |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchResponseCount", wireType) + } + m.BatchResponseCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchResponseCount |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchResponseThreshold", wireType) + } + m.BatchResponseThreshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchResponseThreshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) + } + m.ResponseThreshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ResponseThreshold |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 16: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchState", wireType) + } + m.BatchState = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchState |= RequestContextBatchState(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 17: + 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 ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= RequestContextState(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Request) 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 ErrIntOverflowService + } + 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: Request: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Request: 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 ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + 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 ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Consumer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Input = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFee = append(m.ServiceFee, types.Coin{}) + if err := m.ServiceFee[len(m.ServiceFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeight", wireType) + } + m.RequestHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationHeight", wireType) + } + m.ExpirationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextBatchCounter", wireType) + } + m.RequestContextBatchCounter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestContextBatchCounter |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CompactRequest) 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 ErrIntOverflowService + } + 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: CompactRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CompactRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextBatchCounter", wireType) + } + m.RequestContextBatchCounter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestContextBatchCounter |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFee = append(m.ServiceFee, types.Coin{}) + if err := m.ServiceFee[len(m.ServiceFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestHeight", wireType) + } + m.RequestHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpirationHeight", wireType) + } + m.ExpirationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpirationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Response) 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 ErrIntOverflowService + } + 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: Response: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Response: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Consumer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Result = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Output = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextBatchCounter", wireType) + } + m.RequestContextBatchCounter = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RequestContextBatchCounter |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Pricing) 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 ErrIntOverflowService + } + 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: Pricing: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pricing: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PromotionsByTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PromotionsByTime = append(m.PromotionsByTime, PromotionByTime{}) + if err := m.PromotionsByTime[len(m.PromotionsByTime)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PromotionsByVolume", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PromotionsByVolume = append(m.PromotionsByVolume, PromotionByVolume{}) + if err := m.PromotionsByVolume[len(m.PromotionsByVolume)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Price = append(m.Price, types.Coin{}) + if err := m.Price[len(m.Price)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PromotionByTime) 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 ErrIntOverflowService + } + 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: PromotionByTime: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PromotionByTime: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PromotionByVolume) 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 ErrIntOverflowService + } + 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: PromotionByVolume: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PromotionByVolume: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Volume", wireType) + } + m.Volume = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Volume |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxRequestTimeout", wireType) + } + m.MaxRequestTimeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxRequestTimeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositMultiple", wireType) + } + m.MinDepositMultiple = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinDepositMultiple |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeTax", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ServiceFeeTax.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashFraction", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SlashFraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ComplaintRetrospect", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.ComplaintRetrospect, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ArbitrationTimeLimit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.ArbitrationTimeLimit, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TxSizeLimit", wireType) + } + m.TxSizeLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TxSizeLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + 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 ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BaseDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(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, ErrIntOverflowService + } + 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, ErrIntOverflowService + } + 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, ErrIntOverflowService + } + 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, ErrInvalidLengthService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/service/tx.pb.go b/module-sdk/service/tx.pb.go new file mode 100644 index 00000000..d093a186 --- /dev/null +++ b/module-sdk/service/tx.pb.go @@ -0,0 +1,4609 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: service/tx.proto + +package service + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgDefineService defines an SDK message for defining a new service. +type MsgDefineService struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Tags []string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty"` + Author string `protobuf:"bytes,4,opt,name=author,proto3" json:"author,omitempty"` + AuthorDescription string `protobuf:"bytes,5,opt,name=author_description,json=authorDescription,proto3" json:"author_description,omitempty" yaml:"author_description"` + Schemas string `protobuf:"bytes,6,opt,name=schemas,proto3" json:"schemas,omitempty"` +} + +func (m *MsgDefineService) Reset() { *m = MsgDefineService{} } +func (m *MsgDefineService) String() string { return proto.CompactTextString(m) } +func (*MsgDefineService) ProtoMessage() {} +func (*MsgDefineService) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{0} +} +func (m *MsgDefineService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDefineService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDefineService.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 *MsgDefineService) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDefineService.Merge(m, src) +} +func (m *MsgDefineService) XXX_Size() int { + return m.Size() +} +func (m *MsgDefineService) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDefineService.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDefineService proto.InternalMessageInfo + +// MsgBindService defines an SDK message for binding to an existing service. +type MsgBindService struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` + Pricing string `protobuf:"bytes,4,opt,name=pricing,proto3" json:"pricing,omitempty"` + QoS uint64 `protobuf:"varint,5,opt,name=qos,proto3" json:"qos,omitempty"` + Options string `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` + Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgBindService) Reset() { *m = MsgBindService{} } +func (m *MsgBindService) String() string { return proto.CompactTextString(m) } +func (*MsgBindService) ProtoMessage() {} +func (*MsgBindService) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{1} +} +func (m *MsgBindService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBindService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBindService.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 *MsgBindService) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBindService.Merge(m, src) +} +func (m *MsgBindService) XXX_Size() int { + return m.Size() +} +func (m *MsgBindService) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBindService.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBindService proto.InternalMessageInfo + +// MsgUpdateServiceBinding defines an SDK message for updating an existing service binding. +type MsgUpdateServiceBinding struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` + Pricing string `protobuf:"bytes,4,opt,name=pricing,proto3" json:"pricing,omitempty"` + QoS uint64 `protobuf:"varint,5,opt,name=qos,proto3" json:"qos,omitempty"` + Options string `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` + Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgUpdateServiceBinding) Reset() { *m = MsgUpdateServiceBinding{} } +func (m *MsgUpdateServiceBinding) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateServiceBinding) ProtoMessage() {} +func (*MsgUpdateServiceBinding) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{2} +} +func (m *MsgUpdateServiceBinding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateServiceBinding.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 *MsgUpdateServiceBinding) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateServiceBinding.Merge(m, src) +} +func (m *MsgUpdateServiceBinding) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateServiceBinding) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateServiceBinding.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateServiceBinding proto.InternalMessageInfo + +// MsgSetWithdrawAddress defines an SDK message to set the withdrawal address for a provider. +type MsgSetWithdrawAddress struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + WithdrawAddress string `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty" yaml:"withdraw_address"` +} + +func (m *MsgSetWithdrawAddress) Reset() { *m = MsgSetWithdrawAddress{} } +func (m *MsgSetWithdrawAddress) String() string { return proto.CompactTextString(m) } +func (*MsgSetWithdrawAddress) ProtoMessage() {} +func (*MsgSetWithdrawAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{3} +} +func (m *MsgSetWithdrawAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetWithdrawAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetWithdrawAddress.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 *MsgSetWithdrawAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetWithdrawAddress.Merge(m, src) +} +func (m *MsgSetWithdrawAddress) XXX_Size() int { + return m.Size() +} +func (m *MsgSetWithdrawAddress) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetWithdrawAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetWithdrawAddress proto.InternalMessageInfo + +// MsgDisableServiceBinding defines an SDK message to disable a service binding. +type MsgDisableServiceBinding struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgDisableServiceBinding) Reset() { *m = MsgDisableServiceBinding{} } +func (m *MsgDisableServiceBinding) String() string { return proto.CompactTextString(m) } +func (*MsgDisableServiceBinding) ProtoMessage() {} +func (*MsgDisableServiceBinding) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{4} +} +func (m *MsgDisableServiceBinding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableServiceBinding.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 *MsgDisableServiceBinding) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableServiceBinding.Merge(m, src) +} +func (m *MsgDisableServiceBinding) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableServiceBinding) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableServiceBinding.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDisableServiceBinding proto.InternalMessageInfo + +// MsgEnableServiceBinding defines an SDK message to enable a service binding. +type MsgEnableServiceBinding struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgEnableServiceBinding) Reset() { *m = MsgEnableServiceBinding{} } +func (m *MsgEnableServiceBinding) String() string { return proto.CompactTextString(m) } +func (*MsgEnableServiceBinding) ProtoMessage() {} +func (*MsgEnableServiceBinding) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{5} +} +func (m *MsgEnableServiceBinding) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableServiceBinding.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 *MsgEnableServiceBinding) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableServiceBinding.Merge(m, src) +} +func (m *MsgEnableServiceBinding) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableServiceBinding) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableServiceBinding.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnableServiceBinding proto.InternalMessageInfo + +// MsgRefundServiceDeposit defines an SDK message to refund deposit from a service binding. +type MsgRefundServiceDeposit struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgRefundServiceDeposit) Reset() { *m = MsgRefundServiceDeposit{} } +func (m *MsgRefundServiceDeposit) String() string { return proto.CompactTextString(m) } +func (*MsgRefundServiceDeposit) ProtoMessage() {} +func (*MsgRefundServiceDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{6} +} +func (m *MsgRefundServiceDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRefundServiceDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRefundServiceDeposit.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 *MsgRefundServiceDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRefundServiceDeposit.Merge(m, src) +} +func (m *MsgRefundServiceDeposit) XXX_Size() int { + return m.Size() +} +func (m *MsgRefundServiceDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRefundServiceDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRefundServiceDeposit proto.InternalMessageInfo + +// MsgCallService defines an SDK message to initiate a service request context. +type MsgCallService struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` + Providers []string `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"` + Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` + Input string `protobuf:"bytes,4,opt,name=input,proto3" json:"input,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` + Timeout int64 `protobuf:"varint,6,opt,name=timeout,proto3" json:"timeout,omitempty"` + Repeated bool `protobuf:"varint,7,opt,name=repeated,proto3" json:"repeated,omitempty"` + RepeatedFrequency uint64 `protobuf:"varint,8,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` + RepeatedTotal int64 `protobuf:"varint,9,opt,name=repeated_total,json=repeatedTotal,proto3" json:"repeated_total,omitempty" yaml:"repeated_total"` +} + +func (m *MsgCallService) Reset() { *m = MsgCallService{} } +func (m *MsgCallService) String() string { return proto.CompactTextString(m) } +func (*MsgCallService) ProtoMessage() {} +func (*MsgCallService) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{7} +} +func (m *MsgCallService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCallService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCallService.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 *MsgCallService) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCallService.Merge(m, src) +} +func (m *MsgCallService) XXX_Size() int { + return m.Size() +} +func (m *MsgCallService) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCallService.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCallService proto.InternalMessageInfo + +// MsgCallServiceResponse defines the Msg/CallService response type. +type MsgCallServiceResponse struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` +} + +func (m *MsgCallServiceResponse) Reset() { *m = MsgCallServiceResponse{} } +func (m *MsgCallServiceResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCallServiceResponse) ProtoMessage() {} +func (*MsgCallServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{8} +} +func (m *MsgCallServiceResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCallServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCallServiceResponse.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 *MsgCallServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCallServiceResponse.Merge(m, src) +} +func (m *MsgCallServiceResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCallServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCallServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCallServiceResponse proto.InternalMessageInfo + +// MsgRespondService defines an SDK message to respond a service request. +type MsgRespondService struct { + RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty" yaml:"request_id"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` + Result string `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` + Output string `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` +} + +func (m *MsgRespondService) Reset() { *m = MsgRespondService{} } +func (m *MsgRespondService) String() string { return proto.CompactTextString(m) } +func (*MsgRespondService) ProtoMessage() {} +func (*MsgRespondService) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{9} +} +func (m *MsgRespondService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRespondService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRespondService.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 *MsgRespondService) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRespondService.Merge(m, src) +} +func (m *MsgRespondService) XXX_Size() int { + return m.Size() +} +func (m *MsgRespondService) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRespondService.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRespondService proto.InternalMessageInfo + +// MsgPauseRequestContext defines an SDK message to pause a service request. +type MsgPauseRequestContext struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` +} + +func (m *MsgPauseRequestContext) Reset() { *m = MsgPauseRequestContext{} } +func (m *MsgPauseRequestContext) String() string { return proto.CompactTextString(m) } +func (*MsgPauseRequestContext) ProtoMessage() {} +func (*MsgPauseRequestContext) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{10} +} +func (m *MsgPauseRequestContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPauseRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPauseRequestContext.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 *MsgPauseRequestContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPauseRequestContext.Merge(m, src) +} +func (m *MsgPauseRequestContext) XXX_Size() int { + return m.Size() +} +func (m *MsgPauseRequestContext) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPauseRequestContext.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPauseRequestContext proto.InternalMessageInfo + +// MsgStartRequestContext defines an SDK message to resume a service request. +type MsgStartRequestContext struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` +} + +func (m *MsgStartRequestContext) Reset() { *m = MsgStartRequestContext{} } +func (m *MsgStartRequestContext) String() string { return proto.CompactTextString(m) } +func (*MsgStartRequestContext) ProtoMessage() {} +func (*MsgStartRequestContext) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{11} +} +func (m *MsgStartRequestContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStartRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStartRequestContext.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 *MsgStartRequestContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStartRequestContext.Merge(m, src) +} +func (m *MsgStartRequestContext) XXX_Size() int { + return m.Size() +} +func (m *MsgStartRequestContext) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStartRequestContext.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStartRequestContext proto.InternalMessageInfo + +// MsgKillRequestContext defines an SDK message to terminate a service request. +type MsgKillRequestContext struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` +} + +func (m *MsgKillRequestContext) Reset() { *m = MsgKillRequestContext{} } +func (m *MsgKillRequestContext) String() string { return proto.CompactTextString(m) } +func (*MsgKillRequestContext) ProtoMessage() {} +func (*MsgKillRequestContext) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{12} +} +func (m *MsgKillRequestContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgKillRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgKillRequestContext.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 *MsgKillRequestContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgKillRequestContext.Merge(m, src) +} +func (m *MsgKillRequestContext) XXX_Size() int { + return m.Size() +} +func (m *MsgKillRequestContext) XXX_DiscardUnknown() { + xxx_messageInfo_MsgKillRequestContext.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgKillRequestContext proto.InternalMessageInfo + +// MsgUpdateRequestContext defines an SDK message to update a service request context. +type MsgUpdateRequestContext struct { + RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` + Providers []string `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"` + Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` + ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,4,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` + Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"` + RepeatedFrequency uint64 `protobuf:"varint,6,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` + RepeatedTotal int64 `protobuf:"varint,7,opt,name=repeated_total,json=repeatedTotal,proto3" json:"repeated_total,omitempty" yaml:"repeated_total"` +} + +func (m *MsgUpdateRequestContext) Reset() { *m = MsgUpdateRequestContext{} } +func (m *MsgUpdateRequestContext) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateRequestContext) ProtoMessage() {} +func (*MsgUpdateRequestContext) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{13} +} +func (m *MsgUpdateRequestContext) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateRequestContext.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 *MsgUpdateRequestContext) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateRequestContext.Merge(m, src) +} +func (m *MsgUpdateRequestContext) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateRequestContext) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateRequestContext.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateRequestContext proto.InternalMessageInfo + +// MsgWithdrawEarnedFees defines an SDK message to withdraw the fees earned by the provider or owner. +type MsgWithdrawEarnedFees struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` +} + +func (m *MsgWithdrawEarnedFees) Reset() { *m = MsgWithdrawEarnedFees{} } +func (m *MsgWithdrawEarnedFees) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawEarnedFees) ProtoMessage() {} +func (*MsgWithdrawEarnedFees) Descriptor() ([]byte, []int) { + return fileDescriptor_0564fcd82d845f97, []int{14} +} +func (m *MsgWithdrawEarnedFees) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawEarnedFees) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawEarnedFees.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 *MsgWithdrawEarnedFees) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawEarnedFees.Merge(m, src) +} +func (m *MsgWithdrawEarnedFees) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawEarnedFees) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawEarnedFees.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawEarnedFees proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgDefineService)(nil), "irismod.service.MsgDefineService") + proto.RegisterType((*MsgBindService)(nil), "irismod.service.MsgBindService") + proto.RegisterType((*MsgUpdateServiceBinding)(nil), "irismod.service.MsgUpdateServiceBinding") + proto.RegisterType((*MsgSetWithdrawAddress)(nil), "irismod.service.MsgSetWithdrawAddress") + proto.RegisterType((*MsgDisableServiceBinding)(nil), "irismod.service.MsgDisableServiceBinding") + proto.RegisterType((*MsgEnableServiceBinding)(nil), "irismod.service.MsgEnableServiceBinding") + proto.RegisterType((*MsgRefundServiceDeposit)(nil), "irismod.service.MsgRefundServiceDeposit") + proto.RegisterType((*MsgCallService)(nil), "irismod.service.MsgCallService") + proto.RegisterType((*MsgCallServiceResponse)(nil), "irismod.service.MsgCallServiceResponse") + proto.RegisterType((*MsgRespondService)(nil), "irismod.service.MsgRespondService") + proto.RegisterType((*MsgPauseRequestContext)(nil), "irismod.service.MsgPauseRequestContext") + proto.RegisterType((*MsgStartRequestContext)(nil), "irismod.service.MsgStartRequestContext") + proto.RegisterType((*MsgKillRequestContext)(nil), "irismod.service.MsgKillRequestContext") + proto.RegisterType((*MsgUpdateRequestContext)(nil), "irismod.service.MsgUpdateRequestContext") + proto.RegisterType((*MsgWithdrawEarnedFees)(nil), "irismod.service.MsgWithdrawEarnedFees") +} + +func init() { proto.RegisterFile("service/tx.proto", fileDescriptor_0564fcd82d845f97) } + +var fileDescriptor_0564fcd82d845f97 = []byte{ + // 944 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x4f, 0x53, 0xe4, 0x44, + 0x14, 0x9f, 0x30, 0xc3, 0x0c, 0x34, 0xee, 0x02, 0x71, 0x81, 0x80, 0x3a, 0xa1, 0x72, 0xf2, 0xc2, + 0x4c, 0xe1, 0x9f, 0xcb, 0x9e, 0x74, 0x60, 0xa9, 0xa2, 0x56, 0x5c, 0x0d, 0x5a, 0x56, 0x79, 0x99, + 0xea, 0x49, 0x1e, 0x99, 0xd6, 0x24, 0x1d, 0xd2, 0x1d, 0x58, 0x6e, 0x7a, 0xd2, 0xa3, 0x65, 0x95, + 0x5f, 0xc2, 0x6f, 0xe0, 0xd5, 0x13, 0xc7, 0x3d, 0x7a, 0xb0, 0xb2, 0x0a, 0xdf, 0x60, 0x3c, 0x78, + 0xb5, 0xba, 0xd3, 0x1d, 0x12, 0x76, 0xdd, 0x75, 0x2d, 0x04, 0x0f, 0x7b, 0x9a, 0xfe, 0xbd, 0x7e, + 0xef, 0xf5, 0x7b, 0xbf, 0xf7, 0xfa, 0x75, 0x06, 0x2d, 0x30, 0x48, 0x8f, 0x88, 0x07, 0x7d, 0xfe, + 0xb0, 0x97, 0xa4, 0x94, 0x53, 0x73, 0x9e, 0xa4, 0x84, 0x45, 0xd4, 0xef, 0xa9, 0x9d, 0xb5, 0xae, + 0x47, 0x59, 0x44, 0x59, 0x7f, 0x84, 0x19, 0xf4, 0x8f, 0x36, 0x47, 0xc0, 0xf1, 0x66, 0xdf, 0xa3, + 0x24, 0x2e, 0x0c, 0xd6, 0xee, 0x04, 0x34, 0xa0, 0x72, 0xd9, 0x17, 0xab, 0x42, 0xea, 0xfc, 0x6a, + 0xa0, 0x85, 0x3d, 0x16, 0x6c, 0xc3, 0x01, 0x89, 0x61, 0xbf, 0x70, 0x65, 0x9a, 0xa8, 0x15, 0xe3, + 0x08, 0x2c, 0x63, 0xdd, 0x78, 0x73, 0xd6, 0x95, 0x6b, 0x73, 0x1d, 0xcd, 0xf9, 0xc0, 0xbc, 0x94, + 0x24, 0x9c, 0xd0, 0xd8, 0x9a, 0x92, 0x5b, 0x55, 0x91, 0xb0, 0xe2, 0x38, 0x60, 0x56, 0x73, 0xbd, + 0x29, 0xac, 0xc4, 0xda, 0x5c, 0x46, 0x6d, 0x9c, 0xf1, 0x31, 0x4d, 0xad, 0x96, 0x34, 0x50, 0xc8, + 0xfc, 0x00, 0x99, 0xc5, 0x6a, 0x58, 0x75, 0x3a, 0x2d, 0x74, 0x06, 0x6f, 0x4c, 0x72, 0x7b, 0xf5, + 0x04, 0x47, 0xe1, 0x5d, 0xe7, 0x49, 0x1d, 0xc7, 0x5d, 0x2c, 0x84, 0xdb, 0x95, 0x93, 0x2d, 0xd4, + 0x61, 0xde, 0x18, 0x22, 0xcc, 0xac, 0xb6, 0x3c, 0x46, 0x43, 0xe7, 0xa7, 0x29, 0x74, 0x7b, 0x8f, + 0x05, 0x03, 0x12, 0xfb, 0x3a, 0xb9, 0xbb, 0xe8, 0x15, 0x45, 0xd9, 0xf0, 0x22, 0xc9, 0xc1, 0xca, + 0x24, 0xb7, 0x5f, 0x2d, 0x0e, 0xad, 0xee, 0x3a, 0xee, 0x9c, 0x82, 0x1f, 0x0a, 0x12, 0xd6, 0xd0, + 0x4c, 0x92, 0xd2, 0x23, 0xe2, 0x43, 0xaa, 0x18, 0x28, 0xb1, 0xf9, 0x05, 0xea, 0xf8, 0x90, 0x50, + 0x46, 0xb8, 0x64, 0x60, 0xee, 0xad, 0xd5, 0x5e, 0x51, 0x91, 0x9e, 0xa8, 0x48, 0x4f, 0x55, 0xa4, + 0xb7, 0x45, 0x49, 0x3c, 0x78, 0xf7, 0x34, 0xb7, 0x1b, 0x3f, 0x3e, 0xb6, 0x37, 0x02, 0xc2, 0xc7, + 0xd9, 0xa8, 0xe7, 0xd1, 0xa8, 0x2f, 0xea, 0x19, 0x03, 0x97, 0xbf, 0xe3, 0x6c, 0xb4, 0xc1, 0xfc, + 0x2f, 0x37, 0x02, 0xda, 0xe7, 0x27, 0x09, 0x30, 0x69, 0xc5, 0x5c, 0x7d, 0x80, 0x48, 0x38, 0x49, + 0x89, 0x47, 0xe2, 0x40, 0xf1, 0xaa, 0xa1, 0xb9, 0x8a, 0x9a, 0x87, 0x94, 0x49, 0x26, 0x5b, 0x83, + 0xce, 0x59, 0x6e, 0x37, 0x3f, 0xa6, 0xfb, 0xae, 0x90, 0x09, 0x23, 0x2a, 0xf9, 0x2a, 0x59, 0x52, + 0xd0, 0xbc, 0x83, 0xa6, 0xe9, 0x71, 0x0c, 0xa9, 0xd5, 0x91, 0xf2, 0x02, 0x38, 0x3f, 0x4f, 0xa1, + 0x95, 0x3d, 0x16, 0x7c, 0x9a, 0xf8, 0x98, 0xeb, 0xd6, 0x10, 0x44, 0x8a, 0x63, 0x5e, 0x92, 0xf8, + 0x0f, 0x49, 0xcc, 0xd0, 0xd2, 0x1e, 0x0b, 0xf6, 0x81, 0x7f, 0x46, 0xf8, 0xd8, 0x4f, 0xf1, 0xf1, + 0xfb, 0xbe, 0x9f, 0x02, 0xab, 0xa8, 0x1b, 0x15, 0x75, 0x73, 0x07, 0x2d, 0x1c, 0x2b, 0xc5, 0x21, + 0x2e, 0x34, 0x0b, 0x8e, 0x06, 0xaf, 0x4d, 0x72, 0x7b, 0xa5, 0xe0, 0xf6, 0xb2, 0x86, 0xe3, 0xce, + 0x1f, 0xd7, 0xbd, 0x3b, 0xdf, 0x1a, 0xc8, 0x12, 0xd7, 0x9a, 0x30, 0x3c, 0x0a, 0xaf, 0xab, 0x78, + 0x65, 0x4a, 0xcd, 0x2a, 0x03, 0x7f, 0x18, 0xb2, 0x8d, 0xee, 0xc5, 0xd7, 0x18, 0xc9, 0x75, 0xb6, + 0x51, 0x99, 0x75, 0xab, 0x9a, 0xf5, 0x37, 0x45, 0xd6, 0x2e, 0x1c, 0x64, 0xe5, 0xe8, 0xd9, 0x56, + 0x16, 0xd7, 0xcb, 0xff, 0x9f, 0x4d, 0x39, 0x02, 0xb7, 0x70, 0x18, 0x5e, 0xc5, 0x08, 0x7c, 0x1d, + 0xcd, 0xea, 0x03, 0x45, 0x6b, 0x8a, 0x51, 0x7f, 0x21, 0x10, 0xe1, 0x79, 0x34, 0x66, 0x59, 0x54, + 0x46, 0x51, 0x62, 0x11, 0x1e, 0x89, 0x93, 0x8c, 0x6b, 0xa2, 0x24, 0x30, 0xbf, 0x37, 0xd0, 0xbc, + 0x3e, 0xee, 0x00, 0x60, 0xe8, 0xe1, 0xc4, 0x9a, 0x7e, 0x5e, 0xcd, 0x1e, 0x88, 0x9a, 0x4d, 0x72, + 0x7b, 0xb9, 0x1e, 0xae, 0xb2, 0x77, 0x5e, 0xbc, 0x9a, 0xb7, 0x94, 0x8b, 0x1d, 0x80, 0x2d, 0x9c, + 0x88, 0x5b, 0xce, 0x49, 0x04, 0x34, 0xe3, 0xf2, 0x96, 0x37, 0x5d, 0x0d, 0x45, 0x82, 0x29, 0x24, + 0x80, 0x39, 0xf8, 0xf2, 0xa2, 0xcf, 0xb8, 0x25, 0x16, 0x8f, 0x9a, 0x5e, 0x0f, 0x0f, 0x52, 0x38, + 0xcc, 0x20, 0xf6, 0x4e, 0xac, 0x19, 0x39, 0x45, 0x2a, 0x8f, 0xda, 0x93, 0x3a, 0x8e, 0xbb, 0xa8, + 0x85, 0x3b, 0x5a, 0x66, 0xbe, 0x87, 0x6e, 0x97, 0x9a, 0x9c, 0x72, 0x1c, 0x5a, 0xb3, 0x22, 0x94, + 0xc1, 0xea, 0x24, 0xb7, 0x97, 0x2e, 0x79, 0x92, 0xfb, 0x8e, 0x7b, 0x4b, 0x0b, 0x3e, 0x91, 0x18, + 0xd0, 0x72, 0xbd, 0xf0, 0x2e, 0xb0, 0x84, 0xc6, 0x0c, 0xcc, 0xfb, 0x22, 0xd2, 0xc3, 0x0c, 0x18, + 0x1f, 0x7a, 0x34, 0xe6, 0xf0, 0x90, 0x0f, 0x89, 0xaf, 0xda, 0xa0, 0x16, 0xe9, 0x65, 0x1d, 0xc7, + 0x5d, 0x50, 0xc2, 0xad, 0x42, 0xb6, 0xeb, 0x3b, 0x3f, 0x18, 0x68, 0x51, 0xb6, 0xba, 0x70, 0x5e, + 0x3e, 0xb3, 0xef, 0x20, 0xa4, 0xcd, 0x4b, 0xd7, 0x4b, 0x93, 0xdc, 0x5e, 0xac, 0xbb, 0x16, 0x2e, + 0x67, 0x15, 0xd8, 0xf5, 0x9f, 0xd9, 0xde, 0xcb, 0xa8, 0x9d, 0x02, 0xcb, 0x42, 0xae, 0x3a, 0x4b, + 0x21, 0x21, 0xa7, 0x19, 0xbf, 0x68, 0x2c, 0x85, 0x9c, 0xaf, 0x0d, 0x99, 0xff, 0x47, 0x38, 0x63, + 0xe0, 0xd6, 0x82, 0xbe, 0xd2, 0xfc, 0x6b, 0x3d, 0x3f, 0x55, 0xef, 0x79, 0x1d, 0xc3, 0x3e, 0xc7, + 0x29, 0xbf, 0xa9, 0x18, 0xbe, 0x32, 0xe4, 0x1b, 0x74, 0x9f, 0x84, 0xe1, 0x4d, 0x85, 0xf0, 0xb8, + 0x59, 0xf9, 0x94, 0xf8, 0x2f, 0x83, 0xf8, 0xf7, 0xd3, 0xe9, 0x69, 0x73, 0xa8, 0xf5, 0x3f, 0x9a, + 0x43, 0xd3, 0xf5, 0x39, 0xf4, 0xf4, 0x59, 0xd3, 0xbe, 0xb2, 0x59, 0xd3, 0x79, 0xc1, 0x59, 0xb3, + 0x2b, 0x7b, 0x4c, 0x7f, 0xe4, 0xdc, 0xc3, 0x69, 0x0c, 0xfe, 0x0e, 0xc0, 0xdf, 0x7d, 0xe7, 0x3c, + 0xe3, 0x9e, 0x0f, 0x1e, 0x9c, 0xfe, 0xde, 0x6d, 0x9c, 0x9e, 0x75, 0x8d, 0x47, 0x67, 0x5d, 0xe3, + 0xb7, 0xb3, 0xae, 0xf1, 0xdd, 0x79, 0xb7, 0xf1, 0xe8, 0xbc, 0xdb, 0xf8, 0xe5, 0xbc, 0xdb, 0xf8, + 0x7c, 0xf3, 0xf9, 0x84, 0x46, 0xd4, 0xcf, 0x42, 0x60, 0x7d, 0xc5, 0xe5, 0xa8, 0x2d, 0xff, 0xea, + 0xbc, 0xfd, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x08, 0x83, 0xbc, 0x45, 0x0d, 0x00, 0x00, +} + +func (m *MsgDefineService) 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 *MsgDefineService) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDefineService) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Schemas) > 0 { + i -= len(m.Schemas) + copy(dAtA[i:], m.Schemas) + i = encodeVarintTx(dAtA, i, uint64(len(m.Schemas))) + i-- + dAtA[i] = 0x32 + } + if len(m.AuthorDescription) > 0 { + i -= len(m.AuthorDescription) + copy(dAtA[i:], m.AuthorDescription) + i = encodeVarintTx(dAtA, i, uint64(len(m.AuthorDescription))) + i-- + dAtA[i] = 0x2a + } + if len(m.Author) > 0 { + i -= len(m.Author) + copy(dAtA[i:], m.Author) + i = encodeVarintTx(dAtA, i, uint64(len(m.Author))) + i-- + dAtA[i] = 0x22 + } + if len(m.Tags) > 0 { + for iNdEx := len(m.Tags) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Tags[iNdEx]) + copy(dAtA[i:], m.Tags[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Tags[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + 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] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBindService) 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 *MsgBindService) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBindService) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x3a + } + if len(m.Options) > 0 { + i -= len(m.Options) + copy(dAtA[i:], m.Options) + i = encodeVarintTx(dAtA, i, uint64(len(m.Options))) + i-- + dAtA[i] = 0x32 + } + if m.QoS != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.QoS)) + i-- + dAtA[i] = 0x28 + } + if len(m.Pricing) > 0 { + i -= len(m.Pricing) + copy(dAtA[i:], m.Pricing) + i = encodeVarintTx(dAtA, i, uint64(len(m.Pricing))) + i-- + dAtA[i] = 0x22 + } + if len(m.Deposit) > 0 { + for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateServiceBinding) 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 *MsgUpdateServiceBinding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x3a + } + if len(m.Options) > 0 { + i -= len(m.Options) + copy(dAtA[i:], m.Options) + i = encodeVarintTx(dAtA, i, uint64(len(m.Options))) + i-- + dAtA[i] = 0x32 + } + if m.QoS != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.QoS)) + i-- + dAtA[i] = 0x28 + } + if len(m.Pricing) > 0 { + i -= len(m.Pricing) + copy(dAtA[i:], m.Pricing) + i = encodeVarintTx(dAtA, i, uint64(len(m.Pricing))) + i-- + dAtA[i] = 0x22 + } + if len(m.Deposit) > 0 { + for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetWithdrawAddress) 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 *MsgSetWithdrawAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WithdrawAddress) > 0 { + i -= len(m.WithdrawAddress) + copy(dAtA[i:], m.WithdrawAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.WithdrawAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDisableServiceBinding) 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 *MsgDisableServiceBinding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x1a + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEnableServiceBinding) 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 *MsgEnableServiceBinding) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x22 + } + if len(m.Deposit) > 0 { + for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRefundServiceDeposit) 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 *MsgRefundServiceDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRefundServiceDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x1a + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCallService) 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 *MsgCallService) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCallService) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RepeatedTotal != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RepeatedTotal)) + i-- + dAtA[i] = 0x48 + } + if m.RepeatedFrequency != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) + i-- + dAtA[i] = 0x40 + } + if m.Repeated { + i-- + if m.Repeated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.Timeout != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) + i-- + dAtA[i] = 0x30 + } + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.Input) > 0 { + i -= len(m.Input) + copy(dAtA[i:], m.Input) + i = encodeVarintTx(dAtA, i, uint64(len(m.Input))) + i-- + dAtA[i] = 0x22 + } + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x1a + } + if len(m.Providers) > 0 { + for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Providers[iNdEx]) + copy(dAtA[i:], m.Providers[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCallServiceResponse) 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 *MsgCallServiceResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCallServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRespondService) 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 *MsgRespondService) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRespondService) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Output) > 0 { + i -= len(m.Output) + copy(dAtA[i:], m.Output) + i = encodeVarintTx(dAtA, i, uint64(len(m.Output))) + i-- + dAtA[i] = 0x22 + } + if len(m.Result) > 0 { + i -= len(m.Result) + copy(dAtA[i:], m.Result) + i = encodeVarintTx(dAtA, i, uint64(len(m.Result))) + i-- + dAtA[i] = 0x1a + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + 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 *MsgPauseRequestContext) 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 *MsgPauseRequestContext) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPauseRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x12 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgStartRequestContext) 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 *MsgStartRequestContext) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStartRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x12 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgKillRequestContext) 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 *MsgKillRequestContext) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgKillRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x12 + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateRequestContext) 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 *MsgUpdateRequestContext) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RepeatedTotal != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RepeatedTotal)) + i-- + dAtA[i] = 0x38 + } + if m.RepeatedFrequency != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) + i-- + dAtA[i] = 0x30 + } + if m.Timeout != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) + i-- + dAtA[i] = 0x28 + } + if len(m.ServiceFeeCap) > 0 { + for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Consumer) > 0 { + i -= len(m.Consumer) + copy(dAtA[i:], m.Consumer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) + i-- + dAtA[i] = 0x1a + } + if len(m.Providers) > 0 { + for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Providers[iNdEx]) + copy(dAtA[i:], m.Providers[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.RequestContextId) > 0 { + i -= len(m.RequestContextId) + copy(dAtA[i:], m.RequestContextId) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawEarnedFees) 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 *MsgWithdrawEarnedFees) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawEarnedFees) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + 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 *MsgDefineService) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Tags) > 0 { + for _, s := range m.Tags { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Author) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.AuthorDescription) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Schemas) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgBindService) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Deposit) > 0 { + for _, e := range m.Deposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Pricing) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.QoS != 0 { + n += 1 + sovTx(uint64(m.QoS)) + } + l = len(m.Options) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateServiceBinding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Deposit) > 0 { + for _, e := range m.Deposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Pricing) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.QoS != 0 { + n += 1 + sovTx(uint64(m.QoS)) + } + l = len(m.Options) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetWithdrawAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.WithdrawAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDisableServiceBinding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgEnableServiceBinding) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Deposit) > 0 { + for _, e := range m.Deposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRefundServiceDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCallService) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Providers) > 0 { + for _, s := range m.Providers { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Input) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Timeout != 0 { + n += 1 + sovTx(uint64(m.Timeout)) + } + if m.Repeated { + n += 2 + } + if m.RepeatedFrequency != 0 { + n += 1 + sovTx(uint64(m.RepeatedFrequency)) + } + if m.RepeatedTotal != 0 { + n += 1 + sovTx(uint64(m.RepeatedTotal)) + } + return n +} + +func (m *MsgCallServiceResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRespondService) 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)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Result) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Output) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgPauseRequestContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgStartRequestContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgKillRequestContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateRequestContext) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RequestContextId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Providers) > 0 { + for _, s := range m.Providers { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Consumer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.ServiceFeeCap) > 0 { + for _, e := range m.ServiceFeeCap { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Timeout != 0 { + n += 1 + sovTx(uint64(m.Timeout)) + } + if m.RepeatedFrequency != 0 { + n += 1 + sovTx(uint64(m.RepeatedFrequency)) + } + if m.RepeatedTotal != 0 { + n += 1 + sovTx(uint64(m.RepeatedTotal)) + } + return n +} + +func (m *MsgWithdrawEarnedFees) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovTx(uint64(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 *MsgDefineService) 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: MsgDefineService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDefineService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", 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.Tags = append(m.Tags, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Author", 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.Author = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorDescription", 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.AuthorDescription = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Schemas", 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.Schemas = 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 *MsgBindService) 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: MsgBindService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBindService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deposit = append(m.Deposit, types.Coin{}) + if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pricing", 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.Pricing = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QoS", wireType) + } + m.QoS = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QoS |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", 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.Options = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + 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 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.Owner = 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 *MsgUpdateServiceBinding) 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: MsgUpdateServiceBinding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deposit = append(m.Deposit, types.Coin{}) + if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pricing", 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.Pricing = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field QoS", wireType) + } + m.QoS = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.QoS |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", 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.Options = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + 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 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.Owner = 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 *MsgSetWithdrawAddress) 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: MsgSetWithdrawAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetWithdrawAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", 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.WithdrawAddress = 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 *MsgDisableServiceBinding) 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: MsgDisableServiceBinding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDisableServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 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.Owner = 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 *MsgEnableServiceBinding) 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: MsgEnableServiceBinding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEnableServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deposit = append(m.Deposit, types.Coin{}) + if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = 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 *MsgRefundServiceDeposit) 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: MsgRefundServiceDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRefundServiceDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + 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 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.Owner = 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 *MsgCallService) 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: MsgCallService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCallService: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + m.Timeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Repeated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Repeated = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) + } + m.RepeatedFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedFrequency |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedTotal", wireType) + } + m.RepeatedTotal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedTotal |= 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 *MsgCallServiceResponse) 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: MsgCallServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCallServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = 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 *MsgRespondService) 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: MsgRespondService: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRespondService: 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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", 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.Result = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", 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.Output = 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 *MsgPauseRequestContext) 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: MsgPauseRequestContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPauseRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = 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 *MsgStartRequestContext) 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: MsgStartRequestContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStartRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = 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 *MsgKillRequestContext) 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: MsgKillRequestContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgKillRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = 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 *MsgUpdateRequestContext) 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: MsgUpdateRequestContext: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) + if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) + } + m.Timeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Timeout |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) + } + m.RepeatedFrequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedFrequency |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RepeatedTotal", wireType) + } + m.RepeatedTotal = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RepeatedTotal |= 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 *MsgWithdrawEarnedFees) 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: MsgWithdrawEarnedFees: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawEarnedFees: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = 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 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/module-sdk/service/types.go b/module-sdk/service/types.go new file mode 100644 index 00000000..f0ceee17 --- /dev/null +++ b/module-sdk/service/types.go @@ -0,0 +1,821 @@ +package service + +import ( + json2 "encoding/json" + "errors" + "fmt" + sdk "github.com/irisnet/core-sdk-go/types" + "strings" +) + +const ( + ModuleName = "service" + + eventTypeNewBatchRequest = "new_batch_request" + eventTypeNewBatchRequestProvider = "new_batch_request_provider" + attributeKeyRequests = "requests" + attributeKeyRequestID = "request_id" + attributeKeyRequestContextID = "request_context_id" + attributeKeyServiceName = "service_name" + attributeKeyProvider = "provider" + + requestIDLen = 58 + contextIDLen = 40 +) + +var ( + _ sdk.Msg = &MsgDefineService{} + _ sdk.Msg = &MsgBindService{} + _ sdk.Msg = &MsgUpdateServiceBinding{} + _ sdk.Msg = &MsgSetWithdrawAddress{} + _ sdk.Msg = &MsgDisableServiceBinding{} + _ sdk.Msg = &MsgEnableServiceBinding{} + _ sdk.Msg = &MsgRefundServiceDeposit{} + _ sdk.Msg = &MsgCallService{} + _ sdk.Msg = &MsgRespondService{} + _ sdk.Msg = &MsgPauseRequestContext{} + _ sdk.Msg = &MsgStartRequestContext{} + _ sdk.Msg = &MsgKillRequestContext{} + _ sdk.Msg = &MsgUpdateRequestContext{} + _ sdk.Msg = &MsgWithdrawEarnedFees{} + + RequestContextStateToStringMap = map[RequestContextState]string{ + RUNNING: "running", + PAUSED: "paused", + COMPLETED: "completed", + } + StringToRequestContextStateMap = map[string]RequestContextState{ + "running": RUNNING, + "paused": PAUSED, + "completed": COMPLETED, + } + + RequestContextBatchStateToStringMap = map[RequestContextBatchState]string{ + BATCHRUNNING: "running", + BATCHCOMPLETED: "completed", + } + StringToRequestContextBatchStateMap = map[string]RequestContextBatchState{ + "running": BATCHRUNNING, + "completed": BATCHCOMPLETED, + } +) + +func (msg MsgDefineService) Route() string { return ModuleName } + +func (msg MsgDefineService) Type() string { + return "define_service" +} + +func (msg MsgDefineService) ValidateBasic() error { + if len(msg.Author) == 0 { + return errors.New("author missing") + } + if err := sdk.ValidateAccAddress(msg.Author); err != nil { + return err + } + + if len(msg.Name) == 0 { + return errors.New("author missing") + } + + if len(msg.Schemas) == 0 { + return errors.New("schemas missing") + } + + return nil +} + +func (msg MsgDefineService) GetSignBytes() []byte { + if len(msg.Tags) == 0 { + msg.Tags = nil + } + + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +func (msg MsgDefineService) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Author)} +} + +func (msg MsgBindService) Type() string { + return "bind_service" +} + +func (msg MsgBindService) Route() string { return ModuleName } + +func (msg MsgBindService) ValidateBasic() error { + if len(msg.Owner) == 0 { + return errors.New("owner missing") + } + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return err + } + + if len(msg.Provider) == 0 { + return errors.New("provider missing") + } + if err := sdk.ValidateAccAddress(msg.Provider); err != nil { + return err + } + + if len(msg.ServiceName) == 0 { + return errors.New("serviceName missing") + } + + if len(msg.Pricing) == 0 { + return errors.New("pricing missing") + } + return nil +} + +func (msg MsgBindService) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +func (msg MsgBindService) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +func (msg MsgCallService) Route() string { return ModuleName } + +func (msg MsgCallService) Type() string { + return "request_service" +} + +func (msg MsgCallService) ValidateBasic() error { + if len(msg.Consumer) == 0 { + return errors.New("consumer missing") + } + if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { + return err + } + + if len(msg.Providers) == 0 { + return errors.New("providers missing") + } + for _, provider := range msg.Providers { + if err := sdk.ValidateAccAddress(provider); err != nil { + return err + } + } + + if len(msg.ServiceName) == 0 { + return errors.New("serviceName missing") + } + + if len(msg.Input) == 0 { + return errors.New("input missing") + } + return nil +} + +func (msg MsgCallService) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +func (msg MsgCallService) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} +} + +func (msg MsgRespondService) Route() string { return ModuleName } + +func (msg MsgRespondService) Type() string { + return "respond_service" +} + +func (msg MsgRespondService) ValidateBasic() error { + if len(msg.Provider) == 0 { + return errors.New("provider missing") + } + if err := sdk.ValidateAccAddress(msg.Provider); err != nil { + return err + } + + if len(msg.Result) == 0 { + return errors.New("result missing") + } + + if len(msg.Output) > 0 { + if !json2.Valid([]byte(msg.Output)) { + return errors.New("output is not valid JSON") + } + } + + return nil +} + +func (msg MsgRespondService) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +func (msg MsgRespondService) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Provider)} +} + +// ______________________________________________________________________ + +func (msg MsgUpdateServiceBinding) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgUpdateServiceBinding) Type() string { return "update_service_binding" } + +// GetSignBytes implements Msg. +func (msg MsgUpdateServiceBinding) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgUpdateServiceBinding) ValidateBasic() error { + if len(msg.Provider) == 0 { + return errors.New("provider missing") + } + if err := sdk.ValidateAccAddress(msg.Provider); err != nil { + return err + } + + if len(msg.Owner) == 0 { + return errors.New("owner missing") + } + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return err + } + + if len(msg.ServiceName) == 0 { + return errors.New("service name missing") + } + + if !msg.Deposit.Empty() { + return fmt.Errorf("invalid deposit: %s", msg.Deposit) + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgUpdateServiceBinding) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// ______________________________________________________________________ + +func (msg MsgSetWithdrawAddress) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgSetWithdrawAddress) Type() string { return "set_withdraw_address" } + +// GetSignBytes implements Msg. +func (msg MsgSetWithdrawAddress) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgSetWithdrawAddress) ValidateBasic() error { + if len(msg.Owner) == 0 { + return errors.New("owner missing") + } + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return err + } + + if len(msg.WithdrawAddress) == 0 { + return errors.New("withdrawal address missing") + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgSetWithdrawAddress) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// ______________________________________________________________________ + +func (msg MsgDisableServiceBinding) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgDisableServiceBinding) Type() string { return "disable_service_binding" } + +// GetSignBytes implements Msg. +func (msg MsgDisableServiceBinding) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgDisableServiceBinding) ValidateBasic() error { + if len(msg.Provider) == 0 { + return errors.New("provider missing") + } + if err := sdk.ValidateAccAddress(msg.Provider); err != nil { + return err + } + + if len(msg.Owner) == 0 { + return errors.New("owner missing") + } + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return err + } + + if len(msg.ServiceName) == 0 { + return errors.New("service name missing") + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgDisableServiceBinding) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// ______________________________________________________________________ + +func (msg MsgEnableServiceBinding) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgEnableServiceBinding) Type() string { return "enable_service_binding" } + +// GetSignBytes implements Msg. +func (msg MsgEnableServiceBinding) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgEnableServiceBinding) ValidateBasic() error { + if len(msg.Provider) == 0 { + return errors.New("provider missing") + } + if err := sdk.ValidateAccAddress(msg.Provider); err != nil { + return err + } + + if len(msg.Owner) == 0 { + return errors.New("owner missing") + } + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return err + } + + if len(msg.ServiceName) == 0 { + return errors.New("service name missing") + } + + if !msg.Deposit.Empty() { + return fmt.Errorf("invalid deposit: %s", msg.Deposit) + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgEnableServiceBinding) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// ______________________________________________________________________ + +func (msg MsgRefundServiceDeposit) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgRefundServiceDeposit) Type() string { return "refund_service_deposit" } + +// GetSignBytes implements Msg. +func (msg MsgRefundServiceDeposit) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgRefundServiceDeposit) ValidateBasic() error { + if len(msg.Provider) == 0 { + return errors.New("provider missing") + } + if err := sdk.ValidateAccAddress(msg.Provider); err != nil { + return err + } + + if len(msg.Owner) == 0 { + return errors.New("owner missing") + } + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return err + } + + if len(msg.ServiceName) == 0 { + return errors.New("service name missing") + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgRefundServiceDeposit) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// ______________________________________________________________________ + +func (msg MsgPauseRequestContext) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgPauseRequestContext) Type() string { return "pause_request_context" } + +// GetSignBytes implements Msg. +func (msg MsgPauseRequestContext) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgPauseRequestContext) ValidateBasic() error { + if len(msg.Consumer) == 0 { + return errors.New("consumer missing") + } + if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { + return err + } + return nil +} + +// GetSigners implements Msg. +func (msg MsgPauseRequestContext) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} +} + +// ______________________________________________________________________ + +func (msg MsgStartRequestContext) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgStartRequestContext) Type() string { return "start_request_context" } + +// GetSignBytes implements Msg. +func (msg MsgStartRequestContext) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgStartRequestContext) ValidateBasic() error { + if len(msg.Consumer) == 0 { + return errors.New("consumer missing") + } + if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { + return err + } + return nil +} + +// GetSigners implements Msg. +func (msg MsgStartRequestContext) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} +} + +// ______________________________________________________________________ + +func (msg MsgKillRequestContext) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgKillRequestContext) Type() string { return "kill_request_context" } + +// GetSignBytes implements Msg. +func (msg MsgKillRequestContext) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgKillRequestContext) ValidateBasic() error { + if len(msg.Consumer) == 0 { + return errors.New("consumer missing") + } + if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { + return err + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgKillRequestContext) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} +} + +// ______________________________________________________________________ + +func (msg MsgUpdateRequestContext) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgUpdateRequestContext) Type() string { return "update_request_context" } + +// GetSignBytes implements Msg. +func (msg MsgUpdateRequestContext) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgUpdateRequestContext) ValidateBasic() error { + if len(msg.Consumer) == 0 { + return errors.New("consumer missing") + } + if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { + return err + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgUpdateRequestContext) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} +} + +// ______________________________________________________________________ + +func (msg MsgWithdrawEarnedFees) Route() string { return ModuleName } + +// Type implements Msg. +func (msg MsgWithdrawEarnedFees) Type() string { return "withdraw_earned_fees" } + +// GetSignBytes implements Msg. +func (msg MsgWithdrawEarnedFees) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// ValidateBasic implements Msg. +func (msg MsgWithdrawEarnedFees) ValidateBasic() error { + if len(msg.Provider) == 0 { + return errors.New("provider missing") + } + if err := sdk.ValidateAccAddress(msg.Provider); err != nil { + return err + } + + if len(msg.Owner) == 0 { + return errors.New("owner missing") + } + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return err + } + + return nil +} + +// GetSigners implements Msg. +func (msg MsgWithdrawEarnedFees) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// ==========================================for QueryWithResponse========================================== + +func (r ServiceDefinition) Convert() interface{} { + return QueryServiceDefinitionResponse{ + Name: r.Name, + Description: r.Description, + Tags: r.Tags, + Author: r.Author, + AuthorDescription: r.AuthorDescription, + Schemas: r.Schemas, + } +} + +func (b ServiceBinding) Convert() interface{} { + return QueryServiceBindingResponse{ + ServiceName: b.ServiceName, + Provider: b.Provider, + Deposit: b.Deposit, + Pricing: b.Pricing, + QoS: b.QoS, + Options: b.Options, + Available: b.Available, + DisabledTime: b.DisabledTime, + Owner: b.Owner, + } +} + +type serviceBindings []*ServiceBinding + +func (bs serviceBindings) Convert() interface{} { + bindings := make([]QueryServiceBindingResponse, len(bs)) + for i, binding := range bs { + bindings[i] = binding.Convert().(QueryServiceBindingResponse) + } + return bindings +} + +func (r Request) Empty() bool { + return len(r.ServiceName) == 0 +} + +func (r Request) Convert() interface{} { + return QueryServiceRequestResponse{ + ID: r.Id, + ServiceName: r.ServiceName, + Provider: r.Provider, + Consumer: r.Consumer, + Input: r.Input, + ServiceFee: r.ServiceFee, + RequestHeight: r.RequestHeight, + ExpirationHeight: r.ExpirationHeight, + RequestContextID: r.RequestContextId, + RequestContextBatchCounter: r.RequestContextBatchCounter, + } +} + +type requests []*Request + +func (rs requests) Convert() interface{} { + reqs := make([]QueryServiceRequestResponse, len(rs)) + for i, request := range rs { + reqs[i] = request.Convert().(QueryServiceRequestResponse) + } + return reqs +} + +func (r Response) Empty() bool { + return len(r.Provider) == 0 +} + +func (r Response) Convert() interface{} { + return QueryServiceResponseResponse{ + Provider: r.Provider, + Consumer: r.Consumer, + Output: r.Output, + Result: r.Result, + RequestContextID: r.RequestContextId, + RequestContextBatchCounter: r.RequestContextBatchCounter, + } +} + +type responses []*Response + +func (rs responses) Convert() interface{} { + resps := make([]QueryServiceResponseResponse, len(rs)) + for i, response := range rs { + resps[i] = response.Convert().(QueryServiceResponseResponse) + } + return resps +} + +func RequestContextStateFromString(str string) (RequestContextState, error) { + if state, ok := StringToRequestContextStateMap[strings.ToLower(str)]; ok { + return state, nil + } + return RequestContextState(0xff), fmt.Errorf("'%s' is not a valid request context state", str) +} + +// MarshalJSON returns the JSON representation +func (state RequestContextState) MarshalJSON() ([]byte, error) { + return json2.Marshal(state.String()) +} + +func RequestContextBatchStateFromString(str string) (RequestContextBatchState, error) { + if state, ok := StringToRequestContextBatchStateMap[strings.ToLower(str)]; ok { + return state, nil + } + return RequestContextBatchState(0xff), fmt.Errorf("'%s' is not a valid request context batch state", str) +} + +// MarshalJSON returns the JSON representation +func (state RequestContextBatchState) MarshalJSON() ([]byte, error) { + return json2.Marshal(state.String()) +} + +// UnmarshalJSON unmarshals raw JSON bytes into a RequestContextBatchState +func (state *RequestContextBatchState) UnmarshalJSON(data []byte) error { + var s string + if err := json2.Unmarshal(data, &s); err != nil { + return nil + } + + bz, err := RequestContextBatchStateFromString(s) + if err != nil { + return err + } + + *state = bz + return nil +} + +// UnmarshalJSON unmarshals raw JSON bytes into a RequestContextState. +func (state *RequestContextState) UnmarshalJSON(data []byte) error { + var s string + if err := json2.Unmarshal(data, &s); err != nil { + return nil + } + + bz, err := RequestContextStateFromString(s) + if err != nil { + return err + } + + *state = bz + return nil +} + +// Empty returns true if empty +func (r RequestContext) Empty() bool { + return len(r.ServiceName) == 0 +} + +func (r RequestContext) Convert() interface{} { + return QueryRequestContextResp{ + ServiceName: r.ServiceName, + Providers: r.Providers, + Consumer: r.Consumer, + Input: r.Input, + ServiceFeeCap: r.ServiceFeeCap, + Timeout: r.Timeout, + Repeated: r.Repeated, + RepeatedFrequency: r.RepeatedFrequency, + RepeatedTotal: r.RepeatedTotal, + BatchCounter: r.BatchCounter, + BatchRequestCount: r.BatchRequestCount, + BatchResponseCount: r.BatchResponseCount, + BatchState: r.BatchState.String(), + State: r.State.String(), + ResponseThreshold: r.ResponseThreshold, + ModuleName: r.ModuleName, + } +} + +func (p Params) Convert() interface{} { + return QueryParamsResp{ + MaxRequestTimeout: p.MaxRequestTimeout, + MinDepositMultiple: p.MinDepositMultiple, + MinDeposit: p.MinDeposit.String(), + ServiceFeeTax: p.ServiceFeeTax.String(), + SlashFraction: p.SlashFraction.String(), + ComplaintRetrospect: p.ComplaintRetrospect, + ArbitrationTimeLimit: p.ArbitrationTimeLimit, + TxSizeLimit: p.TxSizeLimit, + BaseDenom: p.BaseDenom, + } +} diff --git a/module-sdk/staking/codec.go b/module-sdk/staking/codec.go new file mode 100644 index 00000000..b9176b37 --- /dev/null +++ b/module-sdk/staking/codec.go @@ -0,0 +1,27 @@ +package staking + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateValidator{}, + &MsgEditValidator{}, + &MsgDelegate{}, + &MsgUndelegate{}, + &MsgBeginRedelegate{}, + ) +} diff --git a/module-sdk/staking/delegation.go b/module-sdk/staking/delegation.go new file mode 100644 index 00000000..4aec89ed --- /dev/null +++ b/module-sdk/staking/delegation.go @@ -0,0 +1,381 @@ +package staking + +import ( + "encoding/json" + "fmt" + "strings" + "time" + yaml "gopkg.in/yaml.v2" + "github.com/irisnet/core-sdk-go/common/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +// Implements Delegation interface +var _ DelegationI = Delegation{} + +// String implements the Stringer interface for a DVPair object. +func (dv DVPair) String() string { + out, _ := yaml.Marshal(dv) + return string(out) +} + +// String implements the Stringer interface for a DVVTriplet object. +func (dvv DVVTriplet) String() string { + out, _ := yaml.Marshal(dvv) + return string(out) +} + +// NewDelegation creates a new delegation object +//nolint:interfacer +func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) Delegation { + return Delegation{ + DelegatorAddress: delegatorAddr.String(), + ValidatorAddress: validatorAddr.String(), + Shares: shares, + } +} + +// MustMarshalDelegation returns the delegation bytes. Panics if fails +func MustMarshalDelegation(cdc codec.BinaryMarshaler, delegation Delegation) []byte { + return cdc.MustMarshalBinaryBare(&delegation) +} + +// MustUnmarshalDelegation return the unmarshaled delegation from bytes. +// Panics if fails. +func MustUnmarshalDelegation(cdc codec.BinaryMarshaler, value []byte) Delegation { + delegation, err := UnmarshalDelegation(cdc, value) + if err != nil { + panic(err) + } + + return delegation +} + +// return the delegation +func UnmarshalDelegation(cdc codec.BinaryMarshaler, value []byte) (delegation Delegation, err error) { + err = cdc.UnmarshalBinaryBare(value, &delegation) + return delegation, err +} + +func (d Delegation) GetDelegatorAddr() sdk.AccAddress { + delAddr, err := sdk.AccAddressFromBech32(d.DelegatorAddress) + if err != nil { + panic(err) + } + return delAddr +} +func (d Delegation) GetValidatorAddr() sdk.ValAddress { + addr, err := sdk.ValAddressFromBech32(d.ValidatorAddress) + if err != nil { + panic(err) + } + return addr +} +func (d Delegation) GetShares() sdk.Dec { return d.Shares } + +// String returns a human readable string representation of a Delegation. +func (d Delegation) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + +// Delegations is a collection of delegations +type Delegations []Delegation + +func (d Delegations) String() (out string) { + for _, del := range d { + out += del.String() + "\n" + } + + return strings.TrimSpace(out) +} + +func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int) UnbondingDelegationEntry { + return UnbondingDelegationEntry{ + CreationHeight: creationHeight, + CompletionTime: completionTime, + InitialBalance: balance, + Balance: balance, + } +} + +// String implements the stringer interface for a UnbondingDelegationEntry. +func (e UnbondingDelegationEntry) String() string { + out, _ := yaml.Marshal(e) + return string(out) +} + +// IsMature - is the current entry mature +func (e UnbondingDelegationEntry) IsMature(currentTime time.Time) bool { + return !e.CompletionTime.After(currentTime) +} + +// NewUnbondingDelegation - create a new unbonding delegation object +//nolint:interfacer +func NewUnbondingDelegation( + delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, + creationHeight int64, minTime time.Time, balance sdk.Int, +) UnbondingDelegation { + return UnbondingDelegation{ + DelegatorAddress: delegatorAddr.String(), + ValidatorAddress: validatorAddr.String(), + Entries: []UnbondingDelegationEntry{ + NewUnbondingDelegationEntry(creationHeight, minTime, balance), + }, + } +} + +// AddEntry - append entry to the unbonding delegation +func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int) { + entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) + ubd.Entries = append(ubd.Entries, entry) +} + +// RemoveEntry - remove entry at index i to the unbonding delegation +func (ubd *UnbondingDelegation) RemoveEntry(i int64) { + ubd.Entries = append(ubd.Entries[:i], ubd.Entries[i+1:]...) +} + +// return the unbonding delegation +func MustMarshalUBD(cdc codec.BinaryMarshaler, ubd UnbondingDelegation) []byte { + return cdc.MustMarshalBinaryBare(&ubd) +} + +// unmarshal a unbonding delegation from a store value +func MustUnmarshalUBD(cdc codec.BinaryMarshaler, value []byte) UnbondingDelegation { + ubd, err := UnmarshalUBD(cdc, value) + if err != nil { + panic(err) + } + + return ubd +} + +// unmarshal a unbonding delegation from a store value +func UnmarshalUBD(cdc codec.BinaryMarshaler, value []byte) (ubd UnbondingDelegation, err error) { + err = cdc.UnmarshalBinaryBare(value, &ubd) + return ubd, err +} + +// String returns a human readable string representation of an UnbondingDelegation. +func (ubd UnbondingDelegation) String() string { + out := fmt.Sprintf(`Unbonding Delegations between: + Delegator: %s + Validator: %s + Entries:`, ubd.DelegatorAddress, ubd.ValidatorAddress) + for i, entry := range ubd.Entries { + out += fmt.Sprintf(` Unbonding Delegation %d: + Creation Height: %v + Min time to unbond (unix): %v + Expected balance: %s`, i, entry.CreationHeight, + entry.CompletionTime, entry.Balance) + } + + return out +} + +// UnbondingDelegations is a collection of UnbondingDelegation +type UnbondingDelegations []UnbondingDelegation + +func (ubds UnbondingDelegations) String() (out string) { + for _, u := range ubds { + out += u.String() + "\n" + } + + return strings.TrimSpace(out) +} + +func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int, sharesDst sdk.Dec) RedelegationEntry { + return RedelegationEntry{ + CreationHeight: creationHeight, + CompletionTime: completionTime, + InitialBalance: balance, + SharesDst: sharesDst, + } +} + +// String implements the Stringer interface for a RedelegationEntry object. +func (e RedelegationEntry) String() string { + out, _ := yaml.Marshal(e) + return string(out) +} + +// IsMature - is the current entry mature +func (e RedelegationEntry) IsMature(currentTime time.Time) bool { + return !e.CompletionTime.After(currentTime) +} + +//nolint:interfacer +func NewRedelegation( + delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, + creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec, +) Redelegation { + return Redelegation{ + DelegatorAddress: delegatorAddr.String(), + ValidatorSrcAddress: validatorSrcAddr.String(), + ValidatorDstAddress: validatorDstAddr.String(), + Entries: []RedelegationEntry{ + NewRedelegationEntry(creationHeight, minTime, balance, sharesDst), + }, + } +} + +// AddEntry - append entry to the unbonding delegation +func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec) { + entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst) + red.Entries = append(red.Entries, entry) +} + +// RemoveEntry - remove entry at index i to the unbonding delegation +func (red *Redelegation) RemoveEntry(i int64) { + red.Entries = append(red.Entries[:i], red.Entries[i+1:]...) +} + +// MustMarshalRED returns the Redelegation bytes. Panics if fails. +func MustMarshalRED(cdc codec.BinaryMarshaler, red Redelegation) []byte { + return cdc.MustMarshalBinaryBare(&red) +} + +// MustUnmarshalRED unmarshals a redelegation from a store value. Panics if fails. +func MustUnmarshalRED(cdc codec.BinaryMarshaler, value []byte) Redelegation { + red, err := UnmarshalRED(cdc, value) + if err != nil { + panic(err) + } + + return red +} + +// UnmarshalRED unmarshals a redelegation from a store value +func UnmarshalRED(cdc codec.BinaryMarshaler, value []byte) (red Redelegation, err error) { + err = cdc.UnmarshalBinaryBare(value, &red) + return red, err +} + +// String returns a human readable string representation of a Redelegation. +func (red Redelegation) String() string { + out := fmt.Sprintf(`Redelegations between: + Delegator: %s + Source Validator: %s + Destination Validator: %s + Entries: +`, + red.DelegatorAddress, red.ValidatorSrcAddress, red.ValidatorDstAddress, + ) + + for i, entry := range red.Entries { + out += fmt.Sprintf(` Redelegation Entry #%d: + Creation height: %v + Min time to unbond (unix): %v + Dest Shares: %s +`, + i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, + ) + } + + return strings.TrimRight(out, "\n") +} + +// Redelegations are a collection of Redelegation +type Redelegations []Redelegation + +func (d Redelegations) String() (out string) { + for _, red := range d { + out += red.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// ---------------------------------------------------------------------------- +// Client Types + +// NewDelegationResp creates a new DelegationResponse instance +func NewDelegationResp( + delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec, balance sdk.Coin, +) DelegationResponse { + return DelegationResponse{ + Delegation: NewDelegation(delegatorAddr, validatorAddr, shares), + Balance: balance, + } +} + +// String implements the Stringer interface for DelegationResponse. +func (d DelegationResponse) String() string { + return fmt.Sprintf("%s\n Balance: %s", d.Delegation.String(), d.Balance) +} + +type delegationRespAlias DelegationResponse + +// MarshalJSON implements the json.Marshaler interface. This is so we can +// achieve a flattened structure while embedding other types. +func (d DelegationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal((delegationRespAlias)(d)) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. This is so we can +// achieve a flattened structure while embedding other types. +func (d *DelegationResponse) UnmarshalJSON(bz []byte) error { + return json.Unmarshal(bz, (*delegationRespAlias)(d)) +} + +// DelegationResponses is a collection of DelegationResp +type DelegationResponses []DelegationResponse + +// String implements the Stringer interface for DelegationResponses. +func (d DelegationResponses) String() (out string) { + for _, del := range d { + out += del.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// NewRedelegationResponse crates a new RedelegationEntryResponse instance. +//nolint:interfacer +func NewRedelegationResponse( + delegatorAddr sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress, entries []RedelegationEntryResponse, +) RedelegationResponse { + return RedelegationResponse{ + Redelegation: Redelegation{ + DelegatorAddress: delegatorAddr.String(), + ValidatorSrcAddress: validatorSrc.String(), + ValidatorDstAddress: validatorDst.String(), + }, + Entries: entries, + } +} + +// NewRedelegationEntryResponse creates a new RedelegationEntryResponse instance. +func NewRedelegationEntryResponse( + creationHeight int64, completionTime time.Time, sharesDst sdk.Dec, initialBalance, balance sdk.Int) RedelegationEntryResponse { + return RedelegationEntryResponse{ + RedelegationEntry: NewRedelegationEntry(creationHeight, completionTime, initialBalance, sharesDst), + Balance: balance, + } +} + +type redelegationRespAlias RedelegationResponse + +// MarshalJSON implements the json.Marshaler interface. This is so we can +// achieve a flattened structure while embedding other types. +func (r RedelegationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal((redelegationRespAlias)(r)) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. This is so we can +// achieve a flattened structure while embedding other types. +func (r *RedelegationResponse) UnmarshalJSON(bz []byte) error { + return json.Unmarshal(bz, (*redelegationRespAlias)(r)) +} + +// RedelegationResponses are a collection of RedelegationResp +type RedelegationResponses []RedelegationResponse + +func (r RedelegationResponses) String() (out string) { + for _, red := range r { + out += red.String() + "\n" + } + + return strings.TrimSpace(out) +} diff --git a/module-sdk/staking/export.go b/module-sdk/staking/export.go new file mode 100644 index 00000000..ffc25b54 --- /dev/null +++ b/module-sdk/staking/export.go @@ -0,0 +1,214 @@ +package staking + +import ( + sdk "github.com/irisnet/core-sdk-go/types" + "time" +) + +// expose Staking module api for user +type Client interface { + sdk.Module + + CreateValidator(request CreateValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + EditValidator(request EditValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + Delegate(request DelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + Undelegate(request UndelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + BeginRedelegate(request BeginRedelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + + QueryValidators(status string, page, size uint64) (QueryValidatorsResp, sdk.Error) + QueryValidator(validatorAddr string) (QueryValidatorResp, sdk.Error) + QueryValidatorDelegations(validatorAddr string, page, size uint64) (QueryValidatorDelegationsResp, sdk.Error) + QueryValidatorUnbondingDelegations(validatorAddr string, page, size uint64) (QueryValidatorUnbondingDelegationsResp, sdk.Error) + QueryDelegation(delegatorAddr string, validatorAddr string) (QueryDelegationResp, sdk.Error) + QueryUnbondingDelegation(delegatorAddr string, validatorAddr string) (QueryUnbondingDelegationResp, sdk.Error) + QueryDelegatorDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorDelegationsResp, sdk.Error) + QueryDelegatorUnbondingDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorUnbondingDelegationsResp, sdk.Error) + QueryRedelegations(request QueryRedelegationsReq) (QueryRedelegationsResp, sdk.Error) + QueryDelegatorValidators(delegatorAddr string, page, size uint64) (QueryDelegatorValidatorsResp, sdk.Error) + QueryDelegatorValidator(delegatorAddr string, validatorAddr string) (QueryValidatorResp, sdk.Error) + QueryHistoricalInfo(height int64) (QueryHistoricalInfoResp, sdk.Error) + QueryPool() (QueryPoolResp, sdk.Error) + QueryParams() (QueryParamsResp, sdk.Error) +} + +type CreateValidatorRequest struct { + Moniker string `json:"moniker"` + Rate sdk.Dec `json:"rate"` + MaxRate sdk.Dec `json:"max_rate"` + MaxChangeRate sdk.Dec `json:"max_change_rate"` + MinSelfDelegation sdk.Int `json:"min_self_delegation"` + Pubkey string `json:"pubkey"` + Value sdk.DecCoin `json:"value"` +} + +type EditValidatorRequest struct { + Moniker string `json:"moniker"` + Identity string `json:"identity"` + Website string `json:"website"` + SecurityContact string `json:"security_contact"` + Details string `json:"details"` + CommissionRate sdk.Dec `json:"commission_rate"` + MinSelfDelegation sdk.Int `json:"min_self_delegation"` +} + +type DelegateRequest struct { + ValidatorAddr string `json:"validator_address"` + Amount sdk.DecCoin `json:"amount"` +} + +type UndelegateRequest struct { + ValidatorAddr string `json:"validator_address"` + Amount sdk.DecCoin `json:"amount"` +} + +type BeginRedelegateRequest struct { + ValidatorSrcAddress string + ValidatorDstAddress string + Amount sdk.DecCoin +} + +type ( + description struct { + Moniker string `json:"moniker"` + Identity string `json:"identity"` + Website string `json:"website"` + SecurityContact string `json:"security_contact"` + Details string `json:"details"` + } + commission struct { + commissionRates + UpdateTime time.Time `json:"update_time"` + } + commissionRates struct { + Rate sdk.Dec `json:"rate"` + MaxRate sdk.Dec `json:"max_rate"` + MaxChangeRate sdk.Dec `json:"max_change_rate"` + } + + QueryValidatorsResp struct { + Validators []QueryValidatorResp `json:"validators"` + Total uint64 `json:"total"` + } + + QueryValidatorResp struct { + OperatorAddress string `json:"operator_address"` + ConsensusPubkey string `json:"consensus_pubkey"` + Jailed bool `json:"jailed"` + Status string `json:"status"` + Tokens sdk.Int `json:"tokens"` + DelegatorShares sdk.Dec `json:"delegator_shares"` + Description description `json:"description"` + UnbondingHeight int64 `json:"unbonding_height"` + UnbondingTime time.Time `json:"unbonding_time"` + Commission commission `json:"commission"` + MinSelfDelegation sdk.Int `json:"min_self_delegation"` + } +) + +type ( + delegation struct { + DelegatorAddress string `json:"delegator_address"` + Shares sdk.Dec `json:"shares"` + ValidatorAddress string `json:"validator_address"` + } + + QueryDelegationResp struct { + Delegation delegation `json:"delegation"` + Balance sdk.Coin `json:"balance"` + } + + QueryValidatorDelegationsResp struct { + DelegationResponses []QueryDelegationResp `json:"delegation_responses"` + Total uint64 `json:"total"` + } +) + +type ( + unbondingDelegationEntry struct { + CreationHeight int64 `json:"creation_height"` + CompletionTime time.Time `json:"completion_time"` + InitialBalance sdk.Int `json:"initial_balance"` + Balance sdk.Int `json:"balance"` + } + + QueryUnbondingDelegationResp struct { + DelegatorAddress string `json:"delegator_address"` + ValidatorAddress string `json:"validator_address"` + Entries []unbondingDelegationEntry `json:"entries"` + } + + QueryValidatorUnbondingDelegationsResp struct { + UnbondingResponses []QueryUnbondingDelegationResp `json:"unbonding_responses"` + Total uint64 `json:"total"` + } +) + +type QueryDelegatorDelegationsResp struct { + DelegationResponses []QueryDelegationResp `json:"delegation_responses"` + Total uint64 `json:"total"` +} + +type QueryDelegatorUnbondingDelegationsResp struct { + UnbondingDelegations []QueryUnbondingDelegationResp `json:"unbonding_delegations"` + Total uint64 `json:"total"` +} + +type ( + QueryRedelegationsReq struct { + DelegatorAddr string `json:"delegator_addr"` + SrcValidatorAddr string `json:"src_validator_addr"` + DstValidatorAddr string `json:"dst_validator_addr"` + Page uint64 `json:"page"` + Size uint64 `json:"size"` + } + + QueryRedelegationsResp struct { + RedelegationResponses []RedelegationResp `json:"redelegation_responses"` + Total uint64 `json:"total"` + } + + redelegationEntry struct { + CreationHeight int64 `json:"creation_height"` + CompletionTime time.Time `json:"completion_time"` + InitialBalance sdk.Int `json:"initial_balance"` + SharesDst sdk.Dec `json:"shares_dst"` + } + redelegationEntryResponse struct { + RedelegationEntry redelegationEntry `json:"redelegation_entry"` + Balance sdk.Int `json:"balance"` + } + redelegation struct { + DelegatorAddress string `json:"delegator_address"` + ValidatorSrcAddress string `json:"validator_src_address"` + ValidatorDstAddress string `json:"validator_dst_address"` + Entries []redelegationEntry `json:"entries"` + } + + RedelegationResp struct { + Redelegation redelegation `json:"redelegation"` + Entries []redelegationEntryResponse `json:"entries"` + } +) + +type QueryDelegatorValidatorsResp struct { + Validator []QueryValidatorResp `json:"validator"` + Total uint64 `json:"total"` +} + +type QueryHistoricalInfoResp struct { + Header sdk.Header `json:"header"` + Valset []QueryValidatorResp `json:"valset"` +} + +type QueryPoolResp struct { + NotBondedTokens sdk.Int `json:"not_bonded_tokens"` + BondedTokens sdk.Int `json:"bonded_tokens"` +} + +type QueryParamsResp struct { + UnbondingTime time.Duration `json:"unbonding_time"` + MaxValidators uint32 `json:"max_validators"` + MaxEntries uint32 `json:"max_entries"` + HistoricalEntries uint32 `json:"historical_entries"` + BondDenom string `json:"bond_denom"` +} diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod new file mode 100644 index 00000000..63ec5c4e --- /dev/null +++ b/module-sdk/staking/go.mod @@ -0,0 +1,13 @@ +module gov + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/staking/params.go b/module-sdk/staking/params.go new file mode 100644 index 00000000..ea812eb5 --- /dev/null +++ b/module-sdk/staking/params.go @@ -0,0 +1,35 @@ +package staking + +import ( + yaml "gopkg.in/yaml.v2" +) + +// String implements the stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +// String implements the Stringer interface for a Commission object. +func (c Commission) String() string { + out, _ := yaml.Marshal(c) + return string(out) +} + +// String implements the Stringer interface for a CommissionRates object. +func (cr CommissionRates) String() string { + out, _ := yaml.Marshal(cr) + return string(out) +} + +// String implements the Stringer interface for a Description object. +func (d Description) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + +// String implements the Stringer interface for a Validator object. +func (v Validator) String() string { + out, _ := yaml.Marshal(v) + return string(out) +} diff --git a/module-sdk/staking/query.pb.go b/module-sdk/staking/query.pb.go new file mode 100644 index 00000000..feddac6f --- /dev/null +++ b/module-sdk/staking/query.pb.go @@ -0,0 +1,6728 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/staking/v1beta1/query.proto + +package staking + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + query "github.com/irisnet/core-sdk-go/types/query" + _ "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 + +// QueryValidatorsRequest is request type for Query/Validators RPC method. +type QueryValidatorsRequest struct { + // status enables to query for validators matching a given status. + Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryValidatorsRequest) Reset() { *m = QueryValidatorsRequest{} } +func (m *QueryValidatorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorsRequest) ProtoMessage() {} +func (*QueryValidatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{0} +} +func (m *QueryValidatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorsRequest.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 *QueryValidatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorsRequest.Merge(m, src) +} +func (m *QueryValidatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorsRequest proto.InternalMessageInfo + +func (m *QueryValidatorsRequest) GetStatus() string { + if m != nil { + return m.Status + } + return "" +} + +func (m *QueryValidatorsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryValidatorsResponse is response type for the Query/Validators RPC method +type QueryValidatorsResponse struct { + // validators contains all the queried validators. + Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryValidatorsResponse) Reset() { *m = QueryValidatorsResponse{} } +func (m *QueryValidatorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorsResponse) ProtoMessage() {} +func (*QueryValidatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{1} +} +func (m *QueryValidatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorsResponse.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 *QueryValidatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorsResponse.Merge(m, src) +} +func (m *QueryValidatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorsResponse proto.InternalMessageInfo + +func (m *QueryValidatorsResponse) GetValidators() []Validator { + if m != nil { + return m.Validators + } + return nil +} + +func (m *QueryValidatorsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryValidatorRequest is response type for the Query/Validator RPC method +type QueryValidatorRequest struct { + // validator_addr defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` +} + +func (m *QueryValidatorRequest) Reset() { *m = QueryValidatorRequest{} } +func (m *QueryValidatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorRequest) ProtoMessage() {} +func (*QueryValidatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{2} +} +func (m *QueryValidatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorRequest.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 *QueryValidatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorRequest.Merge(m, src) +} +func (m *QueryValidatorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorRequest proto.InternalMessageInfo + +func (m *QueryValidatorRequest) GetValidatorAddr() string { + if m != nil { + return m.ValidatorAddr + } + return "" +} + +// QueryValidatorResponse is response type for the Query/Validator RPC method +type QueryValidatorResponse struct { + // validator defines the the validator info. + Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` +} + +func (m *QueryValidatorResponse) Reset() { *m = QueryValidatorResponse{} } +func (m *QueryValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorResponse) ProtoMessage() {} +func (*QueryValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{3} +} +func (m *QueryValidatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorResponse.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 *QueryValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorResponse.Merge(m, src) +} +func (m *QueryValidatorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorResponse proto.InternalMessageInfo + +func (m *QueryValidatorResponse) GetValidator() Validator { + if m != nil { + return m.Validator + } + return Validator{} +} + +// QueryValidatorDelegationsRequest is request type for the +// Query/ValidatorDelegations RPC method +type QueryValidatorDelegationsRequest struct { + // validator_addr defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryValidatorDelegationsRequest) Reset() { *m = QueryValidatorDelegationsRequest{} } +func (m *QueryValidatorDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorDelegationsRequest) ProtoMessage() {} +func (*QueryValidatorDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{4} +} +func (m *QueryValidatorDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorDelegationsRequest.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 *QueryValidatorDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorDelegationsRequest.Merge(m, src) +} +func (m *QueryValidatorDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorDelegationsRequest proto.InternalMessageInfo + +func (m *QueryValidatorDelegationsRequest) GetValidatorAddr() string { + if m != nil { + return m.ValidatorAddr + } + return "" +} + +func (m *QueryValidatorDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryValidatorDelegationsResponse is response type for the +// Query/ValidatorDelegations RPC method +type QueryValidatorDelegationsResponse struct { + DelegationResponses DelegationResponses `protobuf:"bytes,1,rep,name=delegation_responses,json=delegationResponses,proto3,castrepeated=DelegationResponses" json:"delegation_responses"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryValidatorDelegationsResponse) Reset() { *m = QueryValidatorDelegationsResponse{} } +func (m *QueryValidatorDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryValidatorDelegationsResponse) ProtoMessage() {} +func (*QueryValidatorDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{5} +} +func (m *QueryValidatorDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorDelegationsResponse.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 *QueryValidatorDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorDelegationsResponse.Merge(m, src) +} +func (m *QueryValidatorDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorDelegationsResponse proto.InternalMessageInfo + +func (m *QueryValidatorDelegationsResponse) GetDelegationResponses() DelegationResponses { + if m != nil { + return m.DelegationResponses + } + return nil +} + +func (m *QueryValidatorDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryValidatorUnbondingDelegationsRequest is required type for the +// Query/ValidatorUnbondingDelegations RPC method +type QueryValidatorUnbondingDelegationsRequest struct { + // validator_addr defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryValidatorUnbondingDelegationsRequest) Reset() { + *m = QueryValidatorUnbondingDelegationsRequest{} +} +func (m *QueryValidatorUnbondingDelegationsRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryValidatorUnbondingDelegationsRequest) ProtoMessage() {} +func (*QueryValidatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{6} +} +func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.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 *QueryValidatorUnbondingDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.Merge(m, src) +} +func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorUnbondingDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest proto.InternalMessageInfo + +func (m *QueryValidatorUnbondingDelegationsRequest) GetValidatorAddr() string { + if m != nil { + return m.ValidatorAddr + } + return "" +} + +func (m *QueryValidatorUnbondingDelegationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryValidatorUnbondingDelegationsResponse is response type for the +// Query/ValidatorUnbondingDelegations RPC method. +type QueryValidatorUnbondingDelegationsResponse struct { + UnbondingResponses []UnbondingDelegation `protobuf:"bytes,1,rep,name=unbonding_responses,json=unbondingResponses,proto3" json:"unbonding_responses"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryValidatorUnbondingDelegationsResponse) Reset() { + *m = QueryValidatorUnbondingDelegationsResponse{} +} +func (m *QueryValidatorUnbondingDelegationsResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryValidatorUnbondingDelegationsResponse) ProtoMessage() {} +func (*QueryValidatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{7} +} +func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.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 *QueryValidatorUnbondingDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.Merge(m, src) +} +func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryValidatorUnbondingDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse proto.InternalMessageInfo + +func (m *QueryValidatorUnbondingDelegationsResponse) GetUnbondingResponses() []UnbondingDelegation { + if m != nil { + return m.UnbondingResponses + } + return nil +} + +func (m *QueryValidatorUnbondingDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegationRequest is request type for the Query/Delegation RPC method. +type QueryDelegationRequest struct { + // delegator_addr defines the delegator address to query for. + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + // validator_addr defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` +} + +func (m *QueryDelegationRequest) Reset() { *m = QueryDelegationRequest{} } +func (m *QueryDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegationRequest) ProtoMessage() {} +func (*QueryDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{8} +} +func (m *QueryDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegationRequest.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 *QueryDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegationRequest.Merge(m, src) +} +func (m *QueryDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegationRequest proto.InternalMessageInfo + +// QueryDelegationResponse is response type for the Query/Delegation RPC method. +type QueryDelegationResponse struct { + // delegation_responses defines the delegation info of a delegation. + DelegationResponse *DelegationResponse `protobuf:"bytes,1,opt,name=delegation_response,json=delegationResponse,proto3" json:"delegation_response,omitempty"` +} + +func (m *QueryDelegationResponse) Reset() { *m = QueryDelegationResponse{} } +func (m *QueryDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegationResponse) ProtoMessage() {} +func (*QueryDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{9} +} +func (m *QueryDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegationResponse.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 *QueryDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegationResponse.Merge(m, src) +} +func (m *QueryDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegationResponse proto.InternalMessageInfo + +func (m *QueryDelegationResponse) GetDelegationResponse() *DelegationResponse { + if m != nil { + return m.DelegationResponse + } + return nil +} + +// QueryUnbondingDelegationRequest is request type for the +// Query/UnbondingDelegation RPC method. +type QueryUnbondingDelegationRequest struct { + // delegator_addr defines the delegator address to query for. + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + // validator_addr defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` +} + +func (m *QueryUnbondingDelegationRequest) Reset() { *m = QueryUnbondingDelegationRequest{} } +func (m *QueryUnbondingDelegationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUnbondingDelegationRequest) ProtoMessage() {} +func (*QueryUnbondingDelegationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{10} +} +func (m *QueryUnbondingDelegationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUnbondingDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUnbondingDelegationRequest.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 *QueryUnbondingDelegationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUnbondingDelegationRequest.Merge(m, src) +} +func (m *QueryUnbondingDelegationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUnbondingDelegationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUnbondingDelegationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUnbondingDelegationRequest proto.InternalMessageInfo + +// QueryDelegationResponse is response type for the Query/UnbondingDelegation +// RPC method. +type QueryUnbondingDelegationResponse struct { + // unbond defines the unbonding information of a delegation. + Unbond UnbondingDelegation `protobuf:"bytes,1,opt,name=unbond,proto3" json:"unbond"` +} + +func (m *QueryUnbondingDelegationResponse) Reset() { *m = QueryUnbondingDelegationResponse{} } +func (m *QueryUnbondingDelegationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUnbondingDelegationResponse) ProtoMessage() {} +func (*QueryUnbondingDelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{11} +} +func (m *QueryUnbondingDelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUnbondingDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUnbondingDelegationResponse.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 *QueryUnbondingDelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUnbondingDelegationResponse.Merge(m, src) +} +func (m *QueryUnbondingDelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUnbondingDelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUnbondingDelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUnbondingDelegationResponse proto.InternalMessageInfo + +func (m *QueryUnbondingDelegationResponse) GetUnbond() UnbondingDelegation { + if m != nil { + return m.Unbond + } + return UnbondingDelegation{} +} + +// QueryDelegatorDelegationsRequest is request type for the +// Query/DelegatorDelegations RPC method. +type QueryDelegatorDelegationsRequest struct { + // delegator_addr defines the delegator address to query for. + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorDelegationsRequest) Reset() { *m = QueryDelegatorDelegationsRequest{} } +func (m *QueryDelegatorDelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorDelegationsRequest) ProtoMessage() {} +func (*QueryDelegatorDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{12} +} +func (m *QueryDelegatorDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorDelegationsRequest.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 *QueryDelegatorDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorDelegationsRequest.Merge(m, src) +} +func (m *QueryDelegatorDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorDelegationsRequest proto.InternalMessageInfo + +// QueryDelegatorDelegationsResponse is response type for the +// Query/DelegatorDelegations RPC method. +type QueryDelegatorDelegationsResponse struct { + // delegation_responses defines all the delegations' info of a delegator. + DelegationResponses []DelegationResponse `protobuf:"bytes,1,rep,name=delegation_responses,json=delegationResponses,proto3" json:"delegation_responses"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorDelegationsResponse) Reset() { *m = QueryDelegatorDelegationsResponse{} } +func (m *QueryDelegatorDelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorDelegationsResponse) ProtoMessage() {} +func (*QueryDelegatorDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{13} +} +func (m *QueryDelegatorDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorDelegationsResponse.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 *QueryDelegatorDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorDelegationsResponse.Merge(m, src) +} +func (m *QueryDelegatorDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorDelegationsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorDelegationsResponse) GetDelegationResponses() []DelegationResponse { + if m != nil { + return m.DelegationResponses + } + return nil +} + +func (m *QueryDelegatorDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorUnbondingDelegationsRequest is request type for the +// Query/DelegatorUnbondingDelegations RPC method. +type QueryDelegatorUnbondingDelegationsRequest struct { + // delegator_addr defines the delegator address to query for. + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorUnbondingDelegationsRequest) Reset() { + *m = QueryDelegatorUnbondingDelegationsRequest{} +} +func (m *QueryDelegatorUnbondingDelegationsRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryDelegatorUnbondingDelegationsRequest) ProtoMessage() {} +func (*QueryDelegatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{14} +} +func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.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 *QueryDelegatorUnbondingDelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.Merge(m, src) +} +func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest proto.InternalMessageInfo + +// QueryUnbondingDelegatorDelegationsResponse is response type for the +// Query/UnbondingDelegatorDelegations RPC method. +type QueryDelegatorUnbondingDelegationsResponse struct { + UnbondingResponses []UnbondingDelegation `protobuf:"bytes,1,rep,name=unbonding_responses,json=unbondingResponses,proto3" json:"unbonding_responses"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorUnbondingDelegationsResponse) Reset() { + *m = QueryDelegatorUnbondingDelegationsResponse{} +} +func (m *QueryDelegatorUnbondingDelegationsResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryDelegatorUnbondingDelegationsResponse) ProtoMessage() {} +func (*QueryDelegatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{15} +} +func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.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 *QueryDelegatorUnbondingDelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.Merge(m, src) +} +func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorUnbondingDelegationsResponse) GetUnbondingResponses() []UnbondingDelegation { + if m != nil { + return m.UnbondingResponses + } + return nil +} + +func (m *QueryDelegatorUnbondingDelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRedelegationsRequest is request type for the Query/Redelegations RPC +// method. +type QueryRedelegationsRequest struct { + // delegator_addr defines the delegator address to query for. + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + // src_validator_addr defines the validator address to redelegate from. + SrcValidatorAddr string `protobuf:"bytes,2,opt,name=src_validator_addr,json=srcValidatorAddr,proto3" json:"src_validator_addr,omitempty"` + // dst_validator_addr defines the validator address to redelegate to. + DstValidatorAddr string `protobuf:"bytes,3,opt,name=dst_validator_addr,json=dstValidatorAddr,proto3" json:"dst_validator_addr,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRedelegationsRequest) Reset() { *m = QueryRedelegationsRequest{} } +func (m *QueryRedelegationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRedelegationsRequest) ProtoMessage() {} +func (*QueryRedelegationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{16} +} +func (m *QueryRedelegationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRedelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRedelegationsRequest.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 *QueryRedelegationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRedelegationsRequest.Merge(m, src) +} +func (m *QueryRedelegationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRedelegationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRedelegationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRedelegationsRequest proto.InternalMessageInfo + +// QueryRedelegationsResponse is response type for the Query/Redelegations RPC +// method. +type QueryRedelegationsResponse struct { + RedelegationResponses []RedelegationResponse `protobuf:"bytes,1,rep,name=redelegation_responses,json=redelegationResponses,proto3" json:"redelegation_responses"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRedelegationsResponse) Reset() { *m = QueryRedelegationsResponse{} } +func (m *QueryRedelegationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRedelegationsResponse) ProtoMessage() {} +func (*QueryRedelegationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{17} +} +func (m *QueryRedelegationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRedelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRedelegationsResponse.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 *QueryRedelegationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRedelegationsResponse.Merge(m, src) +} +func (m *QueryRedelegationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRedelegationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRedelegationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRedelegationsResponse proto.InternalMessageInfo + +func (m *QueryRedelegationsResponse) GetRedelegationResponses() []RedelegationResponse { + if m != nil { + return m.RedelegationResponses + } + return nil +} + +func (m *QueryRedelegationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorValidatorsRequest is request type for the +// Query/DelegatorValidators RPC method. +type QueryDelegatorValidatorsRequest struct { + // delegator_addr defines the delegator address to query for. + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorValidatorsRequest) Reset() { *m = QueryDelegatorValidatorsRequest{} } +func (m *QueryDelegatorValidatorsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorValidatorsRequest) ProtoMessage() {} +func (*QueryDelegatorValidatorsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{18} +} +func (m *QueryDelegatorValidatorsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorValidatorsRequest.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 *QueryDelegatorValidatorsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorValidatorsRequest.Merge(m, src) +} +func (m *QueryDelegatorValidatorsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorValidatorsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorValidatorsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorValidatorsRequest proto.InternalMessageInfo + +// QueryDelegatorValidatorsResponse is response type for the +// Query/DelegatorValidators RPC method. +type QueryDelegatorValidatorsResponse struct { + // validators defines the the validators' info of a delegator. + Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDelegatorValidatorsResponse) Reset() { *m = QueryDelegatorValidatorsResponse{} } +func (m *QueryDelegatorValidatorsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorValidatorsResponse) ProtoMessage() {} +func (*QueryDelegatorValidatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{19} +} +func (m *QueryDelegatorValidatorsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorValidatorsResponse.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 *QueryDelegatorValidatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorValidatorsResponse.Merge(m, src) +} +func (m *QueryDelegatorValidatorsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorValidatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorValidatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorValidatorsResponse proto.InternalMessageInfo + +func (m *QueryDelegatorValidatorsResponse) GetValidators() []Validator { + if m != nil { + return m.Validators + } + return nil +} + +func (m *QueryDelegatorValidatorsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDelegatorValidatorRequest is request type for the +// Query/DelegatorValidator RPC method. +type QueryDelegatorValidatorRequest struct { + // delegator_addr defines the delegator address to query for. + DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` + // validator_addr defines the validator address to query for. + ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` +} + +func (m *QueryDelegatorValidatorRequest) Reset() { *m = QueryDelegatorValidatorRequest{} } +func (m *QueryDelegatorValidatorRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorValidatorRequest) ProtoMessage() {} +func (*QueryDelegatorValidatorRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{20} +} +func (m *QueryDelegatorValidatorRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorValidatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorValidatorRequest.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 *QueryDelegatorValidatorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorValidatorRequest.Merge(m, src) +} +func (m *QueryDelegatorValidatorRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorValidatorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorValidatorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorValidatorRequest proto.InternalMessageInfo + +// QueryDelegatorValidatorResponse response type for the +// Query/DelegatorValidator RPC method. +type QueryDelegatorValidatorResponse struct { + // validator defines the the validator info. + Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` +} + +func (m *QueryDelegatorValidatorResponse) Reset() { *m = QueryDelegatorValidatorResponse{} } +func (m *QueryDelegatorValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDelegatorValidatorResponse) ProtoMessage() {} +func (*QueryDelegatorValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{21} +} +func (m *QueryDelegatorValidatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDelegatorValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDelegatorValidatorResponse.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 *QueryDelegatorValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDelegatorValidatorResponse.Merge(m, src) +} +func (m *QueryDelegatorValidatorResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDelegatorValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDelegatorValidatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDelegatorValidatorResponse proto.InternalMessageInfo + +func (m *QueryDelegatorValidatorResponse) GetValidator() Validator { + if m != nil { + return m.Validator + } + return Validator{} +} + +// QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC +// method. +type QueryHistoricalInfoRequest struct { + // height defines at which height to query the historical info. + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *QueryHistoricalInfoRequest) Reset() { *m = QueryHistoricalInfoRequest{} } +func (m *QueryHistoricalInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHistoricalInfoRequest) ProtoMessage() {} +func (*QueryHistoricalInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{22} +} +func (m *QueryHistoricalInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHistoricalInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHistoricalInfoRequest.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 *QueryHistoricalInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHistoricalInfoRequest.Merge(m, src) +} +func (m *QueryHistoricalInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryHistoricalInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHistoricalInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHistoricalInfoRequest proto.InternalMessageInfo + +func (m *QueryHistoricalInfoRequest) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +// QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC +// method. +type QueryHistoricalInfoResponse struct { + // hist defines the historical info at the given height. + Hist *HistoricalInfo `protobuf:"bytes,1,opt,name=hist,proto3" json:"hist,omitempty"` +} + +func (m *QueryHistoricalInfoResponse) Reset() { *m = QueryHistoricalInfoResponse{} } +func (m *QueryHistoricalInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHistoricalInfoResponse) ProtoMessage() {} +func (*QueryHistoricalInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{23} +} +func (m *QueryHistoricalInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHistoricalInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHistoricalInfoResponse.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 *QueryHistoricalInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHistoricalInfoResponse.Merge(m, src) +} +func (m *QueryHistoricalInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryHistoricalInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHistoricalInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHistoricalInfoResponse proto.InternalMessageInfo + +func (m *QueryHistoricalInfoResponse) GetHist() *HistoricalInfo { + if m != nil { + return m.Hist + } + return nil +} + +// QueryPoolRequest is request type for the Query/Pool RPC method. +type QueryPoolRequest struct { +} + +func (m *QueryPoolRequest) Reset() { *m = QueryPoolRequest{} } +func (m *QueryPoolRequest) String() string { return proto.CompactTextString(m) } +func (*QueryPoolRequest) ProtoMessage() {} +func (*QueryPoolRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{24} +} +func (m *QueryPoolRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolRequest.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 *QueryPoolRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolRequest.Merge(m, src) +} +func (m *QueryPoolRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolRequest proto.InternalMessageInfo + +// QueryPoolResponse is response type for the Query/Pool RPC method. +type QueryPoolResponse struct { + // pool defines the pool info. + Pool Pool `protobuf:"bytes,1,opt,name=pool,proto3" json:"pool"` +} + +func (m *QueryPoolResponse) Reset() { *m = QueryPoolResponse{} } +func (m *QueryPoolResponse) String() string { return proto.CompactTextString(m) } +func (*QueryPoolResponse) ProtoMessage() {} +func (*QueryPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_f270127f442bbcd8, []int{25} +} +func (m *QueryPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryPoolResponse.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 *QueryPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryPoolResponse.Merge(m, src) +} +func (m *QueryPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryPoolResponse proto.InternalMessageInfo + +func (m *QueryPoolResponse) GetPool() Pool { + if m != nil { + return m.Pool + } + return Pool{} +} + +// QueryParamsRequest is 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_f270127f442bbcd8, []int{26} +} +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 response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + 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_f270127f442bbcd8, []int{27} +} +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{} +} + +func init() { + proto.RegisterType((*QueryValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorsRequest") + proto.RegisterType((*QueryValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorsResponse") + proto.RegisterType((*QueryValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorRequest") + proto.RegisterType((*QueryValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorResponse") + proto.RegisterType((*QueryValidatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsRequest") + proto.RegisterType((*QueryValidatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsResponse") + proto.RegisterType((*QueryValidatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest") + proto.RegisterType((*QueryValidatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse") + proto.RegisterType((*QueryDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryDelegationRequest") + proto.RegisterType((*QueryDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryDelegationResponse") + proto.RegisterType((*QueryUnbondingDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationRequest") + proto.RegisterType((*QueryUnbondingDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationResponse") + proto.RegisterType((*QueryDelegatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest") + proto.RegisterType((*QueryDelegatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse") + proto.RegisterType((*QueryDelegatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest") + proto.RegisterType((*QueryDelegatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse") + proto.RegisterType((*QueryRedelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryRedelegationsRequest") + proto.RegisterType((*QueryRedelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryRedelegationsResponse") + proto.RegisterType((*QueryDelegatorValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest") + proto.RegisterType((*QueryDelegatorValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse") + proto.RegisterType((*QueryDelegatorValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorRequest") + proto.RegisterType((*QueryDelegatorValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorResponse") + proto.RegisterType((*QueryHistoricalInfoRequest)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoRequest") + proto.RegisterType((*QueryHistoricalInfoResponse)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoResponse") + proto.RegisterType((*QueryPoolRequest)(nil), "cosmos.staking.v1beta1.QueryPoolRequest") + proto.RegisterType((*QueryPoolResponse)(nil), "cosmos.staking.v1beta1.QueryPoolResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.staking.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.staking.v1beta1.QueryParamsResponse") +} + +func init() { + proto.RegisterFile("cosmos/staking/v1beta1/query.proto", fileDescriptor_f270127f442bbcd8) +} + +var fileDescriptor_f270127f442bbcd8 = []byte{ + // 1313 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0xcd, 0x6f, 0x1b, 0x55, + 0x10, 0xf7, 0x6b, 0x43, 0x44, 0xa7, 0x6a, 0x55, 0x9e, 0xd3, 0x50, 0xb6, 0xc5, 0x4e, 0x57, 0x25, + 0xa4, 0x69, 0xe2, 0x25, 0x49, 0x49, 0x43, 0xa9, 0x0a, 0x09, 0xa5, 0x25, 0xca, 0x81, 0xc4, 0x88, + 0xf0, 0x75, 0x88, 0xd6, 0xde, 0xed, 0x7a, 0x55, 0x7b, 0x9f, 0xbb, 0xbb, 0x8e, 0x5a, 0xa2, 0x1c, + 0xe0, 0x04, 0x37, 0x10, 0x27, 0xe0, 0xd2, 0x03, 0x12, 0x12, 0x1c, 0xe1, 0x1f, 0xe0, 0x44, 0xb9, + 0x05, 0xc1, 0x01, 0x2e, 0x05, 0x25, 0x1c, 0x2a, 0x4e, 0xdc, 0x10, 0x37, 0xe4, 0xb7, 0xb3, 0xeb, + 0xdd, 0xec, 0xa7, 0x1d, 0x47, 0x51, 0x4f, 0xb1, 0x9f, 0xe7, 0xe3, 0xf7, 0x9b, 0x79, 0x33, 0x6f, + 0x46, 0x01, 0xb1, 0xca, 0xac, 0x06, 0xb3, 0x24, 0xcb, 0x96, 0x6f, 0xe9, 0x86, 0x26, 0xad, 0x4f, + 0x55, 0x54, 0x5b, 0x9e, 0x92, 0x6e, 0xb7, 0x54, 0xf3, 0x6e, 0xa9, 0x69, 0x32, 0x9b, 0xd1, 0x61, + 0x47, 0xa6, 0x84, 0x32, 0x25, 0x94, 0x11, 0xc6, 0x51, 0xb7, 0x22, 0x5b, 0xaa, 0xa3, 0xe0, 0xa9, + 0x37, 0x65, 0x4d, 0x37, 0x64, 0x5b, 0x67, 0x86, 0x63, 0x43, 0x18, 0xd2, 0x98, 0xc6, 0xf8, 0x47, + 0xa9, 0xfd, 0x09, 0x4f, 0xcf, 0x68, 0x8c, 0x69, 0x75, 0x55, 0x92, 0x9b, 0xba, 0x24, 0x1b, 0x06, + 0xb3, 0xb9, 0x8a, 0x85, 0xbf, 0x9e, 0x8b, 0xc1, 0xe6, 0xe2, 0xe0, 0x52, 0xe2, 0x1d, 0x18, 0x5e, + 0x69, 0xfb, 0x5e, 0x95, 0xeb, 0xba, 0x22, 0xdb, 0xcc, 0xb4, 0xca, 0xea, 0xed, 0x96, 0x6a, 0xd9, + 0x74, 0x18, 0x06, 0x2d, 0x5b, 0xb6, 0x5b, 0xd6, 0x29, 0x32, 0x42, 0xc6, 0x8e, 0x94, 0xf1, 0x1b, + 0xbd, 0x0e, 0xd0, 0xc1, 0x77, 0xea, 0xd0, 0x08, 0x19, 0x3b, 0x3a, 0x3d, 0x5a, 0x42, 0x92, 0x6d, + 0x32, 0x25, 0x87, 0x3d, 0xfa, 0x2b, 0x2d, 0xcb, 0x9a, 0x8a, 0x36, 0xcb, 0x3e, 0x4d, 0xf1, 0x5b, + 0x02, 0x4f, 0x86, 0x5c, 0x5b, 0x4d, 0x66, 0x58, 0x2a, 0xbd, 0x01, 0xb0, 0xee, 0x9d, 0x9e, 0x22, + 0x23, 0x87, 0xc7, 0x8e, 0x4e, 0x9f, 0x2d, 0x45, 0x07, 0xb2, 0xe4, 0xe9, 0x2f, 0x0c, 0xdc, 0x7f, + 0x50, 0xcc, 0x95, 0x7d, 0xaa, 0x6d, 0x43, 0x21, 0xb0, 0xcf, 0xa6, 0x82, 0x75, 0x50, 0x04, 0xd0, + 0x5e, 0x85, 0x93, 0x41, 0xb0, 0x6e, 0x98, 0x9e, 0x81, 0xe3, 0x9e, 0xbf, 0x35, 0x59, 0x51, 0x4c, + 0x0c, 0xd7, 0x31, 0xef, 0x74, 0x5e, 0x51, 0x4c, 0x71, 0x6d, 0x77, 0x9c, 0x3d, 0xae, 0xaf, 0xc2, + 0x11, 0x4f, 0x94, 0xeb, 0x76, 0x41, 0xb5, 0xa3, 0x29, 0x7e, 0x4a, 0x60, 0x24, 0xe8, 0xe1, 0x9a, + 0x5a, 0x57, 0x35, 0xe7, 0x4a, 0x74, 0x07, 0xb6, 0x6f, 0x29, 0x7e, 0x48, 0xe0, 0x6c, 0x02, 0x26, + 0x0c, 0xc0, 0xfb, 0x30, 0xa4, 0x78, 0xc7, 0x6b, 0x26, 0x1e, 0xbb, 0x69, 0x1f, 0x8f, 0x8b, 0x45, + 0xc7, 0x94, 0x6b, 0x69, 0xe1, 0x74, 0x3b, 0x28, 0xdf, 0xfc, 0x51, 0xcc, 0x87, 0x7f, 0xb3, 0xca, + 0x79, 0x25, 0x7c, 0xd8, 0xbf, 0xfb, 0xf1, 0x05, 0x81, 0xf3, 0x41, 0xaa, 0x6f, 0x1a, 0x15, 0x66, + 0x28, 0xba, 0xa1, 0x1d, 0x7c, 0x1e, 0x7e, 0x27, 0x30, 0x9e, 0x05, 0x1c, 0x26, 0xa4, 0x02, 0xf9, + 0x96, 0xfb, 0x7b, 0x28, 0x1f, 0x17, 0xe2, 0xf2, 0x11, 0x61, 0x12, 0x6f, 0x29, 0xf5, 0xac, 0xed, + 0x43, 0xe0, 0x9b, 0x58, 0x58, 0xfe, 0x94, 0x7b, 0x41, 0xc6, 0x94, 0xef, 0x0a, 0xb2, 0x77, 0xca, + 0x83, 0x1c, 0xce, 0xc5, 0xa1, 0x88, 0x5c, 0x5c, 0x7e, 0xfc, 0xa3, 0x7b, 0xc5, 0xdc, 0xc3, 0x7b, + 0xc5, 0x9c, 0xb8, 0x8e, 0x7d, 0x2b, 0x7c, 0xc9, 0xe8, 0x7b, 0x90, 0x8f, 0xb8, 0xca, 0x58, 0xd5, + 0x5d, 0xdc, 0xe4, 0x32, 0x0d, 0x5f, 0x56, 0xf1, 0x2e, 0x14, 0xb9, 0xdf, 0x88, 0x40, 0xef, 0x37, + 0xe5, 0x06, 0xf6, 0x96, 0x48, 0xd7, 0xc8, 0x7d, 0x11, 0x06, 0x9d, 0x3c, 0x23, 0xdd, 0x1e, 0x2e, + 0x0a, 0x1a, 0x10, 0xbf, 0x74, 0x7b, 0xd9, 0x35, 0x17, 0x76, 0x74, 0x0d, 0x65, 0xe1, 0xda, 0xa7, + 0x1a, 0xf2, 0x05, 0xe3, 0x67, 0xb7, 0xab, 0x45, 0xa3, 0xc3, 0x70, 0x54, 0xfb, 0xd6, 0xd5, 0x9c, + 0xd8, 0xec, 0x6f, 0xfb, 0xfa, 0xca, 0x6d, 0x5f, 0x1e, 0xa7, 0x94, 0xf6, 0x75, 0x30, 0xa1, 0xf7, + 0x1a, 0x59, 0x0a, 0xcc, 0x47, 0xb1, 0x91, 0xfd, 0x43, 0xe0, 0x29, 0xce, 0xad, 0xac, 0x2a, 0x3d, + 0x87, 0x7c, 0x02, 0xa8, 0x65, 0x56, 0xd7, 0x22, 0xab, 0xfb, 0x84, 0x65, 0x56, 0x57, 0x03, 0xef, + 0xcb, 0x04, 0x50, 0xc5, 0xb2, 0x77, 0x4b, 0x1f, 0x76, 0xa4, 0x15, 0xcb, 0x5e, 0x4d, 0x78, 0x8d, + 0x06, 0xfa, 0x90, 0xce, 0x2d, 0x02, 0x42, 0x14, 0x65, 0x4c, 0x9f, 0x0e, 0xc3, 0xa6, 0x9a, 0x50, + 0x44, 0x13, 0x71, 0x19, 0xf4, 0x9b, 0xdb, 0x55, 0x46, 0x27, 0x4d, 0x75, 0xbf, 0xe7, 0x80, 0x62, + 0xf0, 0x86, 0x86, 0x27, 0xeb, 0x03, 0x2b, 0x9f, 0xef, 0x43, 0x7d, 0xf5, 0x91, 0x98, 0xbd, 0xef, + 0x40, 0x21, 0x06, 0xf5, 0x7e, 0xbf, 0x7b, 0xb5, 0xd8, 0x64, 0xf6, 0x7b, 0x7c, 0xbf, 0x88, 0x95, + 0xf0, 0x9a, 0x6e, 0xd9, 0xcc, 0xd4, 0xab, 0x72, 0x7d, 0xd1, 0xb8, 0xc9, 0x7c, 0xbb, 0x58, 0x4d, + 0xd5, 0xb5, 0x9a, 0xcd, 0x3d, 0x1c, 0x2e, 0xe3, 0x37, 0xf1, 0x1d, 0x38, 0x1d, 0xa9, 0x85, 0xd8, + 0x2e, 0xc3, 0x40, 0x4d, 0xb7, 0x6c, 0x84, 0x35, 0x1a, 0x07, 0x6b, 0x97, 0x36, 0xd7, 0x11, 0x29, + 0x9c, 0xe0, 0xa6, 0x97, 0x19, 0xab, 0x23, 0x0c, 0x71, 0x09, 0x9e, 0xf0, 0x9d, 0xa1, 0x93, 0x59, + 0x18, 0x68, 0x32, 0x56, 0x47, 0x27, 0x67, 0xe2, 0x9c, 0xb4, 0x75, 0x90, 0x36, 0x97, 0x17, 0x87, + 0x80, 0x3a, 0xc6, 0x64, 0x53, 0x6e, 0xb8, 0xb5, 0x21, 0xbe, 0x01, 0xf9, 0xc0, 0x29, 0x3a, 0xb9, + 0x02, 0x83, 0x4d, 0x7e, 0x82, 0x6e, 0x0a, 0xb1, 0x6e, 0xb8, 0x94, 0x3b, 0x4f, 0x38, 0x3a, 0xd3, + 0x7f, 0x9f, 0x84, 0xc7, 0xb8, 0x55, 0xfa, 0x39, 0x01, 0xe8, 0xdc, 0x79, 0x5a, 0x8a, 0x33, 0x13, + 0xbd, 0x13, 0x0b, 0x52, 0x66, 0x79, 0x9c, 0xd9, 0xc6, 0x3f, 0xfc, 0xe5, 0xaf, 0xcf, 0x0e, 0x9d, + 0xa3, 0xa2, 0x14, 0xb3, 0x8d, 0xfb, 0xea, 0xe5, 0x6b, 0x02, 0x47, 0x3c, 0x13, 0x74, 0x32, 0x9b, + 0x2b, 0x17, 0x59, 0x29, 0xab, 0x38, 0x02, 0x7b, 0x91, 0x03, 0x7b, 0x9e, 0xce, 0xa4, 0x03, 0x93, + 0x36, 0x82, 0x45, 0xb3, 0x49, 0x7f, 0x25, 0x30, 0x14, 0xb5, 0xd2, 0xd1, 0xb9, 0x6c, 0x28, 0xc2, + 0x23, 0x85, 0xf0, 0x42, 0x0f, 0x9a, 0x48, 0xe5, 0x06, 0xa7, 0x32, 0x4f, 0x5f, 0xea, 0x81, 0x8a, + 0xe4, 0x7b, 0x77, 0xe8, 0x7f, 0x04, 0x9e, 0x4e, 0xdc, 0x90, 0xe8, 0x7c, 0x36, 0x94, 0x09, 0xb3, + 0x93, 0xb0, 0xb0, 0x17, 0x13, 0xc8, 0x78, 0x85, 0x33, 0x5e, 0xa2, 0x8b, 0xbd, 0x30, 0xee, 0x4c, + 0x44, 0x7e, 0xee, 0x3f, 0x12, 0x80, 0x8e, 0xab, 0x94, 0xc2, 0x08, 0x2d, 0x1e, 0x29, 0x85, 0x11, + 0x1e, 0x6a, 0xc5, 0xb7, 0x39, 0x85, 0x32, 0x5d, 0xde, 0x63, 0xd2, 0xa4, 0x8d, 0x60, 0xe3, 0xdf, + 0xa4, 0xff, 0x12, 0xc8, 0x47, 0x44, 0x8f, 0x5e, 0x4a, 0x84, 0x18, 0xbf, 0x54, 0x09, 0x73, 0xdd, + 0x2b, 0x22, 0xc9, 0x06, 0x27, 0xa9, 0x51, 0xb5, 0xdf, 0x24, 0x23, 0x93, 0x48, 0x7f, 0x22, 0x30, + 0x14, 0xb5, 0x93, 0xa4, 0x94, 0x65, 0xc2, 0x92, 0x95, 0x52, 0x96, 0x49, 0x0b, 0x90, 0x78, 0x85, + 0x93, 0x9f, 0xa5, 0x17, 0xe3, 0xc8, 0x27, 0x66, 0xb1, 0x5d, 0x8b, 0x89, 0x43, 0x7e, 0x4a, 0x2d, + 0x66, 0xd9, 0x63, 0x52, 0x6a, 0x31, 0xd3, 0x8e, 0x91, 0x5e, 0x8b, 0x1e, 0xb3, 0x8c, 0x69, 0xb4, + 0xe8, 0x0f, 0x04, 0x8e, 0x05, 0x26, 0x62, 0x3a, 0x95, 0x08, 0x34, 0x6a, 0x61, 0x10, 0xa6, 0xbb, + 0x51, 0x41, 0x2e, 0x8b, 0x9c, 0xcb, 0x2b, 0x74, 0xbe, 0x17, 0x2e, 0x66, 0x00, 0xf1, 0x16, 0x81, + 0x7c, 0xc4, 0x94, 0x99, 0x52, 0x85, 0xf1, 0x43, 0xb3, 0x30, 0xd7, 0xbd, 0x22, 0xb2, 0xba, 0xce, + 0x59, 0xbd, 0x4c, 0xaf, 0xf6, 0xc2, 0xca, 0xf7, 0x3e, 0x3f, 0x20, 0x40, 0xc3, 0x7e, 0xe8, 0x6c, + 0x97, 0xc0, 0x5c, 0x42, 0x97, 0xba, 0xd6, 0x43, 0x3e, 0x6f, 0x71, 0x3e, 0x2b, 0xf4, 0xf5, 0xbd, + 0xf1, 0x09, 0x3f, 0xeb, 0xdf, 0x11, 0x38, 0x1e, 0x9c, 0x05, 0x69, 0xf2, 0x2d, 0x8a, 0x1c, 0x56, + 0x85, 0x99, 0xae, 0x74, 0x90, 0xd4, 0x1c, 0x27, 0x35, 0x4d, 0x9f, 0x8b, 0x23, 0x55, 0xf3, 0xf4, + 0xd6, 0x74, 0xe3, 0x26, 0x93, 0x36, 0x9c, 0x11, 0x78, 0x93, 0x7e, 0x40, 0x60, 0xa0, 0x3d, 0x5c, + 0xd2, 0xb1, 0x44, 0xbf, 0xbe, 0x39, 0x56, 0x38, 0x9f, 0x41, 0x12, 0x71, 0x9d, 0xe3, 0xb8, 0x0a, + 0xf4, 0x4c, 0x1c, 0xae, 0xf6, 0x2c, 0x4b, 0x3f, 0x26, 0x30, 0xe8, 0x4c, 0x9e, 0x74, 0x3c, 0xd9, + 0xb6, 0x7f, 0xd8, 0x15, 0x2e, 0x64, 0x92, 0x45, 0x24, 0xa3, 0x1c, 0xc9, 0x08, 0x2d, 0xc4, 0x22, + 0x71, 0x46, 0xdf, 0xa5, 0xfb, 0xdb, 0x05, 0xb2, 0xb5, 0x5d, 0x20, 0x7f, 0x6e, 0x17, 0xc8, 0x27, + 0x3b, 0x85, 0xdc, 0xd6, 0x4e, 0x21, 0xf7, 0xdb, 0x4e, 0x21, 0xf7, 0xee, 0x94, 0xa6, 0xdb, 0xb5, + 0x56, 0xa5, 0x54, 0x65, 0x0d, 0x49, 0x37, 0x75, 0xcb, 0x50, 0x6d, 0xfe, 0xb7, 0xd6, 0xaa, 0x4c, + 0x5a, 0xca, 0xad, 0x49, 0x8d, 0x49, 0x0d, 0xa6, 0xb4, 0xea, 0xaa, 0x67, 0xbb, 0x32, 0xc8, 0xff, + 0x4b, 0x34, 0xf3, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x48, 0xc1, 0x5d, 0xe9, 0x1a, 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 { + // Validators queries all validators that match the given status. + Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) + // Validator queries validator info for given validator address. + Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) + // ValidatorDelegations queries delegate info for given validator. + ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) + // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) + // Delegation queries delegate info for given validator delegator pair. + Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) + // UnbondingDelegation queries unbonding info for given validator delegator + // pair. + UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) + // DelegatorDelegations queries all delegations of a given delegator address. + DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) + // DelegatorUnbondingDelegations queries all unbonding delegations of a given + // delegator address. + DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) + // Redelegations queries redelegations of given address. + Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) + // DelegatorValidators queries all validators info for given delegator + // address. + DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) + // DelegatorValidator queries validator info for given delegator validator + // pair. + DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) + // HistoricalInfo queries the historical info for given height. + HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) + // Pool queries the pool info. + Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) + // Parameters queries the staking parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) { + out := new(QueryValidatorsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) { + out := new(QueryValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) { + out := new(QueryValidatorDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) { + out := new(QueryValidatorUnbondingDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) { + out := new(QueryDelegationResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Delegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) { + out := new(QueryUnbondingDelegationResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/UnbondingDelegation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) { + out := new(QueryDelegatorDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) { + out := new(QueryDelegatorUnbondingDelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) { + out := new(QueryRedelegationsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Redelegations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) { + out := new(QueryDelegatorValidatorsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) { + out := new(QueryDelegatorValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) { + out := new(QueryHistoricalInfoResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/HistoricalInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) { + out := new(QueryPoolResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Pool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Validators queries all validators that match the given status. + Validators(context.Context, *QueryValidatorsRequest) (*QueryValidatorsResponse, error) + // Validator queries validator info for given validator address. + Validator(context.Context, *QueryValidatorRequest) (*QueryValidatorResponse, error) + // ValidatorDelegations queries delegate info for given validator. + ValidatorDelegations(context.Context, *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) + // ValidatorUnbondingDelegations queries unbonding delegations of a validator. + ValidatorUnbondingDelegations(context.Context, *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) + // Delegation queries delegate info for given validator delegator pair. + Delegation(context.Context, *QueryDelegationRequest) (*QueryDelegationResponse, error) + // UnbondingDelegation queries unbonding info for given validator delegator + // pair. + UnbondingDelegation(context.Context, *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) + // DelegatorDelegations queries all delegations of a given delegator address. + DelegatorDelegations(context.Context, *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) + // DelegatorUnbondingDelegations queries all unbonding delegations of a given + // delegator address. + DelegatorUnbondingDelegations(context.Context, *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) + // Redelegations queries redelegations of given address. + Redelegations(context.Context, *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) + // DelegatorValidators queries all validators info for given delegator + // address. + DelegatorValidators(context.Context, *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) + // DelegatorValidator queries validator info for given delegator validator + // pair. + DelegatorValidator(context.Context, *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) + // HistoricalInfo queries the historical info for given height. + HistoricalInfo(context.Context, *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) + // Pool queries the pool info. + Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error) + // Parameters queries the staking parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Validators(ctx context.Context, req *QueryValidatorsRequest) (*QueryValidatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Validators not implemented") +} +func (*UnimplementedQueryServer) Validator(ctx context.Context, req *QueryValidatorRequest) (*QueryValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Validator not implemented") +} +func (*UnimplementedQueryServer) ValidatorDelegations(ctx context.Context, req *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidatorDelegations not implemented") +} +func (*UnimplementedQueryServer) ValidatorUnbondingDelegations(ctx context.Context, req *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidatorUnbondingDelegations not implemented") +} +func (*UnimplementedQueryServer) Delegation(ctx context.Context, req *QueryDelegationRequest) (*QueryDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delegation not implemented") +} +func (*UnimplementedQueryServer) UnbondingDelegation(ctx context.Context, req *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnbondingDelegation not implemented") +} +func (*UnimplementedQueryServer) DelegatorDelegations(ctx context.Context, req *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorDelegations not implemented") +} +func (*UnimplementedQueryServer) DelegatorUnbondingDelegations(ctx context.Context, req *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorUnbondingDelegations not implemented") +} +func (*UnimplementedQueryServer) Redelegations(ctx context.Context, req *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Redelegations not implemented") +} +func (*UnimplementedQueryServer) DelegatorValidators(ctx context.Context, req *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidators not implemented") +} +func (*UnimplementedQueryServer) DelegatorValidator(ctx context.Context, req *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidator not implemented") +} +func (*UnimplementedQueryServer) HistoricalInfo(ctx context.Context, req *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HistoricalInfo not implemented") +} +func (*UnimplementedQueryServer) Pool(ctx context.Context, req *QueryPoolRequest) (*QueryPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Pool not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Validators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Validators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Validators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Validators(ctx, req.(*QueryValidatorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Validator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Validator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Validator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Validator(ctx, req.(*QueryValidatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ValidatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ValidatorDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ValidatorDelegations(ctx, req.(*QueryValidatorDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ValidatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryValidatorUnbondingDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, req.(*QueryValidatorUnbondingDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Delegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Delegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Delegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Delegation(ctx, req.(*QueryDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUnbondingDelegationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UnbondingDelegation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/UnbondingDelegation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UnbondingDelegation(ctx, req.(*QueryUnbondingDelegationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorDelegations(ctx, req.(*QueryDelegatorDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorUnbondingDelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, req.(*QueryDelegatorUnbondingDelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Redelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRedelegationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Redelegations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Redelegations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Redelegations(ctx, req.(*QueryRedelegationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorValidatorsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorValidators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorValidators(ctx, req.(*QueryDelegatorValidatorsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_DelegatorValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDelegatorValidatorRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).DelegatorValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).DelegatorValidator(ctx, req.(*QueryDelegatorValidatorRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_HistoricalInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHistoricalInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HistoricalInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/HistoricalInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HistoricalInfo(ctx, req.(*QueryHistoricalInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Pool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryPoolRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Pool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Query/Pool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Pool(ctx, req.(*QueryPoolRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(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: "/cosmos.staking.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.staking.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Validators", + Handler: _Query_Validators_Handler, + }, + { + MethodName: "Validator", + Handler: _Query_Validator_Handler, + }, + { + MethodName: "ValidatorDelegations", + Handler: _Query_ValidatorDelegations_Handler, + }, + { + MethodName: "ValidatorUnbondingDelegations", + Handler: _Query_ValidatorUnbondingDelegations_Handler, + }, + { + MethodName: "Delegation", + Handler: _Query_Delegation_Handler, + }, + { + MethodName: "UnbondingDelegation", + Handler: _Query_UnbondingDelegation_Handler, + }, + { + MethodName: "DelegatorDelegations", + Handler: _Query_DelegatorDelegations_Handler, + }, + { + MethodName: "DelegatorUnbondingDelegations", + Handler: _Query_DelegatorUnbondingDelegations_Handler, + }, + { + MethodName: "Redelegations", + Handler: _Query_Redelegations_Handler, + }, + { + MethodName: "DelegatorValidators", + Handler: _Query_DelegatorValidators_Handler, + }, + { + MethodName: "DelegatorValidator", + Handler: _Query_DelegatorValidator_Handler, + }, + { + MethodName: "HistoricalInfo", + Handler: _Query_HistoricalInfo_Handler, + }, + { + MethodName: "Pool", + Handler: _Query_Pool_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/staking/v1beta1/query.proto", +} + +func (m *QueryValidatorsRequest) 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 *QueryValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorsRequest) 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.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorsResponse) 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 *QueryValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorsResponse) 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.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[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 *QueryValidatorRequest) 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 *QueryValidatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorResponse) 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 *QueryValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Validator.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 *QueryValidatorDelegationsRequest) 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 *QueryValidatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorDelegationsRequest) 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.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorDelegationsResponse) 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 *QueryValidatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorDelegationsResponse) 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.DelegationResponses) > 0 { + for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DelegationResponses[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 *QueryValidatorUnbondingDelegationsRequest) 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 *QueryValidatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorUnbondingDelegationsRequest) 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.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryValidatorUnbondingDelegationsResponse) 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 *QueryValidatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryValidatorUnbondingDelegationsResponse) 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.UnbondingResponses) > 0 { + for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UnbondingResponses[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 *QueryDelegationRequest) 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 *QueryDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegationResponse) 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 *QueryDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DelegationResponse != nil { + { + size, err := m.DelegationResponse.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 *QueryUnbondingDelegationRequest) 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 *QueryUnbondingDelegationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUnbondingDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUnbondingDelegationResponse) 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 *QueryUnbondingDelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Unbond.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 *QueryDelegatorDelegationsRequest) 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 *QueryDelegatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorDelegationsRequest) 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.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorDelegationsResponse) 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 *QueryDelegatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorDelegationsResponse) 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.DelegationResponses) > 0 { + for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DelegationResponses[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 *QueryDelegatorUnbondingDelegationsRequest) 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 *QueryDelegatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorUnbondingDelegationsRequest) 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.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorUnbondingDelegationsResponse) 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 *QueryDelegatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorUnbondingDelegationsResponse) 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.UnbondingResponses) > 0 { + for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UnbondingResponses[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 *QueryRedelegationsRequest) 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 *QueryRedelegationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRedelegationsRequest) 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] = 0x22 + } + if len(m.DstValidatorAddr) > 0 { + i -= len(m.DstValidatorAddr) + copy(dAtA[i:], m.DstValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DstValidatorAddr))) + i-- + dAtA[i] = 0x1a + } + if len(m.SrcValidatorAddr) > 0 { + i -= len(m.SrcValidatorAddr) + copy(dAtA[i:], m.SrcValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.SrcValidatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRedelegationsResponse) 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 *QueryRedelegationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRedelegationsResponse) 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.RedelegationResponses) > 0 { + for iNdEx := len(m.RedelegationResponses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RedelegationResponses[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 *QueryDelegatorValidatorsRequest) 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 *QueryDelegatorValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorsRequest) 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.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorValidatorsResponse) 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 *QueryDelegatorValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorsResponse) 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.Validators) > 0 { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[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 *QueryDelegatorValidatorRequest) 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 *QueryDelegatorValidatorRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddr) > 0 { + i -= len(m.ValidatorAddr) + copy(dAtA[i:], m.ValidatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddr) > 0 { + i -= len(m.DelegatorAddr) + copy(dAtA[i:], m.DelegatorAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDelegatorValidatorResponse) 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 *QueryDelegatorValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDelegatorValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Validator.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 *QueryHistoricalInfoRequest) 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 *QueryHistoricalInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHistoricalInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryHistoricalInfoResponse) 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 *QueryHistoricalInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHistoricalInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Hist != nil { + { + size, err := m.Hist.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 *QueryPoolRequest) 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 *QueryPoolRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryPoolResponse) 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 *QueryPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Pool.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 *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 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 *QueryValidatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Status) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Validators) > 0 { + for _, e := range m.Validators { + 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 *QueryValidatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Validator.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryValidatorDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DelegationResponses) > 0 { + for _, e := range m.DelegationResponses { + 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 *QueryValidatorUnbondingDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryValidatorUnbondingDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.UnbondingResponses) > 0 { + for _, e := range m.UnbondingResponses { + 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 *QueryDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DelegationResponse != nil { + l = m.DelegationResponse.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUnbondingDelegationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUnbondingDelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Unbond.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryDelegatorDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DelegationResponses) > 0 { + for _, e := range m.DelegationResponses { + 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 *QueryDelegatorUnbondingDelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorUnbondingDelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.UnbondingResponses) > 0 { + for _, e := range m.UnbondingResponses { + 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 *QueryRedelegationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.SrcValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.DstValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRedelegationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RedelegationResponses) > 0 { + for _, e := range m.RedelegationResponses { + 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 *QueryDelegatorValidatorsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Validators) > 0 { + for _, e := range m.Validators { + 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 *QueryDelegatorValidatorRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.ValidatorAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDelegatorValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Validator.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryHistoricalInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovQuery(uint64(m.Height)) + } + return n +} + +func (m *QueryHistoricalInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Hist != nil { + l = m.Hist.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryPoolRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Pool.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +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 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 *QueryValidatorsRequest) 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: QueryValidatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", 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.Status = string(dAtA[iNdEx:postIndex]) + 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.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorsResponse) 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: QueryValidatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", 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.Validators = append(m.Validators, Validator{}) + if err := m.Validators[len(m.Validators)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorRequest) 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: QueryValidatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorResponse) 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: QueryValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Validator.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorDelegationsRequest) 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: QueryValidatorDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + 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.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorDelegationsResponse) 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: QueryValidatorDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) + if err := m.DelegationResponses[len(m.DelegationResponses)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorUnbondingDelegationsRequest) 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: QueryValidatorUnbondingDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + 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.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryValidatorUnbondingDelegationsResponse) 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: QueryValidatorUnbondingDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) + if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegationRequest) 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: QueryDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegationResponse) 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: QueryDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponse", 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.DelegationResponse == nil { + m.DelegationResponse = &DelegationResponse{} + } + if err := m.DelegationResponse.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUnbondingDelegationRequest) 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: QueryUnbondingDelegationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUnbondingDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUnbondingDelegationResponse) 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: QueryUnbondingDelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUnbondingDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Unbond", 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.Unbond.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorDelegationsRequest) 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: QueryDelegatorDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + 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.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorDelegationsResponse) 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: QueryDelegatorDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) + if err := m.DelegationResponses[len(m.DelegationResponses)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorUnbondingDelegationsRequest) 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: QueryDelegatorUnbondingDelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + 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.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorUnbondingDelegationsResponse) 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: QueryDelegatorUnbondingDelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) + if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRedelegationsRequest) 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: QueryRedelegationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRedelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SrcValidatorAddr", 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.SrcValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DstValidatorAddr", 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.DstValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRedelegationsResponse) 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: QueryRedelegationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRedelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RedelegationResponses", 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.RedelegationResponses = append(m.RedelegationResponses, RedelegationResponse{}) + if err := m.RedelegationResponses[len(m.RedelegationResponses)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorValidatorsRequest) 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: QueryDelegatorValidatorsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + 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.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorValidatorsResponse) 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: QueryDelegatorValidatorsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validators", 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.Validators = append(m.Validators, Validator{}) + if err := m.Validators[len(m.Validators)-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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorValidatorRequest) 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: QueryDelegatorValidatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDelegatorValidatorResponse) 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: QueryDelegatorValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDelegatorValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Validator.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHistoricalInfoRequest) 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: QueryHistoricalInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHistoricalInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHistoricalInfoResponse) 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: QueryHistoricalInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHistoricalInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hist", 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.Hist == nil { + m.Hist = &HistoricalInfo{} + } + if err := m.Hist.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPoolRequest) 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: QueryPoolRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolRequest: 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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryPoolResponse) 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: QueryPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pool", 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.Pool.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 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +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 { + return ErrInvalidLengthQuery + } + if (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 { + return ErrInvalidLengthQuery + } + if (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/module-sdk/staking/staking.go b/module-sdk/staking/staking.go new file mode 100644 index 00000000..a6f4fdb4 --- /dev/null +++ b/module-sdk/staking/staking.go @@ -0,0 +1,469 @@ +package staking + +import ( + "context" + "github.com/irisnet/core-sdk-go/common" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/query" +) + +type stakingClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { + return &stakingClient{ + BaseClient: baseClient, + Marshaler: marshaler, + } +} + +func (sc stakingClient) Name() string { + return ModuleName +} + +func (sc stakingClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (sc stakingClient) CreateValidator(request CreateValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + valAddr, err := sdk.ValAddressFromBech32(delegatorAddr.String()) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + values, err := sc.ToMinCoin(request.Value) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + pk, e := sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeConsPub, request.Pubkey) + if e != nil { + return sdk.ResultTx{}, sdk.Wrap(e) + } + pkAny, e := types.PackAny(pk) + if e != nil { + return sdk.ResultTx{}, sdk.Wrap(e) + } + + msg := &MsgCreateValidator{ + Description: Description{ + Moniker: request.Moniker, + }, + Commission: CommissionRates{ + Rate: request.Rate, + MaxRate: request.MaxRate, + MaxChangeRate: request.MaxChangeRate, + }, + MinSelfDelegation: request.MinSelfDelegation, + DelegatorAddress: delegatorAddr.String(), + ValidatorAddress: valAddr.String(), + Pubkey: pkAny, + Value: values[0], + } + return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (sc stakingClient) EditValidator(request EditValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + valAddr, err := sdk.ValAddressFromBech32(delegatorAddr.String()) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgEditValidator{ + Description: Description{ + Moniker: request.Moniker, + Identity: request.Identity, + Website: request.Website, + SecurityContact: request.SecurityContact, + Details: request.Details, + }, + ValidatorAddress: valAddr.String(), + CommissionRate: &request.CommissionRate, + MinSelfDelegation: &request.MinSelfDelegation, + } + return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (sc stakingClient) Delegate(request DelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + coins, err := sc.ToMinCoin(request.Amount) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgDelegate{ + DelegatorAddress: delegatorAddr.String(), + ValidatorAddress: request.ValidatorAddr, + Amount: coins[0], + } + return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (sc stakingClient) Undelegate(request UndelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + coins, err := sc.ToMinCoin(request.Amount) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + msg := &MsgUndelegate{ + DelegatorAddress: delegatorAddr.String(), + ValidatorAddress: request.ValidatorAddr, + Amount: coins[0], + } + return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (sc stakingClient) BeginRedelegate(request BeginRedelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + coins, err := sc.ToMinCoin(request.Amount) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + msg := &MsgBeginRedelegate{ + DelegatorAddress: delegatorAddr.String(), + ValidatorSrcAddress: request.ValidatorSrcAddress, + ValidatorDstAddress: request.ValidatorDstAddress, + Amount: coins[0], + } + return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +// QueryValidators when status is "" will return all status' validator +// about status, you can see BondStatus_value +func (sc stakingClient) QueryValidators(status string, page, size uint64) (QueryValidatorsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryValidatorsResp{}, sdk.Wrap(err) + } + + offset, limit := common.ParsePage(page, size) + res, err := NewQueryClient(conn).Validators( + context.Background(), + &QueryValidatorsRequest{ + Status: status, + Pagination: &query.PageRequest{ + Offset: offset, + Limit: limit, + CountTotal: true, + }, + }, + ) + if err != nil { + return QueryValidatorsResp{}, sdk.Wrap(err) + } + return res.Convert(sc.Marshaler).(QueryValidatorsResp), nil +} + +func (sc stakingClient) QueryValidator(validatorAddr string) (QueryValidatorResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryValidatorResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Validator( + context.Background(), + &QueryValidatorRequest{ + ValidatorAddr: validatorAddr, + }, + ) + if err != nil { + return QueryValidatorResp{}, sdk.Wrap(err) + } + return res.Validator.Convert(sc.Marshaler).(QueryValidatorResp), nil +} + +func (sc stakingClient) QueryValidatorDelegations(validatorAddr string, page, size uint64) (QueryValidatorDelegationsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryValidatorDelegationsResp{}, sdk.Wrap(err) + } + + offset, limit := common.ParsePage(page, size) + res, err := NewQueryClient(conn).ValidatorDelegations( + context.Background(), + &QueryValidatorDelegationsRequest{ + ValidatorAddr: validatorAddr, + Pagination: &query.PageRequest{ + Offset: offset, + Limit: limit, + CountTotal: true, + }, + }, + ) + if err != nil { + return QueryValidatorDelegationsResp{}, sdk.Wrap(err) + } + return res.Convert().(QueryValidatorDelegationsResp), nil +} + +func (sc stakingClient) QueryValidatorUnbondingDelegations(validatorAddr string, page, size uint64) (QueryValidatorUnbondingDelegationsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryValidatorUnbondingDelegationsResp{}, sdk.Wrap(err) + } + + offset, limit := common.ParsePage(page, size) + res, err := NewQueryClient(conn).ValidatorUnbondingDelegations( + context.Background(), + &QueryValidatorUnbondingDelegationsRequest{ + ValidatorAddr: validatorAddr, + Pagination: &query.PageRequest{ + Offset: offset, + Limit: limit, + CountTotal: true, + }, + }, + ) + if err != nil { + return QueryValidatorUnbondingDelegationsResp{}, sdk.Wrap(err) + } + return res.Convert().(QueryValidatorUnbondingDelegationsResp), nil +} + +func (sc stakingClient) QueryDelegation(delegatorAddr string, validatorAddr string) (QueryDelegationResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryDelegationResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Delegation( + context.Background(), + &QueryDelegationRequest{ + DelegatorAddr: delegatorAddr, + ValidatorAddr: validatorAddr, + }, + ) + if err != nil { + return QueryDelegationResp{}, sdk.Wrap(err) + } + return res.DelegationResponse.Convert().(QueryDelegationResp), nil +} + +func (sc stakingClient) QueryUnbondingDelegation(delegatorAddr string, validatorAddr string) (QueryUnbondingDelegationResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryUnbondingDelegationResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).UnbondingDelegation( + context.Background(), + &QueryUnbondingDelegationRequest{ + DelegatorAddr: delegatorAddr, + ValidatorAddr: validatorAddr, + }, + ) + if err != nil { + return QueryUnbondingDelegationResp{}, sdk.Wrap(err) + } + return res.Unbond.Convert().(QueryUnbondingDelegationResp), nil +} + +func (sc stakingClient) QueryDelegatorDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorDelegationsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryDelegatorDelegationsResp{}, sdk.Wrap(err) + } + + offset, limit := common.ParsePage(page, size) + res, err := NewQueryClient(conn).DelegatorDelegations( + context.Background(), + &QueryDelegatorDelegationsRequest{ + DelegatorAddr: delegatorAddr, + Pagination: &query.PageRequest{ + Offset: offset, + Limit: limit, + CountTotal: true, + }, + }, + ) + if err != nil { + return QueryDelegatorDelegationsResp{}, sdk.Wrap(err) + } + return res.Convert().(QueryDelegatorDelegationsResp), nil +} + +func (sc stakingClient) QueryDelegatorUnbondingDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorUnbondingDelegationsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryDelegatorUnbondingDelegationsResp{}, sdk.Wrap(err) + } + + offset, limit := common.ParsePage(page, size) + res, err := NewQueryClient(conn).DelegatorUnbondingDelegations( + context.Background(), + &QueryDelegatorUnbondingDelegationsRequest{ + DelegatorAddr: delegatorAddr, + Pagination: &query.PageRequest{ + Offset: offset, + Limit: limit, + CountTotal: true, + }, + }, + ) + if err != nil { + return QueryDelegatorUnbondingDelegationsResp{}, sdk.Wrap(err) + } + return res.Convert().(QueryDelegatorUnbondingDelegationsResp), nil +} + +func (sc stakingClient) QueryRedelegations(request QueryRedelegationsReq) (QueryRedelegationsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryRedelegationsResp{}, sdk.Wrap(err) + } + + offset, limit := common.ParsePage(request.Page, request.Size) + res, err := NewQueryClient(conn).Redelegations( + context.Background(), + &QueryRedelegationsRequest{ + DelegatorAddr: request.DelegatorAddr, + SrcValidatorAddr: request.SrcValidatorAddr, + DstValidatorAddr: request.DstValidatorAddr, + Pagination: &query.PageRequest{ + Offset: offset, + Limit: limit, + CountTotal: true, + }, + }, + ) + if err != nil { + return QueryRedelegationsResp{}, sdk.Wrap(err) + } + return res.Convert().(QueryRedelegationsResp), nil +} + +func (sc stakingClient) QueryDelegatorValidators(delegatorAddr string, page, size uint64) (QueryDelegatorValidatorsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryDelegatorValidatorsResp{}, sdk.Wrap(err) + } + + offset, limit := common.ParsePage(page, size) + res, err := NewQueryClient(conn).DelegatorValidators( + context.Background(), + &QueryDelegatorValidatorsRequest{ + DelegatorAddr: delegatorAddr, + Pagination: &query.PageRequest{ + Offset: offset, + Limit: limit, + CountTotal: true, + }, + }, + ) + if err != nil { + return QueryDelegatorValidatorsResp{}, sdk.Wrap(err) + } + return res.Convert(sc.Marshaler).(QueryDelegatorValidatorsResp), nil +} + +func (sc stakingClient) QueryDelegatorValidator(delegatorAddr string, validatorAddr string) (QueryValidatorResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryValidatorResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).DelegatorValidator( + context.Background(), + &QueryDelegatorValidatorRequest{ + DelegatorAddr: delegatorAddr, + ValidatorAddr: validatorAddr, + }, + ) + if err != nil { + return QueryValidatorResp{}, sdk.Wrap(err) + } + return res.Validator.Convert(sc.Marshaler).(QueryValidatorResp), nil +} + +// QueryHistoricalInfo tendermint only save latest 100 block, previous block is aborted +func (sc stakingClient) QueryHistoricalInfo(height int64) (QueryHistoricalInfoResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryHistoricalInfoResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).HistoricalInfo( + context.Background(), + &QueryHistoricalInfoRequest{ + Height: height, + }, + ) + if err != nil { + return QueryHistoricalInfoResp{}, sdk.Wrap(err) + } + return res.Convert(sc.Marshaler).(QueryHistoricalInfoResp), nil +} + +func (sc stakingClient) QueryPool() (QueryPoolResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryPoolResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Pool( + context.Background(), + &QueryPoolRequest{}, + ) + if err != nil { + return QueryPoolResp{}, sdk.Wrap(err) + } + + return QueryPoolResp{ + NotBondedTokens: res.Pool.NotBondedTokens, + BondedTokens: res.Pool.BondedTokens, + }, nil +} + +func (sc stakingClient) QueryParams() (QueryParamsResp, sdk.Error) { + conn, err := sc.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Params( + context.Background(), + &QueryParamsRequest{}, + ) + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + return res.Convert().(QueryParamsResp), nil +} diff --git a/module-sdk/staking/staking.pb.go b/module-sdk/staking/staking.pb.go new file mode 100644 index 00000000..9f892aec --- /dev/null +++ b/module-sdk/staking/staking.pb.go @@ -0,0 +1,6577 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/staking/v1beta1/staking.proto + +package staking + +import ( + bytes "bytes" + compress_gzip "compress/gzip" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_protoc_gen_gogo_descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/duration" + _ "github.com/golang/protobuf/ptypes/timestamp" + types1 "github.com/irisnet/core-sdk-go/common/codec/types" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types2 "github.com/irisnet/core-sdk-go/types" + _ "github.com/regen-network/cosmos-proto" + types "github.com/tendermint/tendermint/proto/tendermint/types" + io "io" + io_ioutil "io/ioutil" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// BondStatus is the status of a validator. +type BondStatus int32 + +const ( + // UNSPECIFIED defines an invalid validator status. + Unspecified BondStatus = 0 + // UNBONDED defines a validator that is not bonded. + Unbonded BondStatus = 1 + // UNBONDING defines a validator that is unbonding. + Unbonding BondStatus = 2 + // BONDED defines a validator that is bonded. + Bonded BondStatus = 3 +) + +var BondStatus_name = map[int32]string{ + 0: "BOND_STATUS_UNSPECIFIED", + 1: "BOND_STATUS_UNBONDED", + 2: "BOND_STATUS_UNBONDING", + 3: "BOND_STATUS_BONDED", +} + +var BondStatus_value = map[string]int32{ + "BOND_STATUS_UNSPECIFIED": 0, + "BOND_STATUS_UNBONDED": 1, + "BOND_STATUS_UNBONDING": 2, + "BOND_STATUS_BONDED": 3, +} + +func (x BondStatus) String() string { + return proto.EnumName(BondStatus_name, int32(x)) +} + +func (BondStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{0} +} + +// HistoricalInfo contains header and validator information for a given block. +// It is stored as part of staking module's state, which persists the `n` most +// recent HistoricalInfo +// (`n` is set by the staking module's `historical_entries` parameter). +type HistoricalInfo struct { + Header types.Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header"` + Valset []Validator `protobuf:"bytes,2,rep,name=valset,proto3" json:"valset"` +} + +func (m *HistoricalInfo) Reset() { *m = HistoricalInfo{} } +func (m *HistoricalInfo) String() string { return proto.CompactTextString(m) } +func (*HistoricalInfo) ProtoMessage() {} +func (*HistoricalInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{0} +} +func (m *HistoricalInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistoricalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistoricalInfo.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 *HistoricalInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistoricalInfo.Merge(m, src) +} +func (m *HistoricalInfo) XXX_Size() int { + return m.Size() +} +func (m *HistoricalInfo) XXX_DiscardUnknown() { + xxx_messageInfo_HistoricalInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_HistoricalInfo proto.InternalMessageInfo + +func (m *HistoricalInfo) GetHeader() types.Header { + if m != nil { + return m.Header + } + return types.Header{} +} + +func (m *HistoricalInfo) GetValset() []Validator { + if m != nil { + return m.Valset + } + return nil +} + +// CommissionRates defines the initial commission rates to be used for creating +// a validator. +type CommissionRates struct { + Rate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"rate"` + MaxRate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,2,opt,name=max_rate,json=maxRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"max_rate" yaml:"max_rate"` + MaxChangeRate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=max_change_rate,json=maxChangeRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"max_change_rate" yaml:"max_change_rate"` +} + +func (m *CommissionRates) Reset() { *m = CommissionRates{} } +func (*CommissionRates) ProtoMessage() {} +func (*CommissionRates) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{1} +} +func (m *CommissionRates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommissionRates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommissionRates.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 *CommissionRates) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommissionRates.Merge(m, src) +} +func (m *CommissionRates) XXX_Size() int { + return m.Size() +} +func (m *CommissionRates) XXX_DiscardUnknown() { + xxx_messageInfo_CommissionRates.DiscardUnknown(m) +} + +var xxx_messageInfo_CommissionRates proto.InternalMessageInfo + +// Commission defines commission parameters for a given validator. +type Commission struct { + CommissionRates `protobuf:"bytes,1,opt,name=commission_rates,json=commissionRates,proto3,embedded=commission_rates" json:"commission_rates"` + UpdateTime time.Time `protobuf:"bytes,2,opt,name=update_time,json=updateTime,proto3,stdtime" json:"update_time" yaml:"update_time"` +} + +func (m *Commission) Reset() { *m = Commission{} } +func (*Commission) ProtoMessage() {} +func (*Commission) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{2} +} +func (m *Commission) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Commission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Commission.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 *Commission) XXX_Merge(src proto.Message) { + xxx_messageInfo_Commission.Merge(m, src) +} +func (m *Commission) XXX_Size() int { + return m.Size() +} +func (m *Commission) XXX_DiscardUnknown() { + xxx_messageInfo_Commission.DiscardUnknown(m) +} + +var xxx_messageInfo_Commission proto.InternalMessageInfo + +func (m *Commission) GetUpdateTime() time.Time { + if m != nil { + return m.UpdateTime + } + return time.Time{} +} + +// Description defines a validator description. +type Description struct { + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` + SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty" yaml:"security_contact"` + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *Description) Reset() { *m = Description{} } +func (*Description) ProtoMessage() {} +func (*Description) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{3} +} +func (m *Description) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Description) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Description.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 *Description) XXX_Merge(src proto.Message) { + xxx_messageInfo_Description.Merge(m, src) +} +func (m *Description) XXX_Size() int { + return m.Size() +} +func (m *Description) XXX_DiscardUnknown() { + xxx_messageInfo_Description.DiscardUnknown(m) +} + +var xxx_messageInfo_Description proto.InternalMessageInfo + +func (m *Description) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Description) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Description) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Description) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *Description) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// Validator defines a validator, together with the total amount of the +// Validator's bond shares and their exchange rate to coins. Slashing results in +// a decrease in the exchange rate, allowing correct calculation of future +// undelegations without iterating over delegators. When coins are delegated to +// this validator, the validator is credited with a delegation whose number of +// bond shares is based on the amount of coins delegated divided by the current +// exchange rate. Voting power can be calculated as total bonded shares +// multiplied by exchange rate. +type Validator struct { + OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty" yaml:"operator_address"` + ConsensusPubkey *types1.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` + Status BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty"` + Tokens github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"tokens"` + DelegatorShares github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` + Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` + UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` + UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` + Commission Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` + MinSelfDelegation github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` +} + +func (m *Validator) Reset() { *m = Validator{} } +func (*Validator) ProtoMessage() {} +func (*Validator) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{4} +} +func (m *Validator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Validator.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 *Validator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validator.Merge(m, src) +} +func (m *Validator) XXX_Size() int { + return m.Size() +} +func (m *Validator) XXX_DiscardUnknown() { + xxx_messageInfo_Validator.DiscardUnknown(m) +} + +var xxx_messageInfo_Validator proto.InternalMessageInfo + +// ValAddresses defines a repeated set of validator addresses. +type ValAddresses struct { + Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` +} + +func (m *ValAddresses) Reset() { *m = ValAddresses{} } +func (*ValAddresses) ProtoMessage() {} +func (*ValAddresses) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{5} +} +func (m *ValAddresses) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValAddresses.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 *ValAddresses) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValAddresses.Merge(m, src) +} +func (m *ValAddresses) XXX_Size() int { + return m.Size() +} +func (m *ValAddresses) XXX_DiscardUnknown() { + xxx_messageInfo_ValAddresses.DiscardUnknown(m) +} + +var xxx_messageInfo_ValAddresses proto.InternalMessageInfo + +func (m *ValAddresses) GetAddresses() []string { + if m != nil { + return m.Addresses + } + return nil +} + +// DVPair is struct that just has a delegator-validator pair with no other data. +// It is intended to be used as a marshalable pointer. For example, a DVPair can +// be used to construct the key to getting an UnbondingDelegation from state. +type DVPair struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` +} + +func (m *DVPair) Reset() { *m = DVPair{} } +func (*DVPair) ProtoMessage() {} +func (*DVPair) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{6} +} +func (m *DVPair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVPair.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 *DVPair) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVPair.Merge(m, src) +} +func (m *DVPair) XXX_Size() int { + return m.Size() +} +func (m *DVPair) XXX_DiscardUnknown() { + xxx_messageInfo_DVPair.DiscardUnknown(m) +} + +var xxx_messageInfo_DVPair proto.InternalMessageInfo + +// DVPairs defines an array of DVPair objects. +type DVPairs struct { + Pairs []DVPair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"` +} + +func (m *DVPairs) Reset() { *m = DVPairs{} } +func (m *DVPairs) String() string { return proto.CompactTextString(m) } +func (*DVPairs) ProtoMessage() {} +func (*DVPairs) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{7} +} +func (m *DVPairs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVPairs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVPairs.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 *DVPairs) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVPairs.Merge(m, src) +} +func (m *DVPairs) XXX_Size() int { + return m.Size() +} +func (m *DVPairs) XXX_DiscardUnknown() { + xxx_messageInfo_DVPairs.DiscardUnknown(m) +} + +var xxx_messageInfo_DVPairs proto.InternalMessageInfo + +func (m *DVPairs) GetPairs() []DVPair { + if m != nil { + return m.Pairs + } + return nil +} + +// DVVTriplet is struct that just has a delegator-validator-validator triplet +// with no other data. It is intended to be used as a marshalable pointer. For +// example, a DVVTriplet can be used to construct the key to getting a +// Redelegation from state. +type DVVTriplet struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` +} + +func (m *DVVTriplet) Reset() { *m = DVVTriplet{} } +func (*DVVTriplet) ProtoMessage() {} +func (*DVVTriplet) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{8} +} +func (m *DVVTriplet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVVTriplet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVVTriplet.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 *DVVTriplet) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVVTriplet.Merge(m, src) +} +func (m *DVVTriplet) XXX_Size() int { + return m.Size() +} +func (m *DVVTriplet) XXX_DiscardUnknown() { + xxx_messageInfo_DVVTriplet.DiscardUnknown(m) +} + +var xxx_messageInfo_DVVTriplet proto.InternalMessageInfo + +// DVVTriplets defines an array of DVVTriplet objects. +type DVVTriplets struct { + Triplets []DVVTriplet `protobuf:"bytes,1,rep,name=triplets,proto3" json:"triplets"` +} + +func (m *DVVTriplets) Reset() { *m = DVVTriplets{} } +func (m *DVVTriplets) String() string { return proto.CompactTextString(m) } +func (*DVVTriplets) ProtoMessage() {} +func (*DVVTriplets) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{9} +} +func (m *DVVTriplets) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVVTriplets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVVTriplets.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 *DVVTriplets) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVVTriplets.Merge(m, src) +} +func (m *DVVTriplets) XXX_Size() int { + return m.Size() +} +func (m *DVVTriplets) XXX_DiscardUnknown() { + xxx_messageInfo_DVVTriplets.DiscardUnknown(m) +} + +var xxx_messageInfo_DVVTriplets proto.InternalMessageInfo + +func (m *DVVTriplets) GetTriplets() []DVVTriplet { + if m != nil { + return m.Triplets + } + return nil +} + +// Delegation represents the bond with tokens held by an account. It is +// owned by one delegator, and is associated with the voting power of one +// validator. +type Delegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + Shares github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"shares"` +} + +func (m *Delegation) Reset() { *m = Delegation{} } +func (*Delegation) ProtoMessage() {} +func (*Delegation) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{10} +} +func (m *Delegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Delegation.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 *Delegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Delegation.Merge(m, src) +} +func (m *Delegation) XXX_Size() int { + return m.Size() +} +func (m *Delegation) XXX_DiscardUnknown() { + xxx_messageInfo_Delegation.DiscardUnknown(m) +} + +var xxx_messageInfo_Delegation proto.InternalMessageInfo + +// UnbondingDelegation stores all of a single delegator's unbonding bonds +// for a single validator in an time-ordered list. +type UnbondingDelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + Entries []UnbondingDelegationEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries"` +} + +func (m *UnbondingDelegation) Reset() { *m = UnbondingDelegation{} } +func (*UnbondingDelegation) ProtoMessage() {} +func (*UnbondingDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{11} +} +func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnbondingDelegation.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 *UnbondingDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnbondingDelegation.Merge(m, src) +} +func (m *UnbondingDelegation) XXX_Size() int { + return m.Size() +} +func (m *UnbondingDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_UnbondingDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_UnbondingDelegation proto.InternalMessageInfo + +// UnbondingDelegationEntry defines an unbonding object with relevant metadata. +type UnbondingDelegationEntry struct { + CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` + InitialBalance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"initial_balance" yaml:"initial_balance"` + Balance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"balance"` +} + +func (m *UnbondingDelegationEntry) Reset() { *m = UnbondingDelegationEntry{} } +func (*UnbondingDelegationEntry) ProtoMessage() {} +func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{12} +} +func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnbondingDelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnbondingDelegationEntry.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 *UnbondingDelegationEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnbondingDelegationEntry.Merge(m, src) +} +func (m *UnbondingDelegationEntry) XXX_Size() int { + return m.Size() +} +func (m *UnbondingDelegationEntry) XXX_DiscardUnknown() { + xxx_messageInfo_UnbondingDelegationEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_UnbondingDelegationEntry proto.InternalMessageInfo + +func (m *UnbondingDelegationEntry) GetCreationHeight() int64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *UnbondingDelegationEntry) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +// RedelegationEntry defines a redelegation object with relevant metadata. +type RedelegationEntry struct { + CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` + InitialBalance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"initial_balance" yaml:"initial_balance"` + SharesDst github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,4,opt,name=shares_dst,json=sharesDst,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"shares_dst"` +} + +func (m *RedelegationEntry) Reset() { *m = RedelegationEntry{} } +func (*RedelegationEntry) ProtoMessage() {} +func (*RedelegationEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{13} +} +func (m *RedelegationEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedelegationEntry.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 *RedelegationEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedelegationEntry.Merge(m, src) +} +func (m *RedelegationEntry) XXX_Size() int { + return m.Size() +} +func (m *RedelegationEntry) XXX_DiscardUnknown() { + xxx_messageInfo_RedelegationEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_RedelegationEntry proto.InternalMessageInfo + +func (m *RedelegationEntry) GetCreationHeight() int64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *RedelegationEntry) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +// Redelegation contains the list of a particular delegator's redelegating bonds +// from a particular source validator to a particular destination validator. +type Redelegation struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` + Entries []RedelegationEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"` +} + +func (m *Redelegation) Reset() { *m = Redelegation{} } +func (*Redelegation) ProtoMessage() {} +func (*Redelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{14} +} +func (m *Redelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Redelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Redelegation.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 *Redelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Redelegation.Merge(m, src) +} +func (m *Redelegation) XXX_Size() int { + return m.Size() +} +func (m *Redelegation) XXX_DiscardUnknown() { + xxx_messageInfo_Redelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_Redelegation proto.InternalMessageInfo + +// Params defines the parameters for the staking module. +type Params struct { + UnbondingTime time.Duration `protobuf:"bytes,1,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time" yaml:"unbonding_time"` + MaxValidators uint32 `protobuf:"varint,2,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty" yaml:"max_validators"` + MaxEntries uint32 `protobuf:"varint,3,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty" yaml:"max_entries"` + HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty" yaml:"historical_entries"` + BondDenom string `protobuf:"bytes,5,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{15} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetUnbondingTime() time.Duration { + if m != nil { + return m.UnbondingTime + } + return 0 +} + +func (m *Params) GetMaxValidators() uint32 { + if m != nil { + return m.MaxValidators + } + return 0 +} + +func (m *Params) GetMaxEntries() uint32 { + if m != nil { + return m.MaxEntries + } + return 0 +} + +func (m *Params) GetHistoricalEntries() uint32 { + if m != nil { + return m.HistoricalEntries + } + return 0 +} + +func (m *Params) GetBondDenom() string { + if m != nil { + return m.BondDenom + } + return "" +} + +// DelegationResponse is equivalent to Delegation except that it contains a +// balance in addition to shares which is more suitable for client responses. +type DelegationResponse struct { + Delegation Delegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` + Balance types2.Coin `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"` +} + +func (m *DelegationResponse) Reset() { *m = DelegationResponse{} } +func (*DelegationResponse) ProtoMessage() {} +func (*DelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{16} +} +func (m *DelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegationResponse.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 *DelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegationResponse.Merge(m, src) +} +func (m *DelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *DelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_DelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegationResponse proto.InternalMessageInfo + +func (m *DelegationResponse) GetDelegation() Delegation { + if m != nil { + return m.Delegation + } + return Delegation{} +} + +func (m *DelegationResponse) GetBalance() types2.Coin { + if m != nil { + return m.Balance + } + return types2.Coin{} +} + +// RedelegationEntryResponse is equivalent to a RedelegationEntry except that it +// contains a balance in addition to shares which is more suitable for client +// responses. +type RedelegationEntryResponse struct { + RedelegationEntry RedelegationEntry `protobuf:"bytes,1,opt,name=redelegation_entry,json=redelegationEntry,proto3" json:"redelegation_entry"` + Balance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"balance"` +} + +func (m *RedelegationEntryResponse) Reset() { *m = RedelegationEntryResponse{} } +func (m *RedelegationEntryResponse) String() string { return proto.CompactTextString(m) } +func (*RedelegationEntryResponse) ProtoMessage() {} +func (*RedelegationEntryResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{17} +} +func (m *RedelegationEntryResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedelegationEntryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedelegationEntryResponse.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 *RedelegationEntryResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedelegationEntryResponse.Merge(m, src) +} +func (m *RedelegationEntryResponse) XXX_Size() int { + return m.Size() +} +func (m *RedelegationEntryResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RedelegationEntryResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RedelegationEntryResponse proto.InternalMessageInfo + +func (m *RedelegationEntryResponse) GetRedelegationEntry() RedelegationEntry { + if m != nil { + return m.RedelegationEntry + } + return RedelegationEntry{} +} + +// RedelegationResponse is equivalent to a Redelegation except that its entries +// contain a balance in addition to shares which is more suitable for client +// responses. +type RedelegationResponse struct { + Redelegation Redelegation `protobuf:"bytes,1,opt,name=redelegation,proto3" json:"redelegation"` + Entries []RedelegationEntryResponse `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries"` +} + +func (m *RedelegationResponse) Reset() { *m = RedelegationResponse{} } +func (m *RedelegationResponse) String() string { return proto.CompactTextString(m) } +func (*RedelegationResponse) ProtoMessage() {} +func (*RedelegationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{18} +} +func (m *RedelegationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedelegationResponse.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 *RedelegationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedelegationResponse.Merge(m, src) +} +func (m *RedelegationResponse) XXX_Size() int { + return m.Size() +} +func (m *RedelegationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RedelegationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RedelegationResponse proto.InternalMessageInfo + +func (m *RedelegationResponse) GetRedelegation() Redelegation { + if m != nil { + return m.Redelegation + } + return Redelegation{} +} + +func (m *RedelegationResponse) GetEntries() []RedelegationEntryResponse { + if m != nil { + return m.Entries + } + return nil +} + +// Pool is used for tracking bonded and not-bonded token supply of the bond +// denomination. +type Pool struct { + NotBondedTokens github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,1,opt,name=not_bonded_tokens,json=notBondedTokens,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"not_bonded_tokens"` + BondedTokens github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=bonded_tokens,json=bondedTokens,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"bonded_tokens" yaml:"bonded_tokens"` +} + +func (m *Pool) Reset() { *m = Pool{} } +func (m *Pool) String() string { return proto.CompactTextString(m) } +func (*Pool) ProtoMessage() {} +func (*Pool) Descriptor() ([]byte, []int) { + return fileDescriptor_64c30c6cf92913c9, []int{19} +} +func (m *Pool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pool.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 *Pool) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pool.Merge(m, src) +} +func (m *Pool) XXX_Size() int { + return m.Size() +} +func (m *Pool) XXX_DiscardUnknown() { + xxx_messageInfo_Pool.DiscardUnknown(m) +} + +var xxx_messageInfo_Pool proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("cosmos.staking.v1beta1.BondStatus", BondStatus_name, BondStatus_value) + proto.RegisterType((*HistoricalInfo)(nil), "cosmos.staking.v1beta1.HistoricalInfo") + proto.RegisterType((*CommissionRates)(nil), "cosmos.staking.v1beta1.CommissionRates") + proto.RegisterType((*Commission)(nil), "cosmos.staking.v1beta1.Commission") + proto.RegisterType((*Description)(nil), "cosmos.staking.v1beta1.Description") + proto.RegisterType((*Validator)(nil), "cosmos.staking.v1beta1.Validator") + proto.RegisterType((*ValAddresses)(nil), "cosmos.staking.v1beta1.ValAddresses") + proto.RegisterType((*DVPair)(nil), "cosmos.staking.v1beta1.DVPair") + proto.RegisterType((*DVPairs)(nil), "cosmos.staking.v1beta1.DVPairs") + proto.RegisterType((*DVVTriplet)(nil), "cosmos.staking.v1beta1.DVVTriplet") + proto.RegisterType((*DVVTriplets)(nil), "cosmos.staking.v1beta1.DVVTriplets") + proto.RegisterType((*Delegation)(nil), "cosmos.staking.v1beta1.Delegation") + proto.RegisterType((*UnbondingDelegation)(nil), "cosmos.staking.v1beta1.UnbondingDelegation") + proto.RegisterType((*UnbondingDelegationEntry)(nil), "cosmos.staking.v1beta1.UnbondingDelegationEntry") + proto.RegisterType((*RedelegationEntry)(nil), "cosmos.staking.v1beta1.RedelegationEntry") + proto.RegisterType((*Redelegation)(nil), "cosmos.staking.v1beta1.Redelegation") + proto.RegisterType((*Params)(nil), "cosmos.staking.v1beta1.Params") + proto.RegisterType((*DelegationResponse)(nil), "cosmos.staking.v1beta1.DelegationResponse") + proto.RegisterType((*RedelegationEntryResponse)(nil), "cosmos.staking.v1beta1.RedelegationEntryResponse") + proto.RegisterType((*RedelegationResponse)(nil), "cosmos.staking.v1beta1.RedelegationResponse") + proto.RegisterType((*Pool)(nil), "cosmos.staking.v1beta1.Pool") +} + +func init() { + proto.RegisterFile("cosmos/staking/v1beta1/staking.proto", fileDescriptor_64c30c6cf92913c9) +} + +var fileDescriptor_64c30c6cf92913c9 = []byte{ + // 1808 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4d, 0x6c, 0x23, 0x49, + 0x15, 0x76, 0xdb, 0x5e, 0xc7, 0x7e, 0x4e, 0xe2, 0xa4, 0x26, 0x33, 0xeb, 0x98, 0xc1, 0xed, 0x6d, + 0x56, 0x10, 0x7e, 0xc6, 0x61, 0x32, 0x68, 0x11, 0xb9, 0xc0, 0x38, 0xce, 0x6c, 0xa2, 0x61, 0x43, + 0xb6, 0x93, 0xc9, 0x01, 0x56, 0x58, 0xe5, 0xee, 0x8a, 0xd3, 0xc4, 0xdd, 0x6d, 0x75, 0x95, 0x87, + 0xf1, 0x8d, 0xbd, 0x2d, 0xe1, 0xb2, 0x9c, 0x58, 0x0e, 0x23, 0x8d, 0xb4, 0x57, 0x8e, 0x88, 0x13, + 0x82, 0xeb, 0xc2, 0x69, 0xb8, 0x21, 0x84, 0x0c, 0x9a, 0xb9, 0x20, 0x4e, 0xc8, 0x07, 0x6e, 0x48, + 0xa8, 0x7e, 0xfa, 0x27, 0xed, 0x78, 0x67, 0xd6, 0xda, 0xc3, 0x4a, 0x70, 0x49, 0x5c, 0xaf, 0xde, + 0xfb, 0x5e, 0xbd, 0xdf, 0x7a, 0xd5, 0xf0, 0xba, 0xe5, 0x53, 0xd7, 0xa7, 0x9b, 0x94, 0xe1, 0x73, + 0xc7, 0xeb, 0x6d, 0x3e, 0xbc, 0xdd, 0x25, 0x0c, 0xdf, 0x0e, 0xd7, 0xcd, 0x41, 0xe0, 0x33, 0x1f, + 0xdd, 0x90, 0x5c, 0xcd, 0x90, 0xaa, 0xb8, 0x6a, 0x6b, 0x3d, 0xbf, 0xe7, 0x0b, 0x96, 0x4d, 0xfe, + 0x4b, 0x72, 0xd7, 0xd6, 0x7b, 0xbe, 0xdf, 0xeb, 0x93, 0x4d, 0xb1, 0xea, 0x0e, 0x4f, 0x37, 0xb1, + 0x37, 0x52, 0x5b, 0xf5, 0xf4, 0x96, 0x3d, 0x0c, 0x30, 0x73, 0x7c, 0x4f, 0xed, 0xeb, 0xe9, 0x7d, + 0xe6, 0xb8, 0x84, 0x32, 0xec, 0x0e, 0x42, 0x6c, 0x79, 0x92, 0x8e, 0x54, 0xaa, 0x8e, 0xa5, 0xb0, + 0x95, 0x29, 0x5d, 0x4c, 0x49, 0x64, 0x87, 0xe5, 0x3b, 0x21, 0xf6, 0x4d, 0x46, 0x3c, 0x9b, 0x04, + 0xae, 0xe3, 0xb1, 0x4d, 0x36, 0x1a, 0x10, 0x2a, 0xff, 0xca, 0x5d, 0xe3, 0xa7, 0x1a, 0x2c, 0xef, + 0x39, 0x94, 0xf9, 0x81, 0x63, 0xe1, 0xfe, 0xbe, 0x77, 0xea, 0xa3, 0x37, 0xa0, 0x70, 0x46, 0xb0, + 0x4d, 0x82, 0xaa, 0xd6, 0xd0, 0x36, 0xca, 0x5b, 0xd5, 0x66, 0x8c, 0xd0, 0x94, 0xb2, 0x7b, 0x62, + 0xbf, 0x95, 0xff, 0x68, 0xac, 0x67, 0x4c, 0xc5, 0x8d, 0xbe, 0x0d, 0x85, 0x87, 0xb8, 0x4f, 0x09, + 0xab, 0x66, 0x1b, 0xb9, 0x8d, 0xf2, 0xd6, 0x6b, 0xcd, 0xab, 0xdd, 0xd7, 0x3c, 0xc1, 0x7d, 0xc7, + 0xc6, 0xcc, 0x8f, 0x00, 0xa4, 0x98, 0xf1, 0xbb, 0x2c, 0x54, 0x76, 0x7c, 0xd7, 0x75, 0x28, 0x75, + 0x7c, 0xcf, 0xc4, 0x8c, 0x50, 0xf4, 0x26, 0xe4, 0x03, 0xcc, 0x88, 0x38, 0x4a, 0xa9, 0x75, 0x87, + 0xf3, 0xff, 0x65, 0xac, 0x7f, 0xb5, 0xe7, 0xb0, 0xb3, 0x61, 0xb7, 0x69, 0xf9, 0xee, 0xa6, 0x13, + 0x38, 0xd4, 0x23, 0x4c, 0xfc, 0x3f, 0x1b, 0x76, 0x6f, 0x51, 0xfb, 0xfc, 0x56, 0xcf, 0x57, 0x46, + 0xb6, 0x89, 0x65, 0x0a, 0x00, 0x84, 0xa1, 0xe8, 0xe2, 0x47, 0x1d, 0x01, 0x96, 0x15, 0x60, 0xf7, + 0xe6, 0x00, 0x9b, 0x8c, 0xf5, 0xca, 0x08, 0xbb, 0xfd, 0x6d, 0x23, 0x04, 0x33, 0xcc, 0x05, 0x17, + 0x3f, 0xe2, 0x87, 0x45, 0x43, 0xa8, 0x70, 0xaa, 0x75, 0x86, 0xbd, 0x1e, 0x91, 0x9a, 0x72, 0x42, + 0xd3, 0x5b, 0xf3, 0x69, 0xba, 0x11, 0x6b, 0x4a, 0x60, 0x1a, 0xe6, 0x92, 0x8b, 0x1f, 0xed, 0x08, + 0x02, 0x57, 0xbb, 0x5d, 0xfc, 0xe0, 0x89, 0x9e, 0xf9, 0xc7, 0x13, 0x5d, 0x33, 0xfe, 0xa4, 0x01, + 0xc4, 0x0e, 0x44, 0xef, 0xc0, 0x8a, 0x15, 0xad, 0x84, 0x2c, 0x55, 0x21, 0xfd, 0xd2, 0xac, 0xd0, + 0xa4, 0xdc, 0xdf, 0x2a, 0xf2, 0x93, 0x3f, 0x1d, 0xeb, 0x9a, 0x59, 0xb1, 0x52, 0x91, 0xf9, 0x01, + 0x94, 0x87, 0x03, 0x1b, 0x33, 0xd2, 0xe1, 0xc9, 0x2a, 0x7c, 0x5a, 0xde, 0xaa, 0x35, 0x65, 0x26, + 0x37, 0xc3, 0x4c, 0x6e, 0x1e, 0x87, 0x99, 0xdc, 0xaa, 0x73, 0xac, 0xc9, 0x58, 0x47, 0xd2, 0xac, + 0x84, 0xb0, 0xf1, 0xfe, 0xdf, 0x74, 0xcd, 0x04, 0x49, 0xe1, 0x02, 0x09, 0x9b, 0xfe, 0xa0, 0x41, + 0xb9, 0x4d, 0xa8, 0x15, 0x38, 0x03, 0x5e, 0x30, 0xa8, 0x0a, 0x0b, 0xae, 0xef, 0x39, 0xe7, 0x2a, + 0x3d, 0x4b, 0x66, 0xb8, 0x44, 0x35, 0x28, 0x3a, 0x36, 0xf1, 0x98, 0xc3, 0x46, 0x32, 0xc2, 0x66, + 0xb4, 0xe6, 0x52, 0x3f, 0x26, 0x5d, 0xea, 0x84, 0x21, 0x31, 0xc3, 0x25, 0xba, 0x07, 0x2b, 0x94, + 0x58, 0xc3, 0xc0, 0x61, 0xa3, 0x8e, 0xe5, 0x7b, 0x0c, 0x5b, 0xac, 0x9a, 0x17, 0x51, 0xfb, 0xdc, + 0x64, 0xac, 0xbf, 0x2a, 0xcf, 0x9a, 0xe6, 0x30, 0xcc, 0x4a, 0x48, 0xda, 0x91, 0x14, 0xae, 0xc1, + 0x26, 0x0c, 0x3b, 0x7d, 0x5a, 0x7d, 0x45, 0x6a, 0x50, 0xcb, 0x84, 0x2d, 0xbf, 0x5d, 0x80, 0x52, + 0x94, 0xfc, 0x5c, 0xb3, 0x3f, 0x20, 0x01, 0xff, 0xdd, 0xc1, 0xb6, 0x1d, 0x10, 0x4a, 0x55, 0x9a, + 0x27, 0x34, 0xa7, 0x39, 0x0c, 0xb3, 0x12, 0x92, 0xee, 0x4a, 0x0a, 0x62, 0x3c, 0xcc, 0x1e, 0x25, + 0x1e, 0x1d, 0xd2, 0xce, 0x60, 0xd8, 0x3d, 0x27, 0x23, 0x15, 0x8d, 0xb5, 0xa9, 0x68, 0xdc, 0xf5, + 0x46, 0xad, 0x3b, 0x31, 0x7a, 0x5a, 0xce, 0xf8, 0xe3, 0xaf, 0x6f, 0xad, 0xa9, 0xd4, 0xb0, 0x82, + 0xd1, 0x80, 0xf9, 0xcd, 0xc3, 0x61, 0xf7, 0x3e, 0x19, 0xf1, 0xf0, 0x2b, 0xd6, 0x43, 0xc1, 0x89, + 0x6e, 0x40, 0xe1, 0x47, 0xd8, 0xe9, 0x13, 0x5b, 0x38, 0xb4, 0x68, 0xaa, 0x15, 0xda, 0x86, 0x02, + 0x65, 0x98, 0x0d, 0xa9, 0xf0, 0xe2, 0xf2, 0x96, 0x31, 0x2b, 0xd5, 0x5a, 0xbe, 0x67, 0x1f, 0x09, + 0x4e, 0x53, 0x49, 0xa0, 0xfb, 0x50, 0x60, 0xfe, 0x39, 0xf1, 0x94, 0x0b, 0x3f, 0x79, 0xb9, 0xef, + 0x7b, 0xcc, 0x54, 0x10, 0x68, 0x04, 0x2b, 0x36, 0xe9, 0x93, 0x9e, 0xf0, 0x1e, 0x3d, 0xc3, 0x01, + 0xa1, 0xd5, 0x82, 0x80, 0x3d, 0x98, 0xaf, 0x1c, 0x95, 0xcf, 0xd2, 0xa0, 0x86, 0x59, 0x89, 0x48, + 0x47, 0x82, 0x82, 0xee, 0x43, 0xd9, 0x8e, 0x53, 0xb6, 0xba, 0x20, 0x82, 0xf1, 0x85, 0x59, 0x8e, + 0x48, 0x64, 0xb7, 0x6a, 0x88, 0x49, 0x69, 0x9e, 0x26, 0x43, 0xaf, 0xeb, 0x7b, 0xb6, 0xe3, 0xf5, + 0x3a, 0x67, 0xc4, 0xe9, 0x9d, 0xb1, 0x6a, 0xb1, 0xa1, 0x6d, 0xe4, 0x92, 0x69, 0x92, 0xe6, 0x30, + 0xcc, 0x4a, 0x44, 0xda, 0x13, 0x14, 0x64, 0xc3, 0x72, 0xcc, 0x25, 0x4a, 0xb6, 0xf4, 0xc2, 0x92, + 0x7d, 0x4d, 0x95, 0xec, 0xf5, 0xb4, 0x96, 0xb8, 0x6a, 0x97, 0x22, 0x22, 0x17, 0x43, 0x7b, 0x00, + 0x71, 0xa3, 0xa8, 0x82, 0xd0, 0x60, 0xbc, 0xb8, 0xdb, 0x28, 0xc3, 0x13, 0xb2, 0xe8, 0x5d, 0x0d, + 0xae, 0xb9, 0x8e, 0xd7, 0xa1, 0xa4, 0x7f, 0xda, 0x51, 0x1e, 0xe6, 0x98, 0x65, 0x11, 0xc3, 0xb7, + 0xe7, 0x48, 0x8d, 0xc9, 0x58, 0xaf, 0xa9, 0x96, 0x3a, 0x8d, 0x6b, 0x98, 0xab, 0xae, 0xe3, 0x1d, + 0x91, 0xfe, 0x69, 0x3b, 0xa2, 0x6d, 0x2f, 0xbe, 0xf7, 0x44, 0xcf, 0xa8, 0xf2, 0xcd, 0x18, 0x6f, + 0xc0, 0xe2, 0x09, 0xee, 0xab, 0xb2, 0x23, 0x14, 0xdd, 0x84, 0x12, 0x0e, 0x17, 0x55, 0xad, 0x91, + 0xdb, 0x28, 0x99, 0x31, 0x41, 0x96, 0xfd, 0x4f, 0xfe, 0xda, 0xd0, 0x8c, 0x5f, 0x69, 0x50, 0x68, + 0x9f, 0x1c, 0x62, 0x27, 0x40, 0xfb, 0xb0, 0x1a, 0xe7, 0xcf, 0xe5, 0xa2, 0xbf, 0x39, 0x19, 0xeb, + 0xd5, 0x74, 0x8a, 0x45, 0x55, 0x1f, 0xe7, 0x72, 0x58, 0xf6, 0xfb, 0xb0, 0xfa, 0x30, 0xec, 0x25, + 0x11, 0x54, 0x36, 0x0d, 0x35, 0xc5, 0x62, 0x98, 0x2b, 0x11, 0x4d, 0x41, 0xa5, 0xcc, 0xdc, 0x85, + 0x05, 0x79, 0x5a, 0x8a, 0xb6, 0xe1, 0x95, 0x01, 0xff, 0x21, 0xac, 0x2b, 0x6f, 0xd5, 0x67, 0xa6, + 0xb0, 0xe0, 0x57, 0x41, 0x94, 0x22, 0xc6, 0xcf, 0xb3, 0x00, 0xed, 0x93, 0x93, 0xe3, 0xc0, 0x19, + 0xf4, 0x09, 0xfb, 0x34, 0x2d, 0x3f, 0x86, 0xeb, 0xb1, 0x59, 0x34, 0xb0, 0x52, 0xd6, 0x37, 0x26, + 0x63, 0xfd, 0x66, 0xda, 0xfa, 0x04, 0x9b, 0x61, 0x5e, 0x8b, 0xe8, 0x47, 0x81, 0x75, 0x25, 0xaa, + 0x4d, 0x59, 0x84, 0x9a, 0x9b, 0x8d, 0x9a, 0x60, 0x4b, 0xa2, 0xb6, 0x29, 0xbb, 0xda, 0xb5, 0x47, + 0x50, 0x8e, 0x5d, 0x42, 0x51, 0x1b, 0x8a, 0x4c, 0xfd, 0x56, 0x1e, 0x36, 0x66, 0x7b, 0x38, 0x14, + 0x53, 0x5e, 0x8e, 0x24, 0x8d, 0xff, 0x68, 0x00, 0x71, 0xce, 0x7e, 0x36, 0x53, 0x8c, 0xb7, 0x76, + 0xd5, 0x83, 0x73, 0xf3, 0x4f, 0x72, 0x0a, 0x22, 0xe5, 0xd4, 0x9f, 0x65, 0xe1, 0xda, 0x83, 0xb0, + 0x09, 0x7d, 0xe6, 0x1d, 0x71, 0x08, 0x0b, 0xc4, 0x63, 0x81, 0x23, 0x3c, 0xc1, 0x43, 0xfe, 0xf5, + 0x59, 0x21, 0xbf, 0xc2, 0xa6, 0x5d, 0x8f, 0x05, 0x23, 0x95, 0x00, 0x21, 0x4c, 0xca, 0x1b, 0xbf, + 0xcc, 0x41, 0x75, 0x96, 0x24, 0xda, 0x81, 0x8a, 0x15, 0x10, 0x41, 0x08, 0xaf, 0x12, 0x4d, 0x5c, + 0x25, 0xb5, 0x78, 0xdc, 0x4c, 0x31, 0x18, 0xe6, 0x72, 0x48, 0x51, 0x17, 0x49, 0x0f, 0xf8, 0x2c, + 0xc8, 0x73, 0x8f, 0x73, 0xbd, 0xe4, 0xf0, 0x67, 0xa8, 0x9b, 0x24, 0x54, 0x72, 0x19, 0x40, 0x5e, + 0x25, 0xcb, 0x31, 0x55, 0xdc, 0x25, 0x0f, 0xa1, 0xe2, 0x78, 0x0e, 0x73, 0x70, 0xbf, 0xd3, 0xc5, + 0x7d, 0xec, 0x59, 0x73, 0xcf, 0xd3, 0xb2, 0xf9, 0x2b, 0xdd, 0x29, 0x4c, 0xc3, 0x5c, 0x56, 0x94, + 0x96, 0x24, 0xa0, 0xb7, 0x60, 0x21, 0xd4, 0x97, 0x9f, 0x7f, 0x0e, 0x09, 0x31, 0x12, 0xf3, 0xdf, + 0x2f, 0x72, 0xb0, 0x6a, 0x12, 0xfb, 0xff, 0x41, 0x99, 0x23, 0x28, 0x26, 0x80, 0xac, 0x7e, 0xde, + 0x74, 0xe7, 0x8d, 0x0b, 0x6f, 0x22, 0x25, 0x09, 0xd3, 0xa6, 0x2c, 0x11, 0x99, 0x71, 0x16, 0x16, + 0x93, 0x91, 0xf9, 0x1f, 0xbd, 0xae, 0xd0, 0x7e, 0xdc, 0x9d, 0xf2, 0xa2, 0x3b, 0x7d, 0x79, 0x56, + 0x77, 0x9a, 0xca, 0xe3, 0x8f, 0x6f, 0x4b, 0xff, 0xce, 0x42, 0xe1, 0x10, 0x07, 0xd8, 0xa5, 0xc8, + 0x9a, 0x1a, 0x44, 0xe5, 0xa3, 0x74, 0x7d, 0x2a, 0x53, 0xdb, 0xea, 0x2b, 0xc9, 0x0b, 0xe6, 0xd0, + 0x0f, 0xae, 0x98, 0x43, 0xbf, 0x03, 0xcb, 0xfc, 0xdd, 0x1c, 0xd9, 0x28, 0xbd, 0xbd, 0xd4, 0x5a, + 0x8f, 0x51, 0x2e, 0xef, 0xcb, 0x67, 0x75, 0xf4, 0x3a, 0xa3, 0xe8, 0x9b, 0x50, 0xe6, 0x1c, 0x71, + 0xb3, 0xe6, 0xe2, 0x37, 0xe2, 0xf7, 0x6b, 0x62, 0xd3, 0x30, 0xc1, 0xc5, 0x8f, 0x76, 0xe5, 0x02, + 0x7d, 0x17, 0xd0, 0x59, 0xf4, 0x45, 0xa5, 0x13, 0xbb, 0x93, 0xcb, 0x7f, 0x7e, 0x32, 0xd6, 0xd7, + 0xa5, 0xfc, 0x34, 0x8f, 0x61, 0xae, 0xc6, 0xc4, 0x10, 0xed, 0x1b, 0x00, 0xdc, 0xae, 0x8e, 0x4d, + 0x3c, 0xdf, 0x55, 0xef, 0xa2, 0xeb, 0x93, 0xb1, 0xbe, 0x2a, 0x51, 0xe2, 0x3d, 0xc3, 0x2c, 0xf1, + 0x45, 0x9b, 0xff, 0x4e, 0x64, 0xf6, 0x87, 0x1a, 0xa0, 0xf8, 0x1a, 0x30, 0x09, 0x1d, 0xf0, 0x87, + 0x1c, 0x9f, 0xd3, 0x13, 0x33, 0xb5, 0xf6, 0xf1, 0x73, 0x7a, 0x2c, 0x1f, 0xce, 0xe9, 0x89, 0x4a, + 0xf9, 0x56, 0xdc, 0x2d, 0xb3, 0x2a, 0x8e, 0x0a, 0xa6, 0x8b, 0x29, 0x49, 0xcc, 0xfa, 0x4e, 0x28, + 0x3d, 0xd5, 0x19, 0x33, 0xc6, 0x53, 0x0d, 0xd6, 0xa7, 0x32, 0x2a, 0x3a, 0xec, 0x0f, 0x01, 0x05, + 0x89, 0x4d, 0xe1, 0xaf, 0x91, 0x3a, 0xf4, 0x27, 0x4e, 0xd0, 0xd5, 0x60, 0xaa, 0x03, 0x7f, 0xca, + 0x0d, 0x3f, 0x2f, 0x1c, 0xff, 0x7b, 0x0d, 0xd6, 0x92, 0x67, 0x88, 0xac, 0x39, 0x80, 0xc5, 0xe4, + 0x11, 0x94, 0x1d, 0xaf, 0xbf, 0x8c, 0x1d, 0xca, 0x84, 0x4b, 0xf2, 0xe8, 0xed, 0xb8, 0x66, 0xe5, + 0x87, 0xb7, 0xdb, 0x2f, 0xed, 0x92, 0xf0, 0x4c, 0xe9, 0xda, 0xcd, 0x8b, 0xa0, 0x5c, 0x64, 0x21, + 0x7f, 0xe8, 0xfb, 0x7d, 0xc4, 0x60, 0xd5, 0xf3, 0x59, 0x87, 0xa7, 0x17, 0xb1, 0x3b, 0xea, 0x89, + 0x2e, 0x9b, 0xe1, 0xde, 0x1c, 0x9e, 0xfa, 0xe7, 0x58, 0x9f, 0xc6, 0x33, 0x2b, 0x9e, 0xcf, 0x5a, + 0x82, 0x72, 0x2c, 0x1f, 0xf0, 0xef, 0x6a, 0xb0, 0x74, 0x59, 0xa5, 0x6c, 0x98, 0xef, 0xcc, 0xa7, + 0xf2, 0x32, 0xd6, 0x64, 0xac, 0xaf, 0xc5, 0x15, 0x14, 0x91, 0x0d, 0x73, 0xb1, 0x9b, 0x38, 0xc3, + 0x76, 0x91, 0x87, 0xf2, 0x5f, 0x4f, 0x74, 0xed, 0x2b, 0xbf, 0xd1, 0x00, 0xe2, 0x4f, 0x16, 0xe8, + 0x6b, 0xf0, 0x6a, 0xeb, 0x7b, 0x07, 0xed, 0xce, 0xd1, 0xf1, 0xdd, 0xe3, 0x07, 0x47, 0x9d, 0x07, + 0x07, 0x47, 0x87, 0xbb, 0x3b, 0xfb, 0xf7, 0xf6, 0x77, 0xdb, 0x2b, 0x99, 0x5a, 0xe5, 0xe2, 0x71, + 0xa3, 0xfc, 0xc0, 0xa3, 0x03, 0x62, 0x39, 0xa7, 0x0e, 0xb1, 0xd1, 0x17, 0x61, 0xed, 0x32, 0x37, + 0x5f, 0xed, 0xb6, 0x57, 0xb4, 0xda, 0xe2, 0xc5, 0xe3, 0x46, 0x51, 0xce, 0x6b, 0xc4, 0x46, 0x1b, + 0x70, 0x7d, 0x9a, 0x6f, 0xff, 0xe0, 0xcd, 0x95, 0x6c, 0x6d, 0xe9, 0xe2, 0x71, 0xa3, 0x14, 0x0d, + 0x76, 0xc8, 0x00, 0x94, 0xe4, 0x54, 0x78, 0xb9, 0x1a, 0x5c, 0x3c, 0x6e, 0x14, 0xa4, 0x1b, 0x6b, + 0xf9, 0xf7, 0x3e, 0xac, 0x67, 0x5a, 0xf7, 0x3f, 0x7a, 0x56, 0xd7, 0x9e, 0x3e, 0xab, 0x6b, 0x7f, + 0x7f, 0x56, 0xd7, 0xde, 0x7f, 0x5e, 0xcf, 0x3c, 0x7d, 0x5e, 0xcf, 0xfc, 0xf9, 0x79, 0x3d, 0xf3, + 0xfd, 0xdb, 0x2f, 0x76, 0xa0, 0xeb, 0xdb, 0xc3, 0x3e, 0x89, 0xbe, 0x93, 0x77, 0x0b, 0xa2, 0x37, + 0xdf, 0xf9, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xe1, 0xfb, 0x79, 0x40, 0x17, 0x00, 0x00, +} + +func (this *Pool) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { + return StakingDescription() +} +func StakingDescription() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { + d := &github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet{} + var gzipped = []byte{ + // 9503 bytes of a gzipped FileDescriptorSet + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x7d, 0x6d, 0x70, 0x24, 0xd7, + 0x71, 0xd8, 0xcd, 0xee, 0x02, 0xd8, 0x6d, 0x7c, 0x2d, 0x1e, 0x70, 0x77, 0x7b, 0xcb, 0x23, 0x00, + 0x0e, 0xbf, 0x8e, 0x47, 0x1e, 0x40, 0x1e, 0x79, 0xc7, 0xe3, 0x9e, 0x44, 0x0a, 0x0b, 0xec, 0xe1, + 0xc0, 0xc3, 0x17, 0x07, 0xc0, 0xe9, 0xd3, 0x99, 0x1a, 0xcc, 0x3e, 0x2c, 0x86, 0xd8, 0x9d, 0x19, + 0xce, 0xcc, 0xde, 0x1d, 0xa8, 0xa8, 0x8a, 0x92, 0x12, 0x47, 0xa2, 0x93, 0x58, 0x8a, 0x5d, 0xb6, + 0x44, 0xeb, 0x64, 0xc9, 0x72, 0x22, 0x47, 0x76, 0x12, 0xdb, 0x52, 0x94, 0x38, 0x71, 0x25, 0x52, + 0x52, 0x8e, 0x25, 0x55, 0xc5, 0x45, 0x95, 0x53, 0x89, 0xe3, 0x8a, 0xcf, 0x0e, 0xa5, 0x72, 0x68, + 0x45, 0x49, 0x94, 0x8b, 0xec, 0x24, 0xa5, 0x4a, 0x55, 0xea, 0x7d, 0xcd, 0xd7, 0x7e, 0xcc, 0x02, + 0xba, 0x93, 0xe4, 0x38, 0xbf, 0xb0, 0xaf, 0x5f, 0x77, 0xbf, 0xee, 0x7e, 0xdd, 0xfd, 0xfa, 0xbd, + 0x99, 0x37, 0x80, 0x7f, 0x79, 0x11, 0xa6, 0x6b, 0x96, 0x55, 0xab, 0xe3, 0x59, 0xdb, 0xb1, 0x3c, + 0x6b, 0xbb, 0xb9, 0x33, 0x5b, 0xc5, 0xae, 0xee, 0x18, 0xb6, 0x67, 0x39, 0x33, 0x14, 0x86, 0x46, + 0x19, 0xc6, 0x8c, 0xc0, 0x90, 0x57, 0x60, 0xec, 0x92, 0x51, 0xc7, 0x0b, 0x3e, 0xe2, 0x06, 0xf6, + 0xd0, 0x05, 0xc8, 0xec, 0x18, 0x75, 0x5c, 0x90, 0xa6, 0xd3, 0xa7, 0x06, 0xcf, 0x3e, 0x30, 0x13, + 0x23, 0x9a, 0x89, 0x52, 0xac, 0x13, 0xb0, 0x42, 0x29, 0xe4, 0x6f, 0x66, 0x60, 0xbc, 0x4d, 0x2f, + 0x42, 0x90, 0x31, 0xb5, 0x06, 0xe1, 0x28, 0x9d, 0xca, 0x29, 0xf4, 0x37, 0x2a, 0xc0, 0x80, 0xad, + 0xe9, 0x7b, 0x5a, 0x0d, 0x17, 0x52, 0x14, 0x2c, 0x9a, 0x68, 0x12, 0xa0, 0x8a, 0x6d, 0x6c, 0x56, + 0xb1, 0xa9, 0xef, 0x17, 0xd2, 0xd3, 0xe9, 0x53, 0x39, 0x25, 0x04, 0x41, 0x8f, 0xc2, 0x98, 0xdd, + 0xdc, 0xae, 0x1b, 0xba, 0x1a, 0x42, 0x83, 0xe9, 0xf4, 0xa9, 0x3e, 0x25, 0xcf, 0x3a, 0x16, 0x02, + 0xe4, 0x87, 0x61, 0xf4, 0x3a, 0xd6, 0xf6, 0xc2, 0xa8, 0x83, 0x14, 0x75, 0x84, 0x80, 0x43, 0x88, + 0xf3, 0x30, 0xd4, 0xc0, 0xae, 0xab, 0xd5, 0xb0, 0xea, 0xed, 0xdb, 0xb8, 0x90, 0xa1, 0xda, 0x4f, + 0xb7, 0x68, 0x1f, 0xd7, 0x7c, 0x90, 0x53, 0x6d, 0xee, 0xdb, 0x18, 0xcd, 0x41, 0x0e, 0x9b, 0xcd, + 0x06, 0xe3, 0xd0, 0xd7, 0xc1, 0x7e, 0x15, 0xb3, 0xd9, 0x88, 0x73, 0xc9, 0x12, 0x32, 0xce, 0x62, + 0xc0, 0xc5, 0xce, 0x35, 0x43, 0xc7, 0x85, 0x7e, 0xca, 0xe0, 0xe1, 0x16, 0x06, 0x1b, 0xac, 0x3f, + 0xce, 0x43, 0xd0, 0xa1, 0x79, 0xc8, 0xe1, 0x1b, 0x1e, 0x36, 0x5d, 0xc3, 0x32, 0x0b, 0x03, 0x94, + 0xc9, 0x83, 0x6d, 0x66, 0x11, 0xd7, 0xab, 0x71, 0x16, 0x01, 0x1d, 0x3a, 0x0f, 0x03, 0x96, 0xed, + 0x19, 0x96, 0xe9, 0x16, 0xb2, 0xd3, 0xd2, 0xa9, 0xc1, 0xb3, 0x27, 0xdb, 0x3a, 0xc2, 0x1a, 0xc3, + 0x51, 0x04, 0x32, 0x5a, 0x82, 0xbc, 0x6b, 0x35, 0x1d, 0x1d, 0xab, 0xba, 0x55, 0xc5, 0xaa, 0x61, + 0xee, 0x58, 0x85, 0x1c, 0x65, 0x30, 0xd5, 0xaa, 0x08, 0x45, 0x9c, 0xb7, 0xaa, 0x78, 0xc9, 0xdc, + 0xb1, 0x94, 0x11, 0x37, 0xd2, 0x46, 0xc7, 0xa0, 0xdf, 0xdd, 0x37, 0x3d, 0xed, 0x46, 0x61, 0x88, + 0x7a, 0x08, 0x6f, 0xc9, 0xbf, 0xd1, 0x0f, 0xa3, 0xbd, 0xb8, 0xd8, 0x45, 0xe8, 0xdb, 0x21, 0x5a, + 0x16, 0x52, 0x07, 0xb1, 0x01, 0xa3, 0x89, 0x1a, 0xb1, 0xff, 0x90, 0x46, 0x9c, 0x83, 0x41, 0x13, + 0xbb, 0x1e, 0xae, 0x32, 0x8f, 0x48, 0xf7, 0xe8, 0x53, 0xc0, 0x88, 0x5a, 0x5d, 0x2a, 0x73, 0x28, + 0x97, 0x7a, 0x07, 0x8c, 0xfa, 0x22, 0xa9, 0x8e, 0x66, 0xd6, 0x84, 0x6f, 0xce, 0x26, 0x49, 0x32, + 0x53, 0x11, 0x74, 0x0a, 0x21, 0x53, 0x46, 0x70, 0xa4, 0x8d, 0x16, 0x00, 0x2c, 0x13, 0x5b, 0x3b, + 0x6a, 0x15, 0xeb, 0xf5, 0x42, 0xb6, 0x83, 0x95, 0xd6, 0x08, 0x4a, 0x8b, 0x95, 0x2c, 0x06, 0xd5, + 0xeb, 0xe8, 0x99, 0xc0, 0xd5, 0x06, 0x3a, 0x78, 0xca, 0x0a, 0x0b, 0xb2, 0x16, 0x6f, 0xdb, 0x82, + 0x11, 0x07, 0x13, 0xbf, 0xc7, 0x55, 0xae, 0x59, 0x8e, 0x0a, 0x31, 0x93, 0xa8, 0x99, 0xc2, 0xc9, + 0x98, 0x62, 0xc3, 0x4e, 0xb8, 0x89, 0xee, 0x07, 0x1f, 0xa0, 0x52, 0xb7, 0x02, 0x9a, 0x85, 0x86, + 0x04, 0x70, 0x55, 0x6b, 0xe0, 0xe2, 0xcb, 0x30, 0x12, 0x35, 0x0f, 0x9a, 0x80, 0x3e, 0xd7, 0xd3, + 0x1c, 0x8f, 0x7a, 0x61, 0x9f, 0xc2, 0x1a, 0x28, 0x0f, 0x69, 0x6c, 0x56, 0x69, 0x96, 0xeb, 0x53, + 0xc8, 0x4f, 0xf4, 0xb6, 0x40, 0xe1, 0x34, 0x55, 0xf8, 0xa1, 0xd6, 0x19, 0x8d, 0x70, 0x8e, 0xeb, + 0x5d, 0x7c, 0x1a, 0x86, 0x23, 0x0a, 0xf4, 0x3a, 0xb4, 0xfc, 0x97, 0xe1, 0x68, 0x5b, 0xd6, 0xe8, + 0x1d, 0x30, 0xd1, 0x34, 0x0d, 0xd3, 0xc3, 0x8e, 0xed, 0x60, 0xe2, 0xb1, 0x6c, 0xa8, 0xc2, 0x7f, + 0x1a, 0xe8, 0xe0, 0x73, 0x5b, 0x61, 0x6c, 0xc6, 0x45, 0x19, 0x6f, 0xb6, 0x02, 0x4f, 0xe7, 0xb2, + 0x6f, 0x0e, 0xe4, 0x5f, 0x79, 0xe5, 0x95, 0x57, 0x52, 0xf2, 0x97, 0xfb, 0x61, 0xa2, 0x5d, 0xcc, + 0xb4, 0x0d, 0xdf, 0x63, 0xd0, 0x6f, 0x36, 0x1b, 0xdb, 0xd8, 0xa1, 0x46, 0xea, 0x53, 0x78, 0x0b, + 0xcd, 0x41, 0x5f, 0x5d, 0xdb, 0xc6, 0xf5, 0x42, 0x66, 0x5a, 0x3a, 0x35, 0x72, 0xf6, 0xd1, 0x9e, + 0xa2, 0x72, 0x66, 0x99, 0x90, 0x28, 0x8c, 0x12, 0x3d, 0x0b, 0x19, 0x9e, 0xa2, 0x09, 0x87, 0xd3, + 0xbd, 0x71, 0x20, 0xb1, 0xa4, 0x50, 0x3a, 0x74, 0x0f, 0xe4, 0xc8, 0x5f, 0xe6, 0x1b, 0xfd, 0x54, + 0xe6, 0x2c, 0x01, 0x10, 0xbf, 0x40, 0x45, 0xc8, 0xd2, 0x30, 0xa9, 0x62, 0xb1, 0xb4, 0xf9, 0x6d, + 0xe2, 0x58, 0x55, 0xbc, 0xa3, 0x35, 0xeb, 0x9e, 0x7a, 0x4d, 0xab, 0x37, 0x31, 0x75, 0xf8, 0x9c, + 0x32, 0xc4, 0x81, 0x57, 0x09, 0x0c, 0x4d, 0xc1, 0x20, 0x8b, 0x2a, 0xc3, 0xac, 0xe2, 0x1b, 0x34, + 0x7b, 0xf6, 0x29, 0x2c, 0xd0, 0x96, 0x08, 0x84, 0x0c, 0xff, 0xa2, 0x6b, 0x99, 0xc2, 0x35, 0xe9, + 0x10, 0x04, 0x40, 0x87, 0x7f, 0x3a, 0x9e, 0xb8, 0xef, 0x6d, 0xaf, 0x5e, 0x4b, 0x2c, 0x3d, 0x0c, + 0xa3, 0x14, 0xe3, 0x49, 0x3e, 0xf5, 0x5a, 0xbd, 0x30, 0x36, 0x2d, 0x9d, 0xca, 0x2a, 0x23, 0x0c, + 0xbc, 0xc6, 0xa1, 0xf2, 0x17, 0x53, 0x90, 0xa1, 0x89, 0x65, 0x14, 0x06, 0x37, 0xdf, 0xb9, 0x5e, + 0x51, 0x17, 0xd6, 0xb6, 0xca, 0xcb, 0x95, 0xbc, 0x84, 0x46, 0x00, 0x28, 0xe0, 0xd2, 0xf2, 0xda, + 0xdc, 0x66, 0x3e, 0xe5, 0xb7, 0x97, 0x56, 0x37, 0xcf, 0x3f, 0x95, 0x4f, 0xfb, 0x04, 0x5b, 0x0c, + 0x90, 0x09, 0x23, 0x3c, 0x79, 0x36, 0xdf, 0x87, 0xf2, 0x30, 0xc4, 0x18, 0x2c, 0xbd, 0xa3, 0xb2, + 0x70, 0xfe, 0xa9, 0x7c, 0x7f, 0x14, 0xf2, 0xe4, 0xd9, 0xfc, 0x00, 0x1a, 0x86, 0x1c, 0x85, 0x94, + 0xd7, 0xd6, 0x96, 0xf3, 0x59, 0x9f, 0xe7, 0xc6, 0xa6, 0xb2, 0xb4, 0xba, 0x98, 0xcf, 0xf9, 0x3c, + 0x17, 0x95, 0xb5, 0xad, 0xf5, 0x3c, 0xf8, 0x1c, 0x56, 0x2a, 0x1b, 0x1b, 0x73, 0x8b, 0x95, 0xfc, + 0xa0, 0x8f, 0x51, 0x7e, 0xe7, 0x66, 0x65, 0x23, 0x3f, 0x14, 0x11, 0xeb, 0xc9, 0xb3, 0xf9, 0x61, + 0x7f, 0x88, 0xca, 0xea, 0xd6, 0x4a, 0x7e, 0x04, 0x8d, 0xc1, 0x30, 0x1b, 0x42, 0x08, 0x31, 0x1a, + 0x03, 0x9d, 0x7f, 0x2a, 0x9f, 0x0f, 0x04, 0x61, 0x5c, 0xc6, 0x22, 0x80, 0xf3, 0x4f, 0xe5, 0x91, + 0x3c, 0x0f, 0x7d, 0xd4, 0x0d, 0x11, 0x82, 0x91, 0xe5, 0xb9, 0x72, 0x65, 0x59, 0x5d, 0x5b, 0xdf, + 0x5c, 0x5a, 0x5b, 0x9d, 0x5b, 0xce, 0x4b, 0x01, 0x4c, 0xa9, 0xbc, 0xb0, 0xb5, 0xa4, 0x54, 0x16, + 0xf2, 0xa9, 0x30, 0x6c, 0xbd, 0x32, 0xb7, 0x59, 0x59, 0xc8, 0xa7, 0x65, 0x1d, 0x26, 0xda, 0x25, + 0xd4, 0xb6, 0x21, 0x14, 0xf2, 0x85, 0x54, 0x07, 0x5f, 0xa0, 0xbc, 0xe2, 0xbe, 0x20, 0x7f, 0x23, + 0x05, 0xe3, 0x6d, 0x16, 0x95, 0xb6, 0x83, 0x3c, 0x07, 0x7d, 0xcc, 0x97, 0xd9, 0x32, 0xfb, 0x48, + 0xdb, 0xd5, 0x89, 0x7a, 0x76, 0xcb, 0x52, 0x4b, 0xe9, 0xc2, 0xa5, 0x46, 0xba, 0x43, 0xa9, 0x41, + 0x58, 0xb4, 0x38, 0xec, 0x8f, 0xb5, 0x24, 0x7f, 0xb6, 0x3e, 0x9e, 0xef, 0x65, 0x7d, 0xa4, 0xb0, + 0x83, 0x2d, 0x02, 0x7d, 0x6d, 0x16, 0x81, 0x8b, 0x30, 0xd6, 0xc2, 0xa8, 0xe7, 0x64, 0xfc, 0x41, + 0x09, 0x0a, 0x9d, 0x8c, 0x93, 0x90, 0x12, 0x53, 0x91, 0x94, 0x78, 0x31, 0x6e, 0xc1, 0xfb, 0x3a, + 0x4f, 0x42, 0xcb, 0x5c, 0x7f, 0x56, 0x82, 0x63, 0xed, 0x4b, 0xca, 0xb6, 0x32, 0x3c, 0x0b, 0xfd, + 0x0d, 0xec, 0xed, 0x5a, 0xa2, 0xac, 0x7a, 0xa8, 0xcd, 0x62, 0x4d, 0xba, 0xe3, 0x93, 0xcd, 0xa9, + 0xc2, 0xab, 0x7d, 0xba, 0x53, 0x5d, 0xc8, 0xa4, 0x69, 0x91, 0xf4, 0xc3, 0x29, 0x38, 0xda, 0x96, + 0x79, 0x5b, 0x41, 0xef, 0x05, 0x30, 0x4c, 0xbb, 0xe9, 0xb1, 0xd2, 0x89, 0x65, 0xe2, 0x1c, 0x85, + 0xd0, 0xe4, 0x45, 0xb2, 0x6c, 0xd3, 0xf3, 0xfb, 0xd3, 0xb4, 0x1f, 0x18, 0x88, 0x22, 0x5c, 0x08, + 0x04, 0xcd, 0x50, 0x41, 0x27, 0x3b, 0x68, 0xda, 0xe2, 0x98, 0x8f, 0x43, 0x5e, 0xaf, 0x1b, 0xd8, + 0xf4, 0x54, 0xd7, 0x73, 0xb0, 0xd6, 0x30, 0xcc, 0x1a, 0x5d, 0x6a, 0xb2, 0xa5, 0xbe, 0x1d, 0xad, + 0xee, 0x62, 0x65, 0x94, 0x75, 0x6f, 0x88, 0x5e, 0x42, 0x41, 0x1d, 0xc8, 0x09, 0x51, 0xf4, 0x47, + 0x28, 0x58, 0xb7, 0x4f, 0x21, 0x7f, 0x34, 0x07, 0x83, 0xa1, 0x02, 0x1c, 0xdd, 0x07, 0x43, 0x2f, + 0x6a, 0xd7, 0x34, 0x55, 0x6c, 0xaa, 0x98, 0x25, 0x06, 0x09, 0x6c, 0x9d, 0x6f, 0xac, 0x1e, 0x87, + 0x09, 0x8a, 0x62, 0x35, 0x3d, 0xec, 0xa8, 0x7a, 0x5d, 0x73, 0x5d, 0x6a, 0xb4, 0x2c, 0x45, 0x45, + 0xa4, 0x6f, 0x8d, 0x74, 0xcd, 0x8b, 0x1e, 0x74, 0x0e, 0xc6, 0x29, 0x45, 0xa3, 0x59, 0xf7, 0x0c, + 0xbb, 0x8e, 0x55, 0xb2, 0xcd, 0x73, 0xe9, 0x92, 0xe3, 0x4b, 0x36, 0x46, 0x30, 0x56, 0x38, 0x02, + 0x91, 0xc8, 0x45, 0x0b, 0x70, 0x2f, 0x25, 0xab, 0x61, 0x13, 0x3b, 0x9a, 0x87, 0x55, 0xfc, 0x52, + 0x53, 0xab, 0xbb, 0xaa, 0x66, 0x56, 0xd5, 0x5d, 0xcd, 0xdd, 0x2d, 0x4c, 0x10, 0x06, 0xe5, 0x54, + 0x41, 0x52, 0x4e, 0x10, 0xc4, 0x45, 0x8e, 0x57, 0xa1, 0x68, 0x73, 0x66, 0xf5, 0xb2, 0xe6, 0xee, + 0xa2, 0x12, 0x1c, 0xa3, 0x5c, 0x5c, 0xcf, 0x31, 0xcc, 0x9a, 0xaa, 0xef, 0x62, 0x7d, 0x4f, 0x6d, + 0x7a, 0x3b, 0x17, 0x0a, 0xf7, 0x84, 0xc7, 0xa7, 0x12, 0x6e, 0x50, 0x9c, 0x79, 0x82, 0xb2, 0xe5, + 0xed, 0x5c, 0x40, 0x1b, 0x30, 0x44, 0x26, 0xa3, 0x61, 0xbc, 0x8c, 0xd5, 0x1d, 0xcb, 0xa1, 0x6b, + 0xe8, 0x48, 0x9b, 0xd4, 0x14, 0xb2, 0xe0, 0xcc, 0x1a, 0x27, 0x58, 0xb1, 0xaa, 0xb8, 0xd4, 0xb7, + 0xb1, 0x5e, 0xa9, 0x2c, 0x28, 0x83, 0x82, 0xcb, 0x25, 0xcb, 0x21, 0x0e, 0x55, 0xb3, 0x7c, 0x03, + 0x0f, 0x32, 0x87, 0xaa, 0x59, 0xc2, 0xbc, 0xe7, 0x60, 0x5c, 0xd7, 0x99, 0xce, 0x86, 0xae, 0xf2, + 0xcd, 0x98, 0x5b, 0xc8, 0x47, 0x8c, 0xa5, 0xeb, 0x8b, 0x0c, 0x81, 0xfb, 0xb8, 0x8b, 0x9e, 0x81, + 0xa3, 0x81, 0xb1, 0xc2, 0x84, 0x63, 0x2d, 0x5a, 0xc6, 0x49, 0xcf, 0xc1, 0xb8, 0xbd, 0xdf, 0x4a, + 0x88, 0x22, 0x23, 0xda, 0xfb, 0x71, 0xb2, 0xa7, 0x61, 0xc2, 0xde, 0xb5, 0x5b, 0xe9, 0x4e, 0x87, + 0xe9, 0x90, 0xbd, 0x6b, 0xc7, 0x09, 0x1f, 0xa4, 0x3b, 0x73, 0x07, 0xeb, 0x9a, 0x87, 0xab, 0x85, + 0xe3, 0x61, 0xf4, 0x50, 0x07, 0x9a, 0x81, 0xbc, 0xae, 0xab, 0xd8, 0xd4, 0xb6, 0xeb, 0x58, 0xd5, + 0x1c, 0x6c, 0x6a, 0x6e, 0x61, 0x8a, 0x22, 0x67, 0x3c, 0xa7, 0x89, 0x95, 0x11, 0x5d, 0xaf, 0xd0, + 0xce, 0x39, 0xda, 0x87, 0x4e, 0xc3, 0x98, 0xb5, 0xfd, 0xa2, 0xce, 0x3c, 0x52, 0xb5, 0x1d, 0xbc, + 0x63, 0xdc, 0x28, 0x3c, 0x40, 0xcd, 0x3b, 0x4a, 0x3a, 0xa8, 0x3f, 0xae, 0x53, 0x30, 0x7a, 0x04, + 0xf2, 0xba, 0xbb, 0xab, 0x39, 0x36, 0x4d, 0xc9, 0xae, 0xad, 0xe9, 0xb8, 0xf0, 0x20, 0x43, 0x65, + 0xf0, 0x55, 0x01, 0x26, 0x11, 0xe1, 0x5e, 0x37, 0x76, 0x3c, 0xc1, 0xf1, 0x61, 0x16, 0x11, 0x14, + 0xc6, 0xb9, 0x9d, 0x82, 0x3c, 0xb1, 0x44, 0x64, 0xe0, 0x53, 0x14, 0x6d, 0xc4, 0xde, 0xb5, 0xc3, + 0xe3, 0xde, 0x0f, 0xc3, 0x04, 0x33, 0x18, 0xf4, 0x11, 0x56, 0xb8, 0xd9, 0xbb, 0xa1, 0x11, 0x9f, + 0x82, 0x63, 0x04, 0xa9, 0x81, 0x3d, 0xad, 0xaa, 0x79, 0x5a, 0x08, 0xfb, 0x31, 0x8a, 0x4d, 0xcc, + 0xbe, 0xc2, 0x3b, 0x23, 0x72, 0x3a, 0xcd, 0xed, 0x7d, 0xdf, 0xb1, 0xce, 0x30, 0x39, 0x09, 0x4c, + 0xb8, 0xd6, 0x5d, 0x2b, 0xce, 0xe5, 0x12, 0x0c, 0x85, 0xfd, 0x1e, 0xe5, 0x80, 0x79, 0x7e, 0x5e, + 0x22, 0x45, 0xd0, 0xfc, 0xda, 0x02, 0x29, 0x5f, 0xde, 0x55, 0xc9, 0xa7, 0x48, 0x19, 0xb5, 0xbc, + 0xb4, 0x59, 0x51, 0x95, 0xad, 0xd5, 0xcd, 0xa5, 0x95, 0x4a, 0x3e, 0x1d, 0x2a, 0xec, 0x9f, 0xcf, + 0x64, 0x1f, 0xca, 0x3f, 0x2c, 0x7f, 0x3d, 0x05, 0x23, 0xd1, 0x9d, 0x1a, 0x7a, 0x0b, 0x1c, 0x17, + 0xc7, 0x2a, 0x2e, 0xf6, 0xd4, 0xeb, 0x86, 0x43, 0x03, 0xb2, 0xa1, 0xb1, 0xc5, 0xd1, 0xf7, 0x9f, + 0x09, 0x8e, 0xb5, 0x81, 0xbd, 0xb7, 0x1b, 0x0e, 0x09, 0xb7, 0x86, 0xe6, 0xa1, 0x65, 0x98, 0x32, + 0x2d, 0xd5, 0xf5, 0x34, 0xb3, 0xaa, 0x39, 0x55, 0x35, 0x38, 0xd0, 0x52, 0x35, 0x5d, 0xc7, 0xae, + 0x6b, 0xb1, 0x85, 0xd0, 0xe7, 0x72, 0xd2, 0xb4, 0x36, 0x38, 0x72, 0xb0, 0x42, 0xcc, 0x71, 0xd4, + 0x98, 0xfb, 0xa6, 0x3b, 0xb9, 0xef, 0x3d, 0x90, 0x6b, 0x68, 0xb6, 0x8a, 0x4d, 0xcf, 0xd9, 0xa7, + 0xf5, 0x79, 0x56, 0xc9, 0x36, 0x34, 0xbb, 0x42, 0xda, 0x3f, 0x90, 0x6d, 0xd2, 0xf3, 0x99, 0x6c, + 0x36, 0x9f, 0x7b, 0x3e, 0x93, 0xcd, 0xe5, 0x41, 0x7e, 0x23, 0x0d, 0x43, 0xe1, 0x7a, 0x9d, 0x6c, + 0x7f, 0x74, 0xba, 0x62, 0x49, 0x34, 0xa7, 0xdd, 0xdf, 0xb5, 0xba, 0x9f, 0x99, 0x27, 0x4b, 0x59, + 0xa9, 0x9f, 0x15, 0xc7, 0x0a, 0xa3, 0x24, 0x65, 0x04, 0x71, 0x36, 0xcc, 0x8a, 0x91, 0xac, 0xc2, + 0x5b, 0x68, 0x11, 0xfa, 0x5f, 0x74, 0x29, 0xef, 0x7e, 0xca, 0xfb, 0x81, 0xee, 0xbc, 0x9f, 0xdf, + 0xa0, 0xcc, 0x73, 0xcf, 0x6f, 0xa8, 0xab, 0x6b, 0xca, 0xca, 0xdc, 0xb2, 0xc2, 0xc9, 0xd1, 0x09, + 0xc8, 0xd4, 0xb5, 0x97, 0xf7, 0xa3, 0x8b, 0x1e, 0x05, 0xf5, 0x3a, 0x09, 0x27, 0x20, 0x73, 0x1d, + 0x6b, 0x7b, 0xd1, 0xa5, 0x86, 0x82, 0xee, 0x62, 0x30, 0xcc, 0x42, 0x1f, 0xb5, 0x17, 0x02, 0xe0, + 0x16, 0xcb, 0x1f, 0x41, 0x59, 0xc8, 0xcc, 0xaf, 0x29, 0x24, 0x20, 0xf2, 0x30, 0xc4, 0xa0, 0xea, + 0xfa, 0x52, 0x65, 0xbe, 0x92, 0x4f, 0xc9, 0xe7, 0xa0, 0x9f, 0x19, 0x81, 0x04, 0x8b, 0x6f, 0x86, + 0xfc, 0x11, 0xde, 0xe4, 0x3c, 0x24, 0xd1, 0xbb, 0xb5, 0x52, 0xae, 0x28, 0xf9, 0x54, 0x74, 0xaa, + 0x33, 0xf9, 0x3e, 0xd9, 0x85, 0xa1, 0x70, 0x1d, 0xfe, 0x83, 0xd9, 0x8c, 0x7f, 0x49, 0x82, 0xc1, + 0x50, 0x5d, 0x4d, 0x0a, 0x22, 0xad, 0x5e, 0xb7, 0xae, 0xab, 0x5a, 0xdd, 0xd0, 0x5c, 0xee, 0x1a, + 0x40, 0x41, 0x73, 0x04, 0xd2, 0xeb, 0xd4, 0xfd, 0x80, 0x42, 0xa4, 0x2f, 0xdf, 0x2f, 0x7f, 0x52, + 0x82, 0x7c, 0xbc, 0xb0, 0x8d, 0x89, 0x29, 0xfd, 0x30, 0xc5, 0x94, 0x3f, 0x21, 0xc1, 0x48, 0xb4, + 0x9a, 0x8d, 0x89, 0x77, 0xdf, 0x0f, 0x55, 0xbc, 0x3f, 0x4a, 0xc1, 0x70, 0xa4, 0x86, 0xed, 0x55, + 0xba, 0x97, 0x60, 0xcc, 0xa8, 0xe2, 0x86, 0x6d, 0x79, 0xd8, 0xd4, 0xf7, 0xd5, 0x3a, 0xbe, 0x86, + 0xeb, 0x05, 0x99, 0x26, 0x8d, 0xd9, 0xee, 0x55, 0xf2, 0xcc, 0x52, 0x40, 0xb7, 0x4c, 0xc8, 0x4a, + 0xe3, 0x4b, 0x0b, 0x95, 0x95, 0xf5, 0xb5, 0xcd, 0xca, 0xea, 0xfc, 0x3b, 0xd5, 0xad, 0xd5, 0x2b, + 0xab, 0x6b, 0x6f, 0x5f, 0x55, 0xf2, 0x46, 0x0c, 0xed, 0x2e, 0x86, 0xfd, 0x3a, 0xe4, 0xe3, 0x42, + 0xa1, 0xe3, 0xd0, 0x4e, 0xac, 0xfc, 0x11, 0x34, 0x0e, 0xa3, 0xab, 0x6b, 0xea, 0xc6, 0xd2, 0x42, + 0x45, 0xad, 0x5c, 0xba, 0x54, 0x99, 0xdf, 0xdc, 0x60, 0xe7, 0x1e, 0x3e, 0xf6, 0x66, 0x24, 0xc0, + 0xe5, 0xd7, 0xd2, 0x30, 0xde, 0x46, 0x12, 0x34, 0xc7, 0x77, 0x2c, 0x6c, 0x13, 0x75, 0xa6, 0x17, + 0xe9, 0x67, 0x48, 0xcd, 0xb0, 0xae, 0x39, 0x1e, 0xdf, 0xe0, 0x3c, 0x02, 0xc4, 0x4a, 0xa6, 0x67, + 0xec, 0x18, 0xd8, 0xe1, 0xe7, 0x49, 0x6c, 0x1b, 0x33, 0x1a, 0xc0, 0xd9, 0x91, 0xd2, 0x63, 0x80, + 0x6c, 0xcb, 0x35, 0x3c, 0xe3, 0x1a, 0x56, 0x0d, 0x53, 0x1c, 0x3e, 0x91, 0x6d, 0x4d, 0x46, 0xc9, + 0x8b, 0x9e, 0x25, 0xd3, 0xf3, 0xb1, 0x4d, 0x5c, 0xd3, 0x62, 0xd8, 0x24, 0x99, 0xa7, 0x95, 0xbc, + 0xe8, 0xf1, 0xb1, 0xef, 0x83, 0xa1, 0xaa, 0xd5, 0x24, 0xb5, 0x1e, 0xc3, 0x23, 0x6b, 0x87, 0xa4, + 0x0c, 0x32, 0x98, 0x8f, 0xc2, 0xab, 0xf8, 0xe0, 0xd4, 0x6b, 0x48, 0x19, 0x64, 0x30, 0x86, 0xf2, + 0x30, 0x8c, 0x6a, 0xb5, 0x9a, 0x43, 0x98, 0x0b, 0x46, 0x6c, 0x5f, 0x32, 0xe2, 0x83, 0x29, 0x62, + 0xf1, 0x79, 0xc8, 0x0a, 0x3b, 0x90, 0xa5, 0x9a, 0x58, 0x42, 0xb5, 0xd9, 0x66, 0x3b, 0x75, 0x2a, + 0xa7, 0x64, 0x4d, 0xd1, 0x79, 0x1f, 0x0c, 0x19, 0xae, 0x1a, 0x1c, 0xe2, 0xa7, 0xa6, 0x53, 0xa7, + 0xb2, 0xca, 0xa0, 0xe1, 0xfa, 0x07, 0xa0, 0xf2, 0x67, 0x53, 0x30, 0x12, 0x7d, 0x08, 0x81, 0x16, + 0x20, 0x5b, 0xb7, 0x74, 0x8d, 0xba, 0x16, 0x7b, 0x02, 0x76, 0x2a, 0xe1, 0xb9, 0xc5, 0xcc, 0x32, + 0xc7, 0x57, 0x7c, 0xca, 0xe2, 0xef, 0x48, 0x90, 0x15, 0x60, 0x74, 0x0c, 0x32, 0xb6, 0xe6, 0xed, + 0x52, 0x76, 0x7d, 0xe5, 0x54, 0x5e, 0x52, 0x68, 0x9b, 0xc0, 0x5d, 0x5b, 0x33, 0xa9, 0x0b, 0x70, + 0x38, 0x69, 0x93, 0x79, 0xad, 0x63, 0xad, 0x4a, 0x37, 0x3d, 0x56, 0xa3, 0x81, 0x4d, 0xcf, 0x15, + 0xf3, 0xca, 0xe1, 0xf3, 0x1c, 0x8c, 0x1e, 0x85, 0x31, 0xcf, 0xd1, 0x8c, 0x7a, 0x04, 0x37, 0x43, + 0x71, 0xf3, 0xa2, 0xc3, 0x47, 0x2e, 0xc1, 0x09, 0xc1, 0xb7, 0x8a, 0x3d, 0x4d, 0xdf, 0xc5, 0xd5, + 0x80, 0xa8, 0x9f, 0x1e, 0x6e, 0x1c, 0xe7, 0x08, 0x0b, 0xbc, 0x5f, 0xd0, 0xca, 0x5f, 0x97, 0x60, + 0x4c, 0x6c, 0xd3, 0xaa, 0xbe, 0xb1, 0x56, 0x00, 0x34, 0xd3, 0xb4, 0xbc, 0xb0, 0xb9, 0x5a, 0x5d, + 0xb9, 0x85, 0x6e, 0x66, 0xce, 0x27, 0x52, 0x42, 0x0c, 0x8a, 0x0d, 0x80, 0xa0, 0xa7, 0xa3, 0xd9, + 0xa6, 0x60, 0x90, 0x3f, 0x61, 0xa2, 0x8f, 0x29, 0xd9, 0xc6, 0x1e, 0x18, 0x88, 0xec, 0xe7, 0xd0, + 0x04, 0xf4, 0x6d, 0xe3, 0x9a, 0x61, 0xf2, 0x73, 0x63, 0xd6, 0x10, 0xc7, 0x2f, 0x19, 0xff, 0xf8, + 0xa5, 0xfc, 0x93, 0x12, 0x8c, 0xeb, 0x56, 0x23, 0x2e, 0x6f, 0x39, 0x1f, 0x3b, 0x5d, 0x70, 0x2f, + 0x4b, 0xef, 0x7a, 0xb6, 0x66, 0x78, 0xbb, 0xcd, 0xed, 0x19, 0xdd, 0x6a, 0xcc, 0xd6, 0xac, 0xba, + 0x66, 0xd6, 0x82, 0xe7, 0xac, 0xf4, 0x87, 0x7e, 0xa6, 0x86, 0xcd, 0x33, 0x35, 0x2b, 0xf4, 0xd4, + 0xf5, 0x62, 0xf0, 0xf3, 0x7f, 0x49, 0xd2, 0x2f, 0xa4, 0xd2, 0x8b, 0xeb, 0xe5, 0xcf, 0xa5, 0x8a, + 0x8b, 0x6c, 0xb8, 0x75, 0x61, 0x1e, 0x05, 0xef, 0xd4, 0xb1, 0x4e, 0x54, 0x86, 0x6f, 0x3d, 0x0a, + 0x13, 0x35, 0xab, 0x66, 0x51, 0x8e, 0xb3, 0xe4, 0x17, 0x7f, 0x72, 0x9b, 0xf3, 0xa1, 0xc5, 0xc4, + 0xc7, 0xbc, 0xa5, 0x55, 0x18, 0xe7, 0xc8, 0x2a, 0x7d, 0x74, 0xc4, 0x36, 0x36, 0xa8, 0xeb, 0xa9, + 0x5a, 0xe1, 0xd7, 0xbe, 0x49, 0x17, 0x74, 0x65, 0x8c, 0x93, 0x92, 0x3e, 0xb6, 0xf7, 0x29, 0x29, + 0x70, 0x34, 0xc2, 0x8f, 0x85, 0x2d, 0x76, 0x12, 0x38, 0xfe, 0x16, 0xe7, 0x38, 0x1e, 0xe2, 0xb8, + 0xc1, 0x49, 0x4b, 0xf3, 0x30, 0x7c, 0x10, 0x5e, 0xff, 0x8a, 0xf3, 0x1a, 0xc2, 0x61, 0x26, 0x8b, + 0x30, 0x4a, 0x99, 0xe8, 0x4d, 0xd7, 0xb3, 0x1a, 0x34, 0x27, 0x76, 0x67, 0xf3, 0xdb, 0xdf, 0x64, + 0x71, 0x34, 0x42, 0xc8, 0xe6, 0x7d, 0xaa, 0x52, 0x09, 0xe8, 0xd3, 0xb2, 0x2a, 0xd6, 0xeb, 0x09, + 0x1c, 0xbe, 0xc2, 0x05, 0xf1, 0xf1, 0x4b, 0x57, 0x61, 0x82, 0xfc, 0xa6, 0x29, 0x2b, 0x2c, 0x49, + 0xf2, 0x11, 0x5c, 0xe1, 0xeb, 0x1f, 0x64, 0xa1, 0x3a, 0xee, 0x33, 0x08, 0xc9, 0x14, 0x9a, 0xc5, + 0x1a, 0xf6, 0x3c, 0xec, 0xb8, 0xaa, 0x56, 0x6f, 0x27, 0x5e, 0xe8, 0x0c, 0xa3, 0xf0, 0xf1, 0x6f, + 0x47, 0x67, 0x71, 0x91, 0x51, 0xce, 0xd5, 0xeb, 0xa5, 0x2d, 0x38, 0xde, 0xc6, 0x2b, 0x7a, 0xe0, + 0xf9, 0x1a, 0xe7, 0x39, 0xd1, 0xe2, 0x19, 0x84, 0xed, 0x3a, 0x08, 0xb8, 0x3f, 0x97, 0x3d, 0xf0, + 0xfc, 0x39, 0xce, 0x13, 0x71, 0x5a, 0x31, 0xa5, 0x84, 0xe3, 0xf3, 0x30, 0x76, 0x0d, 0x3b, 0xdb, + 0x96, 0xcb, 0xcf, 0x8d, 0x7a, 0x60, 0xf7, 0x09, 0xce, 0x6e, 0x94, 0x13, 0xd2, 0x83, 0x24, 0xc2, + 0xeb, 0x19, 0xc8, 0xee, 0x68, 0x3a, 0xee, 0x81, 0xc5, 0x4d, 0xce, 0x62, 0x80, 0xe0, 0x13, 0xd2, + 0x39, 0x18, 0xaa, 0x59, 0x7c, 0xd5, 0x4a, 0x26, 0xff, 0x24, 0x27, 0x1f, 0x14, 0x34, 0x9c, 0x85, + 0x6d, 0xd9, 0xcd, 0x3a, 0x59, 0xd2, 0x92, 0x59, 0xfc, 0xbc, 0x60, 0x21, 0x68, 0x38, 0x8b, 0x03, + 0x98, 0xf5, 0x53, 0x82, 0x85, 0x1b, 0xb2, 0xe7, 0x73, 0x30, 0x68, 0x99, 0xf5, 0x7d, 0xcb, 0xec, + 0x45, 0x88, 0x4f, 0x73, 0x0e, 0xc0, 0x49, 0x08, 0x83, 0x8b, 0x90, 0xeb, 0x75, 0x22, 0xfe, 0xf6, + 0xb7, 0x45, 0x78, 0x88, 0x19, 0x58, 0x84, 0x51, 0x91, 0xa0, 0x0c, 0xcb, 0xec, 0x81, 0xc5, 0xdf, + 0xe1, 0x2c, 0x46, 0x42, 0x64, 0x5c, 0x0d, 0x0f, 0xbb, 0x5e, 0x0d, 0xf7, 0xc2, 0xe4, 0xb3, 0x42, + 0x0d, 0x4e, 0xc2, 0x4d, 0xb9, 0x8d, 0x4d, 0x7d, 0xb7, 0x37, 0x0e, 0xbf, 0x24, 0x4c, 0x29, 0x68, + 0x08, 0x8b, 0x79, 0x18, 0x6e, 0x68, 0x8e, 0xbb, 0xab, 0xd5, 0x7b, 0x9a, 0x8e, 0xbf, 0xcb, 0x79, + 0x0c, 0xf9, 0x44, 0xdc, 0x22, 0x4d, 0xf3, 0x20, 0x6c, 0x3e, 0x27, 0x2c, 0x12, 0x22, 0xe3, 0xa1, + 0xe7, 0x7a, 0xf4, 0x90, 0xed, 0x20, 0xdc, 0x7e, 0x59, 0x84, 0x1e, 0xa3, 0x5d, 0x09, 0x73, 0xbc, + 0x08, 0x39, 0xd7, 0x78, 0xb9, 0x27, 0x36, 0xbf, 0x22, 0x66, 0x9a, 0x12, 0x10, 0xe2, 0x77, 0xc2, + 0x89, 0xb6, 0xcb, 0x44, 0x0f, 0xcc, 0xfe, 0x1e, 0x67, 0x76, 0xac, 0xcd, 0x52, 0xc1, 0x53, 0xc2, + 0x41, 0x59, 0xfe, 0x7d, 0x91, 0x12, 0x70, 0x8c, 0xd7, 0x3a, 0xd9, 0x47, 0xb8, 0xda, 0xce, 0xc1, + 0xac, 0xf6, 0x0f, 0x84, 0xd5, 0x18, 0x6d, 0xc4, 0x6a, 0x9b, 0x70, 0x8c, 0x73, 0x3c, 0xd8, 0xbc, + 0xfe, 0xaa, 0x48, 0xac, 0x8c, 0x7a, 0x2b, 0x3a, 0xbb, 0xef, 0x86, 0xa2, 0x6f, 0x4e, 0x51, 0xb0, + 0xba, 0x6a, 0x43, 0xb3, 0x7b, 0xe0, 0xfc, 0x6b, 0x9c, 0xb3, 0xc8, 0xf8, 0x7e, 0xc5, 0xeb, 0xae, + 0x68, 0x36, 0x61, 0xfe, 0x0e, 0x28, 0x08, 0xe6, 0x4d, 0xd3, 0xc1, 0xba, 0x55, 0x33, 0x8d, 0x97, + 0x71, 0xb5, 0x07, 0xd6, 0xbf, 0x1e, 0x9b, 0xaa, 0xad, 0x10, 0x39, 0xe1, 0xbc, 0x04, 0x79, 0xbf, + 0x56, 0x51, 0x8d, 0x86, 0x6d, 0x39, 0x5e, 0x02, 0xc7, 0xcf, 0x8b, 0x99, 0xf2, 0xe9, 0x96, 0x28, + 0x59, 0xa9, 0x02, 0xec, 0xc9, 0x73, 0xaf, 0x2e, 0xf9, 0x05, 0xce, 0x68, 0x38, 0xa0, 0xe2, 0x89, + 0x43, 0xb7, 0x1a, 0xb6, 0xe6, 0xf4, 0x92, 0xff, 0xfe, 0xa1, 0x48, 0x1c, 0x9c, 0x84, 0x27, 0x0e, + 0x6f, 0xdf, 0xc6, 0x64, 0xb5, 0xef, 0x81, 0xc3, 0x17, 0x45, 0xe2, 0x10, 0x34, 0x9c, 0x85, 0x28, + 0x18, 0x7a, 0x60, 0xf1, 0x8f, 0x04, 0x0b, 0x41, 0x43, 0x58, 0xbc, 0x10, 0x2c, 0xb4, 0x0e, 0xae, + 0x19, 0xae, 0xe7, 0xb0, 0x32, 0xb9, 0x3b, 0xab, 0x7f, 0xfc, 0xed, 0x68, 0x11, 0xa6, 0x84, 0x48, + 0x49, 0x26, 0xe2, 0xc7, 0xae, 0x74, 0x17, 0x95, 0x2c, 0xd8, 0x6f, 0x88, 0x4c, 0x14, 0x22, 0x23, + 0xb2, 0x85, 0x2a, 0x44, 0x62, 0x76, 0x9d, 0xec, 0x1d, 0x7a, 0x60, 0xf7, 0x4f, 0x62, 0xc2, 0x6d, + 0x08, 0x5a, 0xc2, 0x33, 0x54, 0xff, 0x34, 0xcd, 0x3d, 0xbc, 0xdf, 0x93, 0x77, 0xfe, 0xd3, 0x58, + 0xfd, 0xb3, 0xc5, 0x28, 0x59, 0x0e, 0x19, 0x8d, 0xd5, 0x53, 0x28, 0xe9, 0x3d, 0xa3, 0xc2, 0xfb, + 0xbf, 0xcb, 0xf5, 0x8d, 0x96, 0x53, 0xa5, 0x65, 0xe2, 0xe4, 0xd1, 0xa2, 0x27, 0x99, 0xd9, 0x07, + 0xbf, 0xeb, 0xfb, 0x79, 0xa4, 0xe6, 0x29, 0x5d, 0x82, 0xe1, 0x48, 0xc1, 0x93, 0xcc, 0xea, 0xaf, + 0x70, 0x56, 0x43, 0xe1, 0x7a, 0xa7, 0x74, 0x0e, 0x32, 0xa4, 0x78, 0x49, 0x26, 0xff, 0xab, 0x9c, + 0x9c, 0xa2, 0x97, 0xde, 0x0a, 0x59, 0x51, 0xb4, 0x24, 0x93, 0xfe, 0x38, 0x27, 0xf5, 0x49, 0x08, + 0xb9, 0x28, 0x58, 0x92, 0xc9, 0xff, 0x9a, 0x20, 0x17, 0x24, 0x84, 0xbc, 0x77, 0x13, 0x7e, 0xe9, + 0x27, 0x32, 0x7c, 0xd1, 0x11, 0xb6, 0xbb, 0x08, 0x03, 0xbc, 0x52, 0x49, 0xa6, 0xfe, 0x30, 0x1f, + 0x5c, 0x50, 0x94, 0x9e, 0x86, 0xbe, 0x1e, 0x0d, 0xfe, 0x37, 0x38, 0x29, 0xc3, 0x2f, 0xcd, 0xc3, + 0x60, 0xa8, 0x3a, 0x49, 0x26, 0xff, 0x9b, 0x9c, 0x3c, 0x4c, 0x45, 0x44, 0xe7, 0xd5, 0x49, 0x32, + 0x83, 0x9f, 0x14, 0xa2, 0x73, 0x0a, 0x62, 0x36, 0x51, 0x98, 0x24, 0x53, 0x7f, 0x44, 0x58, 0x5d, + 0x90, 0x94, 0x9e, 0x83, 0x9c, 0xbf, 0xd8, 0x24, 0xd3, 0x7f, 0x94, 0xd3, 0x07, 0x34, 0xc4, 0x02, + 0xa1, 0xc5, 0x2e, 0x99, 0xc5, 0xdf, 0x12, 0x16, 0x08, 0x51, 0x91, 0x30, 0x8a, 0x17, 0x30, 0xc9, + 0x9c, 0x7e, 0x4a, 0x84, 0x51, 0xac, 0x7e, 0x21, 0xb3, 0x49, 0x73, 0x7e, 0x32, 0x8b, 0x9f, 0x16, + 0xb3, 0x49, 0xf1, 0x89, 0x18, 0xf1, 0x8a, 0x20, 0x99, 0xc7, 0xcf, 0x0a, 0x31, 0x62, 0x05, 0x41, + 0x69, 0x1d, 0x50, 0x6b, 0x35, 0x90, 0xcc, 0xef, 0x63, 0x9c, 0xdf, 0x58, 0x4b, 0x31, 0x50, 0x7a, + 0x3b, 0x1c, 0x6b, 0x5f, 0x09, 0x24, 0x73, 0xfd, 0xf8, 0x77, 0x63, 0x7b, 0xb7, 0x70, 0x21, 0x50, + 0xda, 0x0c, 0x96, 0x94, 0x70, 0x15, 0x90, 0xcc, 0xf6, 0xb5, 0xef, 0x46, 0x13, 0x77, 0xb8, 0x08, + 0x28, 0xcd, 0x01, 0x04, 0x0b, 0x70, 0x32, 0xaf, 0x4f, 0x70, 0x5e, 0x21, 0x22, 0x12, 0x1a, 0x7c, + 0xfd, 0x4d, 0xa6, 0xbf, 0x29, 0x42, 0x83, 0x53, 0x90, 0xd0, 0x10, 0x4b, 0x6f, 0x32, 0xf5, 0x27, + 0x45, 0x68, 0x08, 0x12, 0xe2, 0xd9, 0xa1, 0xd5, 0x2d, 0x99, 0xc3, 0xa7, 0x85, 0x67, 0x87, 0xa8, + 0x4a, 0xab, 0x30, 0xd6, 0xb2, 0x20, 0x26, 0xb3, 0xfa, 0x05, 0xce, 0x2a, 0x1f, 0x5f, 0x0f, 0xc3, + 0x8b, 0x17, 0x5f, 0x0c, 0x93, 0xb9, 0x7d, 0x26, 0xb6, 0x78, 0xf1, 0xb5, 0xb0, 0x74, 0x11, 0xb2, + 0x66, 0xb3, 0x5e, 0x27, 0xc1, 0x83, 0xba, 0xbf, 0x1b, 0x58, 0xf8, 0x93, 0xef, 0x71, 0xeb, 0x08, + 0x82, 0xd2, 0x39, 0xe8, 0xc3, 0x8d, 0x6d, 0x5c, 0x4d, 0xa2, 0xfc, 0xd6, 0xf7, 0x44, 0xc2, 0x24, + 0xd8, 0xa5, 0xe7, 0x00, 0xd8, 0xd1, 0x08, 0x7d, 0x3c, 0x98, 0x40, 0xfb, 0x9f, 0xbf, 0xc7, 0x5f, + 0xc6, 0x09, 0x48, 0x02, 0x06, 0xec, 0xd5, 0x9e, 0xee, 0x0c, 0xbe, 0x1d, 0x65, 0x40, 0x67, 0xe4, + 0x19, 0x18, 0x78, 0xd1, 0xb5, 0x4c, 0x4f, 0xab, 0x25, 0x51, 0xff, 0x17, 0x4e, 0x2d, 0xf0, 0x89, + 0xc1, 0x1a, 0x96, 0x83, 0x3d, 0xad, 0xe6, 0x26, 0xd1, 0xfe, 0x57, 0x4e, 0xeb, 0x13, 0x10, 0x62, + 0x5d, 0x73, 0xbd, 0x5e, 0xf4, 0xfe, 0x6f, 0x82, 0x58, 0x10, 0x10, 0xa1, 0xc9, 0xef, 0x3d, 0xbc, + 0x9f, 0x44, 0xfb, 0x1d, 0x21, 0x34, 0xc7, 0x2f, 0xbd, 0x15, 0x72, 0xe4, 0x27, 0x7b, 0xc3, 0x2e, + 0x81, 0xf8, 0xbf, 0x73, 0xe2, 0x80, 0x82, 0x8c, 0xec, 0x7a, 0x55, 0xcf, 0x48, 0x36, 0xf6, 0x6d, + 0x3e, 0xd3, 0x02, 0xbf, 0x34, 0x07, 0x83, 0xae, 0x57, 0xad, 0x36, 0x79, 0x7d, 0x9a, 0x40, 0xfe, + 0x3f, 0xbe, 0xe7, 0x1f, 0x59, 0xf8, 0x34, 0x64, 0xb6, 0xaf, 0xef, 0x79, 0xb6, 0x45, 0x1f, 0x81, + 0x24, 0x71, 0xf8, 0x2e, 0xe7, 0x10, 0x22, 0x29, 0xcd, 0xc3, 0x10, 0xd1, 0xc5, 0xc1, 0x36, 0xa6, + 0xcf, 0xab, 0x12, 0x58, 0xfc, 0x29, 0x37, 0x40, 0x84, 0xa8, 0xfc, 0x63, 0x5f, 0x79, 0x63, 0x52, + 0x7a, 0xfd, 0x8d, 0x49, 0xe9, 0x8f, 0xde, 0x98, 0x94, 0x3e, 0xf2, 0x8d, 0xc9, 0x23, 0xaf, 0x7f, + 0x63, 0xf2, 0xc8, 0xef, 0x7d, 0x63, 0xf2, 0x48, 0xfb, 0x63, 0x63, 0x58, 0xb4, 0x16, 0x2d, 0x76, + 0x60, 0xfc, 0x2e, 0x39, 0x72, 0x5c, 0x5c, 0xb3, 0x82, 0xd3, 0x5a, 0x7f, 0x93, 0x03, 0x7f, 0x2a, + 0x91, 0x0d, 0x73, 0xf4, 0x2c, 0x57, 0x33, 0xf7, 0x3b, 0xdc, 0xd5, 0x29, 0xb6, 0x3d, 0x18, 0x96, + 0xdf, 0x02, 0xe9, 0x39, 0x73, 0x1f, 0x9d, 0x60, 0x39, 0x4f, 0x6d, 0x3a, 0x75, 0xfe, 0xe6, 0xd7, + 0x00, 0x69, 0x6f, 0x39, 0x75, 0x34, 0x11, 0xbc, 0x9e, 0x29, 0x9d, 0x1a, 0xe2, 0xef, 0x5c, 0x96, + 0x32, 0xdf, 0xf9, 0xf4, 0xd4, 0x91, 0xf2, 0x5e, 0x5c, 0xc3, 0x2f, 0x25, 0x6a, 0x99, 0x9d, 0x33, + 0xf7, 0xa9, 0x92, 0xeb, 0xd2, 0xbb, 0xfa, 0xc8, 0x18, 0xae, 0x38, 0xd8, 0x9e, 0x8c, 0x1f, 0x6c, + 0xbf, 0x1d, 0xd7, 0xeb, 0x57, 0x4c, 0xeb, 0xba, 0xb9, 0x49, 0xd0, 0xb6, 0xfb, 0xd9, 0x6b, 0xc4, + 0xf0, 0x91, 0x14, 0x4c, 0xc5, 0xf5, 0x26, 0x8e, 0xe3, 0x7a, 0x5a, 0xc3, 0xee, 0x74, 0x53, 0xe9, + 0x22, 0xe4, 0x36, 0x05, 0x0e, 0x2a, 0xc0, 0x80, 0x8b, 0x75, 0xcb, 0xac, 0xba, 0x54, 0xd9, 0xb4, + 0x22, 0x9a, 0x44, 0x59, 0x53, 0x33, 0x2d, 0x97, 0xbf, 0x1f, 0xc9, 0x1a, 0xe5, 0x9f, 0x91, 0x0e, + 0x36, 0x93, 0x23, 0xfe, 0x50, 0x42, 0xd3, 0x47, 0xbb, 0x1d, 0xff, 0x53, 0x2b, 0x04, 0x2a, 0x84, + 0xce, 0xfa, 0x7b, 0x35, 0xc9, 0x07, 0xd2, 0x70, 0x42, 0xb7, 0xdc, 0x86, 0xe5, 0xaa, 0x6c, 0x86, + 0x59, 0x83, 0x1b, 0x63, 0x28, 0xdc, 0xd5, 0xc3, 0xf9, 0xff, 0x65, 0x18, 0xa1, 0x51, 0x40, 0x4f, + 0x3e, 0x69, 0xe2, 0x49, 0x5c, 0x2b, 0xbe, 0xfa, 0x6f, 0xfb, 0xa8, 0xd7, 0x0c, 0xfb, 0x84, 0xf4, + 0xd5, 0x8e, 0x4d, 0x98, 0x30, 0x1a, 0x76, 0x1d, 0xd3, 0x67, 0x40, 0xaa, 0xdf, 0x97, 0xcc, 0xef, + 0x6b, 0x9c, 0xdf, 0x78, 0x40, 0xbe, 0x24, 0xa8, 0x4b, 0xcb, 0x30, 0xa6, 0xe9, 0x3a, 0xb6, 0x23, + 0x2c, 0x13, 0x22, 0x54, 0x08, 0x98, 0xe7, 0x94, 0x3e, 0xb7, 0xf2, 0x73, 0x9d, 0xe6, 0xf6, 0x5d, + 0x0f, 0x86, 0x26, 0xcd, 0xc1, 0x35, 0x6c, 0x9e, 0x31, 0xb1, 0x77, 0xdd, 0x72, 0xf6, 0xb8, 0x79, + 0xcf, 0xb0, 0xa1, 0xc4, 0x24, 0x7c, 0x38, 0x0d, 0x93, 0xac, 0x63, 0x76, 0x5b, 0x73, 0xf1, 0xec, + 0xb5, 0x27, 0xb6, 0xb1, 0xa7, 0x3d, 0x31, 0xab, 0x5b, 0x86, 0xc9, 0x67, 0x62, 0x9c, 0xcf, 0x0b, + 0xe9, 0x9f, 0xe1, 0xfd, 0x1d, 0x02, 0x73, 0x11, 0x32, 0xf3, 0x96, 0x61, 0x12, 0x8f, 0xac, 0x62, + 0xd3, 0x6a, 0xf0, 0xb0, 0x64, 0x0d, 0x74, 0x3f, 0xf4, 0x6b, 0x0d, 0xab, 0x69, 0x7a, 0xec, 0xf1, + 0x55, 0x79, 0xf0, 0x2b, 0xb7, 0xa6, 0x8e, 0xfc, 0xfe, 0xad, 0xa9, 0xf4, 0x92, 0xe9, 0x29, 0xbc, + 0xab, 0x94, 0x79, 0xf3, 0x53, 0x53, 0x92, 0xfc, 0x3c, 0x0c, 0x2c, 0x60, 0xfd, 0x30, 0xbc, 0x16, + 0xb0, 0x1e, 0xe3, 0xf5, 0x08, 0x64, 0x97, 0x4c, 0x8f, 0xbd, 0x32, 0x7b, 0x2f, 0xa4, 0x0d, 0x93, + 0xbd, 0x85, 0x15, 0x1b, 0x9f, 0xc0, 0x09, 0xea, 0x02, 0xd6, 0x7d, 0xd4, 0x2a, 0xd6, 0xe3, 0xa8, + 0x84, 0x3d, 0x81, 0x97, 0x97, 0x7e, 0xef, 0x3f, 0x4e, 0x1e, 0x79, 0xe5, 0x8d, 0xc9, 0x23, 0x1d, + 0x67, 0xe2, 0xe1, 0xd0, 0x4c, 0x18, 0x8e, 0xe1, 0x9a, 0xd8, 0xa3, 0x7f, 0x77, 0x9b, 0xdb, 0x67, + 0xdc, 0xea, 0xde, 0x99, 0x9a, 0x35, 0xeb, 0x45, 0x02, 0xe2, 0xaf, 0xa7, 0x60, 0xb2, 0xc5, 0xcf, + 0xf9, 0xea, 0xd0, 0x29, 0x45, 0x94, 0x20, 0xbb, 0x20, 0x16, 0x9d, 0x83, 0x66, 0x88, 0x9f, 0x3e, + 0x60, 0x86, 0x18, 0x16, 0x23, 0x89, 0x04, 0x71, 0x3a, 0x39, 0x41, 0x08, 0xf9, 0x0f, 0x91, 0x1f, + 0xfe, 0xb5, 0x04, 0xd3, 0xf4, 0x06, 0x89, 0xd3, 0x30, 0x4c, 0x6f, 0xb6, 0x6e, 0x6c, 0xbb, 0xb3, + 0xdb, 0x86, 0xe7, 0x32, 0xab, 0x71, 0x83, 0x4c, 0x04, 0x18, 0x33, 0x04, 0x63, 0x86, 0x60, 0xc8, + 0x4f, 0x41, 0xb6, 0x6c, 0x78, 0x73, 0x8e, 0xa3, 0xed, 0x23, 0x04, 0x19, 0x02, 0xe3, 0x26, 0xa1, + 0xbf, 0x89, 0x3d, 0x70, 0x1d, 0x37, 0x5c, 0xfa, 0x14, 0x3a, 0xa3, 0xb0, 0x46, 0x79, 0xab, 0xe3, + 0x54, 0x5e, 0x0c, 0x29, 0x1a, 0x12, 0x29, 0xf4, 0x93, 0x85, 0x42, 0x3b, 0x71, 0x7d, 0x7d, 0x3e, + 0x97, 0x81, 0x7b, 0x43, 0x08, 0xba, 0xb3, 0x6f, 0x7b, 0x74, 0x8d, 0xb4, 0x76, 0xb8, 0x32, 0x63, + 0x21, 0x65, 0x58, 0x77, 0x87, 0x38, 0xdb, 0x81, 0xbe, 0x75, 0x42, 0x47, 0x14, 0xf1, 0x2c, 0x4f, + 0xab, 0x73, 0xed, 0x58, 0x83, 0x40, 0xd9, 0x2d, 0x9a, 0x14, 0x83, 0x1a, 0xe2, 0x02, 0x4d, 0x1d, + 0x6b, 0x3b, 0xec, 0x65, 0xe4, 0x34, 0x5d, 0x17, 0xb3, 0x04, 0x40, 0xdf, 0x3b, 0x9e, 0x80, 0x3e, + 0xad, 0xc9, 0x9e, 0xa3, 0xa7, 0xc9, 0x82, 0x49, 0x1b, 0xf2, 0x15, 0x18, 0xe0, 0xcf, 0xee, 0x50, + 0x1e, 0xd2, 0x7b, 0x78, 0x9f, 0x8e, 0x33, 0xa4, 0x90, 0x9f, 0x68, 0x06, 0xfa, 0xa8, 0xf0, 0xfc, + 0x96, 0x45, 0x61, 0xa6, 0x45, 0xfa, 0x19, 0x2a, 0xa4, 0xc2, 0xd0, 0xe4, 0xe7, 0x21, 0xbb, 0x60, + 0x35, 0x0c, 0xd3, 0x8a, 0x72, 0xcb, 0x31, 0x6e, 0x54, 0x66, 0xbb, 0xc9, 0xe3, 0x59, 0x61, 0x0d, + 0x74, 0x0c, 0xfa, 0xd9, 0xcb, 0xe9, 0xfc, 0x5d, 0x00, 0xde, 0x92, 0xe7, 0x61, 0x80, 0xf2, 0x5e, + 0xb3, 0xc9, 0xfc, 0xfa, 0x6f, 0x06, 0xe6, 0xf8, 0x55, 0x25, 0xce, 0x3e, 0x15, 0x08, 0x8b, 0x20, + 0x53, 0xd5, 0x3c, 0x8d, 0xeb, 0x4d, 0x7f, 0xcb, 0xcf, 0x42, 0x96, 0x33, 0x71, 0xd1, 0x59, 0x48, + 0x5b, 0xb6, 0xcb, 0x9f, 0xe6, 0x17, 0x3b, 0xa9, 0xb2, 0x66, 0x97, 0x33, 0x24, 0x13, 0x28, 0x04, + 0xb9, 0xac, 0x74, 0xf4, 0x97, 0x0b, 0x07, 0xf7, 0x17, 0x36, 0x8c, 0xef, 0x2c, 0x9f, 0x4e, 0xc1, + 0x64, 0xa8, 0xf7, 0x1a, 0x76, 0xc8, 0x06, 0x36, 0xe2, 0xfa, 0x28, 0x24, 0x24, 0xef, 0xef, 0xe0, + 0x2e, 0x6f, 0x85, 0xf4, 0x9c, 0x6d, 0xa3, 0x22, 0x64, 0xd9, 0x53, 0x7b, 0x8b, 0xf9, 0x4b, 0x46, + 0xf1, 0xdb, 0xa4, 0xcf, 0xb5, 0x76, 0xbc, 0xeb, 0x9a, 0xe3, 0xdf, 0xdf, 0x12, 0x6d, 0xf9, 0x19, + 0xc8, 0xcd, 0x5b, 0xa6, 0x8b, 0x4d, 0xb7, 0x49, 0x43, 0x67, 0xbb, 0x6e, 0xe9, 0x7b, 0x9c, 0x03, + 0x6b, 0x10, 0x83, 0x6b, 0xb6, 0x4d, 0x29, 0x33, 0x0a, 0xf9, 0xc9, 0x72, 0x6f, 0x79, 0xa3, 0xa3, + 0x89, 0x9e, 0x39, 0xb8, 0x89, 0xb8, 0x92, 0xbe, 0x8d, 0xfe, 0x40, 0x82, 0x93, 0xad, 0x01, 0xb5, + 0x87, 0xf7, 0xdd, 0x83, 0xc6, 0xd3, 0x05, 0xc8, 0xad, 0xd3, 0x4b, 0xd4, 0x57, 0xf0, 0x3e, 0x2a, + 0xc2, 0x00, 0xae, 0x9e, 0x3d, 0x77, 0xee, 0x89, 0x67, 0x98, 0xb7, 0x5f, 0x3e, 0xa2, 0x08, 0x40, + 0x29, 0x4b, 0xb4, 0x7a, 0xf3, 0xd3, 0x53, 0x52, 0xb9, 0x0f, 0xd2, 0x6e, 0xb3, 0x71, 0x57, 0x7d, + 0xe0, 0xb5, 0xbe, 0x48, 0x02, 0x64, 0x09, 0xf5, 0x9a, 0x56, 0x37, 0xaa, 0x5a, 0x70, 0xbd, 0x3d, + 0x1f, 0xd2, 0x91, 0x62, 0xb4, 0x57, 0xb1, 0xd8, 0xd5, 0x52, 0xf2, 0xaf, 0x4b, 0x30, 0x74, 0x55, + 0x70, 0xde, 0xc0, 0x1e, 0xba, 0x08, 0xe0, 0x8f, 0x24, 0xc2, 0xe2, 0x9e, 0x99, 0xf8, 0x58, 0x33, + 0x3e, 0x8d, 0x12, 0x42, 0x47, 0x4f, 0x53, 0x47, 0xb3, 0x2d, 0x97, 0xdf, 0xd9, 0x49, 0x20, 0xf5, + 0x91, 0xd1, 0x63, 0x80, 0x68, 0x06, 0x53, 0xaf, 0x59, 0x9e, 0x61, 0xd6, 0x54, 0xdb, 0xba, 0xce, + 0x6f, 0x42, 0xa6, 0x95, 0x3c, 0xed, 0xb9, 0x4a, 0x3b, 0xd6, 0x09, 0x9c, 0x08, 0x9d, 0xf3, 0xb9, + 0x90, 0xd5, 0x4f, 0xab, 0x56, 0x1d, 0xec, 0xba, 0x3c, 0x49, 0x89, 0x26, 0xba, 0x08, 0x03, 0x76, + 0x73, 0x5b, 0x15, 0x19, 0x61, 0xf0, 0xec, 0xc9, 0x76, 0xf1, 0x2d, 0xe6, 0x9f, 0x47, 0x78, 0xbf, + 0xdd, 0xdc, 0x26, 0xde, 0x70, 0x1f, 0x0c, 0xb5, 0x11, 0x66, 0xf0, 0x5a, 0x20, 0x07, 0xbd, 0x9b, + 0xcf, 0x35, 0x50, 0x6d, 0xc7, 0xb0, 0x1c, 0xc3, 0xdb, 0xa7, 0xaf, 0xdc, 0xa4, 0x95, 0xbc, 0xe8, + 0x58, 0xe7, 0x70, 0x79, 0x0f, 0x46, 0x37, 0x68, 0x7d, 0x18, 0x48, 0x7e, 0x2e, 0x90, 0x4f, 0x4a, + 0x96, 0xaf, 0xa3, 0x64, 0xa9, 0x16, 0xc9, 0xca, 0x2f, 0x74, 0xf4, 0xce, 0xa7, 0x0f, 0xee, 0x9d, + 0xd1, 0x62, 0xe5, 0xcf, 0x8a, 0x91, 0xe0, 0xe3, 0xdb, 0x81, 0x50, 0x7a, 0xea, 0xd5, 0x31, 0x93, + 0xb6, 0x45, 0xc5, 0xc4, 0x22, 0xa0, 0xd8, 0x7d, 0x59, 0x2d, 0x26, 0x24, 0xd2, 0x62, 0x62, 0x90, + 0xc9, 0xcf, 0xc0, 0xf0, 0xba, 0xe6, 0x78, 0x1b, 0xd8, 0xbb, 0x8c, 0xb5, 0x2a, 0x76, 0xa2, 0xeb, + 0xee, 0xb0, 0x58, 0x77, 0x11, 0x64, 0xe8, 0xe2, 0xca, 0xd6, 0x1d, 0xfa, 0x5b, 0xde, 0x85, 0x0c, + 0x7d, 0x31, 0xcf, 0x5f, 0x93, 0x39, 0x05, 0x5b, 0x93, 0x49, 0x36, 0xdd, 0xf7, 0xb0, 0x2b, 0xf6, + 0xa9, 0xb4, 0x81, 0x9e, 0x12, 0x2b, 0x6b, 0xba, 0xfb, 0xca, 0xca, 0x5d, 0x95, 0xaf, 0xaf, 0x75, + 0x18, 0x28, 0x93, 0x64, 0xbc, 0xb4, 0xe0, 0x0b, 0x22, 0x05, 0x82, 0xa0, 0x15, 0x18, 0xb5, 0x35, + 0xc7, 0xa3, 0x37, 0x12, 0x76, 0xa9, 0x16, 0x3c, 0x1a, 0xa6, 0x5a, 0x63, 0x33, 0xa2, 0x2c, 0x1f, + 0x65, 0xd8, 0x0e, 0x03, 0xe5, 0x3f, 0xce, 0x40, 0x3f, 0x37, 0xc6, 0x5b, 0x61, 0x80, 0x9b, 0x95, + 0xfb, 0xef, 0xbd, 0x33, 0xad, 0x4b, 0xd3, 0x8c, 0xbf, 0x84, 0x70, 0x7e, 0x82, 0x06, 0x3d, 0x04, + 0x59, 0x7d, 0x57, 0x33, 0x4c, 0xd5, 0xa8, 0x8a, 0x62, 0xfe, 0x8d, 0x5b, 0x53, 0x03, 0xf3, 0x04, + 0xb6, 0xb4, 0xa0, 0x0c, 0xd0, 0xce, 0xa5, 0x2a, 0xa9, 0x05, 0x76, 0xb1, 0x51, 0xdb, 0xf5, 0x78, + 0x0c, 0xf2, 0x16, 0xba, 0x00, 0x19, 0xe2, 0x32, 0xfc, 0xbe, 0x5a, 0xb1, 0x65, 0x4b, 0xe5, 0xef, + 0x6b, 0xcb, 0x59, 0x32, 0xf0, 0x47, 0xfe, 0x70, 0x4a, 0x52, 0x28, 0x05, 0x9a, 0x87, 0xe1, 0xba, + 0xe6, 0x7a, 0x2a, 0x5d, 0xc3, 0xc8, 0xf0, 0x7d, 0x94, 0xc5, 0x89, 0x56, 0x83, 0x70, 0xc3, 0x72, + 0xd1, 0x07, 0x09, 0x15, 0x03, 0x55, 0xd1, 0x29, 0xc8, 0x53, 0x26, 0xba, 0xd5, 0x68, 0x18, 0x1e, + 0xab, 0xae, 0xfa, 0xa9, 0xdd, 0x47, 0x08, 0x7c, 0x9e, 0x82, 0x69, 0x8d, 0x75, 0x0f, 0xe4, 0xe8, + 0x0d, 0x19, 0x8a, 0xc2, 0xde, 0x06, 0xcd, 0x12, 0x00, 0xed, 0x7c, 0x18, 0x46, 0x83, 0x0c, 0xca, + 0x50, 0xb2, 0x8c, 0x4b, 0x00, 0xa6, 0x88, 0x8f, 0xc3, 0x84, 0x89, 0x6f, 0xd0, 0xf7, 0x53, 0x23, + 0xd8, 0x39, 0x8a, 0x8d, 0x48, 0xdf, 0xd5, 0x28, 0xc5, 0x83, 0x30, 0xa2, 0x0b, 0xe3, 0x33, 0x5c, + 0xa0, 0xb8, 0xc3, 0x3e, 0x94, 0xa2, 0x9d, 0x80, 0xac, 0x66, 0xdb, 0x0c, 0x61, 0x90, 0x67, 0x50, + 0xdb, 0xa6, 0x5d, 0xa7, 0x61, 0x8c, 0xea, 0xe8, 0x60, 0xb7, 0x59, 0xf7, 0x38, 0x93, 0x21, 0x8a, + 0x33, 0x4a, 0x3a, 0x14, 0x06, 0xa7, 0xb8, 0xf7, 0xc3, 0x30, 0xbe, 0x66, 0x54, 0xb1, 0xa9, 0x63, + 0x86, 0x37, 0x4c, 0xf1, 0x86, 0x04, 0x90, 0x22, 0x3d, 0x02, 0x7e, 0x66, 0x54, 0x45, 0xd6, 0x1e, + 0x61, 0xfc, 0x04, 0x7c, 0x8e, 0x81, 0xe5, 0xc7, 0x20, 0xb3, 0xa0, 0x79, 0x1a, 0x29, 0x31, 0xbc, + 0x1b, 0x6c, 0x29, 0x1a, 0x52, 0xc8, 0xcf, 0xb6, 0xe1, 0xf6, 0x66, 0x0a, 0x32, 0x57, 0x2d, 0x0f, + 0xa3, 0x27, 0x43, 0x65, 0xe1, 0x48, 0x3b, 0x1f, 0xdf, 0x30, 0x6a, 0x26, 0xae, 0xae, 0xb8, 0xb5, + 0xd0, 0x15, 0xf7, 0xc0, 0xc5, 0x52, 0x11, 0x17, 0x9b, 0x80, 0x3e, 0xc7, 0x6a, 0x9a, 0x55, 0xf1, + 0x72, 0x25, 0x6d, 0xa0, 0x0a, 0x64, 0x7d, 0xcf, 0xc9, 0x24, 0x79, 0xce, 0x28, 0xf1, 0x1c, 0xe2, + 0xd7, 0x1c, 0xa0, 0x0c, 0x6c, 0x73, 0x07, 0x2a, 0x43, 0xce, 0x4f, 0x79, 0xdc, 0x03, 0x7b, 0x73, + 0xe2, 0x80, 0x8c, 0x2c, 0x41, 0xbe, 0x3f, 0xf8, 0x06, 0x65, 0x5e, 0x98, 0xf7, 0x3b, 0xb8, 0x45, + 0x23, 0xae, 0xc6, 0xaf, 0xdb, 0x0f, 0x50, 0xbd, 0x02, 0x57, 0x63, 0x57, 0xee, 0x4f, 0x42, 0xce, + 0x35, 0x6a, 0xa6, 0xe6, 0x35, 0x1d, 0xcc, 0xbd, 0x31, 0x00, 0xc8, 0x1f, 0x4d, 0x41, 0x3f, 0xf3, + 0xee, 0x90, 0xdd, 0xa4, 0xf6, 0x76, 0x4b, 0x75, 0xb2, 0x5b, 0xfa, 0xf0, 0x76, 0x9b, 0x03, 0xf0, + 0x85, 0x71, 0xf9, 0x2d, 0xe8, 0x36, 0x75, 0x06, 0x13, 0x71, 0xc3, 0xa8, 0xf1, 0xe0, 0x0d, 0x11, + 0xf9, 0x1e, 0xd4, 0x17, 0xca, 0x93, 0x17, 0x21, 0xb7, 0x6d, 0x78, 0xaa, 0x46, 0x36, 0x8f, 0xd4, + 0x84, 0x83, 0x67, 0x27, 0x67, 0xda, 0xed, 0x32, 0x67, 0xc4, 0x16, 0x53, 0xc9, 0x6e, 0xf3, 0x5f, + 0xf2, 0x1f, 0x48, 0xa4, 0x56, 0xe6, 0x03, 0xa2, 0x39, 0x18, 0x16, 0x8a, 0xaa, 0x3b, 0x75, 0xad, + 0xc6, 0x9d, 0xf1, 0xde, 0x8e, 0xda, 0x5e, 0xaa, 0x6b, 0x35, 0x65, 0x90, 0x2b, 0x48, 0x1a, 0xed, + 0x27, 0x36, 0xd5, 0x61, 0x62, 0x23, 0x9e, 0x94, 0x3e, 0x9c, 0x27, 0x45, 0xe6, 0x3c, 0x13, 0x9f, + 0xf3, 0xcf, 0xa7, 0xe8, 0x9e, 0xc9, 0xb6, 0x5c, 0xad, 0xfe, 0x83, 0x08, 0xb1, 0x7b, 0x20, 0x67, + 0x5b, 0x75, 0x95, 0xf5, 0xb0, 0xb7, 0x98, 0xb3, 0xb6, 0x55, 0x57, 0x5a, 0xfc, 0xa8, 0xef, 0x0e, + 0xc5, 0x5f, 0xff, 0x1d, 0xb0, 0xda, 0x40, 0xdc, 0x6a, 0x0e, 0x0c, 0x31, 0x53, 0xf0, 0x05, 0xf3, + 0x71, 0x62, 0x03, 0xba, 0x02, 0x4b, 0xad, 0x0b, 0x3c, 0x13, 0x9b, 0x61, 0x2a, 0x1c, 0x8f, 0x50, + 0xb0, 0xf5, 0xa5, 0xdd, 0x66, 0x3b, 0xec, 0xe7, 0x0a, 0xc7, 0x93, 0x7f, 0x46, 0x02, 0x58, 0x26, + 0x96, 0xa5, 0xfa, 0x92, 0xa5, 0xce, 0xa5, 0x22, 0xa8, 0x91, 0x91, 0x27, 0x3b, 0x4d, 0x1a, 0x1f, + 0x7f, 0xc8, 0x0d, 0xcb, 0x3d, 0x0f, 0xc3, 0x81, 0x33, 0xba, 0x58, 0x08, 0x33, 0xd9, 0xa5, 0xb8, + 0xdf, 0xc0, 0x9e, 0x32, 0x74, 0x2d, 0xd4, 0x92, 0xff, 0x85, 0x04, 0x39, 0x2a, 0xd3, 0x0a, 0xf6, + 0xb4, 0xc8, 0x1c, 0x4a, 0x87, 0x9f, 0xc3, 0x7b, 0x01, 0x18, 0x1b, 0xd7, 0x78, 0x19, 0x73, 0xcf, + 0xca, 0x51, 0xc8, 0x86, 0xf1, 0x32, 0x46, 0xe7, 0x7d, 0x83, 0xa7, 0xbb, 0x1b, 0x5c, 0x14, 0xff, + 0xdc, 0xec, 0xc7, 0x61, 0x80, 0x7e, 0x86, 0xe8, 0x86, 0xcb, 0xeb, 0xf9, 0x7e, 0xb3, 0xd9, 0xd8, + 0xbc, 0xe1, 0xca, 0x2f, 0xc2, 0xc0, 0xe6, 0x0d, 0x76, 0x04, 0x73, 0x0f, 0xe4, 0x1c, 0xcb, 0xe2, + 0x0b, 0x3f, 0x2b, 0xb8, 0xb2, 0x04, 0x40, 0xd7, 0x39, 0x71, 0xec, 0x90, 0x0a, 0x8e, 0x1d, 0x82, + 0x73, 0x93, 0x74, 0x4f, 0xe7, 0x26, 0xa7, 0xff, 0x9d, 0x04, 0x83, 0xa1, 0xfc, 0x80, 0x9e, 0x80, + 0xa3, 0xe5, 0xe5, 0xb5, 0xf9, 0x2b, 0xea, 0xd2, 0x82, 0x7a, 0x69, 0x79, 0x6e, 0x31, 0xb8, 0xa7, + 0x53, 0x3c, 0xf6, 0xea, 0xcd, 0x69, 0x14, 0xc2, 0xdd, 0x32, 0xf7, 0x4c, 0xeb, 0xba, 0x89, 0x66, + 0x61, 0x22, 0x4a, 0x32, 0x57, 0xde, 0xa8, 0xac, 0x6e, 0xe6, 0xa5, 0xe2, 0xd1, 0x57, 0x6f, 0x4e, + 0x8f, 0x85, 0x28, 0xe6, 0xb6, 0x5d, 0x6c, 0x7a, 0xad, 0x04, 0xf3, 0x6b, 0x2b, 0x2b, 0x4b, 0x9b, + 0xf9, 0x54, 0x0b, 0x01, 0x5f, 0x01, 0x1e, 0x81, 0xb1, 0x28, 0xc1, 0xea, 0xd2, 0x72, 0x3e, 0x5d, + 0x44, 0xaf, 0xde, 0x9c, 0x1e, 0x09, 0x61, 0xaf, 0x1a, 0xf5, 0x62, 0xf6, 0x43, 0x9f, 0x99, 0x3c, + 0xf2, 0x4b, 0xbf, 0x38, 0x29, 0x11, 0xcd, 0x86, 0x23, 0x39, 0x02, 0x3d, 0x06, 0xc7, 0x37, 0x96, + 0x16, 0x57, 0x2b, 0x0b, 0xea, 0xca, 0xc6, 0xa2, 0xca, 0xbe, 0x4f, 0xe2, 0x6b, 0x37, 0xfa, 0xea, + 0xcd, 0xe9, 0x41, 0xae, 0x52, 0x27, 0xec, 0x75, 0xa5, 0x72, 0x75, 0x6d, 0xb3, 0x92, 0x97, 0x18, + 0xf6, 0xba, 0x83, 0xaf, 0x59, 0x1e, 0xfb, 0x4e, 0xd9, 0xe3, 0x70, 0xa2, 0x0d, 0xb6, 0xaf, 0xd8, + 0xd8, 0xab, 0x37, 0xa7, 0x87, 0xd7, 0x1d, 0xcc, 0xe2, 0x87, 0x52, 0xcc, 0x40, 0xa1, 0x95, 0x62, + 0x6d, 0x7d, 0x6d, 0x63, 0x6e, 0x39, 0x3f, 0x5d, 0xcc, 0xbf, 0x7a, 0x73, 0x7a, 0x48, 0x24, 0x43, + 0x82, 0x1f, 0x68, 0x76, 0x37, 0x37, 0x5e, 0x5f, 0x9a, 0x81, 0x07, 0xf8, 0x89, 0xbd, 0xeb, 0x69, + 0x7b, 0x86, 0x59, 0xf3, 0x0f, 0xed, 0x79, 0x9b, 0x6f, 0xc0, 0x8e, 0xf1, 0x73, 0x7b, 0x01, 0xed, + 0x7a, 0x74, 0x5f, 0xec, 0xfc, 0x54, 0xae, 0x98, 0x70, 0x28, 0x9d, 0xbc, 0x83, 0xeb, 0xfc, 0x98, + 0xa7, 0x98, 0xf0, 0xf0, 0xa1, 0xd8, 0x75, 0x8f, 0x29, 0x7f, 0x58, 0x82, 0x91, 0xcb, 0x86, 0xeb, + 0x59, 0x8e, 0xa1, 0x6b, 0x75, 0x7a, 0x3b, 0xe7, 0x7c, 0xaf, 0xb9, 0x35, 0x16, 0xea, 0xcf, 0x41, + 0xff, 0x35, 0xad, 0xce, 0x92, 0x5a, 0x9a, 0x7e, 0x4c, 0xa4, 0xbd, 0xf9, 0x82, 0xd4, 0x26, 0x18, + 0x30, 0x32, 0xf9, 0x9f, 0xa5, 0x60, 0x94, 0x06, 0x83, 0xcb, 0x3e, 0x33, 0x45, 0x36, 0x72, 0x8b, + 0x90, 0x71, 0x34, 0x8f, 0x9f, 0x4d, 0x96, 0x9f, 0xe4, 0x0f, 0x11, 0x1e, 0xed, 0xf1, 0xc1, 0xc0, + 0xcc, 0x02, 0xd6, 0x15, 0xca, 0x00, 0x69, 0x90, 0x6d, 0x68, 0x37, 0x54, 0xca, 0x8c, 0xed, 0x91, + 0x2e, 0x1d, 0x82, 0xd9, 0xed, 0x5b, 0x53, 0xa3, 0xfb, 0x5a, 0xa3, 0x5e, 0x92, 0x05, 0x33, 0x59, + 0x19, 0x68, 0x68, 0x37, 0x88, 0xb0, 0xa8, 0x09, 0xa3, 0x04, 0xaa, 0xef, 0x6a, 0x66, 0x0d, 0xb3, + 0x91, 0xe8, 0x99, 0x6b, 0x79, 0xe5, 0x70, 0x23, 0x1d, 0x0b, 0x46, 0x0a, 0xf1, 0x94, 0x95, 0xe1, + 0x86, 0x76, 0x63, 0x9e, 0x02, 0xc8, 0xb0, 0xa5, 0xec, 0xc7, 0x3e, 0x35, 0x75, 0x84, 0x3e, 0xa7, + 0xf9, 0xba, 0x04, 0x10, 0x18, 0x10, 0xbd, 0x07, 0xf2, 0xba, 0xdf, 0xa2, 0xb4, 0x2e, 0x9f, 0xd2, + 0x87, 0x3b, 0x4d, 0x4d, 0xcc, 0xfc, 0x6c, 0xa9, 0x7e, 0xfd, 0xd6, 0x94, 0xa4, 0x8c, 0xea, 0xb1, + 0x99, 0x79, 0x37, 0x0c, 0x36, 0xed, 0xaa, 0xe6, 0x61, 0x95, 0xee, 0x1d, 0x53, 0x89, 0xcb, 0xfe, + 0x24, 0xe1, 0x75, 0xfb, 0xd6, 0x14, 0x62, 0x6a, 0x85, 0x88, 0x65, 0x5a, 0x0c, 0x00, 0x83, 0x10, + 0x82, 0x90, 0x4e, 0x5f, 0x95, 0x60, 0x70, 0x21, 0xf4, 0xd2, 0x5c, 0x01, 0x06, 0x1a, 0x96, 0x69, + 0xec, 0x71, 0xf7, 0xcc, 0x29, 0xa2, 0x89, 0x8a, 0x90, 0x65, 0xf7, 0x17, 0xbd, 0x7d, 0x71, 0x00, + 0x2b, 0xda, 0x84, 0xea, 0x3a, 0xde, 0x76, 0x0d, 0x31, 0x25, 0x8a, 0x68, 0xa2, 0x4b, 0x90, 0x77, + 0xb1, 0xde, 0x74, 0x0c, 0x6f, 0x5f, 0xd5, 0x2d, 0xd3, 0xd3, 0x74, 0x8f, 0xdd, 0x84, 0x2b, 0xdf, + 0x73, 0xfb, 0xd6, 0xd4, 0x71, 0x26, 0x6b, 0x1c, 0x43, 0x56, 0x46, 0x05, 0x68, 0x9e, 0x41, 0xc8, + 0x08, 0x55, 0xec, 0x69, 0x46, 0xdd, 0x2d, 0xb0, 0x47, 0x8e, 0xa2, 0x19, 0xd2, 0xe5, 0x37, 0x07, + 0xc2, 0xc7, 0x6d, 0x97, 0x20, 0x6f, 0xd9, 0xd8, 0x89, 0xd4, 0xa5, 0x52, 0x7c, 0xe4, 0x38, 0x86, + 0xac, 0x8c, 0x0a, 0x90, 0xa8, 0x59, 0x3d, 0x32, 0xcd, 0x62, 0x73, 0x6a, 0x37, 0xb7, 0x83, 0x53, + 0xba, 0x89, 0x96, 0xd9, 0x98, 0x33, 0xf7, 0xcb, 0x4f, 0x06, 0xdc, 0xe3, 0x74, 0xf2, 0xd7, 0xbe, + 0x70, 0x66, 0x82, 0xbb, 0x46, 0x70, 0x6a, 0x76, 0x05, 0xef, 0x93, 0xe9, 0xe7, 0xa8, 0xeb, 0x14, + 0x93, 0x54, 0xa1, 0x2f, 0x6a, 0x46, 0x5d, 0xdc, 0xe8, 0x56, 0x78, 0x0b, 0x95, 0xa0, 0xdf, 0xf5, + 0x34, 0xaf, 0xe9, 0xf2, 0xef, 0xac, 0xc9, 0x9d, 0x5c, 0xad, 0x6c, 0x99, 0xd5, 0x0d, 0x8a, 0xa9, + 0x70, 0x0a, 0x74, 0x05, 0xfa, 0x3d, 0x6b, 0x0f, 0x9b, 0xdc, 0x84, 0x07, 0x0f, 0x77, 0xfa, 0x18, + 0x94, 0xb1, 0x40, 0xfb, 0x90, 0xaf, 0xe2, 0x3a, 0xae, 0xb1, 0x52, 0x6b, 0x57, 0x23, 0x5b, 0x1c, + 0xfa, 0xcd, 0xb5, 0xf2, 0xea, 0xe1, 0xc2, 0x91, 0xdb, 0x2c, 0xce, 0x54, 0x56, 0x46, 0x7d, 0xd0, + 0x06, 0x85, 0xa0, 0x2b, 0x91, 0xf7, 0x3c, 0xf9, 0xd7, 0x09, 0xef, 0xef, 0x64, 0x88, 0x90, 0x77, + 0x8b, 0xd3, 0x91, 0xf0, 0x5b, 0xa2, 0x97, 0x20, 0xdf, 0x34, 0xb7, 0x2d, 0x93, 0x5e, 0xc0, 0xe4, + 0x85, 0x3f, 0xd9, 0x49, 0xa6, 0xc3, 0x6e, 0x12, 0xc7, 0x90, 0x95, 0x51, 0x1f, 0x74, 0x99, 0x6d, + 0x0f, 0xaa, 0x30, 0x12, 0x60, 0xd1, 0x90, 0xcd, 0x25, 0x86, 0xec, 0x7d, 0x3c, 0x64, 0x8f, 0xc6, + 0x47, 0x09, 0xa2, 0x76, 0xd8, 0x07, 0x12, 0x32, 0x74, 0x19, 0x20, 0x48, 0x14, 0xf4, 0x94, 0x64, + 0xb0, 0xb3, 0x0b, 0x04, 0xd9, 0x46, 0xec, 0x2c, 0x03, 0x5a, 0xf4, 0x7e, 0x09, 0xc6, 0x1b, 0x86, + 0xa9, 0xba, 0xb8, 0xbe, 0xa3, 0x72, 0x0b, 0x13, 0x9e, 0xf4, 0x03, 0x3a, 0xe5, 0x17, 0x0e, 0xe1, + 0x1a, 0xb7, 0x6f, 0x4d, 0x15, 0x79, 0x4a, 0x6d, 0xe5, 0x2b, 0x2b, 0x63, 0x0d, 0xc3, 0xdc, 0xc0, + 0xf5, 0x9d, 0x05, 0x1f, 0x56, 0x1a, 0xfa, 0xd0, 0xa7, 0xa6, 0x8e, 0xf0, 0xf0, 0x3d, 0x22, 0x9f, + 0xa7, 0x27, 0xfc, 0x3c, 0xec, 0xb0, 0x4b, 0xb6, 0x2c, 0x9a, 0x68, 0xd0, 0x53, 0x95, 0x9c, 0x12, + 0x00, 0x58, 0xd8, 0xbf, 0xf2, 0x1f, 0xa6, 0x25, 0xf9, 0x57, 0x24, 0xe8, 0x5f, 0xb8, 0xba, 0xae, + 0x19, 0x0e, 0x5a, 0x82, 0xb1, 0xc0, 0x7f, 0xa2, 0x41, 0x7f, 0xf2, 0xf6, 0xad, 0xa9, 0x42, 0xdc, + 0xc5, 0xfc, 0xa8, 0x0f, 0x7c, 0x59, 0x84, 0xfd, 0x52, 0xa7, 0x7d, 0x6d, 0x84, 0x55, 0x0b, 0x8a, + 0xdc, 0xba, 0xeb, 0x8d, 0xa9, 0x59, 0x81, 0x01, 0x26, 0xad, 0x8b, 0x4a, 0xd0, 0x67, 0x93, 0x1f, + 0xfc, 0xf1, 0xc5, 0x64, 0x47, 0x17, 0xa6, 0xf8, 0xfe, 0x61, 0x2a, 0x21, 0x91, 0x3f, 0x9a, 0x02, + 0x58, 0xb8, 0x7a, 0x75, 0xd3, 0x31, 0xec, 0x3a, 0xf6, 0xee, 0xa4, 0xe6, 0x9b, 0x70, 0x34, 0xb4, + 0x89, 0x72, 0xf4, 0x98, 0xf6, 0xd3, 0xb7, 0x6f, 0x4d, 0x9d, 0x8c, 0x6b, 0x1f, 0x42, 0x93, 0x95, + 0xf1, 0x60, 0x3b, 0xe5, 0xe8, 0x6d, 0xb9, 0x56, 0x5d, 0xcf, 0xe7, 0x9a, 0xee, 0xcc, 0x35, 0x84, + 0x16, 0xe6, 0xba, 0xe0, 0x7a, 0xed, 0x4d, 0xbb, 0x01, 0x83, 0x81, 0x49, 0x5c, 0xb4, 0x00, 0x59, + 0x8f, 0xff, 0xe6, 0x16, 0x96, 0x3b, 0x5b, 0x58, 0x90, 0x71, 0x2b, 0xfb, 0x94, 0xf2, 0xff, 0x91, + 0x00, 0x02, 0x9f, 0xfd, 0xd1, 0x74, 0x31, 0x92, 0xda, 0x79, 0x0e, 0x4e, 0x1f, 0xbe, 0x92, 0xe3, + 0x2c, 0x62, 0x46, 0xfd, 0x89, 0x14, 0x8c, 0x6f, 0x89, 0x24, 0xf4, 0x23, 0x6f, 0x88, 0x75, 0x18, + 0xc0, 0xa6, 0xe7, 0x18, 0xd4, 0x12, 0x64, 0xca, 0x1f, 0xef, 0x34, 0xe5, 0x6d, 0x74, 0xa2, 0x1f, + 0x13, 0x12, 0xa7, 0xff, 0x9c, 0x4d, 0xcc, 0x1a, 0x1f, 0x4f, 0x43, 0xa1, 0x13, 0x25, 0x9a, 0x87, + 0x51, 0xdd, 0xc1, 0x14, 0xa0, 0x86, 0x8f, 0x1b, 0xcb, 0xc5, 0xa0, 0xdc, 0x8c, 0x21, 0xc8, 0xca, + 0x88, 0x80, 0xf0, 0x85, 0xa4, 0x06, 0xa4, 0x16, 0x24, 0xbe, 0x47, 0xb0, 0x7a, 0x2c, 0xfe, 0x64, + 0xbe, 0x92, 0x88, 0x41, 0xa2, 0x0c, 0xd8, 0x52, 0x32, 0x12, 0x40, 0xe9, 0x5a, 0x72, 0x0d, 0x46, + 0x0d, 0xd3, 0xf0, 0x0c, 0xad, 0xae, 0x6e, 0x6b, 0x75, 0xcd, 0xd4, 0x0f, 0x5d, 0x4f, 0xb3, 0xe4, + 0xcf, 0xc7, 0x8e, 0xf1, 0x94, 0x95, 0x11, 0x0e, 0x29, 0x33, 0x00, 0x5a, 0x81, 0x01, 0x31, 0x5e, + 0xe6, 0xf0, 0x75, 0x88, 0xe0, 0x11, 0xaa, 0xff, 0x7e, 0x36, 0x0d, 0x63, 0x0a, 0xae, 0xfe, 0xff, + 0x49, 0x39, 0xc4, 0xa4, 0x28, 0x00, 0x2c, 0xfa, 0x49, 0xd2, 0x3d, 0xec, 0xbc, 0x90, 0x24, 0x92, + 0x63, 0x6c, 0x16, 0x5c, 0x2f, 0x34, 0x33, 0xb7, 0x52, 0x30, 0x14, 0x9e, 0x99, 0xbf, 0xa0, 0xcb, + 0x15, 0x5a, 0x0a, 0xb2, 0x53, 0x86, 0x7f, 0x96, 0xb5, 0x43, 0x76, 0x6a, 0xf1, 0xe3, 0xee, 0x69, + 0xe9, 0xcf, 0x52, 0xd0, 0xbf, 0xae, 0x39, 0x5a, 0xc3, 0x45, 0x7a, 0x4b, 0x21, 0x2a, 0x8e, 0x2d, + 0x5b, 0x3e, 0xbe, 0xcd, 0x4f, 0x49, 0x12, 0xea, 0xd0, 0x8f, 0xb5, 0xa9, 0x43, 0xdf, 0x06, 0x23, + 0x64, 0xdf, 0x1c, 0x7a, 0x03, 0x83, 0x58, 0x7b, 0xb8, 0x7c, 0x22, 0xe0, 0x12, 0xed, 0x67, 0xdb, + 0xea, 0xab, 0xe1, 0x57, 0x30, 0x06, 0x09, 0x46, 0x90, 0xac, 0x09, 0xf9, 0xb1, 0x60, 0xff, 0x1a, + 0xea, 0x94, 0x15, 0x68, 0x68, 0x37, 0x2a, 0xac, 0x81, 0x96, 0x01, 0xed, 0xfa, 0x27, 0x2a, 0x6a, + 0x60, 0x4e, 0x42, 0x7f, 0xef, 0xed, 0x5b, 0x53, 0x27, 0x18, 0x7d, 0x2b, 0x8e, 0xac, 0x8c, 0x05, + 0x40, 0xc1, 0xed, 0x29, 0x00, 0xa2, 0x97, 0xca, 0xde, 0xe0, 0x64, 0xfb, 0xa2, 0xa3, 0xb7, 0x6f, + 0x4d, 0x8d, 0x31, 0x2e, 0x41, 0x9f, 0xac, 0xe4, 0x48, 0x63, 0x81, 0xfc, 0x0e, 0x79, 0xf6, 0x67, + 0x24, 0x40, 0xc1, 0x32, 0xa0, 0x60, 0xd7, 0x26, 0x1b, 0x39, 0x52, 0xa7, 0x87, 0x6a, 0x6a, 0xa9, + 0x7b, 0x9d, 0x1e, 0xd0, 0x8b, 0x3a, 0x3d, 0x14, 0x29, 0xcf, 0x04, 0xd9, 0x32, 0xc5, 0xe7, 0xb1, + 0xcd, 0xeb, 0xae, 0x33, 0xf3, 0x96, 0x21, 0xa8, 0x5b, 0x32, 0xe3, 0x11, 0xf9, 0x75, 0x09, 0x4e, + 0xb4, 0x78, 0x94, 0x2f, 0xec, 0x5f, 0x02, 0xe4, 0x84, 0x3a, 0xf9, 0x37, 0xf6, 0x98, 0xd0, 0x07, + 0x76, 0xd0, 0x31, 0xa7, 0x25, 0x03, 0xdf, 0xe1, 0x84, 0xcf, 0x5e, 0x9a, 0xfd, 0xe7, 0x12, 0x4c, + 0x84, 0x65, 0xf0, 0xb5, 0x59, 0x85, 0xa1, 0xb0, 0x08, 0x5c, 0x8f, 0x07, 0x7a, 0xd1, 0x83, 0xab, + 0x10, 0xa1, 0x47, 0x2f, 0x04, 0x31, 0xcb, 0x0e, 0xde, 0x9e, 0xe8, 0xd9, 0x24, 0x42, 0xa6, 0x78, + 0xec, 0x66, 0xe8, 0xa4, 0xbc, 0x9a, 0x82, 0xcc, 0xba, 0x65, 0xd5, 0x91, 0x07, 0x63, 0xa6, 0xe5, + 0xa9, 0xc4, 0xbd, 0x70, 0x55, 0xe5, 0x5b, 0x74, 0x96, 0x0c, 0x2f, 0x1f, 0xc2, 0x52, 0xdf, 0xba, + 0x35, 0xd5, 0xca, 0x4f, 0x19, 0x35, 0x2d, 0xaf, 0x4c, 0x21, 0x9b, 0x6c, 0x03, 0xff, 0x7e, 0x09, + 0x86, 0xa3, 0x43, 0xb2, 0x84, 0xf9, 0x9e, 0xc3, 0x0d, 0x19, 0xe5, 0x75, 0xfb, 0xd6, 0xd4, 0x44, + 0x10, 0x41, 0x3e, 0x58, 0x56, 0x86, 0xb6, 0x43, 0x32, 0xb0, 0xb7, 0xd5, 0xbe, 0xf3, 0xa9, 0x29, + 0xe9, 0xf4, 0x17, 0x25, 0x80, 0xe0, 0xc8, 0x02, 0x3d, 0x06, 0xc7, 0xcb, 0x6b, 0xab, 0x0b, 0xea, + 0xc6, 0xe6, 0xdc, 0xe6, 0xd6, 0x86, 0xba, 0xb5, 0xba, 0xb1, 0x5e, 0x99, 0x5f, 0xba, 0xb4, 0x54, + 0x59, 0x08, 0x8e, 0xd9, 0x5d, 0x1b, 0xeb, 0xc6, 0x8e, 0x81, 0xab, 0xe8, 0x21, 0x98, 0x88, 0x62, + 0x93, 0x56, 0x65, 0x21, 0x2f, 0x15, 0x87, 0x5e, 0xbd, 0x39, 0x9d, 0x65, 0xf5, 0x1a, 0xae, 0xa2, + 0x53, 0x70, 0xb4, 0x15, 0x6f, 0x69, 0x75, 0x31, 0x9f, 0x2a, 0x0e, 0xbf, 0x7a, 0x73, 0x3a, 0xe7, + 0x17, 0x76, 0x48, 0x06, 0x14, 0xc6, 0xe4, 0xfc, 0xd2, 0x45, 0x78, 0xf5, 0xe6, 0x74, 0x3f, 0x33, + 0x63, 0x31, 0xf3, 0xa1, 0xcf, 0x4c, 0x1e, 0x29, 0x5f, 0xe9, 0x78, 0x90, 0xfe, 0x44, 0xb2, 0x01, + 0x1b, 0x56, 0xb5, 0x59, 0xc7, 0xfe, 0x39, 0xb9, 0x7f, 0x84, 0xfe, 0xf3, 0xc7, 0x61, 0xaa, 0xc3, + 0x11, 0xba, 0x77, 0x23, 0xe1, 0xf4, 0xbc, 0xcb, 0x39, 0x79, 0xe2, 0x39, 0x78, 0x87, 0x93, 0xf7, + 0xc3, 0x9f, 0x8e, 0xf7, 0xf4, 0x20, 0x40, 0xfe, 0xdd, 0x0c, 0xa0, 0x15, 0xb7, 0x36, 0x4f, 0x6a, + 0xae, 0xd0, 0x6b, 0x67, 0xb1, 0x73, 0x1e, 0xe9, 0xfb, 0x3a, 0xe7, 0x59, 0x89, 0x9c, 0x9c, 0xa4, + 0x0e, 0x76, 0x4e, 0xdb, 0xfb, 0xf1, 0x49, 0xfa, 0x07, 0x77, 0x7c, 0xd2, 0xbe, 0x88, 0xca, 0xdc, + 0xb9, 0x1d, 0x58, 0xdf, 0xa1, 0x76, 0x60, 0x97, 0xa0, 0x9f, 0x9f, 0x92, 0xf6, 0x77, 0x39, 0x25, + 0x2d, 0x74, 0x3c, 0x0a, 0xe5, 0xd4, 0xe8, 0x9c, 0xb8, 0x21, 0x35, 0xd0, 0xdb, 0xb2, 0xc7, 0xaf, + 0x50, 0x65, 0x3f, 0x24, 0x16, 0xbd, 0x93, 0x50, 0x6c, 0x75, 0x2a, 0x91, 0x92, 0xe5, 0x9b, 0x69, + 0xc8, 0xaf, 0xb8, 0xb5, 0x4a, 0xd5, 0xf0, 0xee, 0x92, 0xc7, 0x3d, 0xd7, 0x79, 0x57, 0x8b, 0x6e, + 0xdf, 0x9a, 0x1a, 0x61, 0x36, 0xed, 0x62, 0x49, 0x07, 0x46, 0x63, 0x0f, 0x18, 0xb8, 0x7b, 0x2d, + 0x1d, 0xfa, 0x61, 0x47, 0x8c, 0x9f, 0x4c, 0xf7, 0x1f, 0x21, 0x57, 0x47, 0xef, 0x6b, 0xef, 0xd6, + 0xcc, 0xab, 0x56, 0xee, 0xfa, 0x89, 0x60, 0x30, 0x7b, 0x45, 0x28, 0xc4, 0xa7, 0xc7, 0x9f, 0xbb, + 0x3f, 0x96, 0x60, 0x70, 0xc5, 0x15, 0xdb, 0x6f, 0xfc, 0x23, 0x7a, 0x14, 0xf1, 0xb4, 0x7f, 0x03, + 0x28, 0xdd, 0x9b, 0x07, 0x8b, 0x5b, 0x41, 0x81, 0x11, 0x8e, 0xc2, 0x78, 0x48, 0x4f, 0x5f, 0xff, + 0xdf, 0x49, 0xd1, 0x7c, 0x59, 0xc6, 0x35, 0xc3, 0xf4, 0x8b, 0x0e, 0xfc, 0x17, 0x75, 0x53, 0x15, + 0xd8, 0x39, 0x73, 0x58, 0x3b, 0xef, 0xd1, 0x54, 0x11, 0xb3, 0xa7, 0x5f, 0x51, 0xae, 0xb4, 0x6e, + 0xfe, 0xa5, 0x03, 0xbc, 0x85, 0x13, 0xdb, 0xe2, 0xcb, 0x6f, 0x4a, 0x30, 0xbc, 0xe2, 0xd6, 0xb6, + 0xcc, 0xea, 0xff, 0xf3, 0xfe, 0xbb, 0x03, 0x47, 0x23, 0x9a, 0xde, 0x25, 0x93, 0x9e, 0x7d, 0x2d, + 0x03, 0xe9, 0x15, 0xb7, 0x86, 0x5e, 0x82, 0xd1, 0x78, 0x11, 0x71, 0xba, 0x53, 0xf6, 0x6e, 0x5d, + 0x1b, 0x8a, 0x67, 0x7b, 0xc7, 0xf5, 0x35, 0xd9, 0x83, 0xe1, 0xe8, 0x1a, 0x72, 0xaa, 0x0b, 0x93, + 0x08, 0x66, 0xf1, 0xf1, 0x5e, 0x31, 0xfd, 0xc1, 0xde, 0x03, 0x59, 0x3f, 0xe9, 0xdd, 0xdf, 0x85, + 0x5a, 0x20, 0x15, 0x1f, 0xed, 0x01, 0xc9, 0xe7, 0xfe, 0x12, 0x8c, 0xc6, 0x53, 0x4a, 0x37, 0xeb, + 0xc5, 0x70, 0xbb, 0x5a, 0xaf, 0x53, 0x68, 0x6d, 0x03, 0x84, 0xe2, 0xe0, 0xc1, 0x2e, 0x1c, 0x02, + 0xb4, 0xe2, 0x99, 0x9e, 0xd0, 0xfc, 0xcd, 0xd7, 0x5d, 0xa9, 0xd0, 0xbf, 0x9a, 0x82, 0xd3, 0xe1, + 0xda, 0xf7, 0xa5, 0x26, 0x76, 0xf6, 0xfd, 0xf2, 0xd6, 0xd6, 0x6a, 0x86, 0x19, 0xbe, 0x16, 0x79, + 0x22, 0x1c, 0x3a, 0x14, 0x57, 0x08, 0x2d, 0x9b, 0x30, 0xb8, 0xae, 0xd5, 0xb0, 0x82, 0x5f, 0x6a, + 0x62, 0xd7, 0x6b, 0x73, 0x8d, 0xed, 0x18, 0xf4, 0x5b, 0x3b, 0x3b, 0xe2, 0x6d, 0xb6, 0x8c, 0xc2, + 0x5b, 0x68, 0x02, 0xfa, 0xea, 0x46, 0xc3, 0x60, 0xe1, 0x99, 0x51, 0x58, 0x03, 0x4d, 0xc1, 0xa0, + 0x4e, 0xa2, 0x50, 0x65, 0xaf, 0xff, 0x67, 0xc4, 0x77, 0xb3, 0x9a, 0xa6, 0xb7, 0x49, 0x20, 0xf2, + 0x73, 0x30, 0xc4, 0xc6, 0xe3, 0x53, 0x70, 0x02, 0xb2, 0xf4, 0x75, 0xed, 0x60, 0xd4, 0x01, 0xd2, + 0xbe, 0xc2, 0xae, 0xbc, 0x31, 0x2e, 0x6c, 0x60, 0xd6, 0x28, 0x2f, 0x76, 0xb4, 0xe7, 0x99, 0x1e, + 0x6b, 0x03, 0x66, 0x2d, 0xdf, 0x96, 0xbf, 0xd5, 0x07, 0x47, 0xf9, 0xce, 0x44, 0xb3, 0x8d, 0xd9, + 0x5d, 0xcf, 0x13, 0x17, 0xce, 0x81, 0x27, 0x03, 0xcd, 0x36, 0xe4, 0x7d, 0xc8, 0x5c, 0xf6, 0x3c, + 0x1b, 0x9d, 0x86, 0x3e, 0x87, 0x4c, 0x09, 0x7f, 0xa4, 0xe3, 0x97, 0x97, 0x9a, 0x6d, 0xcc, 0x10, + 0x04, 0xa5, 0x59, 0xc7, 0x0a, 0x43, 0x41, 0x15, 0x98, 0xda, 0x69, 0xd6, 0xeb, 0xfb, 0x6a, 0x15, + 0xd3, 0xff, 0x7b, 0xe8, 0xff, 0xe7, 0x20, 0x7c, 0xc3, 0xd6, 0x4c, 0x7f, 0x27, 0x90, 0x55, 0x4e, + 0x52, 0xb4, 0x05, 0x8a, 0x25, 0xfe, 0x6b, 0x50, 0x45, 0xe0, 0xc8, 0xbf, 0x9f, 0x82, 0xac, 0x60, + 0x4d, 0x2f, 0xa2, 0xe1, 0x3a, 0xd6, 0x3d, 0x4b, 0xbc, 0x22, 0xe1, 0xb7, 0x11, 0x82, 0x74, 0x8d, + 0xcf, 0x53, 0xee, 0xf2, 0x11, 0x85, 0x34, 0x08, 0xcc, 0xbf, 0x1e, 0x48, 0x60, 0x76, 0x93, 0x4c, + 0x5d, 0xc6, 0xb6, 0xc4, 0x39, 0xeb, 0xe5, 0x23, 0x0a, 0x6d, 0xa1, 0x02, 0xf4, 0x13, 0xe7, 0xf5, + 0xd8, 0x47, 0x9d, 0x09, 0x9c, 0xb7, 0xd1, 0x31, 0xe8, 0xb3, 0x35, 0x4f, 0x67, 0xef, 0xed, 0x93, + 0x0e, 0xd6, 0x24, 0x29, 0x9a, 0x7d, 0x4c, 0x23, 0xfe, 0x4f, 0xc5, 0x88, 0x31, 0xd8, 0x57, 0x4b, + 0x89, 0xdc, 0xeb, 0x9a, 0xe7, 0x61, 0xc7, 0x24, 0x0c, 0x19, 0x3a, 0xbd, 0x73, 0x6a, 0x55, 0xf7, + 0xf9, 0x3f, 0x3a, 0xa3, 0xbf, 0xf9, 0x7f, 0x56, 0xa2, 0x4e, 0xa1, 0xd2, 0x4e, 0xf6, 0xff, 0x1d, + 0x87, 0x04, 0xb0, 0x4c, 0x90, 0x2a, 0x30, 0xae, 0x55, 0xab, 0x06, 0xfb, 0x9f, 0x63, 0xea, 0xb6, + 0x41, 0xb7, 0xcb, 0x2e, 0xfd, 0xef, 0x9d, 0x9d, 0xe6, 0x02, 0x05, 0x04, 0x65, 0x8e, 0x5f, 0xce, + 0xc1, 0x80, 0xcd, 0x84, 0x92, 0x2f, 0xc2, 0x58, 0x8b, 0xa4, 0x44, 0xbe, 0x3d, 0xc3, 0xac, 0x8a, + 0x3b, 0x93, 0xe4, 0x37, 0x81, 0xd1, 0x2f, 0x0f, 0xb3, 0x97, 0x4f, 0xe8, 0xef, 0xf2, 0x07, 0x3a, + 0xdf, 0x10, 0x1e, 0x09, 0xdd, 0x10, 0xd6, 0x6c, 0xa3, 0x9c, 0xa3, 0xfc, 0xf9, 0xc5, 0xe0, 0x39, + 0xde, 0xc1, 0x2e, 0x05, 0xcf, 0x58, 0x4e, 0x6d, 0xb6, 0x86, 0x4d, 0xb1, 0xf3, 0x25, 0x5d, 0x9a, + 0x6d, 0xb8, 0xd4, 0x1d, 0x83, 0x2f, 0x21, 0xbb, 0x17, 0x43, 0xbf, 0xe9, 0x7d, 0xe1, 0xcc, 0xe2, + 0xdc, 0xfa, 0x92, 0xef, 0xc7, 0x5f, 0x4e, 0xc1, 0xc9, 0x90, 0x1f, 0x87, 0x90, 0x5b, 0xdd, 0xb9, + 0xd8, 0xde, 0xe3, 0x7b, 0xf8, 0x8e, 0xc0, 0x15, 0xc8, 0x10, 0x7c, 0x94, 0xf0, 0x7f, 0x8f, 0x0a, + 0xbf, 0xfa, 0xb5, 0xdf, 0x94, 0xa3, 0x1b, 0xb0, 0xc8, 0xac, 0x50, 0x26, 0xe5, 0x1f, 0xef, 0xdd, + 0x7e, 0xf9, 0xe0, 0x23, 0xd0, 0xee, 0x9d, 0x33, 0x63, 0xdc, 0x86, 0x7f, 0x72, 0x0e, 0xe4, 0x0e, + 0x67, 0x06, 0x2c, 0x6d, 0x76, 0x3f, 0xfc, 0x38, 0x40, 0x4e, 0xee, 0x74, 0x0d, 0xb1, 0xdb, 0x0c, + 0xf6, 0x78, 0x9e, 0x71, 0x03, 0x8e, 0xbd, 0x40, 0xc6, 0x0e, 0x8e, 0xbb, 0x45, 0x76, 0x3f, 0xe6, + 0xbf, 0xbe, 0x23, 0xf1, 0x7f, 0x9e, 0xca, 0xce, 0xbb, 0x2e, 0x01, 0x04, 0xf2, 0xf1, 0xd3, 0x89, + 0x87, 0x66, 0x3a, 0x2e, 0x1a, 0x33, 0xa1, 0x15, 0x43, 0x09, 0x51, 0xca, 0xbf, 0x2c, 0xc1, 0xf1, + 0x96, 0xa1, 0x79, 0xa2, 0x5f, 0x6c, 0x73, 0x63, 0xb2, 0xe7, 0x97, 0x08, 0xc3, 0xb7, 0x27, 0x17, + 0xdb, 0x08, 0xfb, 0x70, 0xa2, 0xb0, 0x4c, 0x8a, 0x88, 0xb4, 0xcf, 0xc2, 0xd1, 0xa8, 0xb0, 0xc2, + 0x4c, 0x0f, 0xc2, 0x48, 0xb4, 0x44, 0xe5, 0xe6, 0x1a, 0x8e, 0x14, 0xa9, 0xb2, 0x1a, 0xb7, 0xb3, + 0xaf, 0x6b, 0x05, 0x72, 0x3e, 0x2a, 0xaf, 0x2c, 0x7b, 0x56, 0x35, 0xa0, 0x94, 0x3f, 0x2a, 0xc1, + 0x74, 0x74, 0x84, 0x60, 0xaf, 0xea, 0x1e, 0x4c, 0xd8, 0x3b, 0x36, 0xc5, 0x6f, 0x4a, 0x70, 0x5f, + 0x17, 0x99, 0xb8, 0x01, 0x5e, 0x86, 0x89, 0xd0, 0x89, 0xbe, 0x48, 0xe1, 0x62, 0xda, 0x4f, 0x27, + 0x3f, 0x8a, 0xf0, 0xcb, 0xa7, 0x7b, 0x88, 0x51, 0x3e, 0xf7, 0x87, 0x53, 0xe3, 0xad, 0x7d, 0xae, + 0x32, 0xde, 0x7a, 0x00, 0x7f, 0x07, 0xfd, 0xe3, 0x35, 0x09, 0x1e, 0x89, 0xaa, 0xda, 0xe6, 0xd1, + 0xfb, 0x0f, 0x6b, 0x1e, 0xfe, 0xbd, 0x04, 0xa7, 0x7b, 0x11, 0xce, 0xaf, 0x74, 0xc7, 0x83, 0xe7, + 0x6a, 0xf1, 0xf9, 0x78, 0xf4, 0x00, 0x2f, 0x29, 0x70, 0x2f, 0x45, 0x3e, 0xb7, 0xbb, 0x60, 0x78, + 0x9b, 0x07, 0x56, 0x78, 0xca, 0x7d, 0x23, 0x47, 0xf7, 0xa1, 0xc2, 0xc8, 0x91, 0x9d, 0x68, 0x9b, + 0xb9, 0x48, 0xb5, 0x99, 0x8b, 0xd0, 0x4e, 0xf1, 0x1a, 0xcf, 0x5b, 0x6d, 0x9e, 0xa5, 0xbd, 0x1b, + 0xc6, 0xdb, 0xb8, 0x32, 0x8f, 0xea, 0x03, 0x78, 0xb2, 0x82, 0x5a, 0x9d, 0x55, 0xde, 0x87, 0x29, + 0x3a, 0x6e, 0x1b, 0x43, 0xdf, 0x6d, 0x95, 0x1b, 0x3c, 0xb7, 0xb4, 0x1d, 0x9a, 0xeb, 0xbe, 0x04, + 0xfd, 0x6c, 0x9e, 0xb9, 0xba, 0x87, 0x70, 0x14, 0xce, 0x40, 0xfe, 0x39, 0x91, 0xcb, 0x16, 0x84, + 0xd8, 0xed, 0x63, 0xa8, 0x17, 0x5d, 0xef, 0x50, 0x0c, 0x85, 0x8c, 0xf1, 0x75, 0x91, 0xd5, 0xda, + 0x4b, 0xc7, 0xcd, 0xa1, 0xdf, 0xb1, 0xac, 0xc6, 0x6c, 0x73, 0x77, 0xd3, 0xd7, 0x2f, 0x8a, 0xf4, + 0xe5, 0xeb, 0x94, 0x90, 0xbe, 0x7e, 0x38, 0xa6, 0xf7, 0x13, 0x59, 0x82, 0x98, 0x7f, 0x1e, 0x13, + 0xd9, 0x77, 0x24, 0x38, 0x41, 0x75, 0x0b, 0x3f, 0x9b, 0x3d, 0xa8, 0xc9, 0x1f, 0x03, 0xe4, 0x3a, + 0xba, 0xda, 0x36, 0xba, 0xf3, 0xae, 0xa3, 0x5f, 0x8d, 0xac, 0x2f, 0x8f, 0x01, 0xaa, 0xba, 0x5e, + 0x1c, 0x9b, 0xbd, 0x16, 0x9f, 0xaf, 0xba, 0xde, 0xd5, 0x2e, 0xab, 0x51, 0xe6, 0x0e, 0x4c, 0xe7, + 0xeb, 0x12, 0x14, 0xdb, 0xa9, 0xcc, 0xa7, 0xcf, 0x80, 0x63, 0x91, 0x87, 0xfd, 0xf1, 0x19, 0x7c, + 0xac, 0x97, 0xa7, 0xdb, 0xb1, 0x30, 0x3a, 0xea, 0xe0, 0xbb, 0x5d, 0x07, 0x4c, 0x45, 0x3d, 0xb4, + 0xb5, 0xb2, 0xfe, 0xa1, 0x85, 0xcf, 0x17, 0x5a, 0xf2, 0xea, 0x9f, 0x8b, 0xda, 0xfb, 0x06, 0x4c, + 0x76, 0x90, 0xfa, 0x6e, 0xaf, 0x7b, 0xbb, 0x1d, 0x27, 0xf3, 0x4e, 0x97, 0xef, 0x4f, 0xf1, 0x48, + 0x88, 0xde, 0xc0, 0x0a, 0xed, 0xc5, 0xda, 0xdd, 0x09, 0x97, 0xdf, 0x09, 0xf7, 0xb4, 0xa5, 0xe2, + 0xb2, 0x95, 0x20, 0xb3, 0x6b, 0xb8, 0x1e, 0x17, 0xeb, 0xa1, 0x4e, 0x62, 0xc5, 0xa8, 0x29, 0x8d, + 0x8c, 0x20, 0x4f, 0x59, 0xaf, 0x5b, 0x56, 0x9d, 0x8b, 0x21, 0x5f, 0x81, 0xb1, 0x10, 0x8c, 0x0f, + 0x72, 0x1e, 0x32, 0xb6, 0xc5, 0xbf, 0x82, 0x34, 0x78, 0xf6, 0x64, 0xa7, 0x41, 0x08, 0x0d, 0x57, + 0x9b, 0xe2, 0xcb, 0x13, 0x80, 0x18, 0x33, 0xfa, 0x2e, 0x98, 0x18, 0x62, 0x03, 0xc6, 0x23, 0x50, + 0x3e, 0xc8, 0x5b, 0xa0, 0xdf, 0xa6, 0x10, 0xff, 0xae, 0x6d, 0xa7, 0x61, 0x28, 0x96, 0xff, 0xdd, + 0x19, 0xda, 0x3a, 0xfb, 0xad, 0xa3, 0xd0, 0x47, 0xb9, 0xa2, 0x8f, 0x4b, 0x00, 0xa1, 0x37, 0xbb, + 0x66, 0x3a, 0xb1, 0x69, 0xbf, 0x27, 0x2e, 0xce, 0xf6, 0x8c, 0xcf, 0x6b, 0xb6, 0xd3, 0x1f, 0xf8, + 0xdd, 0x6f, 0xfe, 0x54, 0xea, 0x01, 0x24, 0xcf, 0x76, 0xd8, 0x8d, 0x87, 0xe2, 0xe5, 0xb3, 0x91, + 0x4f, 0xf0, 0x9c, 0xe9, 0x6d, 0x28, 0x21, 0xd9, 0x4c, 0xaf, 0xe8, 0x5c, 0xb0, 0x8b, 0x54, 0xb0, + 0x73, 0xe8, 0xc9, 0x64, 0xc1, 0x66, 0xdf, 0x1b, 0x0d, 0x9a, 0xf7, 0xa1, 0x7f, 0x23, 0xc1, 0x44, + 0xbb, 0x2d, 0x1d, 0xba, 0xd0, 0x9b, 0x14, 0xad, 0x25, 0x45, 0xf1, 0x99, 0x43, 0x50, 0x72, 0x55, + 0x16, 0xa9, 0x2a, 0x73, 0xe8, 0xb9, 0x43, 0xa8, 0x32, 0x1b, 0x5a, 0x77, 0xd0, 0xff, 0x96, 0xe0, + 0xde, 0xae, 0x3b, 0x24, 0x34, 0xd7, 0x9b, 0x94, 0x5d, 0x6a, 0xa7, 0x62, 0xf9, 0xfb, 0x61, 0xc1, + 0x35, 0x7e, 0x81, 0x6a, 0x7c, 0x05, 0x2d, 0x1d, 0x46, 0xe3, 0xa0, 0x22, 0x0a, 0xeb, 0xfe, 0xdb, + 0xd1, 0xab, 0x03, 0xdd, 0xdd, 0xa9, 0x65, 0xe3, 0x91, 0x10, 0x18, 0xad, 0x45, 0xad, 0xfc, 0x0e, + 0xaa, 0x82, 0x82, 0xd6, 0xbf, 0xcf, 0x49, 0x9b, 0x7d, 0x6f, 0x34, 0xf1, 0xbf, 0x0f, 0xfd, 0x4f, + 0xa9, 0xfd, 0x25, 0x80, 0xa7, 0xbb, 0x8a, 0xd8, 0x79, 0x53, 0x55, 0xbc, 0x70, 0x70, 0x42, 0xae, + 0x64, 0x83, 0x2a, 0x59, 0x43, 0xf8, 0x4e, 0x2b, 0xd9, 0x76, 0x12, 0xd1, 0x57, 0x25, 0x98, 0x68, + 0xb7, 0x27, 0x49, 0x08, 0xcb, 0x2e, 0x9b, 0xac, 0x84, 0xb0, 0xec, 0xb6, 0x01, 0x92, 0xdf, 0x42, + 0x95, 0x3f, 0x8f, 0x9e, 0xea, 0xa4, 0x7c, 0xd7, 0x59, 0x24, 0xb1, 0xd8, 0xb5, 0xc8, 0x4f, 0x88, + 0xc5, 0x5e, 0xf6, 0x31, 0x09, 0xb1, 0xd8, 0xd3, 0x1e, 0x23, 0x39, 0x16, 0x7d, 0xcd, 0x7a, 0x9c, + 0x46, 0x17, 0x7d, 0x59, 0x82, 0xe1, 0x48, 0x45, 0x8c, 0x9e, 0xe8, 0x2a, 0x68, 0xbb, 0x0d, 0x43, + 0xe7, 0x47, 0x9c, 0x9d, 0x0b, 0x6e, 0x79, 0x89, 0xea, 0x32, 0x8f, 0xe6, 0x0e, 0xa3, 0x8b, 0x13, + 0x91, 0xf8, 0x75, 0x09, 0xc6, 0xdb, 0x54, 0x99, 0x09, 0x51, 0xd8, 0xb9, 0x68, 0x2e, 0x5e, 0x38, + 0x38, 0x21, 0xd7, 0xea, 0x12, 0xd5, 0xea, 0x6d, 0xe8, 0xd9, 0xc3, 0x68, 0x15, 0x5a, 0x9f, 0x6f, + 0x05, 0xef, 0x4f, 0x87, 0xc6, 0x41, 0xe7, 0x0f, 0x28, 0x98, 0x50, 0xe8, 0xe9, 0x03, 0xd3, 0x71, + 0x7d, 0xde, 0x4e, 0xf5, 0x79, 0x01, 0xad, 0x7d, 0x7f, 0xfa, 0xb4, 0x2e, 0xeb, 0x9f, 0x6f, 0xfd, + 0x02, 0x40, 0x77, 0x2f, 0x6a, 0x5b, 0xac, 0x16, 0x9f, 0x3c, 0x10, 0x0d, 0x57, 0xea, 0x02, 0x55, + 0xea, 0x2c, 0x7a, 0xbc, 0x93, 0x52, 0xa1, 0x97, 0xe4, 0x0d, 0x73, 0xc7, 0x9a, 0x7d, 0x2f, 0x2b, + 0x81, 0xdf, 0x87, 0xde, 0x2f, 0xf1, 0x77, 0x93, 0x4f, 0x75, 0x1d, 0x37, 0x54, 0xc7, 0x16, 0x1f, + 0xe9, 0x01, 0x93, 0xcb, 0xf5, 0x00, 0x95, 0x6b, 0x12, 0x9d, 0xec, 0x24, 0x17, 0xa9, 0x65, 0xd1, + 0x87, 0x25, 0xff, 0x4e, 0xc3, 0xe9, 0xee, 0xbc, 0xc3, 0xc5, 0x6e, 0xe7, 0x57, 0x1e, 0xda, 0x94, + 0xc0, 0xf2, 0x43, 0x54, 0x92, 0x69, 0x34, 0xd9, 0x51, 0x12, 0x56, 0xfa, 0xde, 0x8d, 0x77, 0x08, + 0xfe, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x82, 0xbc, 0x57, 0x12, 0x1e, 0x92, 0x00, 0x00, + } + r := bytes.NewReader(gzipped) + gzipr, err := compress_gzip.NewReader(r) + if err != nil { + panic(err) + } + ungzipped, err := io_ioutil.ReadAll(gzipr) + if err != nil { + panic(err) + } + if err := github_com_gogo_protobuf_proto.Unmarshal(ungzipped, d); err != nil { + panic(err) + } + return d +} +func (this *CommissionRates) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CommissionRates) + if !ok { + that2, ok := that.(CommissionRates) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Rate.Equal(that1.Rate) { + return false + } + if !this.MaxRate.Equal(that1.MaxRate) { + return false + } + if !this.MaxChangeRate.Equal(that1.MaxChangeRate) { + return false + } + return true +} +func (this *Commission) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Commission) + if !ok { + that2, ok := that.(Commission) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CommissionRates.Equal(&that1.CommissionRates) { + return false + } + if !this.UpdateTime.Equal(that1.UpdateTime) { + return false + } + return true +} +func (this *Description) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Description) + if !ok { + that2, ok := that.(Description) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Moniker != that1.Moniker { + return false + } + if this.Identity != that1.Identity { + return false + } + if this.Website != that1.Website { + return false + } + if this.SecurityContact != that1.SecurityContact { + return false + } + if this.Details != that1.Details { + return false + } + return true +} +func (this *UnbondingDelegationEntry) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UnbondingDelegationEntry) + if !ok { + that2, ok := that.(UnbondingDelegationEntry) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.CreationHeight != that1.CreationHeight { + return false + } + if !this.CompletionTime.Equal(that1.CompletionTime) { + return false + } + if !this.InitialBalance.Equal(that1.InitialBalance) { + return false + } + if !this.Balance.Equal(that1.Balance) { + return false + } + return true +} +func (this *RedelegationEntry) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RedelegationEntry) + if !ok { + that2, ok := that.(RedelegationEntry) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.CreationHeight != that1.CreationHeight { + return false + } + if !this.CompletionTime.Equal(that1.CompletionTime) { + return false + } + if !this.InitialBalance.Equal(that1.InitialBalance) { + return false + } + if !this.SharesDst.Equal(that1.SharesDst) { + return false + } + return true +} +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 + } + if this.UnbondingTime != that1.UnbondingTime { + return false + } + if this.MaxValidators != that1.MaxValidators { + return false + } + if this.MaxEntries != that1.MaxEntries { + return false + } + if this.HistoricalEntries != that1.HistoricalEntries { + return false + } + if this.BondDenom != that1.BondDenom { + return false + } + return true +} +func (this *RedelegationEntryResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RedelegationEntryResponse) + if !ok { + that2, ok := that.(RedelegationEntryResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.RedelegationEntry.Equal(&that1.RedelegationEntry) { + return false + } + if !this.Balance.Equal(that1.Balance) { + return false + } + return true +} +func (this *Pool) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Pool) + if !ok { + that2, ok := that.(Pool) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.NotBondedTokens.Equal(that1.NotBondedTokens) { + return false + } + if !this.BondedTokens.Equal(that1.BondedTokens) { + return false + } + return true +} +func (m *HistoricalInfo) 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 *HistoricalInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistoricalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Valset) > 0 { + for iNdEx := len(m.Valset) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Valset[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CommissionRates) 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 *CommissionRates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommissionRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MaxChangeRate.Size() + i -= size + if _, err := m.MaxChangeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MaxRate.Size() + i -= size + if _, err := m.MaxRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Rate.Size() + i -= size + if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Commission) 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 *Commission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Commission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintStaking(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + { + size, err := m.CommissionRates.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Description) 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 *Description) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Description) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintStaking(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x22 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Validator) 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 *Validator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintStaking(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x4a + if m.UnbondingHeight != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingHeight)) + i-- + dAtA[i] = 0x40 + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.DelegatorShares.Size() + i -= size + if _, err := m.DelegatorShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.Status != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x20 + } + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.ConsensusPubkey != nil { + { + size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValAddresses) 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 *ValAddresses) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintStaking(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *DVPair) 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 *DVPair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DVPairs) 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 *DVPairs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVPairs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Pairs) > 0 { + for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *DVVTriplet) 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 *DVVTriplet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVVTriplet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DVVTriplets) 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 *DVVTriplets) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVVTriplets) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Triplets) > 0 { + for iNdEx := len(m.Triplets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Triplets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Delegation) 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 *Delegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Shares.Size() + i -= size + if _, err := m.Shares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UnbondingDelegation) 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 *UnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UnbondingDelegationEntry) 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 *UnbondingDelegationEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Balance.Size() + i -= size + if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.InitialBalance.Size() + i -= size + if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintStaking(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0x12 + if m.CreationHeight != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RedelegationEntry) 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 *RedelegationEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RedelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.SharesDst.Size() + i -= size + if _, err := m.SharesDst.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.InitialBalance.Size() + i -= size + if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintStaking(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x12 + if m.CreationHeight != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Redelegation) 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 *Redelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Redelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BondDenom) > 0 { + i -= len(m.BondDenom) + copy(dAtA[i:], m.BondDenom) + i = encodeVarintStaking(dAtA, i, uint64(len(m.BondDenom))) + i-- + dAtA[i] = 0x2a + } + if m.HistoricalEntries != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.HistoricalEntries)) + i-- + dAtA[i] = 0x20 + } + if m.MaxEntries != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.MaxEntries)) + i-- + dAtA[i] = 0x18 + } + if m.MaxValidators != 0 { + i = encodeVarintStaking(dAtA, i, uint64(m.MaxValidators)) + i-- + dAtA[i] = 0x10 + } + n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintStaking(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DelegationResponse) 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 *DelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Delegation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *RedelegationEntryResponse) 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 *RedelegationEntryResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RedelegationEntryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Balance.Size() + i -= size + if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.RedelegationEntry.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *RedelegationResponse) 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 *RedelegationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RedelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Redelegation.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Pool) 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 *Pool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.BondedTokens.Size() + i -= size + if _, err := m.BondedTokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.NotBondedTokens.Size() + i -= size + if _, err := m.NotBondedTokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintStaking(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintStaking(dAtA []byte, offset int, v uint64) int { + offset -= sovStaking(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *HistoricalInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Header.Size() + n += 1 + l + sovStaking(uint64(l)) + if len(m.Valset) > 0 { + for _, e := range m.Valset { + l = e.Size() + n += 1 + l + sovStaking(uint64(l)) + } + } + return n +} + +func (m *CommissionRates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Rate.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.MaxRate.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.MaxChangeRate.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *Commission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommissionRates.Size() + n += 1 + l + sovStaking(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime) + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *Description) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + return n +} + +func (m *Validator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + if m.ConsensusPubkey != nil { + l = m.ConsensusPubkey.Size() + n += 1 + l + sovStaking(uint64(l)) + } + if m.Jailed { + n += 2 + } + if m.Status != 0 { + n += 1 + sovStaking(uint64(m.Status)) + } + l = m.Tokens.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.DelegatorShares.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.Description.Size() + n += 1 + l + sovStaking(uint64(l)) + if m.UnbondingHeight != 0 { + n += 1 + sovStaking(uint64(m.UnbondingHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime) + n += 1 + l + sovStaking(uint64(l)) + l = m.Commission.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *ValAddresses) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, s := range m.Addresses { + l = len(s) + n += 1 + l + sovStaking(uint64(l)) + } + } + return n +} + +func (m *DVPair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + return n +} + +func (m *DVPairs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Pairs) > 0 { + for _, e := range m.Pairs { + l = e.Size() + n += 1 + l + sovStaking(uint64(l)) + } + } + return n +} + +func (m *DVVTriplet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + return n +} + +func (m *DVVTriplets) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Triplets) > 0 { + for _, e := range m.Triplets { + l = e.Size() + n += 1 + l + sovStaking(uint64(l)) + } + } + return n +} + +func (m *Delegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = m.Shares.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *UnbondingDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovStaking(uint64(l)) + } + } + return n +} + +func (m *UnbondingDelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovStaking(uint64(m.CreationHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovStaking(uint64(l)) + l = m.InitialBalance.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.Balance.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *RedelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovStaking(uint64(m.CreationHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovStaking(uint64(l)) + l = m.InitialBalance.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.SharesDst.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *Redelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovStaking(uint64(l)) + } + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) + n += 1 + l + sovStaking(uint64(l)) + if m.MaxValidators != 0 { + n += 1 + sovStaking(uint64(m.MaxValidators)) + } + if m.MaxEntries != 0 { + n += 1 + sovStaking(uint64(m.MaxEntries)) + } + if m.HistoricalEntries != 0 { + n += 1 + sovStaking(uint64(m.HistoricalEntries)) + } + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovStaking(uint64(l)) + } + return n +} + +func (m *DelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Delegation.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.Balance.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *RedelegationEntryResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RedelegationEntry.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.Balance.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func (m *RedelegationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Redelegation.Size() + n += 1 + l + sovStaking(uint64(l)) + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovStaking(uint64(l)) + } + } + return n +} + +func (m *Pool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NotBondedTokens.Size() + n += 1 + l + sovStaking(uint64(l)) + l = m.BondedTokens.Size() + n += 1 + l + sovStaking(uint64(l)) + return n +} + +func sovStaking(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStaking(x uint64) (n int) { + return sovStaking(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ValAddresses) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ValAddresses{`, + `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, + `}`, + }, "") + return s +} +func valueToStringStaking(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *HistoricalInfo) 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 ErrIntOverflowStaking + } + 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: HistoricalInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HistoricalInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Valset", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Valset = append(m.Valset, Validator{}) + if err := m.Valset[len(m.Valset)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommissionRates) 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 ErrIntOverflowStaking + } + 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: CommissionRates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommissionRates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxChangeRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxChangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Commission) 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 ErrIntOverflowStaking + } + 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: Commission: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Commission: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommissionRates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdateTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UpdateTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Description) 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 ErrIntOverflowStaking + } + 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: Description: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Description: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Validator) 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 ErrIntOverflowStaking + } + 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: Validator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Validator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsensusPubkey == nil { + m.ConsensusPubkey = &types1.Any{} + } + if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) + case 4: + 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 ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= BondStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorShares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DelegatorShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingHeight", wireType) + } + m.UnbondingHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnbondingHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValAddresses) 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 ErrIntOverflowStaking + } + 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: ValAddresses: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValAddresses: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DVPair) 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 ErrIntOverflowStaking + } + 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: DVPair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVPair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DVPairs) 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 ErrIntOverflowStaking + } + 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: DVPairs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVPairs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pairs = append(m.Pairs, DVPair{}) + if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DVVTriplet) 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 ErrIntOverflowStaking + } + 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: DVVTriplet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVVTriplet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DVVTriplets) 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 ErrIntOverflowStaking + } + 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: DVVTriplets: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVVTriplets: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Triplets", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Triplets = append(m.Triplets, DVVTriplet{}) + if err := m.Triplets[len(m.Triplets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Delegation) 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 ErrIntOverflowStaking + } + 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: Delegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Delegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + 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 Shares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnbondingDelegation) 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 ErrIntOverflowStaking + } + 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: UnbondingDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + 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 Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, UnbondingDelegationEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnbondingDelegationEntry) 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 ErrIntOverflowStaking + } + 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: UnbondingDelegationEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnbondingDelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedelegationEntry) 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 ErrIntOverflowStaking + } + 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: RedelegationEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SharesDst", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SharesDst.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Redelegation) 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 ErrIntOverflowStaking + } + 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: Redelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Redelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, RedelegationEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxValidators", wireType) + } + m.MaxValidators = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxValidators |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEntries", wireType) + } + m.MaxEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxEntries |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) + } + m.HistoricalEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HistoricalEntries |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegationResponse) 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 ErrIntOverflowStaking + } + 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: DelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Delegation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Delegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedelegationEntryResponse) 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 ErrIntOverflowStaking + } + 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: RedelegationEntryResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedelegationEntryResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RedelegationEntry", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RedelegationEntry.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedelegationResponse) 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 ErrIntOverflowStaking + } + 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: RedelegationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Redelegation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Redelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStaking + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, RedelegationEntryResponse{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Pool) 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 ErrIntOverflowStaking + } + 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: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NotBondedTokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.NotBondedTokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondedTokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStaking + } + 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 ErrInvalidLengthStaking + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthStaking + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BondedTokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStaking(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStaking + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStaking(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, ErrIntOverflowStaking + } + 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, ErrIntOverflowStaking + } + 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, ErrIntOverflowStaking + } + 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, ErrInvalidLengthStaking + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStaking + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStaking + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStaking = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStaking = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStaking = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/staking/tx.pb.go b/module-sdk/staking/tx.pb.go new file mode 100644 index 00000000..95b095f4 --- /dev/null +++ b/module-sdk/staking/tx.pb.go @@ -0,0 +1,2751 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmos/staking/v1beta1/tx.proto + +package staking + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/timestamp" + types "github.com/irisnet/core-sdk-go/common/codec/types" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types1 "github.com/irisnet/core-sdk-go/types" + _ "github.com/regen-network/cosmos-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" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateValidator defines a SDK message for creating a new validator. +type MsgCreateValidator struct { + Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` + Commission CommissionRates `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission"` + MinSelfDelegation github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` + DelegatorAddress string `protobuf:"bytes,4,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,5,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + Pubkey *types.Any `protobuf:"bytes,6,opt,name=pubkey,proto3" json:"pubkey,omitempty"` + Value types1.Coin `protobuf:"bytes,7,opt,name=value,proto3" json:"value"` +} + +func (m *MsgCreateValidator) Reset() { *m = MsgCreateValidator{} } +func (m *MsgCreateValidator) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidator) ProtoMessage() {} +func (*MsgCreateValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{0} +} +func (m *MsgCreateValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateValidator.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 *MsgCreateValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidator.Merge(m, src) +} +func (m *MsgCreateValidator) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateValidator proto.InternalMessageInfo + +// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. +type MsgCreateValidatorResponse struct { +} + +func (m *MsgCreateValidatorResponse) Reset() { *m = MsgCreateValidatorResponse{} } +func (m *MsgCreateValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidatorResponse) ProtoMessage() {} +func (*MsgCreateValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{1} +} +func (m *MsgCreateValidatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateValidatorResponse.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 *MsgCreateValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidatorResponse.Merge(m, src) +} +func (m *MsgCreateValidatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateValidatorResponse proto.InternalMessageInfo + +// MsgEditValidator defines a SDK message for editing an existing validator. +type MsgEditValidator struct { + Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"address"` + // We pass a reference to the new commission rate and min self delegation as + // it's not mandatory to update. If not updated, the deserialized rate will be + // zero with no way to distinguish if an update was intended. + // + // REF: #2373 + CommissionRate *github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=commission_rate,json=commissionRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"commission_rate,omitempty" yaml:"commission_rate"` + MinSelfDelegation *github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_self_delegation,omitempty" yaml:"min_self_delegation"` +} + +func (m *MsgEditValidator) Reset() { *m = MsgEditValidator{} } +func (m *MsgEditValidator) String() string { return proto.CompactTextString(m) } +func (*MsgEditValidator) ProtoMessage() {} +func (*MsgEditValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{2} +} +func (m *MsgEditValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditValidator.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 *MsgEditValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditValidator.Merge(m, src) +} +func (m *MsgEditValidator) XXX_Size() int { + return m.Size() +} +func (m *MsgEditValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditValidator proto.InternalMessageInfo + +// MsgEditValidatorResponse defines the Msg/EditValidator response type. +type MsgEditValidatorResponse struct { +} + +func (m *MsgEditValidatorResponse) Reset() { *m = MsgEditValidatorResponse{} } +func (m *MsgEditValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEditValidatorResponse) ProtoMessage() {} +func (*MsgEditValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{3} +} +func (m *MsgEditValidatorResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditValidatorResponse.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 *MsgEditValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditValidatorResponse.Merge(m, src) +} +func (m *MsgEditValidatorResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEditValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditValidatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditValidatorResponse proto.InternalMessageInfo + +// MsgDelegate defines a SDK message for performing a delegation of coins +// from a delegator to a validator. +type MsgDelegate struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgDelegate) Reset() { *m = MsgDelegate{} } +func (m *MsgDelegate) String() string { return proto.CompactTextString(m) } +func (*MsgDelegate) ProtoMessage() {} +func (*MsgDelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{4} +} +func (m *MsgDelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegate.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 *MsgDelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegate.Merge(m, src) +} +func (m *MsgDelegate) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegate proto.InternalMessageInfo + +// MsgDelegateResponse defines the Msg/Delegate response type. +type MsgDelegateResponse struct { +} + +func (m *MsgDelegateResponse) Reset() { *m = MsgDelegateResponse{} } +func (m *MsgDelegateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDelegateResponse) ProtoMessage() {} +func (*MsgDelegateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{5} +} +func (m *MsgDelegateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegateResponse.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 *MsgDelegateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegateResponse.Merge(m, src) +} +func (m *MsgDelegateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegateResponse proto.InternalMessageInfo + +// MsgBeginRedelegate defines a SDK message for performing a redelegation +// of coins from a delegator and source validator to a destination validator. +type MsgBeginRedelegate struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` + ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` + Amount types1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgBeginRedelegate) Reset() { *m = MsgBeginRedelegate{} } +func (m *MsgBeginRedelegate) String() string { return proto.CompactTextString(m) } +func (*MsgBeginRedelegate) ProtoMessage() {} +func (*MsgBeginRedelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{6} +} +func (m *MsgBeginRedelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBeginRedelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBeginRedelegate.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 *MsgBeginRedelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBeginRedelegate.Merge(m, src) +} +func (m *MsgBeginRedelegate) XXX_Size() int { + return m.Size() +} +func (m *MsgBeginRedelegate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBeginRedelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBeginRedelegate proto.InternalMessageInfo + +// MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. +type MsgBeginRedelegateResponse struct { + CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` +} + +func (m *MsgBeginRedelegateResponse) Reset() { *m = MsgBeginRedelegateResponse{} } +func (m *MsgBeginRedelegateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBeginRedelegateResponse) ProtoMessage() {} +func (*MsgBeginRedelegateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{7} +} +func (m *MsgBeginRedelegateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBeginRedelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBeginRedelegateResponse.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 *MsgBeginRedelegateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBeginRedelegateResponse.Merge(m, src) +} +func (m *MsgBeginRedelegateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBeginRedelegateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBeginRedelegateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBeginRedelegateResponse proto.InternalMessageInfo + +func (m *MsgBeginRedelegateResponse) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +// MsgUndelegate defines a SDK message for performing an undelegation from a +// delegate and a validator. +type MsgUndelegate struct { + DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` + Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgUndelegate) Reset() { *m = MsgUndelegate{} } +func (m *MsgUndelegate) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegate) ProtoMessage() {} +func (*MsgUndelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{8} +} +func (m *MsgUndelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegate.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 *MsgUndelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegate.Merge(m, src) +} +func (m *MsgUndelegate) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegate proto.InternalMessageInfo + +// MsgUndelegateResponse defines the Msg/Undelegate response type. +type MsgUndelegateResponse struct { + CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` +} + +func (m *MsgUndelegateResponse) Reset() { *m = MsgUndelegateResponse{} } +func (m *MsgUndelegateResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegateResponse) ProtoMessage() {} +func (*MsgUndelegateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0926ef28816b35ab, []int{9} +} +func (m *MsgUndelegateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegateResponse.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 *MsgUndelegateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegateResponse.Merge(m, src) +} +func (m *MsgUndelegateResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegateResponse proto.InternalMessageInfo + +func (m *MsgUndelegateResponse) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +func init() { + proto.RegisterType((*MsgCreateValidator)(nil), "cosmos.staking.v1beta1.MsgCreateValidator") + proto.RegisterType((*MsgCreateValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgCreateValidatorResponse") + proto.RegisterType((*MsgEditValidator)(nil), "cosmos.staking.v1beta1.MsgEditValidator") + proto.RegisterType((*MsgEditValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgEditValidatorResponse") + proto.RegisterType((*MsgDelegate)(nil), "cosmos.staking.v1beta1.MsgDelegate") + proto.RegisterType((*MsgDelegateResponse)(nil), "cosmos.staking.v1beta1.MsgDelegateResponse") + proto.RegisterType((*MsgBeginRedelegate)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegate") + proto.RegisterType((*MsgBeginRedelegateResponse)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegateResponse") + proto.RegisterType((*MsgUndelegate)(nil), "cosmos.staking.v1beta1.MsgUndelegate") + proto.RegisterType((*MsgUndelegateResponse)(nil), "cosmos.staking.v1beta1.MsgUndelegateResponse") +} + +func init() { proto.RegisterFile("cosmos/staking/v1beta1/tx.proto", fileDescriptor_0926ef28816b35ab) } + +var fileDescriptor_0926ef28816b35ab = []byte{ + // 873 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcf, 0x6b, 0xe3, 0x46, + 0x14, 0xb6, 0x6c, 0xaf, 0x9b, 0x4e, 0xd8, 0x4d, 0x56, 0x49, 0x16, 0x47, 0x04, 0x2b, 0x68, 0x5b, + 0x1a, 0xba, 0x58, 0x6a, 0x52, 0x4a, 0x61, 0x2f, 0x25, 0x8e, 0x5b, 0x08, 0x41, 0xd0, 0x2a, 0x69, + 0x0f, 0xa5, 0x60, 0xf4, 0x63, 0xac, 0x08, 0x4b, 0x1a, 0x45, 0x33, 0x0a, 0xf5, 0xa1, 0x87, 0xde, + 0x7a, 0xcc, 0xb9, 0x50, 0xc8, 0x1f, 0xd1, 0x3f, 0x22, 0xf4, 0x50, 0x02, 0xbd, 0x94, 0x1e, 0xdc, + 0x92, 0x40, 0xc9, 0xd9, 0x7f, 0x41, 0xd1, 0x68, 0x24, 0xcb, 0xf2, 0x8f, 0xba, 0xa1, 0xbe, 0xec, + 0xc9, 0x66, 0xe6, 0x9b, 0xef, 0xcd, 0xfb, 0xde, 0xf7, 0xde, 0x08, 0x88, 0x26, 0xc2, 0x1e, 0xc2, + 0x0a, 0x26, 0x7a, 0xcf, 0xf1, 0x6d, 0xe5, 0x72, 0xdf, 0x80, 0x44, 0xdf, 0x57, 0xc8, 0xb7, 0x72, + 0x10, 0x22, 0x82, 0xf8, 0x17, 0x09, 0x40, 0x66, 0x00, 0x99, 0x01, 0x84, 0x6d, 0x1b, 0x21, 0xdb, + 0x85, 0x0a, 0x45, 0x19, 0x51, 0x57, 0xd1, 0xfd, 0x7e, 0x72, 0x44, 0x10, 0x8b, 0x5b, 0xc4, 0xf1, + 0x20, 0x26, 0xba, 0x17, 0x30, 0xc0, 0xa6, 0x8d, 0x6c, 0x44, 0xff, 0x2a, 0xf1, 0x3f, 0xb6, 0xba, + 0x9d, 0x44, 0xea, 0x24, 0x1b, 0x2c, 0x6c, 0xb2, 0xd5, 0x60, 0xb7, 0x34, 0x74, 0x0c, 0xb3, 0x2b, + 0x9a, 0xc8, 0xf1, 0xd9, 0xfe, 0x3b, 0x33, 0xb2, 0x48, 0x2f, 0x4d, 0x51, 0xd2, 0x6f, 0x55, 0xc0, + 0xab, 0xd8, 0x3e, 0x0a, 0xa1, 0x4e, 0xe0, 0x57, 0xba, 0xeb, 0x58, 0x3a, 0x41, 0x21, 0x7f, 0x02, + 0x56, 0x2d, 0x88, 0xcd, 0xd0, 0x09, 0x88, 0x83, 0xfc, 0x3a, 0xb7, 0xcb, 0xed, 0xad, 0x1e, 0xbc, + 0x94, 0xa7, 0xe7, 0x2d, 0xb7, 0x47, 0xd0, 0x56, 0xf5, 0x66, 0x20, 0x96, 0xb4, 0xfc, 0x69, 0x5e, + 0x05, 0xc0, 0x44, 0x9e, 0xe7, 0x60, 0x1c, 0x73, 0x95, 0x29, 0xd7, 0x7b, 0xb3, 0xb8, 0x8e, 0x32, + 0xa4, 0xa6, 0x13, 0x88, 0x19, 0x5f, 0x8e, 0x80, 0xff, 0x9e, 0x03, 0x1b, 0x9e, 0xe3, 0x77, 0x30, + 0x74, 0xbb, 0x1d, 0x0b, 0xba, 0xd0, 0xd6, 0xe9, 0x25, 0x2b, 0xbb, 0xdc, 0xde, 0xdb, 0xad, 0x2f, + 0x62, 0xfc, 0x1f, 0x03, 0xf1, 0x95, 0xed, 0x90, 0xf3, 0xc8, 0x90, 0x4d, 0xe4, 0x29, 0x4e, 0xe8, + 0x60, 0x1f, 0x12, 0xfa, 0x7b, 0x1e, 0x19, 0x4d, 0x6c, 0xf5, 0x9a, 0x36, 0x52, 0x48, 0x3f, 0x80, + 0x58, 0x3e, 0xf6, 0xc9, 0x70, 0x20, 0x0a, 0x7d, 0xdd, 0x73, 0x5f, 0x4b, 0x53, 0x78, 0x25, 0xed, + 0xb9, 0xe7, 0xf8, 0xa7, 0xd0, 0xed, 0xb6, 0xb3, 0x35, 0xfe, 0x18, 0x3c, 0x67, 0x08, 0x14, 0x76, + 0x74, 0xcb, 0x0a, 0x21, 0xc6, 0xf5, 0x2a, 0xbd, 0xc0, 0xce, 0x70, 0x20, 0xd6, 0x13, 0xb6, 0x09, + 0x88, 0xa4, 0xad, 0x67, 0x6b, 0x87, 0xc9, 0x52, 0x4c, 0x75, 0x99, 0xea, 0x9e, 0x51, 0x3d, 0x29, + 0x52, 0x4d, 0x40, 0x24, 0x6d, 0x3d, 0x5b, 0x4b, 0xa9, 0x3e, 0x03, 0xb5, 0x20, 0x32, 0x7a, 0xb0, + 0x5f, 0xaf, 0x51, 0x91, 0x37, 0xe5, 0xc4, 0x75, 0x72, 0xea, 0x3a, 0xf9, 0xd0, 0xef, 0xb7, 0xea, + 0xbf, 0xfc, 0xdc, 0xdc, 0x64, 0xea, 0x9b, 0x61, 0x3f, 0x20, 0x48, 0xfe, 0x3c, 0x32, 0x4e, 0x60, + 0x5f, 0x63, 0xa7, 0xf9, 0x8f, 0xc0, 0x93, 0x4b, 0xdd, 0x8d, 0x60, 0xfd, 0x2d, 0x4a, 0xb3, 0x9d, + 0xd6, 0x2a, 0xb6, 0x5a, 0xae, 0x50, 0x4e, 0x5a, 0xed, 0x04, 0xfd, 0x7a, 0xe5, 0x87, 0x6b, 0xb1, + 0xf4, 0x70, 0x2d, 0x96, 0xa4, 0x1d, 0x20, 0x4c, 0x9a, 0x4a, 0x83, 0x38, 0x40, 0x3e, 0x86, 0xd2, + 0x4f, 0x15, 0xb0, 0xae, 0x62, 0xfb, 0x53, 0xcb, 0x21, 0x4b, 0x72, 0xdc, 0x27, 0xd3, 0x34, 0x2d, + 0x53, 0x4d, 0xf9, 0xe1, 0x40, 0x7c, 0x96, 0x68, 0x3a, 0x47, 0xc9, 0x10, 0xac, 0x8d, 0x1c, 0xd7, + 0x09, 0x75, 0x02, 0x99, 0xbd, 0x8e, 0xff, 0x8b, 0xb5, 0xda, 0xd0, 0x1c, 0x0e, 0xc4, 0x17, 0x49, + 0xb4, 0x02, 0x9f, 0xa4, 0x3d, 0x33, 0xc7, 0xac, 0xce, 0x7f, 0x37, 0xdd, 0xd6, 0x89, 0xab, 0xd4, + 0x65, 0x5b, 0x3a, 0x57, 0x3d, 0x01, 0xd4, 0x8b, 0xe5, 0xc9, 0x6a, 0xf7, 0x37, 0x07, 0x56, 0x55, + 0x6c, 0xb3, 0x73, 0x70, 0x7a, 0x23, 0x70, 0xff, 0x5f, 0x23, 0x94, 0x1f, 0xd5, 0x08, 0x1f, 0x83, + 0x9a, 0xee, 0xa1, 0xc8, 0x27, 0xb4, 0x6a, 0x0b, 0x38, 0x98, 0xc1, 0x73, 0x22, 0x6c, 0x81, 0x8d, + 0x5c, 0x9e, 0x59, 0xfe, 0xbf, 0x96, 0xe9, 0xbc, 0x6c, 0x41, 0xdb, 0xf1, 0x35, 0x68, 0x2d, 0x41, + 0x86, 0x33, 0xb0, 0x35, 0xca, 0x11, 0x87, 0x66, 0x41, 0x8a, 0xdd, 0xe1, 0x40, 0xdc, 0x29, 0x4a, + 0x91, 0x83, 0x49, 0xda, 0x46, 0xb6, 0x7e, 0x1a, 0x9a, 0x53, 0x59, 0x2d, 0x4c, 0x32, 0xd6, 0xca, + 0x6c, 0xd6, 0x1c, 0x2c, 0xcf, 0xda, 0xc6, 0x64, 0x52, 0xe7, 0xea, 0x63, 0x75, 0xee, 0xd1, 0x51, + 0x51, 0xd0, 0x33, 0x95, 0x9b, 0x57, 0x69, 0x1f, 0x06, 0x2e, 0x8c, 0x2d, 0xda, 0x89, 0xdf, 0x4c, + 0x36, 0x19, 0x84, 0x89, 0xd1, 0x76, 0x96, 0x3e, 0xa8, 0xad, 0x95, 0x38, 0xd4, 0xd5, 0x9f, 0x22, + 0x47, 0x5b, 0x8c, 0x1d, 0x8e, 0xb7, 0xa5, 0x07, 0x0e, 0x3c, 0x55, 0xb1, 0xfd, 0xa5, 0x6f, 0xbd, + 0xf1, 0xfe, 0xed, 0x82, 0xad, 0xb1, 0x4c, 0x97, 0x24, 0xe9, 0xc1, 0x8f, 0x55, 0x50, 0x51, 0xb1, + 0xcd, 0x5f, 0x80, 0xb5, 0xe2, 0x47, 0xc4, 0xfb, 0xb3, 0xa6, 0xf7, 0xe4, 0xdb, 0x20, 0x1c, 0x2c, + 0x8e, 0xcd, 0x32, 0xe9, 0x81, 0xa7, 0xe3, 0x6f, 0xc8, 0xde, 0x1c, 0x92, 0x31, 0xa4, 0xf0, 0xc1, + 0xa2, 0xc8, 0x2c, 0xd8, 0x37, 0x60, 0x25, 0x1b, 0x7a, 0x2f, 0xe7, 0x9c, 0x4e, 0x41, 0xc2, 0xab, + 0x05, 0x40, 0x19, 0xfb, 0x05, 0x58, 0x2b, 0x8e, 0x94, 0x79, 0xea, 0x15, 0xb0, 0x73, 0xd5, 0x9b, + 0xd5, 0x5a, 0x06, 0x00, 0xb9, 0x3e, 0x78, 0x77, 0x0e, 0xc3, 0x08, 0x26, 0x34, 0x17, 0x82, 0xa5, + 0x31, 0x5a, 0x27, 0x37, 0x77, 0x0d, 0xee, 0xf6, 0xae, 0xc1, 0xfd, 0x75, 0xd7, 0xe0, 0xae, 0xee, + 0x1b, 0xa5, 0xdb, 0xfb, 0x46, 0xe9, 0xf7, 0xfb, 0x46, 0xe9, 0xeb, 0xfd, 0x7f, 0x7f, 0xcb, 0x3c, + 0x64, 0x45, 0x2e, 0xcc, 0x3e, 0x60, 0x8d, 0x1a, 0xf5, 0xe5, 0x87, 0xff, 0x04, 0x00, 0x00, 0xff, + 0xff, 0xcc, 0xe2, 0x49, 0x82, 0x9f, 0x0b, 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 { + // CreateValidator defines a method for creating a new validator. + CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) + // EditValidator defines a method for editing an existing validator. + EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) + // BeginRedelegate defines a method for performing a redelegation + // of coins from a delegator and source validator to a destination validator. + BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) + // Undelegate defines a method for performing an undelegation from a + // delegate and a validator. + Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) { + out := new(MsgCreateValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/CreateValidator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) { + out := new(MsgEditValidatorResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/EditValidator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { + out := new(MsgDelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Delegate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) { + out := new(MsgBeginRedelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/BeginRedelegate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) { + out := new(MsgUndelegateResponse) + err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Undelegate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateValidator defines a method for creating a new validator. + CreateValidator(context.Context, *MsgCreateValidator) (*MsgCreateValidatorResponse, error) + // EditValidator defines a method for editing an existing validator. + EditValidator(context.Context, *MsgEditValidator) (*MsgEditValidatorResponse, error) + // Delegate defines a method for performing a delegation of coins + // from a delegator to a validator. + Delegate(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) + // BeginRedelegate defines a method for performing a redelegation + // of coins from a delegator and source validator to a destination validator. + BeginRedelegate(context.Context, *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) + // Undelegate defines a method for performing an undelegation from a + // delegate and a validator. + Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateValidator(ctx context.Context, req *MsgCreateValidator) (*MsgCreateValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateValidator not implemented") +} +func (*UnimplementedMsgServer) EditValidator(ctx context.Context, req *MsgEditValidator) (*MsgEditValidatorResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EditValidator not implemented") +} +func (*UnimplementedMsgServer) Delegate(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Delegate not implemented") +} +func (*UnimplementedMsgServer) BeginRedelegate(ctx context.Context, req *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BeginRedelegate not implemented") +} +func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegate) (*MsgUndelegateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateValidator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/CreateValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateValidator(ctx, req.(*MsgCreateValidator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_EditValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEditValidator) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EditValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/EditValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EditValidator(ctx, req.(*MsgEditValidator)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Delegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDelegate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Delegate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/Delegate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Delegate(ctx, req.(*MsgDelegate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_BeginRedelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBeginRedelegate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).BeginRedelegate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/BeginRedelegate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).BeginRedelegate(ctx, req.(*MsgBeginRedelegate)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUndelegate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Undelegate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmos.staking.v1beta1.Msg/Undelegate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Undelegate(ctx, req.(*MsgUndelegate)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmos.staking.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateValidator", + Handler: _Msg_CreateValidator_Handler, + }, + { + MethodName: "EditValidator", + Handler: _Msg_EditValidator_Handler, + }, + { + MethodName: "Delegate", + Handler: _Msg_Delegate_Handler, + }, + { + MethodName: "BeginRedelegate", + Handler: _Msg_BeginRedelegate_Handler, + }, + { + MethodName: "Undelegate", + Handler: _Msg_Undelegate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmos/staking/v1beta1/tx.proto", +} + +func (m *MsgCreateValidator) 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 *MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if m.Pubkey != nil { + { + size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x2a + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0x22 + } + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCreateValidatorResponse) 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 *MsgCreateValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgEditValidator) 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 *MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MinSelfDelegation != nil { + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.CommissionRate != nil { + { + size := m.CommissionRate.Size() + i -= size + if _, err := m.CommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgEditValidatorResponse) 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 *MsgEditValidatorResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDelegate) 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 *MsgDelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDelegateResponse) 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 *MsgDelegateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgBeginRedelegate) 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 *MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBeginRedelegateResponse) 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 *MsgBeginRedelegateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBeginRedelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintTx(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgUndelegate) 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 *MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUndelegateResponse) 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 *MsgUndelegateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUndelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintTx(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0xa + 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 *MsgCreateValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Commission.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Pubkey != nil { + l = m.Pubkey.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = m.Value.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgCreateValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgEditValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Description.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CommissionRate != nil { + l = m.CommissionRate.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.MinSelfDelegation != nil { + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgEditValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgDelegateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgBeginRedelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBeginRedelegateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUndelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUndelegateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTx(uint64(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 *MsgCreateValidator) 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: MsgCreateValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", 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.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", 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 + } + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pubkey == nil { + m.Pubkey = &types.Any{} + } + if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value.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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateValidatorResponse) 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: MsgCreateValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidatorResponse: 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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgEditValidator) 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: MsgEditValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", 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 + } + var v github_com_irisnet_irishub_sdk_go_types.Dec + m.CommissionRate = &v + if err := m.CommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", 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 + } + var v github_com_irisnet_irishub_sdk_go_types.Int + m.MinSelfDelegation = &v + if err := m.MinSelfDelegation.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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgEditValidatorResponse) 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: MsgEditValidatorResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditValidatorResponse: 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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDelegate) 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: MsgDelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Amount.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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDelegateResponse) 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: MsgDelegateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegateResponse: 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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBeginRedelegate) 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: MsgBeginRedelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", 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.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", 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.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Amount.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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBeginRedelegateResponse) 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: MsgBeginRedelegateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBeginRedelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, 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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUndelegate) 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: MsgUndelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUndelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.Amount.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 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUndelegateResponse) 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: MsgUndelegateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUndelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, 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 { + return ErrInvalidLengthTx + } + if (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/module-sdk/staking/types.go b/module-sdk/staking/types.go new file mode 100644 index 00000000..dcfa3b1f --- /dev/null +++ b/module-sdk/staking/types.go @@ -0,0 +1,515 @@ +package staking + +import ( + "bytes" + "github.com/irisnet/core-sdk-go/common/codec" + codectypes "github.com/irisnet/core-sdk-go/common/codec/types" + crypto "github.com/irisnet/core-sdk-go/common/crypto/types" + sdk "github.com/irisnet/core-sdk-go/types" + tmtypes "github.com/tendermint/tendermint/types" +) + +const ( + ModuleName = "staking" +) + +var ( + _ sdk.Msg = &MsgCreateValidator{} + _ codectypes.UnpackInterfacesMessage = (*MsgCreateValidator)(nil) + _ sdk.Msg = &MsgCreateValidator{} + _ sdk.Msg = &MsgEditValidator{} + _ sdk.Msg = &MsgDelegate{} + _ sdk.Msg = &MsgUndelegate{} + _ sdk.Msg = &MsgBeginRedelegate{} +) + +// DelegationI delegation bond for a delegated proof of stake system +type DelegationI interface { + GetDelegatorAddr() sdk.AccAddress // delegator sdk.AccAddress for the bond + GetValidatorAddr() sdk.ValAddress // validator operator address + GetShares() sdk.Dec // amount of validator's shares held in this delegation +} + +// ValidatorI expected validator functions +type ValidatorI interface { + IsJailed() bool // whether the validator is jailed + GetMoniker() string // moniker of the validator + GetStatus() BondStatus // status of the validator + IsBonded() bool // check if has a bonded status + IsUnbonded() bool // check if has status unbonded + IsUnbonding() bool // check if has status unbonding + GetOperator() sdk.ValAddress // operator address to receive/return validators coins + TmConsPubKey() (crypto.PubKey, error) // validation consensus pubkey + GetConsAddr() (sdk.ConsAddress, error) // validation consensus address + GetTokens() sdk.Int // validation tokens + GetBondedTokens() sdk.Int // validator bonded tokens + GetConsensusPower() int64 // validation power in tendermint + GetCommission() sdk.Dec // validator commission rate + GetMinSelfDelegation() sdk.Int // validator minimum self delegation + GetDelegatorShares() sdk.Dec // total outstanding delegator shares + TokensFromShares(sdk.Dec) sdk.Dec // token worth of provided delegator shares + TokensFromSharesTruncated(sdk.Dec) sdk.Dec // token worth of provided delegator shares, truncated + TokensFromSharesRoundUp(sdk.Dec) sdk.Dec // token worth of provided delegator shares, rounded up + SharesFromTokens(amt sdk.Int) (sdk.Dec, error) // shares worth of delegator's bond + SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, error) // truncated shares worth of delegator's bond +} + +func (msg MsgCreateValidator) Route() string { return ModuleName } + +func (msg MsgCreateValidator) Type() string { return "create_validator" } + +func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress { + // delegator is first signer so delegator pays fees + delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + addrs := []sdk.AccAddress{delAddr} + addr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + panic(err) + } + if !bytes.Equal(delAddr.Bytes(), addr.Bytes()) { + addrs = append(addrs, sdk.AccAddress(addr)) + } + + return addrs +} + +func (msg MsgCreateValidator) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgCreateValidator) ValidateBasic() error { + // note that unmarshaling from bech32 ensures either empty or valid + delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return err + } + if delAddr.Empty() { + return sdk.Wrapf("missing delegatorAddr") + } + + if msg.ValidatorAddress == "" { + return sdk.Wrapf("missing validatorAddr") + } + + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return sdk.Wrap(err) + } + if !sdk.AccAddress(valAddr).Equals(delAddr) { + return sdk.Wrapf("validatorAddr must equal delegatorAddr, validatorAddr:[%s], delegatorAddr:[%s]", valAddr, delAddr) + } + + if msg.Pubkey == nil { + return sdk.Wrapf("missing validatorPubKey") + } + + if msg.Description == (Description{}) { + return sdk.Wrapf("missing description") + } + + if msg.Commission == (CommissionRates{}) { + return sdk.Wrapf("missing commission") + } + + if !msg.MinSelfDelegation.IsPositive() { + return sdk.Wrapf("minSelfDelegation isn't positive") + } + + return nil +} + +func (msg MsgCreateValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var pubKey crypto.PubKey + return unpacker.UnpackAny(msg.Pubkey, &pubKey) +} + +func (msg MsgEditValidator) Route() string { return ModuleName } + +func (msg MsgEditValidator) Type() string { return "edit_validator" } + +func (msg MsgEditValidator) GetSigners() []sdk.AccAddress { + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{valAddr.Bytes()} +} + +func (msg MsgEditValidator) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgEditValidator) ValidateBasic() error { + if msg.ValidatorAddress == "" { + return sdk.Wrapf("missing validatorAddress") + } + + if msg.Description == (Description{}) { + return sdk.Wrapf("missing description") + } + + if msg.MinSelfDelegation != nil && !msg.MinSelfDelegation.IsPositive() { + return sdk.Wrapf("minSelfDelegation isn't positive") + } + + return nil +} + +func (msg MsgDelegate) Route() string { return ModuleName } + +func (msg MsgDelegate) Type() string { return "delegate" } + +func (msg MsgDelegate) GetSigners() []sdk.AccAddress { + delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delAddr} +} + +func (msg MsgDelegate) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgDelegate) ValidateBasic() error { + if msg.DelegatorAddress == "" { + return sdk.Wrapf("missing delegatorAddress") + } + + if msg.ValidatorAddress == "" { + return sdk.Wrapf("missing errEmptyValidatorAddr") + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return sdk.Wrapf("amount isn't positive or valid") + } + + return nil +} + +func (msg MsgBeginRedelegate) Route() string { return ModuleName } + +func (msg MsgBeginRedelegate) Type() string { return "begin_redelegate" } + +func (msg MsgBeginRedelegate) GetSigners() []sdk.AccAddress { + delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delAddr} +} + +func (msg MsgBeginRedelegate) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgBeginRedelegate) ValidateBasic() error { + if msg.DelegatorAddress == "" { + return sdk.Wrapf("missing delegatorAddress") + } + + if msg.ValidatorSrcAddress == "" { + return sdk.Wrapf("missing validatorSrcAddress") + } + + if msg.ValidatorDstAddress == "" { + return sdk.Wrapf("missing validatorDstAddress") + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return sdk.Wrapf("amount isn't positive or valid") + } + + return nil +} + +func (msg MsgUndelegate) Route() string { return ModuleName } + +func (msg MsgUndelegate) Type() string { return "begin_unbonding" } + +func (msg MsgUndelegate) GetSigners() []sdk.AccAddress { + delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{delAddr} +} + +func (msg MsgUndelegate) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +func (msg MsgUndelegate) ValidateBasic() error { + if msg.DelegatorAddress == "" { + return sdk.Wrapf("missing delegatorAddr") + } + + if msg.ValidatorAddress == "" { + return sdk.Wrapf("missing validatorAddress") + } + + if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { + return sdk.Wrapf("amount isn't positive or valid") + } + + return nil +} + +func (q QueryValidatorsResponse) Convert(cdc codec.Marshaler) interface{} { + var validatorResps []QueryValidatorResp + for _, v := range q.Validators { + validatorResps = append(validatorResps, v.Convert(cdc).(QueryValidatorResp)) + } + + return QueryValidatorsResp{ + Validators: validatorResps, + Total: q.Pagination.Total, + } +} + +func (v Validator) Convert(cdc codec.Marshaler) interface{} { + pubKey, _ := v.GetPubKey(cdc) + return QueryValidatorResp{ + OperatorAddress: v.OperatorAddress, + ConsensusPubkey: pubKey.String(), + Jailed: v.Jailed, + Status: BondStatus_name[int32(v.Status)], + Tokens: v.Tokens, + DelegatorShares: v.DelegatorShares, + Description: description{ + Moniker: v.Description.Moniker, + Identity: v.Description.Identity, + Website: v.Description.Website, + SecurityContact: v.Description.SecurityContact, + Details: v.Description.Details, + }, + UnbondingHeight: v.UnbondingHeight, + UnbondingTime: v.UnbondingTime, + Commission: commission{ + commissionRates: commissionRates{ + Rate: v.Commission.Rate, + MaxRate: v.Commission.MaxRate, + MaxChangeRate: v.Commission.MaxChangeRate, + }, + UpdateTime: v.Commission.UpdateTime, + }, + MinSelfDelegation: v.MinSelfDelegation, + } +} + +// GetPubKey - Implements Validator. +func (v Validator) GetPubKey(unpacker codectypes.AnyUnpacker) (pk crypto.PubKey, err error) { + if v.ConsensusPubkey == nil { + return nil, nil + } + + var pubKey crypto.PubKey + if err = unpacker.UnpackAny(v.ConsensusPubkey, &pubKey); err != nil { + return nil, err + } + return pubKey, nil +} + +func (q QueryValidatorDelegationsResponse) Convert() interface{} { + var delegationResps []QueryDelegationResp + for _, v := range q.DelegationResponses { + delegationResps = append(delegationResps, v.Convert().(QueryDelegationResp)) + } + + return QueryValidatorDelegationsResp{ + DelegationResponses: delegationResps, + Total: q.Pagination.Total, + } +} + +func (d DelegationResponse) Convert() interface{} { + return QueryDelegationResp{ + Delegation: delegation{ + DelegatorAddress: d.Delegation.DelegatorAddress, + ValidatorAddress: d.Delegation.ValidatorAddress, + Shares: d.Delegation.Shares, + }, + Balance: sdk.Coin{ + Denom: d.Balance.Denom, + Amount: d.Balance.Amount, + }, + } +} + +func (q QueryValidatorUnbondingDelegationsResponse) Convert() interface{} { + var unbondingDelegations []QueryUnbondingDelegationResp + for _, v := range q.UnbondingResponses { + unbondingDelegations = append(unbondingDelegations, v.Convert().(QueryUnbondingDelegationResp)) + } + + return QueryValidatorUnbondingDelegationsResp{ + UnbondingResponses: unbondingDelegations, + Total: q.Pagination.Total, + } +} + +func (u UnbondingDelegation) Convert() interface{} { + var entries []unbondingDelegationEntry + for _, v := range u.Entries { + entries = append(entries, v.Convert().(unbondingDelegationEntry)) + } + + return QueryUnbondingDelegationResp{ + DelegatorAddress: u.DelegatorAddress, + ValidatorAddress: u.ValidatorAddress, + Entries: entries, + } +} + +func (u UnbondingDelegationEntry) Convert() interface{} { + return unbondingDelegationEntry{ + CreationHeight: u.CreationHeight, + CompletionTime: u.CompletionTime, + InitialBalance: u.InitialBalance, + Balance: u.Balance, + } +} + +func (q QueryDelegatorDelegationsResponse) Convert() interface{} { + var delegationResps []QueryDelegationResp + for _, v := range q.DelegationResponses { + delegationResps = append(delegationResps, v.Convert().(QueryDelegationResp)) + } + + return QueryDelegatorDelegationsResp{ + DelegationResponses: delegationResps, + Total: 0, + } +} + +func (q QueryDelegatorUnbondingDelegationsResponse) Convert() interface{} { + var unbondingDelegations []QueryUnbondingDelegationResp + for _, v := range q.UnbondingResponses { + unbondingDelegations = append(unbondingDelegations, v.Convert().(QueryUnbondingDelegationResp)) + } + return QueryDelegatorUnbondingDelegationsResp{ + UnbondingDelegations: unbondingDelegations, + Total: q.Pagination.Total, + } +} + +func (q QueryRedelegationsResponse) Convert() interface{} { + var redelegationResps []RedelegationResp + for _, v := range q.RedelegationResponses { + redelegationResps = append(redelegationResps, v.Convert().(RedelegationResp)) + } + + return QueryRedelegationsResp{ + RedelegationResponses: redelegationResps, + Total: q.Pagination.Total, + } +} + +func (r RedelegationResponse) Convert() interface{} { + var outerEntries []redelegationEntryResponse + for _, v := range r.Entries { + outerEntries = append(outerEntries, v.Convert().(redelegationEntryResponse)) + } + + var innerEntries []redelegationEntry + for _, v := range r.Redelegation.Entries { + innerEntries = append(innerEntries, v.Convert().(redelegationEntry)) + } + + return RedelegationResp{ + Redelegation: redelegation{ + DelegatorAddress: r.Redelegation.DelegatorAddress, + ValidatorSrcAddress: r.Redelegation.ValidatorSrcAddress, + ValidatorDstAddress: r.Redelegation.ValidatorDstAddress, + Entries: innerEntries, + }, + Entries: outerEntries, + } +} + +func (r RedelegationEntry) Convert() interface{} { + return redelegationEntry{ + CreationHeight: r.CreationHeight, + CompletionTime: r.CompletionTime, + InitialBalance: r.InitialBalance, + SharesDst: r.SharesDst, + } +} + +func (r RedelegationEntryResponse) Convert() interface{} { + return redelegationEntryResponse{ + RedelegationEntry: redelegationEntry{ + CreationHeight: r.RedelegationEntry.CreationHeight, + CompletionTime: r.RedelegationEntry.CompletionTime, + InitialBalance: r.RedelegationEntry.InitialBalance, + SharesDst: r.RedelegationEntry.SharesDst, + }, + Balance: r.Balance, + } +} + +func (q QueryDelegatorValidatorsResponse) Convert(cdc codec.Marshaler) interface{} { + var validators []QueryValidatorResp + for _, v := range q.Validators { + validators = append(validators, v.Convert(cdc).(QueryValidatorResp)) + } + + return QueryDelegatorValidatorsResp{ + Validator: validators, + Total: q.Pagination.Total, + } +} + +func (q QueryHistoricalInfoResponse) Convert(cdc codec.Marshaler) interface{} { + var valset []QueryValidatorResp + for _, v := range q.Hist.Valset { + valset = append(valset, v.Convert(cdc).(QueryValidatorResp)) + } + + header := q.Hist.Header + lastBlockId := q.Hist.Header.LastBlockId.PartSetHeader + partSetHeader := q.Hist.Header.LastBlockId.PartSetHeader + return QueryHistoricalInfoResp{ + Header: sdk.Header{ + Version: header.Version, + ChainID: header.ChainID, + Height: header.Height, + Time: header.Time, + LastBlockID: tmtypes.BlockID{ + Hash: lastBlockId.Hash, + PartSetHeader: tmtypes.PartSetHeader{ + Total: partSetHeader.Total, + Hash: partSetHeader.Hash, + }, + }, + LastCommitHash: header.LastCommitHash, + DataHash: header.DataHash, + ValidatorsHash: header.ValidatorsHash, + NextValidatorsHash: header.NextValidatorsHash, + ConsensusHash: header.ConsensusHash, + AppHash: header.AppHash, + LastResultsHash: header.LastResultsHash, + EvidenceHash: header.EvidenceHash, + ProposerAddress: header.ProposerAddress, + }, + Valset: valset, + } +} + +func (q QueryParamsResponse) Convert() interface{} { + return QueryParamsResp{ + UnbondingTime: q.Params.UnbondingTime, + MaxValidators: q.Params.MaxValidators, + MaxEntries: q.Params.MaxEntries, + HistoricalEntries: q.Params.HistoricalEntries, + BondDenom: q.Params.BondDenom, + } +} diff --git a/module-sdk/token/codec.go b/module-sdk/token/codec.go new file mode 100644 index 00000000..24e569dd --- /dev/null +++ b/module-sdk/token/codec.go @@ -0,0 +1,29 @@ +package token + +import ( + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + sdk "github.com/irisnet/core-sdk-go/types" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgIssueToken{}, + &MsgEditToken{}, + &MsgMintToken{}, + &MsgTransferTokenOwner{}, + ) + registry.RegisterInterface("irismod.token.TokenI", (*TokenInterface)(nil), &Token{}) +} diff --git a/module-sdk/token/export.go b/module-sdk/token/export.go new file mode 100644 index 00000000..5e93ab47 --- /dev/null +++ b/module-sdk/token/export.go @@ -0,0 +1,50 @@ +package token + +import ( + sdk "github.com/irisnet/core-sdk-go/types" +) + +type Client interface { + sdk.Module + + IssueToken(req IssueTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + EditToken(req EditTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + TransferToken(to string, symbol string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + MintToken(symbol string, amount uint64, to string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) + + QueryToken(symbol string) (sdk.Token, error) + QueryTokens(owner string) (sdk.Tokens, error) + QueryFees(symbol string) (QueryFeesResp, error) + QueryParams() (QueryParamsResp, error) +} + +type IssueTokenRequest struct { + Symbol string `json:"symbol"` + Name string `json:"name"` + Scale uint32 `json:"scale"` + MinUnit string `json:"min_unit"` + InitialSupply uint64 `json:"initial_supply"` + MaxSupply uint64 `json:"max_supply"` + Mintable bool `json:"mintable"` +} + +type EditTokenRequest struct { + Symbol string `json:"symbol"` + Name string `json:"name"` + MaxSupply uint64 `json:"max_supply"` + Mintable bool `json:"mintable"` +} + +// QueryFeesResp is for the token fees query output +type QueryFeesResp struct { + Exist bool `json:"exist"` // indicate if the token has existed + IssueFee sdk.Coin `json:"issue_fee"` // issue fee + MintFee sdk.Coin `json:"mint_fee"` // mint fee +} + +// token params +type QueryParamsResp struct { + TokenTaxRate string `json:"token_tax_rate"` // e.g., 40% + IssueTokenBaseFee string `json:"issue_token_base_fee"` // e.g., 300000*10^18iris-atto + MintTokenFeeRatio string `json:"mint_token_fee_ratio"` // e.g., 10% +} diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod new file mode 100644 index 00000000..b9a86a4a --- /dev/null +++ b/module-sdk/token/go.mod @@ -0,0 +1,13 @@ +module token + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/token/params.go b/module-sdk/token/params.go new file mode 100644 index 00000000..a2d2eef5 --- /dev/null +++ b/module-sdk/token/params.go @@ -0,0 +1,16 @@ +package token + +import ( + yaml "gopkg.in/yaml.v2" +) + +// String implements the stringer interface. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + +func (t Token) String() string { + bz, _ := yaml.Marshal(t) + return string(bz) +} diff --git a/module-sdk/token/query.pb.go b/module-sdk/token/query.pb.go new file mode 100644 index 00000000..b0f1887b --- /dev/null +++ b/module-sdk/token/query.pb.go @@ -0,0 +1,1880 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: token/query.proto + +package token + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + types "github.com/irisnet/core-sdk-go/common/codec/types" + _ "github.com/irisnet/core-sdk-go/types" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + query "github.com/irisnet/core-sdk-go/types/query" + _ "github.com/regen-network/cosmos-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 + +// QueryTokenRequest is request type for the Query/Token RPC method +type QueryTokenRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *QueryTokenRequest) Reset() { *m = QueryTokenRequest{} } +func (m *QueryTokenRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokenRequest) ProtoMessage() {} +func (*QueryTokenRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ec043bcd18c4056e, []int{0} +} +func (m *QueryTokenRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenRequest.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 *QueryTokenRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenRequest.Merge(m, src) +} +func (m *QueryTokenRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenRequest proto.InternalMessageInfo + +func (m *QueryTokenRequest) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QueryTokenResponse is response type for the Query/Token RPC method +type QueryTokenResponse struct { + Token *types.Any `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"` +} + +func (m *QueryTokenResponse) Reset() { *m = QueryTokenResponse{} } +func (m *QueryTokenResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokenResponse) ProtoMessage() {} +func (*QueryTokenResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ec043bcd18c4056e, []int{1} +} +func (m *QueryTokenResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokenResponse.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 *QueryTokenResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokenResponse.Merge(m, src) +} +func (m *QueryTokenResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokenResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokenResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokenResponse proto.InternalMessageInfo + +func (m *QueryTokenResponse) GetToken() *types.Any { + if m != nil { + return m.Token + } + return nil +} + +// QueryTokensRequest is request type for the Query/Tokens RPC method +type QueryTokensRequest struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *QueryTokensRequest) Reset() { *m = QueryTokensRequest{} } +func (m *QueryTokensRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTokensRequest) ProtoMessage() {} +func (*QueryTokensRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ec043bcd18c4056e, []int{2} +} +func (m *QueryTokensRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokensRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokensRequest.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 *QueryTokensRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokensRequest.Merge(m, src) +} +func (m *QueryTokensRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTokensRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokensRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokensRequest proto.InternalMessageInfo + +func (m *QueryTokensRequest) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +// QueryTokensResponse is response type for the Query/Tokens RPC method +type QueryTokensResponse struct { + Tokens []*types.Any `protobuf:"bytes,1,rep,name=Tokens,proto3" json:"Tokens,omitempty"` +} + +func (m *QueryTokensResponse) Reset() { *m = QueryTokensResponse{} } +func (m *QueryTokensResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTokensResponse) ProtoMessage() {} +func (*QueryTokensResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ec043bcd18c4056e, []int{3} +} +func (m *QueryTokensResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTokensResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTokensResponse.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 *QueryTokensResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTokensResponse.Merge(m, src) +} +func (m *QueryTokensResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTokensResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTokensResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTokensResponse proto.InternalMessageInfo + +func (m *QueryTokensResponse) GetTokens() []*types.Any { + if m != nil { + return m.Tokens + } + return nil +} + +// QueryFeesRequest is request type for the Query/Fees RPC method +type QueryFeesRequest struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` +} + +func (m *QueryFeesRequest) Reset() { *m = QueryFeesRequest{} } +func (m *QueryFeesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFeesRequest) ProtoMessage() {} +func (*QueryFeesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ec043bcd18c4056e, []int{4} +} +func (m *QueryFeesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeesRequest.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 *QueryFeesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeesRequest.Merge(m, src) +} +func (m *QueryFeesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryFeesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeesRequest proto.InternalMessageInfo + +func (m *QueryFeesRequest) GetSymbol() string { + if m != nil { + return m.Symbol + } + return "" +} + +// QueryFeesResponse is response type for the Query/Fees RPC method +type QueryFeesResponse struct { + Exist bool `protobuf:"varint,1,opt,name=exist,proto3" json:"exist,omitempty"` + IssueFee github_com_irisnet_irishub_sdk_go_types.Coin `protobuf:"bytes,2,opt,name=issue_fee,json=issueFee,proto3,casttype=github.com/irisnet/irishub-sdk-go/types.Coin" json:"issue_fee" yaml:"issue_fee"` + MintFee github_com_irisnet_irishub_sdk_go_types.Coin `protobuf:"bytes,3,opt,name=mint_fee,json=mintFee,proto3,casttype=github.com/irisnet/irishub-sdk-go/types.Coin" json:"mint_fee" yaml:"mint_fee"` +} + +func (m *QueryFeesResponse) Reset() { *m = QueryFeesResponse{} } +func (m *QueryFeesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFeesResponse) ProtoMessage() {} +func (*QueryFeesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ec043bcd18c4056e, []int{5} +} +func (m *QueryFeesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryFeesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryFeesResponse.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 *QueryFeesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFeesResponse.Merge(m, src) +} +func (m *QueryFeesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryFeesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFeesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryFeesResponse proto.InternalMessageInfo + +func (m *QueryFeesResponse) GetExist() bool { + if m != nil { + return m.Exist + } + return false +} + +func (m *QueryFeesResponse) GetIssueFee() github_com_irisnet_irishub_sdk_go_types.Coin { + if m != nil { + return m.IssueFee + } + return github_com_irisnet_irishub_sdk_go_types.Coin{} +} + +func (m *QueryFeesResponse) GetMintFee() github_com_irisnet_irishub_sdk_go_types.Coin { + if m != nil { + return m.MintFee + } + return github_com_irisnet_irishub_sdk_go_types.Coin{} +} + +// QueryParametersRequest is request type for the Query/Parameters 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_ec043bcd18c4056e, []int{6} +} +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 + +// QueryParametersResponse is response type for the Query/Parameters RPC method +type QueryParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` +} + +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_ec043bcd18c4056e, []int{7} +} +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{} +} + +func (m *QueryParamsResponse) GetRes() *query.PageResponse { + if m != nil { + return m.Res + } + return nil +} + +func init() { + proto.RegisterType((*QueryTokenRequest)(nil), "irismod.token.QueryTokenRequest") + proto.RegisterType((*QueryTokenResponse)(nil), "irismod.token.QueryTokenResponse") + proto.RegisterType((*QueryTokensRequest)(nil), "irismod.token.QueryTokensRequest") + proto.RegisterType((*QueryTokensResponse)(nil), "irismod.token.QueryTokensResponse") + proto.RegisterType((*QueryFeesRequest)(nil), "irismod.token.QueryFeesRequest") + proto.RegisterType((*QueryFeesResponse)(nil), "irismod.token.QueryFeesResponse") + proto.RegisterType((*QueryParamsRequest)(nil), "irismod.token.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "irismod.token.QueryParamsResponse") +} + +func init() { proto.RegisterFile("token/query.proto", fileDescriptor_ec043bcd18c4056e) } + +var fileDescriptor_ec043bcd18c4056e = []byte{ + // 675 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x4f, 0x13, 0x4f, + 0x14, 0xee, 0x52, 0xda, 0x5f, 0x99, 0x9f, 0x46, 0x18, 0x8b, 0x42, 0x03, 0xdb, 0xba, 0xd1, 0xa8, + 0x44, 0x76, 0x02, 0x5c, 0x94, 0x9b, 0x25, 0x41, 0xb9, 0x18, 0xd8, 0x78, 0xf2, 0x42, 0x76, 0xe9, + 0x63, 0xd9, 0xd0, 0x9d, 0x29, 0x9d, 0x59, 0xb5, 0x21, 0x24, 0xc6, 0xc4, 0xbb, 0x89, 0x7f, 0x86, + 0x57, 0xff, 0x08, 0x62, 0x62, 0x42, 0xe2, 0xc5, 0x13, 0x31, 0xe0, 0x5f, 0xe0, 0xd1, 0x93, 0xd9, + 0x99, 0xb7, 0x64, 0x8b, 0x2d, 0xe8, 0xa5, 0xed, 0x7b, 0xf3, 0xbd, 0xef, 0x7b, 0x6f, 0xe6, 0x7b, + 0x25, 0x13, 0x4a, 0xec, 0x02, 0x67, 0x7b, 0x09, 0x74, 0x7b, 0x6e, 0xa7, 0x2b, 0x94, 0xa0, 0x57, + 0xa3, 0x6e, 0x24, 0x63, 0xd1, 0x72, 0xf5, 0x51, 0xcd, 0xde, 0x12, 0x32, 0x16, 0x92, 0x05, 0xbe, + 0x04, 0xf6, 0x72, 0x21, 0x00, 0xe5, 0x2f, 0xb0, 0x2d, 0x11, 0x71, 0x03, 0xaf, 0x4d, 0x9b, 0xf3, + 0x4d, 0x1d, 0x31, 0x13, 0xe0, 0xd1, 0x5c, 0xbe, 0x54, 0x4b, 0x9c, 0x11, 0x74, 0xfc, 0x30, 0xe2, + 0xbe, 0x8a, 0x44, 0x46, 0x53, 0x0d, 0x45, 0x28, 0x0c, 0x47, 0xfa, 0x0b, 0xb3, 0x33, 0xa1, 0x10, + 0x61, 0x1b, 0x98, 0xdf, 0x89, 0x98, 0xcf, 0xb9, 0x50, 0xba, 0x24, 0xe3, 0x9f, 0xc6, 0x53, 0x1d, + 0x05, 0xc9, 0x36, 0xf3, 0x39, 0x0e, 0x51, 0xc3, 0xb9, 0xf4, 0xa7, 0x49, 0x39, 0xf7, 0xc9, 0xc4, + 0x46, 0xda, 0xc3, 0xf3, 0x34, 0xe7, 0xc1, 0x5e, 0x02, 0x52, 0xd1, 0x2a, 0x29, 0xb5, 0x80, 0x8b, + 0x78, 0xca, 0x6a, 0x58, 0xf7, 0xc6, 0x3c, 0x13, 0x38, 0xcf, 0x08, 0xcd, 0x43, 0x65, 0x47, 0x70, + 0x09, 0xf4, 0x21, 0x29, 0xe9, 0x84, 0xc6, 0xfe, 0xbf, 0x58, 0x75, 0x8d, 0xbc, 0x9b, 0xc9, 0xbb, + 0x8f, 0x79, 0xaf, 0x79, 0xe5, 0xf3, 0xa7, 0xf9, 0xca, 0x8a, 0xe0, 0x0a, 0xb8, 0x5a, 0xf3, 0x4c, + 0x81, 0x33, 0x97, 0xe7, 0x93, 0x39, 0x6d, 0xf1, 0x8a, 0x43, 0x37, 0xd3, 0xd6, 0x81, 0xb3, 0x41, + 0xae, 0xf7, 0x61, 0x51, 0x7c, 0x99, 0x94, 0x4d, 0x66, 0xca, 0x6a, 0x14, 0xff, 0x52, 0x1d, 0x2b, + 0x9c, 0x39, 0x32, 0xae, 0x29, 0x57, 0x01, 0xce, 0xc4, 0x6f, 0x90, 0xb2, 0xec, 0xc5, 0x81, 0x68, + 0xa3, 0x3a, 0x46, 0xce, 0xc7, 0x11, 0xbc, 0x26, 0x03, 0x46, 0xf5, 0x2a, 0x29, 0xc1, 0xeb, 0x48, + 0x2a, 0x0d, 0xae, 0x78, 0x26, 0xa0, 0x6f, 0x2c, 0x32, 0x16, 0x49, 0x99, 0xc0, 0xe6, 0x36, 0xc0, + 0xd4, 0x88, 0xbe, 0x95, 0x69, 0x17, 0x2d, 0x90, 0x3e, 0xba, 0x8b, 0xcf, 0xed, 0xae, 0x88, 0x88, + 0x37, 0x9f, 0x1e, 0x1e, 0xd7, 0x0b, 0x3f, 0x8f, 0xeb, 0xe3, 0x3d, 0x3f, 0x6e, 0x2f, 0x3b, 0x67, + 0x95, 0xce, 0xaf, 0xe3, 0xfa, 0x83, 0x30, 0x52, 0x3b, 0x49, 0xe0, 0x6e, 0x89, 0x98, 0xa5, 0xfe, + 0xe3, 0xa0, 0xf4, 0xf7, 0x4e, 0x12, 0xcc, 0xcb, 0xd6, 0xee, 0x7c, 0x28, 0x98, 0xea, 0x75, 0x40, + 0x6a, 0x26, 0xaf, 0xa2, 0x6b, 0x57, 0x01, 0xe8, 0x01, 0xa9, 0xc4, 0x11, 0x57, 0xba, 0x81, 0xe2, + 0x65, 0x0d, 0x3c, 0xc1, 0x06, 0xae, 0x99, 0x06, 0xb2, 0xc2, 0x7f, 0xd7, 0xff, 0x2f, 0x2d, 0x5d, + 0x05, 0x70, 0xaa, 0xf8, 0xb0, 0xeb, 0x7e, 0xd7, 0x8f, 0xb3, 0xbb, 0x75, 0xde, 0x59, 0xf8, 0x86, + 0x59, 0x1a, 0x6f, 0x71, 0x89, 0x94, 0x3b, 0x3a, 0x83, 0x0e, 0x9a, 0x74, 0xfb, 0x56, 0xcd, 0x35, + 0xf0, 0xe6, 0x68, 0xda, 0xa6, 0x87, 0x50, 0xfa, 0x88, 0x14, 0xbb, 0x20, 0xf1, 0x76, 0xef, 0xf6, + 0x0d, 0x67, 0xb6, 0x36, 0x1b, 0x71, 0xdd, 0x0f, 0x21, 0x93, 0xf2, 0xd2, 0x9a, 0xc5, 0x2f, 0x45, + 0x52, 0xd2, 0x7d, 0x50, 0x89, 0xd6, 0xa5, 0x8d, 0x73, 0x92, 0x7f, 0x6c, 0x44, 0xed, 0xd6, 0x05, + 0x08, 0x43, 0xee, 0xdc, 0x79, 0xfb, 0xf5, 0xc7, 0x87, 0x91, 0x3a, 0x9d, 0x65, 0x08, 0x65, 0xb9, + 0x6d, 0x93, 0x6c, 0x5f, 0x2f, 0xd1, 0x01, 0xe5, 0x99, 0x65, 0xe9, 0x70, 0xce, 0xec, 0xce, 0x6a, + 0xce, 0x45, 0x10, 0xd4, 0x9d, 0xd5, 0xba, 0x37, 0xe9, 0xe4, 0x40, 0x5d, 0x2a, 0xc8, 0x68, 0x6a, + 0x5a, 0x5a, 0x1f, 0x44, 0x95, 0xf3, 0x7e, 0xad, 0x31, 0x1c, 0x80, 0x4a, 0xb7, 0xb5, 0x92, 0x4d, + 0x67, 0xce, 0x29, 0xed, 0x9b, 0x2d, 0x39, 0x60, 0xdb, 0xa9, 0x10, 0x27, 0x65, 0xf3, 0x64, 0x83, + 0x07, 0xec, 0x33, 0xc5, 0xe0, 0x01, 0xfb, 0x0d, 0x32, 0x74, 0x40, 0x63, 0x85, 0xe6, 0xda, 0xe1, + 0x89, 0x6d, 0x1d, 0x9d, 0xd8, 0xd6, 0xf7, 0x13, 0xdb, 0x7a, 0x7f, 0x6a, 0x17, 0x8e, 0x4e, 0xed, + 0xc2, 0xb7, 0x53, 0xbb, 0xf0, 0x82, 0x5d, 0x6e, 0xdf, 0x58, 0xb4, 0x92, 0x36, 0x48, 0xc3, 0x18, + 0x94, 0xf5, 0xdf, 0xc6, 0xd2, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x2a, 0x10, 0x9d, 0x00, + 0x06, 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 { + // Token returns token with token name + Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) + // Tokens returns the token list + Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) + // Fees returns the fees to issue or mint a token + Fees(ctx context.Context, in *QueryFeesRequest, opts ...grpc.CallOption) (*QueryFeesResponse, error) + // Params queries the token parameters + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) { + out := new(QueryTokenResponse) + err := c.cc.Invoke(ctx, "/irismod.token.Query/Token", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) { + out := new(QueryTokensResponse) + err := c.cc.Invoke(ctx, "/irismod.token.Query/Tokens", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Fees(ctx context.Context, in *QueryFeesRequest, opts ...grpc.CallOption) (*QueryFeesResponse, error) { + out := new(QueryFeesResponse) + err := c.cc.Invoke(ctx, "/irismod.token.Query/Fees", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/irismod.token.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Token returns token with token name + Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) + // Tokens returns the token list + Tokens(context.Context, *QueryTokensRequest) (*QueryTokensResponse, error) + // Fees returns the fees to issue or mint a token + Fees(context.Context, *QueryFeesRequest) (*QueryFeesResponse, error) + // Params queries the token parameters + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Token(ctx context.Context, req *QueryTokenRequest) (*QueryTokenResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Token not implemented") +} +func (*UnimplementedQueryServer) Tokens(ctx context.Context, req *QueryTokensRequest) (*QueryTokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Tokens not implemented") +} +func (*UnimplementedQueryServer) Fees(ctx context.Context, req *QueryFeesRequest) (*QueryFeesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Fees not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Token_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Token(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.Query/Token", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Token(ctx, req.(*QueryTokenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTokensRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Tokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.Query/Tokens", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Tokens(ctx, req.(*QueryTokensRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Fees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFeesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Fees(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.token.Query/Fees", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Fees(ctx, req.(*QueryFeesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(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: "/irismod.token.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.token.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Token", + Handler: _Query_Token_Handler, + }, + { + MethodName: "Tokens", + Handler: _Query_Tokens_Handler, + }, + { + MethodName: "Fees", + Handler: _Query_Fees_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "token/query.proto", +} + +func (m *QueryTokenRequest) 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 *QueryTokenRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokenResponse) 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 *QueryTokenResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Token != nil { + { + size, err := m.Token.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 *QueryTokensRequest) 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 *QueryTokensRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokensRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryTokensResponse) 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 *QueryTokensResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTokensResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Tokens) > 0 { + for iNdEx := len(m.Tokens) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Tokens[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 *QueryFeesRequest) 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 *QueryFeesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryFeesResponse) 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 *QueryFeesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.MintFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.IssueFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.Exist { + i-- + if m.Exist { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +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 + if m.Res != nil { + { + size, err := m.Res.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryTokenRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokenResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokensRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryTokensResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Tokens) > 0 { + for _, e := range m.Tokens { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryFeesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryFeesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Exist { + n += 2 + } + l = m.IssueFee.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.MintFee.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +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)) + if m.Res != nil { + l = m.Res.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 *QueryTokenRequest) 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: QueryTokenRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryTokenResponse) 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: QueryTokenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token == nil { + m.Token = &types.Any{} + } + if err := m.Token.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 *QueryTokensRequest) 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: QueryTokensRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokensRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 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.Owner = 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 *QueryTokensResponse) 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: QueryTokensResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTokensResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", 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.Tokens = append(m.Tokens, &types.Any{}) + if err := m.Tokens[len(m.Tokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryFeesRequest) 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: QueryFeesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = 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 *QueryFeesResponse) 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: QueryFeesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryFeesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Exist = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssueFee", 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.IssueFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintFee", 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.MintFee.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 *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 + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Res", 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.Res == nil { + m.Res = &query.PageResponse{} + } + if err := m.Res.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/module-sdk/token/token.go b/module-sdk/token/token.go new file mode 100644 index 00000000..033031a5 --- /dev/null +++ b/module-sdk/token/token.go @@ -0,0 +1,191 @@ +// Package token allows individuals and companies to create and issue their own tokens. +// + +package token + +import ( + "context" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/codec/types" + sdk "github.com/irisnet/core-sdk-go/types" + "strconv" +) + +type tokenClient struct { + sdk.BaseClient + codec.Marshaler +} + +func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { + return tokenClient{ + BaseClient: bc, + Marshaler: cdc, + } +} + +func (t tokenClient) Name() string { + return ModuleName +} + +func (t tokenClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { + RegisterInterfaces(registry) +} + +func (t tokenClient) IssueToken(req IssueTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := t.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgIssueToken{ + Symbol: req.Symbol, + Name: req.Name, + Scale: req.Scale, + MinUnit: req.MinUnit, + InitialSupply: req.InitialSupply, + MaxSupply: req.MaxSupply, + Mintable: req.Mintable, + Owner: owner.String(), + } + + return t.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (t tokenClient) EditToken(req EditTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := t.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgEditToken{ + Symbol: req.Symbol, + Name: req.Name, + MaxSupply: req.MaxSupply, + Mintable: Bool(strconv.FormatBool(req.Mintable)), + Owner: owner.String(), + } + + return t.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (t tokenClient) TransferToken(to string, symbol string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := t.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + if err := sdk.ValidateAccAddress(to); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + msg := &MsgTransferTokenOwner{ + SrcOwner: owner.String(), + DstOwner: to, + Symbol: symbol, + } + return t.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (t tokenClient) MintToken(symbol string, amount uint64, to string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { + owner, err := t.QueryAddress(baseTx.From, baseTx.Password) + if err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } + + receipt := owner.String() + if len(to) != 0 { + if err := sdk.ValidateAccAddress(to); err != nil { + return sdk.ResultTx{}, sdk.Wrap(err) + } else { + receipt = to + } + } + + msg := &MsgMintToken{ + Symbol: symbol, + Amount: amount, + To: receipt, + Owner: owner.String(), + } + return t.BuildAndSend([]sdk.Msg{msg}, baseTx) +} + +func (t tokenClient) QueryToken(denom string) (sdk.Token, error) { + return t.BaseClient.QueryToken(denom) +} + +func (t tokenClient) QueryTokens(owner string) (sdk.Tokens, error) { + var ownerAddr string + if len(owner) > 0 { + if err := sdk.ValidateAccAddress(owner); err != nil { + return nil, sdk.Wrap(err) + } + ownerAddr = owner + } + + conn, err := t.GenConn() + defer func() { _ = conn.Close() }() + + if err != nil { + return sdk.Tokens{}, sdk.Wrap(err) + } + + request := &QueryTokensRequest{ + Owner: ownerAddr, + } + + res, err := NewQueryClient(conn).Tokens(context.Background(), request) + if err != nil { + return sdk.Tokens{}, err + } + + tokens := make(Tokens, 0, len(res.Tokens)) + for _, eviAny := range res.Tokens { + var evi TokenInterface + if err = t.UnpackAny(eviAny, &evi); err != nil { + return sdk.Tokens{}, err + } + tokens = append(tokens, evi.(*Token)) + } + + ts := tokens.Convert().(sdk.Tokens) + t.SaveTokens(ts...) + return ts, nil +} + +func (t tokenClient) QueryFees(symbol string) (QueryFeesResp, error) { + conn, err := t.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryFeesResp{}, sdk.Wrap(err) + } + + request := &QueryFeesRequest{ + Symbol: symbol, + } + + res, err := NewQueryClient(conn).Fees(context.Background(), request) + if err != nil { + return QueryFeesResp{}, err + } + + return res.Convert().(QueryFeesResp), nil +} + +func (t tokenClient) QueryParams() (QueryParamsResp, error) { + conn, err := t.GenConn() + defer func() { _ = conn.Close() }() + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + + res, err := NewQueryClient(conn).Params( + context.Background(), + &QueryParamsRequest{}, + ) + if err != nil { + return QueryParamsResp{}, sdk.Wrap(err) + } + + return res.Params.Convert().(QueryParamsResp), nil +} diff --git a/module-sdk/token/token.pb.go b/module-sdk/token/token.pb.go new file mode 100644 index 00000000..9018ffc2 --- /dev/null +++ b/module-sdk/token/token.pb.go @@ -0,0 +1,873 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: token/token.proto + +package token + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + types "github.com/irisnet/core-sdk-go/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Token defines a standard for the fungible token +type Token struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` + MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty" yaml:"min_unit"` + InitialSupply uint64 `protobuf:"varint,5,opt,name=initial_supply,json=initialSupply,proto3" json:"initial_supply,omitempty" yaml:"initial_supply"` + MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty" yaml:"max_supply"` + Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` + Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *Token) Reset() { *m = Token{} } +func (*Token) ProtoMessage() {} +func (*Token) Descriptor() ([]byte, []int) { + return fileDescriptor_6e2ef433bb3fdc80, []int{0} +} +func (m *Token) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Token.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 *Token) XXX_Merge(src proto.Message) { + xxx_messageInfo_Token.Merge(m, src) +} +func (m *Token) XXX_Size() int { + return m.Size() +} +func (m *Token) XXX_DiscardUnknown() { + xxx_messageInfo_Token.DiscardUnknown(m) +} + +var xxx_messageInfo_Token proto.InternalMessageInfo + +// token parameters +type Params struct { + TokenTaxRate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=token_tax_rate,json=tokenTaxRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"token_tax_rate" yaml:"token_tax_rate"` + IssueTokenBaseFee types.Coin `protobuf:"bytes,2,opt,name=issue_token_base_fee,json=issueTokenBaseFee,proto3" json:"issue_token_base_fee" yaml:"issue_token_base_fee"` + MintTokenFeeRatio github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=mint_token_fee_ratio,json=mintTokenFeeRatio,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"mint_token_fee_ratio" yaml:"mint_token_fee_ratio"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_6e2ef433bb3fdc80, []int{1} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func init() { + proto.RegisterType((*Token)(nil), "irismod.token.Token") + proto.RegisterType((*Params)(nil), "irismod.token.Params") +} + +func init() { proto.RegisterFile("token/token.proto", fileDescriptor_6e2ef433bb3fdc80) } + +var fileDescriptor_6e2ef433bb3fdc80 = []byte{ + // 533 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xbf, 0x6f, 0xd3, 0x4e, + 0x14, 0xb7, 0xf3, 0x4d, 0xd2, 0xe4, 0xbe, 0xa4, 0x28, 0x26, 0x45, 0x6e, 0x2a, 0xd9, 0x91, 0x59, + 0x22, 0xa1, 0xda, 0x2a, 0x30, 0x65, 0x42, 0x06, 0x75, 0x02, 0x09, 0x1d, 0x65, 0x61, 0xb1, 0xce, + 0xc9, 0x6b, 0x7a, 0xaa, 0xcf, 0x17, 0xf9, 0xce, 0x90, 0xcc, 0x2c, 0x8c, 0x8c, 0x8c, 0xf9, 0x07, + 0xf8, 0x3f, 0x32, 0x76, 0x44, 0x0c, 0x16, 0x24, 0x0b, 0x73, 0x76, 0x24, 0x74, 0x67, 0x37, 0xa8, + 0x02, 0x09, 0x89, 0x25, 0x79, 0xef, 0xf3, 0x7e, 0xf8, 0xf3, 0x3e, 0xef, 0x1d, 0xea, 0x4a, 0x7e, + 0x09, 0x69, 0xa0, 0x7f, 0xfd, 0x59, 0xc6, 0x25, 0xb7, 0x3a, 0x34, 0xa3, 0x82, 0xf1, 0x89, 0xaf, + 0xc1, 0xbe, 0x33, 0xe6, 0x82, 0x71, 0x11, 0xc4, 0x44, 0x40, 0xf0, 0xe6, 0x24, 0x06, 0x49, 0x4e, + 0x82, 0x31, 0xa7, 0x55, 0x7a, 0xbf, 0x37, 0xe5, 0x53, 0xae, 0xcd, 0x40, 0x59, 0x25, 0xea, 0x7d, + 0xaa, 0xa1, 0xc6, 0x99, 0xaa, 0xb7, 0xee, 0xa2, 0xa6, 0x58, 0xb0, 0x98, 0x27, 0xb6, 0x39, 0x30, + 0x87, 0x6d, 0x5c, 0x79, 0x96, 0x85, 0xea, 0x29, 0x61, 0x60, 0xd7, 0x34, 0xaa, 0x6d, 0xab, 0x87, + 0x1a, 0x62, 0x4c, 0x12, 0xb0, 0xff, 0x1b, 0x98, 0xc3, 0x0e, 0x2e, 0x1d, 0xcb, 0x47, 0x2d, 0x46, + 0xd3, 0x28, 0x4f, 0xa9, 0xb4, 0xeb, 0x2a, 0x3b, 0xbc, 0xb3, 0x2d, 0xdc, 0xdb, 0x0b, 0xc2, 0x92, + 0x91, 0x77, 0x1d, 0xf1, 0xf0, 0x1e, 0xa3, 0xe9, 0xab, 0x94, 0x4a, 0xeb, 0x31, 0xda, 0xa7, 0x29, + 0x95, 0x94, 0x24, 0x91, 0xc8, 0x67, 0xb3, 0x64, 0x61, 0x37, 0x06, 0xe6, 0xb0, 0x1e, 0x1e, 0x6e, + 0x0b, 0xf7, 0xa0, 0xac, 0xba, 0x19, 0xf7, 0x70, 0xa7, 0x02, 0x5e, 0x6a, 0xdf, 0x7a, 0x84, 0x10, + 0x23, 0xf3, 0xeb, 0xea, 0xa6, 0xae, 0x3e, 0xd8, 0x16, 0x6e, 0xb7, 0xfa, 0xe6, 0x2e, 0xe6, 0xe1, + 0x36, 0x23, 0xf3, 0xaa, 0xaa, 0xaf, 0x79, 0x4a, 0x12, 0x27, 0x60, 0xef, 0x0d, 0xcc, 0x61, 0x0b, + 0xef, 0x7c, 0x35, 0x19, 0x7f, 0x9b, 0x42, 0x66, 0xb7, 0xf4, 0xb8, 0xa5, 0x33, 0x6a, 0xbd, 0x5f, + 0xba, 0xc6, 0xc7, 0xa5, 0x6b, 0x78, 0x3f, 0x6a, 0xa8, 0xf9, 0x82, 0x64, 0x84, 0x09, 0x2b, 0x43, + 0xfb, 0x5a, 0xf9, 0x48, 0x92, 0x79, 0x94, 0x11, 0x09, 0xa5, 0x70, 0xe1, 0xb3, 0x55, 0xe1, 0x1a, + 0x5f, 0x0a, 0xf7, 0xfe, 0x94, 0xca, 0x8b, 0x3c, 0xf6, 0xc7, 0x9c, 0x05, 0x6a, 0x55, 0x29, 0x48, + 0xfd, 0x7f, 0x91, 0xc7, 0xc7, 0x62, 0x72, 0x79, 0x3c, 0xe5, 0x81, 0x5c, 0xcc, 0x40, 0xf8, 0x4f, + 0x61, 0xfc, 0x6b, 0xe2, 0x9b, 0x2d, 0x3d, 0x7c, 0x4b, 0x03, 0x67, 0x64, 0x8e, 0x89, 0x04, 0x8b, + 0xa3, 0x1e, 0x15, 0x22, 0x87, 0xa8, 0x4c, 0x53, 0xbb, 0x8e, 0xce, 0xa1, 0x5c, 0xce, 0xff, 0x0f, + 0x0e, 0xfd, 0xf2, 0x06, 0x7c, 0x85, 0xfb, 0xd5, 0x0d, 0xf8, 0x4f, 0x38, 0x4d, 0xc3, 0x7b, 0x8a, + 0xd4, 0xb6, 0x70, 0x8f, 0x2a, 0x5d, 0xff, 0xd0, 0xc4, 0xc3, 0x5d, 0x0d, 0xeb, 0x73, 0x08, 0x89, + 0x80, 0x53, 0x00, 0xeb, 0x9d, 0x89, 0x7a, 0x4a, 0x9c, 0x2a, 0xf7, 0x1c, 0x40, 0xf1, 0xa2, 0x5c, + 0x6f, 0xbe, 0x1d, 0xe2, 0x7f, 0x9b, 0xf5, 0x68, 0x77, 0x13, 0xbf, 0x35, 0xf6, 0x70, 0x57, 0xc1, + 0x9a, 0xc4, 0x29, 0x00, 0x56, 0xd8, 0xa8, 0xa5, 0xb4, 0xff, 0xbe, 0x74, 0xcd, 0xf0, 0xf9, 0xea, + 0x9b, 0x63, 0xac, 0xd6, 0x8e, 0x79, 0xb5, 0x76, 0xcc, 0xaf, 0x6b, 0xc7, 0xfc, 0xb0, 0x71, 0x8c, + 0xab, 0x8d, 0x63, 0x7c, 0xde, 0x38, 0xc6, 0xeb, 0xe0, 0xef, 0x34, 0x18, 0x9f, 0xe4, 0x09, 0x88, + 0xf2, 0x25, 0xc5, 0x4d, 0xfd, 0x0a, 0x1e, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xc0, 0x8a, + 0x9b, 0x5f, 0x03, 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 + } + if !this.TokenTaxRate.Equal(that1.TokenTaxRate) { + return false + } + if !this.IssueTokenBaseFee.Equal(&that1.IssueTokenBaseFee) { + return false + } + if !this.MintTokenFeeRatio.Equal(that1.MintTokenFeeRatio) { + return false + } + return true +} +func (m *Token) 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 *Token) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintToken(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x42 + } + if m.Mintable { + i-- + if m.Mintable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.MaxSupply != 0 { + i = encodeVarintToken(dAtA, i, uint64(m.MaxSupply)) + i-- + dAtA[i] = 0x30 + } + if m.InitialSupply != 0 { + i = encodeVarintToken(dAtA, i, uint64(m.InitialSupply)) + i-- + dAtA[i] = 0x28 + } + if len(m.MinUnit) > 0 { + i -= len(m.MinUnit) + copy(dAtA[i:], m.MinUnit) + i = encodeVarintToken(dAtA, i, uint64(len(m.MinUnit))) + i-- + dAtA[i] = 0x22 + } + if m.Scale != 0 { + i = encodeVarintToken(dAtA, i, uint64(m.Scale)) + i-- + dAtA[i] = 0x18 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintToken(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintToken(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MintTokenFeeRatio.Size() + i -= size + if _, err := m.MintTokenFeeRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintToken(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.IssueTokenBaseFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintToken(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.TokenTaxRate.Size() + i -= size + if _, err := m.TokenTaxRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintToken(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintToken(dAtA []byte, offset int, v uint64) int { + offset -= sovToken(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Token) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovToken(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovToken(uint64(l)) + } + if m.Scale != 0 { + n += 1 + sovToken(uint64(m.Scale)) + } + l = len(m.MinUnit) + if l > 0 { + n += 1 + l + sovToken(uint64(l)) + } + if m.InitialSupply != 0 { + n += 1 + sovToken(uint64(m.InitialSupply)) + } + if m.MaxSupply != 0 { + n += 1 + sovToken(uint64(m.MaxSupply)) + } + if m.Mintable { + n += 2 + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovToken(uint64(l)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TokenTaxRate.Size() + n += 1 + l + sovToken(uint64(l)) + l = m.IssueTokenBaseFee.Size() + n += 1 + l + sovToken(uint64(l)) + l = m.MintTokenFeeRatio.Size() + n += 1 + l + sovToken(uint64(l)) + return n +} + +func sovToken(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozToken(x uint64) (n int) { + return sovToken(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Token) 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 ErrIntOverflowToken + } + 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: Token: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Token: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) + } + m.Scale = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Scale |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinUnit", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinUnit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialSupply", wireType) + } + m.InitialSupply = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialSupply |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) + } + m.MaxSupply = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSupply |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mintable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Mintable = bool(v != 0) + case 8: + 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 ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipToken(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthToken + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenTaxRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TokenTaxRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssueTokenBaseFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthToken + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.IssueTokenBaseFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintTokenFeeRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowToken + } + 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 ErrInvalidLengthToken + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthToken + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MintTokenFeeRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipToken(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthToken + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipToken(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, ErrIntOverflowToken + } + 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, ErrIntOverflowToken + } + 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, ErrIntOverflowToken + } + 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, ErrInvalidLengthToken + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupToken + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthToken + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthToken = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowToken = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupToken = fmt.Errorf("proto: unexpected end of group") +) diff --git a/module-sdk/token/tx.pb.go b/module-sdk/token/tx.pb.go new file mode 100644 index 00000000..cbec6241 --- /dev/null +++ b/module-sdk/token/tx.pb.go @@ -0,0 +1,1436 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: token/tx.proto + +package token + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/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 + +// MsgIssueToken defines an SDK message for issuing a new token. +type MsgIssueToken struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` + MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty" yaml:"min_unit"` + InitialSupply uint64 `protobuf:"varint,5,opt,name=initial_supply,json=initialSupply,proto3" json:"initial_supply,omitempty" yaml:"initial_supply"` + MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty" yaml:"max_supply"` + Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` + Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgIssueToken) Reset() { *m = MsgIssueToken{} } +func (m *MsgIssueToken) String() string { return proto.CompactTextString(m) } +func (*MsgIssueToken) ProtoMessage() {} +func (*MsgIssueToken) Descriptor() ([]byte, []int) { + return fileDescriptor_ef78f47708126356, []int{0} +} +func (m *MsgIssueToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgIssueToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgIssueToken.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 *MsgIssueToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgIssueToken.Merge(m, src) +} +func (m *MsgIssueToken) XXX_Size() int { + return m.Size() +} +func (m *MsgIssueToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgIssueToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgIssueToken proto.InternalMessageInfo + +// MsgMintToken defines an SDK message for transferring the token owner. +type MsgTransferTokenOwner struct { + SrcOwner string `protobuf:"bytes,1,opt,name=src_owner,json=srcOwner,proto3" json:"src_owner,omitempty" yaml:"src_owner"` + DstOwner string `protobuf:"bytes,2,opt,name=dst_owner,json=dstOwner,proto3" json:"dst_owner,omitempty" yaml:"dst_owner"` + Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"` +} + +func (m *MsgTransferTokenOwner) Reset() { *m = MsgTransferTokenOwner{} } +func (m *MsgTransferTokenOwner) String() string { return proto.CompactTextString(m) } +func (*MsgTransferTokenOwner) ProtoMessage() {} +func (*MsgTransferTokenOwner) Descriptor() ([]byte, []int) { + return fileDescriptor_ef78f47708126356, []int{1} +} +func (m *MsgTransferTokenOwner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTransferTokenOwner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTransferTokenOwner.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 *MsgTransferTokenOwner) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTransferTokenOwner.Merge(m, src) +} +func (m *MsgTransferTokenOwner) XXX_Size() int { + return m.Size() +} +func (m *MsgTransferTokenOwner) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTransferTokenOwner.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTransferTokenOwner proto.InternalMessageInfo + +// MsgEditToken defines an SDK message for editing a new token. +type MsgEditToken struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + MaxSupply uint64 `protobuf:"varint,3,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty" yaml:"max_supply"` + Mintable Bool `protobuf:"bytes,4,opt,name=mintable,proto3,casttype=Bool" json:"mintable,omitempty"` + Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgEditToken) Reset() { *m = MsgEditToken{} } +func (m *MsgEditToken) String() string { return proto.CompactTextString(m) } +func (*MsgEditToken) ProtoMessage() {} +func (*MsgEditToken) Descriptor() ([]byte, []int) { + return fileDescriptor_ef78f47708126356, []int{2} +} +func (m *MsgEditToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditToken.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 *MsgEditToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditToken.Merge(m, src) +} +func (m *MsgEditToken) XXX_Size() int { + return m.Size() +} +func (m *MsgEditToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditToken proto.InternalMessageInfo + +// MsgMintToken defines an SDK message for minting a new token. +type MsgMintToken struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` + Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"` +} + +func (m *MsgMintToken) Reset() { *m = MsgMintToken{} } +func (m *MsgMintToken) String() string { return proto.CompactTextString(m) } +func (*MsgMintToken) ProtoMessage() {} +func (*MsgMintToken) Descriptor() ([]byte, []int) { + return fileDescriptor_ef78f47708126356, []int{3} +} +func (m *MsgMintToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintToken.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 *MsgMintToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintToken.Merge(m, src) +} +func (m *MsgMintToken) XXX_Size() int { + return m.Size() +} +func (m *MsgMintToken) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintToken.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintToken proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgIssueToken)(nil), "irismod.token.MsgIssueToken") + proto.RegisterType((*MsgTransferTokenOwner)(nil), "irismod.token.MsgTransferTokenOwner") + proto.RegisterType((*MsgEditToken)(nil), "irismod.token.MsgEditToken") + proto.RegisterType((*MsgMintToken)(nil), "irismod.token.MsgMintToken") +} + +func init() { proto.RegisterFile("token/tx.proto", fileDescriptor_ef78f47708126356) } + +var fileDescriptor_ef78f47708126356 = []byte{ + // 484 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xb1, 0x8e, 0xd3, 0x40, + 0x10, 0xcd, 0x3a, 0x4e, 0xce, 0x59, 0x91, 0x00, 0x4b, 0x72, 0x32, 0x57, 0xd8, 0x91, 0x45, 0x91, + 0xe6, 0x62, 0x21, 0xa8, 0xa8, 0x90, 0x25, 0x0a, 0x0a, 0x0b, 0xc9, 0x1c, 0x0d, 0x4d, 0xb4, 0x8e, + 0x17, 0xdf, 0xea, 0xbc, 0xbb, 0x91, 0x77, 0x2d, 0x92, 0xbf, 0xa0, 0xe1, 0x2b, 0xe0, 0x43, 0xae, + 0xbc, 0x92, 0xca, 0x82, 0xe4, 0x0f, 0x52, 0x52, 0x21, 0xaf, 0x7d, 0xbe, 0x04, 0x21, 0x01, 0x95, + 0xfd, 0xe6, 0xcd, 0xd3, 0xbc, 0x7d, 0xa3, 0x81, 0x23, 0x25, 0xae, 0x08, 0xf7, 0xd5, 0x7a, 0xbe, + 0xca, 0x85, 0x12, 0x68, 0x48, 0x73, 0x2a, 0x99, 0x48, 0xe6, 0xba, 0x7e, 0x36, 0x4e, 0x45, 0x2a, + 0x34, 0xe3, 0x57, 0x7f, 0x75, 0x93, 0xf7, 0xc5, 0x80, 0xc3, 0x50, 0xa6, 0xaf, 0xa5, 0x2c, 0xc8, + 0x45, 0xd5, 0x87, 0x4e, 0x61, 0x5f, 0x6e, 0x58, 0x2c, 0x32, 0x1b, 0x4c, 0xc1, 0x6c, 0x10, 0x35, + 0x08, 0x21, 0x68, 0x72, 0xcc, 0x88, 0x6d, 0xe8, 0xaa, 0xfe, 0x47, 0x63, 0xd8, 0x93, 0x4b, 0x9c, + 0x11, 0xbb, 0x3b, 0x05, 0xb3, 0x61, 0x54, 0x03, 0x34, 0x87, 0x16, 0xa3, 0x7c, 0x51, 0x70, 0xaa, + 0x6c, 0xb3, 0xea, 0x0e, 0x1e, 0xed, 0x4b, 0xf7, 0xfe, 0x06, 0xb3, 0xec, 0x85, 0x77, 0xcb, 0x78, + 0xd1, 0x09, 0xa3, 0xfc, 0x1d, 0xa7, 0x0a, 0xbd, 0x84, 0x23, 0xca, 0xa9, 0xa2, 0x38, 0x5b, 0xc8, + 0x62, 0xb5, 0xca, 0x36, 0x76, 0x6f, 0x0a, 0x66, 0x66, 0xf0, 0x78, 0x5f, 0xba, 0x93, 0x5a, 0x75, + 0xcc, 0x7b, 0xd1, 0xb0, 0x29, 0xbc, 0xd5, 0x18, 0x3d, 0x87, 0x90, 0xe1, 0xf5, 0xad, 0xba, 0xaf, + 0xd5, 0x93, 0x7d, 0xe9, 0x3e, 0x6c, 0x66, 0xb6, 0x9c, 0x17, 0x0d, 0x18, 0x5e, 0x37, 0xaa, 0x33, + 0xed, 0x53, 0xe1, 0x38, 0x23, 0xf6, 0xc9, 0x14, 0xcc, 0xac, 0xa8, 0xc5, 0xd5, 0xcb, 0xc4, 0x47, + 0x4e, 0x72, 0xdb, 0xd2, 0xcf, 0xad, 0x81, 0xf7, 0x19, 0xc0, 0x49, 0x28, 0xd3, 0x8b, 0x1c, 0x73, + 0xf9, 0x81, 0xe4, 0x3a, 0xb0, 0x37, 0x15, 0x83, 0x9e, 0xc2, 0x81, 0xcc, 0x97, 0x8b, 0x5a, 0xa3, + 0x83, 0x0b, 0xc6, 0xfb, 0xd2, 0x7d, 0x50, 0x1b, 0x68, 0x29, 0x2f, 0xb2, 0x64, 0xbe, 0x6c, 0x25, + 0x89, 0x54, 0x8d, 0xc4, 0xf8, 0x5d, 0xd2, 0x52, 0x5e, 0x64, 0x25, 0x52, 0xd5, 0x92, 0xbb, 0xdd, + 0x74, 0x0f, 0x77, 0xe3, 0x7d, 0x05, 0xf0, 0x5e, 0x28, 0xd3, 0x57, 0x09, 0x55, 0xff, 0xbf, 0xc4, + 0xe3, 0xf0, 0xba, 0xff, 0x18, 0xde, 0x93, 0x83, 0xf0, 0xea, 0x25, 0x5b, 0x3f, 0x4b, 0xd7, 0x0c, + 0x84, 0xc8, 0xfe, 0x14, 0x63, 0xef, 0x30, 0xc6, 0x44, 0xbb, 0x0d, 0x29, 0xff, 0x8b, 0xdb, 0x53, + 0xd8, 0xc7, 0x4c, 0x14, 0x5c, 0x69, 0xbf, 0x66, 0xd4, 0x20, 0x34, 0x82, 0x86, 0x12, 0x4d, 0x04, + 0x86, 0x12, 0x77, 0x53, 0xcc, 0x83, 0x29, 0x41, 0x78, 0xfd, 0xc3, 0xe9, 0x5c, 0x6f, 0x1d, 0x70, + 0xb3, 0x75, 0xc0, 0xf7, 0xad, 0x03, 0x3e, 0xed, 0x9c, 0xce, 0xcd, 0xce, 0xe9, 0x7c, 0xdb, 0x39, + 0x9d, 0xf7, 0x7e, 0x4a, 0xd5, 0x65, 0x11, 0xcf, 0x97, 0x82, 0xf9, 0xd5, 0xa1, 0x70, 0xa2, 0xf4, + 0xf7, 0xb2, 0x88, 0xcf, 0x65, 0x72, 0x75, 0x9e, 0x0a, 0x9f, 0x89, 0xa4, 0xc8, 0x88, 0xf4, 0xf5, + 0xfd, 0xc4, 0x7d, 0x7d, 0x30, 0xcf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x19, 0x30, 0xc7, + 0x67, 0x03, 0x00, 0x00, +} + +func (m *MsgIssueToken) 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 *MsgIssueToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgIssueToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x42 + } + if m.Mintable { + i-- + if m.Mintable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.MaxSupply != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxSupply)) + i-- + dAtA[i] = 0x30 + } + if m.InitialSupply != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.InitialSupply)) + i-- + dAtA[i] = 0x28 + } + if len(m.MinUnit) > 0 { + i -= len(m.MinUnit) + copy(dAtA[i:], m.MinUnit) + i = encodeVarintTx(dAtA, i, uint64(len(m.MinUnit))) + i-- + dAtA[i] = 0x22 + } + if m.Scale != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Scale)) + i-- + dAtA[i] = 0x18 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTransferTokenOwner) 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 *MsgTransferTokenOwner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTransferTokenOwner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0x1a + } + if len(m.DstOwner) > 0 { + i -= len(m.DstOwner) + copy(dAtA[i:], m.DstOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.DstOwner))) + i-- + dAtA[i] = 0x12 + } + if len(m.SrcOwner) > 0 { + i -= len(m.SrcOwner) + copy(dAtA[i:], m.SrcOwner) + i = encodeVarintTx(dAtA, i, uint64(len(m.SrcOwner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEditToken) 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 *MsgEditToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEditToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x2a + } + if len(m.Mintable) > 0 { + i -= len(m.Mintable) + copy(dAtA[i:], m.Mintable) + i = encodeVarintTx(dAtA, i, uint64(len(m.Mintable))) + i-- + dAtA[i] = 0x22 + } + if m.MaxSupply != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxSupply)) + i-- + dAtA[i] = 0x18 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMintToken) 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 *MsgMintToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x22 + } + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintTx(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x1a + } + if m.Amount != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa + } + 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 *MsgIssueToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Scale != 0 { + n += 1 + sovTx(uint64(m.Scale)) + } + l = len(m.MinUnit) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.InitialSupply != 0 { + n += 1 + sovTx(uint64(m.InitialSupply)) + } + if m.MaxSupply != 0 { + n += 1 + sovTx(uint64(m.MaxSupply)) + } + if m.Mintable { + n += 2 + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTransferTokenOwner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SrcOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DstOwner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgEditToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.MaxSupply != 0 { + n += 1 + sovTx(uint64(m.MaxSupply)) + } + l = len(m.Mintable) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMintToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovTx(uint64(m.Amount)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(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 *MsgIssueToken) 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: MsgIssueToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgIssueToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) + } + m.Scale = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Scale |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinUnit", 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.MinUnit = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialSupply", wireType) + } + m.InitialSupply = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialSupply |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) + } + m.MaxSupply = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSupply |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Mintable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Mintable = bool(v != 0) + case 8: + 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 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.Owner = 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 *MsgTransferTokenOwner) 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: MsgTransferTokenOwner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTransferTokenOwner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SrcOwner", 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.SrcOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DstOwner", 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.DstOwner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = 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 *MsgEditToken) 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: MsgEditToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) + } + m.MaxSupply = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxSupply |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Mintable", 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.Mintable = Bool(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + 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 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.Owner = 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 *MsgMintToken) 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: MsgMintToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 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.Owner = 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 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/module-sdk/token/types.go b/module-sdk/token/types.go new file mode 100644 index 00000000..a5c9555c --- /dev/null +++ b/module-sdk/token/types.go @@ -0,0 +1,316 @@ +package token + +import ( + json2 "encoding/json" + "errors" + sdk "github.com/irisnet/core-sdk-go/types" + "strconv" +) + +const ( + ModuleName = "token" +) + +var ( + _ sdk.Msg = &MsgIssueToken{} + _ sdk.Msg = &MsgEditToken{} + _ sdk.Msg = &MsgMintToken{} + _ sdk.Msg = &MsgTransferTokenOwner{} +) + +func (msg MsgIssueToken) Route() string { return ModuleName } + +// Implements Msg. +func (msg MsgIssueToken) Type() string { return "issue_token" } + +// Implements Msg. +func (msg MsgIssueToken) ValidateBasic() error { + if len(msg.Owner) == 0 { + return errors.New("owner must be not empty") + } + + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return sdk.Wrap(err) + } + + if len(msg.Symbol) == 0 { + return errors.New("symbol must be not empty") + } + + if len(msg.Name) == 0 { + return errors.New("name must be not empty") + } + + if len(msg.MinUnit) == 0 { + return errors.New("minUnit must be not empty") + } + + return nil +} + +// Implements Msg. +func (msg MsgIssueToken) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// Implements Msg. +func (msg MsgIssueToken) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// GetSignBytes implements Msg +func (msg MsgTransferTokenOwner) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// GetSigners implements Msg +func (msg MsgTransferTokenOwner) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.SrcOwner)} +} + +func (msg MsgTransferTokenOwner) ValidateBasic() error { + if len(msg.SrcOwner) == 0 { + return errors.New("srcOwner must be not empty") + } + + if err := sdk.ValidateAccAddress(msg.SrcOwner); err != nil { + return sdk.Wrap(err) + } + + if len(msg.DstOwner) == 0 { + return errors.New("dstOwner must be not empty") + } + + if err := sdk.ValidateAccAddress(msg.DstOwner); err != nil { + return sdk.Wrap(err) + } + + if len(msg.Symbol) == 0 { + return errors.New("symbol must be not empty") + } + + return nil +} + +func (msg MsgTransferTokenOwner) Route() string { return ModuleName } + +// Type implements Msg +func (msg MsgTransferTokenOwner) Type() string { return "transfer_token_owner" } + +func (msg MsgEditToken) Route() string { return ModuleName } + +// Type implements Msg +func (msg MsgEditToken) Type() string { return "edit_token" } + +// ValidateBasic implements Msg +func (msg MsgEditToken) ValidateBasic() error { + if len(msg.Owner) == 0 { + return errors.New("owner must be not empty") + } + + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return sdk.Wrap(err) + } + + if len(msg.Symbol) == 0 { + return errors.New("symbol must be not empty") + } + return nil +} + +// GetSignBytes implements Msg +func (msg MsgEditToken) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + + return sdk.MustSortJSON(b) +} + +// GetSigners implements Msg +func (msg MsgEditToken) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +func (msg MsgMintToken) Route() string { return ModuleName } + +// Type implements Msg +func (msg MsgMintToken) Type() string { return "mint_token" } + +// GetSignBytes implements Msg +func (msg MsgMintToken) GetSignBytes() []byte { + b, err := ModuleCdc.MarshalJSON(&msg) + if err != nil { + panic(err) + } + return sdk.MustSortJSON(b) +} + +// GetSigners implements Msg +func (msg MsgMintToken) GetSigners() []sdk.AccAddress { + return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} +} + +// ValidateBasic implements Msg +func (msg MsgMintToken) ValidateBasic() error { + if len(msg.Owner) == 0 { + return errors.New("owner must be not empty") + } + + if err := sdk.ValidateAccAddress(msg.Owner); err != nil { + return sdk.Wrap(err) + } + + if len(msg.Symbol) == 0 { + return errors.New("symbol must be not empty") + } + return nil +} + +type Bool string + +func (b Bool) ToBool() bool { + v := string(b) + if len(v) == 0 { + return false + } + result, _ := strconv.ParseBool(v) + return result +} + +func (b Bool) String() string { + return string(b) +} + +// Marshal needed for protobuf compatibility +func (b Bool) Marshal() ([]byte, error) { + return []byte(b), nil +} + +// Unmarshal needed for protobuf compatibility +func (b *Bool) Unmarshal(data []byte) error { + *b = Bool(data[:]) + return nil +} + +// Marshals to JSON using string +func (b Bool) MarshalJSON() ([]byte, error) { + return json2.Marshal(b.String()) +} + +// Unmarshals from JSON assuming Bech32 encoding +func (b *Bool) UnmarshalJSON(data []byte) error { + var s string + err := json2.Unmarshal(data, &s) + if err != nil { + return nil + } + *b = Bool(s) + return nil +} + +// GetSymbol implements exported.TokenI +func (t Token) GetSymbol() string { + return t.Symbol +} + +// GetName implements exported.TokenI +func (t Token) GetName() string { + return t.Name +} + +// GetScale implements exported.TokenI +func (t Token) GetScale() uint32 { + return t.Scale +} + +// GetMinUnit implements exported.TokenI +func (t Token) GetMinUnit() string { + return t.MinUnit +} + +// GetInitialSupply implements exported.TokenI +func (t Token) GetInitialSupply() uint64 { + return t.InitialSupply +} + +// GetMaxSupply implements exported.TokenI +func (t Token) GetMaxSupply() uint64 { + return t.MaxSupply +} + +// GetMintable implements exported.TokenI +func (t Token) GetMintable() bool { + return t.Mintable +} + +// GetOwner implements exported.TokenI +func (t Token) GetOwner() sdk.AccAddress { + return sdk.MustAccAddressFromBech32(t.Owner) +} + +func (t Token) Convert() interface{} { + return sdk.Token{ + Symbol: t.Symbol, + Name: t.Name, + Scale: t.Scale, + MinUnit: t.MinUnit, + InitialSupply: t.InitialSupply, + MaxSupply: t.MaxSupply, + Mintable: t.Mintable, + Owner: t.Owner, + } +} + +type Tokens []TokenInterface + +func (ts Tokens) Convert() interface{} { + var tokens sdk.Tokens + for _, t := range ts { + tokens = append(tokens, sdk.Token{ + Symbol: t.GetSymbol(), + Name: t.GetName(), + Scale: t.GetScale(), + MinUnit: t.GetMinUnit(), + InitialSupply: t.GetInitialSupply(), + MaxSupply: t.GetMaxSupply(), + Mintable: t.GetMintable(), + Owner: t.GetOwner().String(), + }) + } + return tokens +} + +type TokenInterface interface { + GetSymbol() string + GetName() string + GetScale() uint32 + GetMinUnit() string + GetInitialSupply() uint64 + GetMaxSupply() uint64 + GetMintable() bool + GetOwner() sdk.AccAddress +} + +func (p Params) Convert() interface{} { + return QueryParamsResp{ + TokenTaxRate: p.TokenTaxRate.String(), + IssueTokenBaseFee: p.IssueTokenBaseFee.String(), + MintTokenFeeRatio: p.MintTokenFeeRatio.String(), + } +} + +func (t QueryFeesResponse) Convert() interface{} { + return QueryFeesResp(t) +} From 68ee65000a24030cbec2ab1e82a9193522538cb2 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Wed, 30 Jun 2021 14:23:03 +0800 Subject: [PATCH 11/41] add module-sdk-go test --- client.go | 20 +- module-sdk/coinswap/go.mod | 2 +- module-sdk/gov/go.mod | 2 +- module-sdk/htlc/go.mod | 2 +- module-sdk/integration_test/coinswap_test.go | 64 +++ module-sdk/integration_test/gov_test.go | 131 ++++++ module-sdk/integration_test/htlc_test.go | 77 ++++ .../integration_test/integration_test.go | 133 ++++++ module-sdk/integration_test/nft_test.go | 147 +++++++ module-sdk/integration_test/oracle_test.go | 148 +++++++ module-sdk/integration_test/random_test.go | 83 ++++ module-sdk/integration_test/record_test.go | 53 +++ .../integration_test/scripts/Dockerfile | 10 + module-sdk/integration_test/scripts/build.sh | 1 + module-sdk/integration_test/scripts/clean.sh | 2 + .../scripts/node/config/app.toml | 151 +++++++ .../scripts/node/config/config.toml | 392 ++++++++++++++++++ .../scripts/node/config/genesis.json | 343 +++++++++++++++ .../scripts/node/config/node_key.json | 1 + .../node/config/priv_validator_key.json | 11 + .../node/data/priv_validator_state.json | 5 + module-sdk/integration_test/scripts/priv.key | 9 + module-sdk/integration_test/scripts/setup.sh | 1 + module-sdk/integration_test/scripts/start.sh | 1 + module-sdk/integration_test/service_test.go | 167 ++++++++ module-sdk/integration_test/staking_test.go | 294 +++++++++++++ module-sdk/integration_test/token_test.go | 87 ++++ module-sdk/nft/go.mod | 2 +- module-sdk/oracle/go.mod | 2 +- module-sdk/random/go.mod | 2 +- module-sdk/record/go.mod | 2 +- module-sdk/service/go.mod | 2 +- module-sdk/staking/go.mod | 2 +- module-sdk/token/go.mod | 2 +- 34 files changed, 2331 insertions(+), 20 deletions(-) create mode 100644 module-sdk/integration_test/coinswap_test.go create mode 100644 module-sdk/integration_test/gov_test.go create mode 100644 module-sdk/integration_test/htlc_test.go create mode 100644 module-sdk/integration_test/integration_test.go create mode 100644 module-sdk/integration_test/nft_test.go create mode 100644 module-sdk/integration_test/oracle_test.go create mode 100644 module-sdk/integration_test/random_test.go create mode 100644 module-sdk/integration_test/record_test.go create mode 100644 module-sdk/integration_test/scripts/Dockerfile create mode 100755 module-sdk/integration_test/scripts/build.sh create mode 100755 module-sdk/integration_test/scripts/clean.sh create mode 100644 module-sdk/integration_test/scripts/node/config/app.toml create mode 100644 module-sdk/integration_test/scripts/node/config/config.toml create mode 100644 module-sdk/integration_test/scripts/node/config/genesis.json create mode 100644 module-sdk/integration_test/scripts/node/config/node_key.json create mode 100644 module-sdk/integration_test/scripts/node/config/priv_validator_key.json create mode 100644 module-sdk/integration_test/scripts/node/data/priv_validator_state.json create mode 100644 module-sdk/integration_test/scripts/priv.key create mode 100755 module-sdk/integration_test/scripts/setup.sh create mode 100755 module-sdk/integration_test/scripts/start.sh create mode 100644 module-sdk/integration_test/service_test.go create mode 100644 module-sdk/integration_test/staking_test.go create mode 100644 module-sdk/integration_test/token_test.go diff --git a/client.go b/client.go index 82764de8..04e3fdb8 100644 --- a/client.go +++ b/client.go @@ -26,7 +26,7 @@ import ( txtypes "github.com/irisnet/irishub-sdk-go/types/tx" ) -type IRISHUBClient struct { +type Client struct { logger log.Logger moduleManager map[string]types.Module encodingConfig types.EncodingConfig @@ -46,7 +46,7 @@ type IRISHUBClient struct { Swap coinswap.Client } -func NewIRISHUBClient(cfg types.ClientConfig) IRISHUBClient { +func NewIRISHUBClient(cfg types.ClientConfig) Client { encodingConfig := makeEncodingConfig() // create a instance of baseClient @@ -66,7 +66,7 @@ func NewIRISHUBClient(cfg types.ClientConfig) IRISHUBClient { htlcClient := htlc.NewClient(baseClient, encodingConfig.Marshaler) swapClient := coinswap.NewClient(baseClient, encodingConfig.Marshaler, bankClient.TotalSupply) - client := &IRISHUBClient{ + client := &Client{ logger: baseClient.Logger(), BaseClient: baseClient, moduleManager: make(map[string]types.Module), @@ -101,27 +101,27 @@ func NewIRISHUBClient(cfg types.ClientConfig) IRISHUBClient { return *client } -func (client *IRISHUBClient) SetLogger(logger log.Logger) { +func (client *Client) SetLogger(logger log.Logger) { client.BaseClient.SetLogger(logger) } -func (client *IRISHUBClient) Codec() *codec.LegacyAmino { +func (client *Client) Codec() *codec.LegacyAmino { return client.encodingConfig.Amino } -func (client *IRISHUBClient) AppCodec() codec.Marshaler { +func (client *Client) AppCodec() codec.Marshaler { return client.encodingConfig.Marshaler } -func (client *IRISHUBClient) EncodingConfig() types.EncodingConfig { +func (client *Client) EncodingConfig() types.EncodingConfig { return client.encodingConfig } -func (client *IRISHUBClient) Manager() types.BaseClient { +func (client *Client) Manager() types.BaseClient { return client.BaseClient } -func (client *IRISHUBClient) RegisterModule(ms ...types.Module) { +func (client *Client) RegisterModule(ms ...types.Module) { for _, m := range ms { _, ok := client.moduleManager[m.Name()] if ok { @@ -134,7 +134,7 @@ func (client *IRISHUBClient) RegisterModule(ms ...types.Module) { } } -func (client *IRISHUBClient) Module(name string) types.Module { +func (client *Client) Module(name string) types.Module { return client.moduleManager[name] } diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index 067e7325..bc704999 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -1,4 +1,4 @@ -module coinswap +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index 63ec5c4e..0ec77b7c 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -1,4 +1,4 @@ -module gov +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index bba94cfa..0ec77b7c 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -1,4 +1,4 @@ -module htlc +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/integration_test/coinswap_test.go b/module-sdk/integration_test/coinswap_test.go new file mode 100644 index 00000000..00dbb9ae --- /dev/null +++ b/module-sdk/integration_test/coinswap_test.go @@ -0,0 +1,64 @@ +package integration_test + +import ( + "time" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/irishub-sdk-go/modules/coinswap" + "github.com/irisnet/irishub-sdk-go/modules/token" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +func (s IntegrationTestSuite) TestCoinSwap() { + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + issueTokenReq := token.IssueTokenRequest{ + Symbol: "bnb", + Name: s.RandStringOfLength(8), + Scale: 6, + MinUnit: "ubnb", + InitialSupply: 10000000, + MaxSupply: 21000000, + Mintable: true, + } + + result, er := s.Token.IssueToken(issueTokenReq, baseTx) + require.NoError(s.T(), er) + require.NotEmpty(s.T(), result.Hash) + + request := coinswap.AddLiquidityRequest{ + MaxToken: sdk.Coin{ + Denom: "ubnb", + Amount: sdk.NewInt(1000_000_000), + }, + BaseAmt: sdk.NewInt(1000_000_000), + MinLiquidity: sdk.NewInt(1000_000_000), + Deadline: time.Now().Add(time.Hour).Unix(), + } + + res, err := s.Swap.AddLiquidity(request, baseTx) + require.NoError(s.T(), err) + require.True(s.T(), res.Liquidity.GTE(request.MinLiquidity)) + require.NotEmpty(s.T(), res.TxHash) + require.True(s.T(), request.MaxToken.Amount.GTE(res.TokenAmt)) + + boughtCoin := sdk.NewCoin("uiris", sdk.NewInt(100)) + deadline := time.Now().Add(10 * time.Second).Unix() + resp, err := s.Swap.BuyTokenWithAutoEstimate("ubnb", boughtCoin, deadline, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), resp.TxHash) + require.True(s.T(), resp.InputAmt.Equal(sdk.NewInt(101))) + + soldCoin := sdk.NewCoin("uiris", sdk.NewInt(100)) + resp, err = s.Swap.SellTokenWithAutoEstimate("ubnb", soldCoin, deadline, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), resp.TxHash) + require.True(s.T(), resp.OutputAmt.Equal(sdk.NewInt(99))) +} diff --git a/module-sdk/integration_test/gov_test.go b/module-sdk/integration_test/gov_test.go new file mode 100644 index 00000000..1ded3a60 --- /dev/null +++ b/module-sdk/integration_test/gov_test.go @@ -0,0 +1,131 @@ +package integration_test + +import ( + "encoding/json" + "fmt" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/irishub-sdk-go/modules/gov" + "github.com/irisnet/irishub-sdk-go/types" +) + +func (s IntegrationTestSuite) TestGov() { + cases := []SubTest{ + { + "TestGov", + testGov, + }, + + { + "TestParams", + testParams, + }, + } + + for _, t := range cases { + s.Run(t.testName, func() { + t.testCase(s) + }) + } + +} + +func testGov(s IntegrationTestSuite) { + baseTx := types.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "TEST", + Mode: types.Commit, + Password: s.Account().Password, + } + + // send submitProposal tx + submitProposalReq := gov.SubmitProposalRequest{ + Title: s.RandStringOfLength(4), + Description: s.RandStringOfLength(6), + Type: "Text", + } + proposalId, res, err := s.Gov.SubmitProposal(submitProposalReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + // query proposal details based on ProposalID. + proposal, err := s.Gov.QueryProposal(proposalId) + require.NoError(s.T(), err) + require.Equal(s.T(), proposal.ProposalId, proposalId) + require.Equal(s.T(), "PROPOSAL_STATUS_DEPOSIT_PERIOD", proposal.Status) + + // query all proposals based on given status. + proposalStatus := proposal.Status + proposals, err := s.Gov.QueryProposals(proposalStatus) + var exists bool + require.NoError(s.T(), err) + require.NotEmpty(s.T(), proposals) + for _, proposal := range proposals { + if proposal.ProposalId == proposalId { + exists = true + } + } + require.True(s.T(), exists) + + // send Deposit tx + amount, e := types.ParseDecCoins("2000iris") + require.NoError(s.T(), e) + depositReq := gov.DepositRequest{ + ProposalId: proposalId, + Amount: amount, + } + res, err = s.Gov.Deposit(depositReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + // query single deposit information based proposalID, depositAddr. + depositor := s.Account().Address.String() + deposit, err := s.Gov.QueryDeposit(proposalId, depositor) + require.NoError(s.T(), err) + require.Equal(s.T(), "2000000000uiris", deposit.Amount.String()) + + // query all deposits of a single proposal. + deposits, err := s.Gov.QueryDeposits(proposalId) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), deposits) + for _, deposit := range deposits { + require.Equal(s.T(), proposalId, deposit.ProposalId) + } + + // send vote tx + voteReq := gov.VoteRequest{ + ProposalId: proposalId, + Option: "VOTE_OPTION_YES", + } + res, err = s.Gov.Vote(voteReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + // query voted information based on proposalID, voterAddr. + voter := s.Account().Address.String() + vote, err := s.Gov.QueryVote(proposalId, voter) + require.NoError(s.T(), err) + require.Equal(s.T(), proposalId, vote.ProposalId) + + // query votes of a given proposal. + votes, err := s.Gov.QueryVotes(proposalId) + require.NoError(s.T(), err) + require.Greater(s.T(), len(votes), 0) + + // query the tally of a proposal vote. + _, err = s.Gov.QueryTallyResult(proposalId) + require.NoError(s.T(), err) +} + +func testParams(s IntegrationTestSuite) { + paramsTypes := []string{"voting", "tallying", "deposit"} + for _, paramType := range paramsTypes { + res, err := s.Gov.QueryParams(paramType) + require.NoError(s.T(), err) + bz, e := json.Marshal(res) + require.NoError(s.T(), e) + fmt.Println(string(bz)) + } +} diff --git a/module-sdk/integration_test/htlc_test.go b/module-sdk/integration_test/htlc_test.go new file mode 100644 index 00000000..f632f887 --- /dev/null +++ b/module-sdk/integration_test/htlc_test.go @@ -0,0 +1,77 @@ +package integration_test + +import ( + "encoding/hex" + "encoding/json" + "fmt" + + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/crypto/tmhash" + + "github.com/irisnet/irishub-sdk-go/modules/htlc" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +func (s IntegrationTestSuite) TestHTLC() { + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + amount, err := sdk.ParseDecCoins("10iris") + require.NoError(s.T(), err) + secret := s.GetSecret() + hashLock := s.GetHashLock(secret, 0) + fmt.Println("hashLock: " + hashLock) + fmt.Println("secret: " + secret) + receiverOnOtherChain := "0x" + s.RandStringOfLength(14) + + to := s.GetRandAccount().Address + createHTLCRequest := htlc.CreateHTLCRequest{ + To: to.String(), + ReceiverOnOtherChain: receiverOnOtherChain, + Amount: amount, + HashLock: hashLock, + } + res, err := s.HTLC.CreateHTLC(createHTLCRequest, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + hashLockBytes, _ := hex.DecodeString(hashLock) + minCoins, _ := s.ToMinCoin(amount...) + htlcId := hex.EncodeToString(tmhash.Sum(append(append(append(hashLockBytes, s.Account().Address...), to...), []byte(minCoins.Sort().String())...))) + + queryHTLCResp, err := s.HTLC.QueryHTLC(htlcId) + require.NoError(s.T(), err) + require.Equal(s.T(), receiverOnOtherChain, queryHTLCResp.ReceiverOnOtherChain) + + res, err = s.HTLC.ClaimHTLC(htlcId, secret, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) +} + +// GetHashLock calculates the hash lock from the given secret and timestamp +func (s IntegrationTestSuite) GetHashLock(secret string, timestamp uint64) string { + secretBz, _ := hex.DecodeString(secret) + if timestamp > 0 { + return string(tmhash.Sum(append(secretBz, sdk.Uint64ToBigEndian(timestamp)...))) + } + sum := tmhash.Sum(secretBz) + return hex.EncodeToString(sum) +} + +func (s IntegrationTestSuite) GetSecret() string { + random := s.RandStringOfLength(10) + sum := tmhash.Sum([]byte(random)) + return hex.EncodeToString(sum) +} + +func (s IntegrationTestSuite) TestQueryParams() { + res, err := s.HTLC.QueryParams() + require.NoError(s.T(), err) + data, _ := json.Marshal(res) + fmt.Println(string(data)) +} diff --git a/module-sdk/integration_test/integration_test.go b/module-sdk/integration_test/integration_test.go new file mode 100644 index 00000000..f128bcad --- /dev/null +++ b/module-sdk/integration_test/integration_test.go @@ -0,0 +1,133 @@ +package integration_test + +import ( + "io/ioutil" + "math/rand" + "os" + "path/filepath" + "testing" + "time" + + sdk "github.com/irisnet/irishub-sdk-go" + "github.com/irisnet/irishub-sdk-go/types" + "github.com/irisnet/irishub-sdk-go/types/store" + "github.com/irisnet/irishub-sdk-go/utils/log" + + "github.com/stretchr/testify/suite" +) + +const ( + nodeURI = "tcp://localhost:26657" + grpcAddr = "localhost:9090" + chainID = "test" + charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + addr = "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx" +) + +type IntegrationTestSuite struct { + suite.Suite + sdk.Client + r *rand.Rand + rootAccount MockAccount + randAccounts []MockAccount +} + +type SubTest struct { + testName string + testCase func(s IntegrationTestSuite) +} + +// MockAccount define a account for test +type MockAccount struct { + Name, Password string + Address types.AccAddress +} + +func TestSuite(t *testing.T) { + suite.Run(t, new(IntegrationTestSuite)) +} + +func (s *IntegrationTestSuite) SetupSuite() { + options := []types.Option{ + types.KeyDAOOption(store.NewMemory(nil)), + types.TimeoutOption(10), + } + cfg, err := types.NewClientConfig(nodeURI, grpcAddr, chainID, options...) + if err != nil { + panic(err) + } + + s.Client = sdk.NewIRISHUBClient(cfg) + s.r = rand.New(rand.NewSource(time.Now().UnixNano())) + s.rootAccount = MockAccount{ + Name: "validator", + Password: "1234567890", + Address: types.MustAccAddressFromBech32(addr), + } + s.SetLogger(log.NewLogger(log.Config{ + Format: log.FormatJSON, + Level: log.DebugLevel, + })) + s.initAccount() +} + +func (s *IntegrationTestSuite) initAccount() { + _, err := s.Key.Import( + s.Account().Name, + s.Account().Password, + string(getPrivKeyArmor()), + ) + if err != nil { + panic(err) + } + + //var receipts bank.Receipts + for i := 0; i < 5; i++ { + name := s.RandStringOfLength(10) + pwd := s.RandStringOfLength(16) + address, _, err := s.Key.Add(name, "11111111") + if err != nil { + panic("generate test account failed") + } + + s.randAccounts = append(s.randAccounts, MockAccount{ + Name: name, + Password: pwd, + Address: types.MustAccAddressFromBech32(address), + }) + } +} + +// RandStringOfLength return a random string +func (s *IntegrationTestSuite) RandStringOfLength(l int) string { + var result []byte + bytes := []byte(charset) + for i := 0; i < l; i++ { + result = append(result, bytes[s.r.Intn(len(bytes))]) + } + return string(result) +} + +// GetRandAccount return a random test account +func (s *IntegrationTestSuite) GetRandAccount() MockAccount { + return s.randAccounts[s.r.Intn(len(s.randAccounts))] +} + +// Account return a test account +func (s *IntegrationTestSuite) Account() MockAccount { + return s.rootAccount +} + +func getPrivKeyArmor() []byte { + path, err := os.Getwd() + if err != nil { + panic(err) + } + path = filepath.Dir(path) + path = filepath.Join(path, "integration_test/scripts/priv.key") + bz, err := ioutil.ReadFile(path) + if err != nil { + panic(err) + } + return bz +} diff --git a/module-sdk/integration_test/nft_test.go b/module-sdk/integration_test/nft_test.go new file mode 100644 index 00000000..50e642b4 --- /dev/null +++ b/module-sdk/integration_test/nft_test.go @@ -0,0 +1,147 @@ +package integration_test + +import ( + "fmt" + "strings" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/irishub-sdk-go/modules/nft" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +func (s IntegrationTestSuite) TestNFT() { + + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + denomID := strings.ToLower(s.RandStringOfLength(4)) + denomName := strings.ToLower(s.RandStringOfLength(4)) + schema := strings.ToLower(s.RandStringOfLength(10)) + issueReq := nft.IssueDenomRequest{ + ID: denomID, + Name: denomName, + Schema: schema, + } + + msg := &nft.MsgIssueDenom{ + Id: denomID, + Name: denomName, + Schema: schema, + Sender: addr, + } + txhash, err := s.BuildTxHash([]sdk.Msg{msg}, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), txhash) + fmt.Println(txhash) + + res, err := s.NFT.IssueDenom(issueReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + fmt.Println(res.Hash) + + tokenID := strings.ToLower(s.RandStringOfLength(7)) + tokenName := strings.ToLower(s.RandStringOfLength(7)) + tokenData := strings.ToLower(s.RandStringOfLength(7)) + mintReq := nft.MintNFTRequest{ + Denom: denomID, + ID: tokenID, + Name: tokenName, + URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), + Data: tokenData, + } + res, err = s.NFT.MintNFT(mintReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + editReq := nft.EditNFTRequest{ + Denom: mintReq.Denom, + ID: mintReq.ID, + URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), + } + res, err = s.NFT.EditNFT(editReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + nftRes, err := s.NFT.QueryNFT(mintReq.Denom, mintReq.ID) + require.NoError(s.T(), err) + require.Equal(s.T(), editReq.URI, nftRes.URI) + + supply, err := s.NFT.QuerySupply(mintReq.Denom, nftRes.Creator) + require.NoError(s.T(), err) + require.Equal(s.T(), uint64(1), supply) + + owner, err := s.NFT.QueryOwner(nftRes.Creator, mintReq.Denom) + require.NoError(s.T(), err) + require.Len(s.T(), owner.IDCs, 1) + require.Len(s.T(), owner.IDCs[0].TokenIDs, 1) + require.Equal(s.T(), tokenID, owner.IDCs[0].TokenIDs[0]) + + uName := s.RandStringOfLength(10) + pwd := "11111111" + + recipient, _, err := s.Key.Add(uName, pwd) + require.NoError(s.T(), err) + + transferReq := nft.TransferNFTRequest{ + Recipient: recipient, + Denom: mintReq.Denom, + ID: mintReq.ID, + URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), + } + res, err = s.NFT.TransferNFT(transferReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + owner, err = s.NFT.QueryOwner(transferReq.Recipient, mintReq.Denom) + require.NoError(s.T(), err) + require.Len(s.T(), owner.IDCs, 1) + require.Len(s.T(), owner.IDCs[0].TokenIDs, 1) + require.Equal(s.T(), tokenID, owner.IDCs[0].TokenIDs[0]) + + supply, err = s.NFT.QuerySupply(mintReq.Denom, transferReq.Recipient) + require.NoError(s.T(), err) + require.Equal(s.T(), uint64(1), supply) + + denoms, err := s.NFT.QueryDenoms() + require.NoError(s.T(), err) + require.NotEmpty(s.T(), denoms) + + d, err := s.NFT.QueryDenom(denomID) + require.NoError(s.T(), err) + require.Equal(s.T(), denomID, d.ID) + require.Equal(s.T(), denomName, d.Name) + require.Equal(s.T(), schema, d.Schema) + + col, err := s.NFT.QueryCollection(denomID) + require.NoError(s.T(), err) + require.EqualValues(s.T(), d, col.Denom) + require.Len(s.T(), col.NFTs, 1) + require.Equal(s.T(), mintReq.ID, col.NFTs[0].ID) + + burnReq := nft.BurnNFTRequest{ + Denom: mintReq.Denom, + ID: mintReq.ID, + } + + amount, e := sdk.ParseDecCoins("10iris") + require.NoError(s.T(), e) + _, err = s.Bank.Send(recipient, amount, baseTx) + require.NoError(s.T(), err) + + baseTx.From = uName + baseTx.Password = pwd + res, err = s.NFT.BurnNFT(burnReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + supply, err = s.NFT.QuerySupply(mintReq.Denom, transferReq.Recipient) + require.NoError(s.T(), err) + require.Equal(s.T(), uint64(0), supply) + +} diff --git a/module-sdk/integration_test/oracle_test.go b/module-sdk/integration_test/oracle_test.go new file mode 100644 index 00000000..04311d11 --- /dev/null +++ b/module-sdk/integration_test/oracle_test.go @@ -0,0 +1,148 @@ +package integration_test + +import ( + "fmt" + "time" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/irishub-sdk-go/modules/oracle" + "github.com/irisnet/irishub-sdk-go/modules/service" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +var serviceName = generateServiceName() + +func (s *IntegrationTestSuite) SetupService(ch chan<- int) { + schemas := `{"input":{"type":"object"},"output":{"type":"object"},"error":{"type":"object"}}` + pricing := `{"price":"1uiris"}` + output := `{"header":{},"body":{"last":"100"}}` + testResult := `{"code":200,"message":""}` + + coin, _ := sdk.ParseDecCoins("4iris") + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Fee: coin, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + definition := service.DefineServiceRequest{ + ServiceName: serviceName, + Description: "this is a test service", + Tags: nil, + AuthorDescription: "service provider", + Schemas: schemas, + } + + _, err := s.Service.DefineService(definition, baseTx) + require.NoError(s.T(), err) + deposit, _ := sdk.ParseDecCoins("6000iris") + binding := service.BindServiceRequest{ + ServiceName: definition.ServiceName, + Deposit: deposit, + Pricing: pricing, + QoS: 10, + Options: `{}`, + } + _, err = s.Service.BindService(binding, baseTx) + require.NoError(s.T(), err) + + _, err = s.Service.SubscribeServiceRequest( + definition.ServiceName, + func(reqCtxID, reqID, input string) (string, string) { + s.Logger().Info("Service received request", "input", input, "reqCtxID", reqCtxID, "reqID", reqID, "output", output) + ch <- 1 + return output, testResult + }, baseTx) + + require.NoError(s.T(), err) +} + +func (s IntegrationTestSuite) TestOracle() { + var ch = make(chan int) + s.SetupService(ch) + + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + input := `{"header":{},"body":{"pair":"iris-usdt"}}` + feedName := generateFeedName(serviceName) + serviceFeeCap, _ := sdk.ParseDecCoins("1000iris") + + sender := s.Account().Address + createReq := oracle.CreateFeedRequest{ + FeedName: feedName, + LatestHistory: 5, + Description: "fetch USDT-CNY ", + ServiceName: serviceName, + Providers: []string{sender.String()}, + Input: input, + Timeout: 50, + ServiceFeeCap: serviceFeeCap, + RepeatedFrequency: 50, + AggregateFunc: "avg", + ValueJsonPath: "last", + ResponseThreshold: 1, + } + + cfrs, err := s.Oracle.CreateFeed(createReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), cfrs.Hash) + + sfrs, err := s.Oracle.StartFeed(feedName, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), sfrs.Hash) + + select { + case <-ch: + + time.Sleep(2 * time.Second) + + feedValuesRep, err := s.Oracle.QueryFeedValue(feedName) + require.NoError(s.T(), err) + s.Logger().Info("Query feed value", "feedName", feedName, "result", feedValuesRep) + + editReq := oracle.EditFeedRequest{ + FeedName: feedName, + LatestHistory: 5, + Description: "fetch USDT-CNY ", + Timeout: 3, + ServiceFeeCap: serviceFeeCap, + ResponseThreshold: 1, + RepeatedFrequency: 5, + Providers: []string{sender.String()}, + } + + efrs, err := s.Oracle.EditFeed(editReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), efrs.Hash) + + pfrs, err := s.Oracle.PauseFeed(feedName, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), pfrs.Hash) + + feedRep, err := s.Oracle.QueryFeed(feedName) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), feedRep) + + feedsRep, err := s.Oracle.QueryFeeds("PAUSED") + require.NoError(s.T(), err) + require.NotEmpty(s.T(), feedsRep) + require.Equal(s.T(), int32(service.PAUSED), feedRep.State) + } +} + +func generateServiceName() string { + return fmt.Sprintf("service-%d", time.Now().Nanosecond()) +} + +func generateFeedName(serviceName string) string { + return fmt.Sprintf("feed-%s", serviceName) +} diff --git a/module-sdk/integration_test/random_test.go b/module-sdk/integration_test/random_test.go new file mode 100644 index 00000000..1a8d2df2 --- /dev/null +++ b/module-sdk/integration_test/random_test.go @@ -0,0 +1,83 @@ +package integration_test + +import ( + "strconv" + "time" + + "github.com/irisnet/irishub-sdk-go/modules/random" + "github.com/irisnet/irishub-sdk-go/types" +) + +type TestRandom struct { + reqId string + generateHeight int64 +} + +var testRandom TestRandom + +func (s IntegrationTestSuite) TestRandom() { + + cases := []SubTest{ + { + "TestRequestRandom", + requestRandom, + }, + { + "TestQueryRandom", + queryRandom, + }, + { + "TestQueryRandomRequestQueue", + queryRandomRequestQueue, + }, + } + + for _, t := range cases { + s.Run(t.testName, func() { + t.testCase(s) + }) + } +} + +func requestRandom(s IntegrationTestSuite) { + baseTx := types.BaseTx{ + From: s.Account().Name, + Password: s.Account().Password, + Gas: 200000, + Memo: "test", + Mode: types.Commit, + } + serviceFeeCap, err := types.ParseCoins("10iris") + s.NoError(err) + + req := random.RequestRandomRequest{ + BlockInterval: 0, + Oracle: false, + ServiceFeeCap: serviceFeeCap, + } + + resp, res, err := s.Random.RequestRandom(req, baseTx) + s.NoError(err) + s.NotEmpty(res.Hash) + s.Len(resp.ReqID, 64) + s.Greater(resp.Height, int64(0)) + + testRandom.reqId = resp.ReqID + testRandom.generateHeight = resp.Height +} + +func queryRandom(s IntegrationTestSuite) { + // Wait for the transaction to be packaged into the block + time.Sleep(10 * time.Second) + res, err := s.Random.QueryRandom(testRandom.reqId) + s.NoError(err) + s.NotEmpty(res.RequestTxHash) + value, _ := strconv.ParseFloat(res.Value, 10) + s.Greater(value, float64(0)) +} + +func queryRandomRequestQueue(s IntegrationTestSuite) { + _, err := s.Random.QueryRandomRequestQueue(testRandom.generateHeight) + s.NoError(err) + //s.NotEmpty(queue) +} diff --git a/module-sdk/integration_test/record_test.go b/module-sdk/integration_test/record_test.go new file mode 100644 index 00000000..ce4fbc4e --- /dev/null +++ b/module-sdk/integration_test/record_test.go @@ -0,0 +1,53 @@ +package integration_test + +import ( + "fmt" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/irishub-sdk-go/modules/record" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +func (s IntegrationTestSuite) TestRecord() { + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + num := 5 + contents := make([]record.Content, num) + for i := 0; i < num; i++ { + contents[i] = record.Content{ + Digest: s.RandStringOfLength(10), + DigestAlgo: s.RandStringOfLength(5), + URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), + Meta: s.RandStringOfLength(20), + } + } + + req := record.CreateRecordRequest{ + Contents: contents, + } + + recordID, err := s.Record.CreateRecord(req, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), recordID) + + request := record.QueryRecordReq{ + RecordID: recordID, + Prove: true, + Height: 0, + } + + result, err := s.Record.QueryRecord(request) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), result.Record.Contents) + + for i := 0; i < num; i++ { + require.EqualValues(s.T(), contents[i], result.Record.Contents[i]) + } +} diff --git a/module-sdk/integration_test/scripts/Dockerfile b/module-sdk/integration_test/scripts/Dockerfile new file mode 100644 index 00000000..e5962c2e --- /dev/null +++ b/module-sdk/integration_test/scripts/Dockerfile @@ -0,0 +1,10 @@ +FROM irisnet/irishub:latest + +COPY . /scripts + +RUN sh /scripts/setup.sh + +EXPOSE 26657 +EXPOSE 9090 + +CMD iris start \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/build.sh b/module-sdk/integration_test/scripts/build.sh new file mode 100755 index 00000000..bbadf696 --- /dev/null +++ b/module-sdk/integration_test/scripts/build.sh @@ -0,0 +1 @@ +docker build -t irishub-sdk-go . \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/clean.sh b/module-sdk/integration_test/scripts/clean.sh new file mode 100755 index 00000000..6d6b3604 --- /dev/null +++ b/module-sdk/integration_test/scripts/clean.sh @@ -0,0 +1,2 @@ +docker stop irishub-sdk-go-test +docker rmi irishub-sdk-go \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/node/config/app.toml b/module-sdk/integration_test/scripts/node/config/app.toml new file mode 100644 index 00000000..2d320877 --- /dev/null +++ b/module-sdk/integration_test/scripts/node/config/app.toml @@ -0,0 +1,151 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +############################################################################### +### Base Configuration ### +############################################################################### + +# The minimum gas prices a validator is willing to accept for processing a +# transaction. A transaction's fees must meet the minimum of any denomination +# specified in this config (e.g. 0.25token1;0.0001token2). +minimum-gas-prices = "0.000006uiris" + +# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals +# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) +# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals +# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' +pruning = "default" + +# These are applied if and only if the pruning strategy is custom. +pruning-interval = "0" +pruning-keep-every = "0" +pruning-keep-recent = "0" + +# HaltHeight contains a non-zero block height at which a node will gracefully +# halt and shutdown that can be used to assist upgrades and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-height = 0 + +# HaltTime contains a non-zero minimum block time (in Unix seconds) at which +# a node will gracefully halt and shutdown that can be used to assist upgrades +# and testing. +# +# Note: Commitment of state will be attempted on the corresponding block. +halt-time = 0 + +# MinRetainBlocks defines the minimum block height offset from the current +# block being committed, such that all blocks past this offset are pruned +# from Tendermint. It is used as part of the process of determining the +# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates +# that no blocks should be pruned. +# +# This configuration value is only responsible for pruning Tendermint blocks. +# It has no bearing on application state pruning which is determined by the +# "pruning-*" configurations. +# +# Note: Tendermint block pruning is dependant on this parameter in conunction +# with the unbonding (safety threshold) period, state pruning and state sync +# snapshot parameters to determine the correct minimum value of +# ResponseCommit.RetainHeight. +min-retain-blocks = 0 + +# InterBlockCache enables inter-block caching. +inter-block-cache = true + +# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, +# which informs Tendermint what to index. If empty, all events will be indexed. +# +# Example: +# ["message.sender", "message.recipient"] +index-events = [] + +############################################################################### +### Telemetry Configuration ### +############################################################################### + +[telemetry] + +# Prefixed with keys to separate services. +service-name = "" + +# Enabled enables the application telemetry functionality. When enabled, +# an in-memory sink is also enabled by default. Operators may also enabled +# other sinks such as Prometheus. +enabled = false + +# Enable prefixing gauge values with hostname. +enable-hostname = false + +# Enable adding hostname to labels. +enable-hostname-label = false + +# Enable adding service to labels. +enable-service-label = false + +# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. +prometheus-retention-time = 0 + +# GlobalLabels defines a global set of name/value label tuples applied to all +# metrics emitted using the wrapper functions defined in telemetry package. +# +# Example: +# [["chain_id", "cosmoshub-1"]] +global-labels = [] + +############################################################################### +### API Configuration ### +############################################################################### + +[api] + +# Enable defines if the API server should be enabled. +enable = true + +# Swagger defines if swagger documentation should automatically be registered. +swagger = false + +# Address defines the API server to listen on. +address = "tcp://0.0.0.0:1317" + +# MaxOpenConnections defines the number of maximum open connections. +max-open-connections = 1000 + +# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). +rpc-read-timeout = 10 + +# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). +rpc-write-timeout = 0 + +# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). +rpc-max-body-bytes = 1000000 + +# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). +enabled-unsafe-cors = false + +############################################################################### +### gRPC Configuration ### +############################################################################### + +[grpc] + +# Enable defines if the gRPC server should be enabled. +enable = true + +# Address defines the gRPC server address to bind to. +address = "0.0.0.0:9090" + +############################################################################### +### State Sync Configuration ### +############################################################################### + +# State sync snapshots allow other nodes to rapidly join the network without replaying historical +# blocks, instead downloading and applying a snapshot of the application state at a given height. +[state-sync] + +# snapshot-interval specifies the block interval at which local state sync snapshots are +# taken (0 to disable). Must be a multiple of pruning-keep-every. +snapshot-interval = 0 + +# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). +snapshot-keep-recent = 2 diff --git a/module-sdk/integration_test/scripts/node/config/config.toml b/module-sdk/integration_test/scripts/node/config/config.toml new file mode 100644 index 00000000..1daf37a6 --- /dev/null +++ b/module-sdk/integration_test/scripts/node/config/config.toml @@ -0,0 +1,392 @@ +# This is a TOML config file. +# For more information, see https://github.com/toml-lang/toml + +# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or +# relative to the home directory (e.g. "data"). The home directory is +# "$HOME/.tendermint" by default, but could be changed via $TMHOME env variable +# or --home cmd flag. + +####################################################################### +### Main Base Config Options ### +####################################################################### + +# TCP or UNIX socket address of the ABCI application, +# or the name of an ABCI application compiled in with the Tendermint binary +proxy_app = "tcp://127.0.0.1:26658" + +# A custom human readable name for this node +moniker = "node0" + +# If this node is many blocks behind the tip of the chain, FastSync +# allows them to catchup quickly by downloading blocks in parallel +# and verifying their commits +fast_sync = true + +# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb +# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) +# - pure go +# - stable +# * cleveldb (uses levigo wrapper) +# - fast +# - requires gcc +# - use cleveldb build tag (go build -tags cleveldb) +# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) +# - EXPERIMENTAL +# - may be faster is some use-cases (random reads - indexer) +# - use boltdb build tag (go build -tags boltdb) +# * rocksdb (uses github.com/tecbot/gorocksdb) +# - EXPERIMENTAL +# - requires gcc +# - use rocksdb build tag (go build -tags rocksdb) +# * badgerdb (uses github.com/dgraph-io/badger) +# - EXPERIMENTAL +# - use badgerdb build tag (go build -tags badgerdb) +db_backend = "goleveldb" + +# Database directory +db_dir = "data" + +# Output level for logging, including package level options +log_level = "info" + +# Output format: 'plain' (colored text) or 'json' +log_format = "plain" + +##### additional base config options ##### + +# Path to the JSON file containing the initial validator set and other meta data +genesis_file = "config/genesis.json" + +# Path to the JSON file containing the private key to use as a validator in the consensus protocol +priv_validator_key_file = "config/priv_validator_key.json" + +# Path to the JSON file containing the last sign state of a validator +priv_validator_state_file = "data/priv_validator_state.json" + +# TCP or UNIX socket address for Tendermint to listen on for +# connections from an external PrivValidator process +priv_validator_laddr = "" + +# Path to the JSON file containing the private key to use for node authentication in the p2p protocol +node_key_file = "config/node_key.json" + +# Mechanism to connect to the ABCI application: socket | grpc +abci = "socket" + +# If true, query the ABCI app on connecting to a new peer +# so the app can decide if we should keep the connection or not +filter_peers = false + +####################################################################### +### Advanced Configuration Options ### +####################################################################### + +####################################################### +### RPC Server Configuration Options ### +####################################################### +[rpc] + +# TCP or UNIX socket address for the RPC server to listen on +laddr = "tcp://0.0.0.0:26657" + +# A list of origins a cross-domain request can be executed from +# Default value '[]' disables cors support +# Use '["*"]' to allow any origin +cors_allowed_origins = [] + +# A list of methods the client is allowed to use with cross-domain requests +cors_allowed_methods = ["HEAD", "GET", "POST"] + +# A list of non simple headers the client is allowed to use with cross-domain requests +cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"] + +# TCP or UNIX socket address for the gRPC server to listen on +# NOTE: This server only supports /broadcast_tx_commit +grpc_laddr = "" + +# Maximum number of simultaneous connections. +# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +grpc_max_open_connections = 900 + +# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool +unsafe = false + +# Maximum number of simultaneous connections (including WebSocket). +# Does not include gRPC connections. See grpc_max_open_connections +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} +# 1024 - 40 - 10 - 50 = 924 = ~900 +max_open_connections = 900 + +# Maximum number of unique clientIDs that can /subscribe +# If you're using /broadcast_tx_commit, set to the estimated maximum number +# of broadcast_tx_commit calls per block. +max_subscription_clients = 100 + +# Maximum number of unique queries a given client can /subscribe to +# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to +# the estimated # maximum number of broadcast_tx_commit calls per block. +max_subscriptions_per_client = 5 + +# How long to wait for a tx to be committed during /broadcast_tx_commit. +# WARNING: Using a value larger than 10s will result in increasing the +# global HTTP write timeout, which applies to all connections and endpoints. +# See https://github.com/tendermint/tendermint/issues/3435 +timeout_broadcast_tx_commit = "10s" + +# Maximum size of request body, in bytes +max_body_bytes = 1000000 + +# Maximum size of request header, in bytes +max_header_bytes = 1048576 + +# The path to a file containing certificate that is used to create the HTTPS server. +# Might be either absolute path or path related to Tendermint's config directory. +# If the certificate is signed by a certificate authority, +# the certFile should be the concatenation of the server's certificate, any intermediates, +# and the CA's certificate. +# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. +# Otherwise, HTTP server is run. +tls_cert_file = "" + +# The path to a file containing matching private key that is used to create the HTTPS server. +# Might be either absolute path or path related to Tendermint's config directory. +# NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server. +# Otherwise, HTTP server is run. +tls_key_file = "" + +# pprof listen address (https://golang.org/pkg/net/http/pprof) +pprof_laddr = "localhost:6060" + +####################################################### +### P2P Configuration Options ### +####################################################### +[p2p] + +# Address to listen for incoming connections +laddr = "tcp://0.0.0.0:26656" + +# Address to advertise to peers for them to dial +# If empty, will use the same port as the laddr, +# and will introspect on the listener or use UPnP +# to figure out the address. +external_address = "" + +# Comma separated list of seed nodes to connect to +seeds = "" + +# Comma separated list of nodes to keep persistent connections to +persistent_peers = "" + +# UPNP port forwarding +upnp = false + +# Path to address book +addr_book_file = "config/addrbook.json" + +# Set true for strict address routability rules +# Set false for private or local networks +addr_book_strict = true + +# Maximum number of inbound peers +max_num_inbound_peers = 40 + +# Maximum number of outbound peers to connect to, excluding persistent peers +max_num_outbound_peers = 10 + +# List of node IDs, to which a connection will be (re)established ignoring any existing limits +unconditional_peer_ids = "" + +# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) +persistent_peers_max_dial_period = "0s" + +# Time to wait before flushing messages out on the connection +flush_throttle_timeout = "100ms" + +# Maximum size of a message packet payload, in bytes +max_packet_msg_payload_size = 1024 + +# Rate at which packets can be sent, in bytes/second +send_rate = 5120000 + +# Rate at which packets can be received, in bytes/second +recv_rate = 5120000 + +# Set true to enable the peer-exchange reactor +pex = true + +# Seed mode, in which node constantly crawls the network and looks for +# peers. If another node asks it for addresses, it responds and disconnects. +# +# Does not work if the peer-exchange reactor is disabled. +seed_mode = false + +# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) +private_peer_ids = "" + +# Toggle to disable guard against peers connecting from the same ip. +allow_duplicate_ip = false + +# Peer connection configuration. +dial_timeout = "3s" +handshake_timeout = "20s" + +####################################################### +### Mempool Configuration Option ### +####################################################### +[mempool] + +broadcast = true +recheck = true +wal_dir = "" + +# Maximum number of transactions in the mempool +size = 5000 + +# Limit the total size of all txs in the mempool. +# This only accounts for raw transactions (e.g. given 1MB transactions and +# max_txs_bytes=5MB, mempool will only accept 5 transactions). +max_txs_bytes = 1073741824 + +# Size of the cache (used to filter transactions we saw earlier) in transactions +cache_size = 10000 + +# Do not remove invalid transactions from the cache (default: false) +# Set to true if it's not possible for any invalid transaction to become valid +# again in the future. +keep-invalid-txs-in-cache = false + +# Maximum size of a single transaction. +# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. +max_tx_bytes = 1048576 + +# Maximum size of a batch of transactions to send to a peer +# Including space needed by encoding (one varint per transaction). +# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 +max_batch_bytes = 0 + +####################################################### +### State Sync Configuration Options ### +####################################################### +[statesync] +# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine +# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in +# the network to take and serve state machine snapshots. State sync is not attempted if the node +# has any local state (LastBlockHeight > 0). The node will have a truncated block history, +# starting from the height of the snapshot. +enable = false + +# RPC servers (comma-separated) for light client verification of the synced state machine and +# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding +# header hash obtained from a trusted source, and a period during which validators can be trusted. +# +# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 +# weeks) during which they can be financially punished (slashed) for misbehavior. +rpc_servers = "" +trust_hash = "" +trust_height = 0 +trust_period = "168h0m0s" + +# Time to spend discovering snapshots before initiating a restore. +discovery_time = "15s" + +# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). +# Will create a new, randomly named directory within, and remove it when done. +temp_dir = "" + +####################################################### +### Fast Sync Configuration Connections ### +####################################################### +[fastsync] + +# Fast Sync version to use: +# 1) "v0" (default) - the legacy fast sync implementation +# 2) "v1" - refactor of v0 version for better testability +# 2) "v2" - complete redesign of v0, optimized for testability & readability +version = "v0" + +####################################################### +### Consensus Configuration Options ### +####################################################### +[consensus] + +wal_file = "data/cs.wal/wal" + +# How long we wait for a proposal block before prevoting nil +timeout_propose = "3s" +# How much timeout_propose increases with each round +timeout_propose_delta = "500ms" +# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) +timeout_prevote = "1s" +# How much the timeout_prevote increases with each round +timeout_prevote_delta = "500ms" +# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) +timeout_precommit = "1s" +# How much the timeout_precommit increases with each round +timeout_precommit_delta = "500ms" +# How long we wait after committing a block, before starting on the new +# height (this gives us a chance to receive some more precommits, even +# though we already have +2/3). +timeout_commit = "1s" + +# How many blocks to look back to check existence of the node's consensus votes before joining consensus +# When non-zero, the node will panic upon restart +# if the same consensus key was used to sign {double_sign_check_height} last blocks. +# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. +double_sign_check_height = 0 + +# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) +skip_timeout_commit = false + +# EmptyBlocks mode and possible interval between empty blocks +create_empty_blocks = true +create_empty_blocks_interval = "0s" + +# Reactor sleep duration parameters +peer_gossip_sleep_duration = "100ms" +peer_query_maj23_sleep_duration = "2s" + +####################################################### +### Transaction Indexer Configuration Options ### +####################################################### +[tx_index] + +# What indexer to use for transactions +# +# The application will set which txs to index. In some cases a node operator will be able +# to decide which txs to index based on configuration set in the application. +# +# Options: +# 1) "null" +# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). +# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. +indexer = "kv" + +####################################################### +### Instrumentation Configuration Options ### +####################################################### +[instrumentation] + +# When true, Prometheus metrics are served under /metrics on +# PrometheusListenAddr. +# Check out the documentation for the list of available metrics. +prometheus = false + +# Address to listen for Prometheus collector(s) connections +prometheus_listen_addr = ":26660" + +# Maximum number of simultaneous connections. +# If you want to accept a larger number than the default, make sure +# you increase your OS limits. +# 0 - unlimited. +max_open_connections = 3 + +# Instrumentation namespace +namespace = "tendermint" diff --git a/module-sdk/integration_test/scripts/node/config/genesis.json b/module-sdk/integration_test/scripts/node/config/genesis.json new file mode 100644 index 00000000..1816f52a --- /dev/null +++ b/module-sdk/integration_test/scripts/node/config/genesis.json @@ -0,0 +1,343 @@ +{ + "genesis_time": "2021-04-29T07:03:47.75703Z", + "chain_id": "test", + "initial_height": "1", + "consensus_params": { + "block": { + "max_bytes": "22020096", + "max_gas": "-1", + "time_iota_ms": "1000" + }, + "evidence": { + "max_age_num_blocks": "100000", + "max_age_duration": "172800000000000", + "max_bytes": "1048576" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + }, + "version": {} + }, + "app_hash": "", + "app_state": { + "auth": { + "params": { + "max_memo_characters": "256", + "tx_sig_limit": "7", + "tx_size_cost_per_byte": "10", + "sig_verify_cost_ed25519": "590", + "sig_verify_cost_secp256k1": "1000" + }, + "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", + "pub_key": null, + "account_number": "0", + "sequence": "0" + } + ] + }, + "bank": { + "params": { + "send_enabled": [], + "default_send_enabled": true + }, + "balances": [ + { + "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", + "coins": [ + { + "denom": "uiris", + "amount": "2000000000000000" + } + ] + } + ], + "supply": [], + "denom_metadata": [] + }, + "capability": { + "index": "1", + "owners": [] + }, + "coinswap": { + "params": { + "fee": "0.003000000000000000" + }, + "standard_denom": "uiris" + }, + "crisis": { + "constant_fee": { + "denom": "uiris", + "amount": "1000" + } + }, + "distribution": { + "params": { + "community_tax": "0.020000000000000000", + "base_proposer_reward": "0.010000000000000000", + "bonus_proposer_reward": "0.040000000000000000", + "withdraw_addr_enabled": true + }, + "fee_pool": { + "community_pool": [] + }, + "delegator_withdraw_infos": [], + "previous_proposer": "", + "outstanding_rewards": [], + "validator_accumulated_commissions": [], + "validator_historical_rewards": [], + "validator_current_rewards": [], + "delegator_starting_infos": [], + "validator_slash_events": [] + }, + "evidence": { + "evidence": [] + }, + "genutil": { + "gen_txs": [ + { + "body": { + "messages": [ + { + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "node0", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "0.100000000000000000", + "max_rate": "0.200000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "1", + "delegator_address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", + "validator_address": "iva1w9lvhwlvkwqvg08q84n2k4nn896u9pqxsqxkzp", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "CJ6CJOrPeR0LhGNMJGRDUPiDrjCDVyPmRBRdZWp8kDg=" + }, + "value": { + "denom": "uiris", + "amount": "100000000" + } + } + ], + "memo": "a55eb068ac6f0fb991746b37a2a1bddba4da605a@10.1.4.123:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] + }, + "auth_info": { + "signer_infos": [ + { + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "A+KPcrEkUOSKIW1RZwvNrtenvsKGKYkokDUP2lwnqAje" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" + } + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + } + }, + "signatures": [ + "LQrLc4uGfaNTw9jCzYdUSpoGMiWAB5LA89WtClCDiTt7xHQITzFYugIInjPlT53H4ycgIzD2324qIaYUnk2AZQ==" + ] + } + ] + }, + "gov": { + "starting_proposal_id": "1", + "deposits": [], + "votes": [], + "proposals": [], + "deposit_params": { + "min_deposit": [ + { + "denom": "uiris", + "amount": "10000000" + } + ], + "max_deposit_period": "10s" + }, + "voting_params": { + "voting_period": "10s" + }, + "tally_params": { + "quorum": "0.334000000000000000", + "threshold": "0.500000000000000000", + "veto_threshold": "0.334000000000000000" + } + }, + "guardian": { + "supers": [ + { + "description": "genesis", + "account_type": "GENESIS", + "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", + "added_by": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx" + } + ] + }, + "htlc": { + "params": { + "asset_params": [] + }, + "htlcs": [], + "supplies": [], + "previous_block_time": "1970-01-01T00:00:01Z" + }, + "ibc": { + "client_genesis": { + "clients": [], + "clients_consensus": [], + "clients_metadata": [], + "params": { + "allowed_clients": [ + "06-solomachine", + "07-tendermint" + ] + }, + "create_localhost": false, + "next_client_sequence": "0" + }, + "connection_genesis": { + "connections": [], + "client_connection_paths": [], + "next_connection_sequence": "0" + }, + "channel_genesis": { + "channels": [], + "acknowledgements": [], + "commitments": [], + "receipts": [], + "send_sequences": [], + "recv_sequences": [], + "ack_sequences": [], + "next_channel_sequence": "0" + } + }, + "mint": { + "minter": { + "last_update": "1970-01-01T00:00:00Z", + "inflation_base": "2000000000000000" + }, + "params": { + "mint_denom": "uiris", + "inflation": "0.040000000000000000" + } + }, + "nft": { + "collections": [] + }, + "oracle": { + "entries": [] + }, + "params": null, + "random": { + "pending_random_requests": {} + }, + "record": { + "records": [] + }, + "service": { + "params": { + "max_request_timeout": "100", + "min_deposit_multiple": "1000", + "min_deposit": [ + { + "denom": "uiris", + "amount": "5000" + } + ], + "service_fee_tax": "0.050000000000000000", + "slash_fraction": "0.001000000000000000", + "complaint_retrospect": "1296000s", + "arbitration_time_limit": "432000s", + "tx_size_limit": "4000", + "base_denom": "uiris", + "restricted_service_fee_denom": false + }, + "definitions": [], + "bindings": [], + "withdraw_addresses": {}, + "request_contexts": {} + }, + "slashing": { + "params": { + "signed_blocks_window": "100", + "min_signed_per_window": "0.500000000000000000", + "downtime_jail_duration": "600s", + "slash_fraction_double_sign": "0.050000000000000000", + "slash_fraction_downtime": "0.010000000000000000" + }, + "signing_infos": [], + "missed_blocks": [] + }, + "staking": { + "params": { + "unbonding_time": "10s", + "max_validators": 100, + "max_entries": 7, + "historical_entries": 10000, + "bond_denom": "uiris" + }, + "last_total_power": "0", + "last_validator_powers": [], + "validators": [], + "delegations": [], + "unbonding_delegations": [], + "redelegations": [], + "exported": false + }, + "token": { + "params": { + "token_tax_rate": "0.400000000000000000", + "issue_token_base_fee": { + "denom": "iris", + "amount": "60000" + }, + "mint_token_fee_ratio": "0.100000000000000000" + }, + "tokens": [ + { + "symbol": "iris", + "name": "Irishub staking token", + "scale": 6, + "min_unit": "uiris", + "initial_supply": "2000000000", + "max_supply": "10000000000", + "mintable": true, + "owner": "iaa183rfa8tvtp6ax7jr7dfaf7ywv870sykxxykejp" + } + ], + "burned_coins": [] + }, + "transfer": { + "port_id": "transfer", + "denom_traces": [], + "params": { + "send_enabled": true, + "receive_enabled": true + } + }, + "upgrade": {}, + "vesting": {} + } +} \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/node/config/node_key.json b/module-sdk/integration_test/scripts/node/config/node_key.json new file mode 100644 index 00000000..3e61faba --- /dev/null +++ b/module-sdk/integration_test/scripts/node/config/node_key.json @@ -0,0 +1 @@ +{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"Dyjc0bX/HiIXv+5rsZWvBwLqvI5fD5nitDC49L/H0PnPoRChRIMgaPqNbXA3cWbZHujkATDwGmgfcHjaBZ6BUw=="}} \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/node/config/priv_validator_key.json b/module-sdk/integration_test/scripts/node/config/priv_validator_key.json new file mode 100644 index 00000000..aab96264 --- /dev/null +++ b/module-sdk/integration_test/scripts/node/config/priv_validator_key.json @@ -0,0 +1,11 @@ +{ + "address": "2FDA2E2186D90D9EFEB88C33749F2E4027EC3EC1", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "CJ6CJOrPeR0LhGNMJGRDUPiDrjCDVyPmRBRdZWp8kDg=" + }, + "priv_key": { + "type": "tendermint/PrivKeyEd25519", + "value": "JcFps8b5GHiiev3qg9tczfjRE+livjjT0nfSnWbqjU8InoIk6s95HQuEY0wkZENQ+IOuMINXI+ZEFF1lanyQOA==" + } +} \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/node/data/priv_validator_state.json b/module-sdk/integration_test/scripts/node/data/priv_validator_state.json new file mode 100644 index 00000000..48f3b67e --- /dev/null +++ b/module-sdk/integration_test/scripts/node/data/priv_validator_state.json @@ -0,0 +1,5 @@ +{ + "height": "0", + "round": 0, + "step": 0 +} \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/priv.key b/module-sdk/integration_test/scripts/priv.key new file mode 100644 index 00000000..20cd8b85 --- /dev/null +++ b/module-sdk/integration_test/scripts/priv.key @@ -0,0 +1,9 @@ +-----BEGIN TENDERMINT PRIVATE KEY----- +kdf: bcrypt +salt: 298F51F7478AD9129407D92E3159D7E5 +type: secp256k1 + +Ek9wCZKdEvCu8hrIPr58cUyGHM12b5G6/EIdtWnXlmD9sRifgHt2pfNMD60+W85W +eiSls9IG9KtFM0vjcGWE+lkkxIVo0pBPlhi5NC4= +=jD+4 +-----END TENDERMINT PRIVATE KEY----- \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/setup.sh b/module-sdk/integration_test/scripts/setup.sh new file mode 100755 index 00000000..bf73d002 --- /dev/null +++ b/module-sdk/integration_test/scripts/setup.sh @@ -0,0 +1 @@ + cp -r ./scripts/node/ ~/.iris \ No newline at end of file diff --git a/module-sdk/integration_test/scripts/start.sh b/module-sdk/integration_test/scripts/start.sh new file mode 100755 index 00000000..db2a81cb --- /dev/null +++ b/module-sdk/integration_test/scripts/start.sh @@ -0,0 +1 @@ +docker run -d -it --rm -p 26657:26657 -p 9090:9090 --name irishub-sdk-go-test irishub-sdk-go \ No newline at end of file diff --git a/module-sdk/integration_test/service_test.go b/module-sdk/integration_test/service_test.go new file mode 100644 index 00000000..1910067d --- /dev/null +++ b/module-sdk/integration_test/service_test.go @@ -0,0 +1,167 @@ +package integration_test + +import ( + "time" + + "github.com/stretchr/testify/require" + + sdk "github.com/irisnet/irishub-sdk-go/types" + "github.com/irisnet/irishub-sdk-go/types/query" + + "github.com/irisnet/irishub-sdk-go/modules/service" +) + +func (s IntegrationTestSuite) TestService() { + schemas := `{"input":{"type":"object"},"output":{"type":"object"},"error":{"type":"object"}}` + pricing := `{"price":"1uiris"}` + options := `{}` + + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + definition := service.DefineServiceRequest{ + ServiceName: s.RandStringOfLength(10), + Description: "this is a test service", + Tags: nil, + AuthorDescription: "service provider", + Schemas: schemas, + } + + result, err := s.Service.DefineService(definition, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), result.Hash) + + defi, err := s.Service.QueryServiceDefinition(definition.ServiceName) + require.NoError(s.T(), err) + require.Equal(s.T(), definition.ServiceName, defi.Name) + require.Equal(s.T(), definition.Description, defi.Description) + require.EqualValues(s.T(), definition.Tags, defi.Tags) + require.Equal(s.T(), definition.AuthorDescription, defi.AuthorDescription) + require.Equal(s.T(), definition.Schemas, defi.Schemas) + require.Equal(s.T(), s.Account().Address.String(), defi.Author) + + deposit, e := sdk.ParseDecCoins("20000uiris") + require.NoError(s.T(), e) + binding := service.BindServiceRequest{ + ServiceName: definition.ServiceName, + Deposit: deposit, + Pricing: pricing, + QoS: 10, + Options: options, + } + result, err = s.Service.BindService(binding, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), result.Hash) + + bindResp, err := s.Service.QueryServiceBinding(definition.ServiceName, s.Account().Address.String()) + require.NoError(s.T(), err) + require.Equal(s.T(), binding.ServiceName, bindResp.ServiceName) + require.Equal(s.T(), s.Account().Address.String(), bindResp.Provider) + require.Equal(s.T(), binding.Pricing, bindResp.Pricing) + + input := `{"header":{},"body":{"pair":"uiris-usdt"}}` + output := `{"header":{},"body":{"last":"1:100"}}` + testResult := `{"code":200,"message":""}` + + var sub1 sdk.Subscription + callback := func(reqCtxID, reqID, input string) (string, string) { + _, err := s.Service.QueryServiceRequest(reqID) + require.NoError(s.T(), err) + return output, testResult + } + sub1, err = s.Service.SubscribeServiceRequest(definition.ServiceName, callback, baseTx) + require.NoError(s.T(), err) + s.Logger().Info("SubscribeServiceRequest", "condition", sub1.Query) + + serviceFeeCap, e := sdk.ParseDecCoins("200uiris") + require.NoError(s.T(), e) + + invocation := service.InvokeServiceRequest{ + ServiceName: definition.ServiceName, + Providers: []string{s.Account().Address.String()}, + Input: input, + ServiceFeeCap: serviceFeeCap, + Timeout: 10, + Repeated: false, + RepeatedTotal: -1, + } + + var requestContextID string + var sub2 sdk.Subscription + var exit = make(chan int) + + requestContextID, result, err = s.Service.InvokeService(invocation, baseTx) + require.NoError(s.T(), err) + s.Logger().Info("InvokeService success", + "hash", result.Hash, + "requestContextID", requestContextID, + ) + + requestid, err := s.Service.QueryRequestsByReqCtx(requestContextID, 1, &query.PageRequest{}) + require.NoError(s.T(), err) + s.Logger().Info("request_id: ", requestid) + + sub2, err = s.Service.SubscribeServiceResponse(requestContextID, func(reqCtxID, reqID, responses string) { + require.Equal(s.T(), reqCtxID, requestContextID) + require.Equal(s.T(), output, responses) + request, err := s.Service.QueryServiceRequest(reqID) + require.NoError(s.T(), err) + require.Equal(s.T(), reqCtxID, request.RequestContextID) + require.Equal(s.T(), reqID, request.ID) + require.Equal(s.T(), input, request.Input) + + exit <- 1 + }) + require.NoError(s.T(), err) + + for { + select { + case <-exit: + err = s.Unsubscribe(sub1) + require.NoError(s.T(), err) + err = s.Unsubscribe(sub2) + require.NoError(s.T(), err) + goto loop + case <-time.After(2 * time.Minute): + require.Panics(s.T(), func() {}, "test service timeout") + } + } + +loop: + //_, err = s.Service.PauseRequestContext(requestContextID, baseTx) + //require.NoError(s.T(), err) + // + //_, err = s.Service.StartRequestContext(requestContextID, baseTx) + //require.NoError(s.T(), err) + + request, err := s.Service.QueryRequestContext(requestContextID) + require.NoError(s.T(), err) + require.Equal(s.T(), request.ServiceName, invocation.ServiceName) + require.Equal(s.T(), request.Input, invocation.Input) + + addr, _, err := s.Key.Add(s.RandStringOfLength(30), "1234567890") + require.NoError(s.T(), err) + require.NotEmpty(s.T(), addr) + + _, err = s.Service.SetWithdrawAddress(addr, baseTx) + require.NoError(s.T(), err) + + fee, err := s.Service.QueryFees(s.Account().Address.String()) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), fee) + + //acc := s.GetRandAccount() + + //TODO + //rs, err := s.ServiceI.WithdrawEarnedFees(acc.Address.String(), baseTx) + //require.NoError(s.T(), err) + // + //withdrawFee, er := rs.Events.GetValue("transfer", "amount") + //require.NoError(s.T(), er) + //require.Equal(s.T(), fee.String(), withdrawFee) +} diff --git a/module-sdk/integration_test/staking_test.go b/module-sdk/integration_test/staking_test.go new file mode 100644 index 00000000..b0ba5e26 --- /dev/null +++ b/module-sdk/integration_test/staking_test.go @@ -0,0 +1,294 @@ +package integration_test + +import ( + "context" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/irishub-sdk-go/modules/staking" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +func (s IntegrationTestSuite) TestStaking() { + cases := []SubTest{ + { + "TestStaking", + testStaking, + }, + //{ + // "TestCreateAndEdit", + // testCreateAndEdit, + //}, + { + "TestQueryHistoricalInfo", + queryHistoricalInfo, + }, + { + "TestQueryPool", + queryPool, + }, + { + "TestQueryParams", + queryParams, + }, + } + + for _, t := range cases { + s.Run(t.testName, func() { + t.testCase(s) + }) + } +} + +// this need another node to test +func testCreateAndEdit(s IntegrationTestSuite) { + // send createValidator tx + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + rate := sdk.MustNewDecFromStr("0.1") + maxRate := sdk.MustNewDecFromStr("0.1") + maxChangeRate := sdk.MustNewDecFromStr("0.01") + minSelfDelegation := sdk.OneInt() + value, _ := sdk.ParseDecCoin("1iris") + req1 := staking.CreateValidatorRequest{ + Moniker: "haha", + Rate: rate, + MaxRate: maxRate, + MaxChangeRate: maxChangeRate, + MinSelfDelegation: minSelfDelegation, + Pubkey: "", + Value: value, + } + res, err := s.Staking.CreateValidator(req1, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + // send editValidator tx + commissionRate := sdk.MustNewDecFromStr("0.1") + minSelfDelegation = sdk.OneInt() + req2 := staking.EditValidatorRequest{ + Moniker: "haha", + Identity: "identity", + Website: "website", + SecurityContact: "abbccdd", + Details: "fadsfas", + CommissionRate: commissionRate, + MinSelfDelegation: minSelfDelegation, + } + res, err = s.Staking.EditValidator(req2, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) +} + +func testStaking(s IntegrationTestSuite) { + // ================================ about delegate ============================== + delegateAddr := s.Account().Address.String() + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + // queries all validators that match the given status. + validatorsResp, err := s.Staking.QueryValidators("", 1, 10) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), validatorsResp.Validators) + + // queries validator info for given validator address. + validatorAddr := validatorsResp.Validators[0].OperatorAddress + validatorResp, err := s.Staking.QueryValidator(validatorAddr) + require.NoError(s.T(), err) + require.Equal(s.T(), validatorAddr, validatorResp.OperatorAddress) + + // send Delegate tx + amount, _ := sdk.ParseDecCoin("10000iris") + delegateReq := staking.DelegateRequest{ + ValidatorAddr: validatorAddr, + Amount: amount, + } + res, err := s.Staking.Delegate(delegateReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + // queries delegate info for given validator delegator pair. + delegation, err := s.Staking.QueryDelegation(delegateAddr, validatorAddr) + require.NoError(s.T(), err) + require.Equal(s.T(), delegateAddr, delegation.Delegation.DelegatorAddress) + require.Equal(s.T(), validatorAddr, delegation.Delegation.ValidatorAddress) + + // queries delegate info for given validator + delegationsToResp, err := s.Staking.QueryValidatorDelegations(validatorAddr, 1, 10) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), delegationsToResp.DelegationResponses) + require.Greater(s.T(), delegationsToResp.Total, uint64(0)) + var exists bool + for _, d := range delegationsToResp.DelegationResponses { + if d.Delegation.DelegatorAddress == delegateAddr { + exists = true + } + } + require.True(s.T(), exists) + + // queries all delegations of a given delegator address. + delegatorDelegations, err := s.Staking.QueryDelegatorDelegations(delegateAddr, 1, 10) + require.NoError(s.T(), err) + exists = false // init exists + for _, d := range delegatorDelegations.DelegationResponses { + if d.Delegation.ValidatorAddress == validatorAddr && d.Delegation.DelegatorAddress == delegateAddr { + exists = true + } + } + require.True(s.T(), exists) + + // queries all validators info for given delegator + delegatorValidators, err := s.Staking.QueryDelegatorValidators(delegateAddr, 1, 10) + require.NoError(s.T(), err) + exists = false // init exists + for _, v := range delegatorValidators.Validator { + if v.OperatorAddress == validatorAddr { + exists = true + } + } + require.True(s.T(), exists) + + // queries validator info for given delegator validator pair. + delegatorValidator, err := s.Staking.QueryDelegatorValidator(delegateAddr, validatorAddr) + require.NoError(s.T(), err) + require.Equal(s.T(), validatorAddr, delegatorValidator.OperatorAddress) + + // ================================ about unbonding ============================== + // send Undelegate tx + amount, _ = sdk.ParseDecCoin("500iris") + undelegateReq := staking.UndelegateRequest{ + ValidatorAddr: validatorAddr, + Amount: amount, + } + res, err = s.Staking.Undelegate(undelegateReq, baseTx) + require.NoError(s.T(), err) + require.Greater(s.T(), res.Height, int64(1)) + + // queries unbonding delegations of a validator. + unbondingDelegations, err := s.Staking.QueryValidatorUnbondingDelegations(validatorAddr, 1, 10) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), unbondingDelegations.UnbondingResponses) + exists = false // init exists + for _, u := range unbondingDelegations.UnbondingResponses { + if u.DelegatorAddress == delegateAddr && u.ValidatorAddress == validatorAddr { + exists = true + } + require.NotEmpty(s.T(), u.Entries) + } + require.True(s.T(), exists) + + // queries unbonding info for given validator delegator pair. + unbondingDelegation, err := s.Staking.QueryUnbondingDelegation(delegateAddr, validatorAddr) + require.NoError(s.T(), err) + require.Equal(s.T(), validatorAddr, unbondingDelegation.ValidatorAddress) + require.Equal(s.T(), delegateAddr, unbondingDelegation.DelegatorAddress) + + // queries all unbonding delegations of a given delegator address. + delegatorUnbondingDelegations, err := s.Staking.QueryDelegatorUnbondingDelegations(delegateAddr, 1, 10) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + exists = false // init exists + for _, d := range delegatorUnbondingDelegations.UnbondingDelegations { + if d.DelegatorAddress == delegateAddr && d.ValidatorAddress == validatorAddr { + exists = true + } + require.NotEmpty(s.T(), d.Entries) + } + require.True(s.T(), exists) + + // ================================ about redelegate ============================== + // send redelegate tx + /* amount, _ = sdk.ParseDecCoin("3000iris") + // you can use another node to create a validator, then assgin newValidatorAddr in ValidatorDstAddress to send this tx + newValidatorAddr := validatorAddr + redelegateReq := staking.BeginRedelegateRequest{ + ValidatorSrcAddress: validatorAddr, + ValidatorDstAddress: newValidatorAddr, + Amount: amount, + } + res, err = s.Staking.BeginRedelegate(redelegateReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Hash) + + // queries redelegations of given address. + redelegationsReq := staking.QueryRedelegationsReq{ + DelegatorAddr: "", + SrcValidatorAddr: "", + DstValidatorAddr: "", + Page: 0, + Size: 0, + } + redelegations, err := s.Staking.QueryRedelegations(redelegationsReq) + require.NoError(s.T(), err) + exists = false // init exists + for _, r := range redelegations.RedelegationResponses { + if r.Redelegation.ValidatorSrcAddress == validatorAddr && r.Redelegation.ValidatorDstAddress == newValidatorAddr { + exists = true + } + require.NotEmpty(s.T(), r.Entries) + } + require.True(s.T(), exists)*/ +} + +func queryHistoricalInfo(s IntegrationTestSuite) { + // get latestBlockHeight at first + status, err := s.Status(context.Background()) + require.NoError(s.T(), err) + height := status.SyncInfo.LatestBlockHeight + height -= 10 + + res, err := s.Staking.QueryHistoricalInfo(height) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), res.Valset) + + var flag bool + for _, validator := range res.Valset { + if validator.OperatorAddress == s.curValAddr() { + flag = true + } + } + require.True(s.T(), flag) +} + +func queryPool(s IntegrationTestSuite) { + res, err := s.Staking.QueryPool() + require.NoError(s.T(), err) + require.Greater(s.T(), res.BondedTokens.Int64(), int64(0)) + require.GreaterOrEqual(s.T(), res.NotBondedTokens.Int64(), int64(0)) // NotBondedTokens can be 0 +} + +func queryParams(s IntegrationTestSuite) { + // this params is irishub default params + const ( + bondDenom = "uiris" + defaultHistorical = uint32(10000) + MaxValidators = uint32(100) + MaxEntries = uint32(7) + ) + + res, err := s.Staking.QueryParams() + require.NoError(s.T(), err) + require.Equal(s.T(), bondDenom, res.BondDenom) + require.Equal(s.T(), defaultHistorical, res.HistoricalEntries) + require.Equal(s.T(), MaxValidators, res.MaxValidators) + require.Equal(s.T(), MaxEntries, res.MaxEntries) +} + +func (s IntegrationTestSuite) curValAddr() string { + // queries all validators that match the given status. + validatorsResp, err := s.Staking.QueryValidators("", 1, 10) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), validatorsResp.Validators) + return validatorsResp.Validators[0].OperatorAddress +} diff --git a/module-sdk/integration_test/token_test.go b/module-sdk/integration_test/token_test.go new file mode 100644 index 00000000..ee9a0108 --- /dev/null +++ b/module-sdk/integration_test/token_test.go @@ -0,0 +1,87 @@ +package integration_test + +import ( + "strings" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/irishub-sdk-go/modules/token" + sdk "github.com/irisnet/irishub-sdk-go/types" +) + +func (s IntegrationTestSuite) TestToken() { + baseTx := sdk.BaseTx{ + From: s.Account().Name, + Gas: 200000, + Memo: "test", + Mode: sdk.Commit, + Password: s.Account().Password, + } + + issueTokenReq := token.IssueTokenRequest{ + Symbol: strings.ToLower(s.RandStringOfLength(3)), + Name: s.RandStringOfLength(8), + Scale: 9, + MinUnit: strings.ToLower(s.RandStringOfLength(3)), + InitialSupply: 10000000, + MaxSupply: 21000000, + Mintable: true, + } + + //test issue token + rs, err := s.Token.IssueToken(issueTokenReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), rs.Hash) + + //test mint token + receipt := s.GetRandAccount().Address.String() + rs, err = s.Token.MintToken(issueTokenReq.Symbol, 1000, receipt, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), rs.Hash) + + account, err := s.Bank.QueryAccount(receipt) + require.NoError(s.T(), err) + + amt := sdk.NewIntWithDecimal(1000, int(issueTokenReq.Scale)) + require.Equal(s.T(), amt, account.Coins.AmountOf(issueTokenReq.MinUnit)) + + editTokenReq := token.EditTokenRequest{ + Symbol: issueTokenReq.Symbol, + Name: "ethereum network", + MaxSupply: 20000000, + Mintable: false, + } + + //test edit token + rs, err = s.Token.EditToken(editTokenReq, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), rs.Hash) + + //test transfer token + rs, err = s.Token.TransferToken(receipt, issueTokenReq.Symbol, baseTx) + require.NoError(s.T(), err) + require.NotEmpty(s.T(), rs.Hash) + + t1, er := s.Token.QueryToken(issueTokenReq.Symbol) + require.NoError(s.T(), er) + require.Equal(s.T(), t1.Name, editTokenReq.Name) + require.Equal(s.T(), t1.MaxSupply, editTokenReq.MaxSupply) + require.Equal(s.T(), t1.Mintable, editTokenReq.Mintable) + require.Equal(s.T(), receipt, t1.Owner) + + tokens, er := s.Token.QueryTokens("") + require.NoError(s.T(), er) + require.Contains(s.T(), tokens, t1) + + feeToken, er := s.Token.QueryFees(issueTokenReq.Symbol) + require.NoError(s.T(), er) + require.Equal(s.T(), true, feeToken.Exist) + require.Equal(s.T(), "60000000000uiris", feeToken.IssueFee.String()) + require.Equal(s.T(), "6000000000uiris", feeToken.MintFee.String()) + + res, er := s.Token.QueryParams() + require.NoError(s.T(), er) + require.Equal(s.T(), "0.100000000000000000", res.MintTokenFeeRatio) + require.Equal(s.T(), "0.400000000000000000", res.TokenTaxRate) + require.Equal(s.T(), "60000iris", res.IssueTokenBaseFee) +} diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index 476e77c2..0ec77b7c 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -1,4 +1,4 @@ -module nft +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 59e7e4d7..6e81af43 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -1,4 +1,4 @@ -module oracle +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index 0c90ce30..0ec77b7c 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -1,4 +1,4 @@ -module random +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index 63ec5c4e..0ec77b7c 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -1,4 +1,4 @@ -module gov +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index 63ec5c4e..0ec77b7c 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -1,4 +1,4 @@ -module gov +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index 63ec5c4e..0ec77b7c 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -1,4 +1,4 @@ -module gov +module github.com/irisnet/module-sdk-go go 1.16 diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index b9a86a4a..0ec77b7c 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -1,4 +1,4 @@ -module token +module github.com/irisnet/module-sdk-go go 1.16 From 25bc40037680c9127e327400c9cc601e5c473a80 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Fri, 2 Jul 2021 11:28:58 +0800 Subject: [PATCH 12/41] add module-sdk proto --- module-sdk/coinswap/go.mod | 2 +- module-sdk/integration_test/coinswap_test.go | 3 +-- {proto => module-sdk/proto}/coinswap/coinswap.proto | 0 {proto => module-sdk/proto}/coinswap/genesis.proto | 0 {proto => module-sdk/proto}/coinswap/query.proto | 0 {proto => module-sdk/proto}/coinswap/tx.proto | 0 {proto => module-sdk/proto}/cosmos/auth/v1beta1/auth.proto | 0 {proto => module-sdk/proto}/cosmos/auth/v1beta1/query.proto | 0 {proto => module-sdk/proto}/cosmos/bank/v1beta1/bank.proto | 0 {proto => module-sdk/proto}/cosmos/bank/v1beta1/query.proto | 0 {proto => module-sdk/proto}/cosmos/bank/v1beta1/tx.proto | 0 .../proto}/cosmos/base/abci/v1beta1/abci.proto | 0 {proto => module-sdk/proto}/cosmos/base/kv/v1beta1/kv.proto | 0 .../proto}/cosmos/base/query/v1beta1/pagination.proto | 0 {proto => module-sdk/proto}/cosmos/base/v1beta1/coin.proto | 0 {proto => module-sdk/proto}/cosmos/crypto/ed25519/keys.proto | 0 {proto => module-sdk/proto}/cosmos/crypto/multisig/keys.proto | 0 .../proto}/cosmos/crypto/multisig/v1beta1/multisig.proto | 0 {proto => module-sdk/proto}/cosmos/crypto/secp256k1/keys.proto | 0 {proto => module-sdk/proto}/cosmos/gov/v1beta1/gov.proto | 0 {proto => module-sdk/proto}/cosmos/gov/v1beta1/query.proto | 0 {proto => module-sdk/proto}/cosmos/gov/v1beta1/tx.proto | 0 {proto => module-sdk/proto}/cosmos/staking/v1beta1/query.proto | 0 .../proto}/cosmos/staking/v1beta1/staking.proto | 0 {proto => module-sdk/proto}/cosmos/staking/v1beta1/tx.proto | 0 .../proto}/cosmos/tx/signing/v1beta1/signing.proto | 0 {proto => module-sdk/proto}/cosmos/tx/v1beta1/tx.proto | 0 {proto => module-sdk/proto}/htlc/htlc.proto | 0 {proto => module-sdk/proto}/htlc/query.proto | 0 {proto => module-sdk/proto}/htlc/tx.proto | 0 {proto => module-sdk/proto}/nft/nft.proto | 0 {proto => module-sdk/proto}/nft/query.proto | 0 {proto => module-sdk/proto}/nft/tx.proto | 0 {proto => module-sdk/proto}/oracle/oracle.proto | 0 {proto => module-sdk/proto}/oracle/query.proto | 0 {proto => module-sdk/proto}/oracle/tx.proto | 0 {proto => module-sdk/proto}/random/query.proto | 0 {proto => module-sdk/proto}/random/random.proto | 0 {proto => module-sdk/proto}/random/tx.proto | 0 {proto => module-sdk/proto}/record/query.proto | 0 {proto => module-sdk/proto}/record/record.proto | 0 {proto => module-sdk/proto}/record/tx.proto | 0 {proto => module-sdk/proto}/service/query.proto | 0 {proto => module-sdk/proto}/service/service.proto | 0 {proto => module-sdk/proto}/service/tx.proto | 0 {proto => module-sdk/proto}/token/query.proto | 0 {proto => module-sdk/proto}/token/token.proto | 0 {proto => module-sdk/proto}/token/tx.proto | 0 48 files changed, 2 insertions(+), 3 deletions(-) rename {proto => module-sdk/proto}/coinswap/coinswap.proto (100%) rename {proto => module-sdk/proto}/coinswap/genesis.proto (100%) rename {proto => module-sdk/proto}/coinswap/query.proto (100%) rename {proto => module-sdk/proto}/coinswap/tx.proto (100%) rename {proto => module-sdk/proto}/cosmos/auth/v1beta1/auth.proto (100%) rename {proto => module-sdk/proto}/cosmos/auth/v1beta1/query.proto (100%) rename {proto => module-sdk/proto}/cosmos/bank/v1beta1/bank.proto (100%) rename {proto => module-sdk/proto}/cosmos/bank/v1beta1/query.proto (100%) rename {proto => module-sdk/proto}/cosmos/bank/v1beta1/tx.proto (100%) rename {proto => module-sdk/proto}/cosmos/base/abci/v1beta1/abci.proto (100%) rename {proto => module-sdk/proto}/cosmos/base/kv/v1beta1/kv.proto (100%) rename {proto => module-sdk/proto}/cosmos/base/query/v1beta1/pagination.proto (100%) rename {proto => module-sdk/proto}/cosmos/base/v1beta1/coin.proto (100%) rename {proto => module-sdk/proto}/cosmos/crypto/ed25519/keys.proto (100%) rename {proto => module-sdk/proto}/cosmos/crypto/multisig/keys.proto (100%) rename {proto => module-sdk/proto}/cosmos/crypto/multisig/v1beta1/multisig.proto (100%) rename {proto => module-sdk/proto}/cosmos/crypto/secp256k1/keys.proto (100%) rename {proto => module-sdk/proto}/cosmos/gov/v1beta1/gov.proto (100%) rename {proto => module-sdk/proto}/cosmos/gov/v1beta1/query.proto (100%) rename {proto => module-sdk/proto}/cosmos/gov/v1beta1/tx.proto (100%) rename {proto => module-sdk/proto}/cosmos/staking/v1beta1/query.proto (100%) rename {proto => module-sdk/proto}/cosmos/staking/v1beta1/staking.proto (100%) rename {proto => module-sdk/proto}/cosmos/staking/v1beta1/tx.proto (100%) rename {proto => module-sdk/proto}/cosmos/tx/signing/v1beta1/signing.proto (100%) rename {proto => module-sdk/proto}/cosmos/tx/v1beta1/tx.proto (100%) rename {proto => module-sdk/proto}/htlc/htlc.proto (100%) rename {proto => module-sdk/proto}/htlc/query.proto (100%) rename {proto => module-sdk/proto}/htlc/tx.proto (100%) rename {proto => module-sdk/proto}/nft/nft.proto (100%) rename {proto => module-sdk/proto}/nft/query.proto (100%) rename {proto => module-sdk/proto}/nft/tx.proto (100%) rename {proto => module-sdk/proto}/oracle/oracle.proto (100%) rename {proto => module-sdk/proto}/oracle/query.proto (100%) rename {proto => module-sdk/proto}/oracle/tx.proto (100%) rename {proto => module-sdk/proto}/random/query.proto (100%) rename {proto => module-sdk/proto}/random/random.proto (100%) rename {proto => module-sdk/proto}/random/tx.proto (100%) rename {proto => module-sdk/proto}/record/query.proto (100%) rename {proto => module-sdk/proto}/record/record.proto (100%) rename {proto => module-sdk/proto}/record/tx.proto (100%) rename {proto => module-sdk/proto}/service/query.proto (100%) rename {proto => module-sdk/proto}/service/service.proto (100%) rename {proto => module-sdk/proto}/service/tx.proto (100%) rename {proto => module-sdk/proto}/token/query.proto (100%) rename {proto => module-sdk/proto}/token/token.proto (100%) rename {proto => module-sdk/proto}/token/tx.proto (100%) diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index bc704999..b83a9832 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/coinswap-sdk-go go 1.16 diff --git a/module-sdk/integration_test/coinswap_test.go b/module-sdk/integration_test/coinswap_test.go index 00dbb9ae..b43c1133 100644 --- a/module-sdk/integration_test/coinswap_test.go +++ b/module-sdk/integration_test/coinswap_test.go @@ -3,11 +3,10 @@ package integration_test import ( "time" - "github.com/stretchr/testify/require" - "github.com/irisnet/irishub-sdk-go/modules/coinswap" "github.com/irisnet/irishub-sdk-go/modules/token" sdk "github.com/irisnet/irishub-sdk-go/types" + "github.com/stretchr/testify/require" ) func (s IntegrationTestSuite) TestCoinSwap() { diff --git a/proto/coinswap/coinswap.proto b/module-sdk/proto/coinswap/coinswap.proto similarity index 100% rename from proto/coinswap/coinswap.proto rename to module-sdk/proto/coinswap/coinswap.proto diff --git a/proto/coinswap/genesis.proto b/module-sdk/proto/coinswap/genesis.proto similarity index 100% rename from proto/coinswap/genesis.proto rename to module-sdk/proto/coinswap/genesis.proto diff --git a/proto/coinswap/query.proto b/module-sdk/proto/coinswap/query.proto similarity index 100% rename from proto/coinswap/query.proto rename to module-sdk/proto/coinswap/query.proto diff --git a/proto/coinswap/tx.proto b/module-sdk/proto/coinswap/tx.proto similarity index 100% rename from proto/coinswap/tx.proto rename to module-sdk/proto/coinswap/tx.proto diff --git a/proto/cosmos/auth/v1beta1/auth.proto b/module-sdk/proto/cosmos/auth/v1beta1/auth.proto similarity index 100% rename from proto/cosmos/auth/v1beta1/auth.proto rename to module-sdk/proto/cosmos/auth/v1beta1/auth.proto diff --git a/proto/cosmos/auth/v1beta1/query.proto b/module-sdk/proto/cosmos/auth/v1beta1/query.proto similarity index 100% rename from proto/cosmos/auth/v1beta1/query.proto rename to module-sdk/proto/cosmos/auth/v1beta1/query.proto diff --git a/proto/cosmos/bank/v1beta1/bank.proto b/module-sdk/proto/cosmos/bank/v1beta1/bank.proto similarity index 100% rename from proto/cosmos/bank/v1beta1/bank.proto rename to module-sdk/proto/cosmos/bank/v1beta1/bank.proto diff --git a/proto/cosmos/bank/v1beta1/query.proto b/module-sdk/proto/cosmos/bank/v1beta1/query.proto similarity index 100% rename from proto/cosmos/bank/v1beta1/query.proto rename to module-sdk/proto/cosmos/bank/v1beta1/query.proto diff --git a/proto/cosmos/bank/v1beta1/tx.proto b/module-sdk/proto/cosmos/bank/v1beta1/tx.proto similarity index 100% rename from proto/cosmos/bank/v1beta1/tx.proto rename to module-sdk/proto/cosmos/bank/v1beta1/tx.proto diff --git a/proto/cosmos/base/abci/v1beta1/abci.proto b/module-sdk/proto/cosmos/base/abci/v1beta1/abci.proto similarity index 100% rename from proto/cosmos/base/abci/v1beta1/abci.proto rename to module-sdk/proto/cosmos/base/abci/v1beta1/abci.proto diff --git a/proto/cosmos/base/kv/v1beta1/kv.proto b/module-sdk/proto/cosmos/base/kv/v1beta1/kv.proto similarity index 100% rename from proto/cosmos/base/kv/v1beta1/kv.proto rename to module-sdk/proto/cosmos/base/kv/v1beta1/kv.proto diff --git a/proto/cosmos/base/query/v1beta1/pagination.proto b/module-sdk/proto/cosmos/base/query/v1beta1/pagination.proto similarity index 100% rename from proto/cosmos/base/query/v1beta1/pagination.proto rename to module-sdk/proto/cosmos/base/query/v1beta1/pagination.proto diff --git a/proto/cosmos/base/v1beta1/coin.proto b/module-sdk/proto/cosmos/base/v1beta1/coin.proto similarity index 100% rename from proto/cosmos/base/v1beta1/coin.proto rename to module-sdk/proto/cosmos/base/v1beta1/coin.proto diff --git a/proto/cosmos/crypto/ed25519/keys.proto b/module-sdk/proto/cosmos/crypto/ed25519/keys.proto similarity index 100% rename from proto/cosmos/crypto/ed25519/keys.proto rename to module-sdk/proto/cosmos/crypto/ed25519/keys.proto diff --git a/proto/cosmos/crypto/multisig/keys.proto b/module-sdk/proto/cosmos/crypto/multisig/keys.proto similarity index 100% rename from proto/cosmos/crypto/multisig/keys.proto rename to module-sdk/proto/cosmos/crypto/multisig/keys.proto diff --git a/proto/cosmos/crypto/multisig/v1beta1/multisig.proto b/module-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto similarity index 100% rename from proto/cosmos/crypto/multisig/v1beta1/multisig.proto rename to module-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto diff --git a/proto/cosmos/crypto/secp256k1/keys.proto b/module-sdk/proto/cosmos/crypto/secp256k1/keys.proto similarity index 100% rename from proto/cosmos/crypto/secp256k1/keys.proto rename to module-sdk/proto/cosmos/crypto/secp256k1/keys.proto diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/module-sdk/proto/cosmos/gov/v1beta1/gov.proto similarity index 100% rename from proto/cosmos/gov/v1beta1/gov.proto rename to module-sdk/proto/cosmos/gov/v1beta1/gov.proto diff --git a/proto/cosmos/gov/v1beta1/query.proto b/module-sdk/proto/cosmos/gov/v1beta1/query.proto similarity index 100% rename from proto/cosmos/gov/v1beta1/query.proto rename to module-sdk/proto/cosmos/gov/v1beta1/query.proto diff --git a/proto/cosmos/gov/v1beta1/tx.proto b/module-sdk/proto/cosmos/gov/v1beta1/tx.proto similarity index 100% rename from proto/cosmos/gov/v1beta1/tx.proto rename to module-sdk/proto/cosmos/gov/v1beta1/tx.proto diff --git a/proto/cosmos/staking/v1beta1/query.proto b/module-sdk/proto/cosmos/staking/v1beta1/query.proto similarity index 100% rename from proto/cosmos/staking/v1beta1/query.proto rename to module-sdk/proto/cosmos/staking/v1beta1/query.proto diff --git a/proto/cosmos/staking/v1beta1/staking.proto b/module-sdk/proto/cosmos/staking/v1beta1/staking.proto similarity index 100% rename from proto/cosmos/staking/v1beta1/staking.proto rename to module-sdk/proto/cosmos/staking/v1beta1/staking.proto diff --git a/proto/cosmos/staking/v1beta1/tx.proto b/module-sdk/proto/cosmos/staking/v1beta1/tx.proto similarity index 100% rename from proto/cosmos/staking/v1beta1/tx.proto rename to module-sdk/proto/cosmos/staking/v1beta1/tx.proto diff --git a/proto/cosmos/tx/signing/v1beta1/signing.proto b/module-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto similarity index 100% rename from proto/cosmos/tx/signing/v1beta1/signing.proto rename to module-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto diff --git a/proto/cosmos/tx/v1beta1/tx.proto b/module-sdk/proto/cosmos/tx/v1beta1/tx.proto similarity index 100% rename from proto/cosmos/tx/v1beta1/tx.proto rename to module-sdk/proto/cosmos/tx/v1beta1/tx.proto diff --git a/proto/htlc/htlc.proto b/module-sdk/proto/htlc/htlc.proto similarity index 100% rename from proto/htlc/htlc.proto rename to module-sdk/proto/htlc/htlc.proto diff --git a/proto/htlc/query.proto b/module-sdk/proto/htlc/query.proto similarity index 100% rename from proto/htlc/query.proto rename to module-sdk/proto/htlc/query.proto diff --git a/proto/htlc/tx.proto b/module-sdk/proto/htlc/tx.proto similarity index 100% rename from proto/htlc/tx.proto rename to module-sdk/proto/htlc/tx.proto diff --git a/proto/nft/nft.proto b/module-sdk/proto/nft/nft.proto similarity index 100% rename from proto/nft/nft.proto rename to module-sdk/proto/nft/nft.proto diff --git a/proto/nft/query.proto b/module-sdk/proto/nft/query.proto similarity index 100% rename from proto/nft/query.proto rename to module-sdk/proto/nft/query.proto diff --git a/proto/nft/tx.proto b/module-sdk/proto/nft/tx.proto similarity index 100% rename from proto/nft/tx.proto rename to module-sdk/proto/nft/tx.proto diff --git a/proto/oracle/oracle.proto b/module-sdk/proto/oracle/oracle.proto similarity index 100% rename from proto/oracle/oracle.proto rename to module-sdk/proto/oracle/oracle.proto diff --git a/proto/oracle/query.proto b/module-sdk/proto/oracle/query.proto similarity index 100% rename from proto/oracle/query.proto rename to module-sdk/proto/oracle/query.proto diff --git a/proto/oracle/tx.proto b/module-sdk/proto/oracle/tx.proto similarity index 100% rename from proto/oracle/tx.proto rename to module-sdk/proto/oracle/tx.proto diff --git a/proto/random/query.proto b/module-sdk/proto/random/query.proto similarity index 100% rename from proto/random/query.proto rename to module-sdk/proto/random/query.proto diff --git a/proto/random/random.proto b/module-sdk/proto/random/random.proto similarity index 100% rename from proto/random/random.proto rename to module-sdk/proto/random/random.proto diff --git a/proto/random/tx.proto b/module-sdk/proto/random/tx.proto similarity index 100% rename from proto/random/tx.proto rename to module-sdk/proto/random/tx.proto diff --git a/proto/record/query.proto b/module-sdk/proto/record/query.proto similarity index 100% rename from proto/record/query.proto rename to module-sdk/proto/record/query.proto diff --git a/proto/record/record.proto b/module-sdk/proto/record/record.proto similarity index 100% rename from proto/record/record.proto rename to module-sdk/proto/record/record.proto diff --git a/proto/record/tx.proto b/module-sdk/proto/record/tx.proto similarity index 100% rename from proto/record/tx.proto rename to module-sdk/proto/record/tx.proto diff --git a/proto/service/query.proto b/module-sdk/proto/service/query.proto similarity index 100% rename from proto/service/query.proto rename to module-sdk/proto/service/query.proto diff --git a/proto/service/service.proto b/module-sdk/proto/service/service.proto similarity index 100% rename from proto/service/service.proto rename to module-sdk/proto/service/service.proto diff --git a/proto/service/tx.proto b/module-sdk/proto/service/tx.proto similarity index 100% rename from proto/service/tx.proto rename to module-sdk/proto/service/tx.proto diff --git a/proto/token/query.proto b/module-sdk/proto/token/query.proto similarity index 100% rename from proto/token/query.proto rename to module-sdk/proto/token/query.proto diff --git a/proto/token/token.proto b/module-sdk/proto/token/token.proto similarity index 100% rename from proto/token/token.proto rename to module-sdk/proto/token/token.proto diff --git a/proto/token/tx.proto b/module-sdk/proto/token/tx.proto similarity index 100% rename from proto/token/tx.proto rename to module-sdk/proto/token/tx.proto From e26304ecc96df31aabc3991fbf541d1c3a11731a Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Fri, 2 Jul 2021 15:54:43 +0800 Subject: [PATCH 13/41] fix mod file --- module-sdk/Makefile | 20 ++++++++++++++++++++ module-sdk/coinswap/codec.go | 2 -- module-sdk/coinswap/coinswap.go | 2 +- module-sdk/gov/export.go | 2 +- module-sdk/gov/go.mod | 2 +- module-sdk/gov/gov.go | 2 +- module-sdk/gov/proposal.go | 6 +++--- module-sdk/htlc/go.mod | 2 +- module-sdk/integration_test/go.mod | 14 ++++++++++++++ module-sdk/nft/go.mod | 2 +- module-sdk/oracle/export.go | 2 +- module-sdk/oracle/go.mod | 2 +- module-sdk/random/go.mod | 2 +- module-sdk/record/go.mod | 2 +- module-sdk/service/go.mod | 2 +- module-sdk/service/service.go | 4 ++-- module-sdk/staking/delegation.go | 6 +++--- module-sdk/staking/go.mod | 2 +- module-sdk/token/go.mod | 2 +- 19 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 module-sdk/Makefile create mode 100644 module-sdk/integration_test/go.mod diff --git a/module-sdk/Makefile b/module-sdk/Makefile new file mode 100644 index 00000000..7cc2dfdd --- /dev/null +++ b/module-sdk/Makefile @@ -0,0 +1,20 @@ +PACKAGES=$(shell go list ./...) +PACKAGES_UNITTEST=$(shell go list ./... | grep -v integration_test) +export GO111MODULE = on + +format: + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs gofmt -w -s + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs misspell -w + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/irishub-sdk-go + +test-unit: + @go test -v $(PACKAGES_UNITTEST) + +test-integration: + cd integration_test/scripts/ && sh build.sh && sh start.sh + sleep 2s + @go test -v $(PACKAGES) + cd integration_test/scripts/ && sh clean.sh + +proto-gen: + @./third_party/protocgen.sh \ No newline at end of file diff --git a/module-sdk/coinswap/codec.go b/module-sdk/coinswap/codec.go index 613fe3bb..a4278443 100644 --- a/module-sdk/coinswap/codec.go +++ b/module-sdk/coinswap/codec.go @@ -1,12 +1,10 @@ package coinswap import ( - "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" sdk "github.com/irisnet/core-sdk-go/types" - ) var ( diff --git a/module-sdk/coinswap/coinswap.go b/module-sdk/coinswap/coinswap.go index e564a628..0b16aa7d 100644 --- a/module-sdk/coinswap/coinswap.go +++ b/module-sdk/coinswap/coinswap.go @@ -4,10 +4,10 @@ import ( "context" "errors" "fmt" - "strings" "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" + "strings" ) type coinswapClient struct { diff --git a/module-sdk/gov/export.go b/module-sdk/gov/export.go index 5c5db4e5..c0b84b09 100644 --- a/module-sdk/gov/export.go +++ b/module-sdk/gov/export.go @@ -1,8 +1,8 @@ package gov import ( - "time" sdk "github.com/irisnet/core-sdk-go/types" + "time" ) // expose Gov module api for user diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index 0ec77b7c..55fd4632 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/gov-sdk-go go 1.16 diff --git a/module-sdk/gov/gov.go b/module-sdk/gov/gov.go index 790095ee..60688a67 100644 --- a/module-sdk/gov/gov.go +++ b/module-sdk/gov/gov.go @@ -2,11 +2,11 @@ package gov import ( "context" - "strconv" "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/query" + "strconv" ) type govClient struct { diff --git a/module-sdk/gov/proposal.go b/module-sdk/gov/proposal.go index 8fbc39e2..6497d10e 100644 --- a/module-sdk/gov/proposal.go +++ b/module-sdk/gov/proposal.go @@ -2,12 +2,12 @@ package gov import ( "fmt" - "strings" - "time" "github.com/gogo/protobuf/proto" - yaml "gopkg.in/yaml.v2" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" + yaml "gopkg.in/yaml.v2" + "strings" + "time" ) // DefaultStartingProposalID is 1 diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index 0ec77b7c..01560b22 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/htlc-sdk-go go 1.16 diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod new file mode 100644 index 00000000..d837b556 --- /dev/null +++ b/module-sdk/integration_test/go.mod @@ -0,0 +1,14 @@ +module github.com/irisnet/integration-test + +go 1.16 + + +require ( +github.com/gogo/protobuf v1.3.3 +github.com/irisnet/core-sdk-go v0.1.0 +) + +replace ( +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +) \ No newline at end of file diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index 0ec77b7c..9b417c9f 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/nft-sdk-go go 1.16 diff --git a/module-sdk/oracle/export.go b/module-sdk/oracle/export.go index 5c26f90f..3e13ed89 100644 --- a/module-sdk/oracle/export.go +++ b/module-sdk/oracle/export.go @@ -1,8 +1,8 @@ package oracle import ( - "time" sdk "github.com/irisnet/core-sdk-go/types" + "time" ) // expose Oracle module api for user diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 6e81af43..bd4d7277 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/oracle-sdk-go go 1.16 diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index 0ec77b7c..58d84495 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/random-sdk-go go 1.16 diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index 0ec77b7c..ecd9afaf 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/record-sdk-go go 1.16 diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index 0ec77b7c..c936a429 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/service-sdk-go go 1.16 diff --git a/module-sdk/service/service.go b/module-sdk/service/service.go index 289ddff3..ba1c20c2 100644 --- a/module-sdk/service/service.go +++ b/module-sdk/service/service.go @@ -3,11 +3,11 @@ package service import ( "context" "encoding/json" - "strings" "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" - "github.com/irisnet/core-sdk-go/types/query" sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/query" + "strings" ) type serviceClient struct { diff --git a/module-sdk/staking/delegation.go b/module-sdk/staking/delegation.go index 4aec89ed..2c976b2b 100644 --- a/module-sdk/staking/delegation.go +++ b/module-sdk/staking/delegation.go @@ -3,11 +3,11 @@ package staking import ( "encoding/json" "fmt" - "strings" - "time" - yaml "gopkg.in/yaml.v2" "github.com/irisnet/core-sdk-go/common/codec" sdk "github.com/irisnet/core-sdk-go/types" + yaml "gopkg.in/yaml.v2" + "strings" + "time" ) // Implements Delegation interface diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index 0ec77b7c..2b4ee50f 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/staking-sdk-go go 1.16 diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index 0ec77b7c..4b90aa14 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/module-sdk-go +module github.com/irisnet/token-sdk-go go 1.16 From b8af61f532ffe5afa8797e7f062f1c239fa5473f Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 10:34:22 +0800 Subject: [PATCH 14/41] =?UTF-8?q?1=E3=80=81grpc=20client=20changed=20to=20?= =?UTF-8?q?singleton=20mode=202=E3=80=81fix=20integration=5Ftest=203?= =?UTF-8?q?=E3=80=81delete=20unneeded=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/grpc/reflection/reflection.pb.go | 947 --- client/tx/factory.go | 300 - client/tx/tx.go | 54 - codec/amino.go | 185 - codec/amino_codec.go | 80 - codec/any.go | 42 - codec/codec.go | 66 - codec/json.go | 30 - codec/legacy/codec.go | 19 - codec/legacy/doc.go | 4 - codec/proto_codec.go | 154 - codec/types/any.go | 133 - codec/types/any.pb.go | 584 -- codec/types/compat.go | 213 - codec/types/doc.go | 6 - codec/types/interface_registry.go | 272 - codec/unknownproto/doc.go | 24 - codec/unknownproto/unknown_fields.go | 403 - core-sdk/client/account.go | 2 +- core-sdk/client/grpc_client.go | 34 +- core-sdk/go.mod | 1 + core-sdk/go.sum | 3 + crypto/armor.go | 210 - crypto/codec/amino.go | 59 - crypto/codec/proto.go | 27 - crypto/hd/algo.go | 88 - crypto/hd/hdpath.go | 267 - crypto/key_manager.go | 130 - crypto/key_manager_test.go | 25 - crypto/keys/ed25519/ed25519.go | 233 - crypto/keys/ed25519/ed25519_test.go | 218 - crypto/keys/ed25519/keys.pb.go | 497 -- crypto/keys/internal/benchmarking/bench.go | 92 - crypto/keys/multisig/codec.go | 35 - crypto/keys/multisig/keys.pb.go | 360 - crypto/keys/multisig/multisig.go | 168 - crypto/keys/secp256k1/bench_test.go | 28 - .../secp256k1/internal/secp256k1/.gitignore | 24 - .../keys/secp256k1/internal/secp256k1/LICENSE | 31 - .../secp256k1/internal/secp256k1/README.md | 3 - .../secp256k1/internal/secp256k1/curve.go | 328 - .../keys/secp256k1/internal/secp256k1/ext.h | 130 - .../secp256k1/libsecp256k1/.gitignore | 49 - .../secp256k1/libsecp256k1/.travis.yml | 69 - .../internal/secp256k1/libsecp256k1/COPYING | 19 - .../secp256k1/libsecp256k1/Makefile.am | 177 - .../internal/secp256k1/libsecp256k1/README.md | 61 - .../internal/secp256k1/libsecp256k1/TODO | 3 - .../secp256k1/libsecp256k1/autogen.sh | 3 - .../build-aux/m4/ax_jni_include_dir.m4 | 140 - .../build-aux/m4/ax_prog_cc_for_build.m4 | 125 - .../libsecp256k1/build-aux/m4/bitcoin_secp.m4 | 69 - .../secp256k1/libsecp256k1/configure.ac | 493 -- .../libsecp256k1/contrib/lax_der_parsing.c | 150 - .../libsecp256k1/contrib/lax_der_parsing.h | 91 - .../contrib/lax_der_privatekey_parsing.c | 113 - .../contrib/lax_der_privatekey_parsing.h | 90 - .../libsecp256k1/include/secp256k1.h | 577 -- .../libsecp256k1/include/secp256k1_ecdh.h | 31 - .../libsecp256k1/include/secp256k1_recovery.h | 110 - .../secp256k1/libsecp256k1/libsecp256k1.pc.in | 13 - .../secp256k1/libsecp256k1/obj/.gitignore | 0 .../libsecp256k1/sage/group_prover.sage | 322 - .../libsecp256k1/sage/secp256k1.sage | 306 - .../libsecp256k1/sage/weierstrass_prover.sage | 264 - .../libsecp256k1/src/asm/field_10x26_arm.s | 919 --- .../secp256k1/libsecp256k1/src/basic-config.h | 32 - .../secp256k1/libsecp256k1/src/bench.h | 66 - .../secp256k1/libsecp256k1/src/bench_ecdh.c | 54 - .../libsecp256k1/src/bench_internal.c | 382 - .../libsecp256k1/src/bench_recover.c | 60 - .../libsecp256k1/src/bench_schnorr_verify.c | 73 - .../secp256k1/libsecp256k1/src/bench_sign.c | 56 - .../secp256k1/libsecp256k1/src/bench_verify.c | 112 - .../secp256k1/libsecp256k1/src/ecdsa.h | 21 - .../secp256k1/libsecp256k1/src/ecdsa_impl.h | 315 - .../secp256k1/libsecp256k1/src/eckey.h | 25 - .../secp256k1/libsecp256k1/src/eckey_impl.h | 99 - .../secp256k1/libsecp256k1/src/ecmult.h | 31 - .../secp256k1/libsecp256k1/src/ecmult_const.h | 15 - .../libsecp256k1/src/ecmult_const_impl.h | 239 - .../secp256k1/libsecp256k1/src/ecmult_gen.h | 43 - .../libsecp256k1/src/ecmult_gen_impl.h | 210 - .../secp256k1/libsecp256k1/src/ecmult_impl.h | 406 - .../secp256k1/libsecp256k1/src/field.h | 132 - .../secp256k1/libsecp256k1/src/field_10x26.h | 47 - .../libsecp256k1/src/field_10x26_impl.h | 1140 --- .../secp256k1/libsecp256k1/src/field_5x52.h | 47 - .../libsecp256k1/src/field_5x52_asm_impl.h | 502 -- .../libsecp256k1/src/field_5x52_impl.h | 451 -- .../libsecp256k1/src/field_5x52_int128_impl.h | 277 - .../secp256k1/libsecp256k1/src/field_impl.h | 315 - .../secp256k1/libsecp256k1/src/gen_context.c | 74 - .../secp256k1/libsecp256k1/src/group.h | 144 - .../secp256k1/libsecp256k1/src/group_impl.h | 700 -- .../secp256k1/libsecp256k1/src/hash.h | 41 - .../secp256k1/libsecp256k1/src/hash_impl.h | 281 - .../src/java/org/bitcoin/NativeSecp256k1.java | 446 -- .../java/org/bitcoin/NativeSecp256k1Test.java | 226 - .../java/org/bitcoin/NativeSecp256k1Util.java | 45 - .../java/org/bitcoin/Secp256k1Context.java | 51 - .../src/java/org_bitcoin_NativeSecp256k1.c | 377 - .../src/java/org_bitcoin_NativeSecp256k1.h | 119 - .../src/java/org_bitcoin_Secp256k1Context.c | 15 - .../src/java/org_bitcoin_Secp256k1Context.h | 22 - .../src/modules/ecdh/Makefile.am.include | 8 - .../libsecp256k1/src/modules/ecdh/main_impl.h | 54 - .../src/modules/ecdh/tests_impl.h | 105 - .../src/modules/recovery/Makefile.am.include | 8 - .../src/modules/recovery/main_impl.h | 193 - .../src/modules/recovery/tests_impl.h | 393 - .../internal/secp256k1/libsecp256k1/src/num.h | 74 - .../secp256k1/libsecp256k1/src/num_gmp.h | 20 - .../secp256k1/libsecp256k1/src/num_gmp_impl.h | 288 - .../secp256k1/libsecp256k1/src/num_impl.h | 24 - .../secp256k1/libsecp256k1/src/scalar.h | 106 - .../secp256k1/libsecp256k1/src/scalar_4x64.h | 19 - .../libsecp256k1/src/scalar_4x64_impl.h | 949 --- .../secp256k1/libsecp256k1/src/scalar_8x32.h | 19 - .../libsecp256k1/src/scalar_8x32_impl.h | 721 -- .../secp256k1/libsecp256k1/src/scalar_impl.h | 370 - .../secp256k1/libsecp256k1/src/scalar_low.h | 15 - .../libsecp256k1/src/scalar_low_impl.h | 114 - .../secp256k1/libsecp256k1/src/secp256k1.c | 559 -- .../secp256k1/libsecp256k1/src/testrand.h | 38 - .../libsecp256k1/src/testrand_impl.h | 110 - .../secp256k1/libsecp256k1/src/tests.c | 4525 ----------- .../libsecp256k1/src/tests_exhaustive.c | 470 -- .../secp256k1/libsecp256k1/src/util.h | 113 - .../secp256k1/internal/secp256k1/panic_cb.go | 21 - .../secp256k1/internal/secp256k1/secp256.go | 167 - crypto/keys/secp256k1/keys.pb.go | 499 -- crypto/keys/secp256k1/secp256k1.go | 205 - crypto/keys/secp256k1/secp256k1_cgo.go | 24 - crypto/keys/secp256k1/secp256k1_cgo_test.go | 40 - .../keys/secp256k1/secp256k1_internal_test.go | 46 - crypto/keys/secp256k1/secp256k1_nocgo.go | 70 - crypto/keys/secp256k1/secp256k1_nocgo_test.go | 38 - crypto/keys/secp256k1/secp256k1_test.go | 251 - crypto/types/compact_bit_array.go | 248 - crypto/types/multisig.pb.go | 551 -- crypto/types/multisig/multisignature.go | 90 - crypto/types/multisig/pubkey.go | 28 - crypto/types/types.go | 30 - doc.go | 24 - go.mod | 34 - integration_test/bank_test.go | 185 - integration_test/coinswap_test.go | 64 - integration_test/gov_test.go | 131 - integration_test/htlc_test.go | 77 - integration_test/integration_test.go | 133 - integration_test/nft_test.go | 147 - integration_test/oracle_test.go | 148 - integration_test/random_test.go | 83 - integration_test/record_test.go | 53 - integration_test/scripts/Dockerfile | 10 - integration_test/scripts/build.sh | 1 - integration_test/scripts/clean.sh | 2 - integration_test/scripts/node/config/app.toml | 151 - .../scripts/node/config/config.toml | 392 - .../scripts/node/config/genesis.json | 343 - .../scripts/node/config/node_key.json | 1 - .../node/config/priv_validator_key.json | 11 - .../node/data/priv_validator_state.json | 5 - integration_test/scripts/priv.key | 9 - integration_test/scripts/setup.sh | 1 - integration_test/scripts/start.sh | 1 - integration_test/service_test.go | 167 - integration_test/staking_test.go | 294 - integration_test/token_test.go | 87 - keystore/keys.go | 50 - keystore/keys_test.go | 15 - keystore/keystore.go | 129 - module-sdk/Makefile | 2 +- module-sdk/gov/gov.go | 16 +- module-sdk/htlc/htlc.go | 4 +- .../integration_test/client.go | 67 +- module-sdk/integration_test/coinswap_test.go | 11 +- module-sdk/integration_test/go.mod | 24 +- go.sum => module-sdk/integration_test/go.sum | 105 +- module-sdk/integration_test/gov_test.go | 8 +- module-sdk/integration_test/htlc_test.go | 8 +- .../integration_test/integration_test.go | 17 +- module-sdk/integration_test/nft_test.go | 10 +- module-sdk/integration_test/oracle_test.go | 12 +- module-sdk/integration_test/random_test.go | 7 +- module-sdk/integration_test/record_test.go | 8 +- module-sdk/integration_test/service_test.go | 13 +- module-sdk/integration_test/staking_test.go | 8 +- module-sdk/integration_test/token_test.go | 10 +- module-sdk/keys/export.go | 2 +- module-sdk/keys/go.mod | 13 + module-sdk/keys/keys.go | 2 +- module-sdk/nft/nft.go | 12 +- module-sdk/oracle/go.mod | 4 +- module-sdk/oracle/oracle.go | 6 +- module-sdk/oracle/query.pb.go | 2 +- module-sdk/random/random.go | 4 +- module-sdk/service/service.go | 22 +- module-sdk/staking/staking.go | 28 +- .../github.com/confio/ics23/go/proofs.pb.go | 0 .../gogo/protobuf/gogoproto/gogo.pb.go | 0 .../regen-network/cosmos-proto/cosmos.pb.go | 0 .../third_party}/proto/confio/proofs.proto | 0 .../proto/cosmos_proto/cosmos.proto | 0 .../third_party}/proto/gogoproto/gogo.proto | 0 .../proto/google/api/annotations.proto | 0 .../third_party}/proto/google/api/http.proto | 0 .../proto/google/api/httpbody.proto | 0 .../proto/google/protobuf/any.proto | 0 .../proto/tendermint/abci/types.proto | 0 .../proto/tendermint/crypto/keys.proto | 0 .../proto/tendermint/crypto/proof.proto | 0 .../proto/tendermint/libs/bits/types.proto | 0 .../proto/tendermint/types/evidence.proto | 0 .../proto/tendermint/types/params.proto | 0 .../proto/tendermint/types/types.proto | 0 .../proto/tendermint/types/validator.proto | 0 .../proto/tendermint/version/types.proto | 0 .../third_party}/protocgen.sh | 0 module-sdk/token/token.go | 5 +- modules/account.go | 142 - modules/auth/auth.pb.go | 1048 --- modules/auth/params.go | 11 - modules/auth/query.pb.go | 930 --- modules/auth/types.go | 147 - modules/bank/bank.go | 198 - modules/bank/bank.pb.go | 1887 ----- modules/bank/codec.go | 32 - modules/bank/export.go | 45 - modules/bank/params.go | 23 - modules/bank/query.pb.go | 2220 ------ modules/bank/tx.pb.go | 669 -- modules/bank/types.go | 219 - modules/base_client.go | 465 -- modules/coinswap/codec.go | 27 - modules/coinswap/coinswap.go | 390 - modules/coinswap/coinswap.pb.go | 766 -- modules/coinswap/export.go | 93 - modules/coinswap/genesis.pb.go | 375 - modules/coinswap/query.pb.go | 751 -- modules/coinswap/tx.pb.go | 1756 ----- modules/coinswap/types.go | 164 - modules/gov/codec.go | 25 - modules/gov/content.go | 22 - modules/gov/export.go | 92 - modules/gov/gov.go | 269 - modules/gov/gov.pb.go | 2569 ------- modules/gov/params.go | 33 - modules/gov/proposal.go | 281 - modules/gov/query.pb.go | 3859 ---------- modules/gov/tx.pb.go | 1472 ---- modules/gov/types.go | 292 - modules/grpc_client.go | 17 - modules/htlc/codec.go | 25 - modules/htlc/export.go | 61 - modules/htlc/htlc.go | 111 - modules/htlc/htlc.pb.go | 2417 ------ modules/htlc/query.pb.go | 1668 ---- modules/htlc/tx.pb.go | 1358 ---- modules/htlc/types.go | 141 - modules/keys.go | 164 - modules/keys/doc.go | 17 - modules/keys/export.go | 15 - modules/keys/keys.go | 51 - modules/nft/codec.go | 29 - modules/nft/export.go | 90 - modules/nft/nft.go | 269 - modules/nft/nft.pb.go | 1615 ---- modules/nft/query.pb.go | 2642 ------- modules/nft/tx.pb.go | 2133 ------ modules/nft/types.go | 283 - modules/oracle/codec.go | 26 - modules/oracle/export.go | 72 - modules/oracle/oracle.go | 173 - modules/oracle/oracle.pb.go | 857 --- modules/oracle/query.pb.go | 1958 ----- modules/oracle/tx.pb.go | 2598 ------- modules/oracle/types.go | 334 - modules/random/codec.go | 24 - modules/random/export.go | 39 - modules/random/query.pb.go | 974 --- modules/random/random.go | 108 - modules/random/random.pb.go | 831 -- modules/random/tx.pb.go | 468 -- modules/random/types.go | 76 - modules/record/codec.go | 25 - modules/record/export.go | 35 - modules/record/query.pb.go | 593 -- modules/record/record.go | 87 - modules/record/record.pb.go | 782 -- modules/record/tx.pb.go | 401 - modules/record/types.go | 79 - modules/rpc_client.go | 213 - modules/service/codec.go | 38 - modules/service/doc.go | 106 - modules/service/export.go | 199 - modules/service/params.go | 11 - modules/service/query.go | 197 - modules/service/query.pb.go | 6105 --------------- modules/service/service.go | 748 -- modules/service/service.pb.go | 4440 ----------- modules/service/tx.pb.go | 4609 ----------- modules/service/types.go | 822 -- modules/staking/codec.go | 27 - modules/staking/delegation.go | 383 - modules/staking/export.go | 215 - modules/staking/params.go | 35 - modules/staking/query.pb.go | 6728 ----------------- modules/staking/staking.go | 470 -- modules/staking/staking.pb.go | 6577 ---------------- modules/staking/tx.pb.go | 2751 ------- modules/staking/types.go | 517 -- modules/token.go | 100 - modules/token/codec.go | 29 - modules/token/export.go | 50 - modules/token/params.go | 16 - modules/token/query.pb.go | 1880 ----- modules/token/token.go | 192 - modules/token/token.pb.go | 873 --- modules/token/tx.pb.go | 1436 ---- modules/token/types.go | 317 - modules/tx.go | 253 - types/abci.pb.go | 3084 -------- types/account.go | 10 - types/address.go | 352 - types/address_test.go | 25 - types/block.go | 131 - types/client.go | 74 - types/codec.go | 15 - types/coin.go | 681 -- types/coin.pb.go | 978 --- types/coin_type.go | 88 - types/config.go | 228 - types/dec.go | 797 -- types/dec_coin.go | 644 -- types/env.go | 73 - types/errors.go | 218 - types/event.go | 231 - types/events.go | 263 - types/handler_map.go | 58 - types/int.go | 429 -- types/kv/kv.pb.go | 558 -- types/module.go | 33 - types/proof.go | 13 - types/pubkey.go | 106 - types/query/pagination.pb.go | 674 -- types/result.go | 265 - types/sign_mode_handler.go | 36 - types/stdtx.go | 236 - types/store/aes.go | 64 - types/store/codec.go | 31 - types/store/file.go | 194 - types/store/level_db.go | 118 - types/store/memory.go | 40 - types/store/types.go | 107 - types/tm_types.go | 47 - types/token.go | 37 - types/tx/builder.go | 351 - types/tx/config.go | 65 - types/tx/decoder.go | 79 - types/tx/direct.go | 52 - types/tx/encoder.go | 46 - types/tx/mode_handler.go | 40 - types/tx/signing/signature.go | 100 - types/tx/signing/signature_data.go | 36 - types/tx/signing/signing.pb.go | 1453 ---- types/tx/sigs.go | 149 - types/tx/tx.pb.go | 3108 -------- types/tx/types.go | 120 - types/tx_config.go | 44 - types/tx_msg.go | 87 - types/utils.go | 75 - utils/bech32/bech32.go | 49 - utils/cache/cache.go | 70 - utils/commom.go | 58 - utils/common_test.go | 25 - utils/log/logger.go | 113 - utils/log/logger_test.go | 17 - utils/log/type.go | 16 - utils/uuid/codec.go | 186 - utils/uuid/generator.go | 245 - utils/uuid/uuid.go | 138 - 383 files changed, 208 insertions(+), 135882 deletions(-) delete mode 100644 client/grpc/reflection/reflection.pb.go delete mode 100644 client/tx/factory.go delete mode 100644 client/tx/tx.go delete mode 100644 codec/amino.go delete mode 100644 codec/amino_codec.go delete mode 100644 codec/any.go delete mode 100644 codec/codec.go delete mode 100644 codec/json.go delete mode 100644 codec/legacy/codec.go delete mode 100644 codec/legacy/doc.go delete mode 100644 codec/proto_codec.go delete mode 100644 codec/types/any.go delete mode 100644 codec/types/any.pb.go delete mode 100644 codec/types/compat.go delete mode 100644 codec/types/doc.go delete mode 100644 codec/types/interface_registry.go delete mode 100644 codec/unknownproto/doc.go delete mode 100644 codec/unknownproto/unknown_fields.go delete mode 100644 crypto/armor.go delete mode 100644 crypto/codec/amino.go delete mode 100644 crypto/codec/proto.go delete mode 100644 crypto/hd/algo.go delete mode 100644 crypto/hd/hdpath.go delete mode 100644 crypto/key_manager.go delete mode 100644 crypto/key_manager_test.go delete mode 100644 crypto/keys/ed25519/ed25519.go delete mode 100644 crypto/keys/ed25519/ed25519_test.go delete mode 100644 crypto/keys/ed25519/keys.pb.go delete mode 100644 crypto/keys/internal/benchmarking/bench.go delete mode 100644 crypto/keys/multisig/codec.go delete mode 100644 crypto/keys/multisig/keys.pb.go delete mode 100644 crypto/keys/multisig/multisig.go delete mode 100644 crypto/keys/secp256k1/bench_test.go delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/.gitignore delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/LICENSE delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/README.md delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/curve.go delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/ext.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO delete mode 100755 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/obj/.gitignore delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include delete mode 100755 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h delete mode 100755 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/panic_cb.go delete mode 100644 crypto/keys/secp256k1/internal/secp256k1/secp256.go delete mode 100644 crypto/keys/secp256k1/keys.pb.go delete mode 100644 crypto/keys/secp256k1/secp256k1.go delete mode 100644 crypto/keys/secp256k1/secp256k1_cgo.go delete mode 100644 crypto/keys/secp256k1/secp256k1_cgo_test.go delete mode 100644 crypto/keys/secp256k1/secp256k1_internal_test.go delete mode 100644 crypto/keys/secp256k1/secp256k1_nocgo.go delete mode 100644 crypto/keys/secp256k1/secp256k1_nocgo_test.go delete mode 100644 crypto/keys/secp256k1/secp256k1_test.go delete mode 100644 crypto/types/compact_bit_array.go delete mode 100644 crypto/types/multisig.pb.go delete mode 100644 crypto/types/multisig/multisignature.go delete mode 100644 crypto/types/multisig/pubkey.go delete mode 100644 crypto/types/types.go delete mode 100644 doc.go delete mode 100644 go.mod delete mode 100644 integration_test/bank_test.go delete mode 100644 integration_test/coinswap_test.go delete mode 100644 integration_test/gov_test.go delete mode 100644 integration_test/htlc_test.go delete mode 100644 integration_test/integration_test.go delete mode 100644 integration_test/nft_test.go delete mode 100644 integration_test/oracle_test.go delete mode 100644 integration_test/random_test.go delete mode 100644 integration_test/record_test.go delete mode 100644 integration_test/scripts/Dockerfile delete mode 100755 integration_test/scripts/build.sh delete mode 100755 integration_test/scripts/clean.sh delete mode 100644 integration_test/scripts/node/config/app.toml delete mode 100644 integration_test/scripts/node/config/config.toml delete mode 100644 integration_test/scripts/node/config/genesis.json delete mode 100644 integration_test/scripts/node/config/node_key.json delete mode 100644 integration_test/scripts/node/config/priv_validator_key.json delete mode 100644 integration_test/scripts/node/data/priv_validator_state.json delete mode 100644 integration_test/scripts/priv.key delete mode 100755 integration_test/scripts/setup.sh delete mode 100755 integration_test/scripts/start.sh delete mode 100644 integration_test/service_test.go delete mode 100644 integration_test/staking_test.go delete mode 100644 integration_test/token_test.go delete mode 100644 keystore/keys.go delete mode 100644 keystore/keys_test.go delete mode 100644 keystore/keystore.go rename client.go => module-sdk/integration_test/client.go (69%) rename go.sum => module-sdk/integration_test/go.sum (88%) create mode 100644 module-sdk/keys/go.mod rename {third_party => module-sdk/third_party}/github.com/confio/ics23/go/proofs.pb.go (100%) rename {third_party => module-sdk/third_party}/github.com/gogo/protobuf/gogoproto/gogo.pb.go (100%) rename {third_party => module-sdk/third_party}/github.com/regen-network/cosmos-proto/cosmos.pb.go (100%) rename {third_party => module-sdk/third_party}/proto/confio/proofs.proto (100%) rename {third_party => module-sdk/third_party}/proto/cosmos_proto/cosmos.proto (100%) rename {third_party => module-sdk/third_party}/proto/gogoproto/gogo.proto (100%) rename {third_party => module-sdk/third_party}/proto/google/api/annotations.proto (100%) rename {third_party => module-sdk/third_party}/proto/google/api/http.proto (100%) rename {third_party => module-sdk/third_party}/proto/google/api/httpbody.proto (100%) rename {third_party => module-sdk/third_party}/proto/google/protobuf/any.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/abci/types.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/crypto/keys.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/crypto/proof.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/libs/bits/types.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/types/evidence.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/types/params.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/types/types.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/types/validator.proto (100%) rename {third_party => module-sdk/third_party}/proto/tendermint/version/types.proto (100%) rename {third_party => module-sdk/third_party}/protocgen.sh (100%) delete mode 100644 modules/account.go delete mode 100644 modules/auth/auth.pb.go delete mode 100644 modules/auth/params.go delete mode 100644 modules/auth/query.pb.go delete mode 100644 modules/auth/types.go delete mode 100644 modules/bank/bank.go delete mode 100644 modules/bank/bank.pb.go delete mode 100644 modules/bank/codec.go delete mode 100644 modules/bank/export.go delete mode 100644 modules/bank/params.go delete mode 100644 modules/bank/query.pb.go delete mode 100644 modules/bank/tx.pb.go delete mode 100644 modules/bank/types.go delete mode 100644 modules/base_client.go delete mode 100644 modules/coinswap/codec.go delete mode 100644 modules/coinswap/coinswap.go delete mode 100644 modules/coinswap/coinswap.pb.go delete mode 100644 modules/coinswap/export.go delete mode 100644 modules/coinswap/genesis.pb.go delete mode 100644 modules/coinswap/query.pb.go delete mode 100644 modules/coinswap/tx.pb.go delete mode 100644 modules/coinswap/types.go delete mode 100644 modules/gov/codec.go delete mode 100644 modules/gov/content.go delete mode 100644 modules/gov/export.go delete mode 100644 modules/gov/gov.go delete mode 100644 modules/gov/gov.pb.go delete mode 100644 modules/gov/params.go delete mode 100644 modules/gov/proposal.go delete mode 100644 modules/gov/query.pb.go delete mode 100644 modules/gov/tx.pb.go delete mode 100644 modules/gov/types.go delete mode 100644 modules/grpc_client.go delete mode 100644 modules/htlc/codec.go delete mode 100644 modules/htlc/export.go delete mode 100644 modules/htlc/htlc.go delete mode 100644 modules/htlc/htlc.pb.go delete mode 100644 modules/htlc/query.pb.go delete mode 100644 modules/htlc/tx.pb.go delete mode 100644 modules/htlc/types.go delete mode 100644 modules/keys.go delete mode 100644 modules/keys/doc.go delete mode 100644 modules/keys/export.go delete mode 100644 modules/keys/keys.go delete mode 100644 modules/nft/codec.go delete mode 100644 modules/nft/export.go delete mode 100644 modules/nft/nft.go delete mode 100644 modules/nft/nft.pb.go delete mode 100644 modules/nft/query.pb.go delete mode 100644 modules/nft/tx.pb.go delete mode 100644 modules/nft/types.go delete mode 100644 modules/oracle/codec.go delete mode 100644 modules/oracle/export.go delete mode 100644 modules/oracle/oracle.go delete mode 100644 modules/oracle/oracle.pb.go delete mode 100644 modules/oracle/query.pb.go delete mode 100644 modules/oracle/tx.pb.go delete mode 100644 modules/oracle/types.go delete mode 100644 modules/random/codec.go delete mode 100644 modules/random/export.go delete mode 100644 modules/random/query.pb.go delete mode 100644 modules/random/random.go delete mode 100644 modules/random/random.pb.go delete mode 100644 modules/random/tx.pb.go delete mode 100644 modules/random/types.go delete mode 100644 modules/record/codec.go delete mode 100644 modules/record/export.go delete mode 100644 modules/record/query.pb.go delete mode 100644 modules/record/record.go delete mode 100644 modules/record/record.pb.go delete mode 100644 modules/record/tx.pb.go delete mode 100644 modules/record/types.go delete mode 100644 modules/rpc_client.go delete mode 100644 modules/service/codec.go delete mode 100644 modules/service/doc.go delete mode 100644 modules/service/export.go delete mode 100644 modules/service/params.go delete mode 100644 modules/service/query.go delete mode 100644 modules/service/query.pb.go delete mode 100644 modules/service/service.go delete mode 100644 modules/service/service.pb.go delete mode 100644 modules/service/tx.pb.go delete mode 100644 modules/service/types.go delete mode 100644 modules/staking/codec.go delete mode 100644 modules/staking/delegation.go delete mode 100644 modules/staking/export.go delete mode 100644 modules/staking/params.go delete mode 100644 modules/staking/query.pb.go delete mode 100644 modules/staking/staking.go delete mode 100644 modules/staking/staking.pb.go delete mode 100644 modules/staking/tx.pb.go delete mode 100644 modules/staking/types.go delete mode 100644 modules/token.go delete mode 100644 modules/token/codec.go delete mode 100644 modules/token/export.go delete mode 100644 modules/token/params.go delete mode 100644 modules/token/query.pb.go delete mode 100644 modules/token/token.go delete mode 100644 modules/token/token.pb.go delete mode 100644 modules/token/tx.pb.go delete mode 100644 modules/token/types.go delete mode 100644 modules/tx.go delete mode 100644 types/abci.pb.go delete mode 100644 types/account.go delete mode 100644 types/address.go delete mode 100644 types/address_test.go delete mode 100644 types/block.go delete mode 100644 types/client.go delete mode 100644 types/codec.go delete mode 100644 types/coin.go delete mode 100644 types/coin.pb.go delete mode 100644 types/coin_type.go delete mode 100644 types/config.go delete mode 100644 types/dec.go delete mode 100644 types/dec_coin.go delete mode 100644 types/env.go delete mode 100644 types/errors.go delete mode 100644 types/event.go delete mode 100644 types/events.go delete mode 100644 types/handler_map.go delete mode 100644 types/int.go delete mode 100644 types/kv/kv.pb.go delete mode 100644 types/module.go delete mode 100644 types/proof.go delete mode 100644 types/pubkey.go delete mode 100644 types/query/pagination.pb.go delete mode 100644 types/result.go delete mode 100644 types/sign_mode_handler.go delete mode 100644 types/stdtx.go delete mode 100644 types/store/aes.go delete mode 100644 types/store/codec.go delete mode 100644 types/store/file.go delete mode 100644 types/store/level_db.go delete mode 100644 types/store/memory.go delete mode 100644 types/store/types.go delete mode 100644 types/tm_types.go delete mode 100644 types/token.go delete mode 100644 types/tx/builder.go delete mode 100644 types/tx/config.go delete mode 100644 types/tx/decoder.go delete mode 100644 types/tx/direct.go delete mode 100644 types/tx/encoder.go delete mode 100644 types/tx/mode_handler.go delete mode 100644 types/tx/signing/signature.go delete mode 100644 types/tx/signing/signature_data.go delete mode 100644 types/tx/signing/signing.pb.go delete mode 100644 types/tx/sigs.go delete mode 100644 types/tx/tx.pb.go delete mode 100644 types/tx/types.go delete mode 100644 types/tx_config.go delete mode 100644 types/tx_msg.go delete mode 100644 types/utils.go delete mode 100644 utils/bech32/bech32.go delete mode 100644 utils/cache/cache.go delete mode 100644 utils/commom.go delete mode 100644 utils/common_test.go delete mode 100644 utils/log/logger.go delete mode 100644 utils/log/logger_test.go delete mode 100644 utils/log/type.go delete mode 100644 utils/uuid/codec.go delete mode 100644 utils/uuid/generator.go delete mode 100644 utils/uuid/uuid.go diff --git a/client/grpc/reflection/reflection.pb.go b/client/grpc/reflection/reflection.pb.go deleted file mode 100644 index 78434664..00000000 --- a/client/grpc/reflection/reflection.pb.go +++ /dev/null @@ -1,947 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/reflection/v1beta1/reflection.proto - -package reflection - -import ( - context "context" - fmt "fmt" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/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 - -// ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. -type ListAllInterfacesRequest struct { -} - -func (m *ListAllInterfacesRequest) Reset() { *m = ListAllInterfacesRequest{} } -func (m *ListAllInterfacesRequest) String() string { return proto.CompactTextString(m) } -func (*ListAllInterfacesRequest) ProtoMessage() {} -func (*ListAllInterfacesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d48c054165687f5c, []int{0} -} -func (m *ListAllInterfacesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListAllInterfacesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListAllInterfacesRequest.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 *ListAllInterfacesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListAllInterfacesRequest.Merge(m, src) -} -func (m *ListAllInterfacesRequest) XXX_Size() int { - return m.Size() -} -func (m *ListAllInterfacesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListAllInterfacesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListAllInterfacesRequest proto.InternalMessageInfo - -// ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. -type ListAllInterfacesResponse struct { - // interface_names is an array of all the registered interfaces. - InterfaceNames []string `protobuf:"bytes,1,rep,name=interface_names,json=interfaceNames,proto3" json:"interface_names,omitempty"` -} - -func (m *ListAllInterfacesResponse) Reset() { *m = ListAllInterfacesResponse{} } -func (m *ListAllInterfacesResponse) String() string { return proto.CompactTextString(m) } -func (*ListAllInterfacesResponse) ProtoMessage() {} -func (*ListAllInterfacesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d48c054165687f5c, []int{1} -} -func (m *ListAllInterfacesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListAllInterfacesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListAllInterfacesResponse.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 *ListAllInterfacesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListAllInterfacesResponse.Merge(m, src) -} -func (m *ListAllInterfacesResponse) XXX_Size() int { - return m.Size() -} -func (m *ListAllInterfacesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListAllInterfacesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListAllInterfacesResponse proto.InternalMessageInfo - -func (m *ListAllInterfacesResponse) GetInterfaceNames() []string { - if m != nil { - return m.InterfaceNames - } - return nil -} - -// ListImplementationsRequest is the request type of the ListImplementations RPC. -type ListImplementationsRequest struct { - // interface_name defines the interface to query the implementations for. - InterfaceName string `protobuf:"bytes,1,opt,name=interface_name,json=interfaceName,proto3" json:"interface_name,omitempty"` -} - -func (m *ListImplementationsRequest) Reset() { *m = ListImplementationsRequest{} } -func (m *ListImplementationsRequest) String() string { return proto.CompactTextString(m) } -func (*ListImplementationsRequest) ProtoMessage() {} -func (*ListImplementationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d48c054165687f5c, []int{2} -} -func (m *ListImplementationsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListImplementationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListImplementationsRequest.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 *ListImplementationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListImplementationsRequest.Merge(m, src) -} -func (m *ListImplementationsRequest) XXX_Size() int { - return m.Size() -} -func (m *ListImplementationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ListImplementationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ListImplementationsRequest proto.InternalMessageInfo - -func (m *ListImplementationsRequest) GetInterfaceName() string { - if m != nil { - return m.InterfaceName - } - return "" -} - -// ListImplementationsResponse is the response type of the ListImplementations RPC. -type ListImplementationsResponse struct { - ImplementationMessageNames []string `protobuf:"bytes,1,rep,name=implementation_message_names,json=implementationMessageNames,proto3" json:"implementation_message_names,omitempty"` -} - -func (m *ListImplementationsResponse) Reset() { *m = ListImplementationsResponse{} } -func (m *ListImplementationsResponse) String() string { return proto.CompactTextString(m) } -func (*ListImplementationsResponse) ProtoMessage() {} -func (*ListImplementationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d48c054165687f5c, []int{3} -} -func (m *ListImplementationsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ListImplementationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ListImplementationsResponse.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 *ListImplementationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ListImplementationsResponse.Merge(m, src) -} -func (m *ListImplementationsResponse) XXX_Size() int { - return m.Size() -} -func (m *ListImplementationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ListImplementationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ListImplementationsResponse proto.InternalMessageInfo - -func (m *ListImplementationsResponse) GetImplementationMessageNames() []string { - if m != nil { - return m.ImplementationMessageNames - } - return nil -} - -func init() { - proto.RegisterType((*ListAllInterfacesRequest)(nil), "cosmos.base.reflection.v1beta1.ListAllInterfacesRequest") - proto.RegisterType((*ListAllInterfacesResponse)(nil), "cosmos.base.reflection.v1beta1.ListAllInterfacesResponse") - proto.RegisterType((*ListImplementationsRequest)(nil), "cosmos.base.reflection.v1beta1.ListImplementationsRequest") - proto.RegisterType((*ListImplementationsResponse)(nil), "cosmos.base.reflection.v1beta1.ListImplementationsResponse") -} - -func init() { - proto.RegisterFile("cosmos/base/reflection/v1beta1/reflection.proto", fileDescriptor_d48c054165687f5c) -} - -var fileDescriptor_d48c054165687f5c = []byte{ - // 406 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xbd, 0x6e, 0xdb, 0x30, - 0x18, 0x34, 0x6b, 0xa0, 0x80, 0x09, 0xd4, 0x85, 0xd9, 0xc5, 0x55, 0x0d, 0xc1, 0x10, 0x50, 0xd4, - 0x28, 0x6a, 0x11, 0x76, 0x17, 0xb7, 0x5d, 0xfa, 0xb7, 0x18, 0xad, 0x3b, 0xc8, 0x5b, 0x17, 0x83, - 0x52, 0x3f, 0xab, 0x6c, 0x25, 0x52, 0x11, 0x69, 0x2f, 0x41, 0x96, 0x3c, 0x41, 0x80, 0xbc, 0x4c, - 0x86, 0x3c, 0x40, 0x46, 0x03, 0x59, 0x32, 0x06, 0x56, 0x1e, 0x24, 0x90, 0xa5, 0x38, 0x16, 0xa2, - 0x24, 0x86, 0xd7, 0xef, 0x78, 0xc7, 0xbb, 0xe3, 0x47, 0x4c, 0x3d, 0xa9, 0x42, 0xa9, 0xa8, 0xcb, - 0x14, 0xd0, 0x18, 0xa6, 0x01, 0x78, 0x9a, 0x4b, 0x41, 0xe7, 0x3d, 0x17, 0x34, 0xeb, 0x6d, 0x8c, - 0xec, 0x28, 0x96, 0x5a, 0x12, 0x33, 0x23, 0xd8, 0x29, 0xc1, 0xde, 0x40, 0x73, 0x82, 0xd1, 0xf2, - 0xa5, 0xf4, 0x03, 0xa0, 0x2c, 0xe2, 0x94, 0x09, 0x21, 0x35, 0x4b, 0x61, 0x95, 0xb1, 0x2d, 0x03, - 0x37, 0x7f, 0x72, 0xa5, 0xbf, 0x04, 0xc1, 0x50, 0x68, 0x88, 0xa7, 0xcc, 0x03, 0xe5, 0xc0, 0xde, - 0x0c, 0x94, 0xb6, 0xbe, 0xe3, 0x97, 0x25, 0x98, 0x8a, 0xa4, 0x50, 0x40, 0xde, 0xe0, 0xe7, 0xfc, - 0x66, 0x3a, 0x11, 0x2c, 0x04, 0xd5, 0x44, 0xed, 0x6a, 0xa7, 0xe6, 0xd4, 0xd7, 0xe3, 0x5f, 0xe9, - 0xd4, 0xfa, 0x86, 0x8d, 0x54, 0x65, 0x18, 0x46, 0x01, 0x84, 0x20, 0xf2, 0xeb, 0xf3, 0x3b, 0xc8, - 0x6b, 0x5c, 0x2f, 0xca, 0x34, 0x51, 0x1b, 0x75, 0x6a, 0xce, 0xb3, 0x82, 0x8a, 0x35, 0xc1, 0xaf, - 0x4a, 0x45, 0x72, 0x33, 0x9f, 0x71, 0x8b, 0x17, 0xa0, 0x49, 0x08, 0x4a, 0x31, 0xbf, 0xe8, 0xcc, - 0x28, 0x9e, 0x19, 0x65, 0x47, 0x56, 0x2e, 0xfb, 0x27, 0x55, 0xdc, 0x70, 0xd6, 0xe5, 0x8d, 0x21, - 0x9e, 0x73, 0x0f, 0xc8, 0x29, 0xc2, 0x8d, 0x3b, 0x15, 0x90, 0x81, 0xfd, 0x70, 0xe5, 0xf6, 0x7d, - 0x8d, 0x1a, 0x1f, 0x76, 0x60, 0x66, 0x11, 0xad, 0xfe, 0xe1, 0xf9, 0xd5, 0xf1, 0x93, 0x77, 0xe4, - 0xed, 0x63, 0x0b, 0xc2, 0x6f, 0x8d, 0x26, 0x08, 0xbf, 0x28, 0xa9, 0x8d, 0x7c, 0xdc, 0xc6, 0x46, - 0xf9, 0x83, 0x19, 0x9f, 0x76, 0xe2, 0xe6, 0x21, 0xc6, 0xab, 0x10, 0x23, 0xf2, 0x63, 0xfb, 0x10, - 0x74, 0xbf, 0xb8, 0x1f, 0x07, 0xb4, 0xf8, 0x8a, 0xea, 0xab, 0x73, 0xb6, 0x34, 0xd1, 0x62, 0x69, - 0xa2, 0xcb, 0xa5, 0x89, 0x8e, 0x12, 0xb3, 0xb2, 0x48, 0xcc, 0xca, 0x45, 0x62, 0x56, 0x7e, 0x0f, - 0x7c, 0xae, 0xff, 0xce, 0x5c, 0xdb, 0x93, 0x21, 0x75, 0x39, 0x13, 0xff, 0x38, 0x30, 0x4e, 0x79, - 0xcc, 0x35, 0xeb, 0xaa, 0x3f, 0xff, 0xbb, 0xbe, 0xa4, 0x5e, 0xc0, 0x41, 0x68, 0xea, 0xc7, 0x91, - 0xb7, 0xe1, 0xc3, 0x7d, 0xba, 0xfa, 0x1d, 0xef, 0xaf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xab, 0xf1, - 0x52, 0x13, 0x8e, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// ReflectionServiceClient is the client API for ReflectionService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ReflectionServiceClient interface { - // ListAllInterfaces lists all the interfaces registered in the interface - // registry. - ListAllInterfaces(ctx context.Context, in *ListAllInterfacesRequest, opts ...grpc.CallOption) (*ListAllInterfacesResponse, error) - // ListImplementations list all the concrete types that implement a given - // interface. - ListImplementations(ctx context.Context, in *ListImplementationsRequest, opts ...grpc.CallOption) (*ListImplementationsResponse, error) -} - -type reflectionServiceClient struct { - cc grpc1.ClientConn -} - -func NewReflectionServiceClient(cc grpc1.ClientConn) ReflectionServiceClient { - return &reflectionServiceClient{cc} -} - -func (c *reflectionServiceClient) ListAllInterfaces(ctx context.Context, in *ListAllInterfacesRequest, opts ...grpc.CallOption) (*ListAllInterfacesResponse, error) { - out := new(ListAllInterfacesResponse) - err := c.cc.Invoke(ctx, "/cosmos.base.reflection.v1beta1.ReflectionService/ListAllInterfaces", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *reflectionServiceClient) ListImplementations(ctx context.Context, in *ListImplementationsRequest, opts ...grpc.CallOption) (*ListImplementationsResponse, error) { - out := new(ListImplementationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.base.reflection.v1beta1.ReflectionService/ListImplementations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ReflectionServiceServer is the server API for ReflectionService service. -type ReflectionServiceServer interface { - // ListAllInterfaces lists all the interfaces registered in the interface - // registry. - ListAllInterfaces(context.Context, *ListAllInterfacesRequest) (*ListAllInterfacesResponse, error) - // ListImplementations list all the concrete types that implement a given - // interface. - ListImplementations(context.Context, *ListImplementationsRequest) (*ListImplementationsResponse, error) -} - -// UnimplementedReflectionServiceServer can be embedded to have forward compatible implementations. -type UnimplementedReflectionServiceServer struct { -} - -func (*UnimplementedReflectionServiceServer) ListAllInterfaces(ctx context.Context, req *ListAllInterfacesRequest) (*ListAllInterfacesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListAllInterfaces not implemented") -} -func (*UnimplementedReflectionServiceServer) ListImplementations(ctx context.Context, req *ListImplementationsRequest) (*ListImplementationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListImplementations not implemented") -} - -func RegisterReflectionServiceServer(s grpc1.Server, srv ReflectionServiceServer) { - s.RegisterService(&_ReflectionService_serviceDesc, srv) -} - -func _ReflectionService_ListAllInterfaces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListAllInterfacesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReflectionServiceServer).ListAllInterfaces(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.base.reflection.v1beta1.ReflectionService/ListAllInterfaces", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReflectionServiceServer).ListAllInterfaces(ctx, req.(*ListAllInterfacesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReflectionService_ListImplementations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListImplementationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReflectionServiceServer).ListImplementations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.base.reflection.v1beta1.ReflectionService/ListImplementations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReflectionServiceServer).ListImplementations(ctx, req.(*ListImplementationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _ReflectionService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.base.reflection.v1beta1.ReflectionService", - HandlerType: (*ReflectionServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListAllInterfaces", - Handler: _ReflectionService_ListAllInterfaces_Handler, - }, - { - MethodName: "ListImplementations", - Handler: _ReflectionService_ListImplementations_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/base/reflection/v1beta1/reflection.proto", -} - -func (m *ListAllInterfacesRequest) 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 *ListAllInterfacesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListAllInterfacesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ListAllInterfacesResponse) 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 *ListAllInterfacesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListAllInterfacesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.InterfaceNames) > 0 { - for iNdEx := len(m.InterfaceNames) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.InterfaceNames[iNdEx]) - copy(dAtA[i:], m.InterfaceNames[iNdEx]) - i = encodeVarintReflection(dAtA, i, uint64(len(m.InterfaceNames[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ListImplementationsRequest) 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 *ListImplementationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListImplementationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.InterfaceName) > 0 { - i -= len(m.InterfaceName) - copy(dAtA[i:], m.InterfaceName) - i = encodeVarintReflection(dAtA, i, uint64(len(m.InterfaceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListImplementationsResponse) 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 *ListImplementationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ListImplementationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ImplementationMessageNames) > 0 { - for iNdEx := len(m.ImplementationMessageNames) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ImplementationMessageNames[iNdEx]) - copy(dAtA[i:], m.ImplementationMessageNames[iNdEx]) - i = encodeVarintReflection(dAtA, i, uint64(len(m.ImplementationMessageNames[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintReflection(dAtA []byte, offset int, v uint64) int { - offset -= sovReflection(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ListAllInterfacesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ListAllInterfacesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.InterfaceNames) > 0 { - for _, s := range m.InterfaceNames { - l = len(s) - n += 1 + l + sovReflection(uint64(l)) - } - } - return n -} - -func (m *ListImplementationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.InterfaceName) - if l > 0 { - n += 1 + l + sovReflection(uint64(l)) - } - return n -} - -func (m *ListImplementationsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ImplementationMessageNames) > 0 { - for _, s := range m.ImplementationMessageNames { - l = len(s) - n += 1 + l + sovReflection(uint64(l)) - } - } - return n -} - -func sovReflection(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozReflection(x uint64) (n int) { - return sovReflection(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ListAllInterfacesRequest) 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 ErrIntOverflowReflection - } - 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: ListAllInterfacesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListAllInterfacesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipReflection(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListAllInterfacesResponse) 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 ErrIntOverflowReflection - } - 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: ListAllInterfacesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListAllInterfacesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InterfaceNames", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowReflection - } - 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 ErrInvalidLengthReflection - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthReflection - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InterfaceNames = append(m.InterfaceNames, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipReflection(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListImplementationsRequest) 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 ErrIntOverflowReflection - } - 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: ListImplementationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListImplementationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InterfaceName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowReflection - } - 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 ErrInvalidLengthReflection - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthReflection - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InterfaceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipReflection(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListImplementationsResponse) 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 ErrIntOverflowReflection - } - 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: ListImplementationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListImplementationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ImplementationMessageNames", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowReflection - } - 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 ErrInvalidLengthReflection - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthReflection - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ImplementationMessageNames = append(m.ImplementationMessageNames, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipReflection(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthReflection - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipReflection(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, ErrIntOverflowReflection - } - 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, ErrIntOverflowReflection - } - 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, ErrIntOverflowReflection - } - 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, ErrInvalidLengthReflection - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupReflection - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthReflection - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthReflection = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowReflection = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupReflection = fmt.Errorf("proto: unexpected end of group") -) diff --git a/client/tx/factory.go b/client/tx/factory.go deleted file mode 100644 index 7f539c1f..00000000 --- a/client/tx/factory.go +++ /dev/null @@ -1,300 +0,0 @@ -package tx - -import ( - "errors" - "fmt" - - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// Factory defines a client transaction factory that facilitates generating and -// signing an application-specific transaction. -type ( - // Factory implements a transaction context created in SDK modules. - Factory struct { - address string - chainID string - memo string - password string - accountNumber uint64 - sequence uint64 - gas uint64 - gasAdjustment float64 - simulateAndExecute bool - fees sdk.Coins - gasPrices sdk.DecCoins - mode sdk.BroadcastMode - signMode signing.SignMode - signModeHandler sdk.SignModeHandler - keyManager sdk.KeyManager - txConfig sdk.TxConfig - queryFunc QueryWithData - } - - // QueryWithData implements a query method from cschain. - QueryWithData func(string, []byte) ([]byte, int64, error) -) - -// NewFactory return a point of the instance of Factory. -func NewFactory() *Factory { - return &Factory{} -} - -// ChainID returns the chainID of the current chain. -func (f *Factory) ChainID() string { return f.chainID } - -// Gas returns the gas of the transaction. -func (f *Factory) Gas() uint64 { return f.gas } - -// GasAdjustment returns the gasAdjustment. -func (f Factory) GasAdjustment() float64 { return f.gasAdjustment } - -// Fees returns the fee of the transaction. -func (f *Factory) Fees() sdk.Coins { return f.fees } - -// Sequence returns the sequence of the account. -func (f *Factory) Sequence() uint64 { return f.sequence } - -// Memo returns memo. -func (f *Factory) Memo() string { return f.memo } - -// AccountNumber returns accountNumber. -func (f *Factory) AccountNumber() uint64 { return f.accountNumber } - -// KeyManager returns keyManager. -func (f *Factory) KeyManager() sdk.KeyManager { return f.keyManager } - -// Mode returns mode. -func (f *Factory) Mode() sdk.BroadcastMode { return f.mode } - -// SimulateAndExecute returns the option to simulateAndExecute and then execute the transaction -// using the gas from the simulation results -func (f *Factory) SimulateAndExecute() bool { return f.simulateAndExecute } - -// Password returns password. -func (f *Factory) Password() string { return f.password } - -// Address returns the address. -func (f *Factory) Address() string { return f.address } - -// WithChainID returns a pointer of the context with an updated ChainID. -func (f *Factory) WithChainID(chainID string) *Factory { - f.chainID = chainID - return f -} - -// WithGas returns a pointer of the context with an updated Gas. -func (f *Factory) WithGas(gas uint64) *Factory { - f.gas = gas - return f -} - -// WithGasAdjustment returns a pointer of the context with an updated gasAdjustment. -func (f *Factory) WithGasAdjustment(gasAdjustment float64) *Factory { - f.gasAdjustment = gasAdjustment - return f -} - -// WithFee returns a pointer of the context with an updated Fee. -func (f *Factory) WithFee(fee sdk.Coins) *Factory { - f.fees = fee - return f -} - -// WithSequence returns a pointer of the context with an updated sequence number. -func (f *Factory) WithSequence(sequence uint64) *Factory { - f.sequence = sequence - return f -} - -// WithMemo returns a pointer of the context with an updated memo. -func (f *Factory) WithMemo(memo string) *Factory { - f.memo = memo - return f -} - -// WithAccountNumber returns a pointer of the context with an account number. -func (f *Factory) WithAccountNumber(accnum uint64) *Factory { - f.accountNumber = accnum - return f -} - -// WithKeyManager returns a pointer of the context with a KeyManager. -func (f *Factory) WithKeyManager(keyManager sdk.KeyManager) *Factory { - f.keyManager = keyManager - return f -} - -// WithMode returns a pointer of the context with a Mode. -func (f *Factory) WithMode(mode sdk.BroadcastMode) *Factory { - f.mode = mode - return f -} - -// WithSimulateAndExecute returns a pointer of the context with a simulateAndExecute. -func (f *Factory) WithSimulateAndExecute(simulate bool) *Factory { - f.simulateAndExecute = simulate - return f -} - -// WithPassword returns a pointer of the context with a password. -func (f *Factory) WithPassword(password string) *Factory { - f.password = password - return f -} - -// WithAddress returns a pointer of the context with a password. -func (f *Factory) WithAddress(address string) *Factory { - f.address = address - return f -} - -// WithTxConfig returns a pointer of the context with an TxConfig -func (f *Factory) WithTxConfig(txConfig sdk.TxConfig) *Factory { - f.txConfig = txConfig - return f -} - -// WithSignModeHandler returns a pointer of the context with an signModeHandler. -func (f *Factory) WithSignModeHandler(signModeHandler sdk.SignModeHandler) *Factory { - f.signModeHandler = signModeHandler - return f -} - -// WithQueryFunc returns a pointer of the context with an queryFunc. -func (f *Factory) WithQueryFunc(queryFunc QueryWithData) *Factory { - f.queryFunc = queryFunc - return f -} - -func (f *Factory) BuildAndSign(name string, msgs []sdk.Msg, json bool) ([]byte, error) { - tx, err := f.BuildUnsignedTx(msgs) - if err != nil { - return nil, err - } - - if err = f.Sign(name, tx); err != nil { - return nil, err - } - - if json { - txBytes, err := f.txConfig.TxJSONEncoder()(tx.GetTx()) - if err != nil { - return nil, err - } - return txBytes, nil - } - - txBytes, err := f.txConfig.TxEncoder()(tx.GetTx()) - if err != nil { - return nil, err - } - - return txBytes, nil -} - -func (f *Factory) BuildUnsignedTx(msgs []sdk.Msg) (sdk.TxBuilder, error) { - if f.chainID == "" { - return nil, fmt.Errorf("chain ID required but not specified") - } - - fees := f.fees - - if !f.gasPrices.IsZero() { - if !fees.IsZero() { - return nil, errors.New("cannot provide both fees and gas prices") - } - - glDec := sdk.NewDec(int64(f.gas)) - - // Derive the fees based on the provided gas prices, where - // fee = ceil(gasPrice * gasLimit). - fees = make(sdk.Coins, len(f.gasPrices)) - - for i, gp := range f.gasPrices { - fee := gp.Amount.Mul(glDec) - fees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt()) - } - } - - tx := f.txConfig.NewTxBuilder() - - if err := tx.SetMsgs(msgs...); err != nil { - return nil, err - } - - tx.SetMemo(f.memo) - tx.SetFeeAmount(fees) - tx.SetGasLimit(f.gas) - //f.txBuilder.SetTimeoutHeight(f.TimeoutHeight()) - - return tx, nil -} - -// Sign signs a transaction given a name, passphrase, and a single message to -// signed. An error is returned if signing fails. -func (f *Factory) Sign(name string, txBuilder sdk.TxBuilder) error { - signMode := f.signMode - if signMode == signing.SignMode_SIGN_MODE_UNSPECIFIED { - // use the SignModeHandler's default mode if unspecified - signMode = f.txConfig.SignModeHandler().DefaultMode() - } - signerData := sdk.SignerData{ - ChainID: f.chainID, - AccountNumber: f.accountNumber, - Sequence: f.sequence, - } - - pubkey, _, err := f.keyManager.Find(name, f.password) - if err != nil { - return err - } - - // For SIGN_MODE_DIRECT, calling SetSignatures calls setSignerInfos on - // Factory under the hood, and SignerInfos is needed to generated the - // sign bytes. This is the reason for setting SetSignatures here, with a - // nil signature. - // - // Note: this line is not needed for SIGN_MODE_LEGACY_AMINO, but putting it - // also doesn't affect its generated sign bytes, so for code's simplicity - // sake, we put it here. - sigData := signing.SingleSignatureData{ - SignMode: signMode, - Signature: nil, - } - sig := signing.SignatureV2{ - PubKey: pubkey, - Data: &sigData, - Sequence: f.Sequence(), - } - if err := txBuilder.SetSignatures(sig); err != nil { - return err - } - - // Generate the bytes to be signed. - signBytes, err := f.signModeHandler.GetSignBytes(signMode, signerData, txBuilder.GetTx()) - if err != nil { - return err - } - - // Sign those bytes - sigBytes, _, err := f.keyManager.Sign(name, f.password, signBytes) - if err != nil { - return err - } - - // Construct the SignatureV2 struct - sigData = signing.SingleSignatureData{ - SignMode: signMode, - Signature: sigBytes, - } - sig = signing.SignatureV2{ - PubKey: pubkey, - Data: &sigData, - Sequence: f.Sequence(), - } - - // And here the tx is populated with the signature - return txBuilder.SetSignatures(sig) -} diff --git a/client/tx/tx.go b/client/tx/tx.go deleted file mode 100644 index 96d5eb87..00000000 --- a/client/tx/tx.go +++ /dev/null @@ -1,54 +0,0 @@ -package tx - -import ( - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type ( - // Generator defines an interface a client can utilize to generate an - // application-defined concrete transaction type. The type returned must - // implement ClientTx. - Generator interface { - NewTx() ClientTx - NewFee() ClientFee - NewSignature() ClientSignature - } - - ClientFee interface { - sdk.Fee - SetGas(uint64) - SetAmount(sdk.Coins) - } - - ClientSignature interface { - sdk.Signature - SetPubKey(crypto.PubKey) error - SetSignature([]byte) - } - - // ClientTx defines an interface which an application-defined concrete transaction - // type must implement. Namely, it must be able to set messages, generate - // signatures, and provide canonical bytes to sign over. The transaction must - // also know how to encode itself. - ClientTx interface { - sdk.Tx - codec.ProtoMarshaler - - SetMsgs(...sdk.Msg) error - GetSignatures() []sdk.Signature - SetSignatures(...ClientSignature) error - GetFee() sdk.Fee - SetFee(ClientFee) error - GetMemo() string - SetMemo(string) - - // CanonicalSignBytes returns the canonical JSON bytes to sign over, given a - // chain ID, along with an account and sequence number. The JSON encoding - // ensures all field names adhere to their proto definition, default values - // are omitted, and follows the JSON Canonical Form. - CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error) - } -) diff --git a/codec/amino.go b/codec/amino.go deleted file mode 100644 index 79a1fe5b..00000000 --- a/codec/amino.go +++ /dev/null @@ -1,185 +0,0 @@ -package codec - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - - amino "github.com/tendermint/go-amino" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/irisnet/irishub-sdk-go/codec/types" -) - -// deprecated: LegacyAmino defines a wrapper for an Amino codec that properly handles protobuf -// types with Any's -type LegacyAmino struct { - Amino *amino.Codec -} - -func (cdc *LegacyAmino) Seal() { - cdc.Amino.Seal() -} - -func NewLegacyAmino() *LegacyAmino { - return &LegacyAmino{amino.NewCodec()} -} - -// RegisterEvidences registers Tendermint evidence types with the provided Amino -// codec. -func RegisterEvidences(cdc *LegacyAmino) { - cdc.Amino.RegisterInterface((*tmtypes.Evidence)(nil), nil) - cdc.Amino.RegisterConcrete(&tmtypes.DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence", nil) -} - -// MarshalJSONIndent provides a utility for indented JSON encoding of an object -// via an Amino codec. It returns an error if it cannot serialize or indent as -// JSON. -func MarshalJSONIndent(cdc *LegacyAmino, obj interface{}) ([]byte, error) { - bz, err := cdc.MarshalJSON(obj) - if err != nil { - return nil, err - } - - var out bytes.Buffer - if err = json.Indent(&out, bz, "", " "); err != nil { - return nil, err - } - - return out.Bytes(), nil -} - -// MustMarshalJSONIndent executes MarshalJSONIndent except it panics upon failure. -func MustMarshalJSONIndent(cdc *LegacyAmino, obj interface{}) []byte { - bz, err := MarshalJSONIndent(cdc, obj) - if err != nil { - panic(fmt.Sprintf("failed to marshal JSON: %s", err)) - } - - return bz -} - -func (cdc *LegacyAmino) marshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoPacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) unmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) jsonMarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) jsonUnmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) MarshalBinaryBare(o interface{}) ([]byte, error) { - if err := cdc.marshalAnys(o); err != nil { - return nil, err - } - return cdc.Amino.MarshalBinaryBare(o) -} - -func (cdc *LegacyAmino) MustMarshalBinaryBare(o interface{}) []byte { - bz, err := cdc.MarshalBinaryBare(o) - if err != nil { - panic(err) - } - return bz -} - -func (cdc *LegacyAmino) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { - if err := cdc.marshalAnys(o); err != nil { - return nil, err - } - return cdc.Amino.MarshalBinaryLengthPrefixed(o) -} - -func (cdc *LegacyAmino) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { - bz, err := cdc.MarshalBinaryLengthPrefixed(o) - if err != nil { - panic(err) - } - return bz -} - -func (cdc *LegacyAmino) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { - if err := cdc.Amino.UnmarshalBinaryBare(bz, ptr); err != nil { - return err - } - return cdc.unmarshalAnys(ptr) -} - -func (cdc *LegacyAmino) MustUnmarshalBinaryBare(bz []byte, ptr interface{}) { - if err := cdc.UnmarshalBinaryBare(bz, ptr); err != nil { - panic(err) - } -} - -func (cdc *LegacyAmino) UnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) error { - if err := cdc.Amino.UnmarshalBinaryLengthPrefixed(bz, ptr); err != nil { - return err - } - return cdc.unmarshalAnys(ptr) -} - -func (cdc *LegacyAmino) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) { - if err := cdc.UnmarshalBinaryLengthPrefixed(bz, ptr); err != nil { - panic(err) - } -} - -func (cdc *LegacyAmino) MarshalJSON(o interface{}) ([]byte, error) { - if err := cdc.jsonMarshalAnys(o); err != nil { - return nil, err - } - return cdc.Amino.MarshalJSON(o) -} - -func (cdc *LegacyAmino) MustMarshalJSON(o interface{}) []byte { - bz, err := cdc.MarshalJSON(o) - if err != nil { - panic(err) - } - return bz -} - -func (cdc *LegacyAmino) UnmarshalJSON(bz []byte, ptr interface{}) error { - if err := cdc.Amino.UnmarshalJSON(bz, ptr); err != nil { - return err - } - return cdc.jsonUnmarshalAnys(ptr) -} - -func (cdc *LegacyAmino) MustUnmarshalJSON(bz []byte, ptr interface{}) { - if err := cdc.UnmarshalJSON(bz, ptr); err != nil { - panic(err) - } -} - -func (*LegacyAmino) UnpackAny(*types.Any, interface{}) error { - return errors.New("AminoCodec can't handle unpack protobuf Any's") -} - -func (cdc *LegacyAmino) RegisterInterface(ptr interface{}, iopts *amino.InterfaceOptions) { - cdc.Amino.RegisterInterface(ptr, iopts) -} - -func (cdc *LegacyAmino) RegisterConcrete(o interface{}, name string, copts *amino.ConcreteOptions) { - cdc.Amino.RegisterConcrete(o, name, copts) -} - -func (cdc *LegacyAmino) MarshalJSONIndent(o interface{}, prefix, indent string) ([]byte, error) { - if err := cdc.jsonMarshalAnys(o); err != nil { - panic(err) - } - return cdc.Amino.MarshalJSONIndent(o, prefix, indent) -} - -func (cdc *LegacyAmino) PrintTypes(out io.Writer) error { - return cdc.Amino.PrintTypes(out) -} diff --git a/codec/amino_codec.go b/codec/amino_codec.go deleted file mode 100644 index 21b751e8..00000000 --- a/codec/amino_codec.go +++ /dev/null @@ -1,80 +0,0 @@ -package codec - -import "github.com/gogo/protobuf/proto" - -// AminoCodec defines a codec that utilizes Codec for both binary and JSON -// encoding. -type AminoCodec struct { - *LegacyAmino -} - -var _ Marshaler = &AminoCodec{} - -// NewAminoCodec returns a reference to a new AminoCodec -func NewAminoCodec(codec *LegacyAmino) *AminoCodec { - return &AminoCodec{LegacyAmino: codec} -} - -// MarshalBinaryBare implements BinaryMarshaler.MarshalBinaryBare method. -func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { - return ac.LegacyAmino.MarshalBinaryBare(o) -} - -// MustMarshalBinaryBare implements BinaryMarshaler.MustMarshalBinaryBare method. -func (ac *AminoCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte { - return ac.LegacyAmino.MustMarshalBinaryBare(o) -} - -// MarshalBinaryLengthPrefixed implements BinaryMarshaler.MarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) { - return ac.LegacyAmino.MarshalBinaryLengthPrefixed(o) -} - -// MustMarshalBinaryLengthPrefixed implements BinaryMarshaler.MustMarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte { - return ac.LegacyAmino.MustMarshalBinaryLengthPrefixed(o) -} - -// UnmarshalBinaryBare implements BinaryMarshaler.UnmarshalBinaryBare method. -func (ac *AminoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { - return ac.LegacyAmino.UnmarshalBinaryBare(bz, ptr) -} - -// MustUnmarshalBinaryBare implements BinaryMarshaler.MustUnmarshalBinaryBare method. -func (ac *AminoCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) { - ac.LegacyAmino.MustUnmarshalBinaryBare(bz, ptr) -} - -// UnmarshalBinaryLengthPrefixed implements BinaryMarshaler.UnmarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error { - return ac.LegacyAmino.UnmarshalBinaryLengthPrefixed(bz, ptr) -} - -// MustUnmarshalBinaryLengthPrefixed implements BinaryMarshaler.MustUnmarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) { - ac.LegacyAmino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) -} - -// MarshalJSON implements JSONMarshaler.MarshalJSON method, -// it marshals to JSON using legacy amino codec. -func (ac *AminoCodec) MarshalJSON(o proto.Message) ([]byte, error) { - return ac.LegacyAmino.MarshalJSON(o) -} - -// MustMarshalJSON implements JSONMarshaler.MustMarshalJSON method, -// it executes MarshalJSON except it panics upon failure. -func (ac *AminoCodec) MustMarshalJSON(o proto.Message) []byte { - return ac.LegacyAmino.MustMarshalJSON(o) -} - -// UnmarshalJSON implements JSONMarshaler.UnmarshalJSON method, -// it unmarshals from JSON using legacy amino codec. -func (ac *AminoCodec) UnmarshalJSON(bz []byte, ptr proto.Message) error { - return ac.LegacyAmino.UnmarshalJSON(bz, ptr) -} - -// MustUnmarshalJSON implements JSONMarshaler.MustUnmarshalJSON method, -// it executes UnmarshalJSON except it panics upon failure. -func (ac *AminoCodec) MustUnmarshalJSON(bz []byte, ptr proto.Message) { - ac.LegacyAmino.MustUnmarshalJSON(bz, ptr) -} diff --git a/codec/any.go b/codec/any.go deleted file mode 100644 index 70b3f62c..00000000 --- a/codec/any.go +++ /dev/null @@ -1,42 +0,0 @@ -package codec - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/irishub-sdk-go/codec/types" -) - -// MarshalAny is a convenience function for packing the provided value in an -// Any and then proto marshaling it to bytes -func MarshalAny(m BinaryMarshaler, x interface{}) ([]byte, error) { - msg, ok := x.(proto.Message) - if !ok { - return nil, fmt.Errorf("can't proto marshal %T", x) - } - - any := &types.Any{} - if err := any.Pack(msg); err != nil { - return nil, err - } - - return m.MarshalBinaryBare(any) -} - -// UnmarshalAny is a convenience function for proto unmarshaling an Any from -// bz and then unpacking it to the interface pointer passed in as iface using -// the provided AnyUnpacker or returning an error -// -// Ex: -// var x MyInterface -// err := UnmarshalAny(unpacker, &x, bz) -func UnmarshalAny(m BinaryMarshaler, iface interface{}, bz []byte) error { - any := &types.Any{} - - if err := m.UnmarshalBinaryBare(bz, any); err != nil { - return err - } - - return m.UnpackAny(any, iface) -} diff --git a/codec/codec.go b/codec/codec.go deleted file mode 100644 index 5a0db480..00000000 --- a/codec/codec.go +++ /dev/null @@ -1,66 +0,0 @@ -package codec - -import ( - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/irishub-sdk-go/codec/types" -) - -type ( - // Marshaler defines the interface module codecs must implement in order to support - // backwards compatibility with Amino while allowing custom Protobuf-based - // serialization. Note, Amino can still be used without any dependency on - // Protobuf. There are two typical implementations that fulfill this contract: - // - // 1. AminoCodec: Provides full Amino serialization compatibility. - // 2. ProtoCodec: Provides full Protobuf serialization compatibility. - Marshaler interface { - BinaryMarshaler - JSONMarshaler - } - - BinaryMarshaler interface { - MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) - MustMarshalBinaryBare(o ProtoMarshaler) []byte - - MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) - MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte - - UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error - MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) - - UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error - MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) - - types.AnyUnpacker - } - - JSONMarshaler interface { - MarshalJSON(o proto.Message) ([]byte, error) - MustMarshalJSON(o proto.Message) []byte - - UnmarshalJSON(bz []byte, ptr proto.Message) error - MustUnmarshalJSON(bz []byte, ptr proto.Message) - } - - // ProtoMarshaler defines an interface a type must implement as protocol buffer - // defined message. - ProtoMarshaler interface { - proto.Message // for JSON serialization - - Marshal() ([]byte, error) - MarshalTo(data []byte) (n int, err error) - MarshalToSizedBuffer(dAtA []byte) (int, error) - Size() int - Unmarshal(data []byte) error - } - - // AminoMarshaler defines an interface where Amino marshalling can be - // overridden by custom marshalling. - AminoMarshaler interface { - MarshalAmino() ([]byte, error) - UnmarshalAmino([]byte) error - MarshalAminoJSON() ([]byte, error) - UnmarshalAminoJSON([]byte) error - } -) diff --git a/codec/json.go b/codec/json.go deleted file mode 100644 index 55db6a07..00000000 --- a/codec/json.go +++ /dev/null @@ -1,30 +0,0 @@ -package codec - -import ( - "bytes" - - "github.com/irisnet/irishub-sdk-go/codec/types" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" -) - -// ProtoMarshalJSON provides an auxiliary function to return Proto3 JSON encoded -// bytes of a message. -func ProtoMarshalJSON(msg proto.Message) ([]byte, error) { - // We use the OrigName because camel casing fields just doesn't make sense. - // EmitDefaults is also often the more expected behavior for CLI users - jm := &jsonpb.Marshaler{OrigName: true, EmitDefaults: true} - err := types.UnpackInterfaces(msg, types.ProtoJSONPacker{JSONPBMarshaler: jm}) - if err != nil { - return nil, err - } - - buf := new(bytes.Buffer) - - if err := jm.Marshal(buf, msg); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} diff --git a/codec/legacy/codec.go b/codec/legacy/codec.go deleted file mode 100644 index fec6b115..00000000 --- a/codec/legacy/codec.go +++ /dev/null @@ -1,19 +0,0 @@ -package legacy - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" -) - -// Cdc defines a global generic sealed Amino codec to be used throughout sdk. It -// has all Tendermint crypto and evidence types registered. -// -// TODO: Deprecated - remove this global. -var Cdc *codec.LegacyAmino - -func init() { - Cdc = codec.NewLegacyAmino() - cryptocodec.RegisterCrypto(Cdc) - codec.RegisterEvidences(Cdc) - Cdc.Seal() -} diff --git a/codec/legacy/doc.go b/codec/legacy/doc.go deleted file mode 100644 index d89944f3..00000000 --- a/codec/legacy/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package legacy contains a global amino Cdc which is deprecated but -// still used in several places within the SDK. This package is intended -// to be removed at some point in the future when the global Cdc is removed. -package legacy diff --git a/codec/proto_codec.go b/codec/proto_codec.go deleted file mode 100644 index 2c8a18c8..00000000 --- a/codec/proto_codec.go +++ /dev/null @@ -1,154 +0,0 @@ -package codec - -import ( - "encoding/binary" - "fmt" - "strings" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/irishub-sdk-go/codec/types" -) - -// ProtoCodec defines a codec that utilizes Protobuf for both binary and JSON -// encoding. -type ProtoCodec struct { - anyUnpacker types.AnyUnpacker -} - -var _ Marshaler = &ProtoCodec{} - -// NewProtoCodec returns a reference to a new ProtoCodec -func NewProtoCodec(anyUnpacker types.AnyUnpacker) *ProtoCodec { - return &ProtoCodec{anyUnpacker: anyUnpacker} -} - -// MarshalBinaryBare implements BinaryMarshaler.MarshalBinaryBare method. -func (pc *ProtoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { - return o.Marshal() -} - -// MustMarshalBinaryBare implements BinaryMarshaler.MustMarshalBinaryBare method. -func (pc *ProtoCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte { - bz, err := pc.MarshalBinaryBare(o) - if err != nil { - panic(err) - } - - return bz -} - -// MarshalBinaryLengthPrefixed implements BinaryMarshaler.MarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) { - bz, err := pc.MarshalBinaryBare(o) - if err != nil { - return nil, err - } - - var sizeBuf [binary.MaxVarintLen64]byte - n := binary.PutUvarint(sizeBuf[:], uint64(o.Size())) - return append(sizeBuf[:n], bz...), nil -} - -// MustMarshalBinaryLengthPrefixed implements BinaryMarshaler.MustMarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte { - bz, err := pc.MarshalBinaryLengthPrefixed(o) - if err != nil { - panic(err) - } - - return bz -} - -// UnmarshalBinaryBare implements BinaryMarshaler.UnmarshalBinaryBare method. -func (pc *ProtoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { - if err := ptr.Unmarshal(bz); err != nil { - return err - } - return types.UnpackInterfaces(ptr, pc.anyUnpacker) -} - -// MustUnmarshalBinaryBare implements BinaryMarshaler.MustUnmarshalBinaryBare method. -func (pc *ProtoCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) { - if err := pc.UnmarshalBinaryBare(bz, ptr); err != nil { - panic(err) - } -} - -// UnmarshalBinaryLengthPrefixed implements BinaryMarshaler.UnmarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error { - size, n := binary.Uvarint(bz) - if n < 0 { - return fmt.Errorf("invalid number of bytes read from length-prefixed encoding: %d", n) - } - - if size > uint64(len(bz)-n) { - return fmt.Errorf("not enough bytes to read; want: %v, got: %v", size, len(bz)-n) - } else if size < uint64(len(bz)-n) { - return fmt.Errorf("too many bytes to read; want: %v, got: %v", size, len(bz)-n) - } - - bz = bz[n:] - return pc.UnmarshalBinaryBare(bz, ptr) -} - -// MustUnmarshalBinaryLengthPrefixed implements BinaryMarshaler.MustUnmarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) { - if err := pc.UnmarshalBinaryLengthPrefixed(bz, ptr); err != nil { - panic(err) - } -} - -// MarshalJSON implements JSONMarshaler.MarshalJSON method, -// it marshals to JSON using proto codec. -func (pc *ProtoCodec) MarshalJSON(o proto.Message) ([]byte, error) { - m, ok := o.(ProtoMarshaler) - if !ok { - return nil, fmt.Errorf("cannot protobuf JSON encode unsupported type: %T", o) - } - - return ProtoMarshalJSON(m) -} - -// MustMarshalJSON implements JSONMarshaler.MustMarshalJSON method, -// it executes MarshalJSON except it panics upon failure. -func (pc *ProtoCodec) MustMarshalJSON(o proto.Message) []byte { - bz, err := pc.MarshalJSON(o) - if err != nil { - panic(err) - } - - return bz -} - -// UnmarshalJSON implements JSONMarshaler.UnmarshalJSON method, -// it unmarshals from JSON using proto codec. -func (pc *ProtoCodec) UnmarshalJSON(bz []byte, ptr proto.Message) error { - m, ok := ptr.(ProtoMarshaler) - if !ok { - return fmt.Errorf("cannot protobuf JSON decode unsupported type: %T", ptr) - } - - err := jsonpb.Unmarshal(strings.NewReader(string(bz)), m) - if err != nil { - return err - } - - return types.UnpackInterfaces(ptr, pc.anyUnpacker) -} - -// MustUnmarshalJSON implements JSONMarshaler.MustUnmarshalJSON method, -// it executes UnmarshalJSON except it panics upon failure. -func (pc *ProtoCodec) MustUnmarshalJSON(bz []byte, ptr proto.Message) { - if err := pc.UnmarshalJSON(bz, ptr); err != nil { - panic(err) - } -} - -// UnpackAny implements AnyUnpacker.UnpackAny method, -// it unpacks the value in any to the interface pointer passed in as -// iface. -func (pc *ProtoCodec) UnpackAny(any *types.Any, iface interface{}) error { - return pc.anyUnpacker.UnpackAny(any, iface) -} diff --git a/codec/types/any.go b/codec/types/any.go deleted file mode 100644 index df7ff8a3..00000000 --- a/codec/types/any.go +++ /dev/null @@ -1,133 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" -) - -type Any struct { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - - // nolint - TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // Must be a valid serialized protocol buffer of the above specified type. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - - // nolint - XXX_NoUnkeyedLiteral struct{} `json:"-"` - - // nolint - XXX_unrecognized []byte `json:"-"` - - // nolint - XXX_sizecache int32 `json:"-"` - - cachedValue interface{} - - compat *anyCompat -} - -// NewAnyWithValue constructs a new Any packed with the value provided or -// returns an error if that value couldn't be packed. This also caches -// the packed value so that it can be retrieved from GetCachedValue without -// unmarshaling -func NewAnyWithValue(value proto.Message) (*Any, error) { - any := &Any{} - - err := any.Pack(value) - if err != nil { - return nil, err - } - - return any, nil -} - -// Pack packs the value x in the Any or returns an error. This also caches -// the packed value so that it can be retrieved from GetCachedValue without -// unmarshaling -func (any *Any) Pack(x proto.Message) error { - any.TypeUrl = "/" + proto.MessageName(x) - bz, err := proto.Marshal(x) - if err != nil { - return err - } - - any.Value = bz - any.cachedValue = x - - return nil -} - -// UnsafePackAny packs the value x in the Any and instead of returning the error -// in the case of a packing failure, keeps the cached value. This should only -// be used in situations where compatibility is needed with amino. Amino-only -// values can safely be packed using this method when they will only be -// marshaled with amino and not protobuf. -func UnsafePackAny(x interface{}) *Any { - if msg, ok := x.(proto.Message); ok { - any, err := NewAnyWithValue(msg) - if err == nil { - return any - } - } - return &Any{cachedValue: x} -} - -// PackAny is a checked and safe version of UnsafePackAny. It assures that -// `x` implements the proto.Message interface and uses it to serialize `x`. -// [DEPRECATED]: should be moved away: https://github.com/cosmos/cosmos-sdk/issues/7479 -func PackAny(x interface{}) (*Any, error) { - if x == nil { - return nil, nil - } - if intoany, ok := x.(IntoAny); ok { - return intoany.AsAny(), nil - } - protoMsg, ok := x.(proto.Message) - if !ok { - return nil, fmt.Errorf("Expecting %T to implement proto.Message", x) - } - return NewAnyWithValue(protoMsg) -} - -// GetCachedValue returns the cached value from the Any if present -func (any *Any) GetCachedValue() interface{} { - return any.cachedValue -} - -// ClearCachedValue clears the cached value from the Any -func (any *Any) ClearCachedValue() { - any.cachedValue = nil -} - -// IntoAny represents a type that can be wrapped into an Any. -type IntoAny interface { - AsAny() *Any -} diff --git a/codec/types/any.pb.go b/codec/types/any.pb.go deleted file mode 100644 index d0843816..00000000 --- a/codec/types/any.pb.go +++ /dev/null @@ -1,584 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: third_party/proto/google/protobuf/any.proto - -package types - -import ( - bytes "bytes" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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 - -func (m *Any) Reset() { *m = Any{} } -func (*Any) ProtoMessage() {} -func (*Any) Descriptor() ([]byte, []int) { - return fileDescriptor_cb68f365a8e2bcdc, []int{0} -} -func (*Any) XXX_WellKnownType() string { return "Any" } -func (m *Any) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Any.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 *Any) XXX_Merge(src proto.Message) { - xxx_messageInfo_Any.Merge(m, src) -} -func (m *Any) XXX_Size() int { - return m.Size() -} -func (m *Any) XXX_DiscardUnknown() { - xxx_messageInfo_Any.DiscardUnknown(m) -} - -var xxx_messageInfo_Any proto.InternalMessageInfo - -func (m *Any) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} - -func (m *Any) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (*Any) XXX_MessageName() string { - return "google.protobuf.Any" -} -func init() { -} - -func init() { - proto.RegisterFile("third_party/proto/google/protobuf/any.proto", fileDescriptor_cb68f365a8e2bcdc) -} - -var fileDescriptor_cb68f365a8e2bcdc = []byte{ - // 246 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0xc9, 0xc8, 0x2c, - 0x4a, 0x89, 0x2f, 0x48, 0x2c, 0x2a, 0xa9, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x4f, 0xcf, - 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0x70, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0xf5, 0xc0, 0x1c, - 0x21, 0x7e, 0x88, 0x94, 0x1e, 0x4c, 0x4a, 0x4a, 0x0d, 0x9b, 0xee, 0xf4, 0x7c, 0x04, 0x0b, 0xa2, - 0x54, 0xc9, 0x86, 0x8b, 0xd9, 0x31, 0xaf, 0x52, 0x48, 0x92, 0x8b, 0xa3, 0xa4, 0xb2, 0x20, 0x35, - 0xbe, 0xb4, 0x28, 0x47, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x88, 0x1d, 0xc4, 0x0f, 0x2d, 0xca, - 0x11, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x09, - 0x82, 0x70, 0xac, 0x58, 0x3e, 0x2c, 0x94, 0x67, 0x70, 0x6a, 0x66, 0xbc, 0xf1, 0x50, 0x8e, 0xe1, - 0xc3, 0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x1b, 0x1e, 0xc9, 0x31, 0xae, 0x78, 0x24, 0xc7, - 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78, 0x24, - 0xc7, 0xf0, 0x01, 0x24, 0xfe, 0x58, 0x8e, 0xf1, 0xc0, 0x63, 0x39, 0x86, 0x13, 0x8f, 0xe5, 0x18, - 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0x5c, 0xec, 0xc4, 0xe1, 0x98, 0x57, 0x19, 0x00, 0xe2, - 0x04, 0x30, 0x46, 0xb1, 0x82, 0x2c, 0x2f, 0x5e, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, - 0xce, 0x1d, 0xa2, 0x34, 0x00, 0xaa, 0x54, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, - 0x2f, 0x04, 0xa4, 0x2c, 0x89, 0x0d, 0x6c, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc3, - 0x46, 0x5f, 0x32, 0x01, 0x00, 0x00, -} - -func (this *Any) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.TypeUrl != that1.TypeUrl { - if this.TypeUrl < that1.TypeUrl { - return -1 - } - return 1 - } - if c := bytes.Compare(this.Value, that1.Value); c != 0 { - return c - } - if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { - return c - } - return 0 -} -func (this *Any) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.TypeUrl != that1.TypeUrl { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Any) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&types.Any{") - s = append(s, "TypeUrl: "+fmt.Sprintf("%#v", this.TypeUrl)+",\n") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringAny(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *Any) 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 *Any) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Any) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintAny(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.TypeUrl) > 0 { - i -= len(m.TypeUrl) - copy(dAtA[i:], m.TypeUrl) - i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintAny(dAtA []byte, offset int, v uint64) int { - offset -= sovAny(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func NewPopulatedAny(r randyAny, easy bool) *Any { - this := &Any{} - this.TypeUrl = string(randStringAny(r)) - v1 := r.Intn(100) - this.Value = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Value[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedAny(r, 3) - } - return this -} - -type randyAny interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneAny(r randyAny) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringAny(r randyAny) string { - v2 := r.Intn(100) - tmps := make([]rune, v2) - for i := 0; i < v2; i++ { - tmps[i] = randUTF8RuneAny(r) - } - return string(tmps) -} -func randUnrecognizedAny(r randyAny, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldAny(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldAny(dAtA []byte, r randyAny, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - v3 := r.Int63() - if r.Intn(2) == 0 { - v3 *= -1 - } - dAtA = encodeVarintPopulateAny(dAtA, uint64(v3)) - case 1: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateAny(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateAny(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *Any) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TypeUrl) - if l > 0 { - n += 1 + l + sovAny(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovAny(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovAny(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAny(x uint64) (n int) { - return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Any) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Any{`, - `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func valueToStringAny(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Any) 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 ErrIntOverflowAny - } - 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: Any: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Any: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAny - } - 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 ErrInvalidLengthAny - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAny - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TypeUrl = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAny - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAny - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAny - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAny(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAny - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAny - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAny(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, ErrIntOverflowAny - } - 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, ErrIntOverflowAny - } - 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, ErrIntOverflowAny - } - 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, ErrInvalidLengthAny - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAny - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAny - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAny = fmt.Errorf("proto: unexpected end of group") -) diff --git a/codec/types/compat.go b/codec/types/compat.go deleted file mode 100644 index 3aa02412..00000000 --- a/codec/types/compat.go +++ /dev/null @@ -1,213 +0,0 @@ -package types - -import ( - "fmt" - "reflect" - "runtime/debug" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" - - amino "github.com/tendermint/go-amino" -) - -type anyCompat struct { - aminoBz []byte - jsonBz []byte - err error -} - -var Debug = true - -func anyCompatError(errType string, x interface{}) error { - if Debug { - debug.PrintStack() - } - return fmt.Errorf( - "%s marshaling error for %+v, this is likely because "+ - "amino is being used directly (instead of codec.LegacyAmino which is preferred) "+ - "or UnpackInterfacesMessage is not defined for some type which contains "+ - "a protobuf Any either directly or via one of its members. To see a "+ - "stacktrace of where the error is coming from, set the var Debug = true "+ - "in codec/types/compat.go", - errType, x, - ) -} - -func (any Any) MarshalAmino() ([]byte, error) { - ac := any.compat - if ac == nil { - return nil, anyCompatError("amino binary unmarshal", any) - } - return ac.aminoBz, ac.err -} - -func (any *Any) UnmarshalAmino(bz []byte) error { - any.compat = &anyCompat{ - aminoBz: bz, - err: nil, - } - return nil -} - -func (any *Any) MarshalJSON() ([]byte, error) { - ac := any.compat - if ac == nil { - return nil, anyCompatError("JSON marshal", any) - } - return ac.jsonBz, ac.err -} - -func (any *Any) UnmarshalJSON(bz []byte) error { - any.compat = &anyCompat{ - jsonBz: bz, - err: nil, - } - return nil -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the binary un-marshaling phase -type AminoUnpacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoUnpacker{} - -func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { - ac := any.compat - if ac == nil { - return anyCompatError("amino binary unmarshal", reflect.TypeOf(iface)) - } - err := a.Cdc.UnmarshalBinaryBare(ac.aminoBz, iface) - if err != nil { - return err - } - val := reflect.ValueOf(iface).Elem().Interface() - err = UnpackInterfaces(val, a) - if err != nil { - return err - } - if m, ok := val.(proto.Message); ok { - err := any.Pack(m) - if err != nil { - return err - } - } else { - any.cachedValue = val - } - - // this is necessary for tests that use reflect.DeepEqual and compare - // proto vs amino marshaled values - any.compat = nil - - return nil -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the binary marshaling phase -type AminoPacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoPacker{} - -func (a AminoPacker) UnpackAny(any *Any, _ interface{}) error { - err := UnpackInterfaces(any.cachedValue, a) - if err != nil { - return err - } - bz, err := a.Cdc.MarshalBinaryBare(any.cachedValue) - any.compat = &anyCompat{ - aminoBz: bz, - err: err, - } - return err -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the JSON marshaling phase -type AminoJSONUnpacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoJSONUnpacker{} - -func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { - ac := any.compat - if ac == nil { - return anyCompatError("JSON unmarshal", reflect.TypeOf(iface)) - } - err := a.Cdc.UnmarshalJSON(ac.jsonBz, iface) - if err != nil { - return err - } - val := reflect.ValueOf(iface).Elem().Interface() - err = UnpackInterfaces(val, a) - if err != nil { - return err - } - if m, ok := val.(proto.Message); ok { - err := any.Pack(m) - if err != nil { - return err - } - } else { - any.cachedValue = val - } - - // this is necessary for tests that use reflect.DeepEqual and compare - // proto vs amino marshaled values - any.compat = nil - - return nil -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the JSON un-marshaling phase -type AminoJSONPacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoJSONPacker{} - -func (a AminoJSONPacker) UnpackAny(any *Any, _ interface{}) error { - err := UnpackInterfaces(any.cachedValue, a) - if err != nil { - return err - } - bz, err := a.Cdc.MarshalJSON(any.cachedValue) - any.compat = &anyCompat{ - jsonBz: bz, - err: err, - } - return err -} - -// ProtoJSONPacker is an AnyUnpacker provided for compatibility with jsonpb -type ProtoJSONPacker struct { - JSONPBMarshaler *jsonpb.Marshaler -} - -var _ AnyUnpacker = ProtoJSONPacker{} - -func (a ProtoJSONPacker) UnpackAny(any *Any, _ interface{}) error { - if any == nil { - return nil - } - - if any.cachedValue != nil { - err := UnpackInterfaces(any.cachedValue, a) - if err != nil { - return err - } - } - - bz, err := a.JSONPBMarshaler.MarshalToString(any) - any.compat = &anyCompat{ - jsonBz: []byte(bz), - err: err, - } - - return err -} diff --git a/codec/types/doc.go b/codec/types/doc.go deleted file mode 100644 index 9f89f0c9..00000000 --- a/codec/types/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -/* -Package types defines a custom wrapper for google.protobuf.Any which supports -cached values as well as InterfaceRegistry which keeps track of types which can -be used with Any for both security and introspection -*/ -package types diff --git a/codec/types/interface_registry.go b/codec/types/interface_registry.go deleted file mode 100644 index 3621dc3c..00000000 --- a/codec/types/interface_registry.go +++ /dev/null @@ -1,272 +0,0 @@ -package types - -import ( - "fmt" - "reflect" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" -) - -// AnyUnpacker is an interface which allows safely unpacking types packed -// in Any's against a whitelist of registered types -type AnyUnpacker interface { - // UnpackAny unpacks the value in any to the interface pointer passed in as - // iface. Note that the type in any must have been registered in the - // underlying whitelist registry as a concrete type for that interface - // Ex: - // var msg sdk.Msg - // err := cdc.UnpackAny(any, &msg) - // ... - UnpackAny(any *Any, iface interface{}) error -} - -// InterfaceRegistry provides a mechanism for registering interfaces and -// implementations that can be safely unpacked from Any -type InterfaceRegistry interface { - AnyUnpacker - jsonpb.AnyResolver - - // RegisterInterface associates protoName as the public name for the - // interface passed in as iface. This is to be used primarily to create - // a public facing registry of interface implementations for clients. - // protoName should be a well-chosen public facing name that remains stable. - // RegisterInterface takes an optional list of impls to be registered - // as implementations of iface. - // - // Ex: - // registry.RegisterInterface("cosmos.v1beta1.Msg", (*sdk.Msg)(nil)) - RegisterInterface(protoName string, iface interface{}, impls ...proto.Message) - - // RegisterImplementations registers impls as concrete implementations of - // the interface iface. - // - // Ex: - // registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{}, &MsgMultiSend{}) - RegisterImplementations(iface interface{}, impls ...proto.Message) - - // ListAllInterfaces list the type URLs of all registered interfaces. - ListAllInterfaces() []string - - // ListImplementations lists the valid type URLs for the given interface name that can be used - // for the provided interface type URL. - ListImplementations(ifaceTypeURL string) []string -} - -// UnpackInterfacesMessage is meant to extend protobuf types (which implement -// proto.Message) to support a post-deserialization phase which unpacks -// types packed within Any's using the whitelist provided by AnyUnpacker -type UnpackInterfacesMessage interface { - // UnpackInterfaces is implemented in order to unpack values packed within - // Any's using the AnyUnpacker. It should generally be implemented as - // follows: - // func (s *MyStruct) UnpackInterfaces(unpacker AnyUnpacker) error { - // var x AnyInterface - // // where X is an Any field on MyStruct - // err := unpacker.UnpackAny(s.X, &x) - // if err != nil { - // return nil - // } - // // where Y is a field on MyStruct that implements UnpackInterfacesMessage itself - // err = s.Y.UnpackInterfaces(unpacker) - // if err != nil { - // return nil - // } - // return nil - // } - UnpackInterfaces(unpacker AnyUnpacker) error -} - -type interfaceRegistry struct { - interfaceNames map[string]reflect.Type - interfaceImpls map[reflect.Type]interfaceMap - typeURLMap map[string]reflect.Type -} - -type interfaceMap = map[string]reflect.Type - -// NewInterfaceRegistry returns a new InterfaceRegistry -func NewInterfaceRegistry() InterfaceRegistry { - return &interfaceRegistry{ - interfaceNames: map[string]reflect.Type{}, - interfaceImpls: map[reflect.Type]interfaceMap{}, - typeURLMap: map[string]reflect.Type{}, - } -} - -func (registry *interfaceRegistry) RegisterInterface(protoName string, iface interface{}, impls ...proto.Message) { - typ := reflect.TypeOf(iface) - if typ.Elem().Kind() != reflect.Interface { - panic(fmt.Errorf("%T is not an interface type", iface)) - } - registry.interfaceNames[protoName] = typ - registry.RegisterImplementations(iface, impls...) -} - -func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, impls ...proto.Message) { - for _, impl := range impls { - typeURL := "/" + proto.MessageName(impl) - registry.registerImpl(iface, typeURL, impl) - } -} - -// RegisterCustomTypeURL registers a concrete type which implements the given -// interface under `typeURL`. -// -// This function PANICs if different concrete types are registered under the -// same typeURL. -func (registry *interfaceRegistry) RegisterCustomTypeURL(iface interface{}, typeURL string, impl proto.Message) { - registry.registerImpl(iface, typeURL, impl) -} - -// registerImpl registers a concrete type which implements the given -// interface under `typeURL`. -// -// This function PANICs if different concrete types are registered under the -// same typeURL. -func (registry *interfaceRegistry) registerImpl(iface interface{}, typeURL string, impl proto.Message) { - ityp := reflect.TypeOf(iface).Elem() - imap, found := registry.interfaceImpls[ityp] - if !found { - imap = map[string]reflect.Type{} - } - - implType := reflect.TypeOf(impl) - if !implType.AssignableTo(ityp) { - panic(fmt.Errorf("type %T doesn't actually implement interface %+v", impl, ityp)) - } - - // Check if we already registered something under the given typeURL. It's - // okay to register the same concrete type again, but if we are registering - // a new concrete type under the same typeURL, then we throw an error (here, - // we panic). - foundImplType, found := imap[typeURL] - if found && foundImplType != implType { - panic( - fmt.Errorf( - "concrete type %s has already been registered under typeURL %s, cannot register %s under same typeURL. "+ - "This usually means that there are conflicting modules registering different concrete types "+ - "for a same interface implementation", - foundImplType, - typeURL, - implType, - ), - ) - } - - imap[typeURL] = implType - registry.typeURLMap[typeURL] = implType - - registry.interfaceImpls[ityp] = imap -} - -func (registry *interfaceRegistry) ListAllInterfaces() []string { - interfaceNames := registry.interfaceNames - keys := make([]string, 0, len(interfaceNames)) - for key := range interfaceNames { - keys = append(keys, key) - } - return keys -} - -func (registry *interfaceRegistry) ListImplementations(ifaceName string) []string { - typ, ok := registry.interfaceNames[ifaceName] - if !ok { - return []string{} - } - - impls, ok := registry.interfaceImpls[typ.Elem()] - if !ok { - return []string{} - } - - keys := make([]string, 0, len(impls)) - for key := range impls { - keys = append(keys, key) - } - return keys -} - -func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { - // here we gracefully handle the case in which `any` itself is `nil`, which may occur in message decoding - if any == nil { - return nil - } - - if any.TypeUrl == "" { - // if TypeUrl is empty return nil because without it we can't actually unpack anything - return nil - } - - rv := reflect.ValueOf(iface) - if rv.Kind() != reflect.Ptr { - return fmt.Errorf("UnpackAny expects a pointer") - } - - rt := rv.Elem().Type() - - cachedValue := any.cachedValue - if cachedValue != nil { - if reflect.TypeOf(cachedValue).AssignableTo(rt) { - rv.Elem().Set(reflect.ValueOf(cachedValue)) - return nil - } - } - - imap, found := registry.interfaceImpls[rt] - if !found { - return fmt.Errorf("no registered implementations of type %+v", rt) - } - - typ, found := imap[any.TypeUrl] - if !found { - return fmt.Errorf("no concrete type registered for type URL %s against interface %T", any.TypeUrl, iface) - } - - msg, ok := reflect.New(typ.Elem()).Interface().(proto.Message) - if !ok { - return fmt.Errorf("can't proto unmarshal %T", msg) - } - - err := proto.Unmarshal(any.Value, msg) - if err != nil { - return err - } - - err = UnpackInterfaces(msg, registry) - if err != nil { - return err - } - - rv.Elem().Set(reflect.ValueOf(msg)) - - any.cachedValue = msg - - return nil -} - -// Resolve returns the proto message given its typeURL. It works with types -// registered with RegisterInterface/RegisterImplementations, as well as those -// registered with RegisterWithCustomTypeURL. -func (registry *interfaceRegistry) Resolve(typeURL string) (proto.Message, error) { - typ, found := registry.typeURLMap[typeURL] - if !found { - return nil, fmt.Errorf("unable to resolve type URL %s", typeURL) - } - - msg, ok := reflect.New(typ.Elem()).Interface().(proto.Message) - if !ok { - return nil, fmt.Errorf("can't resolve type URL %s", typeURL) - } - - return msg, nil -} - -// UnpackInterfaces is a convenience function that calls UnpackInterfaces -// on x if x implements UnpackInterfacesMessage -func UnpackInterfaces(x interface{}, unpacker AnyUnpacker) error { - if msg, ok := x.(UnpackInterfacesMessage); ok { - return msg.UnpackInterfaces(unpacker) - } - return nil -} diff --git a/codec/unknownproto/doc.go b/codec/unknownproto/doc.go deleted file mode 100644 index 0e0a4634..00000000 --- a/codec/unknownproto/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -unknownproto implements functionality to "type check" protobuf serialized byte sequences -against an expected proto.Message to report: - -a) Unknown fields in the stream -- this is indicative of mismatched services, perhaps a malicious actor - -b) Mismatched wire types for a field -- this is indicative of mismatched services - -Its API signature is similar to proto.Unmarshal([]byte, proto.Message) in the strict case - - if err := RejectUnknownFieldsStrict(protoBlob, protoMessage, false); err != nil { - // Handle the error. - } - -and ideally should be added before invoking proto.Unmarshal, if you'd like to enforce the features mentioned above. - -By default, for security we report every single field that's unknown, whether a non-critical field or not. To customize -this behavior, please set the boolean parameter allowUnknownNonCriticals to true to RejectUnknownFields: - - if err := RejectUnknownFields(protoBlob, protoMessage, true); err != nil { - // Handle the error. - } -*/ -package unknownproto diff --git a/codec/unknownproto/unknown_fields.go b/codec/unknownproto/unknown_fields.go deleted file mode 100644 index b009e3c6..00000000 --- a/codec/unknownproto/unknown_fields.go +++ /dev/null @@ -1,403 +0,0 @@ -package unknownproto - -import ( - "bytes" - "compress/gzip" - "errors" - "fmt" - "io/ioutil" - "reflect" - "sync" - - "github.com/gogo/protobuf/proto" - "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "google.golang.org/protobuf/encoding/protowire" - - "github.com/irisnet/irishub-sdk-go/codec/types" -) - -const bit11NonCritical = 1 << 10 - -type descriptorIface interface { - Descriptor() ([]byte, []int) -} - -// RejectUnknownFieldsStrict rejects any bytes bz with an error that has unknown fields for the provided proto.Message type. -// This function traverses inside of messages nested via google.protobuf.Any. It does not do any deserialization of the proto.Message. -func RejectUnknownFieldsStrict(bz []byte, msg proto.Message) error { - _, err := RejectUnknownFields(bz, msg, false) - return err -} - -// RejectUnknownFields rejects any bytes bz with an error that has unknown fields for the provided proto.Message type with an -// option to allow non-critical fields (specified as those fields with bit 11) to pass through. In either case, the -// hasUnknownNonCriticals will be set to true if non-critical fields were encountered during traversal. This flag can be -// used to treat a message with non-critical field different in different security contexts (such as transaction signing). -// This function traverses inside of messages nested via google.protobuf.Any. It does not do any deserialization of the proto.Message. -func RejectUnknownFields(bz []byte, msg proto.Message, allowUnknownNonCriticals bool) (hasUnknownNonCriticals bool, err error) { - if len(bz) == 0 { - return hasUnknownNonCriticals, nil - } - - desc, ok := msg.(descriptorIface) - if !ok { - return hasUnknownNonCriticals, fmt.Errorf("%T does not have a Descriptor() method", msg) - } - - fieldDescProtoFromTagNum, _, err := getDescriptorInfo(desc, msg) - if err != nil { - return hasUnknownNonCriticals, err - } - - for len(bz) > 0 { - tagNum, wireType, m := protowire.ConsumeTag(bz) - if m < 0 { - return hasUnknownNonCriticals, errors.New("invalid length") - } - - fieldDescProto, ok := fieldDescProtoFromTagNum[int32(tagNum)] - switch { - case ok: - // Assert that the wireTypes match. - if !canEncodeType(wireType, fieldDescProto.GetType()) { - return hasUnknownNonCriticals, &errMismatchedWireType{ - Type: reflect.ValueOf(msg).Type().String(), - TagNum: tagNum, - GotWireType: wireType, - WantWireType: protowire.Type(fieldDescProto.WireType()), - } - } - - default: - isCriticalField := tagNum&bit11NonCritical == 0 - - if !isCriticalField { - hasUnknownNonCriticals = true - } - - if isCriticalField || !allowUnknownNonCriticals { - // The tag is critical, so report it. - return hasUnknownNonCriticals, &errUnknownField{ - Type: reflect.ValueOf(msg).Type().String(), - TagNum: tagNum, - WireType: wireType, - } - } - } - - // Skip over the bytes that store fieldNumber and wireType bytes. - bz = bz[m:] - n := protowire.ConsumeFieldValue(tagNum, wireType, bz) - fieldBytes := bz[:n] - bz = bz[n:] - - // An unknown but non-critical field or just a scalar type (aka *INT and BYTES like). - if fieldDescProto == nil || fieldDescProto.IsScalar() { - continue - } - - protoMessageName := fieldDescProto.GetTypeName() - if protoMessageName == "" { - switch typ := fieldDescProto.GetType(); typ { - case descriptor.FieldDescriptorProto_TYPE_STRING, descriptor.FieldDescriptorProto_TYPE_BYTES: - // At this point only TYPE_STRING is expected to be unregistered, since FieldDescriptorProto.IsScalar() returns false for - // TYPE_BYTES and TYPE_STRING as per - // https://github.com/gogo/protobuf/blob/5628607bb4c51c3157aacc3a50f0ab707582b805/protoc-gen-gogo/descriptor/descriptor.go#L95-L118 - default: - return hasUnknownNonCriticals, fmt.Errorf("failed to get typename for message of type %v, can only be TYPE_STRING or TYPE_BYTES", typ) - } - continue - } - - // Let's recursively traverse and typecheck the field. - - // consume length prefix of nested message - _, o := protowire.ConsumeVarint(fieldBytes) - fieldBytes = fieldBytes[o:] - - if protoMessageName == ".google.protobuf.Any" { - // Firstly typecheck types.Any to ensure nothing snuck in. - hasUnknownNonCriticalsChild, err := RejectUnknownFields(fieldBytes, (*types.Any)(nil), allowUnknownNonCriticals) - hasUnknownNonCriticals = hasUnknownNonCriticals || hasUnknownNonCriticalsChild - if err != nil { - return hasUnknownNonCriticals, err - } - // And finally we can extract the TypeURL containing the protoMessageName. - any := new(types.Any) - if err := proto.Unmarshal(fieldBytes, any); err != nil { - return hasUnknownNonCriticals, err - } - protoMessageName = any.TypeUrl - fieldBytes = any.Value - } - - msg, err := protoMessageForTypeName(protoMessageName[1:]) - if err != nil { - return hasUnknownNonCriticals, err - } - - hasUnknownNonCriticalsChild, err := RejectUnknownFields(fieldBytes, msg, allowUnknownNonCriticals) - hasUnknownNonCriticals = hasUnknownNonCriticals || hasUnknownNonCriticalsChild - if err != nil { - return hasUnknownNonCriticals, err - } - } - - return hasUnknownNonCriticals, nil -} - -var protoMessageForTypeNameMu sync.RWMutex -var protoMessageForTypeNameCache = make(map[string]proto.Message) - -// protoMessageForTypeName takes in a fully qualified name e.g. testdata.TestVersionFD1 -// and returns a corresponding empty protobuf message that serves the prototype for typechecking. -func protoMessageForTypeName(protoMessageName string) (proto.Message, error) { - protoMessageForTypeNameMu.RLock() - msg, ok := protoMessageForTypeNameCache[protoMessageName] - protoMessageForTypeNameMu.RUnlock() - if ok { - return msg, nil - } - - concreteGoType := proto.MessageType(protoMessageName) - if concreteGoType == nil { - return nil, fmt.Errorf("failed to retrieve the message of type %q", protoMessageName) - } - - value := reflect.New(concreteGoType).Elem() - msg, ok = value.Interface().(proto.Message) - if !ok { - return nil, fmt.Errorf("%q does not implement proto.Message", protoMessageName) - } - - // Now cache it. - protoMessageForTypeNameMu.Lock() - protoMessageForTypeNameCache[protoMessageName] = msg - protoMessageForTypeNameMu.Unlock() - - return msg, nil -} - -// checks is a mapping of protowire.Type to supported descriptor.FieldDescriptorProto_Type. -// it is implemented this way so as to have constant time lookups and avoid the overhead -// from O(n) walking of switch. The change to using this mapping boosts throughput by about 200%. -var checks = [...]map[descriptor.FieldDescriptorProto_Type]bool{ - // "0 Varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum" - 0: { - descriptor.FieldDescriptorProto_TYPE_INT32: true, - descriptor.FieldDescriptorProto_TYPE_INT64: true, - descriptor.FieldDescriptorProto_TYPE_UINT32: true, - descriptor.FieldDescriptorProto_TYPE_UINT64: true, - descriptor.FieldDescriptorProto_TYPE_SINT32: true, - descriptor.FieldDescriptorProto_TYPE_SINT64: true, - descriptor.FieldDescriptorProto_TYPE_BOOL: true, - descriptor.FieldDescriptorProto_TYPE_ENUM: true, - }, - - // "1 64-bit: fixed64, sfixed64, double" - 1: { - descriptor.FieldDescriptorProto_TYPE_FIXED64: true, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: true, - descriptor.FieldDescriptorProto_TYPE_DOUBLE: true, - }, - - // "2 Length-delimited: string, bytes, embedded messages, packed repeated fields" - 2: { - descriptor.FieldDescriptorProto_TYPE_STRING: true, - descriptor.FieldDescriptorProto_TYPE_BYTES: true, - descriptor.FieldDescriptorProto_TYPE_MESSAGE: true, - // The following types can be packed repeated. - // ref: "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed"." - // ref: https://developers.google.com/protocol-buffers/docs/encoding#packed - descriptor.FieldDescriptorProto_TYPE_INT32: true, - descriptor.FieldDescriptorProto_TYPE_INT64: true, - descriptor.FieldDescriptorProto_TYPE_UINT32: true, - descriptor.FieldDescriptorProto_TYPE_UINT64: true, - descriptor.FieldDescriptorProto_TYPE_SINT32: true, - descriptor.FieldDescriptorProto_TYPE_SINT64: true, - descriptor.FieldDescriptorProto_TYPE_BOOL: true, - descriptor.FieldDescriptorProto_TYPE_ENUM: true, - descriptor.FieldDescriptorProto_TYPE_FIXED64: true, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: true, - descriptor.FieldDescriptorProto_TYPE_DOUBLE: true, - }, - - // "3 Start group: groups (deprecated)" - 3: { - descriptor.FieldDescriptorProto_TYPE_GROUP: true, - }, - - // "4 End group: groups (deprecated)" - 4: { - descriptor.FieldDescriptorProto_TYPE_GROUP: true, - }, - - // "5 32-bit: fixed32, sfixed32, float" - 5: { - descriptor.FieldDescriptorProto_TYPE_FIXED32: true, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: true, - descriptor.FieldDescriptorProto_TYPE_FLOAT: true, - }, -} - -// canEncodeType returns true if the wireType is suitable for encoding the descriptor type. -// See https://developers.google.com/protocol-buffers/docs/encoding#structure. -func canEncodeType(wireType protowire.Type, descType descriptor.FieldDescriptorProto_Type) bool { - if iwt := int(wireType); iwt < 0 || iwt >= len(checks) { - return false - } - return checks[wireType][descType] -} - -// errMismatchedWireType describes a mismatch between -// expected and got wireTypes for a specific tag number. -type errMismatchedWireType struct { - Type string - GotWireType protowire.Type - WantWireType protowire.Type - TagNum protowire.Number -} - -// String implements fmt.Stringer. -func (mwt *errMismatchedWireType) String() string { - return fmt.Sprintf("Mismatched %q: {TagNum: %d, GotWireType: %q != WantWireType: %q}", - mwt.Type, mwt.TagNum, wireTypeToString(mwt.GotWireType), wireTypeToString(mwt.WantWireType)) -} - -// Error implements the error interface. -func (mwt *errMismatchedWireType) Error() string { - return mwt.String() -} - -var _ error = (*errMismatchedWireType)(nil) - -func wireTypeToString(wt protowire.Type) string { - switch wt { - case 0: - return "varint" - case 1: - return "fixed64" - case 2: - return "bytes" - case 3: - return "start_group" - case 4: - return "end_group" - case 5: - return "fixed32" - default: - return fmt.Sprintf("unknown type: %d", wt) - } -} - -// errUnknownField represents an error indicating that we encountered -// a field that isn't available in the target proto.Message. -type errUnknownField struct { - Type string - TagNum protowire.Number - WireType protowire.Type -} - -// String implements fmt.Stringer. -func (twt *errUnknownField) String() string { - return fmt.Sprintf("errUnknownField %q: {TagNum: %d, WireType:%q}", - twt.Type, twt.TagNum, wireTypeToString(twt.WireType)) -} - -// Error implements the error interface. -func (twt *errUnknownField) Error() string { - return twt.String() -} - -var _ error = (*errUnknownField)(nil) - -var ( - protoFileToDesc = make(map[string]*descriptor.FileDescriptorProto) - protoFileToDescMu sync.RWMutex -) - -func unnestDesc(mdescs []*descriptor.DescriptorProto, indices []int) *descriptor.DescriptorProto { - mdesc := mdescs[indices[0]] - for _, index := range indices[1:] { - mdesc = mdesc.NestedType[index] - } - return mdesc -} - -// Invoking descriptor.ForMessage(proto.Message.(Descriptor).Descriptor()) is incredibly slow -// for every single message, thus the need for a hand-rolled custom version that's performant and cacheable. -func extractFileDescMessageDesc(desc descriptorIface) (*descriptor.FileDescriptorProto, *descriptor.DescriptorProto, error) { - gzippedPb, indices := desc.Descriptor() - - protoFileToDescMu.RLock() - cached, ok := protoFileToDesc[string(gzippedPb)] - protoFileToDescMu.RUnlock() - - if ok { - return cached, unnestDesc(cached.MessageType, indices), nil - } - - // Time to gunzip the content of the FileDescriptor and then proto unmarshal them. - gzr, err := gzip.NewReader(bytes.NewReader(gzippedPb)) - if err != nil { - return nil, nil, err - } - protoBlob, err := ioutil.ReadAll(gzr) - if err != nil { - return nil, nil, err - } - - fdesc := new(descriptor.FileDescriptorProto) - if err := proto.Unmarshal(protoBlob, fdesc); err != nil { - return nil, nil, err - } - - // Now cache the FileDescriptor. - protoFileToDescMu.Lock() - protoFileToDesc[string(gzippedPb)] = fdesc - protoFileToDescMu.Unlock() - - // Unnest the type if necessary. - return fdesc, unnestDesc(fdesc.MessageType, indices), nil -} - -type descriptorMatch struct { - cache map[int32]*descriptor.FieldDescriptorProto - desc *descriptor.DescriptorProto -} - -var descprotoCacheMu sync.RWMutex -var descprotoCache = make(map[reflect.Type]*descriptorMatch) - -// getDescriptorInfo retrieves the mapping of field numbers to their respective field descriptors. -func getDescriptorInfo(desc descriptorIface, msg proto.Message) (map[int32]*descriptor.FieldDescriptorProto, *descriptor.DescriptorProto, error) { - key := reflect.ValueOf(msg).Type() - - descprotoCacheMu.RLock() - got, ok := descprotoCache[key] - descprotoCacheMu.RUnlock() - - if ok { - return got.cache, got.desc, nil - } - - // Now compute and cache the index. - _, md, err := extractFileDescMessageDesc(desc) - if err != nil { - return nil, nil, err - } - - tagNumToTypeIndex := make(map[int32]*descriptor.FieldDescriptorProto) - for _, field := range md.Field { - tagNumToTypeIndex[field.GetNumber()] = field - } - - descprotoCacheMu.Lock() - descprotoCache[key] = &descriptorMatch{ - cache: tagNumToTypeIndex, - desc: md, - } - descprotoCacheMu.Unlock() - - return tagNumToTypeIndex, md, nil -} diff --git a/core-sdk/client/account.go b/core-sdk/client/account.go index 1b689d36..a11a43cc 100644 --- a/core-sdk/client/account.go +++ b/core-sdk/client/account.go @@ -43,7 +43,7 @@ func (a accountQuery) QueryAndRefreshAccount(address string) (sdk.BaseAccount, s func (a accountQuery) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { conn, err := a.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return sdk.BaseAccount{}, sdk.Wrap(err) } diff --git a/core-sdk/client/grpc_client.go b/core-sdk/client/grpc_client.go index 318d65ce..1c46901c 100644 --- a/core-sdk/client/grpc_client.go +++ b/core-sdk/client/grpc_client.go @@ -1,17 +1,43 @@ package client import ( + "github.com/irisnet/core-sdk-go/types" + "github.com/prometheus/common/log" "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" + "sync" + "time" ) +var clientConnSingleton *grpc.ClientConn +var once sync.Once + type grpcClient struct { - url string } -func NewGRPCClient(url string) grpcClient { - return grpcClient{url: url} +func NewGRPCClient(url string) types.GRPCClient { + once.Do(func() { + var kacp = keepalive.ClientParameters{ + Time: 10 * time.Second, // send pings every 10 seconds if there is no activity + Timeout: time.Second, // wait 1 second for ping ack before considering the connection dead + PermitWithoutStream: true, // send pings even without active streams + } + + dialOpts := []grpc.DialOption{ + grpc.WithInsecure(), + grpc.WithKeepaliveParams(kacp), + } + clientConn, err := grpc.Dial(url, dialOpts...) + if err != nil { + log.Error(err.Error()) + panic(err) + } + clientConnSingleton = clientConn + }) + + return &grpcClient{} } func (g grpcClient) GenConn() (*grpc.ClientConn, error) { - return grpc.Dial(g.url, grpc.WithInsecure()) + return clientConnSingleton, nil } diff --git a/core-sdk/go.mod b/core-sdk/go.mod index 366b5b4c..ec956250 100644 --- a/core-sdk/go.mod +++ b/core-sdk/go.mod @@ -13,6 +13,7 @@ require ( github.com/magiconair/properties v1.8.1 github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 + github.com/prometheus/common v0.14.0 // indirect github.com/regen-network/cosmos-proto v0.3.1 github.com/sirupsen/logrus v1.6.0 github.com/stretchr/testify v1.7.0 diff --git a/core-sdk/go.sum b/core-sdk/go.sum index 35bc02e2..8226f61b 100644 --- a/core-sdk/go.sum +++ b/core-sdk/go.sum @@ -29,9 +29,11 @@ github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3 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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -741,6 +743,7 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/crypto/armor.go b/crypto/armor.go deleted file mode 100644 index ab526ff3..00000000 --- a/crypto/armor.go +++ /dev/null @@ -1,210 +0,0 @@ -package crypto - -import ( - "encoding/hex" - "fmt" - - "github.com/pkg/errors" - - "github.com/tendermint/crypto/bcrypt" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/armor" - "github.com/tendermint/tendermint/crypto/xsalsa20symmetric" - - "github.com/irisnet/irishub-sdk-go/codec/legacy" - cryptoAmino "github.com/irisnet/irishub-sdk-go/crypto/codec" -) - -const ( - blockTypePrivKey = "TENDERMINT PRIVATE KEY" - blockTypeKeyInfo = "TENDERMINT KEY INFO" - blockTypePubKey = "TENDERMINT PUBLIC KEY" - - defaultAlgo = "secp256k1" - - headerVersion = "version" - headerType = "type" -) - -// BcryptSecurityParameter is security parameter var, and it can be changed within the lcd test. -// Making the bcrypt security parameter a var shouldn't be a security issue: -// One can't verify an invalid key by maliciously changing the bcrypt -// parameter during a runtime vulnerability. The main security -// threat this then exposes would be something that changes this during -// runtime before the user creates their key. This vulnerability must -// succeed to update this to that same value before every subsequent call -// to the keys command in future startups / or the attacker must get access -// to the filesystem. However, with a similar threat model (changing -// variables in runtime), one can cause the user to sign a different tx -// than what they see, which is a significantly cheaper attack then breaking -// a bcrypt hash. (Recall that the nonce still exists to break rainbow tables) -// For further notes on security parameter choice, see README.md -var BcryptSecurityParameter = 12 - -//----------------------------------------------------------------- -// add armor - -// Armor the InfoBytes -func ArmorInfoBytes(bz []byte) string { - header := map[string]string{ - headerType: "Info", - headerVersion: "0.0.0", - } - - return armor.EncodeArmor(blockTypeKeyInfo, header, bz) -} - -// Armor the PubKeyBytes -func ArmorPubKeyBytes(bz []byte, algo string) string { - header := map[string]string{ - headerVersion: "0.0.1", - } - if algo != "" { - header[headerType] = algo - } - - return armor.EncodeArmor(blockTypePubKey, header, bz) -} - -//----------------------------------------------------------------- -// remove armor - -// Unarmor the InfoBytes -func UnarmorInfoBytes(armorStr string) ([]byte, error) { - bz, header, err := unarmorBytes(armorStr, blockTypeKeyInfo) - if err != nil { - return nil, err - } - - if header[headerVersion] != "0.0.0" { - return nil, fmt.Errorf("unrecognized version: %v", header[headerVersion]) - } - - return bz, nil -} - -// UnarmorPubKeyBytes returns the pubkey byte slice, a string of the algo type, and an error -func UnarmorPubKeyBytes(armorStr string) (bz []byte, algo string, err error) { - bz, header, err := unarmorBytes(armorStr, blockTypePubKey) - if err != nil { - return nil, "", fmt.Errorf("couldn't unarmor bytes: %v", err) - } - - switch header[headerVersion] { - case "0.0.0": - return bz, defaultAlgo, err - case "0.0.1": - if header[headerType] == "" { - header[headerType] = defaultAlgo - } - - return bz, header[headerType], err - case "": - return nil, "", fmt.Errorf("header's version field is empty") - default: - err = fmt.Errorf("unrecognized version: %v", header[headerVersion]) - return nil, "", err - } -} - -func unarmorBytes(armorStr, blockType string) (bz []byte, header map[string]string, err error) { - bType, header, bz, err := armor.DecodeArmor(armorStr) - if err != nil { - return - } - - if bType != blockType { - err = fmt.Errorf("unrecognized armor type %q, expected: %q", bType, blockType) - return - } - - return -} - -//----------------------------------------------------------------- -// encrypt/decrypt with armor - -// Encrypt and armor the private key. -func EncryptArmorPrivKey(privKey crypto.PrivKey, passphrase string, algo string) string { - saltBytes, encBytes := encryptPrivKey(privKey, passphrase) - header := map[string]string{ - "kdf": "bcrypt", - "salt": fmt.Sprintf("%X", saltBytes), - } - - if algo != "" { - header[headerType] = algo - } - - armorStr := armor.EncodeArmor(blockTypePrivKey, header, encBytes) - - return armorStr -} - -// encrypt the given privKey with the passphrase using a randomly -// generated salt and the xsalsa20 cipher. returns the salt and the -// encrypted priv key. -func encryptPrivKey(privKey crypto.PrivKey, passphrase string) (saltBytes []byte, encBytes []byte) { - saltBytes = crypto.CRandBytes(16) - key, err := bcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter) - - if err != nil { - panic(errors.Wrap(err, "error generating bcrypt key from passphrase")) - } - - key = crypto.Sha256(key) // get 32 bytes - privKeyBytes := legacy.Cdc.Amino.MustMarshalBinaryBare(privKey) - - return saltBytes, xsalsa20symmetric.EncryptSymmetric(privKeyBytes, key) -} - -// UnarmorDecryptPrivKey returns the privkey byte slice, a string of the algo type, and an error -func UnarmorDecryptPrivKey(armorStr string, passphrase string) (privKey crypto.PrivKey, algo string, err error) { - blockType, header, encBytes, err := armor.DecodeArmor(armorStr) - if err != nil { - return privKey, "", err - } - - if blockType != blockTypePrivKey { - return privKey, "", fmt.Errorf("unrecognized armor type: %v", blockType) - } - - if header["kdf"] != "bcrypt" { - return privKey, "", fmt.Errorf("unrecognized KDF type: %v", header["kdf"]) - } - - if header["salt"] == "" { - return privKey, "", fmt.Errorf("missing salt bytes") - } - - saltBytes, err := hex.DecodeString(header["salt"]) - if err != nil { - return privKey, "", fmt.Errorf("error decoding salt: %v", err.Error()) - } - - privKey, err = decryptPrivKey(saltBytes, encBytes, passphrase) - - if header[headerType] == "" { - header[headerType] = defaultAlgo - } - - return privKey, header[headerType], err -} - -func decryptPrivKey(saltBytes []byte, encBytes []byte, passphrase string) (privKey crypto.PrivKey, err error) { - key, err := bcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter) - if err != nil { - return privKey, errors.Wrap(err, "error generating bcrypt key from passphrase") - } - - key = crypto.Sha256(key) // Get 32 bytes - - privKeyBytes, err := xsalsa20symmetric.DecryptSymmetric(encBytes, key) - if err != nil && err.Error() == "Ciphertext decryption failed" { - return privKey, errors.New("wrong password") - } else if err != nil { - return privKey, err - } - - return cryptoAmino.PrivKeyFromBytes(privKeyBytes) -} diff --git a/crypto/codec/amino.go b/crypto/codec/amino.go deleted file mode 100644 index bf6a773a..00000000 --- a/crypto/codec/amino.go +++ /dev/null @@ -1,59 +0,0 @@ -package codec - -import ( - "github.com/tendermint/tendermint/crypto" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/sr25519" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/crypto/keys/ed25519" - kmultisig "github.com/irisnet/irishub-sdk-go/crypto/keys/multisig" - "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/irishub-sdk-go/crypto/types" -) - -var amino *codec.LegacyAmino - -func init() { - amino = codec.NewLegacyAmino() - RegisterCrypto(amino) -} - -// RegisterCrypto registers all crypto dependency types with the provided Amino codec. -func RegisterCrypto(cdc *codec.LegacyAmino) { - cdc.RegisterInterface((*crypto.PubKey)(nil), nil) - cdc.RegisterInterface((*cryptotypes.PubKey)(nil), nil) - cdc.RegisterConcrete(sr25519.PubKey{}, sr25519.PubKeyName, nil) - - cdc.RegisterConcrete(tmed25519.PubKey{}, tmed25519.PubKeyName, nil) - cdc.RegisterConcrete(&ed25519.PubKey{}, ed25519.PubKeyName, nil) - cdc.RegisterConcrete(&secp256k1.PubKey{}, secp256k1.PubKeyName, nil) - cdc.RegisterConcrete(&kmultisig.LegacyAminoPubKey{}, kmultisig.PubKeyAminoRoute, nil) - - cdc.RegisterInterface((*crypto.PrivKey)(nil), nil) - cdc.RegisterConcrete(sr25519.PrivKey{}, sr25519.PrivKeyName, nil) - - cdc.RegisterConcrete(tmed25519.PrivKey{}, tmed25519.PrivKeyName, nil) - cdc.RegisterConcrete(&ed25519.PrivKey{}, ed25519.PrivKeyName, nil) - cdc.RegisterConcrete(&secp256k1.PrivKey{}, secp256k1.PrivKeyName, nil) -} - -// PrivKeyFromBytes unmarshals private key bytes and returns a PrivKey -func PrivKeyFromBytes(privKeyBytes []byte) (privKey crypto.PrivKey, err error) { - err = amino.UnmarshalBinaryBare(privKeyBytes, &privKey) - return -} - -// PubKeyFromBytes unmarshals public key bytes and returns a PubKey -func PubKeyFromBytes(pubKeyBytes []byte) (pubKey crypto.PubKey, err error) { - err = amino.UnmarshalBinaryBare(pubKeyBytes, &pubKey) - return -} - -func MarshalPubkey(pubkey crypto.PubKey) []byte { - return amino.MustMarshalBinaryBare(pubkey) -} - -func MarshalPrivKey(privKey crypto.PrivKey) []byte { - return amino.MustMarshalBinaryBare(privKey) -} diff --git a/crypto/codec/proto.go b/crypto/codec/proto.go deleted file mode 100644 index 3c8aa253..00000000 --- a/crypto/codec/proto.go +++ /dev/null @@ -1,27 +0,0 @@ -package codec - -import ( - tmcrypto "github.com/tendermint/tendermint/crypto" - - codectypes "github.com/irisnet/irishub-sdk-go/codec/types" - "github.com/irisnet/irishub-sdk-go/crypto/keys/ed25519" - "github.com/irisnet/irishub-sdk-go/crypto/keys/multisig" - "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/irishub-sdk-go/crypto/types" -) - -// RegisterInterfaces registers the sdk.Tx interface. -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - // TODO We now register both Tendermint's PubKey and our own PubKey. In the - // long-term, we should move away from Tendermint's PubKey, and delete - // these lines. - registry.RegisterInterface("tendermint.crypto.Pubkey", (*tmcrypto.PubKey)(nil)) - registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &ed25519.PubKey{}) - registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &secp256k1.PubKey{}) - registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &multisig.LegacyAminoPubKey{}) - - registry.RegisterInterface("cosmos.crypto.Pubkey", (*cryptotypes.PubKey)(nil)) - registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &ed25519.PubKey{}) - registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{}) - registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &multisig.LegacyAminoPubKey{}) -} diff --git a/crypto/hd/algo.go b/crypto/hd/algo.go deleted file mode 100644 index e7bae8f3..00000000 --- a/crypto/hd/algo.go +++ /dev/null @@ -1,88 +0,0 @@ -package hd - -import ( - "fmt" - - bip39 "github.com/cosmos/go-bip39" - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1" -) - -type SignatureAlgo interface { - Name() PubKeyType - Derive() DeriveFn - Generate() GenerateFn -} - -func NewSigningAlgoFromString(str string) (SignatureAlgo, error) { - switch str { - case string(Secp256k1.Name()): - return Secp256k1, nil - default: - return nil, fmt.Errorf("provided algorithm `%s` is not supported", str) - } -} - -// PubKeyType defines an algorithm to derive key-pairs which can be used for cryptographic signing. -type PubKeyType string - -const ( - // MultiType implies that a pubkey is a multisignature - MultiType = PubKeyType("multi") - // Secp256k1Type uses the Bitcoin secp256k1 ECDSA parameters. - Secp256k1Type = PubKeyType("secp256k1") - // Ed25519Type represents the Ed25519Type signature system. - // It is currently not supported for end-user keys (wallets/ledgers). - Ed25519Type = PubKeyType("ed25519") - // Sr25519Type represents the Sr25519Type signature system. - Sr25519Type = PubKeyType("sr25519") -) - -var ( - // Secp256k1 uses the Bitcoin secp256k1 ECDSA parameters. - Secp256k1 = secp256k1Algo{} -) - -type DeriveFn func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) -type GenerateFn func(bz []byte) crypto.PrivKey - -type WalletGenerator interface { - Derive(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) - Generate(bz []byte) crypto.PrivKey -} - -type secp256k1Algo struct { -} - -func (s secp256k1Algo) Name() PubKeyType { - return Secp256k1Type -} - -// Derive derives and returns the secp256k1 private key for the given seed and HD path. -func (s secp256k1Algo) Derive() DeriveFn { - return func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) { - seed, err := bip39.NewSeedWithErrorChecking(mnemonic, bip39Passphrase) - if err != nil { - return nil, err - } - - masterPriv, ch := ComputeMastersFromSeed(seed) - if len(hdPath) == 0 { - return masterPriv[:], nil - } - derivedKey, err := DerivePrivateKeyForPath(masterPriv, ch, hdPath) - - return derivedKey, err - } -} - -// Generate generates a secp256k1 private key from the given bytes. -func (s secp256k1Algo) Generate() GenerateFn { - return func(bz []byte) crypto.PrivKey { - var bzArr = make([]byte, secp256k1.PrivKeySize) - copy(bzArr, bz) - - return &secp256k1.PrivKey{Key: bzArr} - } -} diff --git a/crypto/hd/hdpath.go b/crypto/hd/hdpath.go deleted file mode 100644 index f80e53ca..00000000 --- a/crypto/hd/hdpath.go +++ /dev/null @@ -1,267 +0,0 @@ -package hd - -import ( - "crypto/hmac" - "crypto/sha512" - "encoding/binary" - "fmt" - "math/big" - "strconv" - "strings" - - "github.com/btcsuite/btcd/btcec" -) - -const ( - BIP44Prefix = "44'/118'/" - PartialPath = "0'/0/0" - FullPath = BIP44Prefix + PartialPath -) - -// BIP44Params wraps BIP 44 params (5 level BIP 32 path). -// To receive a canonical string representation ala -// m / purpose' / coinType' / account' / change / addressIndex -// call String() on a BIP44Params instance. -type BIP44Params struct { - Purpose uint32 `json:"purpose"` - CoinType uint32 `json:"coinType"` - Account uint32 `json:"account"` - Change bool `json:"change"` - AddressIndex uint32 `json:"addressIndex"` -} - -// NewParams creates a BIP 44 parameter object from the params: -// m / purpose' / coinType' / account' / change / addressIndex -func NewParams(purpose, coinType, account uint32, change bool, addressIdx uint32) *BIP44Params { - return &BIP44Params{ - Purpose: purpose, - CoinType: coinType, - Account: account, - Change: change, - AddressIndex: addressIdx, - } -} - -// Parse the BIP44 path and unmarshal into the struct. -func NewParamsFromPath(path string) (*BIP44Params, error) { - spl := strings.Split(path, "/") - if len(spl) != 5 { - return nil, fmt.Errorf("path length is wrong. Expected 5, got %d", len(spl)) - } - - // Check items can be parsed - purpose, err := hardenedInt(spl[0]) - if err != nil { - return nil, err - } - - coinType, err := hardenedInt(spl[1]) - if err != nil { - return nil, err - } - - account, err := hardenedInt(spl[2]) - if err != nil { - return nil, err - } - - change, err := hardenedInt(spl[3]) - if err != nil { - return nil, err - } - - addressIdx, err := hardenedInt(spl[4]) - if err != nil { - return nil, err - } - - // Confirm valid values - if spl[0] != "44'" { - return nil, fmt.Errorf("first field in path must be 44', got %v", spl[0]) - } - - if !isHardened(spl[1]) || !isHardened(spl[2]) { - return nil, - fmt.Errorf("second and third field in path must be hardened (ie. contain the suffix ', got %v and %v", spl[1], spl[2]) - } - - if isHardened(spl[3]) || isHardened(spl[4]) { - return nil, - fmt.Errorf("fourth and fifth field in path must not be hardened (ie. not contain the suffix ', got %v and %v", spl[3], spl[4]) - } - - if !(change == 0 || change == 1) { - return nil, fmt.Errorf("change field can only be 0 or 1") - } - - return &BIP44Params{ - Purpose: purpose, - CoinType: coinType, - Account: account, - Change: change > 0, - AddressIndex: addressIdx, - }, nil -} - -func hardenedInt(field string) (uint32, error) { - field = strings.TrimSuffix(field, "'") - - i, err := strconv.ParseUint(field, 10, 32) - if err != nil { - return 0, err - } - - return uint32(i), nil -} - -func isHardened(field string) bool { - return strings.HasSuffix(field, "'") -} - -// NewFundraiserParams creates a BIP 44 parameter object from the params: -// m / 44' / coinType' / account' / 0 / address_index -// The fixed parameters (purpose', coin_type', and change) are determined by what was used in the fundraiser. -func NewFundraiserParams(account, coinType, addressIdx uint32) *BIP44Params { - return NewParams(44, coinType, account, false, addressIdx) -} - -// DerivationPath returns the BIP44 fields as an array. -func (p BIP44Params) DerivationPath() []uint32 { - change := uint32(0) - if p.Change { - change = 1 - } - - return []uint32{ - p.Purpose, - p.CoinType, - p.Account, - change, - p.AddressIndex, - } -} - -func (p BIP44Params) String() string { - var changeStr string - if p.Change { - changeStr = "1" - } else { - changeStr = "0" - } - // m / Purpose' / coin_type' / Account' / Change / address_index - return fmt.Sprintf("%d'/%d'/%d'/%s/%d", - p.Purpose, - p.CoinType, - p.Account, - changeStr, - p.AddressIndex) -} - -// ComputeMastersFromSeed returns the master secret key's, and chain code. -func ComputeMastersFromSeed(seed []byte) (secret [32]byte, chainCode [32]byte) { - curveIdentifier := []byte("Bitcoin seed") - secret, chainCode = i64(curveIdentifier, seed) - - return -} - -// DerivePrivateKeyForPath derives the private key by following the BIP 32/44 path from privKeyBytes, -// using the given chainCode. -func DerivePrivateKeyForPath(privKeyBytes, chainCode [32]byte, path string) ([]byte, error) { - data := privKeyBytes - parts := strings.Split(path, "/") - - for _, part := range parts { - // do we have an apostrophe? - harden := part[len(part)-1:] == "'" - // harden == private derivation, else public derivation: - if harden { - part = part[:len(part)-1] - } - - idx, err := strconv.ParseUint(part, 10, 32) - if err != nil { - return []byte{}, fmt.Errorf("invalid BIP 32 path: %s", err) - } - - data, chainCode = derivePrivateKey(data, chainCode, uint32(idx), harden) - } - - derivedKey := make([]byte, 32) - n := copy(derivedKey, data[:]) - - if n != 32 || len(data) != 32 { - return []byte{}, fmt.Errorf("expected a (secp256k1) key of length 32, got length: %v", len(data)) - } - - return derivedKey, nil -} - -// derivePrivateKey derives the private key with index and chainCode. -// If harden is true, the derivation is 'hardened'. -// It returns the new private key and new chain code. -// For more information on hardened keys see: -// - https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki -func derivePrivateKey(privKeyBytes [32]byte, chainCode [32]byte, index uint32, harden bool) ([32]byte, [32]byte) { - var data []byte - - if harden { - index |= 0x80000000 - - data = append([]byte{byte(0)}, privKeyBytes[:]...) - } else { - // this can't return an error: - _, ecPub := btcec.PrivKeyFromBytes(btcec.S256(), privKeyBytes[:]) - pubkeyBytes := ecPub.SerializeCompressed() - data = pubkeyBytes - - /* By using btcec, we can remove the dependency on tendermint/crypto/secp256k1 - pubkey := secp256k1.PrivKeySecp256k1(privKeyBytes).PubKey() - public := pubkey.(secp256k1.PubKeySecp256k1) - data = public[:] - */ - } - - data = append(data, uint32ToBytes(index)...) - data2, chainCode2 := i64(chainCode[:], data) - x := addScalars(privKeyBytes[:], data2[:]) - - return x, chainCode2 -} - -// modular big endian addition -func addScalars(a []byte, b []byte) [32]byte { - aInt := new(big.Int).SetBytes(a) - bInt := new(big.Int).SetBytes(b) - sInt := new(big.Int).Add(aInt, bInt) - x := sInt.Mod(sInt, btcec.S256().N).Bytes() - x2 := [32]byte{} - copy(x2[32-len(x):], x) - - return x2 -} - -func uint32ToBytes(i uint32) []byte { - b := [4]byte{} - binary.BigEndian.PutUint32(b[:], i) - - return b[:] -} - -// i64 returns the two halfs of the SHA512 HMAC of key and data. -func i64(key []byte, data []byte) (il [32]byte, ir [32]byte) { - mac := hmac.New(sha512.New, key) - // sha512 does not err - _, _ = mac.Write(data) - - I := mac.Sum(nil) - copy(il[:], I[:32]) - copy(ir[:], I[32:]) - - return -} - -// CreateHDPath returns BIP 44 object from account and index parameters. -func CreateHDPath(coinType, account, index uint32) *BIP44Params { - return NewFundraiserParams(account, coinType, index) -} diff --git a/crypto/key_manager.go b/crypto/key_manager.go deleted file mode 100644 index cb484477..00000000 --- a/crypto/key_manager.go +++ /dev/null @@ -1,130 +0,0 @@ -package crypto - -import ( - "fmt" - "strings" - - "github.com/pkg/errors" - - "github.com/tendermint/tendermint/crypto" - - "github.com/cosmos/go-bip39" - - cryptoAmino "github.com/irisnet/irishub-sdk-go/crypto/codec" - "github.com/irisnet/irishub-sdk-go/crypto/hd" -) - -const ( - defaultBIP39Passphrase = "" -) - -type KeyManager interface { - Generate() (string, crypto.PrivKey) - Sign(data []byte) ([]byte, error) - - ExportPrivKey(password string) (armor string, err error) - ImportPrivKey(armor, passphrase string) (crypto.PrivKey, string, error) - - ExportPubKey() crypto.PubKey -} - -type keyManager struct { - privKey crypto.PrivKey - mnemonic, algo string -} - -func NewKeyManager() KeyManager { - return &keyManager{} -} - -func NewAlgoKeyManager(algo string) (KeyManager, error) { - entropy, err := bip39.NewEntropy(256) - if err != nil { - return nil, err - } - mnemonic, err := bip39.NewMnemonic(entropy) - if err != nil { - return nil, err - } - return NewMnemonicKeyManager(mnemonic, algo) -} - -func NewMnemonicKeyManager(mnemonic string, algo string) (KeyManager, error) { - k := keyManager{ - mnemonic: mnemonic, - algo: algo, - } - err := k.recoveryFromMnemonic(mnemonic, hd.FullPath, algo) - return &k, err -} - -func NewMnemonicKeyManagerWithHDPath(mnemonic, algo, hdPath string) (KeyManager, error) { - k := keyManager{ - mnemonic: mnemonic, - algo: algo, - } - err := k.recoveryFromMnemonic(mnemonic, hdPath, algo) - return &k, err -} - -func NewPrivateKeyManager(priv []byte, algo string) (KeyManager, error) { - privKey, err := cryptoAmino.PrivKeyFromBytes(priv) - if err != nil { - return nil, errors.Wrap(err, "failed to decrypt private key") - } - k := keyManager{ - privKey: privKey, - algo: algo, - } - return &k, err -} - -func (m *keyManager) Generate() (string, crypto.PrivKey) { - return m.mnemonic, m.privKey -} - -func (m *keyManager) Sign(data []byte) ([]byte, error) { - return m.privKey.Sign(data) -} - -func (m *keyManager) recoveryFromMnemonic(mnemonic, hdPath, algoStr string) error { - words := strings.Split(mnemonic, " ") - if len(words) != 12 && len(words) != 24 { - return fmt.Errorf("mnemonic length should either be 12 or 24") - } - - algo, err := hd.NewSigningAlgoFromString(algoStr) - if err != nil { - return err - } - - // create master key and derive first key for keyring - derivedPriv, err := algo.Derive()(mnemonic, defaultBIP39Passphrase, hdPath) - if err != nil { - return err - } - - privKey := algo.Generate()(derivedPriv) - m.privKey = privKey - m.algo = algoStr - return nil -} - -func (m *keyManager) ExportPrivKey(password string) (armor string, err error) { - return EncryptArmorPrivKey(m.privKey, password, m.algo), nil -} - -func (m *keyManager) ImportPrivKey(armor, passphrase string) (crypto.PrivKey, string, error) { - privKey, algo, err := UnarmorDecryptPrivKey(armor, passphrase) - if err != nil { - return nil, "", errors.Wrap(err, "failed to decrypt private key") - } - - m.privKey = privKey - m.algo = algo - return privKey, algo, nil -} - -func (m *keyManager) ExportPubKey() crypto.PubKey { - return m.privKey.PubKey() -} diff --git a/crypto/key_manager_test.go b/crypto/key_manager_test.go deleted file mode 100644 index 4ca16435..00000000 --- a/crypto/key_manager_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package crypto_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/irisnet/irishub-sdk-go/crypto" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func TestNewMnemonicKeyManager(t *testing.T) { - mnemonic := "nerve leader thank marriage spice task van start piece crowd run hospital control outside cousin romance left choice poet wagon rude climb leisure spring" - - km, err := crypto.NewMnemonicKeyManager(mnemonic, "secp256k1") - assert.NoError(t, err) - - pubKey := km.ExportPubKey() - pubkeyBech32, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pubKey) - assert.NoError(t, err) - assert.Equal(t, "iap1qf6rwt2vpsdx9tcwq03w4dw9udd657u0gmknjd4l0ht699x6npll6hf0ru9", pubkeyBech32) - - address := sdk.AccAddress(pubKey.Address()).String() - assert.Equal(t, "iaa1y9kd9uy7a4qnjp0z5yjx5jhrkv2ycdkzqc0h8z", address) -} diff --git a/crypto/keys/ed25519/ed25519.go b/crypto/keys/ed25519/ed25519.go deleted file mode 100644 index 31e6fb80..00000000 --- a/crypto/keys/ed25519/ed25519.go +++ /dev/null @@ -1,233 +0,0 @@ -package ed25519 - -import ( - "crypto/subtle" - "fmt" - "io" - - "github.com/tendermint/tendermint/crypto" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/tmhash" - "golang.org/x/crypto/ed25519" - - "github.com/irisnet/irishub-sdk-go/codec" - cryptotypes "github.com/irisnet/irishub-sdk-go/crypto/types" -) - -//------------------------------------- - -const ( - PrivKeyName = "cosmos/PrivKeyEd25519" - PubKeyName = "cosmos/PubKeyEd25519" - // PubKeySize is is the size, in bytes, of public keys as used in this package. - PubKeySize = 32 - // PrivKeySize is the size, in bytes, of private keys as used in this package. - PrivKeySize = 64 - // Size of an Edwards25519 signature. Namely the size of a compressed - // Edwards25519 point, and a field element. Both of which are 32 bytes. - SignatureSize = 64 - // SeedSize is the size, in bytes, of private key seeds. These are the - // private key representations used by RFC 8032. - SeedSize = 32 - - keyType = "ed25519" -) - -var _ cryptotypes.PrivKey = &PrivKey{} -var _ codec.AminoMarshaler = &PrivKey{} - -// Bytes returns the privkey byte format. -func (privKey *PrivKey) Bytes() []byte { - return privKey.Key -} - -// Sign produces a signature on the provided message. -// This assumes the privkey is wellformed in the golang format. -// The first 32 bytes should be random, -// corresponding to the normal ed25519 private key. -// The latter 32 bytes should be the compressed public key. -// If these conditions aren't met, Sign will panic or produce an -// incorrect signature. -func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) { - return ed25519.Sign(ed25519.PrivateKey(privKey.Key), msg), nil -} - -// PubKey gets the corresponding public key from the private key. -// -// Panics if the private key is not initialized. -func (privKey *PrivKey) PubKey() crypto.PubKey { - // If the latter 32 bytes of the privkey are all zero, privkey is not - // initialized. - initialized := false - for _, v := range privKey.Key[32:] { - if v != 0 { - initialized = true - break - } - } - - if !initialized { - panic("Expected ed25519 PrivKey to include concatenated pubkey bytes") - } - - pubkeyBytes := make([]byte, PubKeySize) - copy(pubkeyBytes, privKey.Key[32:]) - return &PubKey{Key: pubkeyBytes} -} - -// Equals - you probably don't need to use this. -// Runs in constant time based on length of the keys. -func (privKey *PrivKey) Equals(other crypto.PrivKey) bool { - if privKey.Type() != other.Type() { - return false - } - - return subtle.ConstantTimeCompare(privKey.Bytes(), other.Bytes()) == 1 -} - -func (privKey *PrivKey) Type() string { - return keyType -} - -// MarshalAmino overrides Amino binary marshalling. -func (privKey PrivKey) MarshalAmino() ([]byte, error) { - return privKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PrivKeySize { - return fmt.Errorf("invalid privkey size") - } - privKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return privKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { - return privKey.UnmarshalAmino(bz) -} - -// GenPrivKey generates a new ed25519 private key. -// It uses OS randomness in conjunction with the current global random seed -// in tendermint/libs/common to generate the private key. -func GenPrivKey() *PrivKey { - return genPrivKey(crypto.CReader()) -} - -// genPrivKey generates a new ed25519 private key using the provided reader. -func genPrivKey(rand io.Reader) *PrivKey { - seed := make([]byte, SeedSize) - - _, err := io.ReadFull(rand, seed) - if err != nil { - panic(err) - } - - return &PrivKey{Key: ed25519.NewKeyFromSeed(seed)} -} - -// GenPrivKeyFromSecret hashes the secret with SHA2, and uses -// that 32 byte output to create the private key. -// NOTE: secret should be the output of a KDF like bcrypt, -// if it's derived from user input. -func GenPrivKeyFromSecret(secret []byte) *PrivKey { - seed := crypto.Sha256(secret) // Not Ripemd160 because we want 32 bytes. - - return &PrivKey{Key: ed25519.NewKeyFromSeed(seed)} -} - -//------------------------------------- - -var _ cryptotypes.PubKey = &PubKey{} -var _ codec.AminoMarshaler = &PubKey{} -var _ cryptotypes.IntoTmPubKey = &PubKey{} - -// Address is the SHA256-20 of the raw pubkey bytes. -func (pubKey *PubKey) Address() crypto.Address { - if len(pubKey.Key) != PubKeySize { - panic("pubkey is incorrect size") - } - return crypto.Address(tmhash.SumTruncated(pubKey.Key)) -} - -// Bytes returns the PubKey byte format. -func (pubKey *PubKey) Bytes() []byte { - return pubKey.Key -} - -func (pubKey *PubKey) VerifySignature(msg []byte, sig []byte) bool { - // make sure we use the same algorithm to sign - if len(sig) != SignatureSize { - return false - } - - return ed25519.Verify(ed25519.PublicKey(pubKey.Key), msg, sig) -} - -func (pubKey *PubKey) String() string { - return fmt.Sprintf("PubKeyEd25519{%X}", pubKey.Key) -} - -func (pubKey *PubKey) Type() string { - return keyType -} - -func (pubKey *PubKey) Equals(other crypto.PubKey) bool { - if pubKey.Type() != other.Type() { - return false - } - - return subtle.ConstantTimeCompare(pubKey.Bytes(), other.Bytes()) == 1 -} - -// MarshalAmino overrides Amino binary marshalling. -func (pubKey PubKey) MarshalAmino() ([]byte, error) { - return pubKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PubKeySize { - return fmt.Errorf("invalid pubkey size") - } - pubKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return pubKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { - return pubKey.UnmarshalAmino(bz) -} - -// AsTmPubKey converts our own PubKey into a Tendermint ED25519 pubkey. -func (pubKey *PubKey) AsTmPubKey() crypto.PubKey { - return tmed25519.PubKey(pubKey.Key) -} - -// FromTmEd25519 converts a Tendermint ED25519 pubkey into our own ED25519 -// PubKey. -func FromTmEd25519(pubKey crypto.PubKey) (*PubKey, error) { - tmPk, ok := pubKey.(tmed25519.PubKey) - if !ok { - return nil, fmt.Errorf("expected %T, got %T", tmed25519.PubKey{}, pubKey) - } - - return &PubKey{Key: []byte(tmPk)}, nil -} diff --git a/crypto/keys/ed25519/ed25519_test.go b/crypto/keys/ed25519/ed25519_test.go deleted file mode 100644 index fcb70463..00000000 --- a/crypto/keys/ed25519/ed25519_test.go +++ /dev/null @@ -1,218 +0,0 @@ -package ed25519_test - -import ( - "encoding/base64" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/sr25519" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/crypto/keys/ed25519" - cryptotypes "github.com/irisnet/irishub-sdk-go/crypto/types" -) - -func TestSignAndValidateEd25519(t *testing.T) { - privKey := ed25519.GenPrivKey() - pubKey := privKey.PubKey() - - msg := crypto.CRandBytes(128) - sig, err := privKey.Sign(msg) - require.Nil(t, err) - - // Test the signature - assert.True(t, pubKey.VerifySignature(msg, sig)) - - // Mutate the signature, just one bit. - // TODO: Replace this with a much better fuzzer, tendermint/ed25519/issues/10 - sig[7] ^= byte(0x01) - - assert.False(t, pubKey.VerifySignature(msg, sig)) -} - -func TestPubKeyEquals(t *testing.T) { - ed25519PubKey := ed25519.GenPrivKey().PubKey().(*ed25519.PubKey) - - testCases := []struct { - msg string - pubKey cryptotypes.PubKey - other crypto.PubKey - expectEq bool - }{ - { - "different bytes", - ed25519PubKey, - ed25519.GenPrivKey().PubKey(), - false, - }, - { - "equals", - ed25519PubKey, - &ed25519.PubKey{ - Key: ed25519PubKey.Key, - }, - true, - }, - { - "different types", - ed25519PubKey, - sr25519.GenPrivKey().PubKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.pubKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestPrivKeyEquals(t *testing.T) { - ed25519PrivKey := ed25519.GenPrivKey() - - testCases := []struct { - msg string - privKey cryptotypes.PrivKey - other crypto.PrivKey - expectEq bool - }{ - { - "different bytes", - ed25519PrivKey, - ed25519.GenPrivKey(), - false, - }, - { - "equals", - ed25519PrivKey, - &ed25519.PrivKey{ - Key: ed25519PrivKey.Key, - }, - true, - }, - { - "different types", - ed25519PrivKey, - sr25519.GenPrivKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.privKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestMarshalAmino(t *testing.T) { - aminoCdc := codec.NewLegacyAmino() - privKey := ed25519.GenPrivKey() - pubKey := privKey.PubKey().(*ed25519.PubKey) - - testCases := []struct { - desc string - msg codec.AminoMarshaler - typ interface{} - expBinary []byte - expJSON string - }{ - { - "ed25519 private key", - privKey, - &ed25519.PrivKey{}, - append([]byte{64}, privKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(privKey.Bytes()) + "\"", - }, - { - "ed25519 public key", - pubKey, - &ed25519.PubKey{}, - append([]byte{32}, pubKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(pubKey.Bytes()) + "\"", - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - // Do a round trip of encoding/decoding binary. - bz, err := aminoCdc.MarshalBinaryBare(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expBinary, bz) - - err = aminoCdc.UnmarshalBinaryBare(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - - // Do a round trip of encoding/decoding JSON. - bz, err = aminoCdc.MarshalJSON(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expJSON, string(bz)) - - err = aminoCdc.UnmarshalJSON(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - }) - } -} - -func TestMarshalAmino_BackwardsCompatibility(t *testing.T) { - aminoCdc := codec.NewLegacyAmino() - // Create Tendermint keys. - tmPrivKey := tmed25519.GenPrivKey() - tmPubKey := tmPrivKey.PubKey() - // Create our own keys, with the same private key as Tendermint's. - privKey := &ed25519.PrivKey{Key: []byte(tmPrivKey)} - pubKey := privKey.PubKey().(*ed25519.PubKey) - - testCases := []struct { - desc string - tmKey interface{} - ourKey interface{} - marshalFn func(o interface{}) ([]byte, error) - }{ - { - "ed25519 private key, binary", - tmPrivKey, - privKey, - aminoCdc.MarshalBinaryBare, - }, - { - "ed25519 private key, JSON", - tmPrivKey, - privKey, - aminoCdc.MarshalJSON, - }, - { - "ed25519 public key, binary", - tmPubKey, - pubKey, - aminoCdc.MarshalBinaryBare, - }, - { - "ed25519 public key, JSON", - tmPubKey, - pubKey, - aminoCdc.MarshalJSON, - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - // Make sure Amino encoding override is not breaking backwards compatibility. - bz1, err := tc.marshalFn(tc.tmKey) - require.NoError(t, err) - bz2, err := tc.marshalFn(tc.ourKey) - require.NoError(t, err) - require.Equal(t, bz1, bz2) - }) - } -} diff --git a/crypto/keys/ed25519/keys.pb.go b/crypto/keys/ed25519/keys.pb.go deleted file mode 100644 index f5ed5203..00000000 --- a/crypto/keys/ed25519/keys.pb.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/ed25519/keys.proto - -package ed25519 - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// PubKey defines a ed25519 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -type PubKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_48fe3336771e732d, []int{0} -} -func (m *PubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey.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 *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(m, src) -} -func (m *PubKey) XXX_Size() int { - return m.Size() -} -func (m *PubKey) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey proto.InternalMessageInfo - -func (m *PubKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -// PrivKey defines a ed25519 private key. -type PrivKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PrivKey) Reset() { *m = PrivKey{} } -func (m *PrivKey) String() string { return proto.CompactTextString(m) } -func (*PrivKey) ProtoMessage() {} -func (*PrivKey) Descriptor() ([]byte, []int) { - return fileDescriptor_48fe3336771e732d, []int{1} -} -func (m *PrivKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PrivKey.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 *PrivKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrivKey.Merge(m, src) -} -func (m *PrivKey) XXX_Size() int { - return m.Size() -} -func (m *PrivKey) XXX_DiscardUnknown() { - xxx_messageInfo_PrivKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PrivKey proto.InternalMessageInfo - -func (m *PrivKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func init() { - proto.RegisterType((*PubKey)(nil), "cosmos.crypto.ed25519.PubKey") - proto.RegisterType((*PrivKey)(nil), "cosmos.crypto.ed25519.PrivKey") -} - -func init() { proto.RegisterFile("cosmos/crypto/ed25519/keys.proto", fileDescriptor_48fe3336771e732d) } - -var fileDescriptor_48fe3336771e732d = []byte{ - // 194 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x4f, 0x4d, 0x31, 0x32, 0x35, 0x35, - 0xb4, 0xd4, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0xa8, - 0xd0, 0x83, 0xa8, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd0, 0x07, - 0xb1, 0x20, 0x8a, 0x95, 0x14, 0xb8, 0xd8, 0x02, 0x4a, 0x93, 0xbc, 0x53, 0x2b, 0x85, 0x04, 0xb8, - 0x98, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x40, 0x4c, 0x2b, 0x96, 0x19, - 0x0b, 0xe4, 0x19, 0x94, 0xa4, 0xb9, 0xd8, 0x03, 0x8a, 0x32, 0xcb, 0xb0, 0x2a, 0x71, 0xf2, 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, 0xd3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, - 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xcc, 0xa2, 0xcc, 0xe2, 0xbc, 0xd4, 0x12, 0x30, 0x9d, 0x51, - 0x9a, 0xa4, 0x5b, 0x9c, 0x92, 0xad, 0x9b, 0x9e, 0x0f, 0xf3, 0x02, 0xc8, 0xe9, 0x30, 0x7f, 0x24, - 0xb1, 0x81, 0x9d, 0x65, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xf7, 0x97, 0xb6, 0xe7, 0x00, - 0x00, 0x00, -} - -func (m *PubKey) 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 *PubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PrivKey) 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 *PrivKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { - offset -= sovKeys(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func (m *PrivKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func sovKeys(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKeys(x uint64) (n int) { - return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PubKey) 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 ErrIntOverflowKeys - } - 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: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrivKey) 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 ErrIntOverflowKeys - } - 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: PrivKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrivKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKeys(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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrInvalidLengthKeys - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKeys - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKeys - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") -) diff --git a/crypto/keys/internal/benchmarking/bench.go b/crypto/keys/internal/benchmarking/bench.go deleted file mode 100644 index b74b901d..00000000 --- a/crypto/keys/internal/benchmarking/bench.go +++ /dev/null @@ -1,92 +0,0 @@ -package benchmarking - -import ( - "io" - "testing" - - "github.com/tendermint/tendermint/crypto" -) - -// The code in this file is adapted from agl/ed25519. -// As such it is under the following license. -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found at the bottom of this file. - -type zeroReader struct{} - -func (zeroReader) Read(buf []byte) (int, error) { - for i := range buf { - buf[i] = 0 - } - return len(buf), nil -} - -// BenchmarkKeyGeneration benchmarks the given key generation algorithm using -// a dummy reader. -func BenchmarkKeyGeneration(b *testing.B, generateKey func(reader io.Reader) crypto.PrivKey) { - var zero zeroReader - for i := 0; i < b.N; i++ { - generateKey(zero) - } -} - -// BenchmarkSigning benchmarks the given signing algorithm using -// the provided privkey. -func BenchmarkSigning(b *testing.B, priv crypto.PrivKey) { - message := []byte("Hello, world!") - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := priv.Sign(message) - - if err != nil { - b.FailNow() - } - } -} - -// BenchmarkVerification benchmarks the given verification algorithm using -// the provided privkey on a constant message. -func BenchmarkVerification(b *testing.B, priv crypto.PrivKey) { - pub := priv.PubKey() - // use a short message, so this time doesn't get dominated by hashing. - message := []byte("Hello, world!") - signature, err := priv.Sign(message) - if err != nil { - b.Fatal(err) - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - pub.VerifySignature(message, signature) - } -} - -// Below is the aforementioned license. - -// Copyright (c) 2012 The Go Authors. All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: - -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/crypto/keys/multisig/codec.go b/crypto/keys/multisig/codec.go deleted file mode 100644 index 799e8f4e..00000000 --- a/crypto/keys/multisig/codec.go +++ /dev/null @@ -1,35 +0,0 @@ -package multisig - -import ( - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/sr25519" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/crypto/keys/ed25519" - "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/irishub-sdk-go/crypto/types" -) - -// TODO: Figure out API for others to either add their own pubkey types, or -// to make verify / marshal accept a AminoCdc. -const ( - PubKeyAminoRoute = "tendermint/PubKeyMultisigThreshold" -) - -var AminoCdc = codec.NewLegacyAmino() - -func init() { - // TODO We now register both Tendermint's PubKey and our own PubKey. In the - // long-term, we should move away from Tendermint's PubKey, and delete this - // first line. - AminoCdc.RegisterInterface((*crypto.PubKey)(nil), nil) - AminoCdc.RegisterInterface((*cryptotypes.PubKey)(nil), nil) - AminoCdc.RegisterConcrete(ed25519.PubKey{}, - ed25519.PubKeyName, nil) - AminoCdc.RegisterConcrete(sr25519.PubKey{}, - sr25519.PubKeyName, nil) - AminoCdc.RegisterConcrete(&secp256k1.PubKey{}, - secp256k1.PubKeyName, nil) - AminoCdc.RegisterConcrete(&LegacyAminoPubKey{}, - PubKeyAminoRoute, nil) -} diff --git a/crypto/keys/multisig/keys.pb.go b/crypto/keys/multisig/keys.pb.go deleted file mode 100644 index 0c996eb6..00000000 --- a/crypto/keys/multisig/keys.pb.go +++ /dev/null @@ -1,360 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/multisig/keys.proto - -package multisig - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// LegacyAminoPubKey specifies a public key type -// which nests multiple public keys and a threshold, -// it uses legacy amino address rules. -type LegacyAminoPubKey struct { - Threshold uint32 `protobuf:"varint,1,opt,name=threshold,proto3" json:"threshold,omitempty" yaml:"threshold"` - PubKeys []*types.Any `protobuf:"bytes,2,rep,name=public_keys,json=publicKeys,proto3" json:"public_keys,omitempty" yaml:"pubkeys"` -} - -func (m *LegacyAminoPubKey) Reset() { *m = LegacyAminoPubKey{} } -func (m *LegacyAminoPubKey) String() string { return proto.CompactTextString(m) } -func (*LegacyAminoPubKey) ProtoMessage() {} -func (*LegacyAminoPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_46b57537e097d47d, []int{0} -} -func (m *LegacyAminoPubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LegacyAminoPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LegacyAminoPubKey.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 *LegacyAminoPubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_LegacyAminoPubKey.Merge(m, src) -} -func (m *LegacyAminoPubKey) XXX_Size() int { - return m.Size() -} -func (m *LegacyAminoPubKey) XXX_DiscardUnknown() { - xxx_messageInfo_LegacyAminoPubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_LegacyAminoPubKey proto.InternalMessageInfo - -func init() { - proto.RegisterType((*LegacyAminoPubKey)(nil), "cosmos.crypto.multisig.LegacyAminoPubKey") -} - -func init() { proto.RegisterFile("cosmos/crypto/multisig/keys.proto", fileDescriptor_46b57537e097d47d) } - -var fileDescriptor_46b57537e097d47d = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0xcf, 0x2d, 0xcd, 0x29, 0xc9, 0x2c, - 0xce, 0x4c, 0xd7, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, - 0x28, 0xd1, 0x83, 0x28, 0xd1, 0x83, 0x29, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, - 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0x24, 0xd3, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xc1, 0xbc, 0xa4, - 0xd2, 0x34, 0xfd, 0xc4, 0xbc, 0x4a, 0x88, 0x94, 0xd2, 0x62, 0x46, 0x2e, 0x41, 0x9f, 0xd4, 0xf4, - 0xc4, 0xe4, 0x4a, 0xc7, 0xdc, 0xcc, 0xbc, 0xfc, 0x80, 0xd2, 0x24, 0xef, 0xd4, 0x4a, 0x21, 0x23, - 0x2e, 0xce, 0x92, 0x8c, 0xa2, 0xd4, 0xe2, 0x8c, 0xfc, 0x9c, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, - 0x5e, 0x27, 0x91, 0x4f, 0xf7, 0xe4, 0x05, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xe0, 0x52, 0x4a, - 0x41, 0x08, 0x65, 0x42, 0x21, 0x5c, 0xdc, 0x05, 0xa5, 0x49, 0x39, 0x99, 0xc9, 0xf1, 0x20, 0x77, - 0x4a, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x89, 0xe8, 0x41, 0xac, 0xd6, 0x83, 0x59, 0xad, 0xe7, - 0x98, 0x57, 0xe9, 0x24, 0xfb, 0xe8, 0x9e, 0x3c, 0x3b, 0xc4, 0xaa, 0xe2, 0x4f, 0xf7, 0xe4, 0xf9, - 0x20, 0xc6, 0x16, 0x94, 0x26, 0x81, 0x74, 0x2a, 0x05, 0x71, 0x41, 0xcc, 0x01, 0xc9, 0x5a, 0xb1, - 0x74, 0x2c, 0x90, 0x67, 0x70, 0x0a, 0x38, 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, 0xb3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xcc, 0xa2, 0xcc, - 0xe2, 0xbc, 0xd4, 0x12, 0x30, 0x9d, 0x51, 0x9a, 0xa4, 0x5b, 0x9c, 0x92, 0xad, 0x9b, 0x9e, 0x0f, - 0x0b, 0x46, 0x90, 0xd9, 0xf0, 0xb0, 0x4c, 0x62, 0x03, 0x3b, 0xc8, 0x18, 0x10, 0x00, 0x00, 0xff, - 0xff, 0xfb, 0x05, 0xd9, 0x7a, 0x6c, 0x01, 0x00, 0x00, -} - -func (m *LegacyAminoPubKey) 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 *LegacyAminoPubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LegacyAminoPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PubKeys) > 0 { - for iNdEx := len(m.PubKeys) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PubKeys[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintKeys(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Threshold != 0 { - i = encodeVarintKeys(dAtA, i, uint64(m.Threshold)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { - offset -= sovKeys(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *LegacyAminoPubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Threshold != 0 { - n += 1 + sovKeys(uint64(m.Threshold)) - } - if len(m.PubKeys) > 0 { - for _, e := range m.PubKeys { - l = e.Size() - n += 1 + l + sovKeys(uint64(l)) - } - } - return n -} - -func sovKeys(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKeys(x uint64) (n int) { - return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *LegacyAminoPubKey) 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 ErrIntOverflowKeys - } - 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: LegacyAminoPubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LegacyAminoPubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Threshold |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKeys", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubKeys = append(m.PubKeys, &types.Any{}) - if err := m.PubKeys[len(m.PubKeys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKeys(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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrInvalidLengthKeys - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKeys - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKeys - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") -) diff --git a/crypto/keys/multisig/multisig.go b/crypto/keys/multisig/multisig.go deleted file mode 100644 index bd97df49..00000000 --- a/crypto/keys/multisig/multisig.go +++ /dev/null @@ -1,168 +0,0 @@ -package multisig - -import ( - fmt "fmt" - - tmcrypto "github.com/tendermint/tendermint/crypto" - - proto "github.com/gogo/protobuf/proto" - - "github.com/irisnet/irishub-sdk-go/codec/types" - crypto "github.com/irisnet/irishub-sdk-go/crypto/types" - multisigtypes "github.com/irisnet/irishub-sdk-go/crypto/types/multisig" - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -var _ multisigtypes.PubKey = &LegacyAminoPubKey{} -var _ types.UnpackInterfacesMessage = &LegacyAminoPubKey{} - -// NewLegacyAminoPubKey returns a new LegacyAminoPubKey. -// Panics if len(pubKeys) < k or 0 >= k. -func NewLegacyAminoPubKey(k int, pubKeys []tmcrypto.PubKey) *LegacyAminoPubKey { - if k <= 0 { - panic("threshold k of n multisignature: k <= 0") - } - if len(pubKeys) < k { - panic("threshold k of n multisignature: len(pubKeys) < k") - } - anyPubKeys, err := packPubKeys(pubKeys) - if err != nil { - panic(err) - } - return &LegacyAminoPubKey{Threshold: uint32(k), PubKeys: anyPubKeys} -} - -// Address implements crypto.PubKey Address method -func (m *LegacyAminoPubKey) Address() tmcrypto.Address { - return tmcrypto.AddressHash(m.Bytes()) -} - -// Bytes returns the proto encoded version of the LegacyAminoPubKey -func (m *LegacyAminoPubKey) Bytes() []byte { - return AminoCdc.MustMarshalBinaryBare(m) -} - -// VerifyMultisignature implements the multisigtypes.PubKey VerifyMultisignature method -func (m *LegacyAminoPubKey) VerifyMultisignature(getSignBytes multisigtypes.GetSignBytesFunc, sig *signing.MultiSignatureData) error { - bitarray := sig.BitArray - sigs := sig.Signatures - size := bitarray.Count() - pubKeys := m.GetPubKeys() - // ensure bit array is the correct size - if len(pubKeys) != size { - return fmt.Errorf("bit array size is incorrect %d", len(pubKeys)) - } - // ensure size of signature list - if len(sigs) < int(m.Threshold) || len(sigs) > size { - return fmt.Errorf("signature size is incorrect %d", len(sigs)) - } - // ensure at least k signatures are set - if bitarray.NumTrueBitsBefore(size) < int(m.Threshold) { - return fmt.Errorf("minimum number of signatures not set, have %d, expected %d", bitarray.NumTrueBitsBefore(size), int(m.Threshold)) - } - // index in the list of signatures which we are concerned with. - sigIndex := 0 - for i := 0; i < size; i++ { - if bitarray.GetIndex(i) { - si := sig.Signatures[sigIndex] - switch si := si.(type) { - case *signing.SingleSignatureData: - msg, err := getSignBytes(si.SignMode) - if err != nil { - return err - } - if !pubKeys[i].VerifySignature(msg, si.Signature) { - return fmt.Errorf("unable to verify signature at index %d", i) - } - case *signing.MultiSignatureData: - nestedMultisigPk, ok := pubKeys[i].(multisigtypes.PubKey) - if !ok { - return fmt.Errorf("unable to parse pubkey of index %d", i) - } - if err := nestedMultisigPk.VerifyMultisignature(getSignBytes, si); err != nil { - return err - } - default: - return fmt.Errorf("improper signature data type for index %d", sigIndex) - } - sigIndex++ - } - } - return nil -} - -// VerifySignature implements crypto.PubKey VerifySignature method, -// it panics because it can't handle MultiSignatureData -// cf. https://github.com/cosmos/cosmos-sdk/issues/7109#issuecomment-686329936 -func (m *LegacyAminoPubKey) VerifySignature(msg []byte, sig []byte) bool { - panic("not implemented") -} - -// GetPubKeys implements the PubKey.GetPubKeys method -func (m *LegacyAminoPubKey) GetPubKeys() []tmcrypto.PubKey { - if m != nil { - pubKeys := make([]tmcrypto.PubKey, len(m.PubKeys)) - for i := 0; i < len(m.PubKeys); i++ { - pubKeys[i] = m.PubKeys[i].GetCachedValue().(tmcrypto.PubKey) - } - return pubKeys - } - - return nil -} - -// Equals returns true if m and other both have the same number of keys, and -// all constituent keys are the same, and in the same order. -func (m *LegacyAminoPubKey) Equals(key tmcrypto.PubKey) bool { - otherKey, ok := key.(multisigtypes.PubKey) - if !ok { - return false - } - pubKeys := m.GetPubKeys() - otherPubKeys := otherKey.GetPubKeys() - if m.GetThreshold() != otherKey.GetThreshold() || len(pubKeys) != len(otherPubKeys) { - return false - } - - for i := 0; i < len(pubKeys); i++ { - if !pubKeys[i].Equals(otherPubKeys[i]) { - return false - } - } - return true -} - -// GetThreshold implements the PubKey.GetThreshold method -func (m *LegacyAminoPubKey) GetThreshold() uint { - return uint(m.Threshold) -} - -// Type returns multisig type -func (m *LegacyAminoPubKey) Type() string { - return "PubKeyMultisigThreshold" -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m *LegacyAminoPubKey) UnpackInterfaces(unpacker types.AnyUnpacker) error { - for _, any := range m.PubKeys { - var pk crypto.PubKey - err := unpacker.UnpackAny(any, &pk) - if err != nil { - return err - } - } - return nil -} - -func packPubKeys(pubKeys []tmcrypto.PubKey) ([]*types.Any, error) { - anyPubKeys := make([]*types.Any, len(pubKeys)) - - for i := 0; i < len(pubKeys); i++ { - any, err := types.NewAnyWithValue(pubKeys[i].(proto.Message)) - if err != nil { - return nil, err - } - anyPubKeys[i] = any - } - return anyPubKeys, nil -} diff --git a/crypto/keys/secp256k1/bench_test.go b/crypto/keys/secp256k1/bench_test.go deleted file mode 100644 index cd33480e..00000000 --- a/crypto/keys/secp256k1/bench_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package secp256k1 - -import ( - "io" - "testing" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/crypto/keys/internal/benchmarking" -) - -func BenchmarkKeyGeneration(b *testing.B) { - benchmarkKeygenWrapper := func(reader io.Reader) crypto.PrivKey { - priv := genPrivKey(reader) - return &PrivKey{Key: priv} - } - benchmarking.BenchmarkKeyGeneration(b, benchmarkKeygenWrapper) -} - -func BenchmarkSigning(b *testing.B) { - priv := GenPrivKey() - benchmarking.BenchmarkSigning(b, priv) -} - -func BenchmarkVerification(b *testing.B) { - priv := GenPrivKey() - benchmarking.BenchmarkVerification(b, priv) -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/.gitignore b/crypto/keys/secp256k1/internal/secp256k1/.gitignore deleted file mode 100644 index 802b6744..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -*~ diff --git a/crypto/keys/secp256k1/internal/secp256k1/LICENSE b/crypto/keys/secp256k1/internal/secp256k1/LICENSE deleted file mode 100644 index f9090e14..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Copyright (c) 2010 The Go Authors. All rights reserved. -Copyright (c) 2011 ThePiachu. All rights reserved. -Copyright (c) 2015 Jeffrey Wilcke. All rights reserved. -Copyright (c) 2015 Felix Lange. All rights reserved. -Copyright (c) 2015 Gustav Simonsson. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of the copyright holder. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/crypto/keys/secp256k1/internal/secp256k1/README.md b/crypto/keys/secp256k1/internal/secp256k1/README.md deleted file mode 100644 index d899ca27..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This package is copied from https://github.com/ethereum/go-ethereum/tree/729bf365b5f17325be9107b63b233da54100eec6/crypto/secp256k1 - -Unlike the rest of go-ethereum it is MIT licensed so compatible with our Apache2.0 license. We opt to copy in here rather than depend on go-ethereum to avoid issues with vendoring of the GPL parts of that repository by downstream. diff --git a/crypto/keys/secp256k1/internal/secp256k1/curve.go b/crypto/keys/secp256k1/internal/secp256k1/curve.go deleted file mode 100644 index 7a238736..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/curve.go +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Copyright 2011 ThePiachu. All rights reserved. -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// * The name of ThePiachu may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// nolint:gocritic -package secp256k1 - -import ( - "crypto/elliptic" - "math/big" - "unsafe" -) - -/* -#include "libsecp256k1/include/secp256k1.h" -extern int secp256k1_ext_scalar_mul(const secp256k1_context* ctx, - const unsigned char *point, - const unsigned char *scalar); -*/ -import "C" - -const ( - // number of bits in a big.Word - wordBits = 32 << (uint64(^big.Word(0)) >> 63) - // number of bytes in a big.Word - wordBytes = wordBits / 8 -) - -// readBits encodes the absolute value of bigint as big-endian bytes. Callers -// must ensure that buf has enough space. If buf is too short the result will -// be incomplete. -func readBits(bigint *big.Int, buf []byte) { - i := len(buf) - for _, d := range bigint.Bits() { - for j := 0; j < wordBytes && i > 0; j++ { - i-- - buf[i] = byte(d) - d >>= 8 - } - } -} - -// This code is from https://github.com/ThePiachu/GoBit and implements -// several Koblitz elliptic curves over prime fields. -// -// The curve methods, internally, on Jacobian coordinates. For a given -// (x, y) position on the curve, the Jacobian coordinates are (x1, y1, -// z1) where x = x1/z1² and y = y1/z1³. The greatest speedups come -// when the whole calculation can be performed within the transform -// (as in ScalarMult and ScalarBaseMult). But even for Add and Double, -// it's faster to apply and reverse the transform than to operate in -// affine coordinates. - -// A BitCurve represents a Koblitz Curve with a=0. -// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html -type BitCurve struct { - P *big.Int // the order of the underlying field - N *big.Int // the order of the base point - B *big.Int // the constant of the BitCurve equation - Gx, Gy *big.Int // (x,y) of the base point - BitSize int // the size of the underlying field -} - -func (BitCurve *BitCurve) Params() *elliptic.CurveParams { - return &elliptic.CurveParams{ - P: BitCurve.P, - N: BitCurve.N, - B: BitCurve.B, - Gx: BitCurve.Gx, - Gy: BitCurve.Gy, - BitSize: BitCurve.BitSize, - } -} - -// IsOnCurve returns true if the given (x,y) lies on the BitCurve. -func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool { - // y² = x³ + b - y2 := new(big.Int).Mul(y, y) //y² - y2.Mod(y2, BitCurve.P) //y²%P - - x3 := new(big.Int).Mul(x, x) //x² - x3.Mul(x3, x) //x³ - - x3.Add(x3, BitCurve.B) //x³+B - x3.Mod(x3, BitCurve.P) //(x³+B)%P - - return x3.Cmp(y2) == 0 -} - -//TODO: double check if the function is okay -// affineFromJacobian reverses the Jacobian transform. See the comment at the -// top of the file. -func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) { - zinv := new(big.Int).ModInverse(z, BitCurve.P) - zinvsq := new(big.Int).Mul(zinv, zinv) - - xOut = new(big.Int).Mul(x, zinvsq) - xOut.Mod(xOut, BitCurve.P) - zinvsq.Mul(zinvsq, zinv) - yOut = new(big.Int).Mul(y, zinvsq) - yOut.Mod(yOut, BitCurve.P) - return -} - -// Add returns the sum of (x1,y1) and (x2,y2) -func (BitCurve *BitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) { - z := new(big.Int).SetInt64(1) - return BitCurve.affineFromJacobian(BitCurve.addJacobian(x1, y1, z, x2, y2, z)) -} - -// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and -// (x2, y2, z2) and returns their sum, also in Jacobian form. -func (BitCurve *BitCurve) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) { - // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl - z1z1 := new(big.Int).Mul(z1, z1) - z1z1.Mod(z1z1, BitCurve.P) - z2z2 := new(big.Int).Mul(z2, z2) - z2z2.Mod(z2z2, BitCurve.P) - - u1 := new(big.Int).Mul(x1, z2z2) - u1.Mod(u1, BitCurve.P) - u2 := new(big.Int).Mul(x2, z1z1) - u2.Mod(u2, BitCurve.P) - h := new(big.Int).Sub(u2, u1) - if h.Sign() == -1 { - h.Add(h, BitCurve.P) - } - i := new(big.Int).Lsh(h, 1) - i.Mul(i, i) - j := new(big.Int).Mul(h, i) - - s1 := new(big.Int).Mul(y1, z2) - s1.Mul(s1, z2z2) - s1.Mod(s1, BitCurve.P) - s2 := new(big.Int).Mul(y2, z1) - s2.Mul(s2, z1z1) - s2.Mod(s2, BitCurve.P) - r := new(big.Int).Sub(s2, s1) - if r.Sign() == -1 { - r.Add(r, BitCurve.P) - } - r.Lsh(r, 1) - v := new(big.Int).Mul(u1, i) - - x3 := new(big.Int).Set(r) - x3.Mul(x3, x3) - x3.Sub(x3, j) - x3.Sub(x3, v) - x3.Sub(x3, v) - x3.Mod(x3, BitCurve.P) - - y3 := new(big.Int).Set(r) - v.Sub(v, x3) - y3.Mul(y3, v) - s1.Mul(s1, j) - s1.Lsh(s1, 1) - y3.Sub(y3, s1) - y3.Mod(y3, BitCurve.P) - - z3 := new(big.Int).Add(z1, z2) - z3.Mul(z3, z3) - z3.Sub(z3, z1z1) - if z3.Sign() == -1 { - z3.Add(z3, BitCurve.P) - } - z3.Sub(z3, z2z2) - if z3.Sign() == -1 { - z3.Add(z3, BitCurve.P) - } - z3.Mul(z3, h) - z3.Mod(z3, BitCurve.P) - - return x3, y3, z3 -} - -// Double returns 2*(x,y) -func (BitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) { - z1 := new(big.Int).SetInt64(1) - return BitCurve.affineFromJacobian(BitCurve.doubleJacobian(x1, y1, z1)) -} - -// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and -// returns its double, also in Jacobian form. -func (BitCurve *BitCurve) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) { - // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l - - a := new(big.Int).Mul(x, x) //X1² - b := new(big.Int).Mul(y, y) //Y1² - c := new(big.Int).Mul(b, b) //B² - - d := new(big.Int).Add(x, b) //X1+B - d.Mul(d, d) //(X1+B)² - d.Sub(d, a) //(X1+B)²-A - d.Sub(d, c) //(X1+B)²-A-C - d.Mul(d, big.NewInt(2)) //2*((X1+B)²-A-C) - - e := new(big.Int).Mul(big.NewInt(3), a) //3*A - f := new(big.Int).Mul(e, e) //E² - - x3 := new(big.Int).Mul(big.NewInt(2), d) //2*D - x3.Sub(f, x3) //F-2*D - x3.Mod(x3, BitCurve.P) - - y3 := new(big.Int).Sub(d, x3) //D-X3 - y3.Mul(e, y3) //E*(D-X3) - y3.Sub(y3, new(big.Int).Mul(big.NewInt(8), c)) //E*(D-X3)-8*C - y3.Mod(y3, BitCurve.P) - - z3 := new(big.Int).Mul(y, z) //Y1*Z1 - z3.Mul(big.NewInt(2), z3) //3*Y1*Z1 - z3.Mod(z3, BitCurve.P) - - return x3, y3, z3 -} - -func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, scalar []byte) (*big.Int, *big.Int) { - // Ensure scalar is exactly 32 bytes. We pad always, even if - // scalar is 32 bytes long, to avoid a timing side channel. - if len(scalar) > 32 { - panic("can't handle scalars > 256 bits") - } - // NOTE: potential timing issue - padded := make([]byte, 32) - copy(padded[32-len(scalar):], scalar) - scalar = padded - - // Do the multiplication in C, updating point. - point := make([]byte, 64) - readBits(Bx, point[:32]) - readBits(By, point[32:]) - - pointPtr := (*C.uchar)(unsafe.Pointer(&point[0])) - scalarPtr := (*C.uchar)(unsafe.Pointer(&scalar[0])) - res := C.secp256k1_ext_scalar_mul(context, pointPtr, scalarPtr) - - // Unpack the result and clear temporaries. - x := new(big.Int).SetBytes(point[:32]) - y := new(big.Int).SetBytes(point[32:]) - for i := range point { - point[i] = 0 - } - for i := range padded { - scalar[i] = 0 - } - if res != 1 { - return nil, nil - } - return x, y -} - -// ScalarBaseMult returns k*G, where G is the base point of the group and k is -// an integer in big-endian form. -func (BitCurve *BitCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) { - return BitCurve.ScalarMult(BitCurve.Gx, BitCurve.Gy, k) -} - -// Marshal converts a point into the form specified in section 4.3.6 of ANSI -// X9.62. -func (BitCurve *BitCurve) Marshal(x, y *big.Int) []byte { - byteLen := (BitCurve.BitSize + 7) >> 3 - ret := make([]byte, 1+2*byteLen) - ret[0] = 4 // uncompressed point flag - readBits(x, ret[1:1+byteLen]) - readBits(y, ret[1+byteLen:]) - return ret -} - -// Unmarshal converts a point, serialised by Marshal, into an x, y pair. On -// error, x = nil. -func (BitCurve *BitCurve) Unmarshal(data []byte) (x, y *big.Int) { - byteLen := (BitCurve.BitSize + 7) >> 3 - if len(data) != 1+2*byteLen { - return - } - if data[0] != 4 { // uncompressed form - return - } - x = new(big.Int).SetBytes(data[1 : 1+byteLen]) - y = new(big.Int).SetBytes(data[1+byteLen:]) - return -} - -var theCurve = new(BitCurve) - -func init() { - // See SEC 2 section 2.7.1 - // curve parameters taken from: - // http://www.secg.org/sec2-v2.pdf - theCurve.P, _ = new(big.Int).SetString("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 0) - theCurve.N, _ = new(big.Int).SetString("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 0) - theCurve.B, _ = new(big.Int).SetString("0x0000000000000000000000000000000000000000000000000000000000000007", 0) - theCurve.Gx, _ = new(big.Int).SetString("0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 0) - theCurve.Gy, _ = new(big.Int).SetString("0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 0) - theCurve.BitSize = 256 -} - -// S256 returns a BitCurve which implements secp256k1. -func S256() *BitCurve { - return theCurve -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/ext.h b/crypto/keys/secp256k1/internal/secp256k1/ext.h deleted file mode 100644 index e422fe4b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/ext.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be found in -// the LICENSE file. - -// secp256k1_context_create_sign_verify creates a context for signing and signature verification. -static secp256k1_context* secp256k1_context_create_sign_verify() { - return secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); -} - -// secp256k1_ext_ecdsa_recover recovers the public key of an encoded compact signature. -// -// Returns: 1: recovery was successful -// 0: recovery was not successful -// Args: ctx: pointer to a context object (cannot be NULL) -// Out: pubkey_out: the serialized 65-byte public key of the signer (cannot be NULL) -// In: sigdata: pointer to a 65-byte signature with the recovery id at the end (cannot be NULL) -// msgdata: pointer to a 32-byte message (cannot be NULL) -static int secp256k1_ext_ecdsa_recover( - const secp256k1_context* ctx, - unsigned char *pubkey_out, - const unsigned char *sigdata, - const unsigned char *msgdata -) { - secp256k1_ecdsa_recoverable_signature sig; - secp256k1_pubkey pubkey; - - if (!secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &sig, sigdata, (int)sigdata[64])) { - return 0; - } - if (!secp256k1_ecdsa_recover(ctx, &pubkey, &sig, msgdata)) { - return 0; - } - size_t outputlen = 65; - return secp256k1_ec_pubkey_serialize(ctx, pubkey_out, &outputlen, &pubkey, SECP256K1_EC_UNCOMPRESSED); -} - -// secp256k1_ext_ecdsa_verify verifies an encoded compact signature. -// -// Returns: 1: signature is valid -// 0: signature is invalid -// Args: ctx: pointer to a context object (cannot be NULL) -// In: sigdata: pointer to a 64-byte signature (cannot be NULL) -// msgdata: pointer to a 32-byte message (cannot be NULL) -// pubkeydata: pointer to public key data (cannot be NULL) -// pubkeylen: length of pubkeydata -static int secp256k1_ext_ecdsa_verify( - const secp256k1_context* ctx, - const unsigned char *sigdata, - const unsigned char *msgdata, - const unsigned char *pubkeydata, - size_t pubkeylen -) { - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pubkey; - - if (!secp256k1_ecdsa_signature_parse_compact(ctx, &sig, sigdata)) { - return 0; - } - if (!secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeydata, pubkeylen)) { - return 0; - } - return secp256k1_ecdsa_verify(ctx, &sig, msgdata, &pubkey); -} - -// secp256k1_ext_reencode_pubkey decodes then encodes a public key. It can be used to -// convert between public key formats. The input/output formats are chosen depending on the -// length of the input/output buffers. -// -// Returns: 1: conversion successful -// 0: conversion unsuccessful -// Args: ctx: pointer to a context object (cannot be NULL) -// Out: out: output buffer that will contain the reencoded key (cannot be NULL) -// In: outlen: length of out (33 for compressed keys, 65 for uncompressed keys) -// pubkeydata: the input public key (cannot be NULL) -// pubkeylen: length of pubkeydata -static int secp256k1_ext_reencode_pubkey( - const secp256k1_context* ctx, - unsigned char *out, - size_t outlen, - const unsigned char *pubkeydata, - size_t pubkeylen -) { - secp256k1_pubkey pubkey; - - if (!secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeydata, pubkeylen)) { - return 0; - } - unsigned int flag = (outlen == 33) ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED; - return secp256k1_ec_pubkey_serialize(ctx, out, &outlen, &pubkey, flag); -} - -// secp256k1_ext_scalar_mul multiplies a point by a scalar in constant time. -// -// Returns: 1: multiplication was successful -// 0: scalar was invalid (zero or overflow) -// Args: ctx: pointer to a context object (cannot be NULL) -// Out: point: the multiplied point (usually secret) -// In: point: pointer to a 64-byte public point, -// encoded as two 256bit big-endian numbers. -// scalar: a 32-byte scalar with which to multiply the point -int secp256k1_ext_scalar_mul(const secp256k1_context* ctx, unsigned char *point, const unsigned char *scalar) { - int ret = 0; - int overflow = 0; - secp256k1_fe feX, feY; - secp256k1_gej res; - secp256k1_ge ge; - secp256k1_scalar s; - ARG_CHECK(point != NULL); - ARG_CHECK(scalar != NULL); - (void)ctx; - - secp256k1_fe_set_b32(&feX, point); - secp256k1_fe_set_b32(&feY, point+32); - secp256k1_ge_set_xy(&ge, &feX, &feY); - secp256k1_scalar_set_b32(&s, scalar, &overflow); - if (overflow || secp256k1_scalar_is_zero(&s)) { - ret = 0; - } else { - secp256k1_ecmult_const(&res, &ge, &s); - secp256k1_ge_set_gej(&ge, &res); - /* Note: can't use secp256k1_pubkey_save here because it is not constant time. */ - secp256k1_fe_normalize(&ge.x); - secp256k1_fe_normalize(&ge.y); - secp256k1_fe_get_b32(point, &ge.x); - secp256k1_fe_get_b32(point+32, &ge.y); - ret = 1; - } - secp256k1_scalar_clear(&s); - return ret; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore deleted file mode 100644 index 87fea161..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore +++ /dev/null @@ -1,49 +0,0 @@ -bench_inv -bench_ecdh -bench_sign -bench_verify -bench_schnorr_verify -bench_recover -bench_internal -tests -exhaustive_tests -gen_context -*.exe -*.so -*.a -!.gitignore - -Makefile -configure -.libs/ -Makefile.in -aclocal.m4 -autom4te.cache/ -config.log -config.status -*.tar.gz -*.la -libtool -.deps/ -.dirstamp -*.lo -*.o -*~ -src/libsecp256k1-config.h -src/libsecp256k1-config.h.in -src/ecmult_static_context.h -build-aux/config.guess -build-aux/config.sub -build-aux/depcomp -build-aux/install-sh -build-aux/ltmain.sh -build-aux/m4/libtool.m4 -build-aux/m4/lt~obsolete.m4 -build-aux/m4/ltoptions.m4 -build-aux/m4/ltsugar.m4 -build-aux/m4/ltversion.m4 -build-aux/missing -build-aux/compile -build-aux/test-driver -src/stamp-h1 -libsecp256k1.pc diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml deleted file mode 100644 index 24395292..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml +++ /dev/null @@ -1,69 +0,0 @@ -language: c -sudo: false -addons: - apt: - packages: libgmp-dev -compiler: - - clang - - gcc -cache: - directories: - - src/java/guava/ -env: - global: - - FIELD=auto BIGNUM=auto SCALAR=auto ENDOMORPHISM=no STATICPRECOMPUTATION=yes ASM=no BUILD=check EXTRAFLAGS= HOST= ECDH=no RECOVERY=no EXPERIMENTAL=no - - GUAVA_URL=https://search.maven.org/remotecontent?filepath=com/google/guava/guava/18.0/guava-18.0.jar GUAVA_JAR=src/java/guava/guava-18.0.jar - matrix: - - SCALAR=32bit RECOVERY=yes - - SCALAR=32bit FIELD=32bit ECDH=yes EXPERIMENTAL=yes - - SCALAR=64bit - - FIELD=64bit RECOVERY=yes - - FIELD=64bit ENDOMORPHISM=yes - - FIELD=64bit ENDOMORPHISM=yes ECDH=yes EXPERIMENTAL=yes - - FIELD=64bit ASM=x86_64 - - FIELD=64bit ENDOMORPHISM=yes ASM=x86_64 - - FIELD=32bit ENDOMORPHISM=yes - - BIGNUM=no - - BIGNUM=no ENDOMORPHISM=yes RECOVERY=yes EXPERIMENTAL=yes - - BIGNUM=no STATICPRECOMPUTATION=no - - BUILD=distcheck - - EXTRAFLAGS=CPPFLAGS=-DDETERMINISTIC - - EXTRAFLAGS=CFLAGS=-O0 - - BUILD=check-java ECDH=yes EXPERIMENTAL=yes -matrix: - fast_finish: true - include: - - compiler: clang - env: HOST=i686-linux-gnu ENDOMORPHISM=yes - addons: - apt: - packages: - - gcc-multilib - - libgmp-dev:i386 - - compiler: clang - env: HOST=i686-linux-gnu - addons: - apt: - packages: - - gcc-multilib - - compiler: gcc - env: HOST=i686-linux-gnu ENDOMORPHISM=yes - addons: - apt: - packages: - - gcc-multilib - - compiler: gcc - env: HOST=i686-linux-gnu - addons: - apt: - packages: - - gcc-multilib - - libgmp-dev:i386 -before_install: mkdir -p `dirname $GUAVA_JAR` -install: if [ ! -f $GUAVA_JAR ]; then wget $GUAVA_URL -O $GUAVA_JAR; fi -before_script: ./autogen.sh -script: - - if [ -n "$HOST" ]; then export USE_HOST="--host=$HOST"; fi - - if [ "x$HOST" = "xi686-linux-gnu" ]; then export CC="$CC -m32"; fi - - ./configure --enable-experimental=$EXPERIMENTAL --enable-endomorphism=$ENDOMORPHISM --with-field=$FIELD --with-bignum=$BIGNUM --with-scalar=$SCALAR --enable-ecmult-static-precomputation=$STATICPRECOMPUTATION --enable-module-ecdh=$ECDH --enable-module-recovery=$RECOVERY $EXTRAFLAGS $USE_HOST && make -j2 $BUILD -os: linux diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING deleted file mode 100644 index 4522a599..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Pieter Wuille - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am deleted file mode 100644 index c071fbe2..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am +++ /dev/null @@ -1,177 +0,0 @@ -ACLOCAL_AMFLAGS = -I build-aux/m4 - -lib_LTLIBRARIES = libsecp256k1.la -if USE_JNI -JNI_LIB = libsecp256k1_jni.la -noinst_LTLIBRARIES = $(JNI_LIB) -else -JNI_LIB = -endif -include_HEADERS = include/secp256k1.h -noinst_HEADERS = -noinst_HEADERS += src/scalar.h -noinst_HEADERS += src/scalar_4x64.h -noinst_HEADERS += src/scalar_8x32.h -noinst_HEADERS += src/scalar_low.h -noinst_HEADERS += src/scalar_impl.h -noinst_HEADERS += src/scalar_4x64_impl.h -noinst_HEADERS += src/scalar_8x32_impl.h -noinst_HEADERS += src/scalar_low_impl.h -noinst_HEADERS += src/group.h -noinst_HEADERS += src/group_impl.h -noinst_HEADERS += src/num_gmp.h -noinst_HEADERS += src/num_gmp_impl.h -noinst_HEADERS += src/ecdsa.h -noinst_HEADERS += src/ecdsa_impl.h -noinst_HEADERS += src/eckey.h -noinst_HEADERS += src/eckey_impl.h -noinst_HEADERS += src/ecmult.h -noinst_HEADERS += src/ecmult_impl.h -noinst_HEADERS += src/ecmult_const.h -noinst_HEADERS += src/ecmult_const_impl.h -noinst_HEADERS += src/ecmult_gen.h -noinst_HEADERS += src/ecmult_gen_impl.h -noinst_HEADERS += src/num.h -noinst_HEADERS += src/num_impl.h -noinst_HEADERS += src/field_10x26.h -noinst_HEADERS += src/field_10x26_impl.h -noinst_HEADERS += src/field_5x52.h -noinst_HEADERS += src/field_5x52_impl.h -noinst_HEADERS += src/field_5x52_int128_impl.h -noinst_HEADERS += src/field_5x52_asm_impl.h -noinst_HEADERS += src/java/org_bitcoin_NativeSecp256k1.h -noinst_HEADERS += src/java/org_bitcoin_Secp256k1Context.h -noinst_HEADERS += src/util.h -noinst_HEADERS += src/testrand.h -noinst_HEADERS += src/testrand_impl.h -noinst_HEADERS += src/hash.h -noinst_HEADERS += src/hash_impl.h -noinst_HEADERS += src/field.h -noinst_HEADERS += src/field_impl.h -noinst_HEADERS += src/bench.h -noinst_HEADERS += contrib/lax_der_parsing.h -noinst_HEADERS += contrib/lax_der_parsing.c -noinst_HEADERS += contrib/lax_der_privatekey_parsing.h -noinst_HEADERS += contrib/lax_der_privatekey_parsing.c - -if USE_EXTERNAL_ASM -COMMON_LIB = libsecp256k1_common.la -noinst_LTLIBRARIES = $(COMMON_LIB) -else -COMMON_LIB = -endif - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libsecp256k1.pc - -if USE_EXTERNAL_ASM -if USE_ASM_ARM -libsecp256k1_common_la_SOURCES = src/asm/field_10x26_arm.s -endif -endif - -libsecp256k1_la_SOURCES = src/secp256k1.c -libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -libsecp256k1_la_LIBADD = $(JNI_LIB) $(SECP_LIBS) $(COMMON_LIB) - -libsecp256k1_jni_la_SOURCES = src/java/org_bitcoin_NativeSecp256k1.c src/java/org_bitcoin_Secp256k1Context.c -libsecp256k1_jni_la_CPPFLAGS = -DSECP256K1_BUILD $(JNI_INCLUDES) - -noinst_PROGRAMS = -if USE_BENCHMARK -noinst_PROGRAMS += bench_verify bench_sign bench_internal -bench_verify_SOURCES = src/bench_verify.c -bench_verify_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) -bench_sign_SOURCES = src/bench_sign.c -bench_sign_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) -bench_internal_SOURCES = src/bench_internal.c -bench_internal_LDADD = $(SECP_LIBS) $(COMMON_LIB) -bench_internal_CPPFLAGS = -DSECP256K1_BUILD $(SECP_INCLUDES) -endif - -TESTS = -if USE_TESTS -noinst_PROGRAMS += tests -tests_SOURCES = src/tests.c -tests_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/src -I$(top_srcdir)/include $(SECP_INCLUDES) $(SECP_TEST_INCLUDES) -if !ENABLE_COVERAGE -tests_CPPFLAGS += -DVERIFY -endif -tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) -tests_LDFLAGS = -static -TESTS += tests -endif - -if USE_EXHAUSTIVE_TESTS -noinst_PROGRAMS += exhaustive_tests -exhaustive_tests_SOURCES = src/tests_exhaustive.c -exhaustive_tests_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/src $(SECP_INCLUDES) -if !ENABLE_COVERAGE -exhaustive_tests_CPPFLAGS += -DVERIFY -endif -exhaustive_tests_LDADD = $(SECP_LIBS) -exhaustive_tests_LDFLAGS = -static -TESTS += exhaustive_tests -endif - -JAVAROOT=src/java -JAVAORG=org/bitcoin -JAVA_GUAVA=$(srcdir)/$(JAVAROOT)/guava/guava-18.0.jar -CLASSPATH_ENV=CLASSPATH=$(JAVA_GUAVA) -JAVA_FILES= \ - $(JAVAROOT)/$(JAVAORG)/NativeSecp256k1.java \ - $(JAVAROOT)/$(JAVAORG)/NativeSecp256k1Test.java \ - $(JAVAROOT)/$(JAVAORG)/NativeSecp256k1Util.java \ - $(JAVAROOT)/$(JAVAORG)/Secp256k1Context.java - -if USE_JNI - -$(JAVA_GUAVA): - @echo Guava is missing. Fetch it via: \ - wget https://search.maven.org/remotecontent?filepath=com/google/guava/guava/18.0/guava-18.0.jar -O $(@) - @false - -.stamp-java: $(JAVA_FILES) - @echo Compiling $^ - $(AM_V_at)$(CLASSPATH_ENV) javac $^ - @touch $@ - -if USE_TESTS - -check-java: libsecp256k1.la $(JAVA_GUAVA) .stamp-java - $(AM_V_at)java -Djava.library.path="./:./src:./src/.libs:.libs/" -cp "$(JAVA_GUAVA):$(JAVAROOT)" $(JAVAORG)/NativeSecp256k1Test - -endif -endif - -if USE_ECMULT_STATIC_PRECOMPUTATION -CPPFLAGS_FOR_BUILD +=-I$(top_srcdir) -CFLAGS_FOR_BUILD += -Wall -Wextra -Wno-unused-function - -gen_context_OBJECTS = gen_context.o -gen_context_BIN = gen_context$(BUILD_EXEEXT) -gen_%.o: src/gen_%.c - $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@ - -$(gen_context_BIN): $(gen_context_OBJECTS) - $(CC_FOR_BUILD) $^ -o $@ - -$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h -$(tests_OBJECTS): src/ecmult_static_context.h -$(bench_internal_OBJECTS): src/ecmult_static_context.h - -src/ecmult_static_context.h: $(gen_context_BIN) - ./$(gen_context_BIN) - -CLEANFILES = $(gen_context_BIN) src/ecmult_static_context.h $(JAVAROOT)/$(JAVAORG)/*.class .stamp-java -endif - -EXTRA_DIST = autogen.sh src/gen_context.c src/basic-config.h $(JAVA_FILES) - -if ENABLE_MODULE_ECDH -include src/modules/ecdh/Makefile.am.include -endif - -if ENABLE_MODULE_RECOVERY -include src/modules/recovery/Makefile.am.include -endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md deleted file mode 100644 index 8cd344ea..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md +++ /dev/null @@ -1,61 +0,0 @@ -libsecp256k1 -============ - -[![Build Status](https://travis-ci.org/bitcoin-core/secp256k1.svg?branch=master)](https://travis-ci.org/bitcoin-core/secp256k1) - -Optimized C library for EC operations on curve secp256k1. - -This library is a work in progress and is being used to research best practices. Use at your own risk. - -Features: -* secp256k1 ECDSA signing/verification and key generation. -* Adding/multiplying private/public keys. -* Serialization/parsing of private keys, public keys, signatures. -* Constant time, constant memory access signing and pubkey generation. -* Derandomized DSA (via RFC6979 or with a caller provided function.) -* Very efficient implementation. - -Implementation details ----------------------- - -* General - * No runtime heap allocation. - * Extensive testing infrastructure. - * Structured to facilitate review and analysis. - * Intended to be portable to any system with a C89 compiler and uint64_t support. - * Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.") -* Field operations - * Optimized implementation of arithmetic modulo the curve's field size (2^256 - 0x1000003D1). - * Using 5 52-bit limbs (including hand-optimized assembly for x86_64, by Diederik Huys). - * Using 10 26-bit limbs. - * Field inverses and square roots using a sliding window over blocks of 1s (by Peter Dettman). -* Scalar operations - * Optimized implementation without data-dependent branches of arithmetic modulo the curve's order. - * Using 4 64-bit limbs (relying on __int128 support in the compiler). - * Using 8 32-bit limbs. -* Group operations - * Point addition formula specifically simplified for the curve equation (y^2 = x^3 + 7). - * Use addition between points in Jacobian and affine coordinates where possible. - * Use a unified addition/doubling formula where necessary to avoid data-dependent branches. - * Point/x comparison without a field inversion by comparison in the Jacobian coordinate space. -* Point multiplication for verification (a*P + b*G). - * Use wNAF notation for point multiplicands. - * Use a much larger window for multiples of G, using precomputed multiples. - * Use Shamir's trick to do the multiplication with the public key and the generator simultaneously. - * Optionally (off by default) use secp256k1's efficiently-computable endomorphism to split the P multiplicand into 2 half-sized ones. -* Point multiplication for signing - * Use a precomputed table of multiples of powers of 16 multiplied with the generator, so general multiplication becomes a series of additions. - * Access the table with branch-free conditional moves so memory access is uniform. - * No data-dependent branches - * The precomputed tables add and eventually subtract points for which no known scalar (private key) is known, preventing even an attacker with control over the private key used to control the data internally. - -Build steps ------------ - -libsecp256k1 is built using autotools: - - $ ./autogen.sh - $ ./configure - $ make - $ ./tests - $ sudo make install # optional diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO deleted file mode 100644 index a300e1c5..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO +++ /dev/null @@ -1,3 +0,0 @@ -* Unit tests for fieldelem/groupelem, including ones intended to - trigger fieldelem's boundary cases. -* Complete constant-time operations for signing/keygen diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh deleted file mode 100755 index 65286b93..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -e -autoreconf -if --warnings=all diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 deleted file mode 100644 index 1fc36276..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 +++ /dev/null @@ -1,140 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_JNI_INCLUDE_DIR -# -# DESCRIPTION -# -# AX_JNI_INCLUDE_DIR finds include directories needed for compiling -# programs using the JNI interface. -# -# JNI include directories are usually in the Java distribution. This is -# deduced from the value of $JAVA_HOME, $JAVAC, or the path to "javac", in -# that order. When this macro completes, a list of directories is left in -# the variable JNI_INCLUDE_DIRS. -# -# Example usage follows: -# -# AX_JNI_INCLUDE_DIR -# -# for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS -# do -# CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" -# done -# -# If you want to force a specific compiler: -# -# - at the configure.in level, set JAVAC=yourcompiler before calling -# AX_JNI_INCLUDE_DIR -# -# - at the configure level, setenv JAVAC -# -# Note: This macro can work with the autoconf M4 macros for Java programs. -# This particular macro is not part of the original set of macros. -# -# LICENSE -# -# Copyright (c) 2008 Don Anderson -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 10 - -AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) -AC_DEFUN([AX_JNI_INCLUDE_DIR],[ - -JNI_INCLUDE_DIRS="" - -if test "x$JAVA_HOME" != x; then - _JTOPDIR="$JAVA_HOME" -else - if test "x$JAVAC" = x; then - JAVAC=javac - fi - AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no]) - if test "x$_ACJNI_JAVAC" = xno; then - AC_MSG_WARN([cannot find JDK; try setting \$JAVAC or \$JAVA_HOME]) - fi - _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") - _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` -fi - -case "$host_os" in - darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - _JINC="$_JTOPDIR/Headers";; - *) _JINC="$_JTOPDIR/include";; -esac -_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) -_AS_ECHO_LOG([_JINC=$_JINC]) - -# On Mac OS X 10.6.4, jni.h is a symlink: -# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h -# -> ../../CurrentJDK/Headers/jni.h. - -AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path, -[ -if test -f "$_JINC/jni.h"; then - ac_cv_jni_header_path="$_JINC" - JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" -else - _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - if test -f "$_JTOPDIR/include/jni.h"; then - ac_cv_jni_header_path="$_JTOPDIR/include" - JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" - else - ac_cv_jni_header_path=none - fi -fi -]) - - - -# get the likely subdirectories for system specific java includes -case "$host_os" in -bsdi*) _JNI_INC_SUBDIRS="bsdos";; -darwin*) _JNI_INC_SUBDIRS="darwin";; -freebsd*) _JNI_INC_SUBDIRS="freebsd";; -linux*) _JNI_INC_SUBDIRS="linux genunix";; -osf*) _JNI_INC_SUBDIRS="alpha";; -solaris*) _JNI_INC_SUBDIRS="solaris";; -mingw*) _JNI_INC_SUBDIRS="win32";; -cygwin*) _JNI_INC_SUBDIRS="win32";; -*) _JNI_INC_SUBDIRS="genunix";; -esac - -if test "x$ac_cv_jni_header_path" != "xnone"; then - # add any subdirectories that are present - for JINCSUBDIR in $_JNI_INC_SUBDIRS - do - if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then - JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" - fi - done -fi -]) - -# _ACJNI_FOLLOW_SYMLINKS -# Follows symbolic links on , -# finally setting variable _ACJNI_FOLLOWED -# ---------------------------------------- -AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ -# find the include directory relative to the javac executable -_cur="$1" -while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do - AC_MSG_CHECKING([symlink for $_cur]) - _slink=`ls -ld "$_cur" | sed 's/.* -> //'` - case "$_slink" in - /*) _cur="$_slink";; - # 'X' avoids triggering unwanted echo options. - *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; - esac - AC_MSG_RESULT([$_cur]) -done -_ACJNI_FOLLOWED="$_cur" -])# _ACJNI diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 deleted file mode 100644 index 77fd346a..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 +++ /dev/null @@ -1,125 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_CC_FOR_BUILD -# -# DESCRIPTION -# -# This macro searches for a C compiler that generates native executables, -# that is a C compiler that surely is not a cross-compiler. This can be -# useful if you have to generate source code at compile-time like for -# example GCC does. -# -# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything -# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). -# The value of these variables can be overridden by the user by specifying -# a compiler with an environment variable (like you do for standard CC). -# -# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object -# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if -# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are -# substituted in the Makefile. -# -# LICENSE -# -# Copyright (c) 2008 Paolo Bonzini -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 8 - -AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) -AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_CPP])dnl -AC_REQUIRE([AC_EXEEXT])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl - -dnl Use the standard macros, but make them use other variable names -dnl -pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl -pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl -pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl -pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl -pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl -pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl -pushdef([ac_cv_objext], ac_cv_build_objext)dnl -pushdef([ac_exeext], ac_build_exeext)dnl -pushdef([ac_objext], ac_build_objext)dnl -pushdef([CC], CC_FOR_BUILD)dnl -pushdef([CPP], CPP_FOR_BUILD)dnl -pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl -pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl -pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl -pushdef([host], build)dnl -pushdef([host_alias], build_alias)dnl -pushdef([host_cpu], build_cpu)dnl -pushdef([host_vendor], build_vendor)dnl -pushdef([host_os], build_os)dnl -pushdef([ac_cv_host], ac_cv_build)dnl -pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl -pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl -pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl -pushdef([ac_cv_host_os], ac_cv_build_os)dnl -pushdef([ac_cpp], ac_build_cpp)dnl -pushdef([ac_compile], ac_build_compile)dnl -pushdef([ac_link], ac_build_link)dnl - -save_cross_compiling=$cross_compiling -save_ac_tool_prefix=$ac_tool_prefix -cross_compiling=no -ac_tool_prefix= - -AC_PROG_CC -AC_PROG_CPP -AC_EXEEXT - -ac_tool_prefix=$save_ac_tool_prefix -cross_compiling=$save_cross_compiling - -dnl Restore the old definitions -dnl -popdef([ac_link])dnl -popdef([ac_compile])dnl -popdef([ac_cpp])dnl -popdef([ac_cv_host_os])dnl -popdef([ac_cv_host_vendor])dnl -popdef([ac_cv_host_cpu])dnl -popdef([ac_cv_host_alias])dnl -popdef([ac_cv_host])dnl -popdef([host_os])dnl -popdef([host_vendor])dnl -popdef([host_cpu])dnl -popdef([host_alias])dnl -popdef([host])dnl -popdef([LDFLAGS])dnl -popdef([CPPFLAGS])dnl -popdef([CFLAGS])dnl -popdef([CPP])dnl -popdef([CC])dnl -popdef([ac_objext])dnl -popdef([ac_exeext])dnl -popdef([ac_cv_objext])dnl -popdef([ac_cv_exeext])dnl -popdef([ac_cv_prog_cc_g])dnl -popdef([ac_cv_prog_cc_cross])dnl -popdef([ac_cv_prog_cc_works])dnl -popdef([ac_cv_prog_gcc])dnl -popdef([ac_cv_prog_CPP])dnl - -dnl Finally, set Makefile variables -dnl -BUILD_EXEEXT=$ac_build_exeext -BUILD_OBJEXT=$ac_build_objext -AC_SUBST(BUILD_EXEEXT)dnl -AC_SUBST(BUILD_OBJEXT)dnl -AC_SUBST([CFLAGS_FOR_BUILD])dnl -AC_SUBST([CPPFLAGS_FOR_BUILD])dnl -AC_SUBST([LDFLAGS_FOR_BUILD])dnl -]) diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 deleted file mode 100644 index b74acb8c..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 +++ /dev/null @@ -1,69 +0,0 @@ -dnl libsecp25k1 helper checks -AC_DEFUN([SECP_INT128_CHECK],[ -has_int128=$ac_cv_type___int128 -]) - -dnl escape "$0x" below using the m4 quadrigaph @S|@, and escape it again with a \ for the shell. -AC_DEFUN([SECP_64BIT_ASM_CHECK],[ -AC_MSG_CHECKING(for x86_64 assembly availability) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include ]],[[ - uint64_t a = 11, tmp; - __asm__ __volatile__("movq \@S|@0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx"); - ]])],[has_64bit_asm=yes],[has_64bit_asm=no]) -AC_MSG_RESULT([$has_64bit_asm]) -]) - -dnl -AC_DEFUN([SECP_OPENSSL_CHECK],[ - has_libcrypto=no - m4_ifdef([PKG_CHECK_MODULES],[ - PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes],[has_libcrypto=no]) - if test x"$has_libcrypto" = x"yes"; then - TEMP_LIBS="$LIBS" - LIBS="$LIBS $CRYPTO_LIBS" - AC_CHECK_LIB(crypto, main,[AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])],[has_libcrypto=no]) - LIBS="$TEMP_LIBS" - fi - ]) - if test x$has_libcrypto = xno; then - AC_CHECK_HEADER(openssl/crypto.h,[ - AC_CHECK_LIB(crypto, main,[ - has_libcrypto=yes - CRYPTO_LIBS=-lcrypto - AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed]) - ]) - ]) - LIBS= - fi -if test x"$has_libcrypto" = x"yes" && test x"$has_openssl_ec" = x; then - AC_MSG_CHECKING(for EC functions in libcrypto) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - #include ]],[[ - EC_KEY *eckey = EC_KEY_new_by_curve_name(NID_secp256k1); - ECDSA_sign(0, NULL, 0, NULL, NULL, eckey); - ECDSA_verify(0, NULL, 0, NULL, 0, eckey); - EC_KEY_free(eckey); - ECDSA_SIG *sig_openssl; - sig_openssl = ECDSA_SIG_new(); - (void)sig_openssl->r; - ECDSA_SIG_free(sig_openssl); - ]])],[has_openssl_ec=yes],[has_openssl_ec=no]) - AC_MSG_RESULT([$has_openssl_ec]) -fi -]) - -dnl -AC_DEFUN([SECP_GMP_CHECK],[ -if test x"$has_gmp" != x"yes"; then - CPPFLAGS_TEMP="$CPPFLAGS" - CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS" - LIBS_TEMP="$LIBS" - LIBS="$GMP_LIBS $LIBS" - AC_CHECK_HEADER(gmp.h,[AC_CHECK_LIB(gmp, __gmpz_init,[has_gmp=yes; GMP_LIBS="$GMP_LIBS -lgmp"; AC_DEFINE(HAVE_LIBGMP,1,[Define this symbol if libgmp is installed])])]) - CPPFLAGS="$CPPFLAGS_TEMP" - LIBS="$LIBS_TEMP" -fi -]) diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac deleted file mode 100644 index e5fcbcb4..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac +++ /dev/null @@ -1,493 +0,0 @@ -AC_PREREQ([2.60]) -AC_INIT([libsecp256k1],[0.1]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([build-aux/m4]) -AC_CANONICAL_HOST -AH_TOP([#ifndef LIBSECP256K1_CONFIG_H]) -AH_TOP([#define LIBSECP256K1_CONFIG_H]) -AH_BOTTOM([#endif /*LIBSECP256K1_CONFIG_H*/]) -AM_INIT_AUTOMAKE([foreign subdir-objects]) -LT_INIT - -dnl make the compilation flags quiet unless V=1 is used -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -PKG_PROG_PKG_CONFIG - -AC_PATH_TOOL(AR, ar) -AC_PATH_TOOL(RANLIB, ranlib) -AC_PATH_TOOL(STRIP, strip) -AX_PROG_CC_FOR_BUILD - -if test "x$CFLAGS" = "x"; then - CFLAGS="-g" -fi - -AM_PROG_CC_C_O - -AC_PROG_CC_C89 -if test x"$ac_cv_prog_cc_c89" = x"no"; then - AC_MSG_ERROR([c89 compiler support required]) -fi -AM_PROG_AS - -case $host_os in - *darwin*) - if test x$cross_compiling != xyes; then - AC_PATH_PROG([BREW],brew,) - if test x$BREW != x; then - dnl These Homebrew packages may be keg-only, meaning that they won't be found - dnl in expected paths because they may conflict with system files. Ask - dnl Homebrew where each one is located, then adjust paths accordingly. - - openssl_prefix=`$BREW --prefix openssl 2>/dev/null` - gmp_prefix=`$BREW --prefix gmp 2>/dev/null` - if test x$openssl_prefix != x; then - PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" - export PKG_CONFIG_PATH - fi - if test x$gmp_prefix != x; then - GMP_CPPFLAGS="-I$gmp_prefix/include" - GMP_LIBS="-L$gmp_prefix/lib" - fi - else - AC_PATH_PROG([PORT],port,) - dnl if homebrew isn't installed and macports is, add the macports default paths - dnl as a last resort. - if test x$PORT != x; then - CPPFLAGS="$CPPFLAGS -isystem /opt/local/include" - LDFLAGS="$LDFLAGS -L/opt/local/lib" - fi - fi - fi - ;; -esac - -CFLAGS="$CFLAGS -W" - -warn_CFLAGS="-std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings" -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $warn_CFLAGS" -AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$saved_CFLAGS" - ]) - -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -fvisibility=hidden" -AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$saved_CFLAGS" - ]) - -AC_ARG_ENABLE(benchmark, - AS_HELP_STRING([--enable-benchmark],[compile benchmark (default is no)]), - [use_benchmark=$enableval], - [use_benchmark=no]) - -AC_ARG_ENABLE(coverage, - AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis]), - [enable_coverage=$enableval], - [enable_coverage=no]) - -AC_ARG_ENABLE(tests, - AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), - [use_tests=$enableval], - [use_tests=yes]) - -AC_ARG_ENABLE(openssl_tests, - AS_HELP_STRING([--enable-openssl-tests],[enable OpenSSL tests, if OpenSSL is available (default is auto)]), - [enable_openssl_tests=$enableval], - [enable_openssl_tests=auto]) - -AC_ARG_ENABLE(experimental, - AS_HELP_STRING([--enable-experimental],[allow experimental configure options (default is no)]), - [use_experimental=$enableval], - [use_experimental=no]) - -AC_ARG_ENABLE(exhaustive_tests, - AS_HELP_STRING([--enable-exhaustive-tests],[compile exhaustive tests (default is yes)]), - [use_exhaustive_tests=$enableval], - [use_exhaustive_tests=yes]) - -AC_ARG_ENABLE(endomorphism, - AS_HELP_STRING([--enable-endomorphism],[enable endomorphism (default is no)]), - [use_endomorphism=$enableval], - [use_endomorphism=no]) - -AC_ARG_ENABLE(ecmult_static_precomputation, - AS_HELP_STRING([--enable-ecmult-static-precomputation],[enable precomputed ecmult table for signing (default is yes)]), - [use_ecmult_static_precomputation=$enableval], - [use_ecmult_static_precomputation=auto]) - -AC_ARG_ENABLE(module_ecdh, - AS_HELP_STRING([--enable-module-ecdh],[enable ECDH shared secret computation (experimental)]), - [enable_module_ecdh=$enableval], - [enable_module_ecdh=no]) - -AC_ARG_ENABLE(module_recovery, - AS_HELP_STRING([--enable-module-recovery],[enable ECDSA pubkey recovery module (default is no)]), - [enable_module_recovery=$enableval], - [enable_module_recovery=no]) - -AC_ARG_ENABLE(jni, - AS_HELP_STRING([--enable-jni],[enable libsecp256k1_jni (default is auto)]), - [use_jni=$enableval], - [use_jni=auto]) - -AC_ARG_WITH([field], [AS_HELP_STRING([--with-field=64bit|32bit|auto], -[Specify Field Implementation. Default is auto])],[req_field=$withval], [req_field=auto]) - -AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|no|auto], -[Specify Bignum Implementation. Default is auto])],[req_bignum=$withval], [req_bignum=auto]) - -AC_ARG_WITH([scalar], [AS_HELP_STRING([--with-scalar=64bit|32bit|auto], -[Specify scalar implementation. Default is auto])],[req_scalar=$withval], [req_scalar=auto]) - -AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto] -[Specify assembly optimizations to use. Default is auto (experimental: arm)])],[req_asm=$withval], [req_asm=auto]) - -AC_CHECK_TYPES([__int128]) - -AC_MSG_CHECKING([for __builtin_expect]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void myfunc() {__builtin_expect(0,0);}]])], - [ AC_MSG_RESULT([yes]);AC_DEFINE(HAVE_BUILTIN_EXPECT,1,[Define this symbol if __builtin_expect is available]) ], - [ AC_MSG_RESULT([no]) - ]) - -if test x"$enable_coverage" = x"yes"; then - AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code]) - CFLAGS="$CFLAGS -O0 --coverage" - LDFLAGS="--coverage" -else - CFLAGS="$CFLAGS -O3" -fi - -if test x"$use_ecmult_static_precomputation" != x"no"; then - save_cross_compiling=$cross_compiling - cross_compiling=no - TEMP_CC="$CC" - CC="$CC_FOR_BUILD" - AC_MSG_CHECKING([native compiler: ${CC_FOR_BUILD}]) - AC_RUN_IFELSE( - [AC_LANG_PROGRAM([], [return 0])], - [working_native_cc=yes], - [working_native_cc=no],[dnl]) - CC="$TEMP_CC" - cross_compiling=$save_cross_compiling - - if test x"$working_native_cc" = x"no"; then - set_precomp=no - if test x"$use_ecmult_static_precomputation" = x"yes"; then - AC_MSG_ERROR([${CC_FOR_BUILD} does not produce working binaries. Please set CC_FOR_BUILD]) - else - AC_MSG_RESULT([${CC_FOR_BUILD} does not produce working binaries. Please set CC_FOR_BUILD]) - fi - else - AC_MSG_RESULT([ok]) - set_precomp=yes - fi -else - set_precomp=no -fi - -if test x"$req_asm" = x"auto"; then - SECP_64BIT_ASM_CHECK - if test x"$has_64bit_asm" = x"yes"; then - set_asm=x86_64 - fi - if test x"$set_asm" = x; then - set_asm=no - fi -else - set_asm=$req_asm - case $set_asm in - x86_64) - SECP_64BIT_ASM_CHECK - if test x"$has_64bit_asm" != x"yes"; then - AC_MSG_ERROR([x86_64 assembly optimization requested but not available]) - fi - ;; - arm) - ;; - no) - ;; - *) - AC_MSG_ERROR([invalid assembly optimization selection]) - ;; - esac -fi - -if test x"$req_field" = x"auto"; then - if test x"set_asm" = x"x86_64"; then - set_field=64bit - fi - if test x"$set_field" = x; then - SECP_INT128_CHECK - if test x"$has_int128" = x"yes"; then - set_field=64bit - fi - fi - if test x"$set_field" = x; then - set_field=32bit - fi -else - set_field=$req_field - case $set_field in - 64bit) - if test x"$set_asm" != x"x86_64"; then - SECP_INT128_CHECK - if test x"$has_int128" != x"yes"; then - AC_MSG_ERROR([64bit field explicitly requested but neither __int128 support or x86_64 assembly available]) - fi - fi - ;; - 32bit) - ;; - *) - AC_MSG_ERROR([invalid field implementation selection]) - ;; - esac -fi - -if test x"$req_scalar" = x"auto"; then - SECP_INT128_CHECK - if test x"$has_int128" = x"yes"; then - set_scalar=64bit - fi - if test x"$set_scalar" = x; then - set_scalar=32bit - fi -else - set_scalar=$req_scalar - case $set_scalar in - 64bit) - SECP_INT128_CHECK - if test x"$has_int128" != x"yes"; then - AC_MSG_ERROR([64bit scalar explicitly requested but __int128 support not available]) - fi - ;; - 32bit) - ;; - *) - AC_MSG_ERROR([invalid scalar implementation selected]) - ;; - esac -fi - -if test x"$req_bignum" = x"auto"; then - SECP_GMP_CHECK - if test x"$has_gmp" = x"yes"; then - set_bignum=gmp - fi - - if test x"$set_bignum" = x; then - set_bignum=no - fi -else - set_bignum=$req_bignum - case $set_bignum in - gmp) - SECP_GMP_CHECK - if test x"$has_gmp" != x"yes"; then - AC_MSG_ERROR([gmp bignum explicitly requested but libgmp not available]) - fi - ;; - no) - ;; - *) - AC_MSG_ERROR([invalid bignum implementation selection]) - ;; - esac -fi - -# select assembly optimization -use_external_asm=no - -case $set_asm in -x86_64) - AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations]) - ;; -arm) - use_external_asm=yes - ;; -no) - ;; -*) - AC_MSG_ERROR([invalid assembly optimizations]) - ;; -esac - -# select field implementation -case $set_field in -64bit) - AC_DEFINE(USE_FIELD_5X52, 1, [Define this symbol to use the FIELD_5X52 implementation]) - ;; -32bit) - AC_DEFINE(USE_FIELD_10X26, 1, [Define this symbol to use the FIELD_10X26 implementation]) - ;; -*) - AC_MSG_ERROR([invalid field implementation]) - ;; -esac - -# select bignum implementation -case $set_bignum in -gmp) - AC_DEFINE(HAVE_LIBGMP, 1, [Define this symbol if libgmp is installed]) - AC_DEFINE(USE_NUM_GMP, 1, [Define this symbol to use the gmp implementation for num]) - AC_DEFINE(USE_FIELD_INV_NUM, 1, [Define this symbol to use the num-based field inverse implementation]) - AC_DEFINE(USE_SCALAR_INV_NUM, 1, [Define this symbol to use the num-based scalar inverse implementation]) - ;; -no) - AC_DEFINE(USE_NUM_NONE, 1, [Define this symbol to use no num implementation]) - AC_DEFINE(USE_FIELD_INV_BUILTIN, 1, [Define this symbol to use the native field inverse implementation]) - AC_DEFINE(USE_SCALAR_INV_BUILTIN, 1, [Define this symbol to use the native scalar inverse implementation]) - ;; -*) - AC_MSG_ERROR([invalid bignum implementation]) - ;; -esac - -#select scalar implementation -case $set_scalar in -64bit) - AC_DEFINE(USE_SCALAR_4X64, 1, [Define this symbol to use the 4x64 scalar implementation]) - ;; -32bit) - AC_DEFINE(USE_SCALAR_8X32, 1, [Define this symbol to use the 8x32 scalar implementation]) - ;; -*) - AC_MSG_ERROR([invalid scalar implementation]) - ;; -esac - -if test x"$use_tests" = x"yes"; then - SECP_OPENSSL_CHECK - if test x"$has_openssl_ec" = x"yes"; then - if test x"$enable_openssl_tests" != x"no"; then - AC_DEFINE(ENABLE_OPENSSL_TESTS, 1, [Define this symbol if OpenSSL EC functions are available]) - SECP_TEST_INCLUDES="$SSL_CFLAGS $CRYPTO_CFLAGS" - SECP_TEST_LIBS="$CRYPTO_LIBS" - - case $host in - *mingw*) - SECP_TEST_LIBS="$SECP_TEST_LIBS -lgdi32" - ;; - esac - fi - else - if test x"$enable_openssl_tests" = x"yes"; then - AC_MSG_ERROR([OpenSSL tests requested but OpenSSL with EC support is not available]) - fi - fi -else - if test x"$enable_openssl_tests" = x"yes"; then - AC_MSG_ERROR([OpenSSL tests requested but tests are not enabled]) - fi -fi - -if test x"$use_jni" != x"no"; then - AX_JNI_INCLUDE_DIR - have_jni_dependencies=yes - if test x"$enable_module_ecdh" = x"no"; then - have_jni_dependencies=no - fi - if test "x$JNI_INCLUDE_DIRS" = "x"; then - have_jni_dependencies=no - fi - if test "x$have_jni_dependencies" = "xno"; then - if test x"$use_jni" = x"yes"; then - AC_MSG_ERROR([jni support explicitly requested but headers/dependencies were not found. Enable ECDH and try again.]) - fi - AC_MSG_WARN([jni headers/dependencies not found. jni support disabled]) - use_jni=no - else - use_jni=yes - for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do - JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR" - done - fi -fi - -if test x"$set_bignum" = x"gmp"; then - SECP_LIBS="$SECP_LIBS $GMP_LIBS" - SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS" -fi - -if test x"$use_endomorphism" = x"yes"; then - AC_DEFINE(USE_ENDOMORPHISM, 1, [Define this symbol to use endomorphism optimization]) -fi - -if test x"$set_precomp" = x"yes"; then - AC_DEFINE(USE_ECMULT_STATIC_PRECOMPUTATION, 1, [Define this symbol to use a statically generated ecmult table]) -fi - -if test x"$enable_module_ecdh" = x"yes"; then - AC_DEFINE(ENABLE_MODULE_ECDH, 1, [Define this symbol to enable the ECDH module]) -fi - -if test x"$enable_module_recovery" = x"yes"; then - AC_DEFINE(ENABLE_MODULE_RECOVERY, 1, [Define this symbol to enable the ECDSA pubkey recovery module]) -fi - -AC_C_BIGENDIAN() - -if test x"$use_external_asm" = x"yes"; then - AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used]) -fi - -AC_MSG_NOTICE([Using static precomputation: $set_precomp]) -AC_MSG_NOTICE([Using assembly optimizations: $set_asm]) -AC_MSG_NOTICE([Using field implementation: $set_field]) -AC_MSG_NOTICE([Using bignum implementation: $set_bignum]) -AC_MSG_NOTICE([Using scalar implementation: $set_scalar]) -AC_MSG_NOTICE([Using endomorphism optimizations: $use_endomorphism]) -AC_MSG_NOTICE([Building for coverage analysis: $enable_coverage]) -AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh]) -AC_MSG_NOTICE([Building ECDSA pubkey recovery module: $enable_module_recovery]) -AC_MSG_NOTICE([Using jni: $use_jni]) - -if test x"$enable_experimental" = x"yes"; then - AC_MSG_NOTICE([******]) - AC_MSG_NOTICE([WARNING: experimental build]) - AC_MSG_NOTICE([Experimental features do not have stable APIs or properties, and may not be safe for production use.]) - AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh]) - AC_MSG_NOTICE([******]) -else - if test x"$enable_module_ecdh" = x"yes"; then - AC_MSG_ERROR([ECDH module is experimental. Use --enable-experimental to allow.]) - fi - if test x"$set_asm" = x"arm"; then - AC_MSG_ERROR([ARM assembly optimization is experimental. Use --enable-experimental to allow.]) - fi -fi - -AC_CONFIG_HEADERS([src/libsecp256k1-config.h]) -AC_CONFIG_FILES([Makefile libsecp256k1.pc]) -AC_SUBST(JNI_INCLUDES) -AC_SUBST(SECP_INCLUDES) -AC_SUBST(SECP_LIBS) -AC_SUBST(SECP_TEST_LIBS) -AC_SUBST(SECP_TEST_INCLUDES) -AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"]) -AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"]) -AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"]) -AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"]) -AM_CONDITIONAL([USE_ECMULT_STATIC_PRECOMPUTATION], [test x"$set_precomp" = x"yes"]) -AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"]) -AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"]) -AM_CONDITIONAL([USE_JNI], [test x"$use_jni" == x"yes"]) -AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"]) -AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"]) - -dnl make sure nothing new is exported so that we don't break the cache -PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH" -unset PKG_CONFIG_PATH -PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP" - -AC_OUTPUT diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c deleted file mode 100644 index 5b141a99..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c +++ /dev/null @@ -1,150 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "lax_der_parsing.h" - -int ecdsa_signature_parse_der_lax(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) { - size_t rpos, rlen, spos, slen; - size_t pos = 0; - size_t lenbyte; - unsigned char tmpsig[64] = {0}; - int overflow = 0; - - /* Hack to initialize sig with a correctly-parsed but invalid signature. */ - secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); - - /* Sequence tag byte */ - if (pos == inputlen || input[pos] != 0x30) { - return 0; - } - pos++; - - /* Sequence length bytes */ - if (pos == inputlen) { - return 0; - } - lenbyte = input[pos++]; - if (lenbyte & 0x80) { - lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { - return 0; - } - pos += lenbyte; - } - - /* Integer tag byte for R */ - if (pos == inputlen || input[pos] != 0x02) { - return 0; - } - pos++; - - /* Integer length for R */ - if (pos == inputlen) { - return 0; - } - lenbyte = input[pos++]; - if (lenbyte & 0x80) { - lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { - return 0; - } - while (lenbyte > 0 && input[pos] == 0) { - pos++; - lenbyte--; - } - if (lenbyte >= sizeof(size_t)) { - return 0; - } - rlen = 0; - while (lenbyte > 0) { - rlen = (rlen << 8) + input[pos]; - pos++; - lenbyte--; - } - } else { - rlen = lenbyte; - } - if (rlen > inputlen - pos) { - return 0; - } - rpos = pos; - pos += rlen; - - /* Integer tag byte for S */ - if (pos == inputlen || input[pos] != 0x02) { - return 0; - } - pos++; - - /* Integer length for S */ - if (pos == inputlen) { - return 0; - } - lenbyte = input[pos++]; - if (lenbyte & 0x80) { - lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { - return 0; - } - while (lenbyte > 0 && input[pos] == 0) { - pos++; - lenbyte--; - } - if (lenbyte >= sizeof(size_t)) { - return 0; - } - slen = 0; - while (lenbyte > 0) { - slen = (slen << 8) + input[pos]; - pos++; - lenbyte--; - } - } else { - slen = lenbyte; - } - if (slen > inputlen - pos) { - return 0; - } - spos = pos; - pos += slen; - - /* Ignore leading zeroes in R */ - while (rlen > 0 && input[rpos] == 0) { - rlen--; - rpos++; - } - /* Copy R value */ - if (rlen > 32) { - overflow = 1; - } else { - memcpy(tmpsig + 32 - rlen, input + rpos, rlen); - } - - /* Ignore leading zeroes in S */ - while (slen > 0 && input[spos] == 0) { - slen--; - spos++; - } - /* Copy S value */ - if (slen > 32) { - overflow = 1; - } else { - memcpy(tmpsig + 64 - slen, input + spos, slen); - } - - if (!overflow) { - overflow = !secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); - } - if (overflow) { - memset(tmpsig, 0, 64); - secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); - } - return 1; -} - diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h deleted file mode 100644 index 6d27871a..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h +++ /dev/null @@ -1,91 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -/**** - * Please do not link this file directly. It is not part of the libsecp256k1 - * project and does not promise any stability in its API, functionality or - * presence. Projects which use this code should instead copy this header - * and its accompanying .c file directly into their codebase. - ****/ - -/* This file defines a function that parses DER with various errors and - * violations. This is not a part of the library itself, because the allowed - * violations are chosen arbitrarily and do not follow or establish any - * standard. - * - * In many places it matters that different implementations do not only accept - * the same set of valid signatures, but also reject the same set of signatures. - * The only means to accomplish that is by strictly obeying a standard, and not - * accepting anything else. - * - * Nonetheless, sometimes there is a need for compatibility with systems that - * use signatures which do not strictly obey DER. The snippet below shows how - * certain violations are easily supported. You may need to adapt it. - * - * Do not use this for new systems. Use well-defined DER or compact signatures - * instead if you have the choice (see secp256k1_ecdsa_signature_parse_der and - * secp256k1_ecdsa_signature_parse_compact). - * - * The supported violations are: - * - All numbers are parsed as nonnegative integers, even though X.609-0207 - * section 8.3.3 specifies that integers are always encoded as two's - * complement. - * - Integers can have length 0, even though section 8.3.1 says they can't. - * - Integers with overly long padding are accepted, violation section - * 8.3.2. - * - 127-byte long length descriptors are accepted, even though section - * 8.1.3.5.c says that they are not. - * - Trailing garbage data inside or after the signature is ignored. - * - The length descriptor of the sequence is ignored. - * - * Compared to for example OpenSSL, many violations are NOT supported: - * - Using overly long tag descriptors for the sequence or integers inside, - * violating section 8.1.2.2. - * - Encoding primitive integers as constructed values, violating section - * 8.3.1. - */ - -#ifndef _SECP256K1_CONTRIB_LAX_DER_PARSING_H_ -#define _SECP256K1_CONTRIB_LAX_DER_PARSING_H_ - -#include - -# ifdef __cplusplus -extern "C" { -# endif - -/** Parse a signature in "lax DER" format - * - * Returns: 1 when the signature could be parsed, 0 otherwise. - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input: a pointer to the signature to be parsed - * inputlen: the length of the array pointed to be input - * - * This function will accept any valid DER encoded signature, even if the - * encoded numbers are out of range. In addition, it will accept signatures - * which violate the DER spec in various ways. Its purpose is to allow - * validation of the Bitcoin blockchain, which includes non-DER signatures - * from before the network rules were updated to enforce DER. Note that - * the set of supported violations is a strict subset of what OpenSSL will - * accept. - * - * After the call, sig will always be initialized. If parsing failed or the - * encoded numbers are out of range, signature validation with it is - * guaranteed to fail for every message and public key. - */ -int ecdsa_signature_parse_der_lax( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const unsigned char *input, - size_t inputlen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c deleted file mode 100644 index c2e63b4b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c +++ /dev/null @@ -1,113 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014, 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "lax_der_privatekey_parsing.h" - -int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) { - const unsigned char *end = privkey + privkeylen; - int lenb = 0; - int len = 0; - memset(out32, 0, 32); - /* sequence header */ - if (end < privkey+1 || *privkey != 0x30) { - return 0; - } - privkey++; - /* sequence length constructor */ - if (end < privkey+1 || !(*privkey & 0x80)) { - return 0; - } - lenb = *privkey & ~0x80; privkey++; - if (lenb < 1 || lenb > 2) { - return 0; - } - if (end < privkey+lenb) { - return 0; - } - /* sequence length */ - len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0); - privkey += lenb; - if (end < privkey+len) { - return 0; - } - /* sequence element 0: version number (=1) */ - if (end < privkey+3 || privkey[0] != 0x02 || privkey[1] != 0x01 || privkey[2] != 0x01) { - return 0; - } - privkey += 3; - /* sequence element 1: octet string, up to 32 bytes */ - if (end < privkey+2 || privkey[0] != 0x04 || privkey[1] > 0x20 || end < privkey+2+privkey[1]) { - return 0; - } - memcpy(out32 + 32 - privkey[1], privkey + 2, privkey[1]); - if (!secp256k1_ec_seckey_verify(ctx, out32)) { - memset(out32, 0, 32); - return 0; - } - return 1; -} - -int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) { - secp256k1_pubkey pubkey; - size_t pubkeylen = 0; - if (!secp256k1_ec_pubkey_create(ctx, &pubkey, key32)) { - *privkeylen = 0; - return 0; - } - if (compressed) { - static const unsigned char begin[] = { - 0x30,0x81,0xD3,0x02,0x01,0x01,0x04,0x20 - }; - static const unsigned char middle[] = { - 0xA0,0x81,0x85,0x30,0x81,0x82,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48, - 0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04, - 0x21,0x02,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87, - 0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8, - 0x17,0x98,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E, - 0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x24,0x03,0x22,0x00 - }; - unsigned char *ptr = privkey; - memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin); - memcpy(ptr, key32, 32); ptr += 32; - memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle); - pubkeylen = 33; - secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED); - ptr += pubkeylen; - *privkeylen = ptr - privkey; - } else { - static const unsigned char begin[] = { - 0x30,0x82,0x01,0x13,0x02,0x01,0x01,0x04,0x20 - }; - static const unsigned char middle[] = { - 0xA0,0x81,0xA5,0x30,0x81,0xA2,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48, - 0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04, - 0x41,0x04,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87, - 0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8, - 0x17,0x98,0x48,0x3A,0xDA,0x77,0x26,0xA3,0xC4,0x65,0x5D,0xA4,0xFB,0xFC,0x0E,0x11, - 0x08,0xA8,0xFD,0x17,0xB4,0x48,0xA6,0x85,0x54,0x19,0x9C,0x47,0xD0,0x8F,0xFB,0x10, - 0xD4,0xB8,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E, - 0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x44,0x03,0x42,0x00 - }; - unsigned char *ptr = privkey; - memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin); - memcpy(ptr, key32, 32); ptr += 32; - memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle); - pubkeylen = 65; - secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED); - ptr += pubkeylen; - *privkeylen = ptr - privkey; - } - return 1; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h deleted file mode 100644 index 2fd088f8..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h +++ /dev/null @@ -1,90 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014, 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -/**** - * Please do not link this file directly. It is not part of the libsecp256k1 - * project and does not promise any stability in its API, functionality or - * presence. Projects which use this code should instead copy this header - * and its accompanying .c file directly into their codebase. - ****/ - -/* This file contains code snippets that parse DER private keys with - * various errors and violations. This is not a part of the library - * itself, because the allowed violations are chosen arbitrarily and - * do not follow or establish any standard. - * - * It also contains code to serialize private keys in a compatible - * manner. - * - * These functions are meant for compatibility with applications - * that require BER encoded keys. When working with secp256k1-specific - * code, the simple 32-byte private keys normally used by the - * library are sufficient. - */ - -#ifndef _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_ -#define _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_ - -#include - -# ifdef __cplusplus -extern "C" { -# endif - -/** Export a private key in DER format. - * - * Returns: 1 if the private key was valid. - * Args: ctx: pointer to a context object, initialized for signing (cannot - * be NULL) - * Out: privkey: pointer to an array for storing the private key in BER. - * Should have space for 279 bytes, and cannot be NULL. - * privkeylen: Pointer to an int where the length of the private key in - * privkey will be stored. - * In: seckey: pointer to a 32-byte secret key to export. - * compressed: 1 if the key should be exported in - * compressed format, 0 otherwise - * - * This function is purely meant for compatibility with applications that - * require BER encoded keys. When working with secp256k1-specific code, the - * simple 32-byte private keys are sufficient. - * - * Note that this function does not guarantee correct DER output. It is - * guaranteed to be parsable by secp256k1_ec_privkey_import_der - */ -SECP256K1_WARN_UNUSED_RESULT int ec_privkey_export_der( - const secp256k1_context* ctx, - unsigned char *privkey, - size_t *privkeylen, - const unsigned char *seckey, - int compressed -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Import a private key in DER format. - * Returns: 1 if a private key was extracted. - * Args: ctx: pointer to a context object (cannot be NULL). - * Out: seckey: pointer to a 32-byte array for storing the private key. - * (cannot be NULL). - * In: privkey: pointer to a private key in DER format (cannot be NULL). - * privkeylen: length of the DER private key pointed to be privkey. - * - * This function will accept more than just strict DER, and even allow some BER - * violations. The public key stored inside the DER-encoded private key is not - * verified for correctness, nor are the curve parameters. Use this function - * only if you know in advance it is supposed to contain a secp256k1 private - * key. - */ -SECP256K1_WARN_UNUSED_RESULT int ec_privkey_import_der( - const secp256k1_context* ctx, - unsigned char *seckey, - const unsigned char *privkey, - size_t privkeylen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h deleted file mode 100644 index f268e309..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h +++ /dev/null @@ -1,577 +0,0 @@ -#ifndef _SECP256K1_ -# define _SECP256K1_ - -# ifdef __cplusplus -extern "C" { -# endif - -#include - -/* These rules specify the order of arguments in API calls: - * - * 1. Context pointers go first, followed by output arguments, combined - * output/input arguments, and finally input-only arguments. - * 2. Array lengths always immediately the follow the argument whose length - * they describe, even if this violates rule 1. - * 3. Within the OUT/OUTIN/IN groups, pointers to data that is typically generated - * later go first. This means: signatures, public nonces, private nonces, - * messages, public keys, secret keys, tweaks. - * 4. Arguments that are not data pointers go last, from more complex to less - * complex: function pointers, algorithm names, messages, void pointers, - * counts, flags, booleans. - * 5. Opaque data pointers follow the function pointer they are to be passed to. - */ - -/** Opaque data structure that holds context information (precomputed tables etc.). - * - * The purpose of context structures is to cache large precomputed data tables - * that are expensive to construct, and also to maintain the randomization data - * for blinding. - * - * Do not create a new context object for each operation, as construction is - * far slower than all other API calls (~100 times slower than an ECDSA - * verification). - * - * A constructed context can safely be used from multiple threads - * simultaneously, but API call that take a non-const pointer to a context - * need exclusive access to it. In particular this is the case for - * secp256k1_context_destroy and secp256k1_context_randomize. - * - * Regarding randomization, either do it once at creation time (in which case - * you do not need any locking for the other calls), or use a read-write lock. - */ -typedef struct secp256k1_context_struct secp256k1_context; - -/** Opaque data structure that holds a parsed and valid public key. - * - * The exact representation of data inside is implementation defined and not - * guaranteed to be portable between different platforms or versions. It is - * however guaranteed to be 64 bytes in size, and can be safely copied/moved. - * If you need to convert to a format suitable for storage, transmission, or - * comparison, use secp256k1_ec_pubkey_serialize and secp256k1_ec_pubkey_parse. - */ -typedef struct { - unsigned char data[64]; -} secp256k1_pubkey; - -/** Opaque data structured that holds a parsed ECDSA signature. - * - * The exact representation of data inside is implementation defined and not - * guaranteed to be portable between different platforms or versions. It is - * however guaranteed to be 64 bytes in size, and can be safely copied/moved. - * If you need to convert to a format suitable for storage, transmission, or - * comparison, use the secp256k1_ecdsa_signature_serialize_* and - * secp256k1_ecdsa_signature_serialize_* functions. - */ -typedef struct { - unsigned char data[64]; -} secp256k1_ecdsa_signature; - -/** A pointer to a function to deterministically generate a nonce. - * - * Returns: 1 if a nonce was successfully generated. 0 will cause signing to fail. - * Out: nonce32: pointer to a 32-byte array to be filled by the function. - * In: msg32: the 32-byte message hash being verified (will not be NULL) - * key32: pointer to a 32-byte secret key (will not be NULL) - * algo16: pointer to a 16-byte array describing the signature - * algorithm (will be NULL for ECDSA for compatibility). - * data: Arbitrary data pointer that is passed through. - * attempt: how many iterations we have tried to find a nonce. - * This will almost always be 0, but different attempt values - * are required to result in a different nonce. - * - * Except for test cases, this function should compute some cryptographic hash of - * the message, the algorithm, the key and the attempt. - */ -typedef int (*secp256k1_nonce_function)( - unsigned char *nonce32, - const unsigned char *msg32, - const unsigned char *key32, - const unsigned char *algo16, - void *data, - unsigned int attempt -); - -# if !defined(SECP256K1_GNUC_PREREQ) -# if defined(__GNUC__)&&defined(__GNUC_MINOR__) -# define SECP256K1_GNUC_PREREQ(_maj,_min) \ - ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) -# else -# define SECP256K1_GNUC_PREREQ(_maj,_min) 0 -# endif -# endif - -# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) ) -# if SECP256K1_GNUC_PREREQ(2,7) -# define SECP256K1_INLINE __inline__ -# elif (defined(_MSC_VER)) -# define SECP256K1_INLINE __inline -# else -# define SECP256K1_INLINE -# endif -# else -# define SECP256K1_INLINE inline -# endif - -#ifndef SECP256K1_API -# if defined(_WIN32) -# ifdef SECP256K1_BUILD -# define SECP256K1_API __declspec(dllexport) -# else -# define SECP256K1_API -# endif -# elif defined(__GNUC__) && defined(SECP256K1_BUILD) -# define SECP256K1_API __attribute__ ((visibility ("default"))) -# else -# define SECP256K1_API -# endif -#endif - -/**Warning attributes - * NONNULL is not used if SECP256K1_BUILD is set to avoid the compiler optimizing out - * some paranoid null checks. */ -# if defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4) -# define SECP256K1_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) -# else -# define SECP256K1_WARN_UNUSED_RESULT -# endif -# if !defined(SECP256K1_BUILD) && defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4) -# define SECP256K1_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x))) -# else -# define SECP256K1_ARG_NONNULL(_x) -# endif - -/** All flags' lower 8 bits indicate what they're for. Do not use directly. */ -#define SECP256K1_FLAGS_TYPE_MASK ((1 << 8) - 1) -#define SECP256K1_FLAGS_TYPE_CONTEXT (1 << 0) -#define SECP256K1_FLAGS_TYPE_COMPRESSION (1 << 1) -/** The higher bits contain the actual data. Do not use directly. */ -#define SECP256K1_FLAGS_BIT_CONTEXT_VERIFY (1 << 8) -#define SECP256K1_FLAGS_BIT_CONTEXT_SIGN (1 << 9) -#define SECP256K1_FLAGS_BIT_COMPRESSION (1 << 8) - -/** Flags to pass to secp256k1_context_create. */ -#define SECP256K1_CONTEXT_VERIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY) -#define SECP256K1_CONTEXT_SIGN (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN) -#define SECP256K1_CONTEXT_NONE (SECP256K1_FLAGS_TYPE_CONTEXT) - -/** Flag to pass to secp256k1_ec_pubkey_serialize and secp256k1_ec_privkey_export. */ -#define SECP256K1_EC_COMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION) -#define SECP256K1_EC_UNCOMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION) - -/** Create a secp256k1 context object. - * - * Returns: a newly created context object. - * In: flags: which parts of the context to initialize. - */ -SECP256K1_API secp256k1_context* secp256k1_context_create( - unsigned int flags -) SECP256K1_WARN_UNUSED_RESULT; - -/** Copies a secp256k1 context object. - * - * Returns: a newly created context object. - * Args: ctx: an existing context to copy (cannot be NULL) - */ -SECP256K1_API secp256k1_context* secp256k1_context_clone( - const secp256k1_context* ctx -) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT; - -/** Destroy a secp256k1 context object. - * - * The context pointer may not be used afterwards. - * Args: ctx: an existing context to destroy (cannot be NULL) - */ -SECP256K1_API void secp256k1_context_destroy( - secp256k1_context* ctx -); - -/** Set a callback function to be called when an illegal argument is passed to - * an API call. It will only trigger for violations that are mentioned - * explicitly in the header. - * - * The philosophy is that these shouldn't be dealt with through a - * specific return value, as calling code should not have branches to deal with - * the case that this code itself is broken. - * - * On the other hand, during debug stage, one would want to be informed about - * such mistakes, and the default (crashing) may be inadvisable. - * When this callback is triggered, the API function called is guaranteed not - * to cause a crash, though its return value and output arguments are - * undefined. - * - * Args: ctx: an existing context object (cannot be NULL) - * In: fun: a pointer to a function to call when an illegal argument is - * passed to the API, taking a message and an opaque pointer - * (NULL restores a default handler that calls abort). - * data: the opaque pointer to pass to fun above. - */ -SECP256K1_API void secp256k1_context_set_illegal_callback( - secp256k1_context* ctx, - void (*fun)(const char* message, void* data), - const void* data -) SECP256K1_ARG_NONNULL(1); - -/** Set a callback function to be called when an internal consistency check - * fails. The default is crashing. - * - * This can only trigger in case of a hardware failure, miscompilation, - * memory corruption, serious bug in the library, or other error would can - * otherwise result in undefined behaviour. It will not trigger due to mere - * incorrect usage of the API (see secp256k1_context_set_illegal_callback - * for that). After this callback returns, anything may happen, including - * crashing. - * - * Args: ctx: an existing context object (cannot be NULL) - * In: fun: a pointer to a function to call when an internal error occurs, - * taking a message and an opaque pointer (NULL restores a default - * handler that calls abort). - * data: the opaque pointer to pass to fun above. - */ -SECP256K1_API void secp256k1_context_set_error_callback( - secp256k1_context* ctx, - void (*fun)(const char* message, void* data), - const void* data -) SECP256K1_ARG_NONNULL(1); - -/** Parse a variable-length public key into the pubkey object. - * - * Returns: 1 if the public key was fully valid. - * 0 if the public key could not be parsed or is invalid. - * Args: ctx: a secp256k1 context object. - * Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to a - * parsed version of input. If not, its value is undefined. - * In: input: pointer to a serialized public key - * inputlen: length of the array pointed to by input - * - * This function supports parsing compressed (33 bytes, header byte 0x02 or - * 0x03), uncompressed (65 bytes, header byte 0x04), or hybrid (65 bytes, header - * byte 0x06 or 0x07) format public keys. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse( - const secp256k1_context* ctx, - secp256k1_pubkey* pubkey, - const unsigned char *input, - size_t inputlen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Serialize a pubkey object into a serialized byte sequence. - * - * Returns: 1 always. - * Args: ctx: a secp256k1 context object. - * Out: output: a pointer to a 65-byte (if compressed==0) or 33-byte (if - * compressed==1) byte array to place the serialized key - * in. - * In/Out: outputlen: a pointer to an integer which is initially set to the - * size of output, and is overwritten with the written - * size. - * In: pubkey: a pointer to a secp256k1_pubkey containing an - * initialized public key. - * flags: SECP256K1_EC_COMPRESSED if serialization should be in - * compressed format, otherwise SECP256K1_EC_UNCOMPRESSED. - */ -SECP256K1_API int secp256k1_ec_pubkey_serialize( - const secp256k1_context* ctx, - unsigned char *output, - size_t *outputlen, - const secp256k1_pubkey* pubkey, - unsigned int flags -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Parse an ECDSA signature in compact (64 bytes) format. - * - * Returns: 1 when the signature could be parsed, 0 otherwise. - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input64: a pointer to the 64-byte array to parse - * - * The signature must consist of a 32-byte big endian R value, followed by a - * 32-byte big endian S value. If R or S fall outside of [0..order-1], the - * encoding is invalid. R and S with value 0 are allowed in the encoding. - * - * After the call, sig will always be initialized. If parsing failed or R or - * S are zero, the resulting sig value is guaranteed to fail validation for any - * message and public key. - */ -SECP256K1_API int secp256k1_ecdsa_signature_parse_compact( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const unsigned char *input64 -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Parse a DER ECDSA signature. - * - * Returns: 1 when the signature could be parsed, 0 otherwise. - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input: a pointer to the signature to be parsed - * inputlen: the length of the array pointed to be input - * - * This function will accept any valid DER encoded signature, even if the - * encoded numbers are out of range. - * - * After the call, sig will always be initialized. If parsing failed or the - * encoded numbers are out of range, signature validation with it is - * guaranteed to fail for every message and public key. - */ -SECP256K1_API int secp256k1_ecdsa_signature_parse_der( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const unsigned char *input, - size_t inputlen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Serialize an ECDSA signature in DER format. - * - * Returns: 1 if enough space was available to serialize, 0 otherwise - * Args: ctx: a secp256k1 context object - * Out: output: a pointer to an array to store the DER serialization - * In/Out: outputlen: a pointer to a length integer. Initially, this integer - * should be set to the length of output. After the call - * it will be set to the length of the serialization (even - * if 0 was returned). - * In: sig: a pointer to an initialized signature object - */ -SECP256K1_API int secp256k1_ecdsa_signature_serialize_der( - const secp256k1_context* ctx, - unsigned char *output, - size_t *outputlen, - const secp256k1_ecdsa_signature* sig -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Serialize an ECDSA signature in compact (64 byte) format. - * - * Returns: 1 - * Args: ctx: a secp256k1 context object - * Out: output64: a pointer to a 64-byte array to store the compact serialization - * In: sig: a pointer to an initialized signature object - * - * See secp256k1_ecdsa_signature_parse_compact for details about the encoding. - */ -SECP256K1_API int secp256k1_ecdsa_signature_serialize_compact( - const secp256k1_context* ctx, - unsigned char *output64, - const secp256k1_ecdsa_signature* sig -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Verify an ECDSA signature. - * - * Returns: 1: correct signature - * 0: incorrect or unparseable signature - * Args: ctx: a secp256k1 context object, initialized for verification. - * In: sig: the signature being verified (cannot be NULL) - * msg32: the 32-byte message hash being verified (cannot be NULL) - * pubkey: pointer to an initialized public key to verify with (cannot be NULL) - * - * To avoid accepting malleable signatures, only ECDSA signatures in lower-S - * form are accepted. - * - * If you need to accept ECDSA signatures from sources that do not obey this - * rule, apply secp256k1_ecdsa_signature_normalize to the signature prior to - * validation, but be aware that doing so results in malleable signatures. - * - * For details, see the comments for that function. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify( - const secp256k1_context* ctx, - const secp256k1_ecdsa_signature *sig, - const unsigned char *msg32, - const secp256k1_pubkey *pubkey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Convert a signature to a normalized lower-S form. - * - * Returns: 1 if sigin was not normalized, 0 if it already was. - * Args: ctx: a secp256k1 context object - * Out: sigout: a pointer to a signature to fill with the normalized form, - * or copy if the input was already normalized. (can be NULL if - * you're only interested in whether the input was already - * normalized). - * In: sigin: a pointer to a signature to check/normalize (cannot be NULL, - * can be identical to sigout) - * - * With ECDSA a third-party can forge a second distinct signature of the same - * message, given a single initial signature, but without knowing the key. This - * is done by negating the S value modulo the order of the curve, 'flipping' - * the sign of the random point R which is not included in the signature. - * - * Forgery of the same message isn't universally problematic, but in systems - * where message malleability or uniqueness of signatures is important this can - * cause issues. This forgery can be blocked by all verifiers forcing signers - * to use a normalized form. - * - * The lower-S form reduces the size of signatures slightly on average when - * variable length encodings (such as DER) are used and is cheap to verify, - * making it a good choice. Security of always using lower-S is assured because - * anyone can trivially modify a signature after the fact to enforce this - * property anyway. - * - * The lower S value is always between 0x1 and - * 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, - * inclusive. - * - * No other forms of ECDSA malleability are known and none seem likely, but - * there is no formal proof that ECDSA, even with this additional restriction, - * is free of other malleability. Commonly used serialization schemes will also - * accept various non-unique encodings, so care should be taken when this - * property is required for an application. - * - * The secp256k1_ecdsa_sign function will by default create signatures in the - * lower-S form, and secp256k1_ecdsa_verify will not accept others. In case - * signatures come from a system that cannot enforce this property, - * secp256k1_ecdsa_signature_normalize must be called before verification. - */ -SECP256K1_API int secp256k1_ecdsa_signature_normalize( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature *sigout, - const secp256k1_ecdsa_signature *sigin -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3); - -/** An implementation of RFC6979 (using HMAC-SHA256) as nonce generation function. - * If a data pointer is passed, it is assumed to be a pointer to 32 bytes of - * extra entropy. - */ -SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_rfc6979; - -/** A default safe nonce generation function (currently equal to secp256k1_nonce_function_rfc6979). */ -SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_default; - -/** Create an ECDSA signature. - * - * Returns: 1: signature created - * 0: the nonce generation function failed, or the private key was invalid. - * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) - * Out: sig: pointer to an array where the signature will be placed (cannot be NULL) - * In: msg32: the 32-byte message hash being signed (cannot be NULL) - * seckey: pointer to a 32-byte secret key (cannot be NULL) - * noncefp:pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used - * ndata: pointer to arbitrary data used by the nonce generation function (can be NULL) - * - * The created signature is always in lower-S form. See - * secp256k1_ecdsa_signature_normalize for more details. - */ -SECP256K1_API int secp256k1_ecdsa_sign( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature *sig, - const unsigned char *msg32, - const unsigned char *seckey, - secp256k1_nonce_function noncefp, - const void *ndata -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Verify an ECDSA secret key. - * - * Returns: 1: secret key is valid - * 0: secret key is invalid - * Args: ctx: pointer to a context object (cannot be NULL) - * In: seckey: pointer to a 32-byte secret key (cannot be NULL) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify( - const secp256k1_context* ctx, - const unsigned char *seckey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2); - -/** Compute the public key for a secret key. - * - * Returns: 1: secret was valid, public key stores - * 0: secret was invalid, try again - * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) - * Out: pubkey: pointer to the created public key (cannot be NULL) - * In: seckey: pointer to a 32-byte private key (cannot be NULL) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const unsigned char *seckey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a private key by adding tweak to it. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or if the resulting private key - * would be invalid (only when the tweak is the complement of the - * private key). 1 otherwise. - * Args: ctx: pointer to a context object (cannot be NULL). - * In/Out: seckey: pointer to a 32-byte private key. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add( - const secp256k1_context* ctx, - unsigned char *seckey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a public key by adding tweak times the generator to it. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or if the resulting public key - * would be invalid (only when the tweak is the complement of the - * corresponding private key). 1 otherwise. - * Args: ctx: pointer to a context object initialized for validation - * (cannot be NULL). - * In/Out: pubkey: pointer to a public key object. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a private key by multiplying it by a tweak. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or equal to zero. 1 otherwise. - * Args: ctx: pointer to a context object (cannot be NULL). - * In/Out: seckey: pointer to a 32-byte private key. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul( - const secp256k1_context* ctx, - unsigned char *seckey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a public key by multiplying it by a tweak value. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or equal to zero. 1 otherwise. - * Args: ctx: pointer to a context object initialized for validation - * (cannot be NULL). - * In/Out: pubkey: pointer to a public key obkect. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Updates the context randomization. - * Returns: 1: randomization successfully updated - * 0: error - * Args: ctx: pointer to a context object (cannot be NULL) - * In: seed32: pointer to a 32-byte random seed (NULL resets to initial state) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_context_randomize( - secp256k1_context* ctx, - const unsigned char *seed32 -) SECP256K1_ARG_NONNULL(1); - -/** Add a number of public keys together. - * Returns: 1: the sum of the public keys is valid. - * 0: the sum of the public keys is not valid. - * Args: ctx: pointer to a context object - * Out: out: pointer to a public key object for placing the resulting public key - * (cannot be NULL) - * In: ins: pointer to array of pointers to public keys (cannot be NULL) - * n: the number of public keys to add together (must be at least 1) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_combine( - const secp256k1_context* ctx, - secp256k1_pubkey *out, - const secp256k1_pubkey * const * ins, - size_t n -) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h deleted file mode 100644 index 4b84d7a9..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _SECP256K1_ECDH_ -# define _SECP256K1_ECDH_ - -# include "secp256k1.h" - -# ifdef __cplusplus -extern "C" { -# endif - -/** Compute an EC Diffie-Hellman secret in constant time - * Returns: 1: exponentiation was successful - * 0: scalar was invalid (zero or overflow) - * Args: ctx: pointer to a context object (cannot be NULL) - * Out: result: a 32-byte array which will be populated by an ECDH - * secret computed from the point and scalar - * In: pubkey: a pointer to a secp256k1_pubkey containing an - * initialized public key - * privkey: a 32-byte scalar with which to multiply the point - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh( - const secp256k1_context* ctx, - unsigned char *result, - const secp256k1_pubkey *pubkey, - const unsigned char *privkey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h deleted file mode 100644 index 05537972..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef _SECP256K1_RECOVERY_ -# define _SECP256K1_RECOVERY_ - -# include "secp256k1.h" - -# ifdef __cplusplus -extern "C" { -# endif - -/** Opaque data structured that holds a parsed ECDSA signature, - * supporting pubkey recovery. - * - * The exact representation of data inside is implementation defined and not - * guaranteed to be portable between different platforms or versions. It is - * however guaranteed to be 65 bytes in size, and can be safely copied/moved. - * If you need to convert to a format suitable for storage or transmission, use - * the secp256k1_ecdsa_signature_serialize_* and - * secp256k1_ecdsa_signature_parse_* functions. - * - * Furthermore, it is guaranteed that identical signatures (including their - * recoverability) will have identical representation, so they can be - * memcmp'ed. - */ -typedef struct { - unsigned char data[65]; -} secp256k1_ecdsa_recoverable_signature; - -/** Parse a compact ECDSA signature (64 bytes + recovery id). - * - * Returns: 1 when the signature could be parsed, 0 otherwise - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input64: a pointer to a 64-byte compact signature - * recid: the recovery id (0, 1, 2 or 3) - */ -SECP256K1_API int secp256k1_ecdsa_recoverable_signature_parse_compact( - const secp256k1_context* ctx, - secp256k1_ecdsa_recoverable_signature* sig, - const unsigned char *input64, - int recid -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Convert a recoverable signature into a normal signature. - * - * Returns: 1 - * Out: sig: a pointer to a normal signature (cannot be NULL). - * In: sigin: a pointer to a recoverable signature (cannot be NULL). - */ -SECP256K1_API int secp256k1_ecdsa_recoverable_signature_convert( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const secp256k1_ecdsa_recoverable_signature* sigin -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Serialize an ECDSA signature in compact format (64 bytes + recovery id). - * - * Returns: 1 - * Args: ctx: a secp256k1 context object - * Out: output64: a pointer to a 64-byte array of the compact signature (cannot be NULL) - * recid: a pointer to an integer to hold the recovery id (can be NULL). - * In: sig: a pointer to an initialized signature object (cannot be NULL) - */ -SECP256K1_API int secp256k1_ecdsa_recoverable_signature_serialize_compact( - const secp256k1_context* ctx, - unsigned char *output64, - int *recid, - const secp256k1_ecdsa_recoverable_signature* sig -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Create a recoverable ECDSA signature. - * - * Returns: 1: signature created - * 0: the nonce generation function failed, or the private key was invalid. - * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) - * Out: sig: pointer to an array where the signature will be placed (cannot be NULL) - * In: msg32: the 32-byte message hash being signed (cannot be NULL) - * seckey: pointer to a 32-byte secret key (cannot be NULL) - * noncefp:pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used - * ndata: pointer to arbitrary data used by the nonce generation function (can be NULL) - */ -SECP256K1_API int secp256k1_ecdsa_sign_recoverable( - const secp256k1_context* ctx, - secp256k1_ecdsa_recoverable_signature *sig, - const unsigned char *msg32, - const unsigned char *seckey, - secp256k1_nonce_function noncefp, - const void *ndata -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Recover an ECDSA public key from a signature. - * - * Returns: 1: public key successfully recovered (which guarantees a correct signature). - * 0: otherwise. - * Args: ctx: pointer to a context object, initialized for verification (cannot be NULL) - * Out: pubkey: pointer to the recovered public key (cannot be NULL) - * In: sig: pointer to initialized signature that supports pubkey recovery (cannot be NULL) - * msg32: the 32-byte message hash assumed to be signed (cannot be NULL) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_recover( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const secp256k1_ecdsa_recoverable_signature *sig, - const unsigned char *msg32 -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in deleted file mode 100644 index a0d006f1..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libsecp256k1 -Description: Optimized C library for EC operations on curve secp256k1 -URL: https://github.com/bitcoin-core/secp256k1 -Version: @PACKAGE_VERSION@ -Cflags: -I${includedir} -Libs.private: @SECP_LIBS@ -Libs: -L${libdir} -lsecp256k1 - diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/obj/.gitignore b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/obj/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage deleted file mode 100644 index ab580c5b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage +++ /dev/null @@ -1,322 +0,0 @@ -# This code supports verifying group implementations which have branches -# or conditional statements (like cmovs), by allowing each execution path -# to independently set assumptions on input or intermediary variables. -# -# The general approach is: -# * A constraint is a tuple of two sets of of symbolic expressions: -# the first of which are required to evaluate to zero, the second of which -# are required to evaluate to nonzero. -# - A constraint is said to be conflicting if any of its nonzero expressions -# is in the ideal with basis the zero expressions (in other words: when the -# zero expressions imply that one of the nonzero expressions are zero). -# * There is a list of laws that describe the intended behaviour, including -# laws for addition and doubling. Each law is called with the symbolic point -# coordinates as arguments, and returns: -# - A constraint describing the assumptions under which it is applicable, -# called "assumeLaw" -# - A constraint describing the requirements of the law, called "require" -# * Implementations are transliterated into functions that operate as well on -# algebraic input points, and are called once per combination of branches -# exectured. Each execution returns: -# - A constraint describing the assumptions this implementation requires -# (such as Z1=1), called "assumeFormula" -# - A constraint describing the assumptions this specific branch requires, -# but which is by construction guaranteed to cover the entire space by -# merging the results from all branches, called "assumeBranch" -# - The result of the computation -# * All combinations of laws with implementation branches are tried, and: -# - If the combination of assumeLaw, assumeFormula, and assumeBranch results -# in a conflict, it means this law does not apply to this branch, and it is -# skipped. -# - For others, we try to prove the require constraints hold, assuming the -# information in assumeLaw + assumeFormula + assumeBranch, and if this does -# not succeed, we fail. -# + To prove an expression is zero, we check whether it belongs to the -# ideal with the assumed zero expressions as basis. This test is exact. -# + To prove an expression is nonzero, we check whether each of its -# factors is contained in the set of nonzero assumptions' factors. -# This test is not exact, so various combinations of original and -# reduced expressions' factors are tried. -# - If we succeed, we print out the assumptions from assumeFormula that -# weren't implied by assumeLaw already. Those from assumeBranch are skipped, -# as we assume that all constraints in it are complementary with each other. -# -# Based on the sage verification scripts used in the Explicit-Formulas Database -# by Tanja Lange and others, see http://hyperelliptic.org/EFD - -class fastfrac: - """Fractions over rings.""" - - def __init__(self,R,top,bot=1): - """Construct a fractional, given a ring, a numerator, and denominator.""" - self.R = R - if parent(top) == ZZ or parent(top) == R: - self.top = R(top) - self.bot = R(bot) - elif top.__class__ == fastfrac: - self.top = top.top - self.bot = top.bot * bot - else: - self.top = R(numerator(top)) - self.bot = R(denominator(top)) * bot - - def iszero(self,I): - """Return whether this fraction is zero given an ideal.""" - return self.top in I and self.bot not in I - - def reduce(self,assumeZero): - zero = self.R.ideal(map(numerator, assumeZero)) - return fastfrac(self.R, zero.reduce(self.top)) / fastfrac(self.R, zero.reduce(self.bot)) - - def __add__(self,other): - """Add two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top + self.bot * other,self.bot) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.bot + self.bot * other.top,self.bot * other.bot) - return NotImplemented - - def __sub__(self,other): - """Subtract two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top - self.bot * other,self.bot) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.bot - self.bot * other.top,self.bot * other.bot) - return NotImplemented - - def __neg__(self): - """Return the negation of a fraction.""" - return fastfrac(self.R,-self.top,self.bot) - - def __mul__(self,other): - """Multiply two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top * other,self.bot) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.top,self.bot * other.bot) - return NotImplemented - - def __rmul__(self,other): - """Multiply something else with a fraction.""" - return self.__mul__(other) - - def __div__(self,other): - """Divide two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top,self.bot * other) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.bot,self.bot * other.top) - return NotImplemented - - def __pow__(self,other): - """Compute a power of a fraction.""" - if parent(other) == ZZ: - if other < 0: - # Negative powers require flipping top and bottom - return fastfrac(self.R,self.bot ^ (-other),self.top ^ (-other)) - else: - return fastfrac(self.R,self.top ^ other,self.bot ^ other) - return NotImplemented - - def __str__(self): - return "fastfrac((" + str(self.top) + ") / (" + str(self.bot) + "))" - def __repr__(self): - return "%s" % self - - def numerator(self): - return self.top - -class constraints: - """A set of constraints, consisting of zero and nonzero expressions. - - Constraints can either be used to express knowledge or a requirement. - - Both the fields zero and nonzero are maps from expressions to description - strings. The expressions that are the keys in zero are required to be zero, - and the expressions that are the keys in nonzero are required to be nonzero. - - Note that (a != 0) and (b != 0) is the same as (a*b != 0), so all keys in - nonzero could be multiplied into a single key. This is often much less - efficient to work with though, so we keep them separate inside the - constraints. This allows higher-level code to do fast checks on the individual - nonzero elements, or combine them if needed for stronger checks. - - We can't multiply the different zero elements, as it would suffice for one of - the factors to be zero, instead of all of them. Instead, the zero elements are - typically combined into an ideal first. - """ - - def __init__(self, **kwargs): - if 'zero' in kwargs: - self.zero = dict(kwargs['zero']) - else: - self.zero = dict() - if 'nonzero' in kwargs: - self.nonzero = dict(kwargs['nonzero']) - else: - self.nonzero = dict() - - def negate(self): - return constraints(zero=self.nonzero, nonzero=self.zero) - - def __add__(self, other): - zero = self.zero.copy() - zero.update(other.zero) - nonzero = self.nonzero.copy() - nonzero.update(other.nonzero) - return constraints(zero=zero, nonzero=nonzero) - - def __str__(self): - return "constraints(zero=%s,nonzero=%s)" % (self.zero, self.nonzero) - - def __repr__(self): - return "%s" % self - - -def conflicts(R, con): - """Check whether any of the passed non-zero assumptions is implied by the zero assumptions""" - zero = R.ideal(map(numerator, con.zero)) - if 1 in zero: - return True - # First a cheap check whether any of the individual nonzero terms conflict on - # their own. - for nonzero in con.nonzero: - if nonzero.iszero(zero): - return True - # It can be the case that entries in the nonzero set do not individually - # conflict with the zero set, but their combination does. For example, knowing - # that either x or y is zero is equivalent to having x*y in the zero set. - # Having x or y individually in the nonzero set is not a conflict, but both - # simultaneously is, so that is the right thing to check for. - if reduce(lambda a,b: a * b, con.nonzero, fastfrac(R, 1)).iszero(zero): - return True - return False - - -def get_nonzero_set(R, assume): - """Calculate a simple set of nonzero expressions""" - zero = R.ideal(map(numerator, assume.zero)) - nonzero = set() - for nz in map(numerator, assume.nonzero): - for (f,n) in nz.factor(): - nonzero.add(f) - rnz = zero.reduce(nz) - for (f,n) in rnz.factor(): - nonzero.add(f) - return nonzero - - -def prove_nonzero(R, exprs, assume): - """Check whether an expression is provably nonzero, given assumptions""" - zero = R.ideal(map(numerator, assume.zero)) - nonzero = get_nonzero_set(R, assume) - expl = set() - ok = True - for expr in exprs: - if numerator(expr) in zero: - return (False, [exprs[expr]]) - allexprs = reduce(lambda a,b: numerator(a)*numerator(b), exprs, 1) - for (f, n) in allexprs.factor(): - if f not in nonzero: - ok = False - if ok: - return (True, None) - ok = True - for (f, n) in zero.reduce(numerator(allexprs)).factor(): - if f not in nonzero: - ok = False - if ok: - return (True, None) - ok = True - for expr in exprs: - for (f,n) in numerator(expr).factor(): - if f not in nonzero: - ok = False - if ok: - return (True, None) - ok = True - for expr in exprs: - for (f,n) in zero.reduce(numerator(expr)).factor(): - if f not in nonzero: - expl.add(exprs[expr]) - if expl: - return (False, list(expl)) - else: - return (True, None) - - -def prove_zero(R, exprs, assume): - """Check whether all of the passed expressions are provably zero, given assumptions""" - r, e = prove_nonzero(R, dict(map(lambda x: (fastfrac(R, x.bot, 1), exprs[x]), exprs)), assume) - if not r: - return (False, map(lambda x: "Possibly zero denominator: %s" % x, e)) - zero = R.ideal(map(numerator, assume.zero)) - nonzero = prod(x for x in assume.nonzero) - expl = [] - for expr in exprs: - if not expr.iszero(zero): - expl.append(exprs[expr]) - if not expl: - return (True, None) - return (False, expl) - - -def describe_extra(R, assume, assumeExtra): - """Describe what assumptions are added, given existing assumptions""" - zerox = assume.zero.copy() - zerox.update(assumeExtra.zero) - zero = R.ideal(map(numerator, assume.zero)) - zeroextra = R.ideal(map(numerator, zerox)) - nonzero = get_nonzero_set(R, assume) - ret = set() - # Iterate over the extra zero expressions - for base in assumeExtra.zero: - if base not in zero: - add = [] - for (f, n) in numerator(base).factor(): - if f not in nonzero: - add += ["%s" % f] - if add: - ret.add((" * ".join(add)) + " = 0 [%s]" % assumeExtra.zero[base]) - # Iterate over the extra nonzero expressions - for nz in assumeExtra.nonzero: - nzr = zeroextra.reduce(numerator(nz)) - if nzr not in zeroextra: - for (f,n) in nzr.factor(): - if zeroextra.reduce(f) not in nonzero: - ret.add("%s != 0" % zeroextra.reduce(f)) - return ", ".join(x for x in ret) - - -def check_symbolic(R, assumeLaw, assumeAssert, assumeBranch, require): - """Check a set of zero and nonzero requirements, given a set of zero and nonzero assumptions""" - assume = assumeLaw + assumeAssert + assumeBranch - - if conflicts(R, assume): - # This formula does not apply - return None - - describe = describe_extra(R, assumeLaw + assumeBranch, assumeAssert) - - ok, msg = prove_zero(R, require.zero, assume) - if not ok: - return "FAIL, %s fails (assuming %s)" % (str(msg), describe) - - res, expl = prove_nonzero(R, require.nonzero, assume) - if not res: - return "FAIL, %s fails (assuming %s)" % (str(expl), describe) - - if describe != "": - return "OK (assuming %s)" % describe - else: - return "OK" - - -def concrete_verify(c): - for k in c.zero: - if k != 0: - return (False, c.zero[k]) - for k in c.nonzero: - if k == 0: - return (False, c.nonzero[k]) - return (True, None) diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage deleted file mode 100644 index a97e732f..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage +++ /dev/null @@ -1,306 +0,0 @@ -# Test libsecp256k1' group operation implementations using prover.sage - -import sys - -load("group_prover.sage") -load("weierstrass_prover.sage") - -def formula_secp256k1_gej_double_var(a): - """libsecp256k1's secp256k1_gej_double_var, used by various addition functions""" - rz = a.Z * a.Y - rz = rz * 2 - t1 = a.X^2 - t1 = t1 * 3 - t2 = t1^2 - t3 = a.Y^2 - t3 = t3 * 2 - t4 = t3^2 - t4 = t4 * 2 - t3 = t3 * a.X - rx = t3 - rx = rx * 4 - rx = -rx - rx = rx + t2 - t2 = -t2 - t3 = t3 * 6 - t3 = t3 + t2 - ry = t1 * t3 - t2 = -t4 - ry = ry + t2 - return jacobianpoint(rx, ry, rz) - -def formula_secp256k1_gej_add_var(branch, a, b): - """libsecp256k1's secp256k1_gej_add_var""" - if branch == 0: - return (constraints(), constraints(nonzero={a.Infinity : 'a_infinite'}), b) - if branch == 1: - return (constraints(), constraints(zero={a.Infinity : 'a_finite'}, nonzero={b.Infinity : 'b_infinite'}), a) - z22 = b.Z^2 - z12 = a.Z^2 - u1 = a.X * z22 - u2 = b.X * z12 - s1 = a.Y * z22 - s1 = s1 * b.Z - s2 = b.Y * z12 - s2 = s2 * a.Z - h = -u1 - h = h + u2 - i = -s1 - i = i + s2 - if branch == 2: - r = formula_secp256k1_gej_double_var(a) - return (constraints(), constraints(zero={h : 'h=0', i : 'i=0', a.Infinity : 'a_finite', b.Infinity : 'b_finite'}), r) - if branch == 3: - return (constraints(), constraints(zero={h : 'h=0', a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={i : 'i!=0'}), point_at_infinity()) - i2 = i^2 - h2 = h^2 - h3 = h2 * h - h = h * b.Z - rz = a.Z * h - t = u1 * h2 - rx = t - rx = rx * 2 - rx = rx + h3 - rx = -rx - rx = rx + i2 - ry = -rx - ry = ry + t - ry = ry * i - h3 = h3 * s1 - h3 = -h3 - ry = ry + h3 - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={h : 'h!=0'}), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_ge_var(branch, a, b): - """libsecp256k1's secp256k1_gej_add_ge_var, which assume bz==1""" - if branch == 0: - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(nonzero={a.Infinity : 'a_infinite'}), b) - if branch == 1: - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite'}, nonzero={b.Infinity : 'b_infinite'}), a) - z12 = a.Z^2 - u1 = a.X - u2 = b.X * z12 - s1 = a.Y - s2 = b.Y * z12 - s2 = s2 * a.Z - h = -u1 - h = h + u2 - i = -s1 - i = i + s2 - if (branch == 2): - r = formula_secp256k1_gej_double_var(a) - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0', i : 'i=0'}), r) - if (branch == 3): - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0'}, nonzero={i : 'i!=0'}), point_at_infinity()) - i2 = i^2 - h2 = h^2 - h3 = h * h2 - rz = a.Z * h - t = u1 * h2 - rx = t - rx = rx * 2 - rx = rx + h3 - rx = -rx - rx = rx + i2 - ry = -rx - ry = ry + t - ry = ry * i - h3 = h3 * s1 - h3 = -h3 - ry = ry + h3 - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={h : 'h!=0'}), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_zinv_var(branch, a, b): - """libsecp256k1's secp256k1_gej_add_zinv_var""" - bzinv = b.Z^(-1) - if branch == 0: - return (constraints(), constraints(nonzero={b.Infinity : 'b_infinite'}), a) - if branch == 1: - bzinv2 = bzinv^2 - bzinv3 = bzinv2 * bzinv - rx = b.X * bzinv2 - ry = b.Y * bzinv3 - rz = 1 - return (constraints(), constraints(zero={b.Infinity : 'b_finite'}, nonzero={a.Infinity : 'a_infinite'}), jacobianpoint(rx, ry, rz)) - azz = a.Z * bzinv - z12 = azz^2 - u1 = a.X - u2 = b.X * z12 - s1 = a.Y - s2 = b.Y * z12 - s2 = s2 * azz - h = -u1 - h = h + u2 - i = -s1 - i = i + s2 - if branch == 2: - r = formula_secp256k1_gej_double_var(a) - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0', i : 'i=0'}), r) - if branch == 3: - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0'}, nonzero={i : 'i!=0'}), point_at_infinity()) - i2 = i^2 - h2 = h^2 - h3 = h * h2 - rz = a.Z - rz = rz * h - t = u1 * h2 - rx = t - rx = rx * 2 - rx = rx + h3 - rx = -rx - rx = rx + i2 - ry = -rx - ry = ry + t - ry = ry * i - h3 = h3 * s1 - h3 = -h3 - ry = ry + h3 - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={h : 'h!=0'}), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_ge(branch, a, b): - """libsecp256k1's secp256k1_gej_add_ge""" - zeroes = {} - nonzeroes = {} - a_infinity = False - if (branch & 4) != 0: - nonzeroes.update({a.Infinity : 'a_infinite'}) - a_infinity = True - else: - zeroes.update({a.Infinity : 'a_finite'}) - zz = a.Z^2 - u1 = a.X - u2 = b.X * zz - s1 = a.Y - s2 = b.Y * zz - s2 = s2 * a.Z - t = u1 - t = t + u2 - m = s1 - m = m + s2 - rr = t^2 - m_alt = -u2 - tt = u1 * m_alt - rr = rr + tt - degenerate = (branch & 3) == 3 - if (branch & 1) != 0: - zeroes.update({m : 'm_zero'}) - else: - nonzeroes.update({m : 'm_nonzero'}) - if (branch & 2) != 0: - zeroes.update({rr : 'rr_zero'}) - else: - nonzeroes.update({rr : 'rr_nonzero'}) - rr_alt = s1 - rr_alt = rr_alt * 2 - m_alt = m_alt + u1 - if not degenerate: - rr_alt = rr - m_alt = m - n = m_alt^2 - q = n * t - n = n^2 - if degenerate: - n = m - t = rr_alt^2 - rz = a.Z * m_alt - infinity = False - if (branch & 8) != 0: - if not a_infinity: - infinity = True - zeroes.update({rz : 'r.z=0'}) - else: - nonzeroes.update({rz : 'r.z!=0'}) - rz = rz * 2 - q = -q - t = t + q - rx = t - t = t * 2 - t = t + q - t = t * rr_alt - t = t + n - ry = -t - rx = rx * 4 - ry = ry * 4 - if a_infinity: - rx = b.X - ry = b.Y - rz = 1 - if infinity: - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zeroes, nonzero=nonzeroes), point_at_infinity()) - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zeroes, nonzero=nonzeroes), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_ge_old(branch, a, b): - """libsecp256k1's old secp256k1_gej_add_ge, which fails when ay+by=0 but ax!=bx""" - a_infinity = (branch & 1) != 0 - zero = {} - nonzero = {} - if a_infinity: - nonzero.update({a.Infinity : 'a_infinite'}) - else: - zero.update({a.Infinity : 'a_finite'}) - zz = a.Z^2 - u1 = a.X - u2 = b.X * zz - s1 = a.Y - s2 = b.Y * zz - s2 = s2 * a.Z - z = a.Z - t = u1 - t = t + u2 - m = s1 - m = m + s2 - n = m^2 - q = n * t - n = n^2 - rr = t^2 - t = u1 * u2 - t = -t - rr = rr + t - t = rr^2 - rz = m * z - infinity = False - if (branch & 2) != 0: - if not a_infinity: - infinity = True - else: - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(nonzero={z : 'conflict_a'}, zero={z : 'conflict_b'}), point_at_infinity()) - zero.update({rz : 'r.z=0'}) - else: - nonzero.update({rz : 'r.z!=0'}) - rz = rz * (0 if a_infinity else 2) - rx = t - q = -q - rx = rx + q - q = q * 3 - t = t * 2 - t = t + q - t = t * rr - t = t + n - ry = -t - rx = rx * (0 if a_infinity else 4) - ry = ry * (0 if a_infinity else 4) - t = b.X - t = t * (1 if a_infinity else 0) - rx = rx + t - t = b.Y - t = t * (1 if a_infinity else 0) - ry = ry + t - t = (1 if a_infinity else 0) - rz = rz + t - if infinity: - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zero, nonzero=nonzero), point_at_infinity()) - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zero, nonzero=nonzero), jacobianpoint(rx, ry, rz)) - -if __name__ == "__main__": - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_var", 0, 7, 5, formula_secp256k1_gej_add_var) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_ge_var", 0, 7, 5, formula_secp256k1_gej_add_ge_var) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_zinv_var", 0, 7, 5, formula_secp256k1_gej_add_zinv_var) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_ge", 0, 7, 16, formula_secp256k1_gej_add_ge) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_ge_old [should fail]", 0, 7, 4, formula_secp256k1_gej_add_ge_old) - - if len(sys.argv) >= 2 and sys.argv[1] == "--exhaustive": - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_var", 0, 7, 5, formula_secp256k1_gej_add_var, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_ge_var", 0, 7, 5, formula_secp256k1_gej_add_ge_var, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_zinv_var", 0, 7, 5, formula_secp256k1_gej_add_zinv_var, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_ge", 0, 7, 16, formula_secp256k1_gej_add_ge, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_ge_old [should fail]", 0, 7, 4, formula_secp256k1_gej_add_ge_old, 43) diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage deleted file mode 100644 index 03ef2ec9..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage +++ /dev/null @@ -1,264 +0,0 @@ -# Prover implementation for Weierstrass curves of the form -# y^2 = x^3 + A * x + B, specifically with a = 0 and b = 7, with group laws -# operating on affine and Jacobian coordinates, including the point at infinity -# represented by a 4th variable in coordinates. - -load("group_prover.sage") - - -class affinepoint: - def __init__(self, x, y, infinity=0): - self.x = x - self.y = y - self.infinity = infinity - def __str__(self): - return "affinepoint(x=%s,y=%s,inf=%s)" % (self.x, self.y, self.infinity) - - -class jacobianpoint: - def __init__(self, x, y, z, infinity=0): - self.X = x - self.Y = y - self.Z = z - self.Infinity = infinity - def __str__(self): - return "jacobianpoint(X=%s,Y=%s,Z=%s,inf=%s)" % (self.X, self.Y, self.Z, self.Infinity) - - -def point_at_infinity(): - return jacobianpoint(1, 1, 1, 1) - - -def negate(p): - if p.__class__ == affinepoint: - return affinepoint(p.x, -p.y) - if p.__class__ == jacobianpoint: - return jacobianpoint(p.X, -p.Y, p.Z) - assert(False) - - -def on_weierstrass_curve(A, B, p): - """Return a set of zero-expressions for an affine point to be on the curve""" - return constraints(zero={p.x^3 + A*p.x + B - p.y^2: 'on_curve'}) - - -def tangential_to_weierstrass_curve(A, B, p12, p3): - """Return a set of zero-expressions for ((x12,y12),(x3,y3)) to be a line that is tangential to the curve at (x12,y12)""" - return constraints(zero={ - (p12.y - p3.y) * (p12.y * 2) - (p12.x^2 * 3 + A) * (p12.x - p3.x): 'tangential_to_curve' - }) - - -def colinear(p1, p2, p3): - """Return a set of zero-expressions for ((x1,y1),(x2,y2),(x3,y3)) to be collinear""" - return constraints(zero={ - (p1.y - p2.y) * (p1.x - p3.x) - (p1.y - p3.y) * (p1.x - p2.x): 'colinear_1', - (p2.y - p3.y) * (p2.x - p1.x) - (p2.y - p1.y) * (p2.x - p3.x): 'colinear_2', - (p3.y - p1.y) * (p3.x - p2.x) - (p3.y - p2.y) * (p3.x - p1.x): 'colinear_3' - }) - - -def good_affine_point(p): - return constraints(nonzero={p.x : 'nonzero_x', p.y : 'nonzero_y'}) - - -def good_jacobian_point(p): - return constraints(nonzero={p.X : 'nonzero_X', p.Y : 'nonzero_Y', p.Z^6 : 'nonzero_Z'}) - - -def good_point(p): - return constraints(nonzero={p.Z^6 : 'nonzero_X'}) - - -def finite(p, *affine_fns): - con = good_point(p) + constraints(zero={p.Infinity : 'finite_point'}) - if p.Z != 0: - return con + reduce(lambda a, b: a + b, (f(affinepoint(p.X / p.Z^2, p.Y / p.Z^3)) for f in affine_fns), con) - else: - return con - -def infinite(p): - return constraints(nonzero={p.Infinity : 'infinite_point'}) - - -def law_jacobian_weierstrass_add(A, B, pa, pb, pA, pB, pC): - """Check whether the passed set of coordinates is a valid Jacobian add, given assumptions""" - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - on_weierstrass_curve(A, B, pb) + - finite(pA) + - finite(pB) + - constraints(nonzero={pa.x - pb.x : 'different_x'})) - require = (finite(pC, lambda pc: on_weierstrass_curve(A, B, pc) + - colinear(pa, pb, negate(pc)))) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_double(A, B, pa, pb, pA, pB, pC): - """Check whether the passed set of coordinates is a valid Jacobian doubling, given assumptions""" - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - on_weierstrass_curve(A, B, pb) + - finite(pA) + - finite(pB) + - constraints(zero={pa.x - pb.x : 'equal_x', pa.y - pb.y : 'equal_y'})) - require = (finite(pC, lambda pc: on_weierstrass_curve(A, B, pc) + - tangential_to_weierstrass_curve(A, B, pa, negate(pc)))) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_opposites(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - on_weierstrass_curve(A, B, pb) + - finite(pA) + - finite(pB) + - constraints(zero={pa.x - pb.x : 'equal_x', pa.y + pb.y : 'opposite_y'})) - require = infinite(pC) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_infinite_a(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pb) + - infinite(pA) + - finite(pB)) - require = finite(pC, lambda pc: constraints(zero={pc.x - pb.x : 'c.x=b.x', pc.y - pb.y : 'c.y=b.y'})) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_infinite_b(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - infinite(pB) + - finite(pA)) - require = finite(pC, lambda pc: constraints(zero={pc.x - pa.x : 'c.x=a.x', pc.y - pa.y : 'c.y=a.y'})) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_infinite_ab(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - infinite(pA) + - infinite(pB)) - require = infinite(pC) - return (assumeLaw, require) - - -laws_jacobian_weierstrass = { - 'add': law_jacobian_weierstrass_add, - 'double': law_jacobian_weierstrass_double, - 'add_opposite': law_jacobian_weierstrass_add_opposites, - 'add_infinite_a': law_jacobian_weierstrass_add_infinite_a, - 'add_infinite_b': law_jacobian_weierstrass_add_infinite_b, - 'add_infinite_ab': law_jacobian_weierstrass_add_infinite_ab -} - - -def check_exhaustive_jacobian_weierstrass(name, A, B, branches, formula, p): - """Verify an implementation of addition of Jacobian points on a Weierstrass curve, by executing and validating the result for every possible addition in a prime field""" - F = Integers(p) - print "Formula %s on Z%i:" % (name, p) - points = [] - for x in xrange(0, p): - for y in xrange(0, p): - point = affinepoint(F(x), F(y)) - r, e = concrete_verify(on_weierstrass_curve(A, B, point)) - if r: - points.append(point) - - for za in xrange(1, p): - for zb in xrange(1, p): - for pa in points: - for pb in points: - for ia in xrange(2): - for ib in xrange(2): - pA = jacobianpoint(pa.x * F(za)^2, pa.y * F(za)^3, F(za), ia) - pB = jacobianpoint(pb.x * F(zb)^2, pb.y * F(zb)^3, F(zb), ib) - for branch in xrange(0, branches): - assumeAssert, assumeBranch, pC = formula(branch, pA, pB) - pC.X = F(pC.X) - pC.Y = F(pC.Y) - pC.Z = F(pC.Z) - pC.Infinity = F(pC.Infinity) - r, e = concrete_verify(assumeAssert + assumeBranch) - if r: - match = False - for key in laws_jacobian_weierstrass: - assumeLaw, require = laws_jacobian_weierstrass[key](A, B, pa, pb, pA, pB, pC) - r, e = concrete_verify(assumeLaw) - if r: - if match: - print " multiple branches for (%s,%s,%s,%s) + (%s,%s,%s,%s)" % (pA.X, pA.Y, pA.Z, pA.Infinity, pB.X, pB.Y, pB.Z, pB.Infinity) - else: - match = True - r, e = concrete_verify(require) - if not r: - print " failure in branch %i for (%s,%s,%s,%s) + (%s,%s,%s,%s) = (%s,%s,%s,%s): %s" % (branch, pA.X, pA.Y, pA.Z, pA.Infinity, pB.X, pB.Y, pB.Z, pB.Infinity, pC.X, pC.Y, pC.Z, pC.Infinity, e) - print - - -def check_symbolic_function(R, assumeAssert, assumeBranch, f, A, B, pa, pb, pA, pB, pC): - assumeLaw, require = f(A, B, pa, pb, pA, pB, pC) - return check_symbolic(R, assumeLaw, assumeAssert, assumeBranch, require) - -def check_symbolic_jacobian_weierstrass(name, A, B, branches, formula): - """Verify an implementation of addition of Jacobian points on a Weierstrass curve symbolically""" - R. = PolynomialRing(QQ,8,order='invlex') - lift = lambda x: fastfrac(R,x) - ax = lift(ax) - ay = lift(ay) - Az = lift(Az) - bx = lift(bx) - by = lift(by) - Bz = lift(Bz) - Ai = lift(Ai) - Bi = lift(Bi) - - pa = affinepoint(ax, ay, Ai) - pb = affinepoint(bx, by, Bi) - pA = jacobianpoint(ax * Az^2, ay * Az^3, Az, Ai) - pB = jacobianpoint(bx * Bz^2, by * Bz^3, Bz, Bi) - - res = {} - - for key in laws_jacobian_weierstrass: - res[key] = [] - - print ("Formula " + name + ":") - count = 0 - for branch in xrange(branches): - assumeFormula, assumeBranch, pC = formula(branch, pA, pB) - pC.X = lift(pC.X) - pC.Y = lift(pC.Y) - pC.Z = lift(pC.Z) - pC.Infinity = lift(pC.Infinity) - - for key in laws_jacobian_weierstrass: - res[key].append((check_symbolic_function(R, assumeFormula, assumeBranch, laws_jacobian_weierstrass[key], A, B, pa, pb, pA, pB, pC), branch)) - - for key in res: - print " %s:" % key - val = res[key] - for x in val: - if x[0] is not None: - print " branch %i: %s" % (x[1], x[0]) - - print diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s deleted file mode 100644 index 5df561f2..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s +++ /dev/null @@ -1,919 +0,0 @@ -@ vim: set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab syntax=armasm: -/********************************************************************** - * Copyright (c) 2014 Wladimir J. van der Laan * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ -/* -ARM implementation of field_10x26 inner loops. - -Note: - -- To avoid unnecessary loads and make use of available registers, two - 'passes' have every time been interleaved, with the odd passes accumulating c' and d' - which will be added to c and d respectively in the the even passes - -*/ - - .syntax unified - .arch armv7-a - @ eabi attributes - see readelf -A - .eabi_attribute 8, 1 @ Tag_ARM_ISA_use = yes - .eabi_attribute 9, 0 @ Tag_Thumb_ISA_use = no - .eabi_attribute 10, 0 @ Tag_FP_arch = none - .eabi_attribute 24, 1 @ Tag_ABI_align_needed = 8-byte - .eabi_attribute 25, 1 @ Tag_ABI_align_preserved = 8-byte, except leaf SP - .eabi_attribute 30, 2 @ Tag_ABI_optimization_goals = Agressive Speed - .eabi_attribute 34, 1 @ Tag_CPU_unaligned_access = v6 - .text - - @ Field constants - .set field_R0, 0x3d10 - .set field_R1, 0x400 - .set field_not_M, 0xfc000000 @ ~M = ~0x3ffffff - - .align 2 - .global secp256k1_fe_mul_inner - .type secp256k1_fe_mul_inner, %function - @ Arguments: - @ r0 r Restrict: can overlap with a, not with b - @ r1 a - @ r2 b - @ Stack (total 4+10*4 = 44) - @ sp + #0 saved 'r' pointer - @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 -secp256k1_fe_mul_inner: - stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} - sub sp, sp, #48 @ frame=44 + alignment - str r0, [sp, #0] @ save result address, we need it only at the end - - /****************************************** - * Main computation code. - ****************************************** - - Allocation: - r0,r14,r7,r8 scratch - r1 a (pointer) - r2 b (pointer) - r3:r4 c - r5:r6 d - r11:r12 c' - r9:r10 d' - - Note: do not write to r[] here, it may overlap with a[] - */ - - /* A - interleaved with B */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #9*4] @ b[9] - ldr r0, [r1, #1*4] @ a[1] - umull r5, r6, r7, r8 @ d = a[0] * b[9] - ldr r14, [r2, #8*4] @ b[8] - umull r9, r10, r0, r8 @ d' = a[1] * b[9] - ldr r7, [r1, #2*4] @ a[2] - umlal r5, r6, r0, r14 @ d += a[1] * b[8] - ldr r8, [r2, #7*4] @ b[7] - umlal r9, r10, r7, r14 @ d' += a[2] * b[8] - ldr r0, [r1, #3*4] @ a[3] - umlal r5, r6, r7, r8 @ d += a[2] * b[7] - ldr r14, [r2, #6*4] @ b[6] - umlal r9, r10, r0, r8 @ d' += a[3] * b[7] - ldr r7, [r1, #4*4] @ a[4] - umlal r5, r6, r0, r14 @ d += a[3] * b[6] - ldr r8, [r2, #5*4] @ b[5] - umlal r9, r10, r7, r14 @ d' += a[4] * b[6] - ldr r0, [r1, #5*4] @ a[5] - umlal r5, r6, r7, r8 @ d += a[4] * b[5] - ldr r14, [r2, #4*4] @ b[4] - umlal r9, r10, r0, r8 @ d' += a[5] * b[5] - ldr r7, [r1, #6*4] @ a[6] - umlal r5, r6, r0, r14 @ d += a[5] * b[4] - ldr r8, [r2, #3*4] @ b[3] - umlal r9, r10, r7, r14 @ d' += a[6] * b[4] - ldr r0, [r1, #7*4] @ a[7] - umlal r5, r6, r7, r8 @ d += a[6] * b[3] - ldr r14, [r2, #2*4] @ b[2] - umlal r9, r10, r0, r8 @ d' += a[7] * b[3] - ldr r7, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r14 @ d += a[7] * b[2] - ldr r8, [r2, #1*4] @ b[1] - umlal r9, r10, r7, r14 @ d' += a[8] * b[2] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r8 @ d += a[8] * b[1] - ldr r14, [r2, #0*4] @ b[0] - umlal r9, r10, r0, r8 @ d' += a[9] * b[1] - ldr r7, [r1, #0*4] @ a[0] - umlal r5, r6, r0, r14 @ d += a[9] * b[0] - @ r7,r14 used in B - - bic r0, r5, field_not_M @ t9 = d & M - str r0, [sp, #4 + 4*9] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - /* B */ - umull r3, r4, r7, r14 @ c = a[0] * b[0] - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u0 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u0 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t0 = c & M - str r14, [sp, #4 + 0*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u0 * R1 - umlal r3, r4, r0, r14 - - /* C - interleaved with D */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #2*4] @ b[2] - ldr r14, [r2, #1*4] @ b[1] - umull r11, r12, r7, r8 @ c' = a[0] * b[2] - ldr r0, [r1, #1*4] @ a[1] - umlal r3, r4, r7, r14 @ c += a[0] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r11, r12, r0, r14 @ c' += a[1] * b[1] - ldr r7, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r8 @ c += a[1] * b[0] - ldr r14, [r2, #9*4] @ b[9] - umlal r11, r12, r7, r8 @ c' += a[2] * b[0] - ldr r0, [r1, #3*4] @ a[3] - umlal r5, r6, r7, r14 @ d += a[2] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umull r9, r10, r0, r14 @ d' = a[3] * b[9] - ldr r7, [r1, #4*4] @ a[4] - umlal r5, r6, r0, r8 @ d += a[3] * b[8] - ldr r14, [r2, #7*4] @ b[7] - umlal r9, r10, r7, r8 @ d' += a[4] * b[8] - ldr r0, [r1, #5*4] @ a[5] - umlal r5, r6, r7, r14 @ d += a[4] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r9, r10, r0, r14 @ d' += a[5] * b[7] - ldr r7, [r1, #6*4] @ a[6] - umlal r5, r6, r0, r8 @ d += a[5] * b[6] - ldr r14, [r2, #5*4] @ b[5] - umlal r9, r10, r7, r8 @ d' += a[6] * b[6] - ldr r0, [r1, #7*4] @ a[7] - umlal r5, r6, r7, r14 @ d += a[6] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r9, r10, r0, r14 @ d' += a[7] * b[5] - ldr r7, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r8 @ d += a[7] * b[4] - ldr r14, [r2, #3*4] @ b[3] - umlal r9, r10, r7, r8 @ d' += a[8] * b[4] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r14 @ d += a[8] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r9, r10, r0, r14 @ d' += a[9] * b[3] - umlal r5, r6, r0, r8 @ d += a[9] * b[2] - - bic r0, r5, field_not_M @ u1 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u1 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t1 = c & M - str r14, [sp, #4 + 1*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u1 * R1 - umlal r3, r4, r0, r14 - - /* D */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u2 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u2 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t2 = c & M - str r14, [sp, #4 + 2*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u2 * R1 - umlal r3, r4, r0, r14 - - /* E - interleaved with F */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #4*4] @ b[4] - umull r11, r12, r7, r8 @ c' = a[0] * b[4] - ldr r8, [r2, #3*4] @ b[3] - umlal r3, r4, r7, r8 @ c += a[0] * b[3] - ldr r7, [r1, #1*4] @ a[1] - umlal r11, r12, r7, r8 @ c' += a[1] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r3, r4, r7, r8 @ c += a[1] * b[2] - ldr r7, [r1, #2*4] @ a[2] - umlal r11, r12, r7, r8 @ c' += a[2] * b[2] - ldr r8, [r2, #1*4] @ b[1] - umlal r3, r4, r7, r8 @ c += a[2] * b[1] - ldr r7, [r1, #3*4] @ a[3] - umlal r11, r12, r7, r8 @ c' += a[3] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r3, r4, r7, r8 @ c += a[3] * b[0] - ldr r7, [r1, #4*4] @ a[4] - umlal r11, r12, r7, r8 @ c' += a[4] * b[0] - ldr r8, [r2, #9*4] @ b[9] - umlal r5, r6, r7, r8 @ d += a[4] * b[9] - ldr r7, [r1, #5*4] @ a[5] - umull r9, r10, r7, r8 @ d' = a[5] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umlal r5, r6, r7, r8 @ d += a[5] * b[8] - ldr r7, [r1, #6*4] @ a[6] - umlal r9, r10, r7, r8 @ d' += a[6] * b[8] - ldr r8, [r2, #7*4] @ b[7] - umlal r5, r6, r7, r8 @ d += a[6] * b[7] - ldr r7, [r1, #7*4] @ a[7] - umlal r9, r10, r7, r8 @ d' += a[7] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r5, r6, r7, r8 @ d += a[7] * b[6] - ldr r7, [r1, #8*4] @ a[8] - umlal r9, r10, r7, r8 @ d' += a[8] * b[6] - ldr r8, [r2, #5*4] @ b[5] - umlal r5, r6, r7, r8 @ d += a[8] * b[5] - ldr r7, [r1, #9*4] @ a[9] - umlal r9, r10, r7, r8 @ d' += a[9] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r5, r6, r7, r8 @ d += a[9] * b[4] - - bic r0, r5, field_not_M @ u3 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u3 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t3 = c & M - str r14, [sp, #4 + 3*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u3 * R1 - umlal r3, r4, r0, r14 - - /* F */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u4 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u4 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t4 = c & M - str r14, [sp, #4 + 4*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u4 * R1 - umlal r3, r4, r0, r14 - - /* G - interleaved with H */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #6*4] @ b[6] - ldr r14, [r2, #5*4] @ b[5] - umull r11, r12, r7, r8 @ c' = a[0] * b[6] - ldr r0, [r1, #1*4] @ a[1] - umlal r3, r4, r7, r14 @ c += a[0] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r11, r12, r0, r14 @ c' += a[1] * b[5] - ldr r7, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r8 @ c += a[1] * b[4] - ldr r14, [r2, #3*4] @ b[3] - umlal r11, r12, r7, r8 @ c' += a[2] * b[4] - ldr r0, [r1, #3*4] @ a[3] - umlal r3, r4, r7, r14 @ c += a[2] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r11, r12, r0, r14 @ c' += a[3] * b[3] - ldr r7, [r1, #4*4] @ a[4] - umlal r3, r4, r0, r8 @ c += a[3] * b[2] - ldr r14, [r2, #1*4] @ b[1] - umlal r11, r12, r7, r8 @ c' += a[4] * b[2] - ldr r0, [r1, #5*4] @ a[5] - umlal r3, r4, r7, r14 @ c += a[4] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r11, r12, r0, r14 @ c' += a[5] * b[1] - ldr r7, [r1, #6*4] @ a[6] - umlal r3, r4, r0, r8 @ c += a[5] * b[0] - ldr r14, [r2, #9*4] @ b[9] - umlal r11, r12, r7, r8 @ c' += a[6] * b[0] - ldr r0, [r1, #7*4] @ a[7] - umlal r5, r6, r7, r14 @ d += a[6] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umull r9, r10, r0, r14 @ d' = a[7] * b[9] - ldr r7, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r8 @ d += a[7] * b[8] - ldr r14, [r2, #7*4] @ b[7] - umlal r9, r10, r7, r8 @ d' += a[8] * b[8] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r14 @ d += a[8] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r9, r10, r0, r14 @ d' += a[9] * b[7] - umlal r5, r6, r0, r8 @ d += a[9] * b[6] - - bic r0, r5, field_not_M @ u5 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u5 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t5 = c & M - str r14, [sp, #4 + 5*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u5 * R1 - umlal r3, r4, r0, r14 - - /* H */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u6 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u6 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t6 = c & M - str r14, [sp, #4 + 6*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u6 * R1 - umlal r3, r4, r0, r14 - - /* I - interleaved with J */ - ldr r8, [r2, #8*4] @ b[8] - ldr r7, [r1, #0*4] @ a[0] - ldr r14, [r2, #7*4] @ b[7] - umull r11, r12, r7, r8 @ c' = a[0] * b[8] - ldr r0, [r1, #1*4] @ a[1] - umlal r3, r4, r7, r14 @ c += a[0] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r11, r12, r0, r14 @ c' += a[1] * b[7] - ldr r7, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r8 @ c += a[1] * b[6] - ldr r14, [r2, #5*4] @ b[5] - umlal r11, r12, r7, r8 @ c' += a[2] * b[6] - ldr r0, [r1, #3*4] @ a[3] - umlal r3, r4, r7, r14 @ c += a[2] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r11, r12, r0, r14 @ c' += a[3] * b[5] - ldr r7, [r1, #4*4] @ a[4] - umlal r3, r4, r0, r8 @ c += a[3] * b[4] - ldr r14, [r2, #3*4] @ b[3] - umlal r11, r12, r7, r8 @ c' += a[4] * b[4] - ldr r0, [r1, #5*4] @ a[5] - umlal r3, r4, r7, r14 @ c += a[4] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r11, r12, r0, r14 @ c' += a[5] * b[3] - ldr r7, [r1, #6*4] @ a[6] - umlal r3, r4, r0, r8 @ c += a[5] * b[2] - ldr r14, [r2, #1*4] @ b[1] - umlal r11, r12, r7, r8 @ c' += a[6] * b[2] - ldr r0, [r1, #7*4] @ a[7] - umlal r3, r4, r7, r14 @ c += a[6] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r11, r12, r0, r14 @ c' += a[7] * b[1] - ldr r7, [r1, #8*4] @ a[8] - umlal r3, r4, r0, r8 @ c += a[7] * b[0] - ldr r14, [r2, #9*4] @ b[9] - umlal r11, r12, r7, r8 @ c' += a[8] * b[0] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r14 @ d += a[8] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umull r9, r10, r0, r14 @ d' = a[9] * b[9] - umlal r5, r6, r0, r8 @ d += a[9] * b[8] - - bic r0, r5, field_not_M @ u7 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u7 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t7 = c & M - str r14, [sp, #4 + 7*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u7 * R1 - umlal r3, r4, r0, r14 - - /* J */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u8 = d & M - str r0, [sp, #4 + 8*4] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u8 * R0 - umlal r3, r4, r0, r14 - - /****************************************** - * compute and write back result - ****************************************** - Allocation: - r0 r - r3:r4 c - r5:r6 d - r7 t0 - r8 t1 - r9 t2 - r11 u8 - r12 t9 - r1,r2,r10,r14 scratch - - Note: do not read from a[] after here, it may overlap with r[] - */ - ldr r0, [sp, #0] - add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 - ldmia r1, {r2,r7,r8,r9,r10,r11,r12} - add r1, r0, #3*4 - stmia r1, {r2,r7,r8,r9,r10} - - bic r2, r3, field_not_M @ r[8] = c & M - str r2, [r0, #8*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u8 * R1 - umlal r3, r4, r11, r14 - movw r14, field_R0 @ c += d * R0 - umlal r3, r4, r5, r14 - adds r3, r3, r12 @ c += t9 - adc r4, r4, #0 - - add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 - ldmia r1, {r7,r8,r9} - - ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) - str r2, [r0, #9*4] - mov r3, r3, lsr #22 @ c >>= 22 - orr r3, r3, r4, asl #10 - mov r4, r4, lsr #22 - movw r14, field_R1 << 4 @ c += d * (R1 << 4) - umlal r3, r4, r5, r14 - - movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) - umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) - adds r5, r5, r7 @ d.lo += t0 - mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) - adc r6, r6, 0 @ d.hi += carry - - bic r2, r5, field_not_M @ r[0] = d & M - str r2, [r0, #0*4] - - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) - umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) - adds r5, r5, r8 @ d.lo += t1 - adc r6, r6, #0 @ d.hi += carry - adds r5, r5, r1 @ d.lo += tmp.lo - mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) - adc r6, r6, r2 @ d.hi += carry + tmp.hi - - bic r2, r5, field_not_M @ r[1] = d & M - str r2, [r0, #1*4] - mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) - orr r5, r5, r6, asl #6 - - add r5, r5, r9 @ d += t2 - str r5, [r0, #2*4] @ r[2] = d - - add sp, sp, #48 - ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} - .size secp256k1_fe_mul_inner, .-secp256k1_fe_mul_inner - - .align 2 - .global secp256k1_fe_sqr_inner - .type secp256k1_fe_sqr_inner, %function - @ Arguments: - @ r0 r Can overlap with a - @ r1 a - @ Stack (total 4+10*4 = 44) - @ sp + #0 saved 'r' pointer - @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 -secp256k1_fe_sqr_inner: - stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} - sub sp, sp, #48 @ frame=44 + alignment - str r0, [sp, #0] @ save result address, we need it only at the end - /****************************************** - * Main computation code. - ****************************************** - - Allocation: - r0,r14,r2,r7,r8 scratch - r1 a (pointer) - r3:r4 c - r5:r6 d - r11:r12 c' - r9:r10 d' - - Note: do not write to r[] here, it may overlap with a[] - */ - /* A interleaved with B */ - ldr r0, [r1, #1*4] @ a[1]*2 - ldr r7, [r1, #0*4] @ a[0] - mov r0, r0, asl #1 - ldr r14, [r1, #9*4] @ a[9] - umull r3, r4, r7, r7 @ c = a[0] * a[0] - ldr r8, [r1, #8*4] @ a[8] - mov r7, r7, asl #1 - umull r5, r6, r7, r14 @ d = a[0]*2 * a[9] - ldr r7, [r1, #2*4] @ a[2]*2 - umull r9, r10, r0, r14 @ d' = a[1]*2 * a[9] - ldr r14, [r1, #7*4] @ a[7] - umlal r5, r6, r0, r8 @ d += a[1]*2 * a[8] - mov r7, r7, asl #1 - ldr r0, [r1, #3*4] @ a[3]*2 - umlal r9, r10, r7, r8 @ d' += a[2]*2 * a[8] - ldr r8, [r1, #6*4] @ a[6] - umlal r5, r6, r7, r14 @ d += a[2]*2 * a[7] - mov r0, r0, asl #1 - ldr r7, [r1, #4*4] @ a[4]*2 - umlal r9, r10, r0, r14 @ d' += a[3]*2 * a[7] - ldr r14, [r1, #5*4] @ a[5] - mov r7, r7, asl #1 - umlal r5, r6, r0, r8 @ d += a[3]*2 * a[6] - umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[6] - umlal r5, r6, r7, r14 @ d += a[4]*2 * a[5] - umlal r9, r10, r14, r14 @ d' += a[5] * a[5] - - bic r0, r5, field_not_M @ t9 = d & M - str r0, [sp, #4 + 9*4] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - /* B */ - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u0 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u0 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t0 = c & M - str r14, [sp, #4 + 0*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u0 * R1 - umlal r3, r4, r0, r14 - - /* C interleaved with D */ - ldr r0, [r1, #0*4] @ a[0]*2 - ldr r14, [r1, #1*4] @ a[1] - mov r0, r0, asl #1 - ldr r8, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r14 @ c += a[0]*2 * a[1] - mov r7, r8, asl #1 @ a[2]*2 - umull r11, r12, r14, r14 @ c' = a[1] * a[1] - ldr r14, [r1, #9*4] @ a[9] - umlal r11, r12, r0, r8 @ c' += a[0]*2 * a[2] - ldr r0, [r1, #3*4] @ a[3]*2 - ldr r8, [r1, #8*4] @ a[8] - umlal r5, r6, r7, r14 @ d += a[2]*2 * a[9] - mov r0, r0, asl #1 - ldr r7, [r1, #4*4] @ a[4]*2 - umull r9, r10, r0, r14 @ d' = a[3]*2 * a[9] - ldr r14, [r1, #7*4] @ a[7] - umlal r5, r6, r0, r8 @ d += a[3]*2 * a[8] - mov r7, r7, asl #1 - ldr r0, [r1, #5*4] @ a[5]*2 - umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[8] - ldr r8, [r1, #6*4] @ a[6] - mov r0, r0, asl #1 - umlal r5, r6, r7, r14 @ d += a[4]*2 * a[7] - umlal r9, r10, r0, r14 @ d' += a[5]*2 * a[7] - umlal r5, r6, r0, r8 @ d += a[5]*2 * a[6] - umlal r9, r10, r8, r8 @ d' += a[6] * a[6] - - bic r0, r5, field_not_M @ u1 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u1 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t1 = c & M - str r14, [sp, #4 + 1*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u1 * R1 - umlal r3, r4, r0, r14 - - /* D */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u2 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u2 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t2 = c & M - str r14, [sp, #4 + 2*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u2 * R1 - umlal r3, r4, r0, r14 - - /* E interleaved with F */ - ldr r7, [r1, #0*4] @ a[0]*2 - ldr r0, [r1, #1*4] @ a[1]*2 - ldr r14, [r1, #2*4] @ a[2] - mov r7, r7, asl #1 - ldr r8, [r1, #3*4] @ a[3] - ldr r2, [r1, #4*4] - umlal r3, r4, r7, r8 @ c += a[0]*2 * a[3] - mov r0, r0, asl #1 - umull r11, r12, r7, r2 @ c' = a[0]*2 * a[4] - mov r2, r2, asl #1 @ a[4]*2 - umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[3] - ldr r8, [r1, #9*4] @ a[9] - umlal r3, r4, r0, r14 @ c += a[1]*2 * a[2] - ldr r0, [r1, #5*4] @ a[5]*2 - umlal r11, r12, r14, r14 @ c' += a[2] * a[2] - ldr r14, [r1, #8*4] @ a[8] - mov r0, r0, asl #1 - umlal r5, r6, r2, r8 @ d += a[4]*2 * a[9] - ldr r7, [r1, #6*4] @ a[6]*2 - umull r9, r10, r0, r8 @ d' = a[5]*2 * a[9] - mov r7, r7, asl #1 - ldr r8, [r1, #7*4] @ a[7] - umlal r5, r6, r0, r14 @ d += a[5]*2 * a[8] - umlal r9, r10, r7, r14 @ d' += a[6]*2 * a[8] - umlal r5, r6, r7, r8 @ d += a[6]*2 * a[7] - umlal r9, r10, r8, r8 @ d' += a[7] * a[7] - - bic r0, r5, field_not_M @ u3 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u3 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t3 = c & M - str r14, [sp, #4 + 3*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u3 * R1 - umlal r3, r4, r0, r14 - - /* F */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u4 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u4 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t4 = c & M - str r14, [sp, #4 + 4*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u4 * R1 - umlal r3, r4, r0, r14 - - /* G interleaved with H */ - ldr r7, [r1, #0*4] @ a[0]*2 - ldr r0, [r1, #1*4] @ a[1]*2 - mov r7, r7, asl #1 - ldr r8, [r1, #5*4] @ a[5] - ldr r2, [r1, #6*4] @ a[6] - umlal r3, r4, r7, r8 @ c += a[0]*2 * a[5] - ldr r14, [r1, #4*4] @ a[4] - mov r0, r0, asl #1 - umull r11, r12, r7, r2 @ c' = a[0]*2 * a[6] - ldr r7, [r1, #2*4] @ a[2]*2 - umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[5] - mov r7, r7, asl #1 - ldr r8, [r1, #3*4] @ a[3] - umlal r3, r4, r0, r14 @ c += a[1]*2 * a[4] - mov r0, r2, asl #1 @ a[6]*2 - umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[4] - ldr r14, [r1, #9*4] @ a[9] - umlal r3, r4, r7, r8 @ c += a[2]*2 * a[3] - ldr r7, [r1, #7*4] @ a[7]*2 - umlal r11, r12, r8, r8 @ c' += a[3] * a[3] - mov r7, r7, asl #1 - ldr r8, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r14 @ d += a[6]*2 * a[9] - umull r9, r10, r7, r14 @ d' = a[7]*2 * a[9] - umlal r5, r6, r7, r8 @ d += a[7]*2 * a[8] - umlal r9, r10, r8, r8 @ d' += a[8] * a[8] - - bic r0, r5, field_not_M @ u5 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u5 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t5 = c & M - str r14, [sp, #4 + 5*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u5 * R1 - umlal r3, r4, r0, r14 - - /* H */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u6 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u6 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t6 = c & M - str r14, [sp, #4 + 6*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u6 * R1 - umlal r3, r4, r0, r14 - - /* I interleaved with J */ - ldr r7, [r1, #0*4] @ a[0]*2 - ldr r0, [r1, #1*4] @ a[1]*2 - mov r7, r7, asl #1 - ldr r8, [r1, #7*4] @ a[7] - ldr r2, [r1, #8*4] @ a[8] - umlal r3, r4, r7, r8 @ c += a[0]*2 * a[7] - ldr r14, [r1, #6*4] @ a[6] - mov r0, r0, asl #1 - umull r11, r12, r7, r2 @ c' = a[0]*2 * a[8] - ldr r7, [r1, #2*4] @ a[2]*2 - umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[7] - ldr r8, [r1, #5*4] @ a[5] - umlal r3, r4, r0, r14 @ c += a[1]*2 * a[6] - ldr r0, [r1, #3*4] @ a[3]*2 - mov r7, r7, asl #1 - umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[6] - ldr r14, [r1, #4*4] @ a[4] - mov r0, r0, asl #1 - umlal r3, r4, r7, r8 @ c += a[2]*2 * a[5] - mov r2, r2, asl #1 @ a[8]*2 - umlal r11, r12, r0, r8 @ c' += a[3]*2 * a[5] - umlal r3, r4, r0, r14 @ c += a[3]*2 * a[4] - umlal r11, r12, r14, r14 @ c' += a[4] * a[4] - ldr r8, [r1, #9*4] @ a[9] - umlal r5, r6, r2, r8 @ d += a[8]*2 * a[9] - @ r8 will be used in J - - bic r0, r5, field_not_M @ u7 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u7 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t7 = c & M - str r14, [sp, #4 + 7*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u7 * R1 - umlal r3, r4, r0, r14 - - /* J */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - umlal r5, r6, r8, r8 @ d += a[9] * a[9] - - bic r0, r5, field_not_M @ u8 = d & M - str r0, [sp, #4 + 8*4] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u8 * R0 - umlal r3, r4, r0, r14 - - /****************************************** - * compute and write back result - ****************************************** - Allocation: - r0 r - r3:r4 c - r5:r6 d - r7 t0 - r8 t1 - r9 t2 - r11 u8 - r12 t9 - r1,r2,r10,r14 scratch - - Note: do not read from a[] after here, it may overlap with r[] - */ - ldr r0, [sp, #0] - add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 - ldmia r1, {r2,r7,r8,r9,r10,r11,r12} - add r1, r0, #3*4 - stmia r1, {r2,r7,r8,r9,r10} - - bic r2, r3, field_not_M @ r[8] = c & M - str r2, [r0, #8*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u8 * R1 - umlal r3, r4, r11, r14 - movw r14, field_R0 @ c += d * R0 - umlal r3, r4, r5, r14 - adds r3, r3, r12 @ c += t9 - adc r4, r4, #0 - - add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 - ldmia r1, {r7,r8,r9} - - ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) - str r2, [r0, #9*4] - mov r3, r3, lsr #22 @ c >>= 22 - orr r3, r3, r4, asl #10 - mov r4, r4, lsr #22 - movw r14, field_R1 << 4 @ c += d * (R1 << 4) - umlal r3, r4, r5, r14 - - movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) - umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) - adds r5, r5, r7 @ d.lo += t0 - mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) - adc r6, r6, 0 @ d.hi += carry - - bic r2, r5, field_not_M @ r[0] = d & M - str r2, [r0, #0*4] - - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) - umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) - adds r5, r5, r8 @ d.lo += t1 - adc r6, r6, #0 @ d.hi += carry - adds r5, r5, r1 @ d.lo += tmp.lo - mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) - adc r6, r6, r2 @ d.hi += carry + tmp.hi - - bic r2, r5, field_not_M @ r[1] = d & M - str r2, [r0, #1*4] - mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) - orr r5, r5, r6, asl #6 - - add r5, r5, r9 @ d += t2 - str r5, [r0, #2*4] @ r[2] = d - - add sp, sp, #48 - ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} - .size secp256k1_fe_sqr_inner, .-secp256k1_fe_sqr_inner - diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h deleted file mode 100644 index c4c16eb7..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h +++ /dev/null @@ -1,32 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_BASIC_CONFIG_ -#define _SECP256K1_BASIC_CONFIG_ - -#ifdef USE_BASIC_CONFIG - -#undef USE_ASM_X86_64 -#undef USE_ENDOMORPHISM -#undef USE_FIELD_10X26 -#undef USE_FIELD_5X52 -#undef USE_FIELD_INV_BUILTIN -#undef USE_FIELD_INV_NUM -#undef USE_NUM_GMP -#undef USE_NUM_NONE -#undef USE_SCALAR_4X64 -#undef USE_SCALAR_8X32 -#undef USE_SCALAR_INV_BUILTIN -#undef USE_SCALAR_INV_NUM - -#define USE_NUM_NONE 1 -#define USE_FIELD_INV_BUILTIN 1 -#define USE_SCALAR_INV_BUILTIN 1 -#define USE_FIELD_10X26 1 -#define USE_SCALAR_8X32 1 - -#endif // USE_BASIC_CONFIG -#endif // _SECP256K1_BASIC_CONFIG_ diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h deleted file mode 100644 index 3a71b4aa..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h +++ /dev/null @@ -1,66 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_BENCH_H_ -#define _SECP256K1_BENCH_H_ - -#include -#include -#include "sys/time.h" - -static double gettimedouble(void) { - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_usec * 0.000001 + tv.tv_sec; -} - -void print_number(double x) { - double y = x; - int c = 0; - if (y < 0.0) { - y = -y; - } - while (y < 100.0) { - y *= 10.0; - c++; - } - printf("%.*f", c, x); -} - -void run_benchmark(char *name, void (*benchmark)(void*), void (*setup)(void*), void (*teardown)(void*), void* data, int count, int iter) { - int i; - double min = HUGE_VAL; - double sum = 0.0; - double max = 0.0; - for (i = 0; i < count; i++) { - double begin, total; - if (setup != NULL) { - setup(data); - } - begin = gettimedouble(); - benchmark(data); - total = gettimedouble() - begin; - if (teardown != NULL) { - teardown(data); - } - if (total < min) { - min = total; - } - if (total > max) { - max = total; - } - sum += total; - } - printf("%s: min ", name); - print_number(min * 1000000.0 / iter); - printf("us / avg "); - print_number((sum / count) * 1000000.0 / iter); - printf("us / max "); - print_number(max * 1000000.0 / iter); - printf("us\n"); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c deleted file mode 100644 index cde5e2db..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c +++ /dev/null @@ -1,54 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille, Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include - -#include "include/secp256k1.h" -#include "include/secp256k1_ecdh.h" -#include "util.h" -#include "bench.h" - -typedef struct { - secp256k1_context *ctx; - secp256k1_pubkey point; - unsigned char scalar[32]; -} bench_ecdh_t; - -static void bench_ecdh_setup(void* arg) { - int i; - bench_ecdh_t *data = (bench_ecdh_t*)arg; - const unsigned char point[] = { - 0x03, - 0x54, 0x94, 0xc1, 0x5d, 0x32, 0x09, 0x97, 0x06, - 0xc2, 0x39, 0x5f, 0x94, 0x34, 0x87, 0x45, 0xfd, - 0x75, 0x7c, 0xe3, 0x0e, 0x4e, 0x8c, 0x90, 0xfb, - 0xa2, 0xba, 0xd1, 0x84, 0xf8, 0x83, 0xc6, 0x9f - }; - - /* create a context with no capabilities */ - data->ctx = secp256k1_context_create(SECP256K1_FLAGS_TYPE_CONTEXT); - for (i = 0; i < 32; i++) { - data->scalar[i] = i + 1; - } - CHECK(secp256k1_ec_pubkey_parse(data->ctx, &data->point, point, sizeof(point)) == 1); -} - -static void bench_ecdh(void* arg) { - int i; - unsigned char res[32]; - bench_ecdh_t *data = (bench_ecdh_t*)arg; - - for (i = 0; i < 20000; i++) { - CHECK(secp256k1_ecdh(data->ctx, res, &data->point, data->scalar) == 1); - } -} - -int main(void) { - bench_ecdh_t data; - - run_benchmark("ecdh", bench_ecdh, bench_ecdh_setup, NULL, &data, 10, 20000); - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c deleted file mode 100644 index 0809f77b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c +++ /dev/null @@ -1,382 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ -#include - -#include "include/secp256k1.h" - -#include "util.h" -#include "hash_impl.h" -#include "num_impl.h" -#include "field_impl.h" -#include "group_impl.h" -#include "scalar_impl.h" -#include "ecmult_const_impl.h" -#include "ecmult_impl.h" -#include "bench.h" -#include "secp256k1.c" - -typedef struct { - secp256k1_scalar scalar_x, scalar_y; - secp256k1_fe fe_x, fe_y; - secp256k1_ge ge_x, ge_y; - secp256k1_gej gej_x, gej_y; - unsigned char data[64]; - int wnaf[256]; -} bench_inv_t; - -void bench_setup(void* arg) { - bench_inv_t *data = (bench_inv_t*)arg; - - static const unsigned char init_x[32] = { - 0x02, 0x03, 0x05, 0x07, 0x0b, 0x0d, 0x11, 0x13, - 0x17, 0x1d, 0x1f, 0x25, 0x29, 0x2b, 0x2f, 0x35, - 0x3b, 0x3d, 0x43, 0x47, 0x49, 0x4f, 0x53, 0x59, - 0x61, 0x65, 0x67, 0x6b, 0x6d, 0x71, 0x7f, 0x83 - }; - - static const unsigned char init_y[32] = { - 0x82, 0x83, 0x85, 0x87, 0x8b, 0x8d, 0x81, 0x83, - 0x97, 0xad, 0xaf, 0xb5, 0xb9, 0xbb, 0xbf, 0xc5, - 0xdb, 0xdd, 0xe3, 0xe7, 0xe9, 0xef, 0xf3, 0xf9, - 0x11, 0x15, 0x17, 0x1b, 0x1d, 0xb1, 0xbf, 0xd3 - }; - - secp256k1_scalar_set_b32(&data->scalar_x, init_x, NULL); - secp256k1_scalar_set_b32(&data->scalar_y, init_y, NULL); - secp256k1_fe_set_b32(&data->fe_x, init_x); - secp256k1_fe_set_b32(&data->fe_y, init_y); - CHECK(secp256k1_ge_set_xo_var(&data->ge_x, &data->fe_x, 0)); - CHECK(secp256k1_ge_set_xo_var(&data->ge_y, &data->fe_y, 1)); - secp256k1_gej_set_ge(&data->gej_x, &data->ge_x); - secp256k1_gej_set_ge(&data->gej_y, &data->ge_y); - memcpy(data->data, init_x, 32); - memcpy(data->data + 32, init_y, 32); -} - -void bench_scalar_add(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_scalar_negate(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_scalar_negate(&data->scalar_x, &data->scalar_x); - } -} - -void bench_scalar_sqr(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_scalar_sqr(&data->scalar_x, &data->scalar_x); - } -} - -void bench_scalar_mul(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_scalar_mul(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -#ifdef USE_ENDOMORPHISM -void bench_scalar_split(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_scalar l, r; - secp256k1_scalar_split_lambda(&l, &r, &data->scalar_x); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} -#endif - -void bench_scalar_inverse(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000; i++) { - secp256k1_scalar_inverse(&data->scalar_x, &data->scalar_x); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_scalar_inverse_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000; i++) { - secp256k1_scalar_inverse_var(&data->scalar_x, &data->scalar_x); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_field_normalize(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_fe_normalize(&data->fe_x); - } -} - -void bench_field_normalize_weak(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_fe_normalize_weak(&data->fe_x); - } -} - -void bench_field_mul(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_fe_mul(&data->fe_x, &data->fe_x, &data->fe_y); - } -} - -void bench_field_sqr(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_fe_sqr(&data->fe_x, &data->fe_x); - } -} - -void bench_field_inverse(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_fe_inv(&data->fe_x, &data->fe_x); - secp256k1_fe_add(&data->fe_x, &data->fe_y); - } -} - -void bench_field_inverse_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_fe_inv_var(&data->fe_x, &data->fe_x); - secp256k1_fe_add(&data->fe_x, &data->fe_y); - } -} - -void bench_field_sqrt(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_fe_sqrt(&data->fe_x, &data->fe_x); - secp256k1_fe_add(&data->fe_x, &data->fe_y); - } -} - -void bench_group_double_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_double_var(&data->gej_x, &data->gej_x, NULL); - } -} - -void bench_group_add_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_add_var(&data->gej_x, &data->gej_x, &data->gej_y, NULL); - } -} - -void bench_group_add_affine(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_add_ge(&data->gej_x, &data->gej_x, &data->ge_y); - } -} - -void bench_group_add_affine_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_add_ge_var(&data->gej_x, &data->gej_x, &data->ge_y, NULL); - } -} - -void bench_group_jacobi_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_gej_has_quad_y_var(&data->gej_x); - } -} - -void bench_ecmult_wnaf(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_ecmult_wnaf(data->wnaf, 256, &data->scalar_x, WINDOW_A); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_wnaf_const(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_wnaf_const(data->wnaf, data->scalar_x, WINDOW_A); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - - -void bench_sha256(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_sha256_t sha; - - for (i = 0; i < 20000; i++) { - secp256k1_sha256_initialize(&sha); - secp256k1_sha256_write(&sha, data->data, 32); - secp256k1_sha256_finalize(&sha, data->data); - } -} - -void bench_hmac_sha256(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_hmac_sha256_t hmac; - - for (i = 0; i < 20000; i++) { - secp256k1_hmac_sha256_initialize(&hmac, data->data, 32); - secp256k1_hmac_sha256_write(&hmac, data->data, 32); - secp256k1_hmac_sha256_finalize(&hmac, data->data); - } -} - -void bench_rfc6979_hmac_sha256(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_rfc6979_hmac_sha256_t rng; - - for (i = 0; i < 20000; i++) { - secp256k1_rfc6979_hmac_sha256_initialize(&rng, data->data, 64); - secp256k1_rfc6979_hmac_sha256_generate(&rng, data->data, 32); - } -} - -void bench_context_verify(void* arg) { - int i; - (void)arg; - for (i = 0; i < 20; i++) { - secp256k1_context_destroy(secp256k1_context_create(SECP256K1_CONTEXT_VERIFY)); - } -} - -void bench_context_sign(void* arg) { - int i; - (void)arg; - for (i = 0; i < 200; i++) { - secp256k1_context_destroy(secp256k1_context_create(SECP256K1_CONTEXT_SIGN)); - } -} - -#ifndef USE_NUM_NONE -void bench_num_jacobi(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_num nx, norder; - - secp256k1_scalar_get_num(&nx, &data->scalar_x); - secp256k1_scalar_order_get_num(&norder); - secp256k1_scalar_get_num(&norder, &data->scalar_y); - - for (i = 0; i < 200000; i++) { - secp256k1_num_jacobi(&nx, &norder); - } -} -#endif - -int have_flag(int argc, char** argv, char *flag) { - char** argm = argv + argc; - argv++; - if (argv == argm) { - return 1; - } - while (argv != NULL && argv != argm) { - if (strcmp(*argv, flag) == 0) { - return 1; - } - argv++; - } - return 0; -} - -int main(int argc, char **argv) { - bench_inv_t data; - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "add")) run_benchmark("scalar_add", bench_scalar_add, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "negate")) run_benchmark("scalar_negate", bench_scalar_negate, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "sqr")) run_benchmark("scalar_sqr", bench_scalar_sqr, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "mul")) run_benchmark("scalar_mul", bench_scalar_mul, bench_setup, NULL, &data, 10, 200000); -#ifdef USE_ENDOMORPHISM - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "split")) run_benchmark("scalar_split", bench_scalar_split, bench_setup, NULL, &data, 10, 20000); -#endif - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "inverse")) run_benchmark("scalar_inverse", bench_scalar_inverse, bench_setup, NULL, &data, 10, 2000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "inverse")) run_benchmark("scalar_inverse_var", bench_scalar_inverse_var, bench_setup, NULL, &data, 10, 2000); - - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "normalize")) run_benchmark("field_normalize", bench_field_normalize, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "normalize")) run_benchmark("field_normalize_weak", bench_field_normalize_weak, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "sqr")) run_benchmark("field_sqr", bench_field_sqr, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "mul")) run_benchmark("field_mul", bench_field_mul, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "inverse")) run_benchmark("field_inverse", bench_field_inverse, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "inverse")) run_benchmark("field_inverse_var", bench_field_inverse_var, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "sqrt")) run_benchmark("field_sqrt", bench_field_sqrt, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "double")) run_benchmark("group_double_var", bench_group_double_var, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "add")) run_benchmark("group_add_var", bench_group_add_var, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "add")) run_benchmark("group_add_affine", bench_group_add_affine, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "add")) run_benchmark("group_add_affine_var", bench_group_add_affine_var, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "jacobi")) run_benchmark("group_jacobi_var", bench_group_jacobi_var, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "ecmult") || have_flag(argc, argv, "wnaf")) run_benchmark("wnaf_const", bench_wnaf_const, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "ecmult") || have_flag(argc, argv, "wnaf")) run_benchmark("ecmult_wnaf", bench_ecmult_wnaf, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "hash") || have_flag(argc, argv, "sha256")) run_benchmark("hash_sha256", bench_sha256, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "hash") || have_flag(argc, argv, "hmac")) run_benchmark("hash_hmac_sha256", bench_hmac_sha256, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "hash") || have_flag(argc, argv, "rng6979")) run_benchmark("hash_rfc6979_hmac_sha256", bench_rfc6979_hmac_sha256, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "context") || have_flag(argc, argv, "verify")) run_benchmark("context_verify", bench_context_verify, bench_setup, NULL, &data, 10, 20); - if (have_flag(argc, argv, "context") || have_flag(argc, argv, "sign")) run_benchmark("context_sign", bench_context_sign, bench_setup, NULL, &data, 10, 200); - -#ifndef USE_NUM_NONE - if (have_flag(argc, argv, "num") || have_flag(argc, argv, "jacobi")) run_benchmark("num_jacobi", bench_num_jacobi, bench_setup, NULL, &data, 10, 200000); -#endif - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c deleted file mode 100644 index 6489378c..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c +++ /dev/null @@ -1,60 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include "include/secp256k1.h" -#include "include/secp256k1_recovery.h" -#include "util.h" -#include "bench.h" - -typedef struct { - secp256k1_context *ctx; - unsigned char msg[32]; - unsigned char sig[64]; -} bench_recover_t; - -void bench_recover(void* arg) { - int i; - bench_recover_t *data = (bench_recover_t*)arg; - secp256k1_pubkey pubkey; - unsigned char pubkeyc[33]; - - for (i = 0; i < 20000; i++) { - int j; - size_t pubkeylen = 33; - secp256k1_ecdsa_recoverable_signature sig; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(data->ctx, &sig, data->sig, i % 2)); - CHECK(secp256k1_ecdsa_recover(data->ctx, &pubkey, &sig, data->msg)); - CHECK(secp256k1_ec_pubkey_serialize(data->ctx, pubkeyc, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED)); - for (j = 0; j < 32; j++) { - data->sig[j + 32] = data->msg[j]; /* Move former message to S. */ - data->msg[j] = data->sig[j]; /* Move former R to message. */ - data->sig[j] = pubkeyc[j + 1]; /* Move recovered pubkey X coordinate to R (which must be a valid X coordinate). */ - } - } -} - -void bench_recover_setup(void* arg) { - int i; - bench_recover_t *data = (bench_recover_t*)arg; - - for (i = 0; i < 32; i++) { - data->msg[i] = 1 + i; - } - for (i = 0; i < 64; i++) { - data->sig[i] = 65 + i; - } -} - -int main(void) { - bench_recover_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); - - run_benchmark("ecdsa_recover", bench_recover, bench_recover_setup, NULL, &data, 10, 20000); - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c deleted file mode 100644 index 5f137dda..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c +++ /dev/null @@ -1,73 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "include/secp256k1.h" -#include "include/secp256k1_schnorr.h" -#include "util.h" -#include "bench.h" - -typedef struct { - unsigned char key[32]; - unsigned char sig[64]; - unsigned char pubkey[33]; - size_t pubkeylen; -} benchmark_schnorr_sig_t; - -typedef struct { - secp256k1_context *ctx; - unsigned char msg[32]; - benchmark_schnorr_sig_t sigs[64]; - int numsigs; -} benchmark_schnorr_verify_t; - -static void benchmark_schnorr_init(void* arg) { - int i, k; - benchmark_schnorr_verify_t* data = (benchmark_schnorr_verify_t*)arg; - - for (i = 0; i < 32; i++) { - data->msg[i] = 1 + i; - } - for (k = 0; k < data->numsigs; k++) { - secp256k1_pubkey pubkey; - for (i = 0; i < 32; i++) { - data->sigs[k].key[i] = 33 + i + k; - } - secp256k1_schnorr_sign(data->ctx, data->sigs[k].sig, data->msg, data->sigs[k].key, NULL, NULL); - data->sigs[k].pubkeylen = 33; - CHECK(secp256k1_ec_pubkey_create(data->ctx, &pubkey, data->sigs[k].key)); - CHECK(secp256k1_ec_pubkey_serialize(data->ctx, data->sigs[k].pubkey, &data->sigs[k].pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED)); - } -} - -static void benchmark_schnorr_verify(void* arg) { - int i; - benchmark_schnorr_verify_t* data = (benchmark_schnorr_verify_t*)arg; - - for (i = 0; i < 20000 / data->numsigs; i++) { - secp256k1_pubkey pubkey; - data->sigs[0].sig[(i >> 8) % 64] ^= (i & 0xFF); - CHECK(secp256k1_ec_pubkey_parse(data->ctx, &pubkey, data->sigs[0].pubkey, data->sigs[0].pubkeylen)); - CHECK(secp256k1_schnorr_verify(data->ctx, data->sigs[0].sig, data->msg, &pubkey) == ((i & 0xFF) == 0)); - data->sigs[0].sig[(i >> 8) % 64] ^= (i & 0xFF); - } -} - - - -int main(void) { - benchmark_schnorr_verify_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - data.numsigs = 1; - run_benchmark("schnorr_verify", benchmark_schnorr_verify, benchmark_schnorr_init, NULL, &data, 10, 20000); - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c deleted file mode 100644 index ed7224d7..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c +++ /dev/null @@ -1,56 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include "include/secp256k1.h" -#include "util.h" -#include "bench.h" - -typedef struct { - secp256k1_context* ctx; - unsigned char msg[32]; - unsigned char key[32]; -} bench_sign_t; - -static void bench_sign_setup(void* arg) { - int i; - bench_sign_t *data = (bench_sign_t*)arg; - - for (i = 0; i < 32; i++) { - data->msg[i] = i + 1; - } - for (i = 0; i < 32; i++) { - data->key[i] = i + 65; - } -} - -static void bench_sign(void* arg) { - int i; - bench_sign_t *data = (bench_sign_t*)arg; - - unsigned char sig[74]; - for (i = 0; i < 20000; i++) { - size_t siglen = 74; - int j; - secp256k1_ecdsa_signature signature; - CHECK(secp256k1_ecdsa_sign(data->ctx, &signature, data->msg, data->key, NULL, NULL)); - CHECK(secp256k1_ecdsa_signature_serialize_der(data->ctx, sig, &siglen, &signature)); - for (j = 0; j < 32; j++) { - data->msg[j] = sig[j]; - data->key[j] = sig[j + 32]; - } - } -} - -int main(void) { - bench_sign_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - - run_benchmark("ecdsa_sign", bench_sign, bench_sign_setup, NULL, &data, 10, 20000); - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c deleted file mode 100644 index 418defa0..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c +++ /dev/null @@ -1,112 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "include/secp256k1.h" -#include "util.h" -#include "bench.h" - -#ifdef ENABLE_OPENSSL_TESTS -#include -#include -#include -#endif - -typedef struct { - secp256k1_context *ctx; - unsigned char msg[32]; - unsigned char key[32]; - unsigned char sig[72]; - size_t siglen; - unsigned char pubkey[33]; - size_t pubkeylen; -#ifdef ENABLE_OPENSSL_TESTS - EC_GROUP* ec_group; -#endif -} benchmark_verify_t; - -static void benchmark_verify(void* arg) { - int i; - benchmark_verify_t* data = (benchmark_verify_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_pubkey pubkey; - secp256k1_ecdsa_signature sig; - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - CHECK(secp256k1_ec_pubkey_parse(data->ctx, &pubkey, data->pubkey, data->pubkeylen) == 1); - CHECK(secp256k1_ecdsa_signature_parse_der(data->ctx, &sig, data->sig, data->siglen) == 1); - CHECK(secp256k1_ecdsa_verify(data->ctx, &sig, data->msg, &pubkey) == (i == 0)); - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - } -} - -#ifdef ENABLE_OPENSSL_TESTS -static void benchmark_verify_openssl(void* arg) { - int i; - benchmark_verify_t* data = (benchmark_verify_t*)arg; - - for (i = 0; i < 20000; i++) { - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - { - EC_KEY *pkey = EC_KEY_new(); - const unsigned char *pubkey = &data->pubkey[0]; - int result; - - CHECK(pkey != NULL); - result = EC_KEY_set_group(pkey, data->ec_group); - CHECK(result); - result = (o2i_ECPublicKey(&pkey, &pubkey, data->pubkeylen)) != NULL; - CHECK(result); - result = ECDSA_verify(0, &data->msg[0], sizeof(data->msg), &data->sig[0], data->siglen, pkey) == (i == 0); - CHECK(result); - EC_KEY_free(pkey); - } - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - } -} -#endif - -int main(void) { - int i; - secp256k1_pubkey pubkey; - secp256k1_ecdsa_signature sig; - benchmark_verify_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - for (i = 0; i < 32; i++) { - data.msg[i] = 1 + i; - } - for (i = 0; i < 32; i++) { - data.key[i] = 33 + i; - } - data.siglen = 72; - CHECK(secp256k1_ecdsa_sign(data.ctx, &sig, data.msg, data.key, NULL, NULL)); - CHECK(secp256k1_ecdsa_signature_serialize_der(data.ctx, data.sig, &data.siglen, &sig)); - CHECK(secp256k1_ec_pubkey_create(data.ctx, &pubkey, data.key)); - data.pubkeylen = 33; - CHECK(secp256k1_ec_pubkey_serialize(data.ctx, data.pubkey, &data.pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - - run_benchmark("ecdsa_verify", benchmark_verify, NULL, NULL, &data, 10, 20000); -#ifdef ENABLE_OPENSSL_TESTS - data.ec_group = EC_GROUP_new_by_curve_name(NID_secp256k1); - run_benchmark("ecdsa_verify_openssl", benchmark_verify_openssl, NULL, NULL, &data, 10, 20000); - EC_GROUP_free(data.ec_group); -#endif - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h deleted file mode 100644 index 54ae101b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h +++ /dev/null @@ -1,21 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECDSA_ -#define _SECP256K1_ECDSA_ - -#include - -#include "scalar.h" -#include "group.h" -#include "ecmult.h" - -static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *r, secp256k1_scalar *s, const unsigned char *sig, size_t size); -static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar *r, const secp256k1_scalar *s); -static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const secp256k1_scalar* r, const secp256k1_scalar* s, const secp256k1_ge *pubkey, const secp256k1_scalar *message); -static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h deleted file mode 100644 index 453bb118..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h +++ /dev/null @@ -1,315 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - - -#ifndef _SECP256K1_ECDSA_IMPL_H_ -#define _SECP256K1_ECDSA_IMPL_H_ - -#include "scalar.h" -#include "field.h" -#include "group.h" -#include "ecmult.h" -#include "ecmult_gen.h" -#include "ecdsa.h" - -/** Group order for secp256k1 defined as 'n' in "Standards for Efficient Cryptography" (SEC2) 2.7.1 - * sage: for t in xrange(1023, -1, -1): - * .. p = 2**256 - 2**32 - t - * .. if p.is_prime(): - * .. print '%x'%p - * .. break - * 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f' - * sage: a = 0 - * sage: b = 7 - * sage: F = FiniteField (p) - * sage: '%x' % (EllipticCurve ([F (a), F (b)]).order()) - * 'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141' - */ -static const secp256k1_fe secp256k1_ecdsa_const_order_as_fe = SECP256K1_FE_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL, - 0xBAAEDCE6UL, 0xAF48A03BUL, 0xBFD25E8CUL, 0xD0364141UL -); - -/** Difference between field and order, values 'p' and 'n' values defined in - * "Standards for Efficient Cryptography" (SEC2) 2.7.1. - * sage: p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F - * sage: a = 0 - * sage: b = 7 - * sage: F = FiniteField (p) - * sage: '%x' % (p - EllipticCurve ([F (a), F (b)]).order()) - * '14551231950b75fc4402da1722fc9baee' - */ -static const secp256k1_fe secp256k1_ecdsa_const_p_minus_order = SECP256K1_FE_CONST( - 0, 0, 0, 1, 0x45512319UL, 0x50B75FC4UL, 0x402DA172UL, 0x2FC9BAEEUL -); - -static int secp256k1_der_read_len(const unsigned char **sigp, const unsigned char *sigend) { - int lenleft, b1; - size_t ret = 0; - if (*sigp >= sigend) { - return -1; - } - b1 = *((*sigp)++); - if (b1 == 0xFF) { - /* X.690-0207 8.1.3.5.c the value 0xFF shall not be used. */ - return -1; - } - if ((b1 & 0x80) == 0) { - /* X.690-0207 8.1.3.4 short form length octets */ - return b1; - } - if (b1 == 0x80) { - /* Indefinite length is not allowed in DER. */ - return -1; - } - /* X.690-207 8.1.3.5 long form length octets */ - lenleft = b1 & 0x7F; - if (lenleft > sigend - *sigp) { - return -1; - } - if (**sigp == 0) { - /* Not the shortest possible length encoding. */ - return -1; - } - if ((size_t)lenleft > sizeof(size_t)) { - /* The resulting length would exceed the range of a size_t, so - * certainly longer than the passed array size. - */ - return -1; - } - while (lenleft > 0) { - if ((ret >> ((sizeof(size_t) - 1) * 8)) != 0) { - } - ret = (ret << 8) | **sigp; - if (ret + lenleft > (size_t)(sigend - *sigp)) { - /* Result exceeds the length of the passed array. */ - return -1; - } - (*sigp)++; - lenleft--; - } - if (ret < 128) { - /* Not the shortest possible length encoding. */ - return -1; - } - return ret; -} - -static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char **sig, const unsigned char *sigend) { - int overflow = 0; - unsigned char ra[32] = {0}; - int rlen; - - if (*sig == sigend || **sig != 0x02) { - /* Not a primitive integer (X.690-0207 8.3.1). */ - return 0; - } - (*sig)++; - rlen = secp256k1_der_read_len(sig, sigend); - if (rlen <= 0 || (*sig) + rlen > sigend) { - /* Exceeds bounds or not at least length 1 (X.690-0207 8.3.1). */ - return 0; - } - if (**sig == 0x00 && rlen > 1 && (((*sig)[1]) & 0x80) == 0x00) { - /* Excessive 0x00 padding. */ - return 0; - } - if (**sig == 0xFF && rlen > 1 && (((*sig)[1]) & 0x80) == 0x80) { - /* Excessive 0xFF padding. */ - return 0; - } - if ((**sig & 0x80) == 0x80) { - /* Negative. */ - overflow = 1; - } - while (rlen > 0 && **sig == 0) { - /* Skip leading zero bytes */ - rlen--; - (*sig)++; - } - if (rlen > 32) { - overflow = 1; - } - if (!overflow) { - memcpy(ra + 32 - rlen, *sig, rlen); - secp256k1_scalar_set_b32(r, ra, &overflow); - } - if (overflow) { - secp256k1_scalar_set_int(r, 0); - } - (*sig) += rlen; - return 1; -} - -static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *rr, secp256k1_scalar *rs, const unsigned char *sig, size_t size) { - const unsigned char *sigend = sig + size; - int rlen; - if (sig == sigend || *(sig++) != 0x30) { - /* The encoding doesn't start with a constructed sequence (X.690-0207 8.9.1). */ - return 0; - } - rlen = secp256k1_der_read_len(&sig, sigend); - if (rlen < 0 || sig + rlen > sigend) { - /* Tuple exceeds bounds */ - return 0; - } - if (sig + rlen != sigend) { - /* Garbage after tuple. */ - return 0; - } - - if (!secp256k1_der_parse_integer(rr, &sig, sigend)) { - return 0; - } - if (!secp256k1_der_parse_integer(rs, &sig, sigend)) { - return 0; - } - - if (sig != sigend) { - /* Trailing garbage inside tuple. */ - return 0; - } - - return 1; -} - -static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar* ar, const secp256k1_scalar* as) { - unsigned char r[33] = {0}, s[33] = {0}; - unsigned char *rp = r, *sp = s; - size_t lenR = 33, lenS = 33; - secp256k1_scalar_get_b32(&r[1], ar); - secp256k1_scalar_get_b32(&s[1], as); - while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; } - while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; } - if (*size < 6+lenS+lenR) { - *size = 6 + lenS + lenR; - return 0; - } - *size = 6 + lenS + lenR; - sig[0] = 0x30; - sig[1] = 4 + lenS + lenR; - sig[2] = 0x02; - sig[3] = lenR; - memcpy(sig+4, rp, lenR); - sig[4+lenR] = 0x02; - sig[5+lenR] = lenS; - memcpy(sig+lenR+6, sp, lenS); - return 1; -} - -static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const secp256k1_scalar *sigr, const secp256k1_scalar *sigs, const secp256k1_ge *pubkey, const secp256k1_scalar *message) { - unsigned char c[32]; - secp256k1_scalar sn, u1, u2; -#if !defined(EXHAUSTIVE_TEST_ORDER) - secp256k1_fe xr; -#endif - secp256k1_gej pubkeyj; - secp256k1_gej pr; - - if (secp256k1_scalar_is_zero(sigr) || secp256k1_scalar_is_zero(sigs)) { - return 0; - } - - secp256k1_scalar_inverse_var(&sn, sigs); - secp256k1_scalar_mul(&u1, &sn, message); - secp256k1_scalar_mul(&u2, &sn, sigr); - secp256k1_gej_set_ge(&pubkeyj, pubkey); - secp256k1_ecmult(ctx, &pr, &pubkeyj, &u2, &u1); - if (secp256k1_gej_is_infinity(&pr)) { - return 0; - } - -#if defined(EXHAUSTIVE_TEST_ORDER) -{ - secp256k1_scalar computed_r; - secp256k1_ge pr_ge; - secp256k1_ge_set_gej(&pr_ge, &pr); - secp256k1_fe_normalize(&pr_ge.x); - - secp256k1_fe_get_b32(c, &pr_ge.x); - secp256k1_scalar_set_b32(&computed_r, c, NULL); - return secp256k1_scalar_eq(sigr, &computed_r); -} -#else - secp256k1_scalar_get_b32(c, sigr); - secp256k1_fe_set_b32(&xr, c); - - /** We now have the recomputed R point in pr, and its claimed x coordinate (modulo n) - * in xr. Naively, we would extract the x coordinate from pr (requiring a inversion modulo p), - * compute the remainder modulo n, and compare it to xr. However: - * - * xr == X(pr) mod n - * <=> exists h. (xr + h * n < p && xr + h * n == X(pr)) - * [Since 2 * n > p, h can only be 0 or 1] - * <=> (xr == X(pr)) || (xr + n < p && xr + n == X(pr)) - * [In Jacobian coordinates, X(pr) is pr.x / pr.z^2 mod p] - * <=> (xr == pr.x / pr.z^2 mod p) || (xr + n < p && xr + n == pr.x / pr.z^2 mod p) - * [Multiplying both sides of the equations by pr.z^2 mod p] - * <=> (xr * pr.z^2 mod p == pr.x) || (xr + n < p && (xr + n) * pr.z^2 mod p == pr.x) - * - * Thus, we can avoid the inversion, but we have to check both cases separately. - * secp256k1_gej_eq_x implements the (xr * pr.z^2 mod p == pr.x) test. - */ - if (secp256k1_gej_eq_x_var(&xr, &pr)) { - /* xr * pr.z^2 mod p == pr.x, so the signature is valid. */ - return 1; - } - if (secp256k1_fe_cmp_var(&xr, &secp256k1_ecdsa_const_p_minus_order) >= 0) { - /* xr + n >= p, so we can skip testing the second case. */ - return 0; - } - secp256k1_fe_add(&xr, &secp256k1_ecdsa_const_order_as_fe); - if (secp256k1_gej_eq_x_var(&xr, &pr)) { - /* (xr + n) * pr.z^2 mod p == pr.x, so the signature is valid. */ - return 1; - } - return 0; -#endif -} - -static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar *sigr, secp256k1_scalar *sigs, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid) { - unsigned char b[32]; - secp256k1_gej rp; - secp256k1_ge r; - secp256k1_scalar n; - int overflow = 0; - - secp256k1_ecmult_gen(ctx, &rp, nonce); - secp256k1_ge_set_gej(&r, &rp); - secp256k1_fe_normalize(&r.x); - secp256k1_fe_normalize(&r.y); - secp256k1_fe_get_b32(b, &r.x); - secp256k1_scalar_set_b32(sigr, b, &overflow); - /* These two conditions should be checked before calling */ - VERIFY_CHECK(!secp256k1_scalar_is_zero(sigr)); - VERIFY_CHECK(overflow == 0); - - if (recid) { - /* The overflow condition is cryptographically unreachable as hitting it requires finding the discrete log - * of some P where P.x >= order, and only 1 in about 2^127 points meet this criteria. - */ - *recid = (overflow ? 2 : 0) | (secp256k1_fe_is_odd(&r.y) ? 1 : 0); - } - secp256k1_scalar_mul(&n, sigr, seckey); - secp256k1_scalar_add(&n, &n, message); - secp256k1_scalar_inverse(sigs, nonce); - secp256k1_scalar_mul(sigs, sigs, &n); - secp256k1_scalar_clear(&n); - secp256k1_gej_clear(&rp); - secp256k1_ge_clear(&r); - if (secp256k1_scalar_is_zero(sigs)) { - return 0; - } - if (secp256k1_scalar_is_high(sigs)) { - secp256k1_scalar_negate(sigs, sigs); - if (recid) { - *recid ^= 1; - } - } - return 1; -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h deleted file mode 100644 index 42739a3b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h +++ /dev/null @@ -1,25 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECKEY_ -#define _SECP256K1_ECKEY_ - -#include - -#include "group.h" -#include "scalar.h" -#include "ecmult.h" -#include "ecmult_gen.h" - -static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size); -static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed); - -static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak); -static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); -static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak); -static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h deleted file mode 100644 index ce38071a..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h +++ /dev/null @@ -1,99 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECKEY_IMPL_H_ -#define _SECP256K1_ECKEY_IMPL_H_ - -#include "eckey.h" - -#include "scalar.h" -#include "field.h" -#include "group.h" -#include "ecmult_gen.h" - -static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size) { - if (size == 33 && (pub[0] == 0x02 || pub[0] == 0x03)) { - secp256k1_fe x; - return secp256k1_fe_set_b32(&x, pub+1) && secp256k1_ge_set_xo_var(elem, &x, pub[0] == 0x03); - } else if (size == 65 && (pub[0] == 0x04 || pub[0] == 0x06 || pub[0] == 0x07)) { - secp256k1_fe x, y; - if (!secp256k1_fe_set_b32(&x, pub+1) || !secp256k1_fe_set_b32(&y, pub+33)) { - return 0; - } - secp256k1_ge_set_xy(elem, &x, &y); - if ((pub[0] == 0x06 || pub[0] == 0x07) && secp256k1_fe_is_odd(&y) != (pub[0] == 0x07)) { - return 0; - } - return secp256k1_ge_is_valid_var(elem); - } else { - return 0; - } -} - -static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed) { - if (secp256k1_ge_is_infinity(elem)) { - return 0; - } - secp256k1_fe_normalize_var(&elem->x); - secp256k1_fe_normalize_var(&elem->y); - secp256k1_fe_get_b32(&pub[1], &elem->x); - if (compressed) { - *size = 33; - pub[0] = 0x02 | (secp256k1_fe_is_odd(&elem->y) ? 0x01 : 0x00); - } else { - *size = 65; - pub[0] = 0x04; - secp256k1_fe_get_b32(&pub[33], &elem->y); - } - return 1; -} - -static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak) { - secp256k1_scalar_add(key, key, tweak); - if (secp256k1_scalar_is_zero(key)) { - return 0; - } - return 1; -} - -static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) { - secp256k1_gej pt; - secp256k1_scalar one; - secp256k1_gej_set_ge(&pt, key); - secp256k1_scalar_set_int(&one, 1); - secp256k1_ecmult(ctx, &pt, &pt, &one, tweak); - - if (secp256k1_gej_is_infinity(&pt)) { - return 0; - } - secp256k1_ge_set_gej(key, &pt); - return 1; -} - -static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak) { - if (secp256k1_scalar_is_zero(tweak)) { - return 0; - } - - secp256k1_scalar_mul(key, key, tweak); - return 1; -} - -static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) { - secp256k1_scalar zero; - secp256k1_gej pt; - if (secp256k1_scalar_is_zero(tweak)) { - return 0; - } - - secp256k1_scalar_set_int(&zero, 0); - secp256k1_gej_set_ge(&pt, key); - secp256k1_ecmult(ctx, &pt, &pt, tweak, &zero); - secp256k1_ge_set_gej(key, &pt); - return 1; -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h deleted file mode 100644 index 20484134..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h +++ /dev/null @@ -1,31 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_ -#define _SECP256K1_ECMULT_ - -#include "num.h" -#include "group.h" - -typedef struct { - /* For accelerating the computation of a*P + b*G: */ - secp256k1_ge_storage (*pre_g)[]; /* odd multiples of the generator */ -#ifdef USE_ENDOMORPHISM - secp256k1_ge_storage (*pre_g_128)[]; /* odd multiples of 2^128*generator */ -#endif -} secp256k1_ecmult_context; - -static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx); -static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb); -static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, - const secp256k1_ecmult_context *src, const secp256k1_callback *cb); -static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx); -static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx); - -/** Double multiply: R = na*A + ng*G */ -static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h deleted file mode 100644 index 2b009765..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h +++ /dev/null @@ -1,15 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_CONST_ -#define _SECP256K1_ECMULT_CONST_ - -#include "scalar.h" -#include "group.h" - -static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h deleted file mode 100644 index 0db314c4..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h +++ /dev/null @@ -1,239 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille, Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_CONST_IMPL_ -#define _SECP256K1_ECMULT_CONST_IMPL_ - -#include "scalar.h" -#include "group.h" -#include "ecmult_const.h" -#include "ecmult_impl.h" - -#ifdef USE_ENDOMORPHISM - #define WNAF_BITS 128 -#else - #define WNAF_BITS 256 -#endif -#define WNAF_SIZE(w) ((WNAF_BITS + (w) - 1) / (w)) - -/* This is like `ECMULT_TABLE_GET_GE` but is constant time */ -#define ECMULT_CONST_TABLE_GET_GE(r,pre,n,w) do { \ - int m; \ - int abs_n = (n) * (((n) > 0) * 2 - 1); \ - int idx_n = abs_n / 2; \ - secp256k1_fe neg_y; \ - VERIFY_CHECK(((n) & 1) == 1); \ - VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \ - VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \ - VERIFY_SETUP(secp256k1_fe_clear(&(r)->x)); \ - VERIFY_SETUP(secp256k1_fe_clear(&(r)->y)); \ - for (m = 0; m < ECMULT_TABLE_SIZE(w); m++) { \ - /* This loop is used to avoid secret data in array indices. See - * the comment in ecmult_gen_impl.h for rationale. */ \ - secp256k1_fe_cmov(&(r)->x, &(pre)[m].x, m == idx_n); \ - secp256k1_fe_cmov(&(r)->y, &(pre)[m].y, m == idx_n); \ - } \ - (r)->infinity = 0; \ - secp256k1_fe_negate(&neg_y, &(r)->y, 1); \ - secp256k1_fe_cmov(&(r)->y, &neg_y, (n) != abs_n); \ -} while(0) - - -/** Convert a number to WNAF notation. The number becomes represented by sum(2^{wi} * wnaf[i], i=0..return_val) - * with the following guarantees: - * - each wnaf[i] an odd integer between -(1 << w) and (1 << w) - * - each wnaf[i] is nonzero - * - the number of words set is returned; this is always (WNAF_BITS + w - 1) / w - * - * Adapted from `The Width-w NAF Method Provides Small Memory and Fast Elliptic Scalar - * Multiplications Secure against Side Channel Attacks`, Okeya and Tagaki. M. Joye (Ed.) - * CT-RSA 2003, LNCS 2612, pp. 328-443, 2003. Springer-Verlagy Berlin Heidelberg 2003 - * - * Numbers reference steps of `Algorithm SPA-resistant Width-w NAF with Odd Scalar` on pp. 335 - */ -static int secp256k1_wnaf_const(int *wnaf, secp256k1_scalar s, int w) { - int global_sign; - int skew = 0; - int word = 0; - - /* 1 2 3 */ - int u_last; - int u; - - int flip; - int bit; - secp256k1_scalar neg_s; - int not_neg_one; - /* Note that we cannot handle even numbers by negating them to be odd, as is - * done in other implementations, since if our scalars were specified to have - * width < 256 for performance reasons, their negations would have width 256 - * and we'd lose any performance benefit. Instead, we use a technique from - * Section 4.2 of the Okeya/Tagaki paper, which is to add either 1 (for even) - * or 2 (for odd) to the number we are encoding, returning a skew value indicating - * this, and having the caller compensate after doing the multiplication. */ - - /* Negative numbers will be negated to keep their bit representation below the maximum width */ - flip = secp256k1_scalar_is_high(&s); - /* We add 1 to even numbers, 2 to odd ones, noting that negation flips parity */ - bit = flip ^ !secp256k1_scalar_is_even(&s); - /* We check for negative one, since adding 2 to it will cause an overflow */ - secp256k1_scalar_negate(&neg_s, &s); - not_neg_one = !secp256k1_scalar_is_one(&neg_s); - secp256k1_scalar_cadd_bit(&s, bit, not_neg_one); - /* If we had negative one, flip == 1, s.d[0] == 0, bit == 1, so caller expects - * that we added two to it and flipped it. In fact for -1 these operations are - * identical. We only flipped, but since skewing is required (in the sense that - * the skew must be 1 or 2, never zero) and flipping is not, we need to change - * our flags to claim that we only skewed. */ - global_sign = secp256k1_scalar_cond_negate(&s, flip); - global_sign *= not_neg_one * 2 - 1; - skew = 1 << bit; - - /* 4 */ - u_last = secp256k1_scalar_shr_int(&s, w); - while (word * w < WNAF_BITS) { - int sign; - int even; - - /* 4.1 4.4 */ - u = secp256k1_scalar_shr_int(&s, w); - /* 4.2 */ - even = ((u & 1) == 0); - sign = 2 * (u_last > 0) - 1; - u += sign * even; - u_last -= sign * even * (1 << w); - - /* 4.3, adapted for global sign change */ - wnaf[word++] = u_last * global_sign; - - u_last = u; - } - wnaf[word] = u * global_sign; - - VERIFY_CHECK(secp256k1_scalar_is_zero(&s)); - VERIFY_CHECK(word == WNAF_SIZE(w)); - return skew; -} - - -static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *scalar) { - secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_ge tmpa; - secp256k1_fe Z; - - int skew_1; - int wnaf_1[1 + WNAF_SIZE(WINDOW_A - 1)]; -#ifdef USE_ENDOMORPHISM - secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)]; - int wnaf_lam[1 + WNAF_SIZE(WINDOW_A - 1)]; - int skew_lam; - secp256k1_scalar q_1, q_lam; -#endif - - int i; - secp256k1_scalar sc = *scalar; - - /* build wnaf representation for q. */ -#ifdef USE_ENDOMORPHISM - /* split q into q_1 and q_lam (where q = q_1 + q_lam*lambda, and q_1 and q_lam are ~128 bit) */ - secp256k1_scalar_split_lambda(&q_1, &q_lam, &sc); - skew_1 = secp256k1_wnaf_const(wnaf_1, q_1, WINDOW_A - 1); - skew_lam = secp256k1_wnaf_const(wnaf_lam, q_lam, WINDOW_A - 1); -#else - skew_1 = secp256k1_wnaf_const(wnaf_1, sc, WINDOW_A - 1); -#endif - - /* Calculate odd multiples of a. - * All multiples are brought to the same Z 'denominator', which is stored - * in Z. Due to secp256k1' isomorphism we can do all operations pretending - * that the Z coordinate was 1, use affine addition formulae, and correct - * the Z coordinate of the result once at the end. - */ - secp256k1_gej_set_ge(r, a); - secp256k1_ecmult_odd_multiples_table_globalz_windowa(pre_a, &Z, r); - for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) { - secp256k1_fe_normalize_weak(&pre_a[i].y); - } -#ifdef USE_ENDOMORPHISM - for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) { - secp256k1_ge_mul_lambda(&pre_a_lam[i], &pre_a[i]); - } -#endif - - /* first loop iteration (separated out so we can directly set r, rather - * than having it start at infinity, get doubled several times, then have - * its new value added to it) */ - i = wnaf_1[WNAF_SIZE(WINDOW_A - 1)]; - VERIFY_CHECK(i != 0); - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a, i, WINDOW_A); - secp256k1_gej_set_ge(r, &tmpa); -#ifdef USE_ENDOMORPHISM - i = wnaf_lam[WNAF_SIZE(WINDOW_A - 1)]; - VERIFY_CHECK(i != 0); - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a_lam, i, WINDOW_A); - secp256k1_gej_add_ge(r, r, &tmpa); -#endif - /* remaining loop iterations */ - for (i = WNAF_SIZE(WINDOW_A - 1) - 1; i >= 0; i--) { - int n; - int j; - for (j = 0; j < WINDOW_A - 1; ++j) { - secp256k1_gej_double_nonzero(r, r, NULL); - } - - n = wnaf_1[i]; - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a, n, WINDOW_A); - VERIFY_CHECK(n != 0); - secp256k1_gej_add_ge(r, r, &tmpa); -#ifdef USE_ENDOMORPHISM - n = wnaf_lam[i]; - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a_lam, n, WINDOW_A); - VERIFY_CHECK(n != 0); - secp256k1_gej_add_ge(r, r, &tmpa); -#endif - } - - secp256k1_fe_mul(&r->z, &r->z, &Z); - - { - /* Correct for wNAF skew */ - secp256k1_ge correction = *a; - secp256k1_ge_storage correction_1_stor; -#ifdef USE_ENDOMORPHISM - secp256k1_ge_storage correction_lam_stor; -#endif - secp256k1_ge_storage a2_stor; - secp256k1_gej tmpj; - secp256k1_gej_set_ge(&tmpj, &correction); - secp256k1_gej_double_var(&tmpj, &tmpj, NULL); - secp256k1_ge_set_gej(&correction, &tmpj); - secp256k1_ge_to_storage(&correction_1_stor, a); -#ifdef USE_ENDOMORPHISM - secp256k1_ge_to_storage(&correction_lam_stor, a); -#endif - secp256k1_ge_to_storage(&a2_stor, &correction); - - /* For odd numbers this is 2a (so replace it), for even ones a (so no-op) */ - secp256k1_ge_storage_cmov(&correction_1_stor, &a2_stor, skew_1 == 2); -#ifdef USE_ENDOMORPHISM - secp256k1_ge_storage_cmov(&correction_lam_stor, &a2_stor, skew_lam == 2); -#endif - - /* Apply the correction */ - secp256k1_ge_from_storage(&correction, &correction_1_stor); - secp256k1_ge_neg(&correction, &correction); - secp256k1_gej_add_ge(r, r, &correction); - -#ifdef USE_ENDOMORPHISM - secp256k1_ge_from_storage(&correction, &correction_lam_stor); - secp256k1_ge_neg(&correction, &correction); - secp256k1_ge_mul_lambda(&correction, &correction); - secp256k1_gej_add_ge(r, r, &correction); -#endif - } -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h deleted file mode 100644 index eb2cc9ea..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h +++ /dev/null @@ -1,43 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_GEN_ -#define _SECP256K1_ECMULT_GEN_ - -#include "scalar.h" -#include "group.h" - -typedef struct { - /* For accelerating the computation of a*G: - * To harden against timing attacks, use the following mechanism: - * * Break up the multiplicand into groups of 4 bits, called n_0, n_1, n_2, ..., n_63. - * * Compute sum(n_i * 16^i * G + U_i, i=0..63), where: - * * U_i = U * 2^i (for i=0..62) - * * U_i = U * (1-2^63) (for i=63) - * where U is a point with no known corresponding scalar. Note that sum(U_i, i=0..63) = 0. - * For each i, and each of the 16 possible values of n_i, (n_i * 16^i * G + U_i) is - * precomputed (call it prec(i, n_i)). The formula now becomes sum(prec(i, n_i), i=0..63). - * None of the resulting prec group elements have a known scalar, and neither do any of - * the intermediate sums while computing a*G. - */ - secp256k1_ge_storage (*prec)[64][16]; /* prec[j][i] = 16^j * i * G + U_i */ - secp256k1_scalar blind; - secp256k1_gej initial; -} secp256k1_ecmult_gen_context; - -static void secp256k1_ecmult_gen_context_init(secp256k1_ecmult_gen_context* ctx); -static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context* ctx, const secp256k1_callback* cb); -static void secp256k1_ecmult_gen_context_clone(secp256k1_ecmult_gen_context *dst, - const secp256k1_ecmult_gen_context* src, const secp256k1_callback* cb); -static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context* ctx); -static int secp256k1_ecmult_gen_context_is_built(const secp256k1_ecmult_gen_context* ctx); - -/** Multiply with the generator: R = a*G */ -static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context* ctx, secp256k1_gej *r, const secp256k1_scalar *a); - -static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const unsigned char *seed32); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h deleted file mode 100644 index 35f25460..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h +++ /dev/null @@ -1,210 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014, 2015 Pieter Wuille, Gregory Maxwell * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_GEN_IMPL_H_ -#define _SECP256K1_ECMULT_GEN_IMPL_H_ - -#include "scalar.h" -#include "group.h" -#include "ecmult_gen.h" -#include "hash_impl.h" -#ifdef USE_ECMULT_STATIC_PRECOMPUTATION -#include "ecmult_static_context.h" -#endif -static void secp256k1_ecmult_gen_context_init(secp256k1_ecmult_gen_context *ctx) { - ctx->prec = NULL; -} - -static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context *ctx, const secp256k1_callback* cb) { -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - secp256k1_ge prec[1024]; - secp256k1_gej gj; - secp256k1_gej nums_gej; - int i, j; -#endif - - if (ctx->prec != NULL) { - return; - } -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - ctx->prec = (secp256k1_ge_storage (*)[64][16])checked_malloc(cb, sizeof(*ctx->prec)); - - /* get the generator */ - secp256k1_gej_set_ge(&gj, &secp256k1_ge_const_g); - - /* Construct a group element with no known corresponding scalar (nothing up my sleeve). */ - { - static const unsigned char nums_b32[33] = "The scalar for this x is unknown"; - secp256k1_fe nums_x; - secp256k1_ge nums_ge; - int r; - r = secp256k1_fe_set_b32(&nums_x, nums_b32); - (void)r; - VERIFY_CHECK(r); - r = secp256k1_ge_set_xo_var(&nums_ge, &nums_x, 0); - (void)r; - VERIFY_CHECK(r); - secp256k1_gej_set_ge(&nums_gej, &nums_ge); - /* Add G to make the bits in x uniformly distributed. */ - secp256k1_gej_add_ge_var(&nums_gej, &nums_gej, &secp256k1_ge_const_g, NULL); - } - - /* compute prec. */ - { - secp256k1_gej precj[1024]; /* Jacobian versions of prec. */ - secp256k1_gej gbase; - secp256k1_gej numsbase; - gbase = gj; /* 16^j * G */ - numsbase = nums_gej; /* 2^j * nums. */ - for (j = 0; j < 64; j++) { - /* Set precj[j*16 .. j*16+15] to (numsbase, numsbase + gbase, ..., numsbase + 15*gbase). */ - precj[j*16] = numsbase; - for (i = 1; i < 16; i++) { - secp256k1_gej_add_var(&precj[j*16 + i], &precj[j*16 + i - 1], &gbase, NULL); - } - /* Multiply gbase by 16. */ - for (i = 0; i < 4; i++) { - secp256k1_gej_double_var(&gbase, &gbase, NULL); - } - /* Multiply numbase by 2. */ - secp256k1_gej_double_var(&numsbase, &numsbase, NULL); - if (j == 62) { - /* In the last iteration, numsbase is (1 - 2^j) * nums instead. */ - secp256k1_gej_neg(&numsbase, &numsbase); - secp256k1_gej_add_var(&numsbase, &numsbase, &nums_gej, NULL); - } - } - secp256k1_ge_set_all_gej_var(prec, precj, 1024, cb); - } - for (j = 0; j < 64; j++) { - for (i = 0; i < 16; i++) { - secp256k1_ge_to_storage(&(*ctx->prec)[j][i], &prec[j*16 + i]); - } - } -#else - (void)cb; - ctx->prec = (secp256k1_ge_storage (*)[64][16])secp256k1_ecmult_static_context; -#endif - secp256k1_ecmult_gen_blind(ctx, NULL); -} - -static int secp256k1_ecmult_gen_context_is_built(const secp256k1_ecmult_gen_context* ctx) { - return ctx->prec != NULL; -} - -static void secp256k1_ecmult_gen_context_clone(secp256k1_ecmult_gen_context *dst, - const secp256k1_ecmult_gen_context *src, const secp256k1_callback* cb) { - if (src->prec == NULL) { - dst->prec = NULL; - } else { -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - dst->prec = (secp256k1_ge_storage (*)[64][16])checked_malloc(cb, sizeof(*dst->prec)); - memcpy(dst->prec, src->prec, sizeof(*dst->prec)); -#else - (void)cb; - dst->prec = src->prec; -#endif - dst->initial = src->initial; - dst->blind = src->blind; - } -} - -static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context *ctx) { -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - free(ctx->prec); -#endif - secp256k1_scalar_clear(&ctx->blind); - secp256k1_gej_clear(&ctx->initial); - ctx->prec = NULL; -} - -static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context *ctx, secp256k1_gej *r, const secp256k1_scalar *gn) { - secp256k1_ge add; - secp256k1_ge_storage adds; - secp256k1_scalar gnb; - int bits; - int i, j; - memset(&adds, 0, sizeof(adds)); - *r = ctx->initial; - /* Blind scalar/point multiplication by computing (n-b)G + bG instead of nG. */ - secp256k1_scalar_add(&gnb, gn, &ctx->blind); - add.infinity = 0; - for (j = 0; j < 64; j++) { - bits = secp256k1_scalar_get_bits(&gnb, j * 4, 4); - for (i = 0; i < 16; i++) { - /** This uses a conditional move to avoid any secret data in array indexes. - * _Any_ use of secret indexes has been demonstrated to result in timing - * sidechannels, even when the cache-line access patterns are uniform. - * See also: - * "A word of warning", CHES 2013 Rump Session, by Daniel J. Bernstein and Peter Schwabe - * (https://cryptojedi.org/peter/data/chesrump-20130822.pdf) and - * "Cache Attacks and Countermeasures: the Case of AES", RSA 2006, - * by Dag Arne Osvik, Adi Shamir, and Eran Tromer - * (http://www.tau.ac.il/~tromer/papers/cache.pdf) - */ - secp256k1_ge_storage_cmov(&adds, &(*ctx->prec)[j][i], i == bits); - } - secp256k1_ge_from_storage(&add, &adds); - secp256k1_gej_add_ge(r, r, &add); - } - bits = 0; - secp256k1_ge_clear(&add); - secp256k1_scalar_clear(&gnb); -} - -/* Setup blinding values for secp256k1_ecmult_gen. */ -static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const unsigned char *seed32) { - secp256k1_scalar b; - secp256k1_gej gb; - secp256k1_fe s; - unsigned char nonce32[32]; - secp256k1_rfc6979_hmac_sha256_t rng; - int retry; - unsigned char keydata[64] = {0}; - if (seed32 == NULL) { - /* When seed is NULL, reset the initial point and blinding value. */ - secp256k1_gej_set_ge(&ctx->initial, &secp256k1_ge_const_g); - secp256k1_gej_neg(&ctx->initial, &ctx->initial); - secp256k1_scalar_set_int(&ctx->blind, 1); - } - /* The prior blinding value (if not reset) is chained forward by including it in the hash. */ - secp256k1_scalar_get_b32(nonce32, &ctx->blind); - /** Using a CSPRNG allows a failure free interface, avoids needing large amounts of random data, - * and guards against weak or adversarial seeds. This is a simpler and safer interface than - * asking the caller for blinding values directly and expecting them to retry on failure. - */ - memcpy(keydata, nonce32, 32); - if (seed32 != NULL) { - memcpy(keydata + 32, seed32, 32); - } - secp256k1_rfc6979_hmac_sha256_initialize(&rng, keydata, seed32 ? 64 : 32); - memset(keydata, 0, sizeof(keydata)); - /* Retry for out of range results to achieve uniformity. */ - do { - secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); - retry = !secp256k1_fe_set_b32(&s, nonce32); - retry |= secp256k1_fe_is_zero(&s); - } while (retry); /* This branch true is cryptographically unreachable. Requires sha256_hmac output > Fp. */ - /* Randomize the projection to defend against multiplier sidechannels. */ - secp256k1_gej_rescale(&ctx->initial, &s); - secp256k1_fe_clear(&s); - do { - secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); - secp256k1_scalar_set_b32(&b, nonce32, &retry); - /* A blinding value of 0 works, but would undermine the projection hardening. */ - retry |= secp256k1_scalar_is_zero(&b); - } while (retry); /* This branch true is cryptographically unreachable. Requires sha256_hmac output > order. */ - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - memset(nonce32, 0, 32); - secp256k1_ecmult_gen(ctx, &gb, &b); - secp256k1_scalar_negate(&b, &b); - ctx->blind = b; - ctx->initial = gb; - secp256k1_scalar_clear(&b); - secp256k1_gej_clear(&gb); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h deleted file mode 100644 index 4e40104a..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h +++ /dev/null @@ -1,406 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_IMPL_H_ -#define _SECP256K1_ECMULT_IMPL_H_ - -#include - -#include "group.h" -#include "scalar.h" -#include "ecmult.h" - -#if defined(EXHAUSTIVE_TEST_ORDER) -/* We need to lower these values for exhaustive tests because - * the tables cannot have infinities in them (this breaks the - * affine-isomorphism stuff which tracks z-ratios) */ -# if EXHAUSTIVE_TEST_ORDER > 128 -# define WINDOW_A 5 -# define WINDOW_G 8 -# elif EXHAUSTIVE_TEST_ORDER > 8 -# define WINDOW_A 4 -# define WINDOW_G 4 -# else -# define WINDOW_A 2 -# define WINDOW_G 2 -# endif -#else -/* optimal for 128-bit and 256-bit exponents. */ -#define WINDOW_A 5 -/** larger numbers may result in slightly better performance, at the cost of - exponentially larger precomputed tables. */ -#ifdef USE_ENDOMORPHISM -/** Two tables for window size 15: 1.375 MiB. */ -#define WINDOW_G 15 -#else -/** One table for window size 16: 1.375 MiB. */ -#define WINDOW_G 16 -#endif -#endif - -/** The number of entries a table with precomputed multiples needs to have. */ -#define ECMULT_TABLE_SIZE(w) (1 << ((w)-2)) - -/** Fill a table 'prej' with precomputed odd multiples of a. Prej will contain - * the values [1*a,3*a,...,(2*n-1)*a], so it space for n values. zr[0] will - * contain prej[0].z / a.z. The other zr[i] values = prej[i].z / prej[i-1].z. - * Prej's Z values are undefined, except for the last value. - */ -static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_gej *prej, secp256k1_fe *zr, const secp256k1_gej *a) { - secp256k1_gej d; - secp256k1_ge a_ge, d_ge; - int i; - - VERIFY_CHECK(!a->infinity); - - secp256k1_gej_double_var(&d, a, NULL); - - /* - * Perform the additions on an isomorphism where 'd' is affine: drop the z coordinate - * of 'd', and scale the 1P starting value's x/y coordinates without changing its z. - */ - d_ge.x = d.x; - d_ge.y = d.y; - d_ge.infinity = 0; - - secp256k1_ge_set_gej_zinv(&a_ge, a, &d.z); - prej[0].x = a_ge.x; - prej[0].y = a_ge.y; - prej[0].z = a->z; - prej[0].infinity = 0; - - zr[0] = d.z; - for (i = 1; i < n; i++) { - secp256k1_gej_add_ge_var(&prej[i], &prej[i-1], &d_ge, &zr[i]); - } - - /* - * Each point in 'prej' has a z coordinate too small by a factor of 'd.z'. Only - * the final point's z coordinate is actually used though, so just update that. - */ - secp256k1_fe_mul(&prej[n-1].z, &prej[n-1].z, &d.z); -} - -/** Fill a table 'pre' with precomputed odd multiples of a. - * - * There are two versions of this function: - * - secp256k1_ecmult_odd_multiples_table_globalz_windowa which brings its - * resulting point set to a single constant Z denominator, stores the X and Y - * coordinates as ge_storage points in pre, and stores the global Z in rz. - * It only operates on tables sized for WINDOW_A wnaf multiples. - * - secp256k1_ecmult_odd_multiples_table_storage_var, which converts its - * resulting point set to actually affine points, and stores those in pre. - * It operates on tables of any size, but uses heap-allocated temporaries. - * - * To compute a*P + b*G, we compute a table for P using the first function, - * and for G using the second (which requires an inverse, but it only needs to - * happen once). - */ -static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) { - secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)]; - - /* Compute the odd multiples in Jacobian form. */ - secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), prej, zr, a); - /* Bring them to the same Z denominator. */ - secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A), pre, globalz, prej, zr); -} - -static void secp256k1_ecmult_odd_multiples_table_storage_var(int n, secp256k1_ge_storage *pre, const secp256k1_gej *a, const secp256k1_callback *cb) { - secp256k1_gej *prej = (secp256k1_gej*)checked_malloc(cb, sizeof(secp256k1_gej) * n); - secp256k1_ge *prea = (secp256k1_ge*)checked_malloc(cb, sizeof(secp256k1_ge) * n); - secp256k1_fe *zr = (secp256k1_fe*)checked_malloc(cb, sizeof(secp256k1_fe) * n); - int i; - - /* Compute the odd multiples in Jacobian form. */ - secp256k1_ecmult_odd_multiples_table(n, prej, zr, a); - /* Convert them in batch to affine coordinates. */ - secp256k1_ge_set_table_gej_var(prea, prej, zr, n); - /* Convert them to compact storage form. */ - for (i = 0; i < n; i++) { - secp256k1_ge_to_storage(&pre[i], &prea[i]); - } - - free(prea); - free(prej); - free(zr); -} - -/** The following two macro retrieves a particular odd multiple from a table - * of precomputed multiples. */ -#define ECMULT_TABLE_GET_GE(r,pre,n,w) do { \ - VERIFY_CHECK(((n) & 1) == 1); \ - VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \ - VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \ - if ((n) > 0) { \ - *(r) = (pre)[((n)-1)/2]; \ - } else { \ - secp256k1_ge_neg((r), &(pre)[(-(n)-1)/2]); \ - } \ -} while(0) - -#define ECMULT_TABLE_GET_GE_STORAGE(r,pre,n,w) do { \ - VERIFY_CHECK(((n) & 1) == 1); \ - VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \ - VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \ - if ((n) > 0) { \ - secp256k1_ge_from_storage((r), &(pre)[((n)-1)/2]); \ - } else { \ - secp256k1_ge_from_storage((r), &(pre)[(-(n)-1)/2]); \ - secp256k1_ge_neg((r), (r)); \ - } \ -} while(0) - -static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx) { - ctx->pre_g = NULL; -#ifdef USE_ENDOMORPHISM - ctx->pre_g_128 = NULL; -#endif -} - -static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb) { - secp256k1_gej gj; - - if (ctx->pre_g != NULL) { - return; - } - - /* get the generator */ - secp256k1_gej_set_ge(&gj, &secp256k1_ge_const_g); - - ctx->pre_g = (secp256k1_ge_storage (*)[])checked_malloc(cb, sizeof((*ctx->pre_g)[0]) * ECMULT_TABLE_SIZE(WINDOW_G)); - - /* precompute the tables with odd multiples */ - secp256k1_ecmult_odd_multiples_table_storage_var(ECMULT_TABLE_SIZE(WINDOW_G), *ctx->pre_g, &gj, cb); - -#ifdef USE_ENDOMORPHISM - { - secp256k1_gej g_128j; - int i; - - ctx->pre_g_128 = (secp256k1_ge_storage (*)[])checked_malloc(cb, sizeof((*ctx->pre_g_128)[0]) * ECMULT_TABLE_SIZE(WINDOW_G)); - - /* calculate 2^128*generator */ - g_128j = gj; - for (i = 0; i < 128; i++) { - secp256k1_gej_double_var(&g_128j, &g_128j, NULL); - } - secp256k1_ecmult_odd_multiples_table_storage_var(ECMULT_TABLE_SIZE(WINDOW_G), *ctx->pre_g_128, &g_128j, cb); - } -#endif -} - -static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, - const secp256k1_ecmult_context *src, const secp256k1_callback *cb) { - if (src->pre_g == NULL) { - dst->pre_g = NULL; - } else { - size_t size = sizeof((*dst->pre_g)[0]) * ECMULT_TABLE_SIZE(WINDOW_G); - dst->pre_g = (secp256k1_ge_storage (*)[])checked_malloc(cb, size); - memcpy(dst->pre_g, src->pre_g, size); - } -#ifdef USE_ENDOMORPHISM - if (src->pre_g_128 == NULL) { - dst->pre_g_128 = NULL; - } else { - size_t size = sizeof((*dst->pre_g_128)[0]) * ECMULT_TABLE_SIZE(WINDOW_G); - dst->pre_g_128 = (secp256k1_ge_storage (*)[])checked_malloc(cb, size); - memcpy(dst->pre_g_128, src->pre_g_128, size); - } -#endif -} - -static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx) { - return ctx->pre_g != NULL; -} - -static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx) { - free(ctx->pre_g); -#ifdef USE_ENDOMORPHISM - free(ctx->pre_g_128); -#endif - secp256k1_ecmult_context_init(ctx); -} - -/** Convert a number to WNAF notation. The number becomes represented by sum(2^i * wnaf[i], i=0..bits), - * with the following guarantees: - * - each wnaf[i] is either 0, or an odd integer between -(1<<(w-1) - 1) and (1<<(w-1) - 1) - * - two non-zero entries in wnaf are separated by at least w-1 zeroes. - * - the number of set values in wnaf is returned. This number is at most 256, and at most one more - * than the number of bits in the (absolute value) of the input. - */ -static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a, int w) { - secp256k1_scalar s = *a; - int last_set_bit = -1; - int bit = 0; - int sign = 1; - int carry = 0; - - VERIFY_CHECK(wnaf != NULL); - VERIFY_CHECK(0 <= len && len <= 256); - VERIFY_CHECK(a != NULL); - VERIFY_CHECK(2 <= w && w <= 31); - - memset(wnaf, 0, len * sizeof(wnaf[0])); - - if (secp256k1_scalar_get_bits(&s, 255, 1)) { - secp256k1_scalar_negate(&s, &s); - sign = -1; - } - - while (bit < len) { - int now; - int word; - if (secp256k1_scalar_get_bits(&s, bit, 1) == (unsigned int)carry) { - bit++; - continue; - } - - now = w; - if (now > len - bit) { - now = len - bit; - } - - word = secp256k1_scalar_get_bits_var(&s, bit, now) + carry; - - carry = (word >> (w-1)) & 1; - word -= carry << w; - - wnaf[bit] = sign * word; - last_set_bit = bit; - - bit += now; - } -#ifdef VERIFY - CHECK(carry == 0); - while (bit < 256) { - CHECK(secp256k1_scalar_get_bits(&s, bit++, 1) == 0); - } -#endif - return last_set_bit + 1; -} - -static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) { - secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_ge tmpa; - secp256k1_fe Z; -#ifdef USE_ENDOMORPHISM - secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_scalar na_1, na_lam; - /* Splitted G factors. */ - secp256k1_scalar ng_1, ng_128; - int wnaf_na_1[130]; - int wnaf_na_lam[130]; - int bits_na_1; - int bits_na_lam; - int wnaf_ng_1[129]; - int bits_ng_1; - int wnaf_ng_128[129]; - int bits_ng_128; -#else - int wnaf_na[256]; - int bits_na; - int wnaf_ng[256]; - int bits_ng; -#endif - int i; - int bits; - -#ifdef USE_ENDOMORPHISM - /* split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit) */ - secp256k1_scalar_split_lambda(&na_1, &na_lam, na); - - /* build wnaf representation for na_1 and na_lam. */ - bits_na_1 = secp256k1_ecmult_wnaf(wnaf_na_1, 130, &na_1, WINDOW_A); - bits_na_lam = secp256k1_ecmult_wnaf(wnaf_na_lam, 130, &na_lam, WINDOW_A); - VERIFY_CHECK(bits_na_1 <= 130); - VERIFY_CHECK(bits_na_lam <= 130); - bits = bits_na_1; - if (bits_na_lam > bits) { - bits = bits_na_lam; - } -#else - /* build wnaf representation for na. */ - bits_na = secp256k1_ecmult_wnaf(wnaf_na, 256, na, WINDOW_A); - bits = bits_na; -#endif - - /* Calculate odd multiples of a. - * All multiples are brought to the same Z 'denominator', which is stored - * in Z. Due to secp256k1' isomorphism we can do all operations pretending - * that the Z coordinate was 1, use affine addition formulae, and correct - * the Z coordinate of the result once at the end. - * The exception is the precomputed G table points, which are actually - * affine. Compared to the base used for other points, they have a Z ratio - * of 1/Z, so we can use secp256k1_gej_add_zinv_var, which uses the same - * isomorphism to efficiently add with a known Z inverse. - */ - secp256k1_ecmult_odd_multiples_table_globalz_windowa(pre_a, &Z, a); - -#ifdef USE_ENDOMORPHISM - for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) { - secp256k1_ge_mul_lambda(&pre_a_lam[i], &pre_a[i]); - } - - /* split ng into ng_1 and ng_128 (where gn = gn_1 + gn_128*2^128, and gn_1 and gn_128 are ~128 bit) */ - secp256k1_scalar_split_128(&ng_1, &ng_128, ng); - - /* Build wnaf representation for ng_1 and ng_128 */ - bits_ng_1 = secp256k1_ecmult_wnaf(wnaf_ng_1, 129, &ng_1, WINDOW_G); - bits_ng_128 = secp256k1_ecmult_wnaf(wnaf_ng_128, 129, &ng_128, WINDOW_G); - if (bits_ng_1 > bits) { - bits = bits_ng_1; - } - if (bits_ng_128 > bits) { - bits = bits_ng_128; - } -#else - bits_ng = secp256k1_ecmult_wnaf(wnaf_ng, 256, ng, WINDOW_G); - if (bits_ng > bits) { - bits = bits_ng; - } -#endif - - secp256k1_gej_set_infinity(r); - - for (i = bits - 1; i >= 0; i--) { - int n; - secp256k1_gej_double_var(r, r, NULL); -#ifdef USE_ENDOMORPHISM - if (i < bits_na_1 && (n = wnaf_na_1[i])) { - ECMULT_TABLE_GET_GE(&tmpa, pre_a, n, WINDOW_A); - secp256k1_gej_add_ge_var(r, r, &tmpa, NULL); - } - if (i < bits_na_lam && (n = wnaf_na_lam[i])) { - ECMULT_TABLE_GET_GE(&tmpa, pre_a_lam, n, WINDOW_A); - secp256k1_gej_add_ge_var(r, r, &tmpa, NULL); - } - if (i < bits_ng_1 && (n = wnaf_ng_1[i])) { - ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g, n, WINDOW_G); - secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z); - } - if (i < bits_ng_128 && (n = wnaf_ng_128[i])) { - ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g_128, n, WINDOW_G); - secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z); - } -#else - if (i < bits_na && (n = wnaf_na[i])) { - ECMULT_TABLE_GET_GE(&tmpa, pre_a, n, WINDOW_A); - secp256k1_gej_add_ge_var(r, r, &tmpa, NULL); - } - if (i < bits_ng && (n = wnaf_ng[i])) { - ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g, n, WINDOW_G); - secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z); - } -#endif - } - - if (!r->infinity) { - secp256k1_fe_mul(&r->z, &r->z, &Z); - } -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h deleted file mode 100644 index bbb1ee86..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h +++ /dev/null @@ -1,132 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_ -#define _SECP256K1_FIELD_ - -/** Field element module. - * - * Field elements can be represented in several ways, but code accessing - * it (and implementations) need to take certain properties into account: - * - Each field element can be normalized or not. - * - Each field element has a magnitude, which represents how far away - * its representation is away from normalization. Normalized elements - * always have a magnitude of 1, but a magnitude of 1 doesn't imply - * normality. - */ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(USE_FIELD_10X26) -#include "field_10x26.h" -#elif defined(USE_FIELD_5X52) -#include "field_5x52.h" -#else -#error "Please select field implementation" -#endif - -#include "util.h" - -/** Normalize a field element. */ -static void secp256k1_fe_normalize(secp256k1_fe *r); - -/** Weakly normalize a field element: reduce it magnitude to 1, but don't fully normalize. */ -static void secp256k1_fe_normalize_weak(secp256k1_fe *r); - -/** Normalize a field element, without constant-time guarantee. */ -static void secp256k1_fe_normalize_var(secp256k1_fe *r); - -/** Verify whether a field element represents zero i.e. would normalize to a zero value. The field - * implementation may optionally normalize the input, but this should not be relied upon. */ -static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r); - -/** Verify whether a field element represents zero i.e. would normalize to a zero value. The field - * implementation may optionally normalize the input, but this should not be relied upon. */ -static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r); - -/** Set a field element equal to a small integer. Resulting field element is normalized. */ -static void secp256k1_fe_set_int(secp256k1_fe *r, int a); - -/** Sets a field element equal to zero, initializing all fields. */ -static void secp256k1_fe_clear(secp256k1_fe *a); - -/** Verify whether a field element is zero. Requires the input to be normalized. */ -static int secp256k1_fe_is_zero(const secp256k1_fe *a); - -/** Check the "oddness" of a field element. Requires the input to be normalized. */ -static int secp256k1_fe_is_odd(const secp256k1_fe *a); - -/** Compare two field elements. Requires magnitude-1 inputs. */ -static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b); - -/** Same as secp256k1_fe_equal, but may be variable time. */ -static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b); - -/** Compare two field elements. Requires both inputs to be normalized */ -static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b); - -/** Set a field element equal to 32-byte big endian value. If successful, the resulting field element is normalized. */ -static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a); - -/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */ -static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a); - -/** Set a field element equal to the additive inverse of another. Takes a maximum magnitude of the input - * as an argument. The magnitude of the output is one higher. */ -static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m); - -/** Multiplies the passed field element with a small integer constant. Multiplies the magnitude by that - * small integer. */ -static void secp256k1_fe_mul_int(secp256k1_fe *r, int a); - -/** Adds a field element to another. The result has the sum of the inputs' magnitudes as magnitude. */ -static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a); - -/** Sets a field element to be the product of two others. Requires the inputs' magnitudes to be at most 8. - * The output magnitude is 1 (but not guaranteed to be normalized). */ -static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b); - -/** Sets a field element to be the square of another. Requires the input's magnitude to be at most 8. - * The output magnitude is 1 (but not guaranteed to be normalized). */ -static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a); - -/** If a has a square root, it is computed in r and 1 is returned. If a does not - * have a square root, the root of its negation is computed and 0 is returned. - * The input's magnitude can be at most 8. The output magnitude is 1 (but not - * guaranteed to be normalized). The result in r will always be a square - * itself. */ -static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a); - -/** Checks whether a field element is a quadratic residue. */ -static int secp256k1_fe_is_quad_var(const secp256k1_fe *a); - -/** Sets a field element to be the (modular) inverse of another. Requires the input's magnitude to be - * at most 8. The output magnitude is 1 (but not guaranteed to be normalized). */ -static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a); - -/** Potentially faster version of secp256k1_fe_inv, without constant-time guarantee. */ -static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a); - -/** Calculate the (modular) inverses of a batch of field elements. Requires the inputs' magnitudes to be - * at most 8. The output magnitudes are 1 (but not guaranteed to be normalized). The inputs and - * outputs must not overlap in memory. */ -static void secp256k1_fe_inv_all_var(secp256k1_fe *r, const secp256k1_fe *a, size_t len); - -/** Convert a field element to the storage type. */ -static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a); - -/** Convert a field element back from the storage type. */ -static void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a); - -/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. */ -static void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag); - -/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. */ -static void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h deleted file mode 100644 index 61ee1e09..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h +++ /dev/null @@ -1,47 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_ -#define _SECP256K1_FIELD_REPR_ - -#include - -typedef struct { - /* X = sum(i=0..9, elem[i]*2^26) mod n */ - uint32_t n[10]; -#ifdef VERIFY - int magnitude; - int normalized; -#endif -} secp256k1_fe; - -/* Unpacks a constant into a overlapping multi-limbed FE element. */ -#define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \ - (d0) & 0x3FFFFFFUL, \ - (((uint32_t)d0) >> 26) | (((uint32_t)(d1) & 0xFFFFFUL) << 6), \ - (((uint32_t)d1) >> 20) | (((uint32_t)(d2) & 0x3FFFUL) << 12), \ - (((uint32_t)d2) >> 14) | (((uint32_t)(d3) & 0xFFUL) << 18), \ - (((uint32_t)d3) >> 8) | (((uint32_t)(d4) & 0x3UL) << 24), \ - (((uint32_t)d4) >> 2) & 0x3FFFFFFUL, \ - (((uint32_t)d4) >> 28) | (((uint32_t)(d5) & 0x3FFFFFUL) << 4), \ - (((uint32_t)d5) >> 22) | (((uint32_t)(d6) & 0xFFFFUL) << 10), \ - (((uint32_t)d6) >> 16) | (((uint32_t)(d7) & 0x3FFUL) << 16), \ - (((uint32_t)d7) >> 10) \ -} - -#ifdef VERIFY -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1} -#else -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))} -#endif - -typedef struct { - uint32_t n[8]; -} secp256k1_fe_storage; - -#define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }} -#define SECP256K1_FE_STORAGE_CONST_GET(d) d.n[7], d.n[6], d.n[5], d.n[4],d.n[3], d.n[2], d.n[1], d.n[0] -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h deleted file mode 100644 index 5fb092f1..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h +++ /dev/null @@ -1,1140 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_IMPL_H_ -#define _SECP256K1_FIELD_REPR_IMPL_H_ - -#include "util.h" -#include "num.h" -#include "field.h" - -#ifdef VERIFY -static void secp256k1_fe_verify(const secp256k1_fe *a) { - const uint32_t *d = a->n; - int m = a->normalized ? 1 : 2 * a->magnitude, r = 1; - r &= (d[0] <= 0x3FFFFFFUL * m); - r &= (d[1] <= 0x3FFFFFFUL * m); - r &= (d[2] <= 0x3FFFFFFUL * m); - r &= (d[3] <= 0x3FFFFFFUL * m); - r &= (d[4] <= 0x3FFFFFFUL * m); - r &= (d[5] <= 0x3FFFFFFUL * m); - r &= (d[6] <= 0x3FFFFFFUL * m); - r &= (d[7] <= 0x3FFFFFFUL * m); - r &= (d[8] <= 0x3FFFFFFUL * m); - r &= (d[9] <= 0x03FFFFFUL * m); - r &= (a->magnitude >= 0); - r &= (a->magnitude <= 32); - if (a->normalized) { - r &= (a->magnitude <= 1); - if (r && (d[9] == 0x03FFFFFUL)) { - uint32_t mid = d[8] & d[7] & d[6] & d[5] & d[4] & d[3] & d[2]; - if (mid == 0x3FFFFFFUL) { - r &= ((d[1] + 0x40UL + ((d[0] + 0x3D1UL) >> 26)) <= 0x3FFFFFFUL); - } - } - } - VERIFY_CHECK(r == 1); -} -#endif - -static void secp256k1_fe_normalize(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t m; - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; m = t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; m &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; m &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; m &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; m &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; m &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; m &= t8; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t9 >> 22) | ((t9 == 0x03FFFFFUL) & (m == 0x3FFFFFFUL) - & ((t1 + 0x40UL + ((t0 + 0x3D1UL) >> 26)) > 0x3FFFFFFUL)); - - /* Apply the final reduction (for constant-time behaviour, we do it always) */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; - - /* If t9 didn't carry to bit 22 already, then it should have after any final reduction */ - VERIFY_CHECK(t9 >> 22 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t9 &= 0x03FFFFFUL; - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_weak(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9; - -#ifdef VERIFY - r->magnitude = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_var(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t m; - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; m = t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; m &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; m &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; m &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; m &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; m &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; m &= t8; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t9 >> 22) | ((t9 == 0x03FFFFFUL) & (m == 0x3FFFFFFUL) - & ((t1 + 0x40UL + ((t0 + 0x3D1UL) >> 26)) > 0x3FFFFFFUL)); - - if (x) { - t0 += 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; - - /* If t9 didn't carry to bit 22 already, then it should have after any final reduction */ - VERIFY_CHECK(t9 >> 22 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t9 &= 0x03FFFFFUL; - } - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - uint32_t z0, z1; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; z0 = t0; z1 = t0 ^ 0x3D0UL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; z0 |= t1; z1 &= t1 ^ 0x40UL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; z0 |= t3; z1 &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; z0 |= t4; z1 &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; z0 |= t5; z1 &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; z0 |= t6; z1 &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; z0 |= t7; z1 &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; z0 |= t8; z1 &= t8; - z0 |= t9; z1 &= t9 ^ 0x3C00000UL; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - return (z0 == 0) | (z1 == 0x3FFFFFFUL); -} - -static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r) { - uint32_t t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; - uint32_t z0, z1; - uint32_t x; - - t0 = r->n[0]; - t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - x = t9 >> 22; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - z0 = t0 & 0x3FFFFFFUL; - z1 = z0 ^ 0x3D0UL; - - /* Fast return path should catch the majority of cases */ - if ((z0 != 0UL) & (z1 != 0x3FFFFFFUL)) { - return 0; - } - - t1 = r->n[1]; - t2 = r->n[2]; - t3 = r->n[3]; - t4 = r->n[4]; - t5 = r->n[5]; - t6 = r->n[6]; - t7 = r->n[7]; - t8 = r->n[8]; - - t9 &= 0x03FFFFFUL; - t1 += (x << 6); - - t1 += (t0 >> 26); - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; z0 |= t1; z1 &= t1 ^ 0x40UL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; z0 |= t3; z1 &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; z0 |= t4; z1 &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; z0 |= t5; z1 &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; z0 |= t6; z1 &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; z0 |= t7; z1 &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; z0 |= t8; z1 &= t8; - z0 |= t9; z1 &= t9 ^ 0x3C00000UL; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - return (z0 == 0) | (z1 == 0x3FFFFFFUL); -} - -SECP256K1_INLINE static void secp256k1_fe_set_int(secp256k1_fe *r, int a) { - r->n[0] = a; - r->n[1] = r->n[2] = r->n[3] = r->n[4] = r->n[5] = r->n[6] = r->n[7] = r->n[8] = r->n[9] = 0; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static int secp256k1_fe_is_zero(const secp256k1_fe *a) { - const uint32_t *t = a->n; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return (t[0] | t[1] | t[2] | t[3] | t[4] | t[5] | t[6] | t[7] | t[8] | t[9]) == 0; -} - -SECP256K1_INLINE static int secp256k1_fe_is_odd(const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return a->n[0] & 1; -} - -SECP256K1_INLINE static void secp256k1_fe_clear(secp256k1_fe *a) { - int i; -#ifdef VERIFY - a->magnitude = 0; - a->normalized = 1; -#endif - for (i=0; i<10; i++) { - a->n[i] = 0; - } -} - -static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - VERIFY_CHECK(b->normalized); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); -#endif - for (i = 9; i >= 0; i--) { - if (a->n[i] > b->n[i]) { - return 1; - } - if (a->n[i] < b->n[i]) { - return -1; - } - } - return 0; -} - -static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a) { - int i; - r->n[0] = r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0; - r->n[5] = r->n[6] = r->n[7] = r->n[8] = r->n[9] = 0; - for (i=0; i<32; i++) { - int j; - for (j=0; j<4; j++) { - int limb = (8*i+2*j)/26; - int shift = (8*i+2*j)%26; - r->n[limb] |= (uint32_t)((a[31-i] >> (2*j)) & 0x3) << shift; - } - } - if (r->n[9] == 0x3FFFFFUL && (r->n[8] & r->n[7] & r->n[6] & r->n[5] & r->n[4] & r->n[3] & r->n[2]) == 0x3FFFFFFUL && (r->n[1] + 0x40UL + ((r->n[0] + 0x3D1UL) >> 26)) > 0x3FFFFFFUL) { - return 0; - } -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif - return 1; -} - -/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */ -static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - for (i=0; i<32; i++) { - int j; - int c = 0; - for (j=0; j<4; j++) { - int limb = (8*i+2*j)/26; - int shift = (8*i+2*j)%26; - c |= ((a->n[limb] >> shift) & 0x3) << (2 * j); - } - r[31-i] = c; - } -} - -SECP256K1_INLINE static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= m); - secp256k1_fe_verify(a); -#endif - r->n[0] = 0x3FFFC2FUL * 2 * (m + 1) - a->n[0]; - r->n[1] = 0x3FFFFBFUL * 2 * (m + 1) - a->n[1]; - r->n[2] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[2]; - r->n[3] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[3]; - r->n[4] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[4]; - r->n[5] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[5]; - r->n[6] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[6]; - r->n[7] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[7]; - r->n[8] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[8]; - r->n[9] = 0x03FFFFFUL * 2 * (m + 1) - a->n[9]; -#ifdef VERIFY - r->magnitude = m + 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_mul_int(secp256k1_fe *r, int a) { - r->n[0] *= a; - r->n[1] *= a; - r->n[2] *= a; - r->n[3] *= a; - r->n[4] *= a; - r->n[5] *= a; - r->n[6] *= a; - r->n[7] *= a; - r->n[8] *= a; - r->n[9] *= a; -#ifdef VERIFY - r->magnitude *= a; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - secp256k1_fe_verify(a); -#endif - r->n[0] += a->n[0]; - r->n[1] += a->n[1]; - r->n[2] += a->n[2]; - r->n[3] += a->n[3]; - r->n[4] += a->n[4]; - r->n[5] += a->n[5]; - r->n[6] += a->n[6]; - r->n[7] += a->n[7]; - r->n[8] += a->n[8]; - r->n[9] += a->n[9]; -#ifdef VERIFY - r->magnitude += a->magnitude; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -#if defined(USE_EXTERNAL_ASM) - -/* External assembler implementation */ -void secp256k1_fe_mul_inner(uint32_t *r, const uint32_t *a, const uint32_t * SECP256K1_RESTRICT b); -void secp256k1_fe_sqr_inner(uint32_t *r, const uint32_t *a); - -#else - -#ifdef VERIFY -#define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0) -#else -#define VERIFY_BITS(x, n) do { } while(0) -#endif - -SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint32_t *r, const uint32_t *a, const uint32_t * SECP256K1_RESTRICT b) { - uint64_t c, d; - uint64_t u0, u1, u2, u3, u4, u5, u6, u7, u8; - uint32_t t9, t1, t0, t2, t3, t4, t5, t6, t7; - const uint32_t M = 0x3FFFFFFUL, R0 = 0x3D10UL, R1 = 0x400UL; - - VERIFY_BITS(a[0], 30); - VERIFY_BITS(a[1], 30); - VERIFY_BITS(a[2], 30); - VERIFY_BITS(a[3], 30); - VERIFY_BITS(a[4], 30); - VERIFY_BITS(a[5], 30); - VERIFY_BITS(a[6], 30); - VERIFY_BITS(a[7], 30); - VERIFY_BITS(a[8], 30); - VERIFY_BITS(a[9], 26); - VERIFY_BITS(b[0], 30); - VERIFY_BITS(b[1], 30); - VERIFY_BITS(b[2], 30); - VERIFY_BITS(b[3], 30); - VERIFY_BITS(b[4], 30); - VERIFY_BITS(b[5], 30); - VERIFY_BITS(b[6], 30); - VERIFY_BITS(b[7], 30); - VERIFY_BITS(b[8], 30); - VERIFY_BITS(b[9], 26); - - /** [... a b c] is a shorthand for ... + a<<52 + b<<26 + c<<0 mod n. - * px is a shorthand for sum(a[i]*b[x-i], i=0..x). - * Note that [x 0 0 0 0 0 0 0 0 0 0] = [x*R1 x*R0]. - */ - - d = (uint64_t)a[0] * b[9] - + (uint64_t)a[1] * b[8] - + (uint64_t)a[2] * b[7] - + (uint64_t)a[3] * b[6] - + (uint64_t)a[4] * b[5] - + (uint64_t)a[5] * b[4] - + (uint64_t)a[6] * b[3] - + (uint64_t)a[7] * b[2] - + (uint64_t)a[8] * b[1] - + (uint64_t)a[9] * b[0]; - /* VERIFY_BITS(d, 64); */ - /* [d 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - t9 = d & M; d >>= 26; - VERIFY_BITS(t9, 26); - VERIFY_BITS(d, 38); - /* [d t9 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - - c = (uint64_t)a[0] * b[0]; - VERIFY_BITS(c, 60); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p9 0 0 0 0 0 0 0 0 p0] */ - d += (uint64_t)a[1] * b[9] - + (uint64_t)a[2] * b[8] - + (uint64_t)a[3] * b[7] - + (uint64_t)a[4] * b[6] - + (uint64_t)a[5] * b[5] - + (uint64_t)a[6] * b[4] - + (uint64_t)a[7] * b[3] - + (uint64_t)a[8] * b[2] - + (uint64_t)a[9] * b[1]; - VERIFY_BITS(d, 63); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - u0 = d & M; d >>= 26; c += u0 * R0; - VERIFY_BITS(u0, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 61); - /* [d u0 t9 0 0 0 0 0 0 0 0 c-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - t0 = c & M; c >>= 26; c += u0 * R1; - VERIFY_BITS(t0, 26); - VERIFY_BITS(c, 37); - /* [d u0 t9 0 0 0 0 0 0 0 c-u0*R1 t0-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - - c += (uint64_t)a[0] * b[1] - + (uint64_t)a[1] * b[0]; - VERIFY_BITS(c, 62); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 p1 p0] */ - d += (uint64_t)a[2] * b[9] - + (uint64_t)a[3] * b[8] - + (uint64_t)a[4] * b[7] - + (uint64_t)a[5] * b[6] - + (uint64_t)a[6] * b[5] - + (uint64_t)a[7] * b[4] - + (uint64_t)a[8] * b[3] - + (uint64_t)a[9] * b[2]; - VERIFY_BITS(d, 63); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - u1 = d & M; d >>= 26; c += u1 * R0; - VERIFY_BITS(u1, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u1 0 t9 0 0 0 0 0 0 0 c-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - t1 = c & M; c >>= 26; c += u1 * R1; - VERIFY_BITS(t1, 26); - VERIFY_BITS(c, 38); - /* [d u1 0 t9 0 0 0 0 0 0 c-u1*R1 t1-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - - c += (uint64_t)a[0] * b[2] - + (uint64_t)a[1] * b[1] - + (uint64_t)a[2] * b[0]; - VERIFY_BITS(c, 62); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - d += (uint64_t)a[3] * b[9] - + (uint64_t)a[4] * b[8] - + (uint64_t)a[5] * b[7] - + (uint64_t)a[6] * b[6] - + (uint64_t)a[7] * b[5] - + (uint64_t)a[8] * b[4] - + (uint64_t)a[9] * b[3]; - VERIFY_BITS(d, 63); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - u2 = d & M; d >>= 26; c += u2 * R0; - VERIFY_BITS(u2, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u2 0 0 t9 0 0 0 0 0 0 c-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - t2 = c & M; c >>= 26; c += u2 * R1; - VERIFY_BITS(t2, 26); - VERIFY_BITS(c, 38); - /* [d u2 0 0 t9 0 0 0 0 0 c-u2*R1 t2-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[3] - + (uint64_t)a[1] * b[2] - + (uint64_t)a[2] * b[1] - + (uint64_t)a[3] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - d += (uint64_t)a[4] * b[9] - + (uint64_t)a[5] * b[8] - + (uint64_t)a[6] * b[7] - + (uint64_t)a[7] * b[6] - + (uint64_t)a[8] * b[5] - + (uint64_t)a[9] * b[4]; - VERIFY_BITS(d, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - u3 = d & M; d >>= 26; c += u3 * R0; - VERIFY_BITS(u3, 26); - VERIFY_BITS(d, 37); - /* VERIFY_BITS(c, 64); */ - /* [d u3 0 0 0 t9 0 0 0 0 0 c-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - t3 = c & M; c >>= 26; c += u3 * R1; - VERIFY_BITS(t3, 26); - VERIFY_BITS(c, 39); - /* [d u3 0 0 0 t9 0 0 0 0 c-u3*R1 t3-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[4] - + (uint64_t)a[1] * b[3] - + (uint64_t)a[2] * b[2] - + (uint64_t)a[3] * b[1] - + (uint64_t)a[4] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[5] * b[9] - + (uint64_t)a[6] * b[8] - + (uint64_t)a[7] * b[7] - + (uint64_t)a[8] * b[6] - + (uint64_t)a[9] * b[5]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - u4 = d & M; d >>= 26; c += u4 * R0; - VERIFY_BITS(u4, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u4 0 0 0 0 t9 0 0 0 0 c-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - t4 = c & M; c >>= 26; c += u4 * R1; - VERIFY_BITS(t4, 26); - VERIFY_BITS(c, 39); - /* [d u4 0 0 0 0 t9 0 0 0 c-u4*R1 t4-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[5] - + (uint64_t)a[1] * b[4] - + (uint64_t)a[2] * b[3] - + (uint64_t)a[3] * b[2] - + (uint64_t)a[4] * b[1] - + (uint64_t)a[5] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[6] * b[9] - + (uint64_t)a[7] * b[8] - + (uint64_t)a[8] * b[7] - + (uint64_t)a[9] * b[6]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - u5 = d & M; d >>= 26; c += u5 * R0; - VERIFY_BITS(u5, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u5 0 0 0 0 0 t9 0 0 0 c-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - t5 = c & M; c >>= 26; c += u5 * R1; - VERIFY_BITS(t5, 26); - VERIFY_BITS(c, 39); - /* [d u5 0 0 0 0 0 t9 0 0 c-u5*R1 t5-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[6] - + (uint64_t)a[1] * b[5] - + (uint64_t)a[2] * b[4] - + (uint64_t)a[3] * b[3] - + (uint64_t)a[4] * b[2] - + (uint64_t)a[5] * b[1] - + (uint64_t)a[6] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[7] * b[9] - + (uint64_t)a[8] * b[8] - + (uint64_t)a[9] * b[7]; - VERIFY_BITS(d, 61); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - u6 = d & M; d >>= 26; c += u6 * R0; - VERIFY_BITS(u6, 26); - VERIFY_BITS(d, 35); - /* VERIFY_BITS(c, 64); */ - /* [d u6 0 0 0 0 0 0 t9 0 0 c-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - t6 = c & M; c >>= 26; c += u6 * R1; - VERIFY_BITS(t6, 26); - VERIFY_BITS(c, 39); - /* [d u6 0 0 0 0 0 0 t9 0 c-u6*R1 t6-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[7] - + (uint64_t)a[1] * b[6] - + (uint64_t)a[2] * b[5] - + (uint64_t)a[3] * b[4] - + (uint64_t)a[4] * b[3] - + (uint64_t)a[5] * b[2] - + (uint64_t)a[6] * b[1] - + (uint64_t)a[7] * b[0]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x8000007C00000007ULL); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[8] * b[9] - + (uint64_t)a[9] * b[8]; - VERIFY_BITS(d, 58); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - u7 = d & M; d >>= 26; c += u7 * R0; - VERIFY_BITS(u7, 26); - VERIFY_BITS(d, 32); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x800001703FFFC2F7ULL); - /* [d u7 0 0 0 0 0 0 0 t9 0 c-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - t7 = c & M; c >>= 26; c += u7 * R1; - VERIFY_BITS(t7, 26); - VERIFY_BITS(c, 38); - /* [d u7 0 0 0 0 0 0 0 t9 c-u7*R1 t7-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[8] - + (uint64_t)a[1] * b[7] - + (uint64_t)a[2] * b[6] - + (uint64_t)a[3] * b[5] - + (uint64_t)a[4] * b[4] - + (uint64_t)a[5] * b[3] - + (uint64_t)a[6] * b[2] - + (uint64_t)a[7] * b[1] - + (uint64_t)a[8] * b[0]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000007B80000008ULL); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[9] * b[9]; - VERIFY_BITS(d, 57); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - u8 = d & M; d >>= 26; c += u8 * R0; - VERIFY_BITS(u8, 26); - VERIFY_BITS(d, 31); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000016FBFFFC2F8ULL); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[3] = t3; - VERIFY_BITS(r[3], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = t4; - VERIFY_BITS(r[4], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[5] = t5; - VERIFY_BITS(r[5], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[6] = t6; - VERIFY_BITS(r[6], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[7] = t7; - VERIFY_BITS(r[7], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[8] = c & M; c >>= 26; c += u8 * R1; - VERIFY_BITS(r[8], 26); - VERIFY_BITS(c, 39); - /* [d u8 0 0 0 0 0 0 0 0 t9+c-u8*R1 r8-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 0 t9+c r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += d * R0 + t9; - VERIFY_BITS(c, 45); - /* [d 0 0 0 0 0 0 0 0 0 c-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[9] = c & (M >> 4); c >>= 22; c += d * (R1 << 4); - VERIFY_BITS(r[9], 22); - VERIFY_BITS(c, 46); - /* [d 0 0 0 0 0 0 0 0 r9+((c-d*R1<<4)<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 -d*R1 r9+(c<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - d = c * (R0 >> 4) + t0; - VERIFY_BITS(d, 56); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 d-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[0] = d & M; d >>= 26; - VERIFY_BITS(r[0], 26); - VERIFY_BITS(d, 30); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1+d r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += c * (R1 >> 4) + t1; - VERIFY_BITS(d, 53); - VERIFY_CHECK(d <= 0x10000003FFFFBFULL); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 d-c*R1>>4 r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9 r8 r7 r6 r5 r4 r3 t2 d r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[1] = d & M; d >>= 26; - VERIFY_BITS(r[1], 26); - VERIFY_BITS(d, 27); - VERIFY_CHECK(d <= 0x4000000ULL); - /* [r9 r8 r7 r6 r5 r4 r3 t2+d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += t2; - VERIFY_BITS(d, 27); - /* [r9 r8 r7 r6 r5 r4 r3 d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = d; - VERIFY_BITS(r[2], 27); - /* [r9 r8 r7 r6 r5 r4 r3 r2 r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} - -SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint32_t *r, const uint32_t *a) { - uint64_t c, d; - uint64_t u0, u1, u2, u3, u4, u5, u6, u7, u8; - uint32_t t9, t0, t1, t2, t3, t4, t5, t6, t7; - const uint32_t M = 0x3FFFFFFUL, R0 = 0x3D10UL, R1 = 0x400UL; - - VERIFY_BITS(a[0], 30); - VERIFY_BITS(a[1], 30); - VERIFY_BITS(a[2], 30); - VERIFY_BITS(a[3], 30); - VERIFY_BITS(a[4], 30); - VERIFY_BITS(a[5], 30); - VERIFY_BITS(a[6], 30); - VERIFY_BITS(a[7], 30); - VERIFY_BITS(a[8], 30); - VERIFY_BITS(a[9], 26); - - /** [... a b c] is a shorthand for ... + a<<52 + b<<26 + c<<0 mod n. - * px is a shorthand for sum(a[i]*a[x-i], i=0..x). - * Note that [x 0 0 0 0 0 0 0 0 0 0] = [x*R1 x*R0]. - */ - - d = (uint64_t)(a[0]*2) * a[9] - + (uint64_t)(a[1]*2) * a[8] - + (uint64_t)(a[2]*2) * a[7] - + (uint64_t)(a[3]*2) * a[6] - + (uint64_t)(a[4]*2) * a[5]; - /* VERIFY_BITS(d, 64); */ - /* [d 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - t9 = d & M; d >>= 26; - VERIFY_BITS(t9, 26); - VERIFY_BITS(d, 38); - /* [d t9 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - - c = (uint64_t)a[0] * a[0]; - VERIFY_BITS(c, 60); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p9 0 0 0 0 0 0 0 0 p0] */ - d += (uint64_t)(a[1]*2) * a[9] - + (uint64_t)(a[2]*2) * a[8] - + (uint64_t)(a[3]*2) * a[7] - + (uint64_t)(a[4]*2) * a[6] - + (uint64_t)a[5] * a[5]; - VERIFY_BITS(d, 63); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - u0 = d & M; d >>= 26; c += u0 * R0; - VERIFY_BITS(u0, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 61); - /* [d u0 t9 0 0 0 0 0 0 0 0 c-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - t0 = c & M; c >>= 26; c += u0 * R1; - VERIFY_BITS(t0, 26); - VERIFY_BITS(c, 37); - /* [d u0 t9 0 0 0 0 0 0 0 c-u0*R1 t0-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - - c += (uint64_t)(a[0]*2) * a[1]; - VERIFY_BITS(c, 62); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 p1 p0] */ - d += (uint64_t)(a[2]*2) * a[9] - + (uint64_t)(a[3]*2) * a[8] - + (uint64_t)(a[4]*2) * a[7] - + (uint64_t)(a[5]*2) * a[6]; - VERIFY_BITS(d, 63); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - u1 = d & M; d >>= 26; c += u1 * R0; - VERIFY_BITS(u1, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u1 0 t9 0 0 0 0 0 0 0 c-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - t1 = c & M; c >>= 26; c += u1 * R1; - VERIFY_BITS(t1, 26); - VERIFY_BITS(c, 38); - /* [d u1 0 t9 0 0 0 0 0 0 c-u1*R1 t1-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[2] - + (uint64_t)a[1] * a[1]; - VERIFY_BITS(c, 62); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - d += (uint64_t)(a[3]*2) * a[9] - + (uint64_t)(a[4]*2) * a[8] - + (uint64_t)(a[5]*2) * a[7] - + (uint64_t)a[6] * a[6]; - VERIFY_BITS(d, 63); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - u2 = d & M; d >>= 26; c += u2 * R0; - VERIFY_BITS(u2, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u2 0 0 t9 0 0 0 0 0 0 c-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - t2 = c & M; c >>= 26; c += u2 * R1; - VERIFY_BITS(t2, 26); - VERIFY_BITS(c, 38); - /* [d u2 0 0 t9 0 0 0 0 0 c-u2*R1 t2-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[3] - + (uint64_t)(a[1]*2) * a[2]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - d += (uint64_t)(a[4]*2) * a[9] - + (uint64_t)(a[5]*2) * a[8] - + (uint64_t)(a[6]*2) * a[7]; - VERIFY_BITS(d, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - u3 = d & M; d >>= 26; c += u3 * R0; - VERIFY_BITS(u3, 26); - VERIFY_BITS(d, 37); - /* VERIFY_BITS(c, 64); */ - /* [d u3 0 0 0 t9 0 0 0 0 0 c-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - t3 = c & M; c >>= 26; c += u3 * R1; - VERIFY_BITS(t3, 26); - VERIFY_BITS(c, 39); - /* [d u3 0 0 0 t9 0 0 0 0 c-u3*R1 t3-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[4] - + (uint64_t)(a[1]*2) * a[3] - + (uint64_t)a[2] * a[2]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[5]*2) * a[9] - + (uint64_t)(a[6]*2) * a[8] - + (uint64_t)a[7] * a[7]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - u4 = d & M; d >>= 26; c += u4 * R0; - VERIFY_BITS(u4, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u4 0 0 0 0 t9 0 0 0 0 c-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - t4 = c & M; c >>= 26; c += u4 * R1; - VERIFY_BITS(t4, 26); - VERIFY_BITS(c, 39); - /* [d u4 0 0 0 0 t9 0 0 0 c-u4*R1 t4-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[5] - + (uint64_t)(a[1]*2) * a[4] - + (uint64_t)(a[2]*2) * a[3]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[6]*2) * a[9] - + (uint64_t)(a[7]*2) * a[8]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - u5 = d & M; d >>= 26; c += u5 * R0; - VERIFY_BITS(u5, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u5 0 0 0 0 0 t9 0 0 0 c-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - t5 = c & M; c >>= 26; c += u5 * R1; - VERIFY_BITS(t5, 26); - VERIFY_BITS(c, 39); - /* [d u5 0 0 0 0 0 t9 0 0 c-u5*R1 t5-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[6] - + (uint64_t)(a[1]*2) * a[5] - + (uint64_t)(a[2]*2) * a[4] - + (uint64_t)a[3] * a[3]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[7]*2) * a[9] - + (uint64_t)a[8] * a[8]; - VERIFY_BITS(d, 61); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - u6 = d & M; d >>= 26; c += u6 * R0; - VERIFY_BITS(u6, 26); - VERIFY_BITS(d, 35); - /* VERIFY_BITS(c, 64); */ - /* [d u6 0 0 0 0 0 0 t9 0 0 c-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - t6 = c & M; c >>= 26; c += u6 * R1; - VERIFY_BITS(t6, 26); - VERIFY_BITS(c, 39); - /* [d u6 0 0 0 0 0 0 t9 0 c-u6*R1 t6-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[7] - + (uint64_t)(a[1]*2) * a[6] - + (uint64_t)(a[2]*2) * a[5] - + (uint64_t)(a[3]*2) * a[4]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x8000007C00000007ULL); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[8]*2) * a[9]; - VERIFY_BITS(d, 58); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - u7 = d & M; d >>= 26; c += u7 * R0; - VERIFY_BITS(u7, 26); - VERIFY_BITS(d, 32); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x800001703FFFC2F7ULL); - /* [d u7 0 0 0 0 0 0 0 t9 0 c-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - t7 = c & M; c >>= 26; c += u7 * R1; - VERIFY_BITS(t7, 26); - VERIFY_BITS(c, 38); - /* [d u7 0 0 0 0 0 0 0 t9 c-u7*R1 t7-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[8] - + (uint64_t)(a[1]*2) * a[7] - + (uint64_t)(a[2]*2) * a[6] - + (uint64_t)(a[3]*2) * a[5] - + (uint64_t)a[4] * a[4]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000007B80000008ULL); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[9] * a[9]; - VERIFY_BITS(d, 57); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - u8 = d & M; d >>= 26; c += u8 * R0; - VERIFY_BITS(u8, 26); - VERIFY_BITS(d, 31); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000016FBFFFC2F8ULL); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[3] = t3; - VERIFY_BITS(r[3], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = t4; - VERIFY_BITS(r[4], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[5] = t5; - VERIFY_BITS(r[5], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[6] = t6; - VERIFY_BITS(r[6], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[7] = t7; - VERIFY_BITS(r[7], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[8] = c & M; c >>= 26; c += u8 * R1; - VERIFY_BITS(r[8], 26); - VERIFY_BITS(c, 39); - /* [d u8 0 0 0 0 0 0 0 0 t9+c-u8*R1 r8-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 0 t9+c r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += d * R0 + t9; - VERIFY_BITS(c, 45); - /* [d 0 0 0 0 0 0 0 0 0 c-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[9] = c & (M >> 4); c >>= 22; c += d * (R1 << 4); - VERIFY_BITS(r[9], 22); - VERIFY_BITS(c, 46); - /* [d 0 0 0 0 0 0 0 0 r9+((c-d*R1<<4)<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 -d*R1 r9+(c<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - d = c * (R0 >> 4) + t0; - VERIFY_BITS(d, 56); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 d-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[0] = d & M; d >>= 26; - VERIFY_BITS(r[0], 26); - VERIFY_BITS(d, 30); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1+d r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += c * (R1 >> 4) + t1; - VERIFY_BITS(d, 53); - VERIFY_CHECK(d <= 0x10000003FFFFBFULL); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 d-c*R1>>4 r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9 r8 r7 r6 r5 r4 r3 t2 d r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[1] = d & M; d >>= 26; - VERIFY_BITS(r[1], 26); - VERIFY_BITS(d, 27); - VERIFY_CHECK(d <= 0x4000000ULL); - /* [r9 r8 r7 r6 r5 r4 r3 t2+d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += t2; - VERIFY_BITS(d, 27); - /* [r9 r8 r7 r6 r5 r4 r3 d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = d; - VERIFY_BITS(r[2], 27); - /* [r9 r8 r7 r6 r5 r4 r3 r2 r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} -#endif - -static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - VERIFY_CHECK(b->magnitude <= 8); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); - VERIFY_CHECK(r != b); -#endif - secp256k1_fe_mul_inner(r->n, a->n, b->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - secp256k1_fe_verify(a); -#endif - secp256k1_fe_sqr_inner(r->n, a->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag) { - uint32_t mask0, mask1; - mask0 = flag + ~((uint32_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); - r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1); - r->n[5] = (r->n[5] & mask0) | (a->n[5] & mask1); - r->n[6] = (r->n[6] & mask0) | (a->n[6] & mask1); - r->n[7] = (r->n[7] & mask0) | (a->n[7] & mask1); - r->n[8] = (r->n[8] & mask0) | (a->n[8] & mask1); - r->n[9] = (r->n[9] & mask0) | (a->n[9] & mask1); -#ifdef VERIFY - if (a->magnitude > r->magnitude) { - r->magnitude = a->magnitude; - } - r->normalized &= a->normalized; -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag) { - uint32_t mask0, mask1; - mask0 = flag + ~((uint32_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); - r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1); - r->n[5] = (r->n[5] & mask0) | (a->n[5] & mask1); - r->n[6] = (r->n[6] & mask0) | (a->n[6] & mask1); - r->n[7] = (r->n[7] & mask0) | (a->n[7] & mask1); -} - -static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); -#endif - r->n[0] = a->n[0] | a->n[1] << 26; - r->n[1] = a->n[1] >> 6 | a->n[2] << 20; - r->n[2] = a->n[2] >> 12 | a->n[3] << 14; - r->n[3] = a->n[3] >> 18 | a->n[4] << 8; - r->n[4] = a->n[4] >> 24 | a->n[5] << 2 | a->n[6] << 28; - r->n[5] = a->n[6] >> 4 | a->n[7] << 22; - r->n[6] = a->n[7] >> 10 | a->n[8] << 16; - r->n[7] = a->n[8] >> 16 | a->n[9] << 10; -} - -static SECP256K1_INLINE void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a) { - r->n[0] = a->n[0] & 0x3FFFFFFUL; - r->n[1] = a->n[0] >> 26 | ((a->n[1] << 6) & 0x3FFFFFFUL); - r->n[2] = a->n[1] >> 20 | ((a->n[2] << 12) & 0x3FFFFFFUL); - r->n[3] = a->n[2] >> 14 | ((a->n[3] << 18) & 0x3FFFFFFUL); - r->n[4] = a->n[3] >> 8 | ((a->n[4] << 24) & 0x3FFFFFFUL); - r->n[5] = (a->n[4] >> 2) & 0x3FFFFFFUL; - r->n[6] = a->n[4] >> 28 | ((a->n[5] << 4) & 0x3FFFFFFUL); - r->n[7] = a->n[5] >> 22 | ((a->n[6] << 10) & 0x3FFFFFFUL); - r->n[8] = a->n[6] >> 16 | ((a->n[7] << 16) & 0x3FFFFFFUL); - r->n[9] = a->n[7] >> 10; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; -#endif -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h deleted file mode 100644 index 8e69a560..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h +++ /dev/null @@ -1,47 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_ -#define _SECP256K1_FIELD_REPR_ - -#include - -typedef struct { - /* X = sum(i=0..4, elem[i]*2^52) mod n */ - uint64_t n[5]; -#ifdef VERIFY - int magnitude; - int normalized; -#endif -} secp256k1_fe; - -/* Unpacks a constant into a overlapping multi-limbed FE element. */ -#define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \ - (d0) | (((uint64_t)(d1) & 0xFFFFFUL) << 32), \ - ((uint64_t)(d1) >> 20) | (((uint64_t)(d2)) << 12) | (((uint64_t)(d3) & 0xFFUL) << 44), \ - ((uint64_t)(d3) >> 8) | (((uint64_t)(d4) & 0xFFFFFFFUL) << 24), \ - ((uint64_t)(d4) >> 28) | (((uint64_t)(d5)) << 4) | (((uint64_t)(d6) & 0xFFFFUL) << 36), \ - ((uint64_t)(d6) >> 16) | (((uint64_t)(d7)) << 16) \ -} - -#ifdef VERIFY -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1} -#else -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))} -#endif - -typedef struct { - uint64_t n[4]; -} secp256k1_fe_storage; - -#define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ \ - (d0) | (((uint64_t)(d1)) << 32), \ - (d2) | (((uint64_t)(d3)) << 32), \ - (d4) | (((uint64_t)(d5)) << 32), \ - (d6) | (((uint64_t)(d7)) << 32) \ -}} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h deleted file mode 100644 index 98cc004b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h +++ /dev/null @@ -1,502 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2014 Diederik Huys, Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -/** - * Changelog: - * - March 2013, Diederik Huys: original version - * - November 2014, Pieter Wuille: updated to use Peter Dettman's parallel multiplication algorithm - * - December 2014, Pieter Wuille: converted from YASM to GCC inline assembly - */ - -#ifndef _SECP256K1_FIELD_INNER5X52_IMPL_H_ -#define _SECP256K1_FIELD_INNER5X52_IMPL_H_ - -SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t *a, const uint64_t * SECP256K1_RESTRICT b) { -/** - * Registers: rdx:rax = multiplication accumulator - * r9:r8 = c - * r15:rcx = d - * r10-r14 = a0-a4 - * rbx = b - * rdi = r - * rsi = a / t? - */ - uint64_t tmp1, tmp2, tmp3; -__asm__ __volatile__( - "movq 0(%%rsi),%%r10\n" - "movq 8(%%rsi),%%r11\n" - "movq 16(%%rsi),%%r12\n" - "movq 24(%%rsi),%%r13\n" - "movq 32(%%rsi),%%r14\n" - - /* d += a3 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r13\n" - "movq %%rax,%%rcx\n" - "movq %%rdx,%%r15\n" - /* d += a2 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a1 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d = a0 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c = a4 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r14\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += (c & M) * R */ - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* t3 (tmp1) = d & M */ - "movq %%rcx,%%rsi\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rsi\n" - "movq %%rsi,%q1\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* d += a4 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a2 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a1 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a0 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += c * R */ - "movq %%r8,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* t4 = d & M (%%rsi) */ - "movq %%rcx,%%rsi\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* tx = t4 >> 48 (tmp3) */ - "movq %%rsi,%%rax\n" - "shrq $48,%%rax\n" - "movq %%rax,%q3\n" - /* t4 &= (M >> 4) (tmp2) */ - "movq $0xffffffffffff,%%rax\n" - "andq %%rax,%%rsi\n" - "movq %%rsi,%q2\n" - /* c = a0 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r10\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += a4 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a2 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a1 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* u0 = d & M (%%rsi) */ - "movq %%rcx,%%rsi\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* u0 = (u0 << 4) | tx (%%rsi) */ - "shlq $4,%%rsi\n" - "movq %q3,%%rax\n" - "orq %%rax,%%rsi\n" - /* c += u0 * (R >> 4) */ - "movq $0x1000003d1,%%rax\n" - "mulq %%rsi\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[0] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,0(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += a1 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* c += a0 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d += a4 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a2 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c += (d & M) * R */ - "movq %%rcx,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* r[1] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,8(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += a2 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* c += a1 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* c += a0 * b2 (last use of %%r10 = a0) */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* fetch t3 (%%r10, overwrites a0), t4 (%%rsi) */ - "movq %q2,%%rsi\n" - "movq %q1,%%r10\n" - /* d += a4 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c += (d & M) * R */ - "movq %%rcx,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 (%%rcx only) */ - "shrdq $52,%%r15,%%rcx\n" - /* r[2] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,16(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += t3 */ - "addq %%r10,%%r8\n" - /* c += d * R */ - "movq %%rcx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[3] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,24(%%rdi)\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* c += t4 (%%r8 only) */ - "addq %%rsi,%%r8\n" - /* r[4] = c */ - "movq %%r8,32(%%rdi)\n" -: "+S"(a), "=m"(tmp1), "=m"(tmp2), "=m"(tmp3) -: "b"(b), "D"(r) -: "%rax", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "cc", "memory" -); -} - -SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint64_t *r, const uint64_t *a) { -/** - * Registers: rdx:rax = multiplication accumulator - * r9:r8 = c - * rcx:rbx = d - * r10-r14 = a0-a4 - * r15 = M (0xfffffffffffff) - * rdi = r - * rsi = a / t? - */ - uint64_t tmp1, tmp2, tmp3; -__asm__ __volatile__( - "movq 0(%%rsi),%%r10\n" - "movq 8(%%rsi),%%r11\n" - "movq 16(%%rsi),%%r12\n" - "movq 24(%%rsi),%%r13\n" - "movq 32(%%rsi),%%r14\n" - "movq $0xfffffffffffff,%%r15\n" - - /* d = (a0*2) * a3 */ - "leaq (%%r10,%%r10,1),%%rax\n" - "mulq %%r13\n" - "movq %%rax,%%rbx\n" - "movq %%rdx,%%rcx\n" - /* d += (a1*2) * a2 */ - "leaq (%%r11,%%r11,1),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c = a4 * a4 */ - "movq %%r14,%%rax\n" - "mulq %%r14\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += (c & M) * R */ - "andq %%r15,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* t3 (tmp1) = d & M */ - "movq %%rbx,%%rsi\n" - "andq %%r15,%%rsi\n" - "movq %%rsi,%q1\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* a4 *= 2 */ - "addq %%r14,%%r14\n" - /* d += a0 * a4 */ - "movq %%r10,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d+= (a1*2) * a3 */ - "leaq (%%r11,%%r11,1),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += a2 * a2 */ - "movq %%r12,%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += c * R */ - "movq %%r8,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* t4 = d & M (%%rsi) */ - "movq %%rbx,%%rsi\n" - "andq %%r15,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* tx = t4 >> 48 (tmp3) */ - "movq %%rsi,%%rax\n" - "shrq $48,%%rax\n" - "movq %%rax,%q3\n" - /* t4 &= (M >> 4) (tmp2) */ - "movq $0xffffffffffff,%%rax\n" - "andq %%rax,%%rsi\n" - "movq %%rsi,%q2\n" - /* c = a0 * a0 */ - "movq %%r10,%%rax\n" - "mulq %%r10\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += a1 * a4 */ - "movq %%r11,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += (a2*2) * a3 */ - "leaq (%%r12,%%r12,1),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* u0 = d & M (%%rsi) */ - "movq %%rbx,%%rsi\n" - "andq %%r15,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* u0 = (u0 << 4) | tx (%%rsi) */ - "shlq $4,%%rsi\n" - "movq %q3,%%rax\n" - "orq %%rax,%%rsi\n" - /* c += u0 * (R >> 4) */ - "movq $0x1000003d1,%%rax\n" - "mulq %%rsi\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[0] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,0(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* a0 *= 2 */ - "addq %%r10,%%r10\n" - /* c += a0 * a1 */ - "movq %%r10,%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d += a2 * a4 */ - "movq %%r12,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += a3 * a3 */ - "movq %%r13,%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c += (d & M) * R */ - "movq %%rbx,%%rax\n" - "andq %%r15,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* r[1] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,8(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += a0 * a2 (last use of %%r10) */ - "movq %%r10,%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* fetch t3 (%%r10, overwrites a0),t4 (%%rsi) */ - "movq %q2,%%rsi\n" - "movq %q1,%%r10\n" - /* c += a1 * a1 */ - "movq %%r11,%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d += a3 * a4 */ - "movq %%r13,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c += (d & M) * R */ - "movq %%rbx,%%rax\n" - "andq %%r15,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 (%%rbx only) */ - "shrdq $52,%%rcx,%%rbx\n" - /* r[2] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,16(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += t3 */ - "addq %%r10,%%r8\n" - /* c += d * R */ - "movq %%rbx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[3] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,24(%%rdi)\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* c += t4 (%%r8 only) */ - "addq %%rsi,%%r8\n" - /* r[4] = c */ - "movq %%r8,32(%%rdi)\n" -: "+S"(a), "=m"(tmp1), "=m"(tmp2), "=m"(tmp3) -: "D"(r) -: "%rax", "%rbx", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "cc", "memory" -); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h deleted file mode 100644 index dd88f38c..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h +++ /dev/null @@ -1,451 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_IMPL_H_ -#define _SECP256K1_FIELD_REPR_IMPL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include "util.h" -#include "num.h" -#include "field.h" - -#if defined(USE_ASM_X86_64) -#include "field_5x52_asm_impl.h" -#else -#include "field_5x52_int128_impl.h" -#endif - -/** Implements arithmetic modulo FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F, - * represented as 5 uint64_t's in base 2^52. The values are allowed to contain >52 each. In particular, - * each FieldElem has a 'magnitude' associated with it. Internally, a magnitude M means each element - * is at most M*(2^53-1), except the most significant one, which is limited to M*(2^49-1). All operations - * accept any input with magnitude at most M, and have different rules for propagating magnitude to their - * output. - */ - -#ifdef VERIFY -static void secp256k1_fe_verify(const secp256k1_fe *a) { - const uint64_t *d = a->n; - int m = a->normalized ? 1 : 2 * a->magnitude, r = 1; - /* secp256k1 'p' value defined in "Standards for Efficient Cryptography" (SEC2) 2.7.1. */ - r &= (d[0] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[1] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[2] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[3] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[4] <= 0x0FFFFFFFFFFFFULL * m); - r &= (a->magnitude >= 0); - r &= (a->magnitude <= 2048); - if (a->normalized) { - r &= (a->magnitude <= 1); - if (r && (d[4] == 0x0FFFFFFFFFFFFULL) && ((d[3] & d[2] & d[1]) == 0xFFFFFFFFFFFFFULL)) { - r &= (d[0] < 0xFFFFEFFFFFC2FULL); - } - } - VERIFY_CHECK(r == 1); -} -#endif - -static void secp256k1_fe_normalize(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t m; - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; m = t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; m &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; m &= t3; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t4 >> 48) | ((t4 == 0x0FFFFFFFFFFFFULL) & (m == 0xFFFFFFFFFFFFFULL) - & (t0 >= 0xFFFFEFFFFFC2FULL)); - - /* Apply the final reduction (for constant-time behaviour, we do it always) */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; - - /* If t4 didn't carry to bit 48 already, then it should have after any final reduction */ - VERIFY_CHECK(t4 >> 48 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t4 &= 0x0FFFFFFFFFFFFULL; - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_weak(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - -#ifdef VERIFY - r->magnitude = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_var(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t m; - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; m = t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; m &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; m &= t3; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t4 >> 48) | ((t4 == 0x0FFFFFFFFFFFFULL) & (m == 0xFFFFFFFFFFFFFULL) - & (t0 >= 0xFFFFEFFFFFC2FULL)); - - if (x) { - t0 += 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; - - /* If t4 didn't carry to bit 48 already, then it should have after any final reduction */ - VERIFY_CHECK(t4 >> 48 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t4 &= 0x0FFFFFFFFFFFFULL; - } - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - uint64_t z0, z1; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; z0 = t0; z1 = t0 ^ 0x1000003D0ULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; z0 |= t1; z1 &= t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; z0 |= t3; z1 &= t3; - z0 |= t4; z1 &= t4 ^ 0xF000000000000ULL; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - return (z0 == 0) | (z1 == 0xFFFFFFFFFFFFFULL); -} - -static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r) { - uint64_t t0, t1, t2, t3, t4; - uint64_t z0, z1; - uint64_t x; - - t0 = r->n[0]; - t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - x = t4 >> 48; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - z0 = t0 & 0xFFFFFFFFFFFFFULL; - z1 = z0 ^ 0x1000003D0ULL; - - /* Fast return path should catch the majority of cases */ - if ((z0 != 0ULL) & (z1 != 0xFFFFFFFFFFFFFULL)) { - return 0; - } - - t1 = r->n[1]; - t2 = r->n[2]; - t3 = r->n[3]; - - t4 &= 0x0FFFFFFFFFFFFULL; - - t1 += (t0 >> 52); - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; z0 |= t1; z1 &= t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; z0 |= t3; z1 &= t3; - z0 |= t4; z1 &= t4 ^ 0xF000000000000ULL; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - return (z0 == 0) | (z1 == 0xFFFFFFFFFFFFFULL); -} - -SECP256K1_INLINE static void secp256k1_fe_set_int(secp256k1_fe *r, int a) { - r->n[0] = a; - r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static int secp256k1_fe_is_zero(const secp256k1_fe *a) { - const uint64_t *t = a->n; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return (t[0] | t[1] | t[2] | t[3] | t[4]) == 0; -} - -SECP256K1_INLINE static int secp256k1_fe_is_odd(const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return a->n[0] & 1; -} - -SECP256K1_INLINE static void secp256k1_fe_clear(secp256k1_fe *a) { - int i; -#ifdef VERIFY - a->magnitude = 0; - a->normalized = 1; -#endif - for (i=0; i<5; i++) { - a->n[i] = 0; - } -} - -static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - VERIFY_CHECK(b->normalized); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); -#endif - for (i = 4; i >= 0; i--) { - if (a->n[i] > b->n[i]) { - return 1; - } - if (a->n[i] < b->n[i]) { - return -1; - } - } - return 0; -} - -static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a) { - int i; - r->n[0] = r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0; - for (i=0; i<32; i++) { - int j; - for (j=0; j<2; j++) { - int limb = (8*i+4*j)/52; - int shift = (8*i+4*j)%52; - r->n[limb] |= (uint64_t)((a[31-i] >> (4*j)) & 0xF) << shift; - } - } - if (r->n[4] == 0x0FFFFFFFFFFFFULL && (r->n[3] & r->n[2] & r->n[1]) == 0xFFFFFFFFFFFFFULL && r->n[0] >= 0xFFFFEFFFFFC2FULL) { - return 0; - } -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif - return 1; -} - -/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */ -static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - for (i=0; i<32; i++) { - int j; - int c = 0; - for (j=0; j<2; j++) { - int limb = (8*i+4*j)/52; - int shift = (8*i+4*j)%52; - c |= ((a->n[limb] >> shift) & 0xF) << (4 * j); - } - r[31-i] = c; - } -} - -SECP256K1_INLINE static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= m); - secp256k1_fe_verify(a); -#endif - r->n[0] = 0xFFFFEFFFFFC2FULL * 2 * (m + 1) - a->n[0]; - r->n[1] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[1]; - r->n[2] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[2]; - r->n[3] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[3]; - r->n[4] = 0x0FFFFFFFFFFFFULL * 2 * (m + 1) - a->n[4]; -#ifdef VERIFY - r->magnitude = m + 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_mul_int(secp256k1_fe *r, int a) { - r->n[0] *= a; - r->n[1] *= a; - r->n[2] *= a; - r->n[3] *= a; - r->n[4] *= a; -#ifdef VERIFY - r->magnitude *= a; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - secp256k1_fe_verify(a); -#endif - r->n[0] += a->n[0]; - r->n[1] += a->n[1]; - r->n[2] += a->n[2]; - r->n[3] += a->n[3]; - r->n[4] += a->n[4]; -#ifdef VERIFY - r->magnitude += a->magnitude; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - VERIFY_CHECK(b->magnitude <= 8); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); - VERIFY_CHECK(r != b); -#endif - secp256k1_fe_mul_inner(r->n, a->n, b->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - secp256k1_fe_verify(a); -#endif - secp256k1_fe_sqr_inner(r->n, a->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag) { - uint64_t mask0, mask1; - mask0 = flag + ~((uint64_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); - r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1); -#ifdef VERIFY - if (a->magnitude > r->magnitude) { - r->magnitude = a->magnitude; - } - r->normalized &= a->normalized; -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag) { - uint64_t mask0, mask1; - mask0 = flag + ~((uint64_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); -} - -static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); -#endif - r->n[0] = a->n[0] | a->n[1] << 52; - r->n[1] = a->n[1] >> 12 | a->n[2] << 40; - r->n[2] = a->n[2] >> 24 | a->n[3] << 28; - r->n[3] = a->n[3] >> 36 | a->n[4] << 16; -} - -static SECP256K1_INLINE void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a) { - r->n[0] = a->n[0] & 0xFFFFFFFFFFFFFULL; - r->n[1] = a->n[0] >> 52 | ((a->n[1] << 12) & 0xFFFFFFFFFFFFFULL); - r->n[2] = a->n[1] >> 40 | ((a->n[2] << 24) & 0xFFFFFFFFFFFFFULL); - r->n[3] = a->n[2] >> 28 | ((a->n[3] << 36) & 0xFFFFFFFFFFFFFULL); - r->n[4] = a->n[3] >> 16; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; -#endif -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h deleted file mode 100644 index 0bf22bdd..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h +++ /dev/null @@ -1,277 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_INNER5X52_IMPL_H_ -#define _SECP256K1_FIELD_INNER5X52_IMPL_H_ - -#include - -#ifdef VERIFY -#define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0) -#else -#define VERIFY_BITS(x, n) do { } while(0) -#endif - -SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t *a, const uint64_t * SECP256K1_RESTRICT b) { - uint128_t c, d; - uint64_t t3, t4, tx, u0; - uint64_t a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4]; - const uint64_t M = 0xFFFFFFFFFFFFFULL, R = 0x1000003D10ULL; - - VERIFY_BITS(a[0], 56); - VERIFY_BITS(a[1], 56); - VERIFY_BITS(a[2], 56); - VERIFY_BITS(a[3], 56); - VERIFY_BITS(a[4], 52); - VERIFY_BITS(b[0], 56); - VERIFY_BITS(b[1], 56); - VERIFY_BITS(b[2], 56); - VERIFY_BITS(b[3], 56); - VERIFY_BITS(b[4], 52); - VERIFY_CHECK(r != b); - - /* [... a b c] is a shorthand for ... + a<<104 + b<<52 + c<<0 mod n. - * px is a shorthand for sum(a[i]*b[x-i], i=0..x). - * Note that [x 0 0 0 0 0] = [x*R]. - */ - - d = (uint128_t)a0 * b[3] - + (uint128_t)a1 * b[2] - + (uint128_t)a2 * b[1] - + (uint128_t)a3 * b[0]; - VERIFY_BITS(d, 114); - /* [d 0 0 0] = [p3 0 0 0] */ - c = (uint128_t)a4 * b[4]; - VERIFY_BITS(c, 112); - /* [c 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - d += (c & M) * R; c >>= 52; - VERIFY_BITS(d, 115); - VERIFY_BITS(c, 60); - /* [c 0 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - t3 = d & M; d >>= 52; - VERIFY_BITS(t3, 52); - VERIFY_BITS(d, 63); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - - d += (uint128_t)a0 * b[4] - + (uint128_t)a1 * b[3] - + (uint128_t)a2 * b[2] - + (uint128_t)a3 * b[1] - + (uint128_t)a4 * b[0]; - VERIFY_BITS(d, 115); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - d += c * R; - VERIFY_BITS(d, 116); - /* [d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - t4 = d & M; d >>= 52; - VERIFY_BITS(t4, 52); - VERIFY_BITS(d, 64); - /* [d t4 t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - tx = (t4 >> 48); t4 &= (M >> 4); - VERIFY_BITS(tx, 4); - VERIFY_BITS(t4, 48); - /* [d t4+(tx<<48) t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - - c = (uint128_t)a0 * b[0]; - VERIFY_BITS(c, 112); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 0 p4 p3 0 0 p0] */ - d += (uint128_t)a1 * b[4] - + (uint128_t)a2 * b[3] - + (uint128_t)a3 * b[2] - + (uint128_t)a4 * b[1]; - VERIFY_BITS(d, 115); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = d & M; d >>= 52; - VERIFY_BITS(u0, 52); - VERIFY_BITS(d, 63); - /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = (u0 << 4) | tx; - VERIFY_BITS(u0, 56); - /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - c += (uint128_t)u0 * (R >> 4); - VERIFY_BITS(c, 115); - /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - r[0] = c & M; c >>= 52; - VERIFY_BITS(r[0], 52); - VERIFY_BITS(c, 61); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 0 p0] */ - - c += (uint128_t)a0 * b[1] - + (uint128_t)a1 * b[0]; - VERIFY_BITS(c, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 p1 p0] */ - d += (uint128_t)a2 * b[4] - + (uint128_t)a3 * b[3] - + (uint128_t)a4 * b[2]; - VERIFY_BITS(d, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - r[1] = c & M; c >>= 52; - VERIFY_BITS(r[1], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - - c += (uint128_t)a0 * b[2] - + (uint128_t)a1 * b[1] - + (uint128_t)a2 * b[0]; - VERIFY_BITS(c, 114); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint128_t)a3 * b[4] - + (uint128_t)a4 * b[3]; - VERIFY_BITS(d, 114); - /* [d 0 0 t4 t3 c t1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - /* [d 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = c & M; c >>= 52; - VERIFY_BITS(r[2], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 0 t4 t3+c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += d * R + t3; - VERIFY_BITS(c, 100); - /* [t4 c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[3] = c & M; c >>= 52; - VERIFY_BITS(r[3], 52); - VERIFY_BITS(c, 48); - /* [t4+c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += t4; - VERIFY_BITS(c, 49); - /* [c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = c; - VERIFY_BITS(r[4], 49); - /* [r4 r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} - -SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint64_t *r, const uint64_t *a) { - uint128_t c, d; - uint64_t a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4]; - int64_t t3, t4, tx, u0; - const uint64_t M = 0xFFFFFFFFFFFFFULL, R = 0x1000003D10ULL; - - VERIFY_BITS(a[0], 56); - VERIFY_BITS(a[1], 56); - VERIFY_BITS(a[2], 56); - VERIFY_BITS(a[3], 56); - VERIFY_BITS(a[4], 52); - - /** [... a b c] is a shorthand for ... + a<<104 + b<<52 + c<<0 mod n. - * px is a shorthand for sum(a[i]*a[x-i], i=0..x). - * Note that [x 0 0 0 0 0] = [x*R]. - */ - - d = (uint128_t)(a0*2) * a3 - + (uint128_t)(a1*2) * a2; - VERIFY_BITS(d, 114); - /* [d 0 0 0] = [p3 0 0 0] */ - c = (uint128_t)a4 * a4; - VERIFY_BITS(c, 112); - /* [c 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - d += (c & M) * R; c >>= 52; - VERIFY_BITS(d, 115); - VERIFY_BITS(c, 60); - /* [c 0 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - t3 = d & M; d >>= 52; - VERIFY_BITS(t3, 52); - VERIFY_BITS(d, 63); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - - a4 *= 2; - d += (uint128_t)a0 * a4 - + (uint128_t)(a1*2) * a3 - + (uint128_t)a2 * a2; - VERIFY_BITS(d, 115); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - d += c * R; - VERIFY_BITS(d, 116); - /* [d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - t4 = d & M; d >>= 52; - VERIFY_BITS(t4, 52); - VERIFY_BITS(d, 64); - /* [d t4 t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - tx = (t4 >> 48); t4 &= (M >> 4); - VERIFY_BITS(tx, 4); - VERIFY_BITS(t4, 48); - /* [d t4+(tx<<48) t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - - c = (uint128_t)a0 * a0; - VERIFY_BITS(c, 112); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 0 p4 p3 0 0 p0] */ - d += (uint128_t)a1 * a4 - + (uint128_t)(a2*2) * a3; - VERIFY_BITS(d, 114); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = d & M; d >>= 52; - VERIFY_BITS(u0, 52); - VERIFY_BITS(d, 62); - /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = (u0 << 4) | tx; - VERIFY_BITS(u0, 56); - /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - c += (uint128_t)u0 * (R >> 4); - VERIFY_BITS(c, 113); - /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - r[0] = c & M; c >>= 52; - VERIFY_BITS(r[0], 52); - VERIFY_BITS(c, 61); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 0 p0] */ - - a0 *= 2; - c += (uint128_t)a0 * a1; - VERIFY_BITS(c, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 p1 p0] */ - d += (uint128_t)a2 * a4 - + (uint128_t)a3 * a3; - VERIFY_BITS(d, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - r[1] = c & M; c >>= 52; - VERIFY_BITS(r[1], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - - c += (uint128_t)a0 * a2 - + (uint128_t)a1 * a1; - VERIFY_BITS(c, 114); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint128_t)a3 * a4; - VERIFY_BITS(d, 114); - /* [d 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = c & M; c >>= 52; - VERIFY_BITS(r[2], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 0 t4 t3+c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - c += d * R + t3; - VERIFY_BITS(c, 100); - /* [t4 c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[3] = c & M; c >>= 52; - VERIFY_BITS(r[3], 52); - VERIFY_BITS(c, 48); - /* [t4+c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += t4; - VERIFY_BITS(c, 49); - /* [c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = c; - VERIFY_BITS(r[4], 49); - /* [r4 r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h deleted file mode 100644 index 5127b279..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h +++ /dev/null @@ -1,315 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_IMPL_H_ -#define _SECP256K1_FIELD_IMPL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include "util.h" - -#if defined(USE_FIELD_10X26) -#include "field_10x26_impl.h" -#elif defined(USE_FIELD_5X52) -#include "field_5x52_impl.h" -#else -#error "Please select field implementation" -#endif - -SECP256K1_INLINE static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe na; - secp256k1_fe_negate(&na, a, 1); - secp256k1_fe_add(&na, b); - return secp256k1_fe_normalizes_to_zero(&na); -} - -SECP256K1_INLINE static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe na; - secp256k1_fe_negate(&na, a, 1); - secp256k1_fe_add(&na, b); - return secp256k1_fe_normalizes_to_zero_var(&na); -} - -static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a) { - /** Given that p is congruent to 3 mod 4, we can compute the square root of - * a mod p as the (p+1)/4'th power of a. - * - * As (p+1)/4 is an even number, it will have the same result for a and for - * (-a). Only one of these two numbers actually has a square root however, - * so we test at the end by squaring and comparing to the input. - * Also because (p+1)/4 is an even number, the computed square root is - * itself always a square (a ** ((p+1)/4) is the square of a ** ((p+1)/8)). - */ - secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1; - int j; - - /** The binary representation of (p + 1)/4 has 3 blocks of 1s, with lengths in - * { 2, 22, 223 }. Use an addition chain to calculate 2^n - 1 for each block: - * 1, [2], 3, 6, 9, 11, [22], 44, 88, 176, 220, [223] - */ - - secp256k1_fe_sqr(&x2, a); - secp256k1_fe_mul(&x2, &x2, a); - - secp256k1_fe_sqr(&x3, &x2); - secp256k1_fe_mul(&x3, &x3, a); - - x6 = x3; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x6, &x6); - } - secp256k1_fe_mul(&x6, &x6, &x3); - - x9 = x6; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x9, &x9); - } - secp256k1_fe_mul(&x9, &x9, &x3); - - x11 = x9; - for (j=0; j<2; j++) { - secp256k1_fe_sqr(&x11, &x11); - } - secp256k1_fe_mul(&x11, &x11, &x2); - - x22 = x11; - for (j=0; j<11; j++) { - secp256k1_fe_sqr(&x22, &x22); - } - secp256k1_fe_mul(&x22, &x22, &x11); - - x44 = x22; - for (j=0; j<22; j++) { - secp256k1_fe_sqr(&x44, &x44); - } - secp256k1_fe_mul(&x44, &x44, &x22); - - x88 = x44; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x88, &x88); - } - secp256k1_fe_mul(&x88, &x88, &x44); - - x176 = x88; - for (j=0; j<88; j++) { - secp256k1_fe_sqr(&x176, &x176); - } - secp256k1_fe_mul(&x176, &x176, &x88); - - x220 = x176; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x220, &x220); - } - secp256k1_fe_mul(&x220, &x220, &x44); - - x223 = x220; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x223, &x223); - } - secp256k1_fe_mul(&x223, &x223, &x3); - - /* The final result is then assembled using a sliding window over the blocks. */ - - t1 = x223; - for (j=0; j<23; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x22); - for (j=0; j<6; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x2); - secp256k1_fe_sqr(&t1, &t1); - secp256k1_fe_sqr(r, &t1); - - /* Check that a square root was actually calculated */ - - secp256k1_fe_sqr(&t1, r); - return secp256k1_fe_equal(&t1, a); -} - -static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a) { - secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1; - int j; - - /** The binary representation of (p - 2) has 5 blocks of 1s, with lengths in - * { 1, 2, 22, 223 }. Use an addition chain to calculate 2^n - 1 for each block: - * [1], [2], 3, 6, 9, 11, [22], 44, 88, 176, 220, [223] - */ - - secp256k1_fe_sqr(&x2, a); - secp256k1_fe_mul(&x2, &x2, a); - - secp256k1_fe_sqr(&x3, &x2); - secp256k1_fe_mul(&x3, &x3, a); - - x6 = x3; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x6, &x6); - } - secp256k1_fe_mul(&x6, &x6, &x3); - - x9 = x6; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x9, &x9); - } - secp256k1_fe_mul(&x9, &x9, &x3); - - x11 = x9; - for (j=0; j<2; j++) { - secp256k1_fe_sqr(&x11, &x11); - } - secp256k1_fe_mul(&x11, &x11, &x2); - - x22 = x11; - for (j=0; j<11; j++) { - secp256k1_fe_sqr(&x22, &x22); - } - secp256k1_fe_mul(&x22, &x22, &x11); - - x44 = x22; - for (j=0; j<22; j++) { - secp256k1_fe_sqr(&x44, &x44); - } - secp256k1_fe_mul(&x44, &x44, &x22); - - x88 = x44; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x88, &x88); - } - secp256k1_fe_mul(&x88, &x88, &x44); - - x176 = x88; - for (j=0; j<88; j++) { - secp256k1_fe_sqr(&x176, &x176); - } - secp256k1_fe_mul(&x176, &x176, &x88); - - x220 = x176; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x220, &x220); - } - secp256k1_fe_mul(&x220, &x220, &x44); - - x223 = x220; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x223, &x223); - } - secp256k1_fe_mul(&x223, &x223, &x3); - - /* The final result is then assembled using a sliding window over the blocks. */ - - t1 = x223; - for (j=0; j<23; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x22); - for (j=0; j<5; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, a); - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x2); - for (j=0; j<2; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(r, a, &t1); -} - -static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a) { -#if defined(USE_FIELD_INV_BUILTIN) - secp256k1_fe_inv(r, a); -#elif defined(USE_FIELD_INV_NUM) - secp256k1_num n, m; - static const secp256k1_fe negone = SECP256K1_FE_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL, 0xFFFFFC2EUL - ); - /* secp256k1 field prime, value p defined in "Standards for Efficient Cryptography" (SEC2) 2.7.1. */ - static const unsigned char prime[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F - }; - unsigned char b[32]; - int res; - secp256k1_fe c = *a; - secp256k1_fe_normalize_var(&c); - secp256k1_fe_get_b32(b, &c); - secp256k1_num_set_bin(&n, b, 32); - secp256k1_num_set_bin(&m, prime, 32); - secp256k1_num_mod_inverse(&n, &n, &m); - secp256k1_num_get_bin(b, 32, &n); - res = secp256k1_fe_set_b32(r, b); - (void)res; - VERIFY_CHECK(res); - /* Verify the result is the (unique) valid inverse using non-GMP code. */ - secp256k1_fe_mul(&c, &c, r); - secp256k1_fe_add(&c, &negone); - CHECK(secp256k1_fe_normalizes_to_zero_var(&c)); -#else -#error "Please select field inverse implementation" -#endif -} - -static void secp256k1_fe_inv_all_var(secp256k1_fe *r, const secp256k1_fe *a, size_t len) { - secp256k1_fe u; - size_t i; - if (len < 1) { - return; - } - - VERIFY_CHECK((r + len <= a) || (a + len <= r)); - - r[0] = a[0]; - - i = 0; - while (++i < len) { - secp256k1_fe_mul(&r[i], &r[i - 1], &a[i]); - } - - secp256k1_fe_inv_var(&u, &r[--i]); - - while (i > 0) { - size_t j = i--; - secp256k1_fe_mul(&r[j], &r[i], &u); - secp256k1_fe_mul(&u, &u, &a[j]); - } - - r[0] = u; -} - -static int secp256k1_fe_is_quad_var(const secp256k1_fe *a) { -#ifndef USE_NUM_NONE - unsigned char b[32]; - secp256k1_num n; - secp256k1_num m; - /* secp256k1 field prime, value p defined in "Standards for Efficient Cryptography" (SEC2) 2.7.1. */ - static const unsigned char prime[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F - }; - - secp256k1_fe c = *a; - secp256k1_fe_normalize_var(&c); - secp256k1_fe_get_b32(b, &c); - secp256k1_num_set_bin(&n, b, 32); - secp256k1_num_set_bin(&m, prime, 32); - return secp256k1_num_jacobi(&n, &m) >= 0; -#else - secp256k1_fe r; - return secp256k1_fe_sqrt(&r, a); -#endif -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c deleted file mode 100644 index 1835fd49..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c +++ /dev/null @@ -1,74 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014, 2015 Thomas Daede, Cory Fields * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#define USE_BASIC_CONFIG 1 - -#include "basic-config.h" -#include "include/secp256k1.h" -#include "field_impl.h" -#include "scalar_impl.h" -#include "group_impl.h" -#include "ecmult_gen_impl.h" - -static void default_error_callback_fn(const char* str, void* data) { - (void)data; - fprintf(stderr, "[libsecp256k1] internal consistency check failed: %s\n", str); - abort(); -} - -static const secp256k1_callback default_error_callback = { - default_error_callback_fn, - NULL -}; - -int main(int argc, char **argv) { - secp256k1_ecmult_gen_context ctx; - int inner; - int outer; - FILE* fp; - - (void)argc; - (void)argv; - - fp = fopen("src/ecmult_static_context.h","w"); - if (fp == NULL) { - fprintf(stderr, "Could not open src/ecmult_static_context.h for writing!\n"); - return -1; - } - - fprintf(fp, "#ifndef _SECP256K1_ECMULT_STATIC_CONTEXT_\n"); - fprintf(fp, "#define _SECP256K1_ECMULT_STATIC_CONTEXT_\n"); - fprintf(fp, "#include \"group.h\"\n"); - fprintf(fp, "#define SC SECP256K1_GE_STORAGE_CONST\n"); - fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_static_context[64][16] = {\n"); - - secp256k1_ecmult_gen_context_init(&ctx); - secp256k1_ecmult_gen_context_build(&ctx, &default_error_callback); - for(outer = 0; outer != 64; outer++) { - fprintf(fp,"{\n"); - for(inner = 0; inner != 16; inner++) { - fprintf(fp," SC(%uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu)", SECP256K1_GE_STORAGE_CONST_GET((*ctx.prec)[outer][inner])); - if (inner != 15) { - fprintf(fp,",\n"); - } else { - fprintf(fp,"\n"); - } - } - if (outer != 63) { - fprintf(fp,"},\n"); - } else { - fprintf(fp,"}\n"); - } - } - fprintf(fp,"};\n"); - secp256k1_ecmult_gen_context_clear(&ctx); - - fprintf(fp, "#undef SC\n"); - fprintf(fp, "#endif\n"); - fclose(fp); - - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h deleted file mode 100644 index 4957b248..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h +++ /dev/null @@ -1,144 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_GROUP_ -#define _SECP256K1_GROUP_ - -#include "num.h" -#include "field.h" - -/** A group element of the secp256k1 curve, in affine coordinates. */ -typedef struct { - secp256k1_fe x; - secp256k1_fe y; - int infinity; /* whether this represents the point at infinity */ -} secp256k1_ge; - -#define SECP256K1_GE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), 0} -#define SECP256K1_GE_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1} - -/** A group element of the secp256k1 curve, in jacobian coordinates. */ -typedef struct { - secp256k1_fe x; /* actual X: x/z^2 */ - secp256k1_fe y; /* actual Y: y/z^3 */ - secp256k1_fe z; - int infinity; /* whether this represents the point at infinity */ -} secp256k1_gej; - -#define SECP256K1_GEJ_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1), 0} -#define SECP256K1_GEJ_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1} - -typedef struct { - secp256k1_fe_storage x; - secp256k1_fe_storage y; -} secp256k1_ge_storage; - -#define SECP256K1_GE_STORAGE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_STORAGE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_STORAGE_CONST((i),(j),(k),(l),(m),(n),(o),(p))} - -#define SECP256K1_GE_STORAGE_CONST_GET(t) SECP256K1_FE_STORAGE_CONST_GET(t.x), SECP256K1_FE_STORAGE_CONST_GET(t.y) - -/** Set a group element equal to the point with given X and Y coordinates */ -static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y); - -/** Set a group element (affine) equal to the point with the given X coordinate - * and a Y coordinate that is a quadratic residue modulo p. The return value - * is true iff a coordinate with the given X coordinate exists. - */ -static int secp256k1_ge_set_xquad(secp256k1_ge *r, const secp256k1_fe *x); - -/** Set a group element (affine) equal to the point with the given X coordinate, and given oddness - * for Y. Return value indicates whether the result is valid. */ -static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd); - -/** Check whether a group element is the point at infinity. */ -static int secp256k1_ge_is_infinity(const secp256k1_ge *a); - -/** Check whether a group element is valid (i.e., on the curve). */ -static int secp256k1_ge_is_valid_var(const secp256k1_ge *a); - -static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a); - -/** Set a group element equal to another which is given in jacobian coordinates */ -static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a); - -/** Set a batch of group elements equal to the inputs given in jacobian coordinates */ -static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len, const secp256k1_callback *cb); - -/** Set a batch of group elements equal to the inputs given in jacobian - * coordinates (with known z-ratios). zr must contain the known z-ratios such - * that mul(a[i].z, zr[i+1]) == a[i+1].z. zr[0] is ignored. */ -static void secp256k1_ge_set_table_gej_var(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zr, size_t len); - -/** Bring a batch inputs given in jacobian coordinates (with known z-ratios) to - * the same global z "denominator". zr must contain the known z-ratios such - * that mul(a[i].z, zr[i+1]) == a[i+1].z. zr[0] is ignored. The x and y - * coordinates of the result are stored in r, the common z coordinate is - * stored in globalz. */ -static void secp256k1_ge_globalz_set_table_gej(size_t len, secp256k1_ge *r, secp256k1_fe *globalz, const secp256k1_gej *a, const secp256k1_fe *zr); - -/** Set a group element (jacobian) equal to the point at infinity. */ -static void secp256k1_gej_set_infinity(secp256k1_gej *r); - -/** Set a group element (jacobian) equal to another which is given in affine coordinates. */ -static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a); - -/** Compare the X coordinate of a group element (jacobian). */ -static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a); - -/** Set r equal to the inverse of a (i.e., mirrored around the X axis) */ -static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a); - -/** Check whether a group element is the point at infinity. */ -static int secp256k1_gej_is_infinity(const secp256k1_gej *a); - -/** Check whether a group element's y coordinate is a quadratic residue. */ -static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a); - -/** Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0). - * a may not be zero. Constant time. */ -static void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr); - -/** Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0). */ -static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr); - -/** Set r equal to the sum of a and b. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case). */ -static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr); - -/** Set r equal to the sum of a and b (with b given in affine coordinates, and not infinity). */ -static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b); - -/** Set r equal to the sum of a and b (with b given in affine coordinates). This is more efficient - than secp256k1_gej_add_var. It is identical to secp256k1_gej_add_ge but without constant-time - guarantee, and b is allowed to be infinity. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case). */ -static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr); - -/** Set r equal to the sum of a and b (with the inverse of b's Z coordinate passed as bzinv). */ -static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv); - -#ifdef USE_ENDOMORPHISM -/** Set r to be equal to lambda times a, where lambda is chosen in a way such that this is very fast. */ -static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a); -#endif - -/** Clear a secp256k1_gej to prevent leaking sensitive information. */ -static void secp256k1_gej_clear(secp256k1_gej *r); - -/** Clear a secp256k1_ge to prevent leaking sensitive information. */ -static void secp256k1_ge_clear(secp256k1_ge *r); - -/** Convert a group element to the storage type. */ -static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a); - -/** Convert a group element back from the storage type. */ -static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a); - -/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. */ -static void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag); - -/** Rescale a jacobian point by b which must be non-zero. Constant-time. */ -static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *b); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h deleted file mode 100644 index 7d723532..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h +++ /dev/null @@ -1,700 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_GROUP_IMPL_H_ -#define _SECP256K1_GROUP_IMPL_H_ - -#include "num.h" -#include "field.h" -#include "group.h" - -/* These points can be generated in sage as follows: - * - * 0. Setup a worksheet with the following parameters. - * b = 4 # whatever CURVE_B will be set to - * F = FiniteField (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F) - * C = EllipticCurve ([F (0), F (b)]) - * - * 1. Determine all the small orders available to you. (If there are - * no satisfactory ones, go back and change b.) - * print C.order().factor(limit=1000) - * - * 2. Choose an order as one of the prime factors listed in the above step. - * (You can also multiply some to get a composite order, though the - * tests will crash trying to invert scalars during signing.) We take a - * random point and scale it to drop its order to the desired value. - * There is some probability this won't work; just try again. - * order = 199 - * P = C.random_point() - * P = (int(P.order()) / int(order)) * P - * assert(P.order() == order) - * - * 3. Print the values. You'll need to use a vim macro or something to - * split the hex output into 4-byte chunks. - * print "%x %x" % P.xy() - */ -#if defined(EXHAUSTIVE_TEST_ORDER) -# if EXHAUSTIVE_TEST_ORDER == 199 -const secp256k1_ge secp256k1_ge_const_g = SECP256K1_GE_CONST( - 0xFA7CC9A7, 0x0737F2DB, 0xA749DD39, 0x2B4FB069, - 0x3B017A7D, 0xA808C2F1, 0xFB12940C, 0x9EA66C18, - 0x78AC123A, 0x5ED8AEF3, 0x8732BC91, 0x1F3A2868, - 0x48DF246C, 0x808DAE72, 0xCFE52572, 0x7F0501ED -); - -const int CURVE_B = 4; -# elif EXHAUSTIVE_TEST_ORDER == 13 -const secp256k1_ge secp256k1_ge_const_g = SECP256K1_GE_CONST( - 0xedc60018, 0xa51a786b, 0x2ea91f4d, 0x4c9416c0, - 0x9de54c3b, 0xa1316554, 0x6cf4345c, 0x7277ef15, - 0x54cb1b6b, 0xdc8c1273, 0x087844ea, 0x43f4603e, - 0x0eaf9a43, 0xf6effe55, 0x939f806d, 0x37adf8ac -); -const int CURVE_B = 2; -# else -# error No known generator for the specified exhaustive test group order. -# endif -#else -/** Generator for secp256k1, value 'g' defined in - * "Standards for Efficient Cryptography" (SEC2) 2.7.1. - */ -static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_GE_CONST( - 0x79BE667EUL, 0xF9DCBBACUL, 0x55A06295UL, 0xCE870B07UL, - 0x029BFCDBUL, 0x2DCE28D9UL, 0x59F2815BUL, 0x16F81798UL, - 0x483ADA77UL, 0x26A3C465UL, 0x5DA4FBFCUL, 0x0E1108A8UL, - 0xFD17B448UL, 0xA6855419UL, 0x9C47D08FUL, 0xFB10D4B8UL -); - -const int CURVE_B = 7; -#endif - -static void secp256k1_ge_set_gej_zinv(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zi) { - secp256k1_fe zi2; - secp256k1_fe zi3; - secp256k1_fe_sqr(&zi2, zi); - secp256k1_fe_mul(&zi3, &zi2, zi); - secp256k1_fe_mul(&r->x, &a->x, &zi2); - secp256k1_fe_mul(&r->y, &a->y, &zi3); - r->infinity = a->infinity; -} - -static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y) { - r->infinity = 0; - r->x = *x; - r->y = *y; -} - -static int secp256k1_ge_is_infinity(const secp256k1_ge *a) { - return a->infinity; -} - -static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a) { - *r = *a; - secp256k1_fe_normalize_weak(&r->y); - secp256k1_fe_negate(&r->y, &r->y, 1); -} - -static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a) { - secp256k1_fe z2, z3; - r->infinity = a->infinity; - secp256k1_fe_inv(&a->z, &a->z); - secp256k1_fe_sqr(&z2, &a->z); - secp256k1_fe_mul(&z3, &a->z, &z2); - secp256k1_fe_mul(&a->x, &a->x, &z2); - secp256k1_fe_mul(&a->y, &a->y, &z3); - secp256k1_fe_set_int(&a->z, 1); - r->x = a->x; - r->y = a->y; -} - -static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a) { - secp256k1_fe z2, z3; - r->infinity = a->infinity; - if (a->infinity) { - return; - } - secp256k1_fe_inv_var(&a->z, &a->z); - secp256k1_fe_sqr(&z2, &a->z); - secp256k1_fe_mul(&z3, &a->z, &z2); - secp256k1_fe_mul(&a->x, &a->x, &z2); - secp256k1_fe_mul(&a->y, &a->y, &z3); - secp256k1_fe_set_int(&a->z, 1); - r->x = a->x; - r->y = a->y; -} - -static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len, const secp256k1_callback *cb) { - secp256k1_fe *az; - secp256k1_fe *azi; - size_t i; - size_t count = 0; - az = (secp256k1_fe *)checked_malloc(cb, sizeof(secp256k1_fe) * len); - for (i = 0; i < len; i++) { - if (!a[i].infinity) { - az[count++] = a[i].z; - } - } - - azi = (secp256k1_fe *)checked_malloc(cb, sizeof(secp256k1_fe) * count); - secp256k1_fe_inv_all_var(azi, az, count); - free(az); - - count = 0; - for (i = 0; i < len; i++) { - r[i].infinity = a[i].infinity; - if (!a[i].infinity) { - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &azi[count++]); - } - } - free(azi); -} - -static void secp256k1_ge_set_table_gej_var(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zr, size_t len) { - size_t i = len - 1; - secp256k1_fe zi; - - if (len > 0) { - /* Compute the inverse of the last z coordinate, and use it to compute the last affine output. */ - secp256k1_fe_inv(&zi, &a[i].z); - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &zi); - - /* Work out way backwards, using the z-ratios to scale the x/y values. */ - while (i > 0) { - secp256k1_fe_mul(&zi, &zi, &zr[i]); - i--; - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &zi); - } - } -} - -static void secp256k1_ge_globalz_set_table_gej(size_t len, secp256k1_ge *r, secp256k1_fe *globalz, const secp256k1_gej *a, const secp256k1_fe *zr) { - size_t i = len - 1; - secp256k1_fe zs; - - if (len > 0) { - /* The z of the final point gives us the "global Z" for the table. */ - r[i].x = a[i].x; - r[i].y = a[i].y; - *globalz = a[i].z; - r[i].infinity = 0; - zs = zr[i]; - - /* Work our way backwards, using the z-ratios to scale the x/y values. */ - while (i > 0) { - if (i != len - 1) { - secp256k1_fe_mul(&zs, &zs, &zr[i]); - } - i--; - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &zs); - } - } -} - -static void secp256k1_gej_set_infinity(secp256k1_gej *r) { - r->infinity = 1; - secp256k1_fe_clear(&r->x); - secp256k1_fe_clear(&r->y); - secp256k1_fe_clear(&r->z); -} - -static void secp256k1_gej_clear(secp256k1_gej *r) { - r->infinity = 0; - secp256k1_fe_clear(&r->x); - secp256k1_fe_clear(&r->y); - secp256k1_fe_clear(&r->z); -} - -static void secp256k1_ge_clear(secp256k1_ge *r) { - r->infinity = 0; - secp256k1_fe_clear(&r->x); - secp256k1_fe_clear(&r->y); -} - -static int secp256k1_ge_set_xquad(secp256k1_ge *r, const secp256k1_fe *x) { - secp256k1_fe x2, x3, c; - r->x = *x; - secp256k1_fe_sqr(&x2, x); - secp256k1_fe_mul(&x3, x, &x2); - r->infinity = 0; - secp256k1_fe_set_int(&c, CURVE_B); - secp256k1_fe_add(&c, &x3); - return secp256k1_fe_sqrt(&r->y, &c); -} - -static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd) { - if (!secp256k1_ge_set_xquad(r, x)) { - return 0; - } - secp256k1_fe_normalize_var(&r->y); - if (secp256k1_fe_is_odd(&r->y) != odd) { - secp256k1_fe_negate(&r->y, &r->y, 1); - } - return 1; - -} - -static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a) { - r->infinity = a->infinity; - r->x = a->x; - r->y = a->y; - secp256k1_fe_set_int(&r->z, 1); -} - -static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a) { - secp256k1_fe r, r2; - VERIFY_CHECK(!a->infinity); - secp256k1_fe_sqr(&r, &a->z); secp256k1_fe_mul(&r, &r, x); - r2 = a->x; secp256k1_fe_normalize_weak(&r2); - return secp256k1_fe_equal_var(&r, &r2); -} - -static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a) { - r->infinity = a->infinity; - r->x = a->x; - r->y = a->y; - r->z = a->z; - secp256k1_fe_normalize_weak(&r->y); - secp256k1_fe_negate(&r->y, &r->y, 1); -} - -static int secp256k1_gej_is_infinity(const secp256k1_gej *a) { - return a->infinity; -} - -static int secp256k1_gej_is_valid_var(const secp256k1_gej *a) { - secp256k1_fe y2, x3, z2, z6; - if (a->infinity) { - return 0; - } - /** y^2 = x^3 + 7 - * (Y/Z^3)^2 = (X/Z^2)^3 + 7 - * Y^2 / Z^6 = X^3 / Z^6 + 7 - * Y^2 = X^3 + 7*Z^6 - */ - secp256k1_fe_sqr(&y2, &a->y); - secp256k1_fe_sqr(&x3, &a->x); secp256k1_fe_mul(&x3, &x3, &a->x); - secp256k1_fe_sqr(&z2, &a->z); - secp256k1_fe_sqr(&z6, &z2); secp256k1_fe_mul(&z6, &z6, &z2); - secp256k1_fe_mul_int(&z6, CURVE_B); - secp256k1_fe_add(&x3, &z6); - secp256k1_fe_normalize_weak(&x3); - return secp256k1_fe_equal_var(&y2, &x3); -} - -static int secp256k1_ge_is_valid_var(const secp256k1_ge *a) { - secp256k1_fe y2, x3, c; - if (a->infinity) { - return 0; - } - /* y^2 = x^3 + 7 */ - secp256k1_fe_sqr(&y2, &a->y); - secp256k1_fe_sqr(&x3, &a->x); secp256k1_fe_mul(&x3, &x3, &a->x); - secp256k1_fe_set_int(&c, CURVE_B); - secp256k1_fe_add(&x3, &c); - secp256k1_fe_normalize_weak(&x3); - return secp256k1_fe_equal_var(&y2, &x3); -} - -static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr) { - /* Operations: 3 mul, 4 sqr, 0 normalize, 12 mul_int/add/negate. - * - * Note that there is an implementation described at - * https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l - * which trades a multiply for a square, but in practice this is actually slower, - * mainly because it requires more normalizations. - */ - secp256k1_fe t1,t2,t3,t4; - /** For secp256k1, 2Q is infinity if and only if Q is infinity. This is because if 2Q = infinity, - * Q must equal -Q, or that Q.y == -(Q.y), or Q.y is 0. For a point on y^2 = x^3 + 7 to have - * y=0, x^3 must be -7 mod p. However, -7 has no cube root mod p. - * - * Having said this, if this function receives a point on a sextic twist, e.g. by - * a fault attack, it is possible for y to be 0. This happens for y^2 = x^3 + 6, - * since -6 does have a cube root mod p. For this point, this function will not set - * the infinity flag even though the point doubles to infinity, and the result - * point will be gibberish (z = 0 but infinity = 0). - */ - r->infinity = a->infinity; - if (r->infinity) { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 1); - } - return; - } - - if (rzr != NULL) { - *rzr = a->y; - secp256k1_fe_normalize_weak(rzr); - secp256k1_fe_mul_int(rzr, 2); - } - - secp256k1_fe_mul(&r->z, &a->z, &a->y); - secp256k1_fe_mul_int(&r->z, 2); /* Z' = 2*Y*Z (2) */ - secp256k1_fe_sqr(&t1, &a->x); - secp256k1_fe_mul_int(&t1, 3); /* T1 = 3*X^2 (3) */ - secp256k1_fe_sqr(&t2, &t1); /* T2 = 9*X^4 (1) */ - secp256k1_fe_sqr(&t3, &a->y); - secp256k1_fe_mul_int(&t3, 2); /* T3 = 2*Y^2 (2) */ - secp256k1_fe_sqr(&t4, &t3); - secp256k1_fe_mul_int(&t4, 2); /* T4 = 8*Y^4 (2) */ - secp256k1_fe_mul(&t3, &t3, &a->x); /* T3 = 2*X*Y^2 (1) */ - r->x = t3; - secp256k1_fe_mul_int(&r->x, 4); /* X' = 8*X*Y^2 (4) */ - secp256k1_fe_negate(&r->x, &r->x, 4); /* X' = -8*X*Y^2 (5) */ - secp256k1_fe_add(&r->x, &t2); /* X' = 9*X^4 - 8*X*Y^2 (6) */ - secp256k1_fe_negate(&t2, &t2, 1); /* T2 = -9*X^4 (2) */ - secp256k1_fe_mul_int(&t3, 6); /* T3 = 12*X*Y^2 (6) */ - secp256k1_fe_add(&t3, &t2); /* T3 = 12*X*Y^2 - 9*X^4 (8) */ - secp256k1_fe_mul(&r->y, &t1, &t3); /* Y' = 36*X^3*Y^2 - 27*X^6 (1) */ - secp256k1_fe_negate(&t2, &t4, 2); /* T2 = -8*Y^4 (3) */ - secp256k1_fe_add(&r->y, &t2); /* Y' = 36*X^3*Y^2 - 27*X^6 - 8*Y^4 (4) */ -} - -static SECP256K1_INLINE void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr) { - VERIFY_CHECK(!secp256k1_gej_is_infinity(a)); - secp256k1_gej_double_var(r, a, rzr); -} - -static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr) { - /* Operations: 12 mul, 4 sqr, 2 normalize, 12 mul_int/add/negate */ - secp256k1_fe z22, z12, u1, u2, s1, s2, h, i, i2, h2, h3, t; - - if (a->infinity) { - VERIFY_CHECK(rzr == NULL); - *r = *b; - return; - } - - if (b->infinity) { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 1); - } - *r = *a; - return; - } - - r->infinity = 0; - secp256k1_fe_sqr(&z22, &b->z); - secp256k1_fe_sqr(&z12, &a->z); - secp256k1_fe_mul(&u1, &a->x, &z22); - secp256k1_fe_mul(&u2, &b->x, &z12); - secp256k1_fe_mul(&s1, &a->y, &z22); secp256k1_fe_mul(&s1, &s1, &b->z); - secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &a->z); - secp256k1_fe_negate(&h, &u1, 1); secp256k1_fe_add(&h, &u2); - secp256k1_fe_negate(&i, &s1, 1); secp256k1_fe_add(&i, &s2); - if (secp256k1_fe_normalizes_to_zero_var(&h)) { - if (secp256k1_fe_normalizes_to_zero_var(&i)) { - secp256k1_gej_double_var(r, a, rzr); - } else { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 0); - } - r->infinity = 1; - } - return; - } - secp256k1_fe_sqr(&i2, &i); - secp256k1_fe_sqr(&h2, &h); - secp256k1_fe_mul(&h3, &h, &h2); - secp256k1_fe_mul(&h, &h, &b->z); - if (rzr != NULL) { - *rzr = h; - } - secp256k1_fe_mul(&r->z, &a->z, &h); - secp256k1_fe_mul(&t, &u1, &h2); - r->x = t; secp256k1_fe_mul_int(&r->x, 2); secp256k1_fe_add(&r->x, &h3); secp256k1_fe_negate(&r->x, &r->x, 3); secp256k1_fe_add(&r->x, &i2); - secp256k1_fe_negate(&r->y, &r->x, 5); secp256k1_fe_add(&r->y, &t); secp256k1_fe_mul(&r->y, &r->y, &i); - secp256k1_fe_mul(&h3, &h3, &s1); secp256k1_fe_negate(&h3, &h3, 1); - secp256k1_fe_add(&r->y, &h3); -} - -static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr) { - /* 8 mul, 3 sqr, 4 normalize, 12 mul_int/add/negate */ - secp256k1_fe z12, u1, u2, s1, s2, h, i, i2, h2, h3, t; - if (a->infinity) { - VERIFY_CHECK(rzr == NULL); - secp256k1_gej_set_ge(r, b); - return; - } - if (b->infinity) { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 1); - } - *r = *a; - return; - } - r->infinity = 0; - - secp256k1_fe_sqr(&z12, &a->z); - u1 = a->x; secp256k1_fe_normalize_weak(&u1); - secp256k1_fe_mul(&u2, &b->x, &z12); - s1 = a->y; secp256k1_fe_normalize_weak(&s1); - secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &a->z); - secp256k1_fe_negate(&h, &u1, 1); secp256k1_fe_add(&h, &u2); - secp256k1_fe_negate(&i, &s1, 1); secp256k1_fe_add(&i, &s2); - if (secp256k1_fe_normalizes_to_zero_var(&h)) { - if (secp256k1_fe_normalizes_to_zero_var(&i)) { - secp256k1_gej_double_var(r, a, rzr); - } else { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 0); - } - r->infinity = 1; - } - return; - } - secp256k1_fe_sqr(&i2, &i); - secp256k1_fe_sqr(&h2, &h); - secp256k1_fe_mul(&h3, &h, &h2); - if (rzr != NULL) { - *rzr = h; - } - secp256k1_fe_mul(&r->z, &a->z, &h); - secp256k1_fe_mul(&t, &u1, &h2); - r->x = t; secp256k1_fe_mul_int(&r->x, 2); secp256k1_fe_add(&r->x, &h3); secp256k1_fe_negate(&r->x, &r->x, 3); secp256k1_fe_add(&r->x, &i2); - secp256k1_fe_negate(&r->y, &r->x, 5); secp256k1_fe_add(&r->y, &t); secp256k1_fe_mul(&r->y, &r->y, &i); - secp256k1_fe_mul(&h3, &h3, &s1); secp256k1_fe_negate(&h3, &h3, 1); - secp256k1_fe_add(&r->y, &h3); -} - -static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv) { - /* 9 mul, 3 sqr, 4 normalize, 12 mul_int/add/negate */ - secp256k1_fe az, z12, u1, u2, s1, s2, h, i, i2, h2, h3, t; - - if (b->infinity) { - *r = *a; - return; - } - if (a->infinity) { - secp256k1_fe bzinv2, bzinv3; - r->infinity = b->infinity; - secp256k1_fe_sqr(&bzinv2, bzinv); - secp256k1_fe_mul(&bzinv3, &bzinv2, bzinv); - secp256k1_fe_mul(&r->x, &b->x, &bzinv2); - secp256k1_fe_mul(&r->y, &b->y, &bzinv3); - secp256k1_fe_set_int(&r->z, 1); - return; - } - r->infinity = 0; - - /** We need to calculate (rx,ry,rz) = (ax,ay,az) + (bx,by,1/bzinv). Due to - * secp256k1's isomorphism we can multiply the Z coordinates on both sides - * by bzinv, and get: (rx,ry,rz*bzinv) = (ax,ay,az*bzinv) + (bx,by,1). - * This means that (rx,ry,rz) can be calculated as - * (ax,ay,az*bzinv) + (bx,by,1), when not applying the bzinv factor to rz. - * The variable az below holds the modified Z coordinate for a, which is used - * for the computation of rx and ry, but not for rz. - */ - secp256k1_fe_mul(&az, &a->z, bzinv); - - secp256k1_fe_sqr(&z12, &az); - u1 = a->x; secp256k1_fe_normalize_weak(&u1); - secp256k1_fe_mul(&u2, &b->x, &z12); - s1 = a->y; secp256k1_fe_normalize_weak(&s1); - secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &az); - secp256k1_fe_negate(&h, &u1, 1); secp256k1_fe_add(&h, &u2); - secp256k1_fe_negate(&i, &s1, 1); secp256k1_fe_add(&i, &s2); - if (secp256k1_fe_normalizes_to_zero_var(&h)) { - if (secp256k1_fe_normalizes_to_zero_var(&i)) { - secp256k1_gej_double_var(r, a, NULL); - } else { - r->infinity = 1; - } - return; - } - secp256k1_fe_sqr(&i2, &i); - secp256k1_fe_sqr(&h2, &h); - secp256k1_fe_mul(&h3, &h, &h2); - r->z = a->z; secp256k1_fe_mul(&r->z, &r->z, &h); - secp256k1_fe_mul(&t, &u1, &h2); - r->x = t; secp256k1_fe_mul_int(&r->x, 2); secp256k1_fe_add(&r->x, &h3); secp256k1_fe_negate(&r->x, &r->x, 3); secp256k1_fe_add(&r->x, &i2); - secp256k1_fe_negate(&r->y, &r->x, 5); secp256k1_fe_add(&r->y, &t); secp256k1_fe_mul(&r->y, &r->y, &i); - secp256k1_fe_mul(&h3, &h3, &s1); secp256k1_fe_negate(&h3, &h3, 1); - secp256k1_fe_add(&r->y, &h3); -} - - -static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b) { - /* Operations: 7 mul, 5 sqr, 4 normalize, 21 mul_int/add/negate/cmov */ - static const secp256k1_fe fe_1 = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_fe zz, u1, u2, s1, s2, t, tt, m, n, q, rr; - secp256k1_fe m_alt, rr_alt; - int infinity, degenerate; - VERIFY_CHECK(!b->infinity); - VERIFY_CHECK(a->infinity == 0 || a->infinity == 1); - - /** In: - * Eric Brier and Marc Joye, Weierstrass Elliptic Curves and Side-Channel Attacks. - * In D. Naccache and P. Paillier, Eds., Public Key Cryptography, vol. 2274 of Lecture Notes in Computer Science, pages 335-345. Springer-Verlag, 2002. - * we find as solution for a unified addition/doubling formula: - * lambda = ((x1 + x2)^2 - x1 * x2 + a) / (y1 + y2), with a = 0 for secp256k1's curve equation. - * x3 = lambda^2 - (x1 + x2) - * 2*y3 = lambda * (x1 + x2 - 2 * x3) - (y1 + y2). - * - * Substituting x_i = Xi / Zi^2 and yi = Yi / Zi^3, for i=1,2,3, gives: - * U1 = X1*Z2^2, U2 = X2*Z1^2 - * S1 = Y1*Z2^3, S2 = Y2*Z1^3 - * Z = Z1*Z2 - * T = U1+U2 - * M = S1+S2 - * Q = T*M^2 - * R = T^2-U1*U2 - * X3 = 4*(R^2-Q) - * Y3 = 4*(R*(3*Q-2*R^2)-M^4) - * Z3 = 2*M*Z - * (Note that the paper uses xi = Xi / Zi and yi = Yi / Zi instead.) - * - * This formula has the benefit of being the same for both addition - * of distinct points and doubling. However, it breaks down in the - * case that either point is infinity, or that y1 = -y2. We handle - * these cases in the following ways: - * - * - If b is infinity we simply bail by means of a VERIFY_CHECK. - * - * - If a is infinity, we detect this, and at the end of the - * computation replace the result (which will be meaningless, - * but we compute to be constant-time) with b.x : b.y : 1. - * - * - If a = -b, we have y1 = -y2, which is a degenerate case. - * But here the answer is infinity, so we simply set the - * infinity flag of the result, overriding the computed values - * without even needing to cmov. - * - * - If y1 = -y2 but x1 != x2, which does occur thanks to certain - * properties of our curve (specifically, 1 has nontrivial cube - * roots in our field, and the curve equation has no x coefficient) - * then the answer is not infinity but also not given by the above - * equation. In this case, we cmov in place an alternate expression - * for lambda. Specifically (y1 - y2)/(x1 - x2). Where both these - * expressions for lambda are defined, they are equal, and can be - * obtained from each other by multiplication by (y1 + y2)/(y1 + y2) - * then substitution of x^3 + 7 for y^2 (using the curve equation). - * For all pairs of nonzero points (a, b) at least one is defined, - * so this covers everything. - */ - - secp256k1_fe_sqr(&zz, &a->z); /* z = Z1^2 */ - u1 = a->x; secp256k1_fe_normalize_weak(&u1); /* u1 = U1 = X1*Z2^2 (1) */ - secp256k1_fe_mul(&u2, &b->x, &zz); /* u2 = U2 = X2*Z1^2 (1) */ - s1 = a->y; secp256k1_fe_normalize_weak(&s1); /* s1 = S1 = Y1*Z2^3 (1) */ - secp256k1_fe_mul(&s2, &b->y, &zz); /* s2 = Y2*Z1^2 (1) */ - secp256k1_fe_mul(&s2, &s2, &a->z); /* s2 = S2 = Y2*Z1^3 (1) */ - t = u1; secp256k1_fe_add(&t, &u2); /* t = T = U1+U2 (2) */ - m = s1; secp256k1_fe_add(&m, &s2); /* m = M = S1+S2 (2) */ - secp256k1_fe_sqr(&rr, &t); /* rr = T^2 (1) */ - secp256k1_fe_negate(&m_alt, &u2, 1); /* Malt = -X2*Z1^2 */ - secp256k1_fe_mul(&tt, &u1, &m_alt); /* tt = -U1*U2 (2) */ - secp256k1_fe_add(&rr, &tt); /* rr = R = T^2-U1*U2 (3) */ - /** If lambda = R/M = 0/0 we have a problem (except in the "trivial" - * case that Z = z1z2 = 0, and this is special-cased later on). */ - degenerate = secp256k1_fe_normalizes_to_zero(&m) & - secp256k1_fe_normalizes_to_zero(&rr); - /* This only occurs when y1 == -y2 and x1^3 == x2^3, but x1 != x2. - * This means either x1 == beta*x2 or beta*x1 == x2, where beta is - * a nontrivial cube root of one. In either case, an alternate - * non-indeterminate expression for lambda is (y1 - y2)/(x1 - x2), - * so we set R/M equal to this. */ - rr_alt = s1; - secp256k1_fe_mul_int(&rr_alt, 2); /* rr = Y1*Z2^3 - Y2*Z1^3 (2) */ - secp256k1_fe_add(&m_alt, &u1); /* Malt = X1*Z2^2 - X2*Z1^2 */ - - secp256k1_fe_cmov(&rr_alt, &rr, !degenerate); - secp256k1_fe_cmov(&m_alt, &m, !degenerate); - /* Now Ralt / Malt = lambda and is guaranteed not to be 0/0. - * From here on out Ralt and Malt represent the numerator - * and denominator of lambda; R and M represent the explicit - * expressions x1^2 + x2^2 + x1x2 and y1 + y2. */ - secp256k1_fe_sqr(&n, &m_alt); /* n = Malt^2 (1) */ - secp256k1_fe_mul(&q, &n, &t); /* q = Q = T*Malt^2 (1) */ - /* These two lines use the observation that either M == Malt or M == 0, - * so M^3 * Malt is either Malt^4 (which is computed by squaring), or - * zero (which is "computed" by cmov). So the cost is one squaring - * versus two multiplications. */ - secp256k1_fe_sqr(&n, &n); - secp256k1_fe_cmov(&n, &m, degenerate); /* n = M^3 * Malt (2) */ - secp256k1_fe_sqr(&t, &rr_alt); /* t = Ralt^2 (1) */ - secp256k1_fe_mul(&r->z, &a->z, &m_alt); /* r->z = Malt*Z (1) */ - infinity = secp256k1_fe_normalizes_to_zero(&r->z) * (1 - a->infinity); - secp256k1_fe_mul_int(&r->z, 2); /* r->z = Z3 = 2*Malt*Z (2) */ - secp256k1_fe_negate(&q, &q, 1); /* q = -Q (2) */ - secp256k1_fe_add(&t, &q); /* t = Ralt^2-Q (3) */ - secp256k1_fe_normalize_weak(&t); - r->x = t; /* r->x = Ralt^2-Q (1) */ - secp256k1_fe_mul_int(&t, 2); /* t = 2*x3 (2) */ - secp256k1_fe_add(&t, &q); /* t = 2*x3 - Q: (4) */ - secp256k1_fe_mul(&t, &t, &rr_alt); /* t = Ralt*(2*x3 - Q) (1) */ - secp256k1_fe_add(&t, &n); /* t = Ralt*(2*x3 - Q) + M^3*Malt (3) */ - secp256k1_fe_negate(&r->y, &t, 3); /* r->y = Ralt*(Q - 2x3) - M^3*Malt (4) */ - secp256k1_fe_normalize_weak(&r->y); - secp256k1_fe_mul_int(&r->x, 4); /* r->x = X3 = 4*(Ralt^2-Q) */ - secp256k1_fe_mul_int(&r->y, 4); /* r->y = Y3 = 4*Ralt*(Q - 2x3) - 4*M^3*Malt (4) */ - - /** In case a->infinity == 1, replace r with (b->x, b->y, 1). */ - secp256k1_fe_cmov(&r->x, &b->x, a->infinity); - secp256k1_fe_cmov(&r->y, &b->y, a->infinity); - secp256k1_fe_cmov(&r->z, &fe_1, a->infinity); - r->infinity = infinity; -} - -static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *s) { - /* Operations: 4 mul, 1 sqr */ - secp256k1_fe zz; - VERIFY_CHECK(!secp256k1_fe_is_zero(s)); - secp256k1_fe_sqr(&zz, s); - secp256k1_fe_mul(&r->x, &r->x, &zz); /* r->x *= s^2 */ - secp256k1_fe_mul(&r->y, &r->y, &zz); - secp256k1_fe_mul(&r->y, &r->y, s); /* r->y *= s^3 */ - secp256k1_fe_mul(&r->z, &r->z, s); /* r->z *= s */ -} - -static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a) { - secp256k1_fe x, y; - VERIFY_CHECK(!a->infinity); - x = a->x; - secp256k1_fe_normalize(&x); - y = a->y; - secp256k1_fe_normalize(&y); - secp256k1_fe_to_storage(&r->x, &x); - secp256k1_fe_to_storage(&r->y, &y); -} - -static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a) { - secp256k1_fe_from_storage(&r->x, &a->x); - secp256k1_fe_from_storage(&r->y, &a->y); - r->infinity = 0; -} - -static SECP256K1_INLINE void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag) { - secp256k1_fe_storage_cmov(&r->x, &a->x, flag); - secp256k1_fe_storage_cmov(&r->y, &a->y, flag); -} - -#ifdef USE_ENDOMORPHISM -static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a) { - static const secp256k1_fe beta = SECP256K1_FE_CONST( - 0x7ae96a2bul, 0x657c0710ul, 0x6e64479eul, 0xac3434e9ul, - 0x9cf04975ul, 0x12f58995ul, 0xc1396c28ul, 0x719501eeul - ); - *r = *a; - secp256k1_fe_mul(&r->x, &r->x, &beta); -} -#endif - -static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a) { - secp256k1_fe yz; - - if (a->infinity) { - return 0; - } - - /* We rely on the fact that the Jacobi symbol of 1 / a->z^3 is the same as - * that of a->z. Thus a->y / a->z^3 is a quadratic residue iff a->y * a->z - is */ - secp256k1_fe_mul(&yz, &a->y, &a->z); - return secp256k1_fe_is_quad_var(&yz); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h deleted file mode 100644 index fca98cab..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h +++ /dev/null @@ -1,41 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_HASH_ -#define _SECP256K1_HASH_ - -#include -#include - -typedef struct { - uint32_t s[8]; - uint32_t buf[16]; /* In big endian */ - size_t bytes; -} secp256k1_sha256_t; - -static void secp256k1_sha256_initialize(secp256k1_sha256_t *hash); -static void secp256k1_sha256_write(secp256k1_sha256_t *hash, const unsigned char *data, size_t size); -static void secp256k1_sha256_finalize(secp256k1_sha256_t *hash, unsigned char *out32); - -typedef struct { - secp256k1_sha256_t inner, outer; -} secp256k1_hmac_sha256_t; - -static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256_t *hash, const unsigned char *key, size_t size); -static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256_t *hash, const unsigned char *data, size_t size); -static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256_t *hash, unsigned char *out32); - -typedef struct { - unsigned char v[32]; - unsigned char k[32]; - int retry; -} secp256k1_rfc6979_hmac_sha256_t; - -static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256_t *rng, const unsigned char *key, size_t keylen); -static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256_t *rng, unsigned char *out, size_t outlen); -static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256_t *rng); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h deleted file mode 100644 index b47e65f8..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h +++ /dev/null @@ -1,281 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_HASH_IMPL_H_ -#define _SECP256K1_HASH_IMPL_H_ - -#include "hash.h" - -#include -#include -#include - -#define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) -#define Maj(x,y,z) (((x) & (y)) | ((z) & ((x) | (y)))) -#define Sigma0(x) (((x) >> 2 | (x) << 30) ^ ((x) >> 13 | (x) << 19) ^ ((x) >> 22 | (x) << 10)) -#define Sigma1(x) (((x) >> 6 | (x) << 26) ^ ((x) >> 11 | (x) << 21) ^ ((x) >> 25 | (x) << 7)) -#define sigma0(x) (((x) >> 7 | (x) << 25) ^ ((x) >> 18 | (x) << 14) ^ ((x) >> 3)) -#define sigma1(x) (((x) >> 17 | (x) << 15) ^ ((x) >> 19 | (x) << 13) ^ ((x) >> 10)) - -#define Round(a,b,c,d,e,f,g,h,k,w) do { \ - uint32_t t1 = (h) + Sigma1(e) + Ch((e), (f), (g)) + (k) + (w); \ - uint32_t t2 = Sigma0(a) + Maj((a), (b), (c)); \ - (d) += t1; \ - (h) = t1 + t2; \ -} while(0) - -#ifdef WORDS_BIGENDIAN -#define BE32(x) (x) -#else -#define BE32(p) ((((p) & 0xFF) << 24) | (((p) & 0xFF00) << 8) | (((p) & 0xFF0000) >> 8) | (((p) & 0xFF000000) >> 24)) -#endif - -static void secp256k1_sha256_initialize(secp256k1_sha256_t *hash) { - hash->s[0] = 0x6a09e667ul; - hash->s[1] = 0xbb67ae85ul; - hash->s[2] = 0x3c6ef372ul; - hash->s[3] = 0xa54ff53aul; - hash->s[4] = 0x510e527ful; - hash->s[5] = 0x9b05688cul; - hash->s[6] = 0x1f83d9abul; - hash->s[7] = 0x5be0cd19ul; - hash->bytes = 0; -} - -/** Perform one SHA-256 transformation, processing 16 big endian 32-bit words. */ -static void secp256k1_sha256_transform(uint32_t* s, const uint32_t* chunk) { - uint32_t a = s[0], b = s[1], c = s[2], d = s[3], e = s[4], f = s[5], g = s[6], h = s[7]; - uint32_t w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15; - - Round(a, b, c, d, e, f, g, h, 0x428a2f98, w0 = BE32(chunk[0])); - Round(h, a, b, c, d, e, f, g, 0x71374491, w1 = BE32(chunk[1])); - Round(g, h, a, b, c, d, e, f, 0xb5c0fbcf, w2 = BE32(chunk[2])); - Round(f, g, h, a, b, c, d, e, 0xe9b5dba5, w3 = BE32(chunk[3])); - Round(e, f, g, h, a, b, c, d, 0x3956c25b, w4 = BE32(chunk[4])); - Round(d, e, f, g, h, a, b, c, 0x59f111f1, w5 = BE32(chunk[5])); - Round(c, d, e, f, g, h, a, b, 0x923f82a4, w6 = BE32(chunk[6])); - Round(b, c, d, e, f, g, h, a, 0xab1c5ed5, w7 = BE32(chunk[7])); - Round(a, b, c, d, e, f, g, h, 0xd807aa98, w8 = BE32(chunk[8])); - Round(h, a, b, c, d, e, f, g, 0x12835b01, w9 = BE32(chunk[9])); - Round(g, h, a, b, c, d, e, f, 0x243185be, w10 = BE32(chunk[10])); - Round(f, g, h, a, b, c, d, e, 0x550c7dc3, w11 = BE32(chunk[11])); - Round(e, f, g, h, a, b, c, d, 0x72be5d74, w12 = BE32(chunk[12])); - Round(d, e, f, g, h, a, b, c, 0x80deb1fe, w13 = BE32(chunk[13])); - Round(c, d, e, f, g, h, a, b, 0x9bdc06a7, w14 = BE32(chunk[14])); - Round(b, c, d, e, f, g, h, a, 0xc19bf174, w15 = BE32(chunk[15])); - - Round(a, b, c, d, e, f, g, h, 0xe49b69c1, w0 += sigma1(w14) + w9 + sigma0(w1)); - Round(h, a, b, c, d, e, f, g, 0xefbe4786, w1 += sigma1(w15) + w10 + sigma0(w2)); - Round(g, h, a, b, c, d, e, f, 0x0fc19dc6, w2 += sigma1(w0) + w11 + sigma0(w3)); - Round(f, g, h, a, b, c, d, e, 0x240ca1cc, w3 += sigma1(w1) + w12 + sigma0(w4)); - Round(e, f, g, h, a, b, c, d, 0x2de92c6f, w4 += sigma1(w2) + w13 + sigma0(w5)); - Round(d, e, f, g, h, a, b, c, 0x4a7484aa, w5 += sigma1(w3) + w14 + sigma0(w6)); - Round(c, d, e, f, g, h, a, b, 0x5cb0a9dc, w6 += sigma1(w4) + w15 + sigma0(w7)); - Round(b, c, d, e, f, g, h, a, 0x76f988da, w7 += sigma1(w5) + w0 + sigma0(w8)); - Round(a, b, c, d, e, f, g, h, 0x983e5152, w8 += sigma1(w6) + w1 + sigma0(w9)); - Round(h, a, b, c, d, e, f, g, 0xa831c66d, w9 += sigma1(w7) + w2 + sigma0(w10)); - Round(g, h, a, b, c, d, e, f, 0xb00327c8, w10 += sigma1(w8) + w3 + sigma0(w11)); - Round(f, g, h, a, b, c, d, e, 0xbf597fc7, w11 += sigma1(w9) + w4 + sigma0(w12)); - Round(e, f, g, h, a, b, c, d, 0xc6e00bf3, w12 += sigma1(w10) + w5 + sigma0(w13)); - Round(d, e, f, g, h, a, b, c, 0xd5a79147, w13 += sigma1(w11) + w6 + sigma0(w14)); - Round(c, d, e, f, g, h, a, b, 0x06ca6351, w14 += sigma1(w12) + w7 + sigma0(w15)); - Round(b, c, d, e, f, g, h, a, 0x14292967, w15 += sigma1(w13) + w8 + sigma0(w0)); - - Round(a, b, c, d, e, f, g, h, 0x27b70a85, w0 += sigma1(w14) + w9 + sigma0(w1)); - Round(h, a, b, c, d, e, f, g, 0x2e1b2138, w1 += sigma1(w15) + w10 + sigma0(w2)); - Round(g, h, a, b, c, d, e, f, 0x4d2c6dfc, w2 += sigma1(w0) + w11 + sigma0(w3)); - Round(f, g, h, a, b, c, d, e, 0x53380d13, w3 += sigma1(w1) + w12 + sigma0(w4)); - Round(e, f, g, h, a, b, c, d, 0x650a7354, w4 += sigma1(w2) + w13 + sigma0(w5)); - Round(d, e, f, g, h, a, b, c, 0x766a0abb, w5 += sigma1(w3) + w14 + sigma0(w6)); - Round(c, d, e, f, g, h, a, b, 0x81c2c92e, w6 += sigma1(w4) + w15 + sigma0(w7)); - Round(b, c, d, e, f, g, h, a, 0x92722c85, w7 += sigma1(w5) + w0 + sigma0(w8)); - Round(a, b, c, d, e, f, g, h, 0xa2bfe8a1, w8 += sigma1(w6) + w1 + sigma0(w9)); - Round(h, a, b, c, d, e, f, g, 0xa81a664b, w9 += sigma1(w7) + w2 + sigma0(w10)); - Round(g, h, a, b, c, d, e, f, 0xc24b8b70, w10 += sigma1(w8) + w3 + sigma0(w11)); - Round(f, g, h, a, b, c, d, e, 0xc76c51a3, w11 += sigma1(w9) + w4 + sigma0(w12)); - Round(e, f, g, h, a, b, c, d, 0xd192e819, w12 += sigma1(w10) + w5 + sigma0(w13)); - Round(d, e, f, g, h, a, b, c, 0xd6990624, w13 += sigma1(w11) + w6 + sigma0(w14)); - Round(c, d, e, f, g, h, a, b, 0xf40e3585, w14 += sigma1(w12) + w7 + sigma0(w15)); - Round(b, c, d, e, f, g, h, a, 0x106aa070, w15 += sigma1(w13) + w8 + sigma0(w0)); - - Round(a, b, c, d, e, f, g, h, 0x19a4c116, w0 += sigma1(w14) + w9 + sigma0(w1)); - Round(h, a, b, c, d, e, f, g, 0x1e376c08, w1 += sigma1(w15) + w10 + sigma0(w2)); - Round(g, h, a, b, c, d, e, f, 0x2748774c, w2 += sigma1(w0) + w11 + sigma0(w3)); - Round(f, g, h, a, b, c, d, e, 0x34b0bcb5, w3 += sigma1(w1) + w12 + sigma0(w4)); - Round(e, f, g, h, a, b, c, d, 0x391c0cb3, w4 += sigma1(w2) + w13 + sigma0(w5)); - Round(d, e, f, g, h, a, b, c, 0x4ed8aa4a, w5 += sigma1(w3) + w14 + sigma0(w6)); - Round(c, d, e, f, g, h, a, b, 0x5b9cca4f, w6 += sigma1(w4) + w15 + sigma0(w7)); - Round(b, c, d, e, f, g, h, a, 0x682e6ff3, w7 += sigma1(w5) + w0 + sigma0(w8)); - Round(a, b, c, d, e, f, g, h, 0x748f82ee, w8 += sigma1(w6) + w1 + sigma0(w9)); - Round(h, a, b, c, d, e, f, g, 0x78a5636f, w9 += sigma1(w7) + w2 + sigma0(w10)); - Round(g, h, a, b, c, d, e, f, 0x84c87814, w10 += sigma1(w8) + w3 + sigma0(w11)); - Round(f, g, h, a, b, c, d, e, 0x8cc70208, w11 += sigma1(w9) + w4 + sigma0(w12)); - Round(e, f, g, h, a, b, c, d, 0x90befffa, w12 += sigma1(w10) + w5 + sigma0(w13)); - Round(d, e, f, g, h, a, b, c, 0xa4506ceb, w13 += sigma1(w11) + w6 + sigma0(w14)); - Round(c, d, e, f, g, h, a, b, 0xbef9a3f7, w14 + sigma1(w12) + w7 + sigma0(w15)); - Round(b, c, d, e, f, g, h, a, 0xc67178f2, w15 + sigma1(w13) + w8 + sigma0(w0)); - - s[0] += a; - s[1] += b; - s[2] += c; - s[3] += d; - s[4] += e; - s[5] += f; - s[6] += g; - s[7] += h; -} - -static void secp256k1_sha256_write(secp256k1_sha256_t *hash, const unsigned char *data, size_t len) { - size_t bufsize = hash->bytes & 0x3F; - hash->bytes += len; - while (bufsize + len >= 64) { - /* Fill the buffer, and process it. */ - memcpy(((unsigned char*)hash->buf) + bufsize, data, 64 - bufsize); - data += 64 - bufsize; - len -= 64 - bufsize; - secp256k1_sha256_transform(hash->s, hash->buf); - bufsize = 0; - } - if (len) { - /* Fill the buffer with what remains. */ - memcpy(((unsigned char*)hash->buf) + bufsize, data, len); - } -} - -static void secp256k1_sha256_finalize(secp256k1_sha256_t *hash, unsigned char *out32) { - static const unsigned char pad[64] = {0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - uint32_t sizedesc[2]; - uint32_t out[8]; - int i = 0; - sizedesc[0] = BE32(hash->bytes >> 29); - sizedesc[1] = BE32(hash->bytes << 3); - secp256k1_sha256_write(hash, pad, 1 + ((119 - (hash->bytes % 64)) % 64)); - secp256k1_sha256_write(hash, (const unsigned char*)sizedesc, 8); - for (i = 0; i < 8; i++) { - out[i] = BE32(hash->s[i]); - hash->s[i] = 0; - } - memcpy(out32, (const unsigned char*)out, 32); -} - -static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256_t *hash, const unsigned char *key, size_t keylen) { - int n; - unsigned char rkey[64]; - if (keylen <= 64) { - memcpy(rkey, key, keylen); - memset(rkey + keylen, 0, 64 - keylen); - } else { - secp256k1_sha256_t sha256; - secp256k1_sha256_initialize(&sha256); - secp256k1_sha256_write(&sha256, key, keylen); - secp256k1_sha256_finalize(&sha256, rkey); - memset(rkey + 32, 0, 32); - } - - secp256k1_sha256_initialize(&hash->outer); - for (n = 0; n < 64; n++) { - rkey[n] ^= 0x5c; - } - secp256k1_sha256_write(&hash->outer, rkey, 64); - - secp256k1_sha256_initialize(&hash->inner); - for (n = 0; n < 64; n++) { - rkey[n] ^= 0x5c ^ 0x36; - } - secp256k1_sha256_write(&hash->inner, rkey, 64); - memset(rkey, 0, 64); -} - -static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256_t *hash, const unsigned char *data, size_t size) { - secp256k1_sha256_write(&hash->inner, data, size); -} - -static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256_t *hash, unsigned char *out32) { - unsigned char temp[32]; - secp256k1_sha256_finalize(&hash->inner, temp); - secp256k1_sha256_write(&hash->outer, temp, 32); - memset(temp, 0, 32); - secp256k1_sha256_finalize(&hash->outer, out32); -} - - -static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256_t *rng, const unsigned char *key, size_t keylen) { - secp256k1_hmac_sha256_t hmac; - static const unsigned char zero[1] = {0x00}; - static const unsigned char one[1] = {0x01}; - - memset(rng->v, 0x01, 32); /* RFC6979 3.2.b. */ - memset(rng->k, 0x00, 32); /* RFC6979 3.2.c. */ - - /* RFC6979 3.2.d. */ - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_write(&hmac, zero, 1); - secp256k1_hmac_sha256_write(&hmac, key, keylen); - secp256k1_hmac_sha256_finalize(&hmac, rng->k); - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - - /* RFC6979 3.2.f. */ - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_write(&hmac, one, 1); - secp256k1_hmac_sha256_write(&hmac, key, keylen); - secp256k1_hmac_sha256_finalize(&hmac, rng->k); - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - rng->retry = 0; -} - -static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256_t *rng, unsigned char *out, size_t outlen) { - /* RFC6979 3.2.h. */ - static const unsigned char zero[1] = {0x00}; - if (rng->retry) { - secp256k1_hmac_sha256_t hmac; - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_write(&hmac, zero, 1); - secp256k1_hmac_sha256_finalize(&hmac, rng->k); - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - } - - while (outlen > 0) { - secp256k1_hmac_sha256_t hmac; - int now = outlen; - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - if (now > 32) { - now = 32; - } - memcpy(out, rng->v, now); - out += now; - outlen -= now; - } - - rng->retry = 1; -} - -static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256_t *rng) { - memset(rng->k, 0, 32); - memset(rng->v, 0, 32); - rng->retry = 0; -} - -#undef BE32 -#undef Round -#undef sigma1 -#undef sigma0 -#undef Sigma1 -#undef Sigma0 -#undef Maj -#undef Ch - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java deleted file mode 100644 index 1c67802f..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * Copyright 2014-2016 the libsecp256k1 contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.bitcoin; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -import java.math.BigInteger; -import com.google.common.base.Preconditions; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import static org.bitcoin.NativeSecp256k1Util.*; - -/** - *

This class holds native methods to handle ECDSA verification.

- * - *

You can find an example library that can be used for this at https://github.com/bitcoin/secp256k1

- * - *

To build secp256k1 for use with bitcoinj, run - * `./configure --enable-jni --enable-experimental --enable-module-ecdh` - * and `make` then copy `.libs/libsecp256k1.so` to your system library path - * or point the JVM to the folder containing it with -Djava.library.path - *

- */ -public class NativeSecp256k1 { - - private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); - private static final Lock r = rwl.readLock(); - private static final Lock w = rwl.writeLock(); - private static ThreadLocal nativeECDSABuffer = new ThreadLocal(); - /** - * Verifies the given secp256k1 signature in native code. - * Calling when enabled == false is undefined (probably library not loaded) - * - * @param data The data which was signed, must be exactly 32 bytes - * @param signature The signature - * @param pub The public key which did the signing - */ - public static boolean verify(byte[] data, byte[] signature, byte[] pub) throws AssertFailException{ - Preconditions.checkArgument(data.length == 32 && signature.length <= 520 && pub.length <= 520); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < 520) { - byteBuff = ByteBuffer.allocateDirect(520); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(data); - byteBuff.put(signature); - byteBuff.put(pub); - - byte[][] retByteArray; - - r.lock(); - try { - return secp256k1_ecdsa_verify(byteBuff, Secp256k1Context.getContext(), signature.length, pub.length) == 1; - } finally { - r.unlock(); - } - } - - /** - * libsecp256k1 Create an ECDSA signature. - * - * @param data Message hash, 32 bytes - * @param key Secret key, 32 bytes - * - * Return values - * @param sig byte array of signature - */ - public static byte[] sign(byte[] data, byte[] sec) throws AssertFailException{ - Preconditions.checkArgument(data.length == 32 && sec.length <= 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < 32 + 32) { - byteBuff = ByteBuffer.allocateDirect(32 + 32); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(data); - byteBuff.put(sec); - - byte[][] retByteArray; - - r.lock(); - try { - retByteArray = secp256k1_ecdsa_sign(byteBuff, Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] sigArr = retByteArray[0]; - int sigLen = new BigInteger(new byte[] { retByteArray[1][0] }).intValue(); - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(sigArr.length, sigLen, "Got bad signature length."); - - return retVal == 0 ? new byte[0] : sigArr; - } - - /** - * libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid - * - * @param seckey ECDSA Secret key, 32 bytes - */ - public static boolean secKeyVerify(byte[] seckey) { - Preconditions.checkArgument(seckey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < seckey.length) { - byteBuff = ByteBuffer.allocateDirect(seckey.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seckey); - - r.lock(); - try { - return secp256k1_ec_seckey_verify(byteBuff,Secp256k1Context.getContext()) == 1; - } finally { - r.unlock(); - } - } - - - /** - * libsecp256k1 Compute Pubkey - computes public key from secret key - * - * @param seckey ECDSA Secret key, 32 bytes - * - * Return values - * @param pubkey ECDSA Public key, 33 or 65 bytes - */ - //TODO add a 'compressed' arg - public static byte[] computePubkey(byte[] seckey) throws AssertFailException{ - Preconditions.checkArgument(seckey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < seckey.length) { - byteBuff = ByteBuffer.allocateDirect(seckey.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seckey); - - byte[][] retByteArray; - - r.lock(); - try { - retByteArray = secp256k1_ec_pubkey_create(byteBuff, Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] pubArr = retByteArray[0]; - int pubLen = new BigInteger(new byte[] { retByteArray[1][0] }).intValue(); - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(pubArr.length, pubLen, "Got bad pubkey length."); - - return retVal == 0 ? new byte[0]: pubArr; - } - - /** - * libsecp256k1 Cleanup - This destroys the secp256k1 context object - * This should be called at the end of the program for proper cleanup of the context. - */ - public static synchronized void cleanup() { - w.lock(); - try { - secp256k1_destroy_context(Secp256k1Context.getContext()); - } finally { - w.unlock(); - } - } - - public static long cloneContext() { - r.lock(); - try { - return secp256k1_ctx_clone(Secp256k1Context.getContext()); - } finally { r.unlock(); } - } - - /** - * libsecp256k1 PrivKey Tweak-Mul - Tweak privkey by multiplying to it - * - * @param tweak some bytes to tweak with - * @param seckey 32-byte seckey - */ - public static byte[] privKeyTweakMul(byte[] privkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(privkey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < privkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(privkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(privkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_privkey_tweak_mul(byteBuff,Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] privArr = retByteArray[0]; - - int privLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(privArr.length, privLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return privArr; - } - - /** - * libsecp256k1 PrivKey Tweak-Add - Tweak privkey by adding to it - * - * @param tweak some bytes to tweak with - * @param seckey 32-byte seckey - */ - public static byte[] privKeyTweakAdd(byte[] privkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(privkey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < privkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(privkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(privkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_privkey_tweak_add(byteBuff,Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] privArr = retByteArray[0]; - - int privLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(privArr.length, privLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return privArr; - } - - /** - * libsecp256k1 PubKey Tweak-Add - Tweak pubkey by adding to it - * - * @param tweak some bytes to tweak with - * @param pubkey 32-byte seckey - */ - public static byte[] pubKeyTweakAdd(byte[] pubkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(pubkey.length == 33 || pubkey.length == 65); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < pubkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(pubkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(pubkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_pubkey_tweak_add(byteBuff,Secp256k1Context.getContext(), pubkey.length); - } finally { - r.unlock(); - } - - byte[] pubArr = retByteArray[0]; - - int pubLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(pubArr.length, pubLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return pubArr; - } - - /** - * libsecp256k1 PubKey Tweak-Mul - Tweak pubkey by multiplying to it - * - * @param tweak some bytes to tweak with - * @param pubkey 32-byte seckey - */ - public static byte[] pubKeyTweakMul(byte[] pubkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(pubkey.length == 33 || pubkey.length == 65); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < pubkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(pubkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(pubkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_pubkey_tweak_mul(byteBuff,Secp256k1Context.getContext(), pubkey.length); - } finally { - r.unlock(); - } - - byte[] pubArr = retByteArray[0]; - - int pubLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(pubArr.length, pubLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return pubArr; - } - - /** - * libsecp256k1 create ECDH secret - constant time ECDH calculation - * - * @param seckey byte array of secret key used in exponentiaion - * @param pubkey byte array of public key used in exponentiaion - */ - public static byte[] createECDHSecret(byte[] seckey, byte[] pubkey) throws AssertFailException{ - Preconditions.checkArgument(seckey.length <= 32 && pubkey.length <= 65); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < 32 + pubkey.length) { - byteBuff = ByteBuffer.allocateDirect(32 + pubkey.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seckey); - byteBuff.put(pubkey); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_ecdh(byteBuff, Secp256k1Context.getContext(), pubkey.length); - } finally { - r.unlock(); - } - - byte[] resArr = retByteArray[0]; - int retVal = new BigInteger(new byte[] { retByteArray[1][0] }).intValue(); - - assertEquals(resArr.length, 32, "Got bad result length."); - assertEquals(retVal, 1, "Failed return value check."); - - return resArr; - } - - /** - * libsecp256k1 randomize - updates the context randomization - * - * @param seed 32-byte random seed - */ - public static synchronized boolean randomize(byte[] seed) throws AssertFailException{ - Preconditions.checkArgument(seed.length == 32 || seed == null); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < seed.length) { - byteBuff = ByteBuffer.allocateDirect(seed.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seed); - - w.lock(); - try { - return secp256k1_context_randomize(byteBuff, Secp256k1Context.getContext()) == 1; - } finally { - w.unlock(); - } - } - - private static native long secp256k1_ctx_clone(long context); - - private static native int secp256k1_context_randomize(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_privkey_tweak_add(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_privkey_tweak_mul(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_pubkey_tweak_add(ByteBuffer byteBuff, long context, int pubLen); - - private static native byte[][] secp256k1_pubkey_tweak_mul(ByteBuffer byteBuff, long context, int pubLen); - - private static native void secp256k1_destroy_context(long context); - - private static native int secp256k1_ecdsa_verify(ByteBuffer byteBuff, long context, int sigLen, int pubLen); - - private static native byte[][] secp256k1_ecdsa_sign(ByteBuffer byteBuff, long context); - - private static native int secp256k1_ec_seckey_verify(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_ec_pubkey_create(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_ec_pubkey_parse(ByteBuffer byteBuff, long context, int inputLen); - - private static native byte[][] secp256k1_ecdh(ByteBuffer byteBuff, long context, int inputLen); - -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java deleted file mode 100644 index c00d0889..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java +++ /dev/null @@ -1,226 +0,0 @@ -package org.bitcoin; - -import com.google.common.io.BaseEncoding; -import java.util.Arrays; -import java.math.BigInteger; -import javax.xml.bind.DatatypeConverter; -import static org.bitcoin.NativeSecp256k1Util.*; - -/** - * This class holds test cases defined for testing this library. - */ -public class NativeSecp256k1Test { - - //TODO improve comments/add more tests - /** - * This tests verify() for a valid signature - */ - public static void testVerifyPos() throws AssertFailException{ - boolean result = false; - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90".toLowerCase()); //sha256hash of "testing" - byte[] sig = BaseEncoding.base16().lowerCase().decode("3044022079BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F817980220294F14E883B3F525B5367756C2A11EF6CF84B730B36C17CB0C56F0AAB2C98589".toLowerCase()); - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - - result = NativeSecp256k1.verify( data, sig, pub); - assertEquals( result, true , "testVerifyPos"); - } - - /** - * This tests verify() for a non-valid signature - */ - public static void testVerifyNeg() throws AssertFailException{ - boolean result = false; - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A91".toLowerCase()); //sha256hash of "testing" - byte[] sig = BaseEncoding.base16().lowerCase().decode("3044022079BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F817980220294F14E883B3F525B5367756C2A11EF6CF84B730B36C17CB0C56F0AAB2C98589".toLowerCase()); - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - - result = NativeSecp256k1.verify( data, sig, pub); - //System.out.println(" TEST " + new BigInteger(1, resultbytes).toString(16)); - assertEquals( result, false , "testVerifyNeg"); - } - - /** - * This tests secret key verify() for a valid secretkey - */ - public static void testSecKeyVerifyPos() throws AssertFailException{ - boolean result = false; - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - - result = NativeSecp256k1.secKeyVerify( sec ); - //System.out.println(" TEST " + new BigInteger(1, resultbytes).toString(16)); - assertEquals( result, true , "testSecKeyVerifyPos"); - } - - /** - * This tests secret key verify() for a invalid secretkey - */ - public static void testSecKeyVerifyNeg() throws AssertFailException{ - boolean result = false; - byte[] sec = BaseEncoding.base16().lowerCase().decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".toLowerCase()); - - result = NativeSecp256k1.secKeyVerify( sec ); - //System.out.println(" TEST " + new BigInteger(1, resultbytes).toString(16)); - assertEquals( result, false , "testSecKeyVerifyNeg"); - } - - /** - * This tests public key create() for a valid secretkey - */ - public static void testPubKeyCreatePos() throws AssertFailException{ - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.computePubkey( sec); - String pubkeyString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( pubkeyString , "04C591A8FF19AC9C4E4E5793673B83123437E975285E7B442F4EE2654DFFCA5E2D2103ED494718C697AC9AEBCFD19612E224DB46661011863ED2FC54E71861E2A6" , "testPubKeyCreatePos"); - } - - /** - * This tests public key create() for a invalid secretkey - */ - public static void testPubKeyCreateNeg() throws AssertFailException{ - byte[] sec = BaseEncoding.base16().lowerCase().decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.computePubkey( sec); - String pubkeyString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( pubkeyString, "" , "testPubKeyCreateNeg"); - } - - /** - * This tests sign() for a valid secretkey - */ - public static void testSignPos() throws AssertFailException{ - - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90".toLowerCase()); //sha256hash of "testing" - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.sign(data, sec); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString, "30440220182A108E1448DC8F1FB467D06A0F3BB8EA0533584CB954EF8DA112F1D60E39A202201C66F36DA211C087F3AF88B50EDF4F9BDAA6CF5FD6817E74DCA34DB12390C6E9" , "testSignPos"); - } - - /** - * This tests sign() for a invalid secretkey - */ - public static void testSignNeg() throws AssertFailException{ - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90".toLowerCase()); //sha256hash of "testing" - byte[] sec = BaseEncoding.base16().lowerCase().decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.sign(data, sec); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString, "" , "testSignNeg"); - } - - /** - * This tests private key tweak-add - */ - public static void testPrivKeyTweakAdd_1() throws AssertFailException { - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.privKeyTweakAdd( sec , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "A168571E189E6F9A7E2D657A4B53AE99B909F7E712D1C23CED28093CD57C88F3" , "testPrivKeyAdd_1"); - } - - /** - * This tests private key tweak-mul - */ - public static void testPrivKeyTweakMul_1() throws AssertFailException { - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.privKeyTweakMul( sec , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "97F8184235F101550F3C71C927507651BD3F1CDB4A5A33B8986ACF0DEE20FFFC" , "testPrivKeyMul_1"); - } - - /** - * This tests private key tweak-add uncompressed - */ - public static void testPrivKeyTweakAdd_2() throws AssertFailException { - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.pubKeyTweakAdd( pub , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "0411C6790F4B663CCE607BAAE08C43557EDC1A4D11D88DFCB3D841D0C6A941AF525A268E2A863C148555C48FB5FBA368E88718A46E205FABC3DBA2CCFFAB0796EF" , "testPrivKeyAdd_2"); - } - - /** - * This tests private key tweak-mul uncompressed - */ - public static void testPrivKeyTweakMul_2() throws AssertFailException { - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.pubKeyTweakMul( pub , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "04E0FE6FE55EBCA626B98A807F6CAF654139E14E5E3698F01A9A658E21DC1D2791EC060D4F412A794D5370F672BC94B722640B5F76914151CFCA6E712CA48CC589" , "testPrivKeyMul_2"); - } - - /** - * This tests seed randomization - */ - public static void testRandomize() throws AssertFailException { - byte[] seed = BaseEncoding.base16().lowerCase().decode("A441B15FE9A3CF56661190A0B93B9DEC7D04127288CC87250967CF3B52894D11".toLowerCase()); //sha256hash of "random" - boolean result = NativeSecp256k1.randomize(seed); - assertEquals( result, true, "testRandomize"); - } - - public static void testCreateECDHSecret() throws AssertFailException{ - - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.createECDHSecret(sec, pub); - String ecdhString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( ecdhString, "2A2A67007A926E6594AF3EB564FC74005B37A9C8AEF2033C4552051B5C87F043" , "testCreateECDHSecret"); - } - - public static void main(String[] args) throws AssertFailException{ - - - System.out.println("\n libsecp256k1 enabled: " + Secp256k1Context.isEnabled() + "\n"); - - assertEquals( Secp256k1Context.isEnabled(), true, "isEnabled" ); - - //Test verify() success/fail - testVerifyPos(); - testVerifyNeg(); - - //Test secKeyVerify() success/fail - testSecKeyVerifyPos(); - testSecKeyVerifyNeg(); - - //Test computePubkey() success/fail - testPubKeyCreatePos(); - testPubKeyCreateNeg(); - - //Test sign() success/fail - testSignPos(); - testSignNeg(); - - //Test privKeyTweakAdd() 1 - testPrivKeyTweakAdd_1(); - - //Test privKeyTweakMul() 2 - testPrivKeyTweakMul_1(); - - //Test privKeyTweakAdd() 3 - testPrivKeyTweakAdd_2(); - - //Test privKeyTweakMul() 4 - testPrivKeyTweakMul_2(); - - //Test randomize() - testRandomize(); - - //Test ECDH - testCreateECDHSecret(); - - NativeSecp256k1.cleanup(); - - System.out.println(" All tests passed." ); - - } -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java deleted file mode 100644 index 04732ba0..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2014-2016 the libsecp256k1 contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.bitcoin; - -public class NativeSecp256k1Util{ - - public static void assertEquals( int val, int val2, String message ) throws AssertFailException{ - if( val != val2 ) - throw new AssertFailException("FAIL: " + message); - } - - public static void assertEquals( boolean val, boolean val2, String message ) throws AssertFailException{ - if( val != val2 ) - throw new AssertFailException("FAIL: " + message); - else - System.out.println("PASS: " + message); - } - - public static void assertEquals( String val, String val2, String message ) throws AssertFailException{ - if( !val.equals(val2) ) - throw new AssertFailException("FAIL: " + message); - else - System.out.println("PASS: " + message); - } - - public static class AssertFailException extends Exception { - public AssertFailException(String message) { - super( message ); - } - } -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java deleted file mode 100644 index 216c986a..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2014-2016 the libsecp256k1 contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.bitcoin; - -/** - * This class holds the context reference used in native methods - * to handle ECDSA operations. - */ -public class Secp256k1Context { - private static final boolean enabled; //true if the library is loaded - private static final long context; //ref to pointer to context obj - - static { //static initializer - boolean isEnabled = true; - long contextRef = -1; - try { - System.loadLibrary("secp256k1"); - contextRef = secp256k1_init_context(); - } catch (UnsatisfiedLinkError e) { - System.out.println("UnsatisfiedLinkError: " + e.toString()); - isEnabled = false; - } - enabled = isEnabled; - context = contextRef; - } - - public static boolean isEnabled() { - return enabled; - } - - public static long getContext() { - if(!enabled) return -1; //sanity check - return context; - } - - private static native long secp256k1_init_context(); -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c deleted file mode 100644 index bcef7b32..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c +++ /dev/null @@ -1,377 +0,0 @@ -#include -#include -#include -#include "org_bitcoin_NativeSecp256k1.h" -#include "include/secp256k1.h" -#include "include/secp256k1_ecdh.h" -#include "include/secp256k1_recovery.h" - - -SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ctx_1clone - (JNIEnv* env, jclass classObject, jlong ctx_l) -{ - const secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - jlong ctx_clone_l = (uintptr_t) secp256k1_context_clone(ctx); - - (void)classObject;(void)env; - - return ctx_clone_l; - -} - -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1context_1randomize - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - const unsigned char* seed = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - - (void)classObject; - - return secp256k1_context_randomize(ctx, seed); - -} - -SECP256K1_API void JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1destroy_1context - (JNIEnv* env, jclass classObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - secp256k1_context_destroy(ctx); - - (void)classObject;(void)env; -} - -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint siglen, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* sigdata = { (unsigned char*) (data + 32) }; - const unsigned char* pubdata = { (unsigned char*) (data + siglen + 32) }; - - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pubkey; - - int ret = secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigdata, siglen); - - if( ret ) { - ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pubdata, publen); - - if( ret ) { - ret = secp256k1_ecdsa_verify(ctx, &sig, data, &pubkey); - } - } - - (void)classObject; - - return ret; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1sign - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - unsigned char* secKey = (unsigned char*) (data + 32); - - jobjectArray retArray; - jbyteArray sigArray, intsByteArray; - unsigned char intsarray[2]; - - secp256k1_ecdsa_signature sig[72]; - - int ret = secp256k1_ecdsa_sign(ctx, sig, data, secKey, NULL, NULL ); - - unsigned char outputSer[72]; - size_t outputLen = 72; - - if( ret ) { - int ret2 = secp256k1_ecdsa_signature_serialize_der(ctx,outputSer, &outputLen, sig ); (void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - sigArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, sigArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, sigArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* secKey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - - (void)classObject; - - return secp256k1_ec_seckey_verify(ctx, secKey); -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1create - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - const unsigned char* secKey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - - secp256k1_pubkey pubkey; - - jobjectArray retArray; - jbyteArray pubkeyArray, intsByteArray; - unsigned char intsarray[2]; - - int ret = secp256k1_ec_pubkey_create(ctx, &pubkey, secKey); - - unsigned char outputSer[65]; - size_t outputLen = 65; - - if( ret ) { - int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - pubkeyArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, pubkeyArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, pubkeyArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; - -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1add - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* privkey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (privkey + 32); - - jobjectArray retArray; - jbyteArray privArray, intsByteArray; - unsigned char intsarray[2]; - - int privkeylen = 32; - - int ret = secp256k1_ec_privkey_tweak_add(ctx, privkey, tweak); - - intsarray[0] = privkeylen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - privArray = (*env)->NewByteArray(env, privkeylen); - (*env)->SetByteArrayRegion(env, privArray, 0, privkeylen, (jbyte*)privkey); - (*env)->SetObjectArrayElement(env, retArray, 0, privArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1mul - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* privkey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (privkey + 32); - - jobjectArray retArray; - jbyteArray privArray, intsByteArray; - unsigned char intsarray[2]; - - int privkeylen = 32; - - int ret = secp256k1_ec_privkey_tweak_mul(ctx, privkey, tweak); - - intsarray[0] = privkeylen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - privArray = (*env)->NewByteArray(env, privkeylen); - (*env)->SetByteArrayRegion(env, privArray, 0, privkeylen, (jbyte*)privkey); - (*env)->SetObjectArrayElement(env, retArray, 0, privArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1add - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; -/* secp256k1_pubkey* pubkey = (secp256k1_pubkey*) (*env)->GetDirectBufferAddress(env, byteBufferObject);*/ - unsigned char* pkey = (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (pkey + publen); - - jobjectArray retArray; - jbyteArray pubArray, intsByteArray; - unsigned char intsarray[2]; - unsigned char outputSer[65]; - size_t outputLen = 65; - - secp256k1_pubkey pubkey; - int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pkey, publen); - - if( ret ) { - ret = secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, tweak); - } - - if( ret ) { - int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - pubArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, pubArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, pubArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1mul - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* pkey = (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (pkey + publen); - - jobjectArray retArray; - jbyteArray pubArray, intsByteArray; - unsigned char intsarray[2]; - unsigned char outputSer[65]; - size_t outputLen = 65; - - secp256k1_pubkey pubkey; - int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pkey, publen); - - if ( ret ) { - ret = secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, tweak); - } - - if( ret ) { - int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - pubArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, pubArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, pubArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1pubkey_1combine - (JNIEnv * env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint numkeys) -{ - (void)classObject;(void)env;(void)byteBufferObject;(void)ctx_l;(void)numkeys; - - return 0; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdh - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - const unsigned char* secdata = (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* pubdata = (const unsigned char*) (secdata + 32); - - jobjectArray retArray; - jbyteArray outArray, intsByteArray; - unsigned char intsarray[1]; - secp256k1_pubkey pubkey; - unsigned char nonce_res[32]; - size_t outputLen = 32; - - int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pubdata, publen); - - if (ret) { - ret = secp256k1_ecdh( - ctx, - nonce_res, - &pubkey, - secdata - ); - } - - intsarray[0] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - outArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, outArray, 0, 32, (jbyte*)nonce_res); - (*env)->SetObjectArrayElement(env, retArray, 0, outArray); - - intsByteArray = (*env)->NewByteArray(env, 1); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 1, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h deleted file mode 100644 index fe613c9e..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h +++ /dev/null @@ -1,119 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -#include "include/secp256k1.h" -/* Header for class org_bitcoin_NativeSecp256k1 */ - -#ifndef _Included_org_bitcoin_NativeSecp256k1 -#define _Included_org_bitcoin_NativeSecp256k1 -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ctx_clone - * Signature: (J)J - */ -SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ctx_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_context_randomize - * Signature: (Ljava/nio/ByteBuffer;J)I - */ -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1context_1randomize - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_privkey_tweak_add - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1add - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_privkey_tweak_mul - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1mul - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_pubkey_tweak_add - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1add - (JNIEnv *, jclass, jobject, jlong, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_pubkey_tweak_mul - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1mul - (JNIEnv *, jclass, jobject, jlong, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_destroy_context - * Signature: (J)V - */ -SECP256K1_API void JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1destroy_1context - (JNIEnv *, jclass, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ecdsa_verify - * Signature: (Ljava/nio/ByteBuffer;JII)I - */ -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify - (JNIEnv *, jclass, jobject, jlong, jint, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ecdsa_sign - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1sign - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ec_seckey_verify - * Signature: (Ljava/nio/ByteBuffer;J)I - */ -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ec_pubkey_create - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1create - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ec_pubkey_parse - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1parse - (JNIEnv *, jclass, jobject, jlong, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ecdh - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdh - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c deleted file mode 100644 index a52939e7..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include "org_bitcoin_Secp256k1Context.h" -#include "include/secp256k1.h" - -SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context - (JNIEnv* env, jclass classObject) -{ - secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - (void)classObject;(void)env; - - return (uintptr_t)ctx; -} - diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h deleted file mode 100644 index 0d2bc84b..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h +++ /dev/null @@ -1,22 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -#include "include/secp256k1.h" -/* Header for class org_bitcoin_Secp256k1Context */ - -#ifndef _Included_org_bitcoin_Secp256k1Context -#define _Included_org_bitcoin_Secp256k1Context -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_bitcoin_Secp256k1Context - * Method: secp256k1_init_context - * Signature: ()J - */ -SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include deleted file mode 100644 index e3088b46..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include +++ /dev/null @@ -1,8 +0,0 @@ -include_HEADERS += include/secp256k1_ecdh.h -noinst_HEADERS += src/modules/ecdh/main_impl.h -noinst_HEADERS += src/modules/ecdh/tests_impl.h -if USE_BENCHMARK -noinst_PROGRAMS += bench_ecdh -bench_ecdh_SOURCES = src/bench_ecdh.c -bench_ecdh_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB) -endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h deleted file mode 100644 index 9e30fb73..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_ECDH_MAIN_ -#define _SECP256K1_MODULE_ECDH_MAIN_ - -#include "include/secp256k1_ecdh.h" -#include "ecmult_const_impl.h" - -int secp256k1_ecdh(const secp256k1_context* ctx, unsigned char *result, const secp256k1_pubkey *point, const unsigned char *scalar) { - int ret = 0; - int overflow = 0; - secp256k1_gej res; - secp256k1_ge pt; - secp256k1_scalar s; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(result != NULL); - ARG_CHECK(point != NULL); - ARG_CHECK(scalar != NULL); - - secp256k1_pubkey_load(ctx, &pt, point); - secp256k1_scalar_set_b32(&s, scalar, &overflow); - if (overflow || secp256k1_scalar_is_zero(&s)) { - ret = 0; - } else { - unsigned char x[32]; - unsigned char y[1]; - secp256k1_sha256_t sha; - - secp256k1_ecmult_const(&res, &pt, &s); - secp256k1_ge_set_gej(&pt, &res); - /* Compute a hash of the point in compressed form - * Note we cannot use secp256k1_eckey_pubkey_serialize here since it does not - * expect its output to be secret and has a timing sidechannel. */ - secp256k1_fe_normalize(&pt.x); - secp256k1_fe_normalize(&pt.y); - secp256k1_fe_get_b32(x, &pt.x); - y[0] = 0x02 | secp256k1_fe_is_odd(&pt.y); - - secp256k1_sha256_initialize(&sha); - secp256k1_sha256_write(&sha, y, sizeof(y)); - secp256k1_sha256_write(&sha, x, sizeof(x)); - secp256k1_sha256_finalize(&sha, result); - ret = 1; - } - - secp256k1_scalar_clear(&s); - return ret; -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h deleted file mode 100644 index 85a5d0a9..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h +++ /dev/null @@ -1,105 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_ECDH_TESTS_ -#define _SECP256K1_MODULE_ECDH_TESTS_ - -void test_ecdh_api(void) { - /* Setup context that just counts errors */ - secp256k1_context *tctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - secp256k1_pubkey point; - unsigned char res[32]; - unsigned char s_one[32] = { 0 }; - int32_t ecount = 0; - s_one[31] = 1; - - secp256k1_context_set_error_callback(tctx, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(tctx, counting_illegal_callback_fn, &ecount); - CHECK(secp256k1_ec_pubkey_create(tctx, &point, s_one) == 1); - - /* Check all NULLs are detected */ - CHECK(secp256k1_ecdh(tctx, res, &point, s_one) == 1); - CHECK(ecount == 0); - CHECK(secp256k1_ecdh(tctx, NULL, &point, s_one) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdh(tctx, res, NULL, s_one) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdh(tctx, res, &point, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdh(tctx, res, &point, s_one) == 1); - CHECK(ecount == 3); - - /* Cleanup */ - secp256k1_context_destroy(tctx); -} - -void test_ecdh_generator_basepoint(void) { - unsigned char s_one[32] = { 0 }; - secp256k1_pubkey point[2]; - int i; - - s_one[31] = 1; - /* Check against pubkey creation when the basepoint is the generator */ - for (i = 0; i < 100; ++i) { - secp256k1_sha256_t sha; - unsigned char s_b32[32]; - unsigned char output_ecdh[32]; - unsigned char output_ser[32]; - unsigned char point_ser[33]; - size_t point_ser_len = sizeof(point_ser); - secp256k1_scalar s; - - random_scalar_order(&s); - secp256k1_scalar_get_b32(s_b32, &s); - - /* compute using ECDH function */ - CHECK(secp256k1_ec_pubkey_create(ctx, &point[0], s_one) == 1); - CHECK(secp256k1_ecdh(ctx, output_ecdh, &point[0], s_b32) == 1); - /* compute "explicitly" */ - CHECK(secp256k1_ec_pubkey_create(ctx, &point[1], s_b32) == 1); - CHECK(secp256k1_ec_pubkey_serialize(ctx, point_ser, &point_ser_len, &point[1], SECP256K1_EC_COMPRESSED) == 1); - CHECK(point_ser_len == sizeof(point_ser)); - secp256k1_sha256_initialize(&sha); - secp256k1_sha256_write(&sha, point_ser, point_ser_len); - secp256k1_sha256_finalize(&sha, output_ser); - /* compare */ - CHECK(memcmp(output_ecdh, output_ser, sizeof(output_ser)) == 0); - } -} - -void test_bad_scalar(void) { - unsigned char s_zero[32] = { 0 }; - unsigned char s_overflow[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41 - }; - unsigned char s_rand[32] = { 0 }; - unsigned char output[32]; - secp256k1_scalar rand; - secp256k1_pubkey point; - - /* Create random point */ - random_scalar_order(&rand); - secp256k1_scalar_get_b32(s_rand, &rand); - CHECK(secp256k1_ec_pubkey_create(ctx, &point, s_rand) == 1); - - /* Try to multiply it by bad values */ - CHECK(secp256k1_ecdh(ctx, output, &point, s_zero) == 0); - CHECK(secp256k1_ecdh(ctx, output, &point, s_overflow) == 0); - /* ...and a good one */ - s_overflow[31] -= 1; - CHECK(secp256k1_ecdh(ctx, output, &point, s_overflow) == 1); -} - -void run_ecdh_tests(void) { - test_ecdh_api(); - test_ecdh_generator_basepoint(); - test_bad_scalar(); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include deleted file mode 100644 index bf23c26e..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include +++ /dev/null @@ -1,8 +0,0 @@ -include_HEADERS += include/secp256k1_recovery.h -noinst_HEADERS += src/modules/recovery/main_impl.h -noinst_HEADERS += src/modules/recovery/tests_impl.h -if USE_BENCHMARK -noinst_PROGRAMS += bench_recover -bench_recover_SOURCES = src/bench_recover.c -bench_recover_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB) -endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h deleted file mode 100755 index c6fbe239..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h +++ /dev/null @@ -1,193 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_RECOVERY_MAIN_ -#define _SECP256K1_MODULE_RECOVERY_MAIN_ - -#include "include/secp256k1_recovery.h" - -static void secp256k1_ecdsa_recoverable_signature_load(const secp256k1_context* ctx, secp256k1_scalar* r, secp256k1_scalar* s, int* recid, const secp256k1_ecdsa_recoverable_signature* sig) { - (void)ctx; - if (sizeof(secp256k1_scalar) == 32) { - /* When the secp256k1_scalar type is exactly 32 byte, use its - * representation inside secp256k1_ecdsa_signature, as conversion is very fast. - * Note that secp256k1_ecdsa_signature_save must use the same representation. */ - memcpy(r, &sig->data[0], 32); - memcpy(s, &sig->data[32], 32); - } else { - secp256k1_scalar_set_b32(r, &sig->data[0], NULL); - secp256k1_scalar_set_b32(s, &sig->data[32], NULL); - } - *recid = sig->data[64]; -} - -static void secp256k1_ecdsa_recoverable_signature_save(secp256k1_ecdsa_recoverable_signature* sig, const secp256k1_scalar* r, const secp256k1_scalar* s, int recid) { - if (sizeof(secp256k1_scalar) == 32) { - memcpy(&sig->data[0], r, 32); - memcpy(&sig->data[32], s, 32); - } else { - secp256k1_scalar_get_b32(&sig->data[0], r); - secp256k1_scalar_get_b32(&sig->data[32], s); - } - sig->data[64] = recid; -} - -int secp256k1_ecdsa_recoverable_signature_parse_compact(const secp256k1_context* ctx, secp256k1_ecdsa_recoverable_signature* sig, const unsigned char *input64, int recid) { - secp256k1_scalar r, s; - int ret = 1; - int overflow = 0; - - (void)ctx; - ARG_CHECK(sig != NULL); - ARG_CHECK(input64 != NULL); - ARG_CHECK(recid >= 0 && recid <= 3); - - secp256k1_scalar_set_b32(&r, &input64[0], &overflow); - ret &= !overflow; - secp256k1_scalar_set_b32(&s, &input64[32], &overflow); - ret &= !overflow; - if (ret) { - secp256k1_ecdsa_recoverable_signature_save(sig, &r, &s, recid); - } else { - memset(sig, 0, sizeof(*sig)); - } - return ret; -} - -int secp256k1_ecdsa_recoverable_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, int *recid, const secp256k1_ecdsa_recoverable_signature* sig) { - secp256k1_scalar r, s; - - (void)ctx; - ARG_CHECK(output64 != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(recid != NULL); - - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, recid, sig); - secp256k1_scalar_get_b32(&output64[0], &r); - secp256k1_scalar_get_b32(&output64[32], &s); - return 1; -} - -int secp256k1_ecdsa_recoverable_signature_convert(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const secp256k1_ecdsa_recoverable_signature* sigin) { - secp256k1_scalar r, s; - int recid; - - (void)ctx; - ARG_CHECK(sig != NULL); - ARG_CHECK(sigin != NULL); - - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, &recid, sigin); - secp256k1_ecdsa_signature_save(sig, &r, &s); - return 1; -} - -static int secp256k1_ecdsa_sig_recover(const secp256k1_ecmult_context *ctx, const secp256k1_scalar *sigr, const secp256k1_scalar* sigs, secp256k1_ge *pubkey, const secp256k1_scalar *message, int recid) { - unsigned char brx[32]; - secp256k1_fe fx; - secp256k1_ge x; - secp256k1_gej xj; - secp256k1_scalar rn, u1, u2; - secp256k1_gej qj; - int r; - - if (secp256k1_scalar_is_zero(sigr) || secp256k1_scalar_is_zero(sigs)) { - return 0; - } - - secp256k1_scalar_get_b32(brx, sigr); - r = secp256k1_fe_set_b32(&fx, brx); - (void)r; - VERIFY_CHECK(r); /* brx comes from a scalar, so is less than the order; certainly less than p */ - if (recid & 2) { - if (secp256k1_fe_cmp_var(&fx, &secp256k1_ecdsa_const_p_minus_order) >= 0) { - return 0; - } - secp256k1_fe_add(&fx, &secp256k1_ecdsa_const_order_as_fe); - } - if (!secp256k1_ge_set_xo_var(&x, &fx, recid & 1)) { - return 0; - } - secp256k1_gej_set_ge(&xj, &x); - secp256k1_scalar_inverse_var(&rn, sigr); - secp256k1_scalar_mul(&u1, &rn, message); - secp256k1_scalar_negate(&u1, &u1); - secp256k1_scalar_mul(&u2, &rn, sigs); - secp256k1_ecmult(ctx, &qj, &xj, &u2, &u1); - secp256k1_ge_set_gej_var(pubkey, &qj); - return !secp256k1_gej_is_infinity(&qj); -} - -int secp256k1_ecdsa_sign_recoverable(const secp256k1_context* ctx, secp256k1_ecdsa_recoverable_signature *signature, const unsigned char *msg32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) { - secp256k1_scalar r, s; - secp256k1_scalar sec, non, msg; - int recid; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(signature != NULL); - ARG_CHECK(seckey != NULL); - if (noncefp == NULL) { - noncefp = secp256k1_nonce_function_default; - } - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - /* Fail if the secret key is invalid. */ - if (!overflow && !secp256k1_scalar_is_zero(&sec)) { - unsigned char nonce32[32]; - unsigned int count = 0; - secp256k1_scalar_set_b32(&msg, msg32, NULL); - while (1) { - ret = noncefp(nonce32, msg32, seckey, NULL, (void*)noncedata, count); - if (!ret) { - break; - } - secp256k1_scalar_set_b32(&non, nonce32, &overflow); - if (!secp256k1_scalar_is_zero(&non) && !overflow) { - if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, &recid)) { - break; - } - } - count++; - } - memset(nonce32, 0, 32); - secp256k1_scalar_clear(&msg); - secp256k1_scalar_clear(&non); - secp256k1_scalar_clear(&sec); - } - if (ret) { - secp256k1_ecdsa_recoverable_signature_save(signature, &r, &s, recid); - } else { - memset(signature, 0, sizeof(*signature)); - } - return ret; -} - -int secp256k1_ecdsa_recover(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const secp256k1_ecdsa_recoverable_signature *signature, const unsigned char *msg32) { - secp256k1_ge q; - secp256k1_scalar r, s; - secp256k1_scalar m; - int recid; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(signature != NULL); - ARG_CHECK(pubkey != NULL); - - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, &recid, signature); - VERIFY_CHECK(recid >= 0 && recid < 4); /* should have been caught in parse_compact */ - secp256k1_scalar_set_b32(&m, msg32, NULL); - if (secp256k1_ecdsa_sig_recover(&ctx->ecmult_ctx, &r, &s, &q, &m, recid)) { - secp256k1_pubkey_save(pubkey, &q); - return 1; - } else { - memset(pubkey, 0, sizeof(*pubkey)); - return 0; - } -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h deleted file mode 100644 index 765c7dd8..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h +++ /dev/null @@ -1,393 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_RECOVERY_TESTS_ -#define _SECP256K1_MODULE_RECOVERY_TESTS_ - -static int recovery_test_nonce_function(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - (void) msg32; - (void) key32; - (void) algo16; - (void) data; - - /* On the first run, return 0 to force a second run */ - if (counter == 0) { - memset(nonce32, 0, 32); - return 1; - } - /* On the second run, return an overflow to force a third run */ - if (counter == 1) { - memset(nonce32, 0xff, 32); - return 1; - } - /* On the next run, return a valid nonce, but flip a coin as to whether or not to fail signing. */ - memset(nonce32, 1, 32); - return secp256k1_rand_bits(1); -} - -void test_ecdsa_recovery_api(void) { - /* Setup contexts that just count errors */ - secp256k1_context *none = secp256k1_context_create(SECP256K1_CONTEXT_NONE); - secp256k1_context *sign = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - secp256k1_context *vrfy = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); - secp256k1_context *both = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - secp256k1_pubkey pubkey; - secp256k1_pubkey recpubkey; - secp256k1_ecdsa_signature normal_sig; - secp256k1_ecdsa_recoverable_signature recsig; - unsigned char privkey[32] = { 1 }; - unsigned char message[32] = { 2 }; - int32_t ecount = 0; - int recid = 0; - unsigned char sig[74]; - unsigned char zero_privkey[32] = { 0 }; - unsigned char over_privkey[32] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - secp256k1_context_set_error_callback(none, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_error_callback(sign, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_error_callback(vrfy, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_error_callback(both, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(none, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(sign, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(vrfy, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(both, counting_illegal_callback_fn, &ecount); - - /* Construct and verify corresponding public key. */ - CHECK(secp256k1_ec_seckey_verify(ctx, privkey) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, privkey) == 1); - - /* Check bad contexts and NULLs for signing */ - ecount = 0; - CHECK(secp256k1_ecdsa_sign_recoverable(none, &recsig, message, privkey, NULL, NULL) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(sign, &recsig, message, privkey, NULL, NULL) == 1); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(vrfy, &recsig, message, privkey, NULL, NULL) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, NULL, NULL) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_sign_recoverable(both, NULL, message, privkey, NULL, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, NULL, privkey, NULL, NULL) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, NULL, NULL, NULL) == 0); - CHECK(ecount == 5); - /* This will fail or succeed randomly, and in either case will not ARG_CHECK failure */ - secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, recovery_test_nonce_function, NULL); - CHECK(ecount == 5); - /* These will all fail, but not in ARG_CHECK way */ - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, zero_privkey, NULL, NULL) == 0); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, over_privkey, NULL, NULL) == 0); - /* This one will succeed. */ - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, NULL, NULL) == 1); - CHECK(ecount == 5); - - /* Check signing with a goofy nonce function */ - - /* Check bad contexts and NULLs for recovery */ - ecount = 0; - CHECK(secp256k1_ecdsa_recover(none, &recpubkey, &recsig, message) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_recover(sign, &recpubkey, &recsig, message) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recover(vrfy, &recpubkey, &recsig, message) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recover(both, &recpubkey, &recsig, message) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recover(both, NULL, &recsig, message) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_recover(both, &recpubkey, NULL, message) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_recover(both, &recpubkey, &recsig, NULL) == 0); - CHECK(ecount == 5); - - /* Check NULLs for conversion */ - CHECK(secp256k1_ecdsa_sign(both, &normal_sig, message, privkey, NULL, NULL) == 1); - ecount = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_convert(both, NULL, &recsig) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(both, &normal_sig, NULL) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(both, &normal_sig, &recsig) == 1); - - /* Check NULLs for de/serialization */ - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, NULL, NULL) == 1); - ecount = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, NULL, &recid, &recsig) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, sig, NULL, &recsig) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, sig, &recid, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, sig, &recid, &recsig) == 1); - - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, NULL, sig, recid) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, NULL, recid) == 0); - CHECK(ecount == 5); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, sig, -1) == 0); - CHECK(ecount == 6); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, sig, 5) == 0); - CHECK(ecount == 7); - /* overflow in signature will fail but not affect ecount */ - memcpy(sig, over_privkey, 32); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, sig, recid) == 0); - CHECK(ecount == 7); - - /* cleanup */ - secp256k1_context_destroy(none); - secp256k1_context_destroy(sign); - secp256k1_context_destroy(vrfy); - secp256k1_context_destroy(both); -} - -void test_ecdsa_recovery_end_to_end(void) { - unsigned char extra[32] = {0x00}; - unsigned char privkey[32]; - unsigned char message[32]; - secp256k1_ecdsa_signature signature[5]; - secp256k1_ecdsa_recoverable_signature rsignature[5]; - unsigned char sig[74]; - secp256k1_pubkey pubkey; - secp256k1_pubkey recpubkey; - int recid = 0; - - /* Generate a random key and message. */ - { - secp256k1_scalar msg, key; - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_scalar_get_b32(privkey, &key); - secp256k1_scalar_get_b32(message, &msg); - } - - /* Construct and verify corresponding public key. */ - CHECK(secp256k1_ec_seckey_verify(ctx, privkey) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, privkey) == 1); - - /* Serialize/parse compact and verify/recover. */ - extra[0] = 0; - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[0], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &signature[0], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[4], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[1], message, privkey, NULL, extra) == 1); - extra[31] = 1; - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[2], message, privkey, NULL, extra) == 1); - extra[31] = 0; - extra[0] = 1; - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[3], message, privkey, NULL, extra) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx, sig, &recid, &rsignature[4]) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1); - CHECK(memcmp(&signature[4], &signature[0], 64) == 0); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 1); - memset(&rsignature[4], 0, sizeof(rsignature[4])); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 1); - /* Parse compact (with recovery id) and recover. */ - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &recpubkey, &rsignature[4], message) == 1); - CHECK(memcmp(&pubkey, &recpubkey, sizeof(pubkey)) == 0); - /* Serialize/destroy/parse signature and verify again. */ - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx, sig, &recid, &rsignature[4]) == 1); - sig[secp256k1_rand_bits(6)] += 1 + secp256k1_rand_int(255); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 0); - /* Recover again */ - CHECK(secp256k1_ecdsa_recover(ctx, &recpubkey, &rsignature[4], message) == 0 || - memcmp(&pubkey, &recpubkey, sizeof(pubkey)) != 0); -} - -/* Tests several edge cases. */ -void test_ecdsa_recovery_edge_cases(void) { - const unsigned char msg32[32] = { - 'T', 'h', 'i', 's', ' ', 'i', 's', ' ', - 'a', ' ', 'v', 'e', 'r', 'y', ' ', 's', - 'e', 'c', 'r', 'e', 't', ' ', 'm', 'e', - 's', 's', 'a', 'g', 'e', '.', '.', '.' - }; - const unsigned char sig64[64] = { - /* Generated by signing the above message with nonce 'This is the nonce we will use...' - * and secret key 0 (which is not valid), resulting in recid 0. */ - 0x67, 0xCB, 0x28, 0x5F, 0x9C, 0xD1, 0x94, 0xE8, - 0x40, 0xD6, 0x29, 0x39, 0x7A, 0xF5, 0x56, 0x96, - 0x62, 0xFD, 0xE4, 0x46, 0x49, 0x99, 0x59, 0x63, - 0x17, 0x9A, 0x7D, 0xD1, 0x7B, 0xD2, 0x35, 0x32, - 0x4B, 0x1B, 0x7D, 0xF3, 0x4C, 0xE1, 0xF6, 0x8E, - 0x69, 0x4F, 0xF6, 0xF1, 0x1A, 0xC7, 0x51, 0xDD, - 0x7D, 0xD7, 0x3E, 0x38, 0x7E, 0xE4, 0xFC, 0x86, - 0x6E, 0x1B, 0xE8, 0xEC, 0xC7, 0xDD, 0x95, 0x57 - }; - secp256k1_pubkey pubkey; - /* signature (r,s) = (4,4), which can be recovered with all 4 recids. */ - const unsigned char sigb64[64] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - }; - secp256k1_pubkey pubkeyb; - secp256k1_ecdsa_recoverable_signature rsig; - secp256k1_ecdsa_signature sig; - int recid; - - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 0)); - CHECK(!secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 1)); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 2)); - CHECK(!secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 3)); - CHECK(!secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - - for (recid = 0; recid < 4; recid++) { - int i; - int recid2; - /* (4,4) encoded in DER. */ - unsigned char sigbder[8] = {0x30, 0x06, 0x02, 0x01, 0x04, 0x02, 0x01, 0x04}; - unsigned char sigcder_zr[7] = {0x30, 0x05, 0x02, 0x00, 0x02, 0x01, 0x01}; - unsigned char sigcder_zs[7] = {0x30, 0x05, 0x02, 0x01, 0x01, 0x02, 0x00}; - unsigned char sigbderalt1[39] = { - 0x30, 0x25, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x04, - }; - unsigned char sigbderalt2[39] = { - 0x30, 0x25, 0x02, 0x01, 0x04, 0x02, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - }; - unsigned char sigbderalt3[40] = { - 0x30, 0x26, 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x04, - }; - unsigned char sigbderalt4[40] = { - 0x30, 0x26, 0x02, 0x01, 0x04, 0x02, 0x21, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - }; - /* (order + r,4) encoded in DER. */ - unsigned char sigbderlong[40] = { - 0x30, 0x26, 0x02, 0x21, 0x00, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0xAE, 0xDC, - 0xE6, 0xAF, 0x48, 0xA0, 0x3B, 0xBF, 0xD2, 0x5E, - 0x8C, 0xD0, 0x36, 0x41, 0x45, 0x02, 0x01, 0x04 - }; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigb64, recid) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyb, &rsig, msg32) == 1); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 1); - for (recid2 = 0; recid2 < 4; recid2++) { - secp256k1_pubkey pubkey2b; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigb64, recid2) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkey2b, &rsig, msg32) == 1); - /* Verifying with (order + r,4) should always fail. */ - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderlong, sizeof(sigbderlong)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - } - /* DER parsing tests. */ - /* Zero length r/s. */ - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder_zr, sizeof(sigcder_zr)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder_zs, sizeof(sigcder_zs)) == 0); - /* Leading zeros. */ - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt1, sizeof(sigbderalt1)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt2, sizeof(sigbderalt2)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt3, sizeof(sigbderalt3)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt4, sizeof(sigbderalt4)) == 0); - sigbderalt3[4] = 1; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt3, sizeof(sigbderalt3)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - sigbderalt4[7] = 1; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt4, sizeof(sigbderalt4)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - /* Damage signature. */ - sigbder[7]++; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - sigbder[7]--; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, 6) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder) - 1) == 0); - for(i = 0; i < 8; i++) { - int c; - unsigned char orig = sigbder[i]; - /*Try every single-byte change.*/ - for (c = 0; c < 256; c++) { - if (c == orig ) { - continue; - } - sigbder[i] = c; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder)) == 0 || secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - } - sigbder[i] = orig; - } - } - - /* Test r/s equal to zero */ - { - /* (1,1) encoded in DER. */ - unsigned char sigcder[8] = {0x30, 0x06, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01}; - unsigned char sigc64[64] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }; - secp256k1_pubkey pubkeyc; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigc64, 0) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyc, &rsig, msg32) == 1); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder, sizeof(sigcder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyc) == 1); - sigcder[4] = 0; - sigc64[31] = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigc64, 0) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyb, &rsig, msg32) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder, sizeof(sigcder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyc) == 0); - sigcder[4] = 1; - sigcder[7] = 0; - sigc64[31] = 1; - sigc64[63] = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigc64, 0) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyb, &rsig, msg32) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder, sizeof(sigcder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyc) == 0); - } -} - -void run_recovery_tests(void) { - int i; - for (i = 0; i < count; i++) { - test_ecdsa_recovery_api(); - } - for (i = 0; i < 64*count; i++) { - test_ecdsa_recovery_end_to_end(); - } - test_ecdsa_recovery_edge_cases(); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h deleted file mode 100644 index eff84220..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h +++ /dev/null @@ -1,74 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_ -#define _SECP256K1_NUM_ - -#ifndef USE_NUM_NONE - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(USE_NUM_GMP) -#include "num_gmp.h" -#else -#error "Please select num implementation" -#endif - -/** Copy a number. */ -static void secp256k1_num_copy(secp256k1_num *r, const secp256k1_num *a); - -/** Convert a number's absolute value to a binary big-endian string. - * There must be enough place. */ -static void secp256k1_num_get_bin(unsigned char *r, unsigned int rlen, const secp256k1_num *a); - -/** Set a number to the value of a binary big-endian string. */ -static void secp256k1_num_set_bin(secp256k1_num *r, const unsigned char *a, unsigned int alen); - -/** Compute a modular inverse. The input must be less than the modulus. */ -static void secp256k1_num_mod_inverse(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *m); - -/** Compute the jacobi symbol (a|b). b must be positive and odd. */ -static int secp256k1_num_jacobi(const secp256k1_num *a, const secp256k1_num *b); - -/** Compare the absolute value of two numbers. */ -static int secp256k1_num_cmp(const secp256k1_num *a, const secp256k1_num *b); - -/** Test whether two number are equal (including sign). */ -static int secp256k1_num_eq(const secp256k1_num *a, const secp256k1_num *b); - -/** Add two (signed) numbers. */ -static void secp256k1_num_add(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b); - -/** Subtract two (signed) numbers. */ -static void secp256k1_num_sub(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b); - -/** Multiply two (signed) numbers. */ -static void secp256k1_num_mul(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b); - -/** Replace a number by its remainder modulo m. M's sign is ignored. The result is a number between 0 and m-1, - even if r was negative. */ -static void secp256k1_num_mod(secp256k1_num *r, const secp256k1_num *m); - -/** Right-shift the passed number by bits. */ -static void secp256k1_num_shift(secp256k1_num *r, int bits); - -/** Check whether a number is zero. */ -static int secp256k1_num_is_zero(const secp256k1_num *a); - -/** Check whether a number is one. */ -static int secp256k1_num_is_one(const secp256k1_num *a); - -/** Check whether a number is strictly negative. */ -static int secp256k1_num_is_neg(const secp256k1_num *a); - -/** Change a number's sign. */ -static void secp256k1_num_negate(secp256k1_num *r); - -#endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h deleted file mode 100644 index 7dd81308..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h +++ /dev/null @@ -1,20 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_REPR_ -#define _SECP256K1_NUM_REPR_ - -#include - -#define NUM_LIMBS ((256+GMP_NUMB_BITS-1)/GMP_NUMB_BITS) - -typedef struct { - mp_limb_t data[2*NUM_LIMBS]; - int neg; - int limbs; -} secp256k1_num; - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h deleted file mode 100644 index 3a46495e..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h +++ /dev/null @@ -1,288 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_REPR_IMPL_H_ -#define _SECP256K1_NUM_REPR_IMPL_H_ - -#include -#include -#include - -#include "util.h" -#include "num.h" - -#ifdef VERIFY -static void secp256k1_num_sanity(const secp256k1_num *a) { - VERIFY_CHECK(a->limbs == 1 || (a->limbs > 1 && a->data[a->limbs-1] != 0)); -} -#else -#define secp256k1_num_sanity(a) do { } while(0) -#endif - -static void secp256k1_num_copy(secp256k1_num *r, const secp256k1_num *a) { - *r = *a; -} - -static void secp256k1_num_get_bin(unsigned char *r, unsigned int rlen, const secp256k1_num *a) { - unsigned char tmp[65]; - int len = 0; - int shift = 0; - if (a->limbs>1 || a->data[0] != 0) { - len = mpn_get_str(tmp, 256, (mp_limb_t*)a->data, a->limbs); - } - while (shift < len && tmp[shift] == 0) shift++; - VERIFY_CHECK(len-shift <= (int)rlen); - memset(r, 0, rlen - len + shift); - if (len > shift) { - memcpy(r + rlen - len + shift, tmp + shift, len - shift); - } - memset(tmp, 0, sizeof(tmp)); -} - -static void secp256k1_num_set_bin(secp256k1_num *r, const unsigned char *a, unsigned int alen) { - int len; - VERIFY_CHECK(alen > 0); - VERIFY_CHECK(alen <= 64); - len = mpn_set_str(r->data, a, alen, 256); - if (len == 0) { - r->data[0] = 0; - len = 1; - } - VERIFY_CHECK(len <= NUM_LIMBS*2); - r->limbs = len; - r->neg = 0; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } -} - -static void secp256k1_num_add_abs(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - mp_limb_t c = mpn_add(r->data, a->data, a->limbs, b->data, b->limbs); - r->limbs = a->limbs; - if (c != 0) { - VERIFY_CHECK(r->limbs < 2*NUM_LIMBS); - r->data[r->limbs++] = c; - } -} - -static void secp256k1_num_sub_abs(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - mp_limb_t c = mpn_sub(r->data, a->data, a->limbs, b->data, b->limbs); - (void)c; - VERIFY_CHECK(c == 0); - r->limbs = a->limbs; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } -} - -static void secp256k1_num_mod(secp256k1_num *r, const secp256k1_num *m) { - secp256k1_num_sanity(r); - secp256k1_num_sanity(m); - - if (r->limbs >= m->limbs) { - mp_limb_t t[2*NUM_LIMBS]; - mpn_tdiv_qr(t, r->data, 0, r->data, r->limbs, m->data, m->limbs); - memset(t, 0, sizeof(t)); - r->limbs = m->limbs; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } - } - - if (r->neg && (r->limbs > 1 || r->data[0] != 0)) { - secp256k1_num_sub_abs(r, m, r); - r->neg = 0; - } -} - -static void secp256k1_num_mod_inverse(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *m) { - int i; - mp_limb_t g[NUM_LIMBS+1]; - mp_limb_t u[NUM_LIMBS+1]; - mp_limb_t v[NUM_LIMBS+1]; - mp_size_t sn; - mp_size_t gn; - secp256k1_num_sanity(a); - secp256k1_num_sanity(m); - - /** mpn_gcdext computes: (G,S) = gcdext(U,V), where - * * G = gcd(U,V) - * * G = U*S + V*T - * * U has equal or more limbs than V, and V has no padding - * If we set U to be (a padded version of) a, and V = m: - * G = a*S + m*T - * G = a*S mod m - * Assuming G=1: - * S = 1/a mod m - */ - VERIFY_CHECK(m->limbs <= NUM_LIMBS); - VERIFY_CHECK(m->data[m->limbs-1] != 0); - for (i = 0; i < m->limbs; i++) { - u[i] = (i < a->limbs) ? a->data[i] : 0; - v[i] = m->data[i]; - } - sn = NUM_LIMBS+1; - gn = mpn_gcdext(g, r->data, &sn, u, m->limbs, v, m->limbs); - (void)gn; - VERIFY_CHECK(gn == 1); - VERIFY_CHECK(g[0] == 1); - r->neg = a->neg ^ m->neg; - if (sn < 0) { - mpn_sub(r->data, m->data, m->limbs, r->data, -sn); - r->limbs = m->limbs; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } - } else { - r->limbs = sn; - } - memset(g, 0, sizeof(g)); - memset(u, 0, sizeof(u)); - memset(v, 0, sizeof(v)); -} - -static int secp256k1_num_jacobi(const secp256k1_num *a, const secp256k1_num *b) { - int ret; - mpz_t ga, gb; - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - VERIFY_CHECK(!b->neg && (b->limbs > 0) && (b->data[0] & 1)); - - mpz_inits(ga, gb, NULL); - - mpz_import(gb, b->limbs, -1, sizeof(mp_limb_t), 0, 0, b->data); - mpz_import(ga, a->limbs, -1, sizeof(mp_limb_t), 0, 0, a->data); - if (a->neg) { - mpz_neg(ga, ga); - } - - ret = mpz_jacobi(ga, gb); - - mpz_clears(ga, gb, NULL); - - return ret; -} - -static int secp256k1_num_is_one(const secp256k1_num *a) { - return (a->limbs == 1 && a->data[0] == 1); -} - -static int secp256k1_num_is_zero(const secp256k1_num *a) { - return (a->limbs == 1 && a->data[0] == 0); -} - -static int secp256k1_num_is_neg(const secp256k1_num *a) { - return (a->limbs > 1 || a->data[0] != 0) && a->neg; -} - -static int secp256k1_num_cmp(const secp256k1_num *a, const secp256k1_num *b) { - if (a->limbs > b->limbs) { - return 1; - } - if (a->limbs < b->limbs) { - return -1; - } - return mpn_cmp(a->data, b->data, a->limbs); -} - -static int secp256k1_num_eq(const secp256k1_num *a, const secp256k1_num *b) { - if (a->limbs > b->limbs) { - return 0; - } - if (a->limbs < b->limbs) { - return 0; - } - if ((a->neg && !secp256k1_num_is_zero(a)) != (b->neg && !secp256k1_num_is_zero(b))) { - return 0; - } - return mpn_cmp(a->data, b->data, a->limbs) == 0; -} - -static void secp256k1_num_subadd(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b, int bneg) { - if (!(b->neg ^ bneg ^ a->neg)) { /* a and b have the same sign */ - r->neg = a->neg; - if (a->limbs >= b->limbs) { - secp256k1_num_add_abs(r, a, b); - } else { - secp256k1_num_add_abs(r, b, a); - } - } else { - if (secp256k1_num_cmp(a, b) > 0) { - r->neg = a->neg; - secp256k1_num_sub_abs(r, a, b); - } else { - r->neg = b->neg ^ bneg; - secp256k1_num_sub_abs(r, b, a); - } - } -} - -static void secp256k1_num_add(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - secp256k1_num_subadd(r, a, b, 0); -} - -static void secp256k1_num_sub(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - secp256k1_num_subadd(r, a, b, 1); -} - -static void secp256k1_num_mul(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - mp_limb_t tmp[2*NUM_LIMBS+1]; - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - - VERIFY_CHECK(a->limbs + b->limbs <= 2*NUM_LIMBS+1); - if ((a->limbs==1 && a->data[0]==0) || (b->limbs==1 && b->data[0]==0)) { - r->limbs = 1; - r->neg = 0; - r->data[0] = 0; - return; - } - if (a->limbs >= b->limbs) { - mpn_mul(tmp, a->data, a->limbs, b->data, b->limbs); - } else { - mpn_mul(tmp, b->data, b->limbs, a->data, a->limbs); - } - r->limbs = a->limbs + b->limbs; - if (r->limbs > 1 && tmp[r->limbs - 1]==0) { - r->limbs--; - } - VERIFY_CHECK(r->limbs <= 2*NUM_LIMBS); - mpn_copyi(r->data, tmp, r->limbs); - r->neg = a->neg ^ b->neg; - memset(tmp, 0, sizeof(tmp)); -} - -static void secp256k1_num_shift(secp256k1_num *r, int bits) { - if (bits % GMP_NUMB_BITS) { - /* Shift within limbs. */ - mpn_rshift(r->data, r->data, r->limbs, bits % GMP_NUMB_BITS); - } - if (bits >= GMP_NUMB_BITS) { - int i; - /* Shift full limbs. */ - for (i = 0; i < r->limbs; i++) { - int index = i + (bits / GMP_NUMB_BITS); - if (index < r->limbs && index < 2*NUM_LIMBS) { - r->data[i] = r->data[index]; - } else { - r->data[i] = 0; - } - } - } - while (r->limbs>1 && r->data[r->limbs-1]==0) { - r->limbs--; - } -} - -static void secp256k1_num_negate(secp256k1_num *r) { - r->neg ^= 1; -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h deleted file mode 100644 index 0b0e3a07..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h +++ /dev/null @@ -1,24 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_IMPL_H_ -#define _SECP256K1_NUM_IMPL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include "num.h" - -#if defined(USE_NUM_GMP) -#include "num_gmp_impl.h" -#elif defined(USE_NUM_NONE) -/* Nothing. */ -#else -#error "Please select num implementation" -#endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h deleted file mode 100644 index 27e9d837..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h +++ /dev/null @@ -1,106 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_ -#define _SECP256K1_SCALAR_ - -#include "num.h" - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(EXHAUSTIVE_TEST_ORDER) -#include "scalar_low.h" -#elif defined(USE_SCALAR_4X64) -#include "scalar_4x64.h" -#elif defined(USE_SCALAR_8X32) -#include "scalar_8x32.h" -#else -#error "Please select scalar implementation" -#endif - -/** Clear a scalar to prevent the leak of sensitive data. */ -static void secp256k1_scalar_clear(secp256k1_scalar *r); - -/** Access bits from a scalar. All requested bits must belong to the same 32-bit limb. */ -static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count); - -/** Access bits from a scalar. Not constant time. */ -static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count); - -/** Set a scalar from a big endian byte array. */ -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow); - -/** Set a scalar to an unsigned integer. */ -static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v); - -/** Convert a scalar to a byte array. */ -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a); - -/** Add two scalars together (modulo the group order). Returns whether it overflowed. */ -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b); - -/** Conditionally add a power of two to a scalar. The result is not allowed to overflow. */ -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag); - -/** Multiply two scalars (modulo the group order). */ -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b); - -/** Shift a scalar right by some amount strictly between 0 and 16, returning - * the low bits that were shifted off */ -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n); - -/** Compute the square of a scalar (modulo the group order). */ -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Compute the inverse of a scalar (modulo the group order). */ -static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Compute the inverse of a scalar (modulo the group order), without constant-time guarantee. */ -static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Compute the complement of a scalar (modulo the group order). */ -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Check whether a scalar equals zero. */ -static int secp256k1_scalar_is_zero(const secp256k1_scalar *a); - -/** Check whether a scalar equals one. */ -static int secp256k1_scalar_is_one(const secp256k1_scalar *a); - -/** Check whether a scalar, considered as an nonnegative integer, is even. */ -static int secp256k1_scalar_is_even(const secp256k1_scalar *a); - -/** Check whether a scalar is higher than the group order divided by 2. */ -static int secp256k1_scalar_is_high(const secp256k1_scalar *a); - -/** Conditionally negate a number, in constant time. - * Returns -1 if the number was negated, 1 otherwise */ -static int secp256k1_scalar_cond_negate(secp256k1_scalar *a, int flag); - -#ifndef USE_NUM_NONE -/** Convert a scalar to a number. */ -static void secp256k1_scalar_get_num(secp256k1_num *r, const secp256k1_scalar *a); - -/** Get the order of the group as a number. */ -static void secp256k1_scalar_order_get_num(secp256k1_num *r); -#endif - -/** Compare two scalars. */ -static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b); - -#ifdef USE_ENDOMORPHISM -/** Find r1 and r2 such that r1+r2*2^128 = a. */ -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a); -/** Find r1 and r2 such that r1+r2*lambda = a, and r1 and r2 are maximum 128 bits long (see secp256k1_gej_mul_lambda). */ -static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a); -#endif - -/** Multiply a and b (without taking the modulus!), divide by 2**shift, and round to the nearest integer. Shift must be at least 256. */ -static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h deleted file mode 100644 index cff40603..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h +++ /dev/null @@ -1,19 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_ -#define _SECP256K1_SCALAR_REPR_ - -#include - -/** A scalar modulo the group order of the secp256k1 curve. */ -typedef struct { - uint64_t d[4]; -} secp256k1_scalar; - -#define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{((uint64_t)(d1)) << 32 | (d0), ((uint64_t)(d3)) << 32 | (d2), ((uint64_t)(d5)) << 32 | (d4), ((uint64_t)(d7)) << 32 | (d6)}} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h deleted file mode 100644 index 56e7bd82..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h +++ /dev/null @@ -1,949 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_IMPL_H_ -#define _SECP256K1_SCALAR_REPR_IMPL_H_ - -/* Limbs of the secp256k1 order. */ -#define SECP256K1_N_0 ((uint64_t)0xBFD25E8CD0364141ULL) -#define SECP256K1_N_1 ((uint64_t)0xBAAEDCE6AF48A03BULL) -#define SECP256K1_N_2 ((uint64_t)0xFFFFFFFFFFFFFFFEULL) -#define SECP256K1_N_3 ((uint64_t)0xFFFFFFFFFFFFFFFFULL) - -/* Limbs of 2^256 minus the secp256k1 order. */ -#define SECP256K1_N_C_0 (~SECP256K1_N_0 + 1) -#define SECP256K1_N_C_1 (~SECP256K1_N_1) -#define SECP256K1_N_C_2 (1) - -/* Limbs of half the secp256k1 order. */ -#define SECP256K1_N_H_0 ((uint64_t)0xDFE92F46681B20A0ULL) -#define SECP256K1_N_H_1 ((uint64_t)0x5D576E7357A4501DULL) -#define SECP256K1_N_H_2 ((uint64_t)0xFFFFFFFFFFFFFFFFULL) -#define SECP256K1_N_H_3 ((uint64_t)0x7FFFFFFFFFFFFFFFULL) - -SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) { - r->d[0] = 0; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) { - r->d[0] = v; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK((offset + count - 1) >> 6 == offset >> 6); - return (a->d[offset >> 6] >> (offset & 0x3F)) & ((((uint64_t)1) << count) - 1); -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK(count < 32); - VERIFY_CHECK(offset + count <= 256); - if ((offset + count - 1) >> 6 == offset >> 6) { - return secp256k1_scalar_get_bits(a, offset, count); - } else { - VERIFY_CHECK((offset >> 6) + 1 < 4); - return ((a->d[offset >> 6] >> (offset & 0x3F)) | (a->d[(offset >> 6) + 1] << (64 - (offset & 0x3F)))) & ((((uint64_t)1) << count) - 1); - } -} - -SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[3] < SECP256K1_N_3); /* No need for a > check. */ - no |= (a->d[2] < SECP256K1_N_2); - yes |= (a->d[2] > SECP256K1_N_2) & ~no; - no |= (a->d[1] < SECP256K1_N_1); - yes |= (a->d[1] > SECP256K1_N_1) & ~no; - yes |= (a->d[0] >= SECP256K1_N_0) & ~no; - return yes; -} - -SECP256K1_INLINE static int secp256k1_scalar_reduce(secp256k1_scalar *r, unsigned int overflow) { - uint128_t t; - VERIFY_CHECK(overflow <= 1); - t = (uint128_t)r->d[0] + overflow * SECP256K1_N_C_0; - r->d[0] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[1] + overflow * SECP256K1_N_C_1; - r->d[1] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[2] + overflow * SECP256K1_N_C_2; - r->d[2] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint64_t)r->d[3]; - r->d[3] = t & 0xFFFFFFFFFFFFFFFFULL; - return overflow; -} - -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - int overflow; - uint128_t t = (uint128_t)a->d[0] + b->d[0]; - r->d[0] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)a->d[1] + b->d[1]; - r->d[1] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)a->d[2] + b->d[2]; - r->d[2] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)a->d[3] + b->d[3]; - r->d[3] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - overflow = t + secp256k1_scalar_check_overflow(r); - VERIFY_CHECK(overflow == 0 || overflow == 1); - secp256k1_scalar_reduce(r, overflow); - return overflow; -} - -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) { - uint128_t t; - VERIFY_CHECK(bit < 256); - bit += ((uint32_t) flag - 1) & 0x100; /* forcing (bit >> 6) > 3 makes this a noop */ - t = (uint128_t)r->d[0] + (((uint64_t)((bit >> 6) == 0)) << (bit & 0x3F)); - r->d[0] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[1] + (((uint64_t)((bit >> 6) == 1)) << (bit & 0x3F)); - r->d[1] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[2] + (((uint64_t)((bit >> 6) == 2)) << (bit & 0x3F)); - r->d[2] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[3] + (((uint64_t)((bit >> 6) == 3)) << (bit & 0x3F)); - r->d[3] = t & 0xFFFFFFFFFFFFFFFFULL; -#ifdef VERIFY - VERIFY_CHECK((t >> 64) == 0); - VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0); -#endif -} - -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) { - int over; - r->d[0] = (uint64_t)b32[31] | (uint64_t)b32[30] << 8 | (uint64_t)b32[29] << 16 | (uint64_t)b32[28] << 24 | (uint64_t)b32[27] << 32 | (uint64_t)b32[26] << 40 | (uint64_t)b32[25] << 48 | (uint64_t)b32[24] << 56; - r->d[1] = (uint64_t)b32[23] | (uint64_t)b32[22] << 8 | (uint64_t)b32[21] << 16 | (uint64_t)b32[20] << 24 | (uint64_t)b32[19] << 32 | (uint64_t)b32[18] << 40 | (uint64_t)b32[17] << 48 | (uint64_t)b32[16] << 56; - r->d[2] = (uint64_t)b32[15] | (uint64_t)b32[14] << 8 | (uint64_t)b32[13] << 16 | (uint64_t)b32[12] << 24 | (uint64_t)b32[11] << 32 | (uint64_t)b32[10] << 40 | (uint64_t)b32[9] << 48 | (uint64_t)b32[8] << 56; - r->d[3] = (uint64_t)b32[7] | (uint64_t)b32[6] << 8 | (uint64_t)b32[5] << 16 | (uint64_t)b32[4] << 24 | (uint64_t)b32[3] << 32 | (uint64_t)b32[2] << 40 | (uint64_t)b32[1] << 48 | (uint64_t)b32[0] << 56; - over = secp256k1_scalar_reduce(r, secp256k1_scalar_check_overflow(r)); - if (overflow) { - *overflow = over; - } -} - -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) { - bin[0] = a->d[3] >> 56; bin[1] = a->d[3] >> 48; bin[2] = a->d[3] >> 40; bin[3] = a->d[3] >> 32; bin[4] = a->d[3] >> 24; bin[5] = a->d[3] >> 16; bin[6] = a->d[3] >> 8; bin[7] = a->d[3]; - bin[8] = a->d[2] >> 56; bin[9] = a->d[2] >> 48; bin[10] = a->d[2] >> 40; bin[11] = a->d[2] >> 32; bin[12] = a->d[2] >> 24; bin[13] = a->d[2] >> 16; bin[14] = a->d[2] >> 8; bin[15] = a->d[2]; - bin[16] = a->d[1] >> 56; bin[17] = a->d[1] >> 48; bin[18] = a->d[1] >> 40; bin[19] = a->d[1] >> 32; bin[20] = a->d[1] >> 24; bin[21] = a->d[1] >> 16; bin[22] = a->d[1] >> 8; bin[23] = a->d[1]; - bin[24] = a->d[0] >> 56; bin[25] = a->d[0] >> 48; bin[26] = a->d[0] >> 40; bin[27] = a->d[0] >> 32; bin[28] = a->d[0] >> 24; bin[29] = a->d[0] >> 16; bin[30] = a->d[0] >> 8; bin[31] = a->d[0]; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) { - return (a->d[0] | a->d[1] | a->d[2] | a->d[3]) == 0; -} - -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint64_t nonzero = 0xFFFFFFFFFFFFFFFFULL * (secp256k1_scalar_is_zero(a) == 0); - uint128_t t = (uint128_t)(~a->d[0]) + SECP256K1_N_0 + 1; - r->d[0] = t & nonzero; t >>= 64; - t += (uint128_t)(~a->d[1]) + SECP256K1_N_1; - r->d[1] = t & nonzero; t >>= 64; - t += (uint128_t)(~a->d[2]) + SECP256K1_N_2; - r->d[2] = t & nonzero; t >>= 64; - t += (uint128_t)(~a->d[3]) + SECP256K1_N_3; - r->d[3] = t & nonzero; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) { - return ((a->d[0] ^ 1) | a->d[1] | a->d[2] | a->d[3]) == 0; -} - -static int secp256k1_scalar_is_high(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[3] < SECP256K1_N_H_3); - yes |= (a->d[3] > SECP256K1_N_H_3) & ~no; - no |= (a->d[2] < SECP256K1_N_H_2) & ~yes; /* No need for a > check. */ - no |= (a->d[1] < SECP256K1_N_H_1) & ~yes; - yes |= (a->d[1] > SECP256K1_N_H_1) & ~no; - yes |= (a->d[0] > SECP256K1_N_H_0) & ~no; - return yes; -} - -static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) { - /* If we are flag = 0, mask = 00...00 and this is a no-op; - * if we are flag = 1, mask = 11...11 and this is identical to secp256k1_scalar_negate */ - uint64_t mask = !flag - 1; - uint64_t nonzero = (secp256k1_scalar_is_zero(r) != 0) - 1; - uint128_t t = (uint128_t)(r->d[0] ^ mask) + ((SECP256K1_N_0 + 1) & mask); - r->d[0] = t & nonzero; t >>= 64; - t += (uint128_t)(r->d[1] ^ mask) + (SECP256K1_N_1 & mask); - r->d[1] = t & nonzero; t >>= 64; - t += (uint128_t)(r->d[2] ^ mask) + (SECP256K1_N_2 & mask); - r->d[2] = t & nonzero; t >>= 64; - t += (uint128_t)(r->d[3] ^ mask) + (SECP256K1_N_3 & mask); - r->d[3] = t & nonzero; - return 2 * (mask == 0) - 1; -} - -/* Inspired by the macros in OpenSSL's crypto/bn/asm/x86_64-gcc.c. */ - -/** Add a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd(a,b) { \ - uint64_t tl, th; \ - { \ - uint128_t t = (uint128_t)a * b; \ - th = t >> 64; /* at most 0xFFFFFFFFFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFFFFFFFFFF */ \ - c1 += th; /* overflow is handled on the next line */ \ - c2 += (c1 < th) ? 1 : 0; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK((c1 >= th) || (c2 != 0)); \ -} - -/** Add a*b to the number defined by (c0,c1). c1 must never overflow. */ -#define muladd_fast(a,b) { \ - uint64_t tl, th; \ - { \ - uint128_t t = (uint128_t)a * b; \ - th = t >> 64; /* at most 0xFFFFFFFFFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFFFFFFFFFF */ \ - c1 += th; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK(c1 >= th); \ -} - -/** Add 2*a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd2(a,b) { \ - uint64_t tl, th, th2, tl2; \ - { \ - uint128_t t = (uint128_t)a * b; \ - th = t >> 64; /* at most 0xFFFFFFFFFFFFFFFE */ \ - tl = t; \ - } \ - th2 = th + th; /* at most 0xFFFFFFFFFFFFFFFE (in case th was 0x7FFFFFFFFFFFFFFF) */ \ - c2 += (th2 < th) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((th2 >= th) || (c2 != 0)); \ - tl2 = tl + tl; /* at most 0xFFFFFFFFFFFFFFFE (in case the lowest 63 bits of tl were 0x7FFFFFFFFFFFFFFF) */ \ - th2 += (tl2 < tl) ? 1 : 0; /* at most 0xFFFFFFFFFFFFFFFF */ \ - c0 += tl2; /* overflow is handled on the next line */ \ - th2 += (c0 < tl2) ? 1 : 0; /* second overflow is handled on the next line */ \ - c2 += (c0 < tl2) & (th2 == 0); /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c0 >= tl2) || (th2 != 0) || (c2 != 0)); \ - c1 += th2; /* overflow is handled on the next line */ \ - c2 += (c1 < th2) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 >= th2) || (c2 != 0)); \ -} - -/** Add a to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define sumadd(a) { \ - unsigned int over; \ - c0 += (a); /* overflow is handled on the next line */ \ - over = (c0 < (a)) ? 1 : 0; \ - c1 += over; /* overflow is handled on the next line */ \ - c2 += (c1 < over) ? 1 : 0; /* never overflows by contract */ \ -} - -/** Add a to the number defined by (c0,c1). c1 must never overflow, c2 must be zero. */ -#define sumadd_fast(a) { \ - c0 += (a); /* overflow is handled on the next line */ \ - c1 += (c0 < (a)) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \ - VERIFY_CHECK(c2 == 0); \ -} - -/** Extract the lowest 64 bits of (c0,c1,c2) into n, and left shift the number 64 bits. */ -#define extract(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = c2; \ - c2 = 0; \ -} - -/** Extract the lowest 64 bits of (c0,c1,c2) into n, and left shift the number 64 bits. c2 is required to be zero. */ -#define extract_fast(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = 0; \ - VERIFY_CHECK(c2 == 0); \ -} - -static void secp256k1_scalar_reduce_512(secp256k1_scalar *r, const uint64_t *l) { -#ifdef USE_ASM_X86_64 - /* Reduce 512 bits into 385. */ - uint64_t m0, m1, m2, m3, m4, m5, m6; - uint64_t p0, p1, p2, p3, p4; - uint64_t c; - - __asm__ __volatile__( - /* Preload. */ - "movq 32(%%rsi), %%r11\n" - "movq 40(%%rsi), %%r12\n" - "movq 48(%%rsi), %%r13\n" - "movq 56(%%rsi), %%r14\n" - /* Initialize r8,r9,r10 */ - "movq 0(%%rsi), %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9) += n0 * c0 */ - "movq %8, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* extract m0 */ - "movq %%r8, %q0\n" - "xorq %%r8, %%r8\n" - /* (r9,r10) += l1 */ - "addq 8(%%rsi), %%r9\n" - "adcq $0, %%r10\n" - /* (r9,r10,r8) += n1 * c0 */ - "movq %8, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += n0 * c1 */ - "movq %9, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* extract m1 */ - "movq %%r9, %q1\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += l2 */ - "addq 16(%%rsi), %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += n2 * c0 */ - "movq %8, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += n1 * c1 */ - "movq %9, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += n0 */ - "addq %%r11, %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* extract m2 */ - "movq %%r10, %q2\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += l3 */ - "addq 24(%%rsi), %%r8\n" - "adcq $0, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += n3 * c0 */ - "movq %8, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += n2 * c1 */ - "movq %9, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += n1 */ - "addq %%r12, %%r8\n" - "adcq $0, %%r9\n" - "adcq $0, %%r10\n" - /* extract m3 */ - "movq %%r8, %q3\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += n3 * c1 */ - "movq %9, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += n2 */ - "addq %%r13, %%r9\n" - "adcq $0, %%r10\n" - "adcq $0, %%r8\n" - /* extract m4 */ - "movq %%r9, %q4\n" - /* (r10,r8) += n3 */ - "addq %%r14, %%r10\n" - "adcq $0, %%r8\n" - /* extract m5 */ - "movq %%r10, %q5\n" - /* extract m6 */ - "movq %%r8, %q6\n" - : "=g"(m0), "=g"(m1), "=g"(m2), "=g"(m3), "=g"(m4), "=g"(m5), "=g"(m6) - : "S"(l), "n"(SECP256K1_N_C_0), "n"(SECP256K1_N_C_1) - : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "cc"); - - /* Reduce 385 bits into 258. */ - __asm__ __volatile__( - /* Preload */ - "movq %q9, %%r11\n" - "movq %q10, %%r12\n" - "movq %q11, %%r13\n" - /* Initialize (r8,r9,r10) */ - "movq %q5, %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9) += m4 * c0 */ - "movq %12, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* extract p0 */ - "movq %%r8, %q0\n" - "xorq %%r8, %%r8\n" - /* (r9,r10) += m1 */ - "addq %q6, %%r9\n" - "adcq $0, %%r10\n" - /* (r9,r10,r8) += m5 * c0 */ - "movq %12, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += m4 * c1 */ - "movq %13, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* extract p1 */ - "movq %%r9, %q1\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += m2 */ - "addq %q7, %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += m6 * c0 */ - "movq %12, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += m5 * c1 */ - "movq %13, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += m4 */ - "addq %%r11, %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* extract p2 */ - "movq %%r10, %q2\n" - /* (r8,r9) += m3 */ - "addq %q8, %%r8\n" - "adcq $0, %%r9\n" - /* (r8,r9) += m6 * c1 */ - "movq %13, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* (r8,r9) += m5 */ - "addq %%r12, %%r8\n" - "adcq $0, %%r9\n" - /* extract p3 */ - "movq %%r8, %q3\n" - /* (r9) += m6 */ - "addq %%r13, %%r9\n" - /* extract p4 */ - "movq %%r9, %q4\n" - : "=&g"(p0), "=&g"(p1), "=&g"(p2), "=g"(p3), "=g"(p4) - : "g"(m0), "g"(m1), "g"(m2), "g"(m3), "g"(m4), "g"(m5), "g"(m6), "n"(SECP256K1_N_C_0), "n"(SECP256K1_N_C_1) - : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "cc"); - - /* Reduce 258 bits into 256. */ - __asm__ __volatile__( - /* Preload */ - "movq %q5, %%r10\n" - /* (rax,rdx) = p4 * c0 */ - "movq %7, %%rax\n" - "mulq %%r10\n" - /* (rax,rdx) += p0 */ - "addq %q1, %%rax\n" - "adcq $0, %%rdx\n" - /* extract r0 */ - "movq %%rax, 0(%q6)\n" - /* Move to (r8,r9) */ - "movq %%rdx, %%r8\n" - "xorq %%r9, %%r9\n" - /* (r8,r9) += p1 */ - "addq %q2, %%r8\n" - "adcq $0, %%r9\n" - /* (r8,r9) += p4 * c1 */ - "movq %8, %%rax\n" - "mulq %%r10\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* Extract r1 */ - "movq %%r8, 8(%q6)\n" - "xorq %%r8, %%r8\n" - /* (r9,r8) += p4 */ - "addq %%r10, %%r9\n" - "adcq $0, %%r8\n" - /* (r9,r8) += p2 */ - "addq %q3, %%r9\n" - "adcq $0, %%r8\n" - /* Extract r2 */ - "movq %%r9, 16(%q6)\n" - "xorq %%r9, %%r9\n" - /* (r8,r9) += p3 */ - "addq %q4, %%r8\n" - "adcq $0, %%r9\n" - /* Extract r3 */ - "movq %%r8, 24(%q6)\n" - /* Extract c */ - "movq %%r9, %q0\n" - : "=g"(c) - : "g"(p0), "g"(p1), "g"(p2), "g"(p3), "g"(p4), "D"(r), "n"(SECP256K1_N_C_0), "n"(SECP256K1_N_C_1) - : "rax", "rdx", "r8", "r9", "r10", "cc", "memory"); -#else - uint128_t c; - uint64_t c0, c1, c2; - uint64_t n0 = l[4], n1 = l[5], n2 = l[6], n3 = l[7]; - uint64_t m0, m1, m2, m3, m4, m5; - uint32_t m6; - uint64_t p0, p1, p2, p3; - uint32_t p4; - - /* Reduce 512 bits into 385. */ - /* m[0..6] = l[0..3] + n[0..3] * SECP256K1_N_C. */ - c0 = l[0]; c1 = 0; c2 = 0; - muladd_fast(n0, SECP256K1_N_C_0); - extract_fast(m0); - sumadd_fast(l[1]); - muladd(n1, SECP256K1_N_C_0); - muladd(n0, SECP256K1_N_C_1); - extract(m1); - sumadd(l[2]); - muladd(n2, SECP256K1_N_C_0); - muladd(n1, SECP256K1_N_C_1); - sumadd(n0); - extract(m2); - sumadd(l[3]); - muladd(n3, SECP256K1_N_C_0); - muladd(n2, SECP256K1_N_C_1); - sumadd(n1); - extract(m3); - muladd(n3, SECP256K1_N_C_1); - sumadd(n2); - extract(m4); - sumadd_fast(n3); - extract_fast(m5); - VERIFY_CHECK(c0 <= 1); - m6 = c0; - - /* Reduce 385 bits into 258. */ - /* p[0..4] = m[0..3] + m[4..6] * SECP256K1_N_C. */ - c0 = m0; c1 = 0; c2 = 0; - muladd_fast(m4, SECP256K1_N_C_0); - extract_fast(p0); - sumadd_fast(m1); - muladd(m5, SECP256K1_N_C_0); - muladd(m4, SECP256K1_N_C_1); - extract(p1); - sumadd(m2); - muladd(m6, SECP256K1_N_C_0); - muladd(m5, SECP256K1_N_C_1); - sumadd(m4); - extract(p2); - sumadd_fast(m3); - muladd_fast(m6, SECP256K1_N_C_1); - sumadd_fast(m5); - extract_fast(p3); - p4 = c0 + m6; - VERIFY_CHECK(p4 <= 2); - - /* Reduce 258 bits into 256. */ - /* r[0..3] = p[0..3] + p[4] * SECP256K1_N_C. */ - c = p0 + (uint128_t)SECP256K1_N_C_0 * p4; - r->d[0] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; - c += p1 + (uint128_t)SECP256K1_N_C_1 * p4; - r->d[1] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; - c += p2 + (uint128_t)p4; - r->d[2] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; - c += p3; - r->d[3] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; -#endif - - /* Final reduction of r. */ - secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r)); -} - -static void secp256k1_scalar_mul_512(uint64_t l[8], const secp256k1_scalar *a, const secp256k1_scalar *b) { -#ifdef USE_ASM_X86_64 - const uint64_t *pb = b->d; - __asm__ __volatile__( - /* Preload */ - "movq 0(%%rdi), %%r15\n" - "movq 8(%%rdi), %%rbx\n" - "movq 16(%%rdi), %%rcx\n" - "movq 0(%%rdx), %%r11\n" - "movq 8(%%rdx), %%r12\n" - "movq 16(%%rdx), %%r13\n" - "movq 24(%%rdx), %%r14\n" - /* (rax,rdx) = a0 * b0 */ - "movq %%r15, %%rax\n" - "mulq %%r11\n" - /* Extract l0 */ - "movq %%rax, 0(%%rsi)\n" - /* (r8,r9,r10) = (rdx) */ - "movq %%rdx, %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += a0 * b1 */ - "movq %%r15, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a1 * b0 */ - "movq %%rbx, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l1 */ - "movq %%r8, 8(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += a0 * b2 */ - "movq %%r15, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a1 * b1 */ - "movq %%rbx, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a2 * b0 */ - "movq %%rcx, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l2 */ - "movq %%r9, 16(%%rsi)\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += a0 * b3 */ - "movq %%r15, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* Preload a3 */ - "movq 24(%%rdi), %%r15\n" - /* (r10,r8,r9) += a1 * b2 */ - "movq %%rbx, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += a2 * b1 */ - "movq %%rcx, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += a3 * b0 */ - "movq %%r15, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* Extract l3 */ - "movq %%r10, 24(%%rsi)\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += a1 * b3 */ - "movq %%rbx, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a2 * b2 */ - "movq %%rcx, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a3 * b1 */ - "movq %%r15, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l4 */ - "movq %%r8, 32(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += a2 * b3 */ - "movq %%rcx, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a3 * b2 */ - "movq %%r15, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l5 */ - "movq %%r9, 40(%%rsi)\n" - /* (r10,r8) += a3 * b3 */ - "movq %%r15, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - /* Extract l6 */ - "movq %%r10, 48(%%rsi)\n" - /* Extract l7 */ - "movq %%r8, 56(%%rsi)\n" - : "+d"(pb) - : "S"(l), "D"(a->d) - : "rax", "rbx", "rcx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "cc", "memory"); -#else - /* 160 bit accumulator. */ - uint64_t c0 = 0, c1 = 0; - uint32_t c2 = 0; - - /* l[0..7] = a[0..3] * b[0..3]. */ - muladd_fast(a->d[0], b->d[0]); - extract_fast(l[0]); - muladd(a->d[0], b->d[1]); - muladd(a->d[1], b->d[0]); - extract(l[1]); - muladd(a->d[0], b->d[2]); - muladd(a->d[1], b->d[1]); - muladd(a->d[2], b->d[0]); - extract(l[2]); - muladd(a->d[0], b->d[3]); - muladd(a->d[1], b->d[2]); - muladd(a->d[2], b->d[1]); - muladd(a->d[3], b->d[0]); - extract(l[3]); - muladd(a->d[1], b->d[3]); - muladd(a->d[2], b->d[2]); - muladd(a->d[3], b->d[1]); - extract(l[4]); - muladd(a->d[2], b->d[3]); - muladd(a->d[3], b->d[2]); - extract(l[5]); - muladd_fast(a->d[3], b->d[3]); - extract_fast(l[6]); - VERIFY_CHECK(c1 == 0); - l[7] = c0; -#endif -} - -static void secp256k1_scalar_sqr_512(uint64_t l[8], const secp256k1_scalar *a) { -#ifdef USE_ASM_X86_64 - __asm__ __volatile__( - /* Preload */ - "movq 0(%%rdi), %%r11\n" - "movq 8(%%rdi), %%r12\n" - "movq 16(%%rdi), %%r13\n" - "movq 24(%%rdi), %%r14\n" - /* (rax,rdx) = a0 * a0 */ - "movq %%r11, %%rax\n" - "mulq %%r11\n" - /* Extract l0 */ - "movq %%rax, 0(%%rsi)\n" - /* (r8,r9,r10) = (rdx,0) */ - "movq %%rdx, %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += 2 * a0 * a1 */ - "movq %%r11, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l1 */ - "movq %%r8, 8(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += 2 * a0 * a2 */ - "movq %%r11, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a1 * a1 */ - "movq %%r12, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l2 */ - "movq %%r9, 16(%%rsi)\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += 2 * a0 * a3 */ - "movq %%r11, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += 2 * a1 * a2 */ - "movq %%r12, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* Extract l3 */ - "movq %%r10, 24(%%rsi)\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += 2 * a1 * a3 */ - "movq %%r12, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a2 * a2 */ - "movq %%r13, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l4 */ - "movq %%r8, 32(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += 2 * a2 * a3 */ - "movq %%r13, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l5 */ - "movq %%r9, 40(%%rsi)\n" - /* (r10,r8) += a3 * a3 */ - "movq %%r14, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - /* Extract l6 */ - "movq %%r10, 48(%%rsi)\n" - /* Extract l7 */ - "movq %%r8, 56(%%rsi)\n" - : - : "S"(l), "D"(a->d) - : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "cc", "memory"); -#else - /* 160 bit accumulator. */ - uint64_t c0 = 0, c1 = 0; - uint32_t c2 = 0; - - /* l[0..7] = a[0..3] * b[0..3]. */ - muladd_fast(a->d[0], a->d[0]); - extract_fast(l[0]); - muladd2(a->d[0], a->d[1]); - extract(l[1]); - muladd2(a->d[0], a->d[2]); - muladd(a->d[1], a->d[1]); - extract(l[2]); - muladd2(a->d[0], a->d[3]); - muladd2(a->d[1], a->d[2]); - extract(l[3]); - muladd2(a->d[1], a->d[3]); - muladd(a->d[2], a->d[2]); - extract(l[4]); - muladd2(a->d[2], a->d[3]); - extract(l[5]); - muladd_fast(a->d[3], a->d[3]); - extract_fast(l[6]); - VERIFY_CHECK(c1 == 0); - l[7] = c0; -#endif -} - -#undef sumadd -#undef sumadd_fast -#undef muladd -#undef muladd_fast -#undef muladd2 -#undef extract -#undef extract_fast - -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - uint64_t l[8]; - secp256k1_scalar_mul_512(l, a, b); - secp256k1_scalar_reduce_512(r, l); -} - -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) { - int ret; - VERIFY_CHECK(n > 0); - VERIFY_CHECK(n < 16); - ret = r->d[0] & ((1 << n) - 1); - r->d[0] = (r->d[0] >> n) + (r->d[1] << (64 - n)); - r->d[1] = (r->d[1] >> n) + (r->d[2] << (64 - n)); - r->d[2] = (r->d[2] >> n) + (r->d[3] << (64 - n)); - r->d[3] = (r->d[3] >> n); - return ret; -} - -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint64_t l[8]; - secp256k1_scalar_sqr_512(l, a); - secp256k1_scalar_reduce_512(r, l); -} - -#ifdef USE_ENDOMORPHISM -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - r1->d[0] = a->d[0]; - r1->d[1] = a->d[1]; - r1->d[2] = 0; - r1->d[3] = 0; - r2->d[0] = a->d[2]; - r2->d[1] = a->d[3]; - r2->d[2] = 0; - r2->d[3] = 0; -} -#endif - -SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { - return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3])) == 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) { - uint64_t l[8]; - unsigned int shiftlimbs; - unsigned int shiftlow; - unsigned int shifthigh; - VERIFY_CHECK(shift >= 256); - secp256k1_scalar_mul_512(l, a, b); - shiftlimbs = shift >> 6; - shiftlow = shift & 0x3F; - shifthigh = 64 - shiftlow; - r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[1] = shift < 448 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[2] = shift < 384 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[3] = shift < 320 ? (l[3 + shiftlimbs] >> shiftlow) : 0; - secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 6] >> ((shift - 1) & 0x3f)) & 1); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h deleted file mode 100644 index 1319664f..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h +++ /dev/null @@ -1,19 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_ -#define _SECP256K1_SCALAR_REPR_ - -#include - -/** A scalar modulo the group order of the secp256k1 curve. */ -typedef struct { - uint32_t d[8]; -} secp256k1_scalar; - -#define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)}} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h deleted file mode 100644 index aae4f35c..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h +++ /dev/null @@ -1,721 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_IMPL_H_ -#define _SECP256K1_SCALAR_REPR_IMPL_H_ - -/* Limbs of the secp256k1 order. */ -#define SECP256K1_N_0 ((uint32_t)0xD0364141UL) -#define SECP256K1_N_1 ((uint32_t)0xBFD25E8CUL) -#define SECP256K1_N_2 ((uint32_t)0xAF48A03BUL) -#define SECP256K1_N_3 ((uint32_t)0xBAAEDCE6UL) -#define SECP256K1_N_4 ((uint32_t)0xFFFFFFFEUL) -#define SECP256K1_N_5 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_6 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_7 ((uint32_t)0xFFFFFFFFUL) - -/* Limbs of 2^256 minus the secp256k1 order. */ -#define SECP256K1_N_C_0 (~SECP256K1_N_0 + 1) -#define SECP256K1_N_C_1 (~SECP256K1_N_1) -#define SECP256K1_N_C_2 (~SECP256K1_N_2) -#define SECP256K1_N_C_3 (~SECP256K1_N_3) -#define SECP256K1_N_C_4 (1) - -/* Limbs of half the secp256k1 order. */ -#define SECP256K1_N_H_0 ((uint32_t)0x681B20A0UL) -#define SECP256K1_N_H_1 ((uint32_t)0xDFE92F46UL) -#define SECP256K1_N_H_2 ((uint32_t)0x57A4501DUL) -#define SECP256K1_N_H_3 ((uint32_t)0x5D576E73UL) -#define SECP256K1_N_H_4 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_H_5 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_H_6 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_H_7 ((uint32_t)0x7FFFFFFFUL) - -SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) { - r->d[0] = 0; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; - r->d[4] = 0; - r->d[5] = 0; - r->d[6] = 0; - r->d[7] = 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) { - r->d[0] = v; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; - r->d[4] = 0; - r->d[5] = 0; - r->d[6] = 0; - r->d[7] = 0; -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK((offset + count - 1) >> 5 == offset >> 5); - return (a->d[offset >> 5] >> (offset & 0x1F)) & ((1 << count) - 1); -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK(count < 32); - VERIFY_CHECK(offset + count <= 256); - if ((offset + count - 1) >> 5 == offset >> 5) { - return secp256k1_scalar_get_bits(a, offset, count); - } else { - VERIFY_CHECK((offset >> 5) + 1 < 8); - return ((a->d[offset >> 5] >> (offset & 0x1F)) | (a->d[(offset >> 5) + 1] << (32 - (offset & 0x1F)))) & ((((uint32_t)1) << count) - 1); - } -} - -SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[7] < SECP256K1_N_7); /* No need for a > check. */ - no |= (a->d[6] < SECP256K1_N_6); /* No need for a > check. */ - no |= (a->d[5] < SECP256K1_N_5); /* No need for a > check. */ - no |= (a->d[4] < SECP256K1_N_4); - yes |= (a->d[4] > SECP256K1_N_4) & ~no; - no |= (a->d[3] < SECP256K1_N_3) & ~yes; - yes |= (a->d[3] > SECP256K1_N_3) & ~no; - no |= (a->d[2] < SECP256K1_N_2) & ~yes; - yes |= (a->d[2] > SECP256K1_N_2) & ~no; - no |= (a->d[1] < SECP256K1_N_1) & ~yes; - yes |= (a->d[1] > SECP256K1_N_1) & ~no; - yes |= (a->d[0] >= SECP256K1_N_0) & ~no; - return yes; -} - -SECP256K1_INLINE static int secp256k1_scalar_reduce(secp256k1_scalar *r, uint32_t overflow) { - uint64_t t; - VERIFY_CHECK(overflow <= 1); - t = (uint64_t)r->d[0] + overflow * SECP256K1_N_C_0; - r->d[0] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[1] + overflow * SECP256K1_N_C_1; - r->d[1] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[2] + overflow * SECP256K1_N_C_2; - r->d[2] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[3] + overflow * SECP256K1_N_C_3; - r->d[3] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[4] + overflow * SECP256K1_N_C_4; - r->d[4] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[5]; - r->d[5] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[6]; - r->d[6] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[7]; - r->d[7] = t & 0xFFFFFFFFUL; - return overflow; -} - -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - int overflow; - uint64_t t = (uint64_t)a->d[0] + b->d[0]; - r->d[0] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[1] + b->d[1]; - r->d[1] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[2] + b->d[2]; - r->d[2] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[3] + b->d[3]; - r->d[3] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[4] + b->d[4]; - r->d[4] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[5] + b->d[5]; - r->d[5] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[6] + b->d[6]; - r->d[6] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[7] + b->d[7]; - r->d[7] = t & 0xFFFFFFFFULL; t >>= 32; - overflow = t + secp256k1_scalar_check_overflow(r); - VERIFY_CHECK(overflow == 0 || overflow == 1); - secp256k1_scalar_reduce(r, overflow); - return overflow; -} - -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) { - uint64_t t; - VERIFY_CHECK(bit < 256); - bit += ((uint32_t) flag - 1) & 0x100; /* forcing (bit >> 5) > 7 makes this a noop */ - t = (uint64_t)r->d[0] + (((uint32_t)((bit >> 5) == 0)) << (bit & 0x1F)); - r->d[0] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[1] + (((uint32_t)((bit >> 5) == 1)) << (bit & 0x1F)); - r->d[1] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[2] + (((uint32_t)((bit >> 5) == 2)) << (bit & 0x1F)); - r->d[2] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[3] + (((uint32_t)((bit >> 5) == 3)) << (bit & 0x1F)); - r->d[3] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[4] + (((uint32_t)((bit >> 5) == 4)) << (bit & 0x1F)); - r->d[4] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[5] + (((uint32_t)((bit >> 5) == 5)) << (bit & 0x1F)); - r->d[5] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[6] + (((uint32_t)((bit >> 5) == 6)) << (bit & 0x1F)); - r->d[6] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[7] + (((uint32_t)((bit >> 5) == 7)) << (bit & 0x1F)); - r->d[7] = t & 0xFFFFFFFFULL; -#ifdef VERIFY - VERIFY_CHECK((t >> 32) == 0); - VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0); -#endif -} - -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) { - int over; - r->d[0] = (uint32_t)b32[31] | (uint32_t)b32[30] << 8 | (uint32_t)b32[29] << 16 | (uint32_t)b32[28] << 24; - r->d[1] = (uint32_t)b32[27] | (uint32_t)b32[26] << 8 | (uint32_t)b32[25] << 16 | (uint32_t)b32[24] << 24; - r->d[2] = (uint32_t)b32[23] | (uint32_t)b32[22] << 8 | (uint32_t)b32[21] << 16 | (uint32_t)b32[20] << 24; - r->d[3] = (uint32_t)b32[19] | (uint32_t)b32[18] << 8 | (uint32_t)b32[17] << 16 | (uint32_t)b32[16] << 24; - r->d[4] = (uint32_t)b32[15] | (uint32_t)b32[14] << 8 | (uint32_t)b32[13] << 16 | (uint32_t)b32[12] << 24; - r->d[5] = (uint32_t)b32[11] | (uint32_t)b32[10] << 8 | (uint32_t)b32[9] << 16 | (uint32_t)b32[8] << 24; - r->d[6] = (uint32_t)b32[7] | (uint32_t)b32[6] << 8 | (uint32_t)b32[5] << 16 | (uint32_t)b32[4] << 24; - r->d[7] = (uint32_t)b32[3] | (uint32_t)b32[2] << 8 | (uint32_t)b32[1] << 16 | (uint32_t)b32[0] << 24; - over = secp256k1_scalar_reduce(r, secp256k1_scalar_check_overflow(r)); - if (overflow) { - *overflow = over; - } -} - -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) { - bin[0] = a->d[7] >> 24; bin[1] = a->d[7] >> 16; bin[2] = a->d[7] >> 8; bin[3] = a->d[7]; - bin[4] = a->d[6] >> 24; bin[5] = a->d[6] >> 16; bin[6] = a->d[6] >> 8; bin[7] = a->d[6]; - bin[8] = a->d[5] >> 24; bin[9] = a->d[5] >> 16; bin[10] = a->d[5] >> 8; bin[11] = a->d[5]; - bin[12] = a->d[4] >> 24; bin[13] = a->d[4] >> 16; bin[14] = a->d[4] >> 8; bin[15] = a->d[4]; - bin[16] = a->d[3] >> 24; bin[17] = a->d[3] >> 16; bin[18] = a->d[3] >> 8; bin[19] = a->d[3]; - bin[20] = a->d[2] >> 24; bin[21] = a->d[2] >> 16; bin[22] = a->d[2] >> 8; bin[23] = a->d[2]; - bin[24] = a->d[1] >> 24; bin[25] = a->d[1] >> 16; bin[26] = a->d[1] >> 8; bin[27] = a->d[1]; - bin[28] = a->d[0] >> 24; bin[29] = a->d[0] >> 16; bin[30] = a->d[0] >> 8; bin[31] = a->d[0]; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) { - return (a->d[0] | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0; -} - -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(a) == 0); - uint64_t t = (uint64_t)(~a->d[0]) + SECP256K1_N_0 + 1; - r->d[0] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[1]) + SECP256K1_N_1; - r->d[1] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[2]) + SECP256K1_N_2; - r->d[2] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[3]) + SECP256K1_N_3; - r->d[3] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[4]) + SECP256K1_N_4; - r->d[4] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[5]) + SECP256K1_N_5; - r->d[5] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[6]) + SECP256K1_N_6; - r->d[6] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[7]) + SECP256K1_N_7; - r->d[7] = t & nonzero; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) { - return ((a->d[0] ^ 1) | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0; -} - -static int secp256k1_scalar_is_high(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[7] < SECP256K1_N_H_7); - yes |= (a->d[7] > SECP256K1_N_H_7) & ~no; - no |= (a->d[6] < SECP256K1_N_H_6) & ~yes; /* No need for a > check. */ - no |= (a->d[5] < SECP256K1_N_H_5) & ~yes; /* No need for a > check. */ - no |= (a->d[4] < SECP256K1_N_H_4) & ~yes; /* No need for a > check. */ - no |= (a->d[3] < SECP256K1_N_H_3) & ~yes; - yes |= (a->d[3] > SECP256K1_N_H_3) & ~no; - no |= (a->d[2] < SECP256K1_N_H_2) & ~yes; - yes |= (a->d[2] > SECP256K1_N_H_2) & ~no; - no |= (a->d[1] < SECP256K1_N_H_1) & ~yes; - yes |= (a->d[1] > SECP256K1_N_H_1) & ~no; - yes |= (a->d[0] > SECP256K1_N_H_0) & ~no; - return yes; -} - -static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) { - /* If we are flag = 0, mask = 00...00 and this is a no-op; - * if we are flag = 1, mask = 11...11 and this is identical to secp256k1_scalar_negate */ - uint32_t mask = !flag - 1; - uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(r) == 0); - uint64_t t = (uint64_t)(r->d[0] ^ mask) + ((SECP256K1_N_0 + 1) & mask); - r->d[0] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[1] ^ mask) + (SECP256K1_N_1 & mask); - r->d[1] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[2] ^ mask) + (SECP256K1_N_2 & mask); - r->d[2] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[3] ^ mask) + (SECP256K1_N_3 & mask); - r->d[3] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[4] ^ mask) + (SECP256K1_N_4 & mask); - r->d[4] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[5] ^ mask) + (SECP256K1_N_5 & mask); - r->d[5] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[6] ^ mask) + (SECP256K1_N_6 & mask); - r->d[6] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[7] ^ mask) + (SECP256K1_N_7 & mask); - r->d[7] = t & nonzero; - return 2 * (mask == 0) - 1; -} - - -/* Inspired by the macros in OpenSSL's crypto/bn/asm/x86_64-gcc.c. */ - -/** Add a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd(a,b) { \ - uint32_t tl, th; \ - { \ - uint64_t t = (uint64_t)a * b; \ - th = t >> 32; /* at most 0xFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \ - c1 += th; /* overflow is handled on the next line */ \ - c2 += (c1 < th) ? 1 : 0; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK((c1 >= th) || (c2 != 0)); \ -} - -/** Add a*b to the number defined by (c0,c1). c1 must never overflow. */ -#define muladd_fast(a,b) { \ - uint32_t tl, th; \ - { \ - uint64_t t = (uint64_t)a * b; \ - th = t >> 32; /* at most 0xFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \ - c1 += th; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK(c1 >= th); \ -} - -/** Add 2*a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd2(a,b) { \ - uint32_t tl, th, th2, tl2; \ - { \ - uint64_t t = (uint64_t)a * b; \ - th = t >> 32; /* at most 0xFFFFFFFE */ \ - tl = t; \ - } \ - th2 = th + th; /* at most 0xFFFFFFFE (in case th was 0x7FFFFFFF) */ \ - c2 += (th2 < th) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((th2 >= th) || (c2 != 0)); \ - tl2 = tl + tl; /* at most 0xFFFFFFFE (in case the lowest 63 bits of tl were 0x7FFFFFFF) */ \ - th2 += (tl2 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \ - c0 += tl2; /* overflow is handled on the next line */ \ - th2 += (c0 < tl2) ? 1 : 0; /* second overflow is handled on the next line */ \ - c2 += (c0 < tl2) & (th2 == 0); /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c0 >= tl2) || (th2 != 0) || (c2 != 0)); \ - c1 += th2; /* overflow is handled on the next line */ \ - c2 += (c1 < th2) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 >= th2) || (c2 != 0)); \ -} - -/** Add a to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define sumadd(a) { \ - unsigned int over; \ - c0 += (a); /* overflow is handled on the next line */ \ - over = (c0 < (a)) ? 1 : 0; \ - c1 += over; /* overflow is handled on the next line */ \ - c2 += (c1 < over) ? 1 : 0; /* never overflows by contract */ \ -} - -/** Add a to the number defined by (c0,c1). c1 must never overflow, c2 must be zero. */ -#define sumadd_fast(a) { \ - c0 += (a); /* overflow is handled on the next line */ \ - c1 += (c0 < (a)) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \ - VERIFY_CHECK(c2 == 0); \ -} - -/** Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits. */ -#define extract(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = c2; \ - c2 = 0; \ -} - -/** Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits. c2 is required to be zero. */ -#define extract_fast(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = 0; \ - VERIFY_CHECK(c2 == 0); \ -} - -static void secp256k1_scalar_reduce_512(secp256k1_scalar *r, const uint32_t *l) { - uint64_t c; - uint32_t n0 = l[8], n1 = l[9], n2 = l[10], n3 = l[11], n4 = l[12], n5 = l[13], n6 = l[14], n7 = l[15]; - uint32_t m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12; - uint32_t p0, p1, p2, p3, p4, p5, p6, p7, p8; - - /* 96 bit accumulator. */ - uint32_t c0, c1, c2; - - /* Reduce 512 bits into 385. */ - /* m[0..12] = l[0..7] + n[0..7] * SECP256K1_N_C. */ - c0 = l[0]; c1 = 0; c2 = 0; - muladd_fast(n0, SECP256K1_N_C_0); - extract_fast(m0); - sumadd_fast(l[1]); - muladd(n1, SECP256K1_N_C_0); - muladd(n0, SECP256K1_N_C_1); - extract(m1); - sumadd(l[2]); - muladd(n2, SECP256K1_N_C_0); - muladd(n1, SECP256K1_N_C_1); - muladd(n0, SECP256K1_N_C_2); - extract(m2); - sumadd(l[3]); - muladd(n3, SECP256K1_N_C_0); - muladd(n2, SECP256K1_N_C_1); - muladd(n1, SECP256K1_N_C_2); - muladd(n0, SECP256K1_N_C_3); - extract(m3); - sumadd(l[4]); - muladd(n4, SECP256K1_N_C_0); - muladd(n3, SECP256K1_N_C_1); - muladd(n2, SECP256K1_N_C_2); - muladd(n1, SECP256K1_N_C_3); - sumadd(n0); - extract(m4); - sumadd(l[5]); - muladd(n5, SECP256K1_N_C_0); - muladd(n4, SECP256K1_N_C_1); - muladd(n3, SECP256K1_N_C_2); - muladd(n2, SECP256K1_N_C_3); - sumadd(n1); - extract(m5); - sumadd(l[6]); - muladd(n6, SECP256K1_N_C_0); - muladd(n5, SECP256K1_N_C_1); - muladd(n4, SECP256K1_N_C_2); - muladd(n3, SECP256K1_N_C_3); - sumadd(n2); - extract(m6); - sumadd(l[7]); - muladd(n7, SECP256K1_N_C_0); - muladd(n6, SECP256K1_N_C_1); - muladd(n5, SECP256K1_N_C_2); - muladd(n4, SECP256K1_N_C_3); - sumadd(n3); - extract(m7); - muladd(n7, SECP256K1_N_C_1); - muladd(n6, SECP256K1_N_C_2); - muladd(n5, SECP256K1_N_C_3); - sumadd(n4); - extract(m8); - muladd(n7, SECP256K1_N_C_2); - muladd(n6, SECP256K1_N_C_3); - sumadd(n5); - extract(m9); - muladd(n7, SECP256K1_N_C_3); - sumadd(n6); - extract(m10); - sumadd_fast(n7); - extract_fast(m11); - VERIFY_CHECK(c0 <= 1); - m12 = c0; - - /* Reduce 385 bits into 258. */ - /* p[0..8] = m[0..7] + m[8..12] * SECP256K1_N_C. */ - c0 = m0; c1 = 0; c2 = 0; - muladd_fast(m8, SECP256K1_N_C_0); - extract_fast(p0); - sumadd_fast(m1); - muladd(m9, SECP256K1_N_C_0); - muladd(m8, SECP256K1_N_C_1); - extract(p1); - sumadd(m2); - muladd(m10, SECP256K1_N_C_0); - muladd(m9, SECP256K1_N_C_1); - muladd(m8, SECP256K1_N_C_2); - extract(p2); - sumadd(m3); - muladd(m11, SECP256K1_N_C_0); - muladd(m10, SECP256K1_N_C_1); - muladd(m9, SECP256K1_N_C_2); - muladd(m8, SECP256K1_N_C_3); - extract(p3); - sumadd(m4); - muladd(m12, SECP256K1_N_C_0); - muladd(m11, SECP256K1_N_C_1); - muladd(m10, SECP256K1_N_C_2); - muladd(m9, SECP256K1_N_C_3); - sumadd(m8); - extract(p4); - sumadd(m5); - muladd(m12, SECP256K1_N_C_1); - muladd(m11, SECP256K1_N_C_2); - muladd(m10, SECP256K1_N_C_3); - sumadd(m9); - extract(p5); - sumadd(m6); - muladd(m12, SECP256K1_N_C_2); - muladd(m11, SECP256K1_N_C_3); - sumadd(m10); - extract(p6); - sumadd_fast(m7); - muladd_fast(m12, SECP256K1_N_C_3); - sumadd_fast(m11); - extract_fast(p7); - p8 = c0 + m12; - VERIFY_CHECK(p8 <= 2); - - /* Reduce 258 bits into 256. */ - /* r[0..7] = p[0..7] + p[8] * SECP256K1_N_C. */ - c = p0 + (uint64_t)SECP256K1_N_C_0 * p8; - r->d[0] = c & 0xFFFFFFFFUL; c >>= 32; - c += p1 + (uint64_t)SECP256K1_N_C_1 * p8; - r->d[1] = c & 0xFFFFFFFFUL; c >>= 32; - c += p2 + (uint64_t)SECP256K1_N_C_2 * p8; - r->d[2] = c & 0xFFFFFFFFUL; c >>= 32; - c += p3 + (uint64_t)SECP256K1_N_C_3 * p8; - r->d[3] = c & 0xFFFFFFFFUL; c >>= 32; - c += p4 + (uint64_t)p8; - r->d[4] = c & 0xFFFFFFFFUL; c >>= 32; - c += p5; - r->d[5] = c & 0xFFFFFFFFUL; c >>= 32; - c += p6; - r->d[6] = c & 0xFFFFFFFFUL; c >>= 32; - c += p7; - r->d[7] = c & 0xFFFFFFFFUL; c >>= 32; - - /* Final reduction of r. */ - secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r)); -} - -static void secp256k1_scalar_mul_512(uint32_t *l, const secp256k1_scalar *a, const secp256k1_scalar *b) { - /* 96 bit accumulator. */ - uint32_t c0 = 0, c1 = 0, c2 = 0; - - /* l[0..15] = a[0..7] * b[0..7]. */ - muladd_fast(a->d[0], b->d[0]); - extract_fast(l[0]); - muladd(a->d[0], b->d[1]); - muladd(a->d[1], b->d[0]); - extract(l[1]); - muladd(a->d[0], b->d[2]); - muladd(a->d[1], b->d[1]); - muladd(a->d[2], b->d[0]); - extract(l[2]); - muladd(a->d[0], b->d[3]); - muladd(a->d[1], b->d[2]); - muladd(a->d[2], b->d[1]); - muladd(a->d[3], b->d[0]); - extract(l[3]); - muladd(a->d[0], b->d[4]); - muladd(a->d[1], b->d[3]); - muladd(a->d[2], b->d[2]); - muladd(a->d[3], b->d[1]); - muladd(a->d[4], b->d[0]); - extract(l[4]); - muladd(a->d[0], b->d[5]); - muladd(a->d[1], b->d[4]); - muladd(a->d[2], b->d[3]); - muladd(a->d[3], b->d[2]); - muladd(a->d[4], b->d[1]); - muladd(a->d[5], b->d[0]); - extract(l[5]); - muladd(a->d[0], b->d[6]); - muladd(a->d[1], b->d[5]); - muladd(a->d[2], b->d[4]); - muladd(a->d[3], b->d[3]); - muladd(a->d[4], b->d[2]); - muladd(a->d[5], b->d[1]); - muladd(a->d[6], b->d[0]); - extract(l[6]); - muladd(a->d[0], b->d[7]); - muladd(a->d[1], b->d[6]); - muladd(a->d[2], b->d[5]); - muladd(a->d[3], b->d[4]); - muladd(a->d[4], b->d[3]); - muladd(a->d[5], b->d[2]); - muladd(a->d[6], b->d[1]); - muladd(a->d[7], b->d[0]); - extract(l[7]); - muladd(a->d[1], b->d[7]); - muladd(a->d[2], b->d[6]); - muladd(a->d[3], b->d[5]); - muladd(a->d[4], b->d[4]); - muladd(a->d[5], b->d[3]); - muladd(a->d[6], b->d[2]); - muladd(a->d[7], b->d[1]); - extract(l[8]); - muladd(a->d[2], b->d[7]); - muladd(a->d[3], b->d[6]); - muladd(a->d[4], b->d[5]); - muladd(a->d[5], b->d[4]); - muladd(a->d[6], b->d[3]); - muladd(a->d[7], b->d[2]); - extract(l[9]); - muladd(a->d[3], b->d[7]); - muladd(a->d[4], b->d[6]); - muladd(a->d[5], b->d[5]); - muladd(a->d[6], b->d[4]); - muladd(a->d[7], b->d[3]); - extract(l[10]); - muladd(a->d[4], b->d[7]); - muladd(a->d[5], b->d[6]); - muladd(a->d[6], b->d[5]); - muladd(a->d[7], b->d[4]); - extract(l[11]); - muladd(a->d[5], b->d[7]); - muladd(a->d[6], b->d[6]); - muladd(a->d[7], b->d[5]); - extract(l[12]); - muladd(a->d[6], b->d[7]); - muladd(a->d[7], b->d[6]); - extract(l[13]); - muladd_fast(a->d[7], b->d[7]); - extract_fast(l[14]); - VERIFY_CHECK(c1 == 0); - l[15] = c0; -} - -static void secp256k1_scalar_sqr_512(uint32_t *l, const secp256k1_scalar *a) { - /* 96 bit accumulator. */ - uint32_t c0 = 0, c1 = 0, c2 = 0; - - /* l[0..15] = a[0..7]^2. */ - muladd_fast(a->d[0], a->d[0]); - extract_fast(l[0]); - muladd2(a->d[0], a->d[1]); - extract(l[1]); - muladd2(a->d[0], a->d[2]); - muladd(a->d[1], a->d[1]); - extract(l[2]); - muladd2(a->d[0], a->d[3]); - muladd2(a->d[1], a->d[2]); - extract(l[3]); - muladd2(a->d[0], a->d[4]); - muladd2(a->d[1], a->d[3]); - muladd(a->d[2], a->d[2]); - extract(l[4]); - muladd2(a->d[0], a->d[5]); - muladd2(a->d[1], a->d[4]); - muladd2(a->d[2], a->d[3]); - extract(l[5]); - muladd2(a->d[0], a->d[6]); - muladd2(a->d[1], a->d[5]); - muladd2(a->d[2], a->d[4]); - muladd(a->d[3], a->d[3]); - extract(l[6]); - muladd2(a->d[0], a->d[7]); - muladd2(a->d[1], a->d[6]); - muladd2(a->d[2], a->d[5]); - muladd2(a->d[3], a->d[4]); - extract(l[7]); - muladd2(a->d[1], a->d[7]); - muladd2(a->d[2], a->d[6]); - muladd2(a->d[3], a->d[5]); - muladd(a->d[4], a->d[4]); - extract(l[8]); - muladd2(a->d[2], a->d[7]); - muladd2(a->d[3], a->d[6]); - muladd2(a->d[4], a->d[5]); - extract(l[9]); - muladd2(a->d[3], a->d[7]); - muladd2(a->d[4], a->d[6]); - muladd(a->d[5], a->d[5]); - extract(l[10]); - muladd2(a->d[4], a->d[7]); - muladd2(a->d[5], a->d[6]); - extract(l[11]); - muladd2(a->d[5], a->d[7]); - muladd(a->d[6], a->d[6]); - extract(l[12]); - muladd2(a->d[6], a->d[7]); - extract(l[13]); - muladd_fast(a->d[7], a->d[7]); - extract_fast(l[14]); - VERIFY_CHECK(c1 == 0); - l[15] = c0; -} - -#undef sumadd -#undef sumadd_fast -#undef muladd -#undef muladd_fast -#undef muladd2 -#undef extract -#undef extract_fast - -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - uint32_t l[16]; - secp256k1_scalar_mul_512(l, a, b); - secp256k1_scalar_reduce_512(r, l); -} - -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) { - int ret; - VERIFY_CHECK(n > 0); - VERIFY_CHECK(n < 16); - ret = r->d[0] & ((1 << n) - 1); - r->d[0] = (r->d[0] >> n) + (r->d[1] << (32 - n)); - r->d[1] = (r->d[1] >> n) + (r->d[2] << (32 - n)); - r->d[2] = (r->d[2] >> n) + (r->d[3] << (32 - n)); - r->d[3] = (r->d[3] >> n) + (r->d[4] << (32 - n)); - r->d[4] = (r->d[4] >> n) + (r->d[5] << (32 - n)); - r->d[5] = (r->d[5] >> n) + (r->d[6] << (32 - n)); - r->d[6] = (r->d[6] >> n) + (r->d[7] << (32 - n)); - r->d[7] = (r->d[7] >> n); - return ret; -} - -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint32_t l[16]; - secp256k1_scalar_sqr_512(l, a); - secp256k1_scalar_reduce_512(r, l); -} - -#ifdef USE_ENDOMORPHISM -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - r1->d[0] = a->d[0]; - r1->d[1] = a->d[1]; - r1->d[2] = a->d[2]; - r1->d[3] = a->d[3]; - r1->d[4] = 0; - r1->d[5] = 0; - r1->d[6] = 0; - r1->d[7] = 0; - r2->d[0] = a->d[4]; - r2->d[1] = a->d[5]; - r2->d[2] = a->d[6]; - r2->d[3] = a->d[7]; - r2->d[4] = 0; - r2->d[5] = 0; - r2->d[6] = 0; - r2->d[7] = 0; -} -#endif - -SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { - return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3]) | (a->d[4] ^ b->d[4]) | (a->d[5] ^ b->d[5]) | (a->d[6] ^ b->d[6]) | (a->d[7] ^ b->d[7])) == 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) { - uint32_t l[16]; - unsigned int shiftlimbs; - unsigned int shiftlow; - unsigned int shifthigh; - VERIFY_CHECK(shift >= 256); - secp256k1_scalar_mul_512(l, a, b); - shiftlimbs = shift >> 5; - shiftlow = shift & 0x1F; - shifthigh = 32 - shiftlow; - r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 480 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[1] = shift < 480 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[2] = shift < 448 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 416 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[3] = shift < 416 ? (l[3 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[4 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[4] = shift < 384 ? (l[4 + shiftlimbs] >> shiftlow | (shift < 352 && shiftlow ? (l[5 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[5] = shift < 352 ? (l[5 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[6 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[6] = shift < 320 ? (l[6 + shiftlimbs] >> shiftlow | (shift < 288 && shiftlow ? (l[7 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[7] = shift < 288 ? (l[7 + shiftlimbs] >> shiftlow) : 0; - secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 5] >> ((shift - 1) & 0x1f)) & 1); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h deleted file mode 100644 index f5b23764..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h +++ /dev/null @@ -1,370 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_IMPL_H_ -#define _SECP256K1_SCALAR_IMPL_H_ - -#include "group.h" -#include "scalar.h" - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(EXHAUSTIVE_TEST_ORDER) -#include "scalar_low_impl.h" -#elif defined(USE_SCALAR_4X64) -#include "scalar_4x64_impl.h" -#elif defined(USE_SCALAR_8X32) -#include "scalar_8x32_impl.h" -#else -#error "Please select scalar implementation" -#endif - -#ifndef USE_NUM_NONE -static void secp256k1_scalar_get_num(secp256k1_num *r, const secp256k1_scalar *a) { - unsigned char c[32]; - secp256k1_scalar_get_b32(c, a); - secp256k1_num_set_bin(r, c, 32); -} - -/** secp256k1 curve order, see secp256k1_ecdsa_const_order_as_fe in ecdsa_impl.h */ -static void secp256k1_scalar_order_get_num(secp256k1_num *r) { -#if defined(EXHAUSTIVE_TEST_ORDER) - static const unsigned char order[32] = { - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,EXHAUSTIVE_TEST_ORDER - }; -#else - static const unsigned char order[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, - 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, - 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x41 - }; -#endif - secp256k1_num_set_bin(r, order, 32); -} -#endif - -static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *x) { -#if defined(EXHAUSTIVE_TEST_ORDER) - int i; - *r = 0; - for (i = 0; i < EXHAUSTIVE_TEST_ORDER; i++) - if ((i * *x) % EXHAUSTIVE_TEST_ORDER == 1) - *r = i; - /* If this VERIFY_CHECK triggers we were given a noninvertible scalar (and thus - * have a composite group order; fix it in exhaustive_tests.c). */ - VERIFY_CHECK(*r != 0); -} -#else - secp256k1_scalar *t; - int i; - /* First compute x ^ (2^N - 1) for some values of N. */ - secp256k1_scalar x2, x3, x4, x6, x7, x8, x15, x30, x60, x120, x127; - - secp256k1_scalar_sqr(&x2, x); - secp256k1_scalar_mul(&x2, &x2, x); - - secp256k1_scalar_sqr(&x3, &x2); - secp256k1_scalar_mul(&x3, &x3, x); - - secp256k1_scalar_sqr(&x4, &x3); - secp256k1_scalar_mul(&x4, &x4, x); - - secp256k1_scalar_sqr(&x6, &x4); - secp256k1_scalar_sqr(&x6, &x6); - secp256k1_scalar_mul(&x6, &x6, &x2); - - secp256k1_scalar_sqr(&x7, &x6); - secp256k1_scalar_mul(&x7, &x7, x); - - secp256k1_scalar_sqr(&x8, &x7); - secp256k1_scalar_mul(&x8, &x8, x); - - secp256k1_scalar_sqr(&x15, &x8); - for (i = 0; i < 6; i++) { - secp256k1_scalar_sqr(&x15, &x15); - } - secp256k1_scalar_mul(&x15, &x15, &x7); - - secp256k1_scalar_sqr(&x30, &x15); - for (i = 0; i < 14; i++) { - secp256k1_scalar_sqr(&x30, &x30); - } - secp256k1_scalar_mul(&x30, &x30, &x15); - - secp256k1_scalar_sqr(&x60, &x30); - for (i = 0; i < 29; i++) { - secp256k1_scalar_sqr(&x60, &x60); - } - secp256k1_scalar_mul(&x60, &x60, &x30); - - secp256k1_scalar_sqr(&x120, &x60); - for (i = 0; i < 59; i++) { - secp256k1_scalar_sqr(&x120, &x120); - } - secp256k1_scalar_mul(&x120, &x120, &x60); - - secp256k1_scalar_sqr(&x127, &x120); - for (i = 0; i < 6; i++) { - secp256k1_scalar_sqr(&x127, &x127); - } - secp256k1_scalar_mul(&x127, &x127, &x7); - - /* Then accumulate the final result (t starts at x127). */ - t = &x127; - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 3; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 5; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 4; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 5; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x4); /* 1111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 4; i++) { /* 000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 10; i++) { /* 0000000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 9; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x8); /* 11111111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 5; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x4); /* 1111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 5; i++) { /* 000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 4; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 8; i++) { /* 000000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 3; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 6; i++) { /* 00000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 8; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(r, t, &x6); /* 111111 */ -} - -SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) { - return !(a->d[0] & 1); -} -#endif - -static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *x) { -#if defined(USE_SCALAR_INV_BUILTIN) - secp256k1_scalar_inverse(r, x); -#elif defined(USE_SCALAR_INV_NUM) - unsigned char b[32]; - secp256k1_num n, m; - secp256k1_scalar t = *x; - secp256k1_scalar_get_b32(b, &t); - secp256k1_num_set_bin(&n, b, 32); - secp256k1_scalar_order_get_num(&m); - secp256k1_num_mod_inverse(&n, &n, &m); - secp256k1_num_get_bin(b, 32, &n); - secp256k1_scalar_set_b32(r, b, NULL); - /* Verify that the inverse was computed correctly, without GMP code. */ - secp256k1_scalar_mul(&t, &t, r); - CHECK(secp256k1_scalar_is_one(&t)); -#else -#error "Please select scalar inverse implementation" -#endif -} - -#ifdef USE_ENDOMORPHISM -#if defined(EXHAUSTIVE_TEST_ORDER) -/** - * Find k1 and k2 given k, such that k1 + k2 * lambda == k mod n; unlike in the - * full case we don't bother making k1 and k2 be small, we just want them to be - * nontrivial to get full test coverage for the exhaustive tests. We therefore - * (arbitrarily) set k2 = k + 5 and k1 = k - k2 * lambda. - */ -static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - *r2 = (*a + 5) % EXHAUSTIVE_TEST_ORDER; - *r1 = (*a + (EXHAUSTIVE_TEST_ORDER - *r2) * EXHAUSTIVE_TEST_LAMBDA) % EXHAUSTIVE_TEST_ORDER; -} -#else -/** - * The Secp256k1 curve has an endomorphism, where lambda * (x, y) = (beta * x, y), where - * lambda is {0x53,0x63,0xad,0x4c,0xc0,0x5c,0x30,0xe0,0xa5,0x26,0x1c,0x02,0x88,0x12,0x64,0x5a, - * 0x12,0x2e,0x22,0xea,0x20,0x81,0x66,0x78,0xdf,0x02,0x96,0x7c,0x1b,0x23,0xbd,0x72} - * - * "Guide to Elliptic Curve Cryptography" (Hankerson, Menezes, Vanstone) gives an algorithm - * (algorithm 3.74) to find k1 and k2 given k, such that k1 + k2 * lambda == k mod n, and k1 - * and k2 have a small size. - * It relies on constants a1, b1, a2, b2. These constants for the value of lambda above are: - * - * - a1 = {0x30,0x86,0xd2,0x21,0xa7,0xd4,0x6b,0xcd,0xe8,0x6c,0x90,0xe4,0x92,0x84,0xeb,0x15} - * - b1 = -{0xe4,0x43,0x7e,0xd6,0x01,0x0e,0x88,0x28,0x6f,0x54,0x7f,0xa9,0x0a,0xbf,0xe4,0xc3} - * - a2 = {0x01,0x14,0xca,0x50,0xf7,0xa8,0xe2,0xf3,0xf6,0x57,0xc1,0x10,0x8d,0x9d,0x44,0xcf,0xd8} - * - b2 = {0x30,0x86,0xd2,0x21,0xa7,0xd4,0x6b,0xcd,0xe8,0x6c,0x90,0xe4,0x92,0x84,0xeb,0x15} - * - * The algorithm then computes c1 = round(b1 * k / n) and c2 = round(b2 * k / n), and gives - * k1 = k - (c1*a1 + c2*a2) and k2 = -(c1*b1 + c2*b2). Instead, we use modular arithmetic, and - * compute k1 as k - k2 * lambda, avoiding the need for constants a1 and a2. - * - * g1, g2 are precomputed constants used to replace division with a rounded multiplication - * when decomposing the scalar for an endomorphism-based point multiplication. - * - * The possibility of using precomputed estimates is mentioned in "Guide to Elliptic Curve - * Cryptography" (Hankerson, Menezes, Vanstone) in section 3.5. - * - * The derivation is described in the paper "Efficient Software Implementation of Public-Key - * Cryptography on Sensor Networks Using the MSP430X Microcontroller" (Gouvea, Oliveira, Lopez), - * Section 4.3 (here we use a somewhat higher-precision estimate): - * d = a1*b2 - b1*a2 - * g1 = round((2^272)*b2/d) - * g2 = round((2^272)*b1/d) - * - * (Note that 'd' is also equal to the curve order here because [a1,b1] and [a2,b2] are found - * as outputs of the Extended Euclidean Algorithm on inputs 'order' and 'lambda'). - * - * The function below splits a in r1 and r2, such that r1 + lambda * r2 == a (mod order). - */ - -static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - secp256k1_scalar c1, c2; - static const secp256k1_scalar minus_lambda = SECP256K1_SCALAR_CONST( - 0xAC9C52B3UL, 0x3FA3CF1FUL, 0x5AD9E3FDUL, 0x77ED9BA4UL, - 0xA880B9FCUL, 0x8EC739C2UL, 0xE0CFC810UL, 0xB51283CFUL - ); - static const secp256k1_scalar minus_b1 = SECP256K1_SCALAR_CONST( - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0xE4437ED6UL, 0x010E8828UL, 0x6F547FA9UL, 0x0ABFE4C3UL - ); - static const secp256k1_scalar minus_b2 = SECP256K1_SCALAR_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL, - 0x8A280AC5UL, 0x0774346DUL, 0xD765CDA8UL, 0x3DB1562CUL - ); - static const secp256k1_scalar g1 = SECP256K1_SCALAR_CONST( - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00003086UL, - 0xD221A7D4UL, 0x6BCDE86CUL, 0x90E49284UL, 0xEB153DABUL - ); - static const secp256k1_scalar g2 = SECP256K1_SCALAR_CONST( - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x0000E443UL, - 0x7ED6010EUL, 0x88286F54UL, 0x7FA90ABFUL, 0xE4C42212UL - ); - VERIFY_CHECK(r1 != a); - VERIFY_CHECK(r2 != a); - /* these _var calls are constant time since the shift amount is constant */ - secp256k1_scalar_mul_shift_var(&c1, a, &g1, 272); - secp256k1_scalar_mul_shift_var(&c2, a, &g2, 272); - secp256k1_scalar_mul(&c1, &c1, &minus_b1); - secp256k1_scalar_mul(&c2, &c2, &minus_b2); - secp256k1_scalar_add(r2, &c1, &c2); - secp256k1_scalar_mul(r1, r2, &minus_lambda); - secp256k1_scalar_add(r1, r1, a); -} -#endif -#endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h deleted file mode 100644 index 5574c44c..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h +++ /dev/null @@ -1,15 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_ -#define _SECP256K1_SCALAR_REPR_ - -#include - -/** A scalar modulo the group order of the secp256k1 curve. */ -typedef uint32_t secp256k1_scalar; - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h deleted file mode 100644 index 4f94441f..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h +++ /dev/null @@ -1,114 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_IMPL_H_ -#define _SECP256K1_SCALAR_REPR_IMPL_H_ - -#include "scalar.h" - -#include - -SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) { - return !(*a & 1); -} - -SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) { *r = 0; } -SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) { *r = v; } - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - if (offset < 32) - return ((*a >> offset) & ((((uint32_t)1) << count) - 1)); - else - return 0; -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - return secp256k1_scalar_get_bits(a, offset, count); -} - -SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) { return *a >= EXHAUSTIVE_TEST_ORDER; } - -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - *r = (*a + *b) % EXHAUSTIVE_TEST_ORDER; - return *r < *b; -} - -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) { - if (flag && bit < 32) - *r += (1 << bit); -#ifdef VERIFY - VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0); -#endif -} - -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) { - const int base = 0x100 % EXHAUSTIVE_TEST_ORDER; - int i; - *r = 0; - for (i = 0; i < 32; i++) { - *r = ((*r * base) + b32[i]) % EXHAUSTIVE_TEST_ORDER; - } - /* just deny overflow, it basically always happens */ - if (overflow) *overflow = 0; -} - -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) { - memset(bin, 0, 32); - bin[28] = *a >> 24; bin[29] = *a >> 16; bin[30] = *a >> 8; bin[31] = *a; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) { - return *a == 0; -} - -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) { - if (*a == 0) { - *r = 0; - } else { - *r = EXHAUSTIVE_TEST_ORDER - *a; - } -} - -SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) { - return *a == 1; -} - -static int secp256k1_scalar_is_high(const secp256k1_scalar *a) { - return *a > EXHAUSTIVE_TEST_ORDER / 2; -} - -static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) { - if (flag) secp256k1_scalar_negate(r, r); - return flag ? -1 : 1; -} - -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - *r = (*a * *b) % EXHAUSTIVE_TEST_ORDER; -} - -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) { - int ret; - VERIFY_CHECK(n > 0); - VERIFY_CHECK(n < 16); - ret = *r & ((1 << n) - 1); - *r >>= n; - return ret; -} - -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { - *r = (*a * *a) % EXHAUSTIVE_TEST_ORDER; -} - -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - *r1 = *a; - *r2 = 0; -} - -SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { - return *a == *b; -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c deleted file mode 100755 index 7d637bfa..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c +++ /dev/null @@ -1,559 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include "include/secp256k1.h" - -#include "util.h" -#include "num_impl.h" -#include "field_impl.h" -#include "scalar_impl.h" -#include "group_impl.h" -#include "ecmult_impl.h" -#include "ecmult_const_impl.h" -#include "ecmult_gen_impl.h" -#include "ecdsa_impl.h" -#include "eckey_impl.h" -#include "hash_impl.h" - -#define ARG_CHECK(cond) do { \ - if (EXPECT(!(cond), 0)) { \ - secp256k1_callback_call(&ctx->illegal_callback, #cond); \ - return 0; \ - } \ -} while(0) - -static void default_illegal_callback_fn(const char* str, void* data) { - fprintf(stderr, "[libsecp256k1] illegal argument: %s\n", str); - abort(); -} - -static const secp256k1_callback default_illegal_callback = { - default_illegal_callback_fn, - NULL -}; - -static void default_error_callback_fn(const char* str, void* data) { - fprintf(stderr, "[libsecp256k1] internal consistency check failed: %s\n", str); - abort(); -} - -static const secp256k1_callback default_error_callback = { - default_error_callback_fn, - NULL -}; - - -struct secp256k1_context_struct { - secp256k1_ecmult_context ecmult_ctx; - secp256k1_ecmult_gen_context ecmult_gen_ctx; - secp256k1_callback illegal_callback; - secp256k1_callback error_callback; -}; - -secp256k1_context* secp256k1_context_create(unsigned int flags) { - secp256k1_context* ret = (secp256k1_context*)checked_malloc(&default_error_callback, sizeof(secp256k1_context)); - ret->illegal_callback = default_illegal_callback; - ret->error_callback = default_error_callback; - - if (EXPECT((flags & SECP256K1_FLAGS_TYPE_MASK) != SECP256K1_FLAGS_TYPE_CONTEXT, 0)) { - secp256k1_callback_call(&ret->illegal_callback, - "Invalid flags"); - free(ret); - return NULL; - } - - secp256k1_ecmult_context_init(&ret->ecmult_ctx); - secp256k1_ecmult_gen_context_init(&ret->ecmult_gen_ctx); - - if (flags & SECP256K1_FLAGS_BIT_CONTEXT_SIGN) { - secp256k1_ecmult_gen_context_build(&ret->ecmult_gen_ctx, &ret->error_callback); - } - if (flags & SECP256K1_FLAGS_BIT_CONTEXT_VERIFY) { - secp256k1_ecmult_context_build(&ret->ecmult_ctx, &ret->error_callback); - } - - return ret; -} - -secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) { - secp256k1_context* ret = (secp256k1_context*)checked_malloc(&ctx->error_callback, sizeof(secp256k1_context)); - ret->illegal_callback = ctx->illegal_callback; - ret->error_callback = ctx->error_callback; - secp256k1_ecmult_context_clone(&ret->ecmult_ctx, &ctx->ecmult_ctx, &ctx->error_callback); - secp256k1_ecmult_gen_context_clone(&ret->ecmult_gen_ctx, &ctx->ecmult_gen_ctx, &ctx->error_callback); - return ret; -} - -void secp256k1_context_destroy(secp256k1_context* ctx) { - if (ctx != NULL) { - secp256k1_ecmult_context_clear(&ctx->ecmult_ctx); - secp256k1_ecmult_gen_context_clear(&ctx->ecmult_gen_ctx); - - free(ctx); - } -} - -void secp256k1_context_set_illegal_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) { - if (fun == NULL) { - fun = default_illegal_callback_fn; - } - ctx->illegal_callback.fn = fun; - ctx->illegal_callback.data = data; -} - -void secp256k1_context_set_error_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) { - if (fun == NULL) { - fun = default_error_callback_fn; - } - ctx->error_callback.fn = fun; - ctx->error_callback.data = data; -} - -static int secp256k1_pubkey_load(const secp256k1_context* ctx, secp256k1_ge* ge, const secp256k1_pubkey* pubkey) { - if (sizeof(secp256k1_ge_storage) == 64) { - /* When the secp256k1_ge_storage type is exactly 64 byte, use its - * representation inside secp256k1_pubkey, as conversion is very fast. - * Note that secp256k1_pubkey_save must use the same representation. */ - secp256k1_ge_storage s; - memcpy(&s, &pubkey->data[0], 64); - secp256k1_ge_from_storage(ge, &s); - } else { - /* Otherwise, fall back to 32-byte big endian for X and Y. */ - secp256k1_fe x, y; - secp256k1_fe_set_b32(&x, pubkey->data); - secp256k1_fe_set_b32(&y, pubkey->data + 32); - secp256k1_ge_set_xy(ge, &x, &y); - } - ARG_CHECK(!secp256k1_fe_is_zero(&ge->x)); - return 1; -} - -static void secp256k1_pubkey_save(secp256k1_pubkey* pubkey, secp256k1_ge* ge) { - if (sizeof(secp256k1_ge_storage) == 64) { - secp256k1_ge_storage s; - secp256k1_ge_to_storage(&s, ge); - memcpy(&pubkey->data[0], &s, 64); - } else { - VERIFY_CHECK(!secp256k1_ge_is_infinity(ge)); - secp256k1_fe_normalize_var(&ge->x); - secp256k1_fe_normalize_var(&ge->y); - secp256k1_fe_get_b32(pubkey->data, &ge->x); - secp256k1_fe_get_b32(pubkey->data + 32, &ge->y); - } -} - -int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pubkey, const unsigned char *input, size_t inputlen) { - secp256k1_ge Q; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(pubkey != NULL); - memset(pubkey, 0, sizeof(*pubkey)); - ARG_CHECK(input != NULL); - if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) { - return 0; - } - secp256k1_pubkey_save(pubkey, &Q); - secp256k1_ge_clear(&Q); - return 1; -} - -int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_pubkey* pubkey, unsigned int flags) { - secp256k1_ge Q; - size_t len; - int ret = 0; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(outputlen != NULL); - ARG_CHECK(*outputlen >= ((flags & SECP256K1_FLAGS_BIT_COMPRESSION) ? 33 : 65)); - len = *outputlen; - *outputlen = 0; - ARG_CHECK(output != NULL); - memset(output, 0, len); - ARG_CHECK(pubkey != NULL); - ARG_CHECK((flags & SECP256K1_FLAGS_TYPE_MASK) == SECP256K1_FLAGS_TYPE_COMPRESSION); - if (secp256k1_pubkey_load(ctx, &Q, pubkey)) { - ret = secp256k1_eckey_pubkey_serialize(&Q, output, &len, flags & SECP256K1_FLAGS_BIT_COMPRESSION); - if (ret) { - *outputlen = len; - } - } - return ret; -} - -static void secp256k1_ecdsa_signature_load(const secp256k1_context* ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_ecdsa_signature* sig) { - (void)ctx; - if (sizeof(secp256k1_scalar) == 32) { - /* When the secp256k1_scalar type is exactly 32 byte, use its - * representation inside secp256k1_ecdsa_signature, as conversion is very fast. - * Note that secp256k1_ecdsa_signature_save must use the same representation. */ - memcpy(r, &sig->data[0], 32); - memcpy(s, &sig->data[32], 32); - } else { - secp256k1_scalar_set_b32(r, &sig->data[0], NULL); - secp256k1_scalar_set_b32(s, &sig->data[32], NULL); - } -} - -static void secp256k1_ecdsa_signature_save(secp256k1_ecdsa_signature* sig, const secp256k1_scalar* r, const secp256k1_scalar* s) { - if (sizeof(secp256k1_scalar) == 32) { - memcpy(&sig->data[0], r, 32); - memcpy(&sig->data[32], s, 32); - } else { - secp256k1_scalar_get_b32(&sig->data[0], r); - secp256k1_scalar_get_b32(&sig->data[32], s); - } -} - -int secp256k1_ecdsa_signature_parse_der(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) { - secp256k1_scalar r, s; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(input != NULL); - - if (secp256k1_ecdsa_sig_parse(&r, &s, input, inputlen)) { - secp256k1_ecdsa_signature_save(sig, &r, &s); - return 1; - } else { - memset(sig, 0, sizeof(*sig)); - return 0; - } -} - -int secp256k1_ecdsa_signature_parse_compact(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input64) { - secp256k1_scalar r, s; - int ret = 1; - int overflow = 0; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(input64 != NULL); - - secp256k1_scalar_set_b32(&r, &input64[0], &overflow); - ret &= !overflow; - secp256k1_scalar_set_b32(&s, &input64[32], &overflow); - ret &= !overflow; - if (ret) { - secp256k1_ecdsa_signature_save(sig, &r, &s); - } else { - memset(sig, 0, sizeof(*sig)); - } - return ret; -} - -int secp256k1_ecdsa_signature_serialize_der(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_ecdsa_signature* sig) { - secp256k1_scalar r, s; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(output != NULL); - ARG_CHECK(outputlen != NULL); - ARG_CHECK(sig != NULL); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, sig); - return secp256k1_ecdsa_sig_serialize(output, outputlen, &r, &s); -} - -int secp256k1_ecdsa_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, const secp256k1_ecdsa_signature* sig) { - secp256k1_scalar r, s; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(output64 != NULL); - ARG_CHECK(sig != NULL); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, sig); - secp256k1_scalar_get_b32(&output64[0], &r); - secp256k1_scalar_get_b32(&output64[32], &s); - return 1; -} - -int secp256k1_ecdsa_signature_normalize(const secp256k1_context* ctx, secp256k1_ecdsa_signature *sigout, const secp256k1_ecdsa_signature *sigin) { - secp256k1_scalar r, s; - int ret = 0; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(sigin != NULL); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, sigin); - ret = secp256k1_scalar_is_high(&s); - if (sigout != NULL) { - if (ret) { - secp256k1_scalar_negate(&s, &s); - } - secp256k1_ecdsa_signature_save(sigout, &r, &s); - } - - return ret; -} - -int secp256k1_ecdsa_verify(const secp256k1_context* ctx, const secp256k1_ecdsa_signature *sig, const unsigned char *msg32, const secp256k1_pubkey *pubkey) { - secp256k1_ge q; - secp256k1_scalar r, s; - secp256k1_scalar m; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(pubkey != NULL); - - secp256k1_scalar_set_b32(&m, msg32, NULL); - secp256k1_ecdsa_signature_load(ctx, &r, &s, sig); - return (!secp256k1_scalar_is_high(&s) && - secp256k1_pubkey_load(ctx, &q, pubkey) && - secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &r, &s, &q, &m)); -} - -static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - unsigned char keydata[112]; - int keylen = 64; - secp256k1_rfc6979_hmac_sha256_t rng; - unsigned int i; - /* We feed a byte array to the PRNG as input, consisting of: - * - the private key (32 bytes) and message (32 bytes), see RFC 6979 3.2d. - * - optionally 32 extra bytes of data, see RFC 6979 3.6 Additional Data. - * - optionally 16 extra bytes with the algorithm name. - * Because the arguments have distinct fixed lengths it is not possible for - * different argument mixtures to emulate each other and result in the same - * nonces. - */ - memcpy(keydata, key32, 32); - memcpy(keydata + 32, msg32, 32); - if (data != NULL) { - memcpy(keydata + 64, data, 32); - keylen = 96; - } - if (algo16 != NULL) { - memcpy(keydata + keylen, algo16, 16); - keylen += 16; - } - secp256k1_rfc6979_hmac_sha256_initialize(&rng, keydata, keylen); - memset(keydata, 0, sizeof(keydata)); - for (i = 0; i <= counter; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - return 1; -} - -const secp256k1_nonce_function secp256k1_nonce_function_rfc6979 = nonce_function_rfc6979; -const secp256k1_nonce_function secp256k1_nonce_function_default = nonce_function_rfc6979; - -int secp256k1_ecdsa_sign(const secp256k1_context* ctx, secp256k1_ecdsa_signature *signature, const unsigned char *msg32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) { - secp256k1_scalar r, s; - secp256k1_scalar sec, non, msg; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(signature != NULL); - ARG_CHECK(seckey != NULL); - if (noncefp == NULL) { - noncefp = secp256k1_nonce_function_default; - } - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - /* Fail if the secret key is invalid. */ - if (!overflow && !secp256k1_scalar_is_zero(&sec)) { - unsigned char nonce32[32]; - unsigned int count = 0; - secp256k1_scalar_set_b32(&msg, msg32, NULL); - while (1) { - ret = noncefp(nonce32, msg32, seckey, NULL, (void*)noncedata, count); - if (!ret) { - break; - } - secp256k1_scalar_set_b32(&non, nonce32, &overflow); - if (!overflow && !secp256k1_scalar_is_zero(&non)) { - if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, NULL)) { - break; - } - } - count++; - } - memset(nonce32, 0, 32); - secp256k1_scalar_clear(&msg); - secp256k1_scalar_clear(&non); - secp256k1_scalar_clear(&sec); - } - if (ret) { - secp256k1_ecdsa_signature_save(signature, &r, &s); - } else { - memset(signature, 0, sizeof(*signature)); - } - return ret; -} - -int secp256k1_ec_seckey_verify(const secp256k1_context* ctx, const unsigned char *seckey) { - secp256k1_scalar sec; - int ret; - int overflow; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(seckey != NULL); - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - ret = !overflow && !secp256k1_scalar_is_zero(&sec); - secp256k1_scalar_clear(&sec); - return ret; -} - -int secp256k1_ec_pubkey_create(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *seckey) { - secp256k1_gej pj; - secp256k1_ge p; - secp256k1_scalar sec; - int overflow; - int ret = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(pubkey != NULL); - memset(pubkey, 0, sizeof(*pubkey)); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - ARG_CHECK(seckey != NULL); - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - ret = (!overflow) & (!secp256k1_scalar_is_zero(&sec)); - if (ret) { - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pj, &sec); - secp256k1_ge_set_gej(&p, &pj); - secp256k1_pubkey_save(pubkey, &p); - } - secp256k1_scalar_clear(&sec); - return ret; -} - -int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak) { - secp256k1_scalar term; - secp256k1_scalar sec; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(seckey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&term, tweak, &overflow); - secp256k1_scalar_set_b32(&sec, seckey, NULL); - - ret = !overflow && secp256k1_eckey_privkey_tweak_add(&sec, &term); - memset(seckey, 0, 32); - if (ret) { - secp256k1_scalar_get_b32(seckey, &sec); - } - - secp256k1_scalar_clear(&sec); - secp256k1_scalar_clear(&term); - return ret; -} - -int secp256k1_ec_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak) { - secp256k1_ge p; - secp256k1_scalar term; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(pubkey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&term, tweak, &overflow); - ret = !overflow && secp256k1_pubkey_load(ctx, &p, pubkey); - memset(pubkey, 0, sizeof(*pubkey)); - if (ret) { - if (secp256k1_eckey_pubkey_tweak_add(&ctx->ecmult_ctx, &p, &term)) { - secp256k1_pubkey_save(pubkey, &p); - } else { - ret = 0; - } - } - - return ret; -} - -int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak) { - secp256k1_scalar factor; - secp256k1_scalar sec; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(seckey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&factor, tweak, &overflow); - secp256k1_scalar_set_b32(&sec, seckey, NULL); - ret = !overflow && secp256k1_eckey_privkey_tweak_mul(&sec, &factor); - memset(seckey, 0, 32); - if (ret) { - secp256k1_scalar_get_b32(seckey, &sec); - } - - secp256k1_scalar_clear(&sec); - secp256k1_scalar_clear(&factor); - return ret; -} - -int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak) { - secp256k1_ge p; - secp256k1_scalar factor; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(pubkey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&factor, tweak, &overflow); - ret = !overflow && secp256k1_pubkey_load(ctx, &p, pubkey); - memset(pubkey, 0, sizeof(*pubkey)); - if (ret) { - if (secp256k1_eckey_pubkey_tweak_mul(&ctx->ecmult_ctx, &p, &factor)) { - secp256k1_pubkey_save(pubkey, &p); - } else { - ret = 0; - } - } - - return ret; -} - -int secp256k1_context_randomize(secp256k1_context* ctx, const unsigned char *seed32) { - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, seed32); - return 1; -} - -int secp256k1_ec_pubkey_combine(const secp256k1_context* ctx, secp256k1_pubkey *pubnonce, const secp256k1_pubkey * const *pubnonces, size_t n) { - size_t i; - secp256k1_gej Qj; - secp256k1_ge Q; - - ARG_CHECK(pubnonce != NULL); - memset(pubnonce, 0, sizeof(*pubnonce)); - ARG_CHECK(n >= 1); - ARG_CHECK(pubnonces != NULL); - - secp256k1_gej_set_infinity(&Qj); - - for (i = 0; i < n; i++) { - secp256k1_pubkey_load(ctx, &Q, pubnonces[i]); - secp256k1_gej_add_ge(&Qj, &Qj, &Q); - } - if (secp256k1_gej_is_infinity(&Qj)) { - return 0; - } - secp256k1_ge_set_gej(&Q, &Qj); - secp256k1_pubkey_save(pubnonce, &Q); - return 1; -} - -#ifdef ENABLE_MODULE_ECDH -# include "modules/ecdh/main_impl.h" -#endif - -#ifdef ENABLE_MODULE_SCHNORR -# include "modules/schnorr/main_impl.h" -#endif - -#ifdef ENABLE_MODULE_RECOVERY -# include "modules/recovery/main_impl.h" -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h deleted file mode 100644 index f8efa93c..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h +++ /dev/null @@ -1,38 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_TESTRAND_H_ -#define _SECP256K1_TESTRAND_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -/* A non-cryptographic RNG used only for test infrastructure. */ - -/** Seed the pseudorandom number generator for testing. */ -SECP256K1_INLINE static void secp256k1_rand_seed(const unsigned char *seed16); - -/** Generate a pseudorandom number in the range [0..2**32-1]. */ -static uint32_t secp256k1_rand32(void); - -/** Generate a pseudorandom number in the range [0..2**bits-1]. Bits must be 1 or - * more. */ -static uint32_t secp256k1_rand_bits(int bits); - -/** Generate a pseudorandom number in the range [0..range-1]. */ -static uint32_t secp256k1_rand_int(uint32_t range); - -/** Generate a pseudorandom 32-byte array. */ -static void secp256k1_rand256(unsigned char *b32); - -/** Generate a pseudorandom 32-byte array with long sequences of zero and one bits. */ -static void secp256k1_rand256_test(unsigned char *b32); - -/** Generate pseudorandom bytes with long sequences of zero and one bits. */ -static void secp256k1_rand_bytes_test(unsigned char *bytes, size_t len); - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h deleted file mode 100644 index 15c7b9f1..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h +++ /dev/null @@ -1,110 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_TESTRAND_IMPL_H_ -#define _SECP256K1_TESTRAND_IMPL_H_ - -#include -#include - -#include "testrand.h" -#include "hash.h" - -static secp256k1_rfc6979_hmac_sha256_t secp256k1_test_rng; -static uint32_t secp256k1_test_rng_precomputed[8]; -static int secp256k1_test_rng_precomputed_used = 8; -static uint64_t secp256k1_test_rng_integer; -static int secp256k1_test_rng_integer_bits_left = 0; - -SECP256K1_INLINE static void secp256k1_rand_seed(const unsigned char *seed16) { - secp256k1_rfc6979_hmac_sha256_initialize(&secp256k1_test_rng, seed16, 16); -} - -SECP256K1_INLINE static uint32_t secp256k1_rand32(void) { - if (secp256k1_test_rng_precomputed_used == 8) { - secp256k1_rfc6979_hmac_sha256_generate(&secp256k1_test_rng, (unsigned char*)(&secp256k1_test_rng_precomputed[0]), sizeof(secp256k1_test_rng_precomputed)); - secp256k1_test_rng_precomputed_used = 0; - } - return secp256k1_test_rng_precomputed[secp256k1_test_rng_precomputed_used++]; -} - -static uint32_t secp256k1_rand_bits(int bits) { - uint32_t ret; - if (secp256k1_test_rng_integer_bits_left < bits) { - secp256k1_test_rng_integer |= (((uint64_t)secp256k1_rand32()) << secp256k1_test_rng_integer_bits_left); - secp256k1_test_rng_integer_bits_left += 32; - } - ret = secp256k1_test_rng_integer; - secp256k1_test_rng_integer >>= bits; - secp256k1_test_rng_integer_bits_left -= bits; - ret &= ((~((uint32_t)0)) >> (32 - bits)); - return ret; -} - -static uint32_t secp256k1_rand_int(uint32_t range) { - /* We want a uniform integer between 0 and range-1, inclusive. - * B is the smallest number such that range <= 2**B. - * two mechanisms implemented here: - * - generate B bits numbers until one below range is found, and return it - * - find the largest multiple M of range that is <= 2**(B+A), generate B+A - * bits numbers until one below M is found, and return it modulo range - * The second mechanism consumes A more bits of entropy in every iteration, - * but may need fewer iterations due to M being closer to 2**(B+A) then - * range is to 2**B. The array below (indexed by B) contains a 0 when the - * first mechanism is to be used, and the number A otherwise. - */ - static const int addbits[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0}; - uint32_t trange, mult; - int bits = 0; - if (range <= 1) { - return 0; - } - trange = range - 1; - while (trange > 0) { - trange >>= 1; - bits++; - } - if (addbits[bits]) { - bits = bits + addbits[bits]; - mult = ((~((uint32_t)0)) >> (32 - bits)) / range; - trange = range * mult; - } else { - trange = range; - mult = 1; - } - while(1) { - uint32_t x = secp256k1_rand_bits(bits); - if (x < trange) { - return (mult == 1) ? x : (x % range); - } - } -} - -static void secp256k1_rand256(unsigned char *b32) { - secp256k1_rfc6979_hmac_sha256_generate(&secp256k1_test_rng, b32, 32); -} - -static void secp256k1_rand_bytes_test(unsigned char *bytes, size_t len) { - size_t bits = 0; - memset(bytes, 0, len); - while (bits < len * 8) { - int now; - uint32_t val; - now = 1 + (secp256k1_rand_bits(6) * secp256k1_rand_bits(5) + 16) / 31; - val = secp256k1_rand_bits(1); - while (now > 0 && bits < len * 8) { - bytes[bits / 8] |= val << (bits % 8); - now--; - bits++; - } - } -} - -static void secp256k1_rand256_test(unsigned char *b32) { - secp256k1_rand_bytes_test(b32, 32); -} - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c deleted file mode 100644 index 9ae7d302..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c +++ /dev/null @@ -1,4525 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014, 2015 Pieter Wuille, Gregory Maxwell * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include -#include - -#include - -#include "secp256k1.c" -#include "include/secp256k1.h" -#include "testrand_impl.h" - -#ifdef ENABLE_OPENSSL_TESTS -#include "openssl/bn.h" -#include "openssl/ec.h" -#include "openssl/ecdsa.h" -#include "openssl/obj_mac.h" -#endif - -#include "contrib/lax_der_parsing.c" -#include "contrib/lax_der_privatekey_parsing.c" - -#if !defined(VG_CHECK) -# if defined(VALGRIND) -# include -# define VG_UNDEF(x,y) VALGRIND_MAKE_MEM_UNDEFINED((x),(y)) -# define VG_CHECK(x,y) VALGRIND_CHECK_MEM_IS_DEFINED((x),(y)) -# else -# define VG_UNDEF(x,y) -# define VG_CHECK(x,y) -# endif -#endif - -static int count = 64; -static secp256k1_context *ctx = NULL; - -static void counting_illegal_callback_fn(const char* str, void* data) { - /* Dummy callback function that just counts. */ - int32_t *p; - (void)str; - p = data; - (*p)++; -} - -static void uncounting_illegal_callback_fn(const char* str, void* data) { - /* Dummy callback function that just counts (backwards). */ - int32_t *p; - (void)str; - p = data; - (*p)--; -} - -void random_field_element_test(secp256k1_fe *fe) { - do { - unsigned char b32[32]; - secp256k1_rand256_test(b32); - if (secp256k1_fe_set_b32(fe, b32)) { - break; - } - } while(1); -} - -void random_field_element_magnitude(secp256k1_fe *fe) { - secp256k1_fe zero; - int n = secp256k1_rand_int(9); - secp256k1_fe_normalize(fe); - if (n == 0) { - return; - } - secp256k1_fe_clear(&zero); - secp256k1_fe_negate(&zero, &zero, 0); - secp256k1_fe_mul_int(&zero, n - 1); - secp256k1_fe_add(fe, &zero); - VERIFY_CHECK(fe->magnitude == n); -} - -void random_group_element_test(secp256k1_ge *ge) { - secp256k1_fe fe; - do { - random_field_element_test(&fe); - if (secp256k1_ge_set_xo_var(ge, &fe, secp256k1_rand_bits(1))) { - secp256k1_fe_normalize(&ge->y); - break; - } - } while(1); -} - -void random_group_element_jacobian_test(secp256k1_gej *gej, const secp256k1_ge *ge) { - secp256k1_fe z2, z3; - do { - random_field_element_test(&gej->z); - if (!secp256k1_fe_is_zero(&gej->z)) { - break; - } - } while(1); - secp256k1_fe_sqr(&z2, &gej->z); - secp256k1_fe_mul(&z3, &z2, &gej->z); - secp256k1_fe_mul(&gej->x, &ge->x, &z2); - secp256k1_fe_mul(&gej->y, &ge->y, &z3); - gej->infinity = ge->infinity; -} - -void random_scalar_order_test(secp256k1_scalar *num) { - do { - unsigned char b32[32]; - int overflow = 0; - secp256k1_rand256_test(b32); - secp256k1_scalar_set_b32(num, b32, &overflow); - if (overflow || secp256k1_scalar_is_zero(num)) { - continue; - } - break; - } while(1); -} - -void random_scalar_order(secp256k1_scalar *num) { - do { - unsigned char b32[32]; - int overflow = 0; - secp256k1_rand256(b32); - secp256k1_scalar_set_b32(num, b32, &overflow); - if (overflow || secp256k1_scalar_is_zero(num)) { - continue; - } - break; - } while(1); -} - -void run_context_tests(void) { - secp256k1_pubkey pubkey; - secp256k1_ecdsa_signature sig; - unsigned char ctmp[32]; - int32_t ecount; - int32_t ecount2; - secp256k1_context *none = secp256k1_context_create(SECP256K1_CONTEXT_NONE); - secp256k1_context *sign = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - secp256k1_context *vrfy = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); - secp256k1_context *both = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - secp256k1_gej pubj; - secp256k1_ge pub; - secp256k1_scalar msg, key, nonce; - secp256k1_scalar sigr, sigs; - - ecount = 0; - ecount2 = 10; - secp256k1_context_set_illegal_callback(vrfy, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(sign, counting_illegal_callback_fn, &ecount2); - secp256k1_context_set_error_callback(sign, counting_illegal_callback_fn, NULL); - CHECK(vrfy->error_callback.fn != sign->error_callback.fn); - - /*** clone and destroy all of them to make sure cloning was complete ***/ - { - secp256k1_context *ctx_tmp; - - ctx_tmp = none; none = secp256k1_context_clone(none); secp256k1_context_destroy(ctx_tmp); - ctx_tmp = sign; sign = secp256k1_context_clone(sign); secp256k1_context_destroy(ctx_tmp); - ctx_tmp = vrfy; vrfy = secp256k1_context_clone(vrfy); secp256k1_context_destroy(ctx_tmp); - ctx_tmp = both; both = secp256k1_context_clone(both); secp256k1_context_destroy(ctx_tmp); - } - - /* Verify that the error callback makes it across the clone. */ - CHECK(vrfy->error_callback.fn != sign->error_callback.fn); - /* And that it resets back to default. */ - secp256k1_context_set_error_callback(sign, NULL, NULL); - CHECK(vrfy->error_callback.fn == sign->error_callback.fn); - - /*** attempt to use them ***/ - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_ecmult_gen(&both->ecmult_gen_ctx, &pubj, &key); - secp256k1_ge_set_gej(&pub, &pubj); - - /* Verify context-type checking illegal-argument errors. */ - memset(ctmp, 1, 32); - CHECK(secp256k1_ec_pubkey_create(vrfy, &pubkey, ctmp) == 0); - CHECK(ecount == 1); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(sign, &pubkey, ctmp) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ecdsa_sign(vrfy, &sig, ctmp, ctmp, NULL, NULL) == 0); - CHECK(ecount == 2); - VG_UNDEF(&sig, sizeof(sig)); - CHECK(secp256k1_ecdsa_sign(sign, &sig, ctmp, ctmp, NULL, NULL) == 1); - VG_CHECK(&sig, sizeof(sig)); - CHECK(ecount2 == 10); - CHECK(secp256k1_ecdsa_verify(sign, &sig, ctmp, &pubkey) == 0); - CHECK(ecount2 == 11); - CHECK(secp256k1_ecdsa_verify(vrfy, &sig, ctmp, &pubkey) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ec_pubkey_tweak_add(sign, &pubkey, ctmp) == 0); - CHECK(ecount2 == 12); - CHECK(secp256k1_ec_pubkey_tweak_add(vrfy, &pubkey, ctmp) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ec_pubkey_tweak_mul(sign, &pubkey, ctmp) == 0); - CHECK(ecount2 == 13); - CHECK(secp256k1_ec_pubkey_tweak_mul(vrfy, &pubkey, ctmp) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_context_randomize(vrfy, ctmp) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_context_randomize(sign, NULL) == 1); - CHECK(ecount2 == 13); - secp256k1_context_set_illegal_callback(vrfy, NULL, NULL); - secp256k1_context_set_illegal_callback(sign, NULL, NULL); - - /* This shouldn't leak memory, due to already-set tests. */ - secp256k1_ecmult_gen_context_build(&sign->ecmult_gen_ctx, NULL); - secp256k1_ecmult_context_build(&vrfy->ecmult_ctx, NULL); - - /* obtain a working nonce */ - do { - random_scalar_order_test(&nonce); - } while(!secp256k1_ecdsa_sig_sign(&both->ecmult_gen_ctx, &sigr, &sigs, &key, &msg, &nonce, NULL)); - - /* try signing */ - CHECK(secp256k1_ecdsa_sig_sign(&sign->ecmult_gen_ctx, &sigr, &sigs, &key, &msg, &nonce, NULL)); - CHECK(secp256k1_ecdsa_sig_sign(&both->ecmult_gen_ctx, &sigr, &sigs, &key, &msg, &nonce, NULL)); - - /* try verifying */ - CHECK(secp256k1_ecdsa_sig_verify(&vrfy->ecmult_ctx, &sigr, &sigs, &pub, &msg)); - CHECK(secp256k1_ecdsa_sig_verify(&both->ecmult_ctx, &sigr, &sigs, &pub, &msg)); - - /* cleanup */ - secp256k1_context_destroy(none); - secp256k1_context_destroy(sign); - secp256k1_context_destroy(vrfy); - secp256k1_context_destroy(both); - /* Defined as no-op. */ - secp256k1_context_destroy(NULL); -} - -/***** HASH TESTS *****/ - -void run_sha256_tests(void) { - static const char *inputs[8] = { - "", "abc", "message digest", "secure hash algorithm", "SHA256 is considered to be safe", - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "For this sample, this 63-byte string will be used as input data", - "This is exactly 64 bytes long, not counting the terminating byte" - }; - static const unsigned char outputs[8][32] = { - {0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}, - {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad}, - {0xf7, 0x84, 0x6f, 0x55, 0xcf, 0x23, 0xe1, 0x4e, 0xeb, 0xea, 0xb5, 0xb4, 0xe1, 0x55, 0x0c, 0xad, 0x5b, 0x50, 0x9e, 0x33, 0x48, 0xfb, 0xc4, 0xef, 0xa3, 0xa1, 0x41, 0x3d, 0x39, 0x3c, 0xb6, 0x50}, - {0xf3, 0x0c, 0xeb, 0x2b, 0xb2, 0x82, 0x9e, 0x79, 0xe4, 0xca, 0x97, 0x53, 0xd3, 0x5a, 0x8e, 0xcc, 0x00, 0x26, 0x2d, 0x16, 0x4c, 0xc0, 0x77, 0x08, 0x02, 0x95, 0x38, 0x1c, 0xbd, 0x64, 0x3f, 0x0d}, - {0x68, 0x19, 0xd9, 0x15, 0xc7, 0x3f, 0x4d, 0x1e, 0x77, 0xe4, 0xe1, 0xb5, 0x2d, 0x1f, 0xa0, 0xf9, 0xcf, 0x9b, 0xea, 0xea, 0xd3, 0x93, 0x9f, 0x15, 0x87, 0x4b, 0xd9, 0x88, 0xe2, 0xa2, 0x36, 0x30}, - {0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1}, - {0xf0, 0x8a, 0x78, 0xcb, 0xba, 0xee, 0x08, 0x2b, 0x05, 0x2a, 0xe0, 0x70, 0x8f, 0x32, 0xfa, 0x1e, 0x50, 0xc5, 0xc4, 0x21, 0xaa, 0x77, 0x2b, 0xa5, 0xdb, 0xb4, 0x06, 0xa2, 0xea, 0x6b, 0xe3, 0x42}, - {0xab, 0x64, 0xef, 0xf7, 0xe8, 0x8e, 0x2e, 0x46, 0x16, 0x5e, 0x29, 0xf2, 0xbc, 0xe4, 0x18, 0x26, 0xbd, 0x4c, 0x7b, 0x35, 0x52, 0xf6, 0xb3, 0x82, 0xa9, 0xe7, 0xd3, 0xaf, 0x47, 0xc2, 0x45, 0xf8} - }; - int i; - for (i = 0; i < 8; i++) { - unsigned char out[32]; - secp256k1_sha256_t hasher; - secp256k1_sha256_initialize(&hasher); - secp256k1_sha256_write(&hasher, (const unsigned char*)(inputs[i]), strlen(inputs[i])); - secp256k1_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - if (strlen(inputs[i]) > 0) { - int split = secp256k1_rand_int(strlen(inputs[i])); - secp256k1_sha256_initialize(&hasher); - secp256k1_sha256_write(&hasher, (const unsigned char*)(inputs[i]), split); - secp256k1_sha256_write(&hasher, (const unsigned char*)(inputs[i] + split), strlen(inputs[i]) - split); - secp256k1_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - } - } -} - -void run_hmac_sha256_tests(void) { - static const char *keys[6] = { - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - "\x4a\x65\x66\x65", - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - }; - static const char *inputs[6] = { - "\x48\x69\x20\x54\x68\x65\x72\x65", - "\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61\x20\x77\x61\x6e\x74\x20\x66\x6f\x72\x20\x6e\x6f\x74\x68\x69\x6e\x67\x3f", - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", - "\x54\x65\x73\x74\x20\x55\x73\x69\x6e\x67\x20\x4c\x61\x72\x67\x65\x72\x20\x54\x68\x61\x6e\x20\x42\x6c\x6f\x63\x6b\x2d\x53\x69\x7a\x65\x20\x4b\x65\x79\x20\x2d\x20\x48\x61\x73\x68\x20\x4b\x65\x79\x20\x46\x69\x72\x73\x74", - "\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x20\x75\x73\x69\x6e\x67\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65\x20\x6b\x65\x79\x20\x61\x6e\x64\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65\x20\x64\x61\x74\x61\x2e\x20\x54\x68\x65\x20\x6b\x65\x79\x20\x6e\x65\x65\x64\x73\x20\x74\x6f\x20\x62\x65\x20\x68\x61\x73\x68\x65\x64\x20\x62\x65\x66\x6f\x72\x65\x20\x62\x65\x69\x6e\x67\x20\x75\x73\x65\x64\x20\x62\x79\x20\x74\x68\x65\x20\x48\x4d\x41\x43\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d\x2e" - }; - static const unsigned char outputs[6][32] = { - {0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b, 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7}, - {0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83, 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43}, - {0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46, 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7, 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8, 0xc1, 0x22, 0xd9, 0x63, 0x55, 0x14, 0xce, 0xd5, 0x65, 0xfe}, - {0x82, 0x55, 0x8a, 0x38, 0x9a, 0x44, 0x3c, 0x0e, 0xa4, 0xcc, 0x81, 0x98, 0x99, 0xf2, 0x08, 0x3a, 0x85, 0xf0, 0xfa, 0xa3, 0xe5, 0x78, 0xf8, 0x07, 0x7a, 0x2e, 0x3f, 0xf4, 0x67, 0x29, 0x66, 0x5b}, - {0x60, 0xe4, 0x31, 0x59, 0x1e, 0xe0, 0xb6, 0x7f, 0x0d, 0x8a, 0x26, 0xaa, 0xcb, 0xf5, 0xb7, 0x7f, 0x8e, 0x0b, 0xc6, 0x21, 0x37, 0x28, 0xc5, 0x14, 0x05, 0x46, 0x04, 0x0f, 0x0e, 0xe3, 0x7f, 0x54}, - {0x9b, 0x09, 0xff, 0xa7, 0x1b, 0x94, 0x2f, 0xcb, 0x27, 0x63, 0x5f, 0xbc, 0xd5, 0xb0, 0xe9, 0x44, 0xbf, 0xdc, 0x63, 0x64, 0x4f, 0x07, 0x13, 0x93, 0x8a, 0x7f, 0x51, 0x53, 0x5c, 0x3a, 0x35, 0xe2} - }; - int i; - for (i = 0; i < 6; i++) { - secp256k1_hmac_sha256_t hasher; - unsigned char out[32]; - secp256k1_hmac_sha256_initialize(&hasher, (const unsigned char*)(keys[i]), strlen(keys[i])); - secp256k1_hmac_sha256_write(&hasher, (const unsigned char*)(inputs[i]), strlen(inputs[i])); - secp256k1_hmac_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - if (strlen(inputs[i]) > 0) { - int split = secp256k1_rand_int(strlen(inputs[i])); - secp256k1_hmac_sha256_initialize(&hasher, (const unsigned char*)(keys[i]), strlen(keys[i])); - secp256k1_hmac_sha256_write(&hasher, (const unsigned char*)(inputs[i]), split); - secp256k1_hmac_sha256_write(&hasher, (const unsigned char*)(inputs[i] + split), strlen(inputs[i]) - split); - secp256k1_hmac_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - } - } -} - -void run_rfc6979_hmac_sha256_tests(void) { - static const unsigned char key1[65] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x4b, 0xf5, 0x12, 0x2f, 0x34, 0x45, 0x54, 0xc5, 0x3b, 0xde, 0x2e, 0xbb, 0x8c, 0xd2, 0xb7, 0xe3, 0xd1, 0x60, 0x0a, 0xd6, 0x31, 0xc3, 0x85, 0xa5, 0xd7, 0xcc, 0xe2, 0x3c, 0x77, 0x85, 0x45, 0x9a, 0}; - static const unsigned char out1[3][32] = { - {0x4f, 0xe2, 0x95, 0x25, 0xb2, 0x08, 0x68, 0x09, 0x15, 0x9a, 0xcd, 0xf0, 0x50, 0x6e, 0xfb, 0x86, 0xb0, 0xec, 0x93, 0x2c, 0x7b, 0xa4, 0x42, 0x56, 0xab, 0x32, 0x1e, 0x42, 0x1e, 0x67, 0xe9, 0xfb}, - {0x2b, 0xf0, 0xff, 0xf1, 0xd3, 0xc3, 0x78, 0xa2, 0x2d, 0xc5, 0xde, 0x1d, 0x85, 0x65, 0x22, 0x32, 0x5c, 0x65, 0xb5, 0x04, 0x49, 0x1a, 0x0c, 0xbd, 0x01, 0xcb, 0x8f, 0x3a, 0xa6, 0x7f, 0xfd, 0x4a}, - {0xf5, 0x28, 0xb4, 0x10, 0xcb, 0x54, 0x1f, 0x77, 0x00, 0x0d, 0x7a, 0xfb, 0x6c, 0x5b, 0x53, 0xc5, 0xc4, 0x71, 0xea, 0xb4, 0x3e, 0x46, 0x6d, 0x9a, 0xc5, 0x19, 0x0c, 0x39, 0xc8, 0x2f, 0xd8, 0x2e} - }; - - static const unsigned char key2[64] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}; - static const unsigned char out2[3][32] = { - {0x9c, 0x23, 0x6c, 0x16, 0x5b, 0x82, 0xae, 0x0c, 0xd5, 0x90, 0x65, 0x9e, 0x10, 0x0b, 0x6b, 0xab, 0x30, 0x36, 0xe7, 0xba, 0x8b, 0x06, 0x74, 0x9b, 0xaf, 0x69, 0x81, 0xe1, 0x6f, 0x1a, 0x2b, 0x95}, - {0xdf, 0x47, 0x10, 0x61, 0x62, 0x5b, 0xc0, 0xea, 0x14, 0xb6, 0x82, 0xfe, 0xee, 0x2c, 0x9c, 0x02, 0xf2, 0x35, 0xda, 0x04, 0x20, 0x4c, 0x1d, 0x62, 0xa1, 0x53, 0x6c, 0x6e, 0x17, 0xae, 0xd7, 0xa9}, - {0x75, 0x97, 0x88, 0x7c, 0xbd, 0x76, 0x32, 0x1f, 0x32, 0xe3, 0x04, 0x40, 0x67, 0x9a, 0x22, 0xcf, 0x7f, 0x8d, 0x9d, 0x2e, 0xac, 0x39, 0x0e, 0x58, 0x1f, 0xea, 0x09, 0x1c, 0xe2, 0x02, 0xba, 0x94} - }; - - secp256k1_rfc6979_hmac_sha256_t rng; - unsigned char out[32]; - int i; - - secp256k1_rfc6979_hmac_sha256_initialize(&rng, key1, 64); - for (i = 0; i < 3; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, out, 32); - CHECK(memcmp(out, out1[i], 32) == 0); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - - secp256k1_rfc6979_hmac_sha256_initialize(&rng, key1, 65); - for (i = 0; i < 3; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, out, 32); - CHECK(memcmp(out, out1[i], 32) != 0); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - - secp256k1_rfc6979_hmac_sha256_initialize(&rng, key2, 64); - for (i = 0; i < 3; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, out, 32); - CHECK(memcmp(out, out2[i], 32) == 0); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); -} - -/***** RANDOM TESTS *****/ - -void test_rand_bits(int rand32, int bits) { - /* (1-1/2^B)^rounds[B] < 1/10^9, so rounds is the number of iterations to - * get a false negative chance below once in a billion */ - static const unsigned int rounds[7] = {1, 30, 73, 156, 322, 653, 1316}; - /* We try multiplying the results with various odd numbers, which shouldn't - * influence the uniform distribution modulo a power of 2. */ - static const uint32_t mults[6] = {1, 3, 21, 289, 0x9999, 0x80402011}; - /* We only select up to 6 bits from the output to analyse */ - unsigned int usebits = bits > 6 ? 6 : bits; - unsigned int maxshift = bits - usebits; - /* For each of the maxshift+1 usebits-bit sequences inside a bits-bit - number, track all observed outcomes, one per bit in a uint64_t. */ - uint64_t x[6][27] = {{0}}; - unsigned int i, shift, m; - /* Multiply the output of all rand calls with the odd number m, which - should not change the uniformity of its distribution. */ - for (i = 0; i < rounds[usebits]; i++) { - uint32_t r = (rand32 ? secp256k1_rand32() : secp256k1_rand_bits(bits)); - CHECK((((uint64_t)r) >> bits) == 0); - for (m = 0; m < sizeof(mults) / sizeof(mults[0]); m++) { - uint32_t rm = r * mults[m]; - for (shift = 0; shift <= maxshift; shift++) { - x[m][shift] |= (((uint64_t)1) << ((rm >> shift) & ((1 << usebits) - 1))); - } - } - } - for (m = 0; m < sizeof(mults) / sizeof(mults[0]); m++) { - for (shift = 0; shift <= maxshift; shift++) { - /* Test that the lower usebits bits of x[shift] are 1 */ - CHECK(((~x[m][shift]) << (64 - (1 << usebits))) == 0); - } - } -} - -/* Subrange must be a whole divisor of range, and at most 64 */ -void test_rand_int(uint32_t range, uint32_t subrange) { - /* (1-1/subrange)^rounds < 1/10^9 */ - int rounds = (subrange * 2073) / 100; - int i; - uint64_t x = 0; - CHECK((range % subrange) == 0); - for (i = 0; i < rounds; i++) { - uint32_t r = secp256k1_rand_int(range); - CHECK(r < range); - r = r % subrange; - x |= (((uint64_t)1) << r); - } - /* Test that the lower subrange bits of x are 1. */ - CHECK(((~x) << (64 - subrange)) == 0); -} - -void run_rand_bits(void) { - size_t b; - test_rand_bits(1, 32); - for (b = 1; b <= 32; b++) { - test_rand_bits(0, b); - } -} - -void run_rand_int(void) { - static const uint32_t ms[] = {1, 3, 17, 1000, 13771, 999999, 33554432}; - static const uint32_t ss[] = {1, 3, 6, 9, 13, 31, 64}; - unsigned int m, s; - for (m = 0; m < sizeof(ms) / sizeof(ms[0]); m++) { - for (s = 0; s < sizeof(ss) / sizeof(ss[0]); s++) { - test_rand_int(ms[m] * ss[s], ss[s]); - } - } -} - -/***** NUM TESTS *****/ - -#ifndef USE_NUM_NONE -void random_num_negate(secp256k1_num *num) { - if (secp256k1_rand_bits(1)) { - secp256k1_num_negate(num); - } -} - -void random_num_order_test(secp256k1_num *num) { - secp256k1_scalar sc; - random_scalar_order_test(&sc); - secp256k1_scalar_get_num(num, &sc); -} - -void random_num_order(secp256k1_num *num) { - secp256k1_scalar sc; - random_scalar_order(&sc); - secp256k1_scalar_get_num(num, &sc); -} - -void test_num_negate(void) { - secp256k1_num n1; - secp256k1_num n2; - random_num_order_test(&n1); /* n1 = R */ - random_num_negate(&n1); - secp256k1_num_copy(&n2, &n1); /* n2 = R */ - secp256k1_num_sub(&n1, &n2, &n1); /* n1 = n2-n1 = 0 */ - CHECK(secp256k1_num_is_zero(&n1)); - secp256k1_num_copy(&n1, &n2); /* n1 = R */ - secp256k1_num_negate(&n1); /* n1 = -R */ - CHECK(!secp256k1_num_is_zero(&n1)); - secp256k1_num_add(&n1, &n2, &n1); /* n1 = n2+n1 = 0 */ - CHECK(secp256k1_num_is_zero(&n1)); - secp256k1_num_copy(&n1, &n2); /* n1 = R */ - secp256k1_num_negate(&n1); /* n1 = -R */ - CHECK(secp256k1_num_is_neg(&n1) != secp256k1_num_is_neg(&n2)); - secp256k1_num_negate(&n1); /* n1 = R */ - CHECK(secp256k1_num_eq(&n1, &n2)); -} - -void test_num_add_sub(void) { - int i; - secp256k1_scalar s; - secp256k1_num n1; - secp256k1_num n2; - secp256k1_num n1p2, n2p1, n1m2, n2m1; - random_num_order_test(&n1); /* n1 = R1 */ - if (secp256k1_rand_bits(1)) { - random_num_negate(&n1); - } - random_num_order_test(&n2); /* n2 = R2 */ - if (secp256k1_rand_bits(1)) { - random_num_negate(&n2); - } - secp256k1_num_add(&n1p2, &n1, &n2); /* n1p2 = R1 + R2 */ - secp256k1_num_add(&n2p1, &n2, &n1); /* n2p1 = R2 + R1 */ - secp256k1_num_sub(&n1m2, &n1, &n2); /* n1m2 = R1 - R2 */ - secp256k1_num_sub(&n2m1, &n2, &n1); /* n2m1 = R2 - R1 */ - CHECK(secp256k1_num_eq(&n1p2, &n2p1)); - CHECK(!secp256k1_num_eq(&n1p2, &n1m2)); - secp256k1_num_negate(&n2m1); /* n2m1 = -R2 + R1 */ - CHECK(secp256k1_num_eq(&n2m1, &n1m2)); - CHECK(!secp256k1_num_eq(&n2m1, &n1)); - secp256k1_num_add(&n2m1, &n2m1, &n2); /* n2m1 = -R2 + R1 + R2 = R1 */ - CHECK(secp256k1_num_eq(&n2m1, &n1)); - CHECK(!secp256k1_num_eq(&n2p1, &n1)); - secp256k1_num_sub(&n2p1, &n2p1, &n2); /* n2p1 = R2 + R1 - R2 = R1 */ - CHECK(secp256k1_num_eq(&n2p1, &n1)); - - /* check is_one */ - secp256k1_scalar_set_int(&s, 1); - secp256k1_scalar_get_num(&n1, &s); - CHECK(secp256k1_num_is_one(&n1)); - /* check that 2^n + 1 is never 1 */ - secp256k1_scalar_get_num(&n2, &s); - for (i = 0; i < 250; ++i) { - secp256k1_num_add(&n1, &n1, &n1); /* n1 *= 2 */ - secp256k1_num_add(&n1p2, &n1, &n2); /* n1p2 = n1 + 1 */ - CHECK(!secp256k1_num_is_one(&n1p2)); - } -} - -void test_num_mod(void) { - int i; - secp256k1_scalar s; - secp256k1_num order, n; - - /* check that 0 mod anything is 0 */ - random_scalar_order_test(&s); - secp256k1_scalar_get_num(&order, &s); - secp256k1_scalar_set_int(&s, 0); - secp256k1_scalar_get_num(&n, &s); - secp256k1_num_mod(&n, &order); - CHECK(secp256k1_num_is_zero(&n)); - - /* check that anything mod 1 is 0 */ - secp256k1_scalar_set_int(&s, 1); - secp256k1_scalar_get_num(&order, &s); - secp256k1_scalar_get_num(&n, &s); - secp256k1_num_mod(&n, &order); - CHECK(secp256k1_num_is_zero(&n)); - - /* check that increasing the number past 2^256 does not break this */ - random_scalar_order_test(&s); - secp256k1_scalar_get_num(&n, &s); - /* multiply by 2^8, which'll test this case with high probability */ - for (i = 0; i < 8; ++i) { - secp256k1_num_add(&n, &n, &n); - } - secp256k1_num_mod(&n, &order); - CHECK(secp256k1_num_is_zero(&n)); -} - -void test_num_jacobi(void) { - secp256k1_scalar sqr; - secp256k1_scalar small; - secp256k1_scalar five; /* five is not a quadratic residue */ - secp256k1_num order, n; - int i; - /* squares mod 5 are 1, 4 */ - const int jacobi5[10] = { 0, 1, -1, -1, 1, 0, 1, -1, -1, 1 }; - - /* check some small values with 5 as the order */ - secp256k1_scalar_set_int(&five, 5); - secp256k1_scalar_get_num(&order, &five); - for (i = 0; i < 10; ++i) { - secp256k1_scalar_set_int(&small, i); - secp256k1_scalar_get_num(&n, &small); - CHECK(secp256k1_num_jacobi(&n, &order) == jacobi5[i]); - } - - /** test large values with 5 as group order */ - secp256k1_scalar_get_num(&order, &five); - /* we first need a scalar which is not a multiple of 5 */ - do { - secp256k1_num fiven; - random_scalar_order_test(&sqr); - secp256k1_scalar_get_num(&fiven, &five); - secp256k1_scalar_get_num(&n, &sqr); - secp256k1_num_mod(&n, &fiven); - } while (secp256k1_num_is_zero(&n)); - /* next force it to be a residue. 2 is a nonresidue mod 5 so we can - * just multiply by two, i.e. add the number to itself */ - if (secp256k1_num_jacobi(&n, &order) == -1) { - secp256k1_num_add(&n, &n, &n); - } - - /* test residue */ - CHECK(secp256k1_num_jacobi(&n, &order) == 1); - /* test nonresidue */ - secp256k1_num_add(&n, &n, &n); - CHECK(secp256k1_num_jacobi(&n, &order) == -1); - - /** test with secp group order as order */ - secp256k1_scalar_order_get_num(&order); - random_scalar_order_test(&sqr); - secp256k1_scalar_sqr(&sqr, &sqr); - /* test residue */ - secp256k1_scalar_get_num(&n, &sqr); - CHECK(secp256k1_num_jacobi(&n, &order) == 1); - /* test nonresidue */ - secp256k1_scalar_mul(&sqr, &sqr, &five); - secp256k1_scalar_get_num(&n, &sqr); - CHECK(secp256k1_num_jacobi(&n, &order) == -1); - /* test multiple of the order*/ - CHECK(secp256k1_num_jacobi(&order, &order) == 0); - - /* check one less than the order */ - secp256k1_scalar_set_int(&small, 1); - secp256k1_scalar_get_num(&n, &small); - secp256k1_num_sub(&n, &order, &n); - CHECK(secp256k1_num_jacobi(&n, &order) == 1); /* sage confirms this is 1 */ -} - -void run_num_smalltests(void) { - int i; - for (i = 0; i < 100*count; i++) { - test_num_negate(); - test_num_add_sub(); - test_num_mod(); - test_num_jacobi(); - } -} -#endif - -/***** SCALAR TESTS *****/ - -void scalar_test(void) { - secp256k1_scalar s; - secp256k1_scalar s1; - secp256k1_scalar s2; -#ifndef USE_NUM_NONE - secp256k1_num snum, s1num, s2num; - secp256k1_num order, half_order; -#endif - unsigned char c[32]; - - /* Set 's' to a random scalar, with value 'snum'. */ - random_scalar_order_test(&s); - - /* Set 's1' to a random scalar, with value 's1num'. */ - random_scalar_order_test(&s1); - - /* Set 's2' to a random scalar, with value 'snum2', and byte array representation 'c'. */ - random_scalar_order_test(&s2); - secp256k1_scalar_get_b32(c, &s2); - -#ifndef USE_NUM_NONE - secp256k1_scalar_get_num(&snum, &s); - secp256k1_scalar_get_num(&s1num, &s1); - secp256k1_scalar_get_num(&s2num, &s2); - - secp256k1_scalar_order_get_num(&order); - half_order = order; - secp256k1_num_shift(&half_order, 1); -#endif - - { - int i; - /* Test that fetching groups of 4 bits from a scalar and recursing n(i)=16*n(i-1)+p(i) reconstructs it. */ - secp256k1_scalar n; - secp256k1_scalar_set_int(&n, 0); - for (i = 0; i < 256; i += 4) { - secp256k1_scalar t; - int j; - secp256k1_scalar_set_int(&t, secp256k1_scalar_get_bits(&s, 256 - 4 - i, 4)); - for (j = 0; j < 4; j++) { - secp256k1_scalar_add(&n, &n, &n); - } - secp256k1_scalar_add(&n, &n, &t); - } - CHECK(secp256k1_scalar_eq(&n, &s)); - } - - { - /* Test that fetching groups of randomly-sized bits from a scalar and recursing n(i)=b*n(i-1)+p(i) reconstructs it. */ - secp256k1_scalar n; - int i = 0; - secp256k1_scalar_set_int(&n, 0); - while (i < 256) { - secp256k1_scalar t; - int j; - int now = secp256k1_rand_int(15) + 1; - if (now + i > 256) { - now = 256 - i; - } - secp256k1_scalar_set_int(&t, secp256k1_scalar_get_bits_var(&s, 256 - now - i, now)); - for (j = 0; j < now; j++) { - secp256k1_scalar_add(&n, &n, &n); - } - secp256k1_scalar_add(&n, &n, &t); - i += now; - } - CHECK(secp256k1_scalar_eq(&n, &s)); - } - -#ifndef USE_NUM_NONE - { - /* Test that adding the scalars together is equal to adding their numbers together modulo the order. */ - secp256k1_num rnum; - secp256k1_num r2num; - secp256k1_scalar r; - secp256k1_num_add(&rnum, &snum, &s2num); - secp256k1_num_mod(&rnum, &order); - secp256k1_scalar_add(&r, &s, &s2); - secp256k1_scalar_get_num(&r2num, &r); - CHECK(secp256k1_num_eq(&rnum, &r2num)); - } - - { - /* Test that multiplying the scalars is equal to multiplying their numbers modulo the order. */ - secp256k1_scalar r; - secp256k1_num r2num; - secp256k1_num rnum; - secp256k1_num_mul(&rnum, &snum, &s2num); - secp256k1_num_mod(&rnum, &order); - secp256k1_scalar_mul(&r, &s, &s2); - secp256k1_scalar_get_num(&r2num, &r); - CHECK(secp256k1_num_eq(&rnum, &r2num)); - /* The result can only be zero if at least one of the factors was zero. */ - CHECK(secp256k1_scalar_is_zero(&r) == (secp256k1_scalar_is_zero(&s) || secp256k1_scalar_is_zero(&s2))); - /* The results can only be equal to one of the factors if that factor was zero, or the other factor was one. */ - CHECK(secp256k1_num_eq(&rnum, &snum) == (secp256k1_scalar_is_zero(&s) || secp256k1_scalar_is_one(&s2))); - CHECK(secp256k1_num_eq(&rnum, &s2num) == (secp256k1_scalar_is_zero(&s2) || secp256k1_scalar_is_one(&s))); - } - - { - secp256k1_scalar neg; - secp256k1_num negnum; - secp256k1_num negnum2; - /* Check that comparison with zero matches comparison with zero on the number. */ - CHECK(secp256k1_num_is_zero(&snum) == secp256k1_scalar_is_zero(&s)); - /* Check that comparison with the half order is equal to testing for high scalar. */ - CHECK(secp256k1_scalar_is_high(&s) == (secp256k1_num_cmp(&snum, &half_order) > 0)); - secp256k1_scalar_negate(&neg, &s); - secp256k1_num_sub(&negnum, &order, &snum); - secp256k1_num_mod(&negnum, &order); - /* Check that comparison with the half order is equal to testing for high scalar after negation. */ - CHECK(secp256k1_scalar_is_high(&neg) == (secp256k1_num_cmp(&negnum, &half_order) > 0)); - /* Negating should change the high property, unless the value was already zero. */ - CHECK((secp256k1_scalar_is_high(&s) == secp256k1_scalar_is_high(&neg)) == secp256k1_scalar_is_zero(&s)); - secp256k1_scalar_get_num(&negnum2, &neg); - /* Negating a scalar should be equal to (order - n) mod order on the number. */ - CHECK(secp256k1_num_eq(&negnum, &negnum2)); - secp256k1_scalar_add(&neg, &neg, &s); - /* Adding a number to its negation should result in zero. */ - CHECK(secp256k1_scalar_is_zero(&neg)); - secp256k1_scalar_negate(&neg, &neg); - /* Negating zero should still result in zero. */ - CHECK(secp256k1_scalar_is_zero(&neg)); - } - - { - /* Test secp256k1_scalar_mul_shift_var. */ - secp256k1_scalar r; - secp256k1_num one; - secp256k1_num rnum; - secp256k1_num rnum2; - unsigned char cone[1] = {0x01}; - unsigned int shift = 256 + secp256k1_rand_int(257); - secp256k1_scalar_mul_shift_var(&r, &s1, &s2, shift); - secp256k1_num_mul(&rnum, &s1num, &s2num); - secp256k1_num_shift(&rnum, shift - 1); - secp256k1_num_set_bin(&one, cone, 1); - secp256k1_num_add(&rnum, &rnum, &one); - secp256k1_num_shift(&rnum, 1); - secp256k1_scalar_get_num(&rnum2, &r); - CHECK(secp256k1_num_eq(&rnum, &rnum2)); - } - - { - /* test secp256k1_scalar_shr_int */ - secp256k1_scalar r; - int i; - random_scalar_order_test(&r); - for (i = 0; i < 100; ++i) { - int low; - int shift = 1 + secp256k1_rand_int(15); - int expected = r.d[0] % (1 << shift); - low = secp256k1_scalar_shr_int(&r, shift); - CHECK(expected == low); - } - } -#endif - - { - /* Test that scalar inverses are equal to the inverse of their number modulo the order. */ - if (!secp256k1_scalar_is_zero(&s)) { - secp256k1_scalar inv; -#ifndef USE_NUM_NONE - secp256k1_num invnum; - secp256k1_num invnum2; -#endif - secp256k1_scalar_inverse(&inv, &s); -#ifndef USE_NUM_NONE - secp256k1_num_mod_inverse(&invnum, &snum, &order); - secp256k1_scalar_get_num(&invnum2, &inv); - CHECK(secp256k1_num_eq(&invnum, &invnum2)); -#endif - secp256k1_scalar_mul(&inv, &inv, &s); - /* Multiplying a scalar with its inverse must result in one. */ - CHECK(secp256k1_scalar_is_one(&inv)); - secp256k1_scalar_inverse(&inv, &inv); - /* Inverting one must result in one. */ - CHECK(secp256k1_scalar_is_one(&inv)); -#ifndef USE_NUM_NONE - secp256k1_scalar_get_num(&invnum, &inv); - CHECK(secp256k1_num_is_one(&invnum)); -#endif - } - } - - { - /* Test commutativity of add. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_add(&r1, &s1, &s2); - secp256k1_scalar_add(&r2, &s2, &s1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - secp256k1_scalar r1, r2; - secp256k1_scalar b; - int i; - /* Test add_bit. */ - int bit = secp256k1_rand_bits(8); - secp256k1_scalar_set_int(&b, 1); - CHECK(secp256k1_scalar_is_one(&b)); - for (i = 0; i < bit; i++) { - secp256k1_scalar_add(&b, &b, &b); - } - r1 = s1; - r2 = s1; - if (!secp256k1_scalar_add(&r1, &r1, &b)) { - /* No overflow happened. */ - secp256k1_scalar_cadd_bit(&r2, bit, 1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - /* cadd is a noop when flag is zero */ - secp256k1_scalar_cadd_bit(&r2, bit, 0); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - } - - { - /* Test commutativity of mul. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_mul(&r1, &s1, &s2); - secp256k1_scalar_mul(&r2, &s2, &s1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test associativity of add. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_add(&r1, &s1, &s2); - secp256k1_scalar_add(&r1, &r1, &s); - secp256k1_scalar_add(&r2, &s2, &s); - secp256k1_scalar_add(&r2, &s1, &r2); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test associativity of mul. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_mul(&r1, &s1, &s2); - secp256k1_scalar_mul(&r1, &r1, &s); - secp256k1_scalar_mul(&r2, &s2, &s); - secp256k1_scalar_mul(&r2, &s1, &r2); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test distributitivity of mul over add. */ - secp256k1_scalar r1, r2, t; - secp256k1_scalar_add(&r1, &s1, &s2); - secp256k1_scalar_mul(&r1, &r1, &s); - secp256k1_scalar_mul(&r2, &s1, &s); - secp256k1_scalar_mul(&t, &s2, &s); - secp256k1_scalar_add(&r2, &r2, &t); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test square. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_sqr(&r1, &s1); - secp256k1_scalar_mul(&r2, &s1, &s1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test multiplicative identity. */ - secp256k1_scalar r1, v1; - secp256k1_scalar_set_int(&v1,1); - secp256k1_scalar_mul(&r1, &s1, &v1); - CHECK(secp256k1_scalar_eq(&r1, &s1)); - } - - { - /* Test additive identity. */ - secp256k1_scalar r1, v0; - secp256k1_scalar_set_int(&v0,0); - secp256k1_scalar_add(&r1, &s1, &v0); - CHECK(secp256k1_scalar_eq(&r1, &s1)); - } - - { - /* Test zero product property. */ - secp256k1_scalar r1, v0; - secp256k1_scalar_set_int(&v0,0); - secp256k1_scalar_mul(&r1, &s1, &v0); - CHECK(secp256k1_scalar_eq(&r1, &v0)); - } - -} - -void run_scalar_tests(void) { - int i; - for (i = 0; i < 128 * count; i++) { - scalar_test(); - } - - { - /* (-1)+1 should be zero. */ - secp256k1_scalar s, o; - secp256k1_scalar_set_int(&s, 1); - CHECK(secp256k1_scalar_is_one(&s)); - secp256k1_scalar_negate(&o, &s); - secp256k1_scalar_add(&o, &o, &s); - CHECK(secp256k1_scalar_is_zero(&o)); - secp256k1_scalar_negate(&o, &o); - CHECK(secp256k1_scalar_is_zero(&o)); - } - -#ifndef USE_NUM_NONE - { - /* A scalar with value of the curve order should be 0. */ - secp256k1_num order; - secp256k1_scalar zero; - unsigned char bin[32]; - int overflow = 0; - secp256k1_scalar_order_get_num(&order); - secp256k1_num_get_bin(bin, 32, &order); - secp256k1_scalar_set_b32(&zero, bin, &overflow); - CHECK(overflow == 1); - CHECK(secp256k1_scalar_is_zero(&zero)); - } -#endif - - { - /* Does check_overflow check catch all ones? */ - static const secp256k1_scalar overflowed = SECP256K1_SCALAR_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL - ); - CHECK(secp256k1_scalar_check_overflow(&overflowed)); - } - - { - /* Static test vectors. - * These were reduced from ~10^12 random vectors based on comparison-decision - * and edge-case coverage on 32-bit and 64-bit implementations. - * The responses were generated with Sage 5.9. - */ - secp256k1_scalar x; - secp256k1_scalar y; - secp256k1_scalar z; - secp256k1_scalar zz; - secp256k1_scalar one; - secp256k1_scalar r1; - secp256k1_scalar r2; -#if defined(USE_SCALAR_INV_NUM) - secp256k1_scalar zzv; -#endif - int overflow; - unsigned char chal[33][2][32] = { - {{0xff, 0xff, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, - 0xff, 0xff, 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff}}, - {{0xef, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x80, 0xff}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0x3f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00}, - {0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x1e, 0xf8, 0xff, 0xff, 0xff, 0xfd, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, - 0x00, 0x00, 0x00, 0xf8, 0xff, 0x03, 0x00, 0xe0, - 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, - 0xf3, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x1c, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, - 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x00, 0x80, 0xff, 0xff, 0x3f, - 0x00, 0xfe, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0x00, 0x0f, 0xfc, 0x9f, - 0xff, 0xff, 0xff, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0x0f, 0xfc, 0xff, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x00, 0x00, 0xf8, 0xff, 0x0f, 0xc0, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x07, 0x80, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xf7, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf0}, - {0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0x00, 0xf8, 0xff, 0x03, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x03, 0xc0, 0xff, 0x0f, 0xfc, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, - 0xff, 0x01, 0x00, 0x00, 0x00, 0x3f, 0x00, 0xc0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0x8f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x7f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x03, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x80, 0xff, 0x7f}, - {0xff, 0xcf, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, - 0xbf, 0xff, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, - 0xff, 0xff, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0x01, 0xfc, 0xff, 0x01, 0x00, 0xfe, 0xff}, - {0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x7f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf0, 0xff, 0xff, - 0xe0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0xfc, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x3f, - 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x0f, 0x7e, 0x00, 0x00}}, - {{0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0x07, 0x00}, - {0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xfb, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60}}, - {{0xff, 0x01, 0x00, 0xff, 0xff, 0xff, 0x0f, 0x00, - 0x80, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00}}, - {{0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, - 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0xff, 0xff, 0xcf, 0xff, 0x1f, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x7e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00}, - {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xff, 0x7f, 0x00, 0x80, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x80, - 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x7f, 0xf8, 0xff, 0xff, 0x1f, 0x00, 0xfe}}, - {{0xff, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, - 0xff, 0x03, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xc0, - 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff}}, - {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x7e, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0x01, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, - 0xff, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x3f, 0x00, 0x00, 0xc0, 0xf1, 0x7f, 0x00}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00}, - {0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, - 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, - 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0xff, 0xff}}, - {{0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0x03, 0xe0, 0x01, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xfc, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xff, 0xff, 0xf0, 0x07, 0x00, 0x3c, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x07, 0xe0, 0xff, 0x00, 0x00, 0x00}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf8, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x80, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x7f, 0xfe, 0xff, 0x1f, - 0x00, 0xfe, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff}}, - {{0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, - 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xf0}, - {0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, - 0xf8, 0x07, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xc7, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff}}, - {{0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0x03, 0xfb, - 0xfa, 0x8a, 0x7d, 0xdf, 0x13, 0x86, 0xe2, 0x03}, - {0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0x03, 0xfb, - 0xfa, 0x8a, 0x7d, 0xdf, 0x13, 0x86, 0xe2, 0x03}} - }; - unsigned char res[33][2][32] = { - {{0x0c, 0x3b, 0x0a, 0xca, 0x8d, 0x1a, 0x2f, 0xb9, - 0x8a, 0x7b, 0x53, 0x5a, 0x1f, 0xc5, 0x22, 0xa1, - 0x07, 0x2a, 0x48, 0xea, 0x02, 0xeb, 0xb3, 0xd6, - 0x20, 0x1e, 0x86, 0xd0, 0x95, 0xf6, 0x92, 0x35}, - {0xdc, 0x90, 0x7a, 0x07, 0x2e, 0x1e, 0x44, 0x6d, - 0xf8, 0x15, 0x24, 0x5b, 0x5a, 0x96, 0x37, 0x9c, - 0x37, 0x7b, 0x0d, 0xac, 0x1b, 0x65, 0x58, 0x49, - 0x43, 0xb7, 0x31, 0xbb, 0xa7, 0xf4, 0x97, 0x15}}, - {{0xf1, 0xf7, 0x3a, 0x50, 0xe6, 0x10, 0xba, 0x22, - 0x43, 0x4d, 0x1f, 0x1f, 0x7c, 0x27, 0xca, 0x9c, - 0xb8, 0xb6, 0xa0, 0xfc, 0xd8, 0xc0, 0x05, 0x2f, - 0xf7, 0x08, 0xe1, 0x76, 0xdd, 0xd0, 0x80, 0xc8}, - {0xe3, 0x80, 0x80, 0xb8, 0xdb, 0xe3, 0xa9, 0x77, - 0x00, 0xb0, 0xf5, 0x2e, 0x27, 0xe2, 0x68, 0xc4, - 0x88, 0xe8, 0x04, 0xc1, 0x12, 0xbf, 0x78, 0x59, - 0xe6, 0xa9, 0x7c, 0xe1, 0x81, 0xdd, 0xb9, 0xd5}}, - {{0x96, 0xe2, 0xee, 0x01, 0xa6, 0x80, 0x31, 0xef, - 0x5c, 0xd0, 0x19, 0xb4, 0x7d, 0x5f, 0x79, 0xab, - 0xa1, 0x97, 0xd3, 0x7e, 0x33, 0xbb, 0x86, 0x55, - 0x60, 0x20, 0x10, 0x0d, 0x94, 0x2d, 0x11, 0x7c}, - {0xcc, 0xab, 0xe0, 0xe8, 0x98, 0x65, 0x12, 0x96, - 0x38, 0x5a, 0x1a, 0xf2, 0x85, 0x23, 0x59, 0x5f, - 0xf9, 0xf3, 0xc2, 0x81, 0x70, 0x92, 0x65, 0x12, - 0x9c, 0x65, 0x1e, 0x96, 0x00, 0xef, 0xe7, 0x63}}, - {{0xac, 0x1e, 0x62, 0xc2, 0x59, 0xfc, 0x4e, 0x5c, - 0x83, 0xb0, 0xd0, 0x6f, 0xce, 0x19, 0xf6, 0xbf, - 0xa4, 0xb0, 0xe0, 0x53, 0x66, 0x1f, 0xbf, 0xc9, - 0x33, 0x47, 0x37, 0xa9, 0x3d, 0x5d, 0xb0, 0x48}, - {0x86, 0xb9, 0x2a, 0x7f, 0x8e, 0xa8, 0x60, 0x42, - 0x26, 0x6d, 0x6e, 0x1c, 0xa2, 0xec, 0xe0, 0xe5, - 0x3e, 0x0a, 0x33, 0xbb, 0x61, 0x4c, 0x9f, 0x3c, - 0xd1, 0xdf, 0x49, 0x33, 0xcd, 0x72, 0x78, 0x18}}, - {{0xf7, 0xd3, 0xcd, 0x49, 0x5c, 0x13, 0x22, 0xfb, - 0x2e, 0xb2, 0x2f, 0x27, 0xf5, 0x8a, 0x5d, 0x74, - 0xc1, 0x58, 0xc5, 0xc2, 0x2d, 0x9f, 0x52, 0xc6, - 0x63, 0x9f, 0xba, 0x05, 0x76, 0x45, 0x7a, 0x63}, - {0x8a, 0xfa, 0x55, 0x4d, 0xdd, 0xa3, 0xb2, 0xc3, - 0x44, 0xfd, 0xec, 0x72, 0xde, 0xef, 0xc0, 0x99, - 0xf5, 0x9f, 0xe2, 0x52, 0xb4, 0x05, 0x32, 0x58, - 0x57, 0xc1, 0x8f, 0xea, 0xc3, 0x24, 0x5b, 0x94}}, - {{0x05, 0x83, 0xee, 0xdd, 0x64, 0xf0, 0x14, 0x3b, - 0xa0, 0x14, 0x4a, 0x3a, 0x41, 0x82, 0x7c, 0xa7, - 0x2c, 0xaa, 0xb1, 0x76, 0xbb, 0x59, 0x64, 0x5f, - 0x52, 0xad, 0x25, 0x29, 0x9d, 0x8f, 0x0b, 0xb0}, - {0x7e, 0xe3, 0x7c, 0xca, 0xcd, 0x4f, 0xb0, 0x6d, - 0x7a, 0xb2, 0x3e, 0xa0, 0x08, 0xb9, 0xa8, 0x2d, - 0xc2, 0xf4, 0x99, 0x66, 0xcc, 0xac, 0xd8, 0xb9, - 0x72, 0x2a, 0x4a, 0x3e, 0x0f, 0x7b, 0xbf, 0xf4}}, - {{0x8c, 0x9c, 0x78, 0x2b, 0x39, 0x61, 0x7e, 0xf7, - 0x65, 0x37, 0x66, 0x09, 0x38, 0xb9, 0x6f, 0x70, - 0x78, 0x87, 0xff, 0xcf, 0x93, 0xca, 0x85, 0x06, - 0x44, 0x84, 0xa7, 0xfe, 0xd3, 0xa4, 0xe3, 0x7e}, - {0xa2, 0x56, 0x49, 0x23, 0x54, 0xa5, 0x50, 0xe9, - 0x5f, 0xf0, 0x4d, 0xe7, 0xdc, 0x38, 0x32, 0x79, - 0x4f, 0x1c, 0xb7, 0xe4, 0xbb, 0xf8, 0xbb, 0x2e, - 0x40, 0x41, 0x4b, 0xcc, 0xe3, 0x1e, 0x16, 0x36}}, - {{0x0c, 0x1e, 0xd7, 0x09, 0x25, 0x40, 0x97, 0xcb, - 0x5c, 0x46, 0xa8, 0xda, 0xef, 0x25, 0xd5, 0xe5, - 0x92, 0x4d, 0xcf, 0xa3, 0xc4, 0x5d, 0x35, 0x4a, - 0xe4, 0x61, 0x92, 0xf3, 0xbf, 0x0e, 0xcd, 0xbe}, - {0xe4, 0xaf, 0x0a, 0xb3, 0x30, 0x8b, 0x9b, 0x48, - 0x49, 0x43, 0xc7, 0x64, 0x60, 0x4a, 0x2b, 0x9e, - 0x95, 0x5f, 0x56, 0xe8, 0x35, 0xdc, 0xeb, 0xdc, - 0xc7, 0xc4, 0xfe, 0x30, 0x40, 0xc7, 0xbf, 0xa4}}, - {{0xd4, 0xa0, 0xf5, 0x81, 0x49, 0x6b, 0xb6, 0x8b, - 0x0a, 0x69, 0xf9, 0xfe, 0xa8, 0x32, 0xe5, 0xe0, - 0xa5, 0xcd, 0x02, 0x53, 0xf9, 0x2c, 0xe3, 0x53, - 0x83, 0x36, 0xc6, 0x02, 0xb5, 0xeb, 0x64, 0xb8}, - {0x1d, 0x42, 0xb9, 0xf9, 0xe9, 0xe3, 0x93, 0x2c, - 0x4c, 0xee, 0x6c, 0x5a, 0x47, 0x9e, 0x62, 0x01, - 0x6b, 0x04, 0xfe, 0xa4, 0x30, 0x2b, 0x0d, 0x4f, - 0x71, 0x10, 0xd3, 0x55, 0xca, 0xf3, 0x5e, 0x80}}, - {{0x77, 0x05, 0xf6, 0x0c, 0x15, 0x9b, 0x45, 0xe7, - 0xb9, 0x11, 0xb8, 0xf5, 0xd6, 0xda, 0x73, 0x0c, - 0xda, 0x92, 0xea, 0xd0, 0x9d, 0xd0, 0x18, 0x92, - 0xce, 0x9a, 0xaa, 0xee, 0x0f, 0xef, 0xde, 0x30}, - {0xf1, 0xf1, 0xd6, 0x9b, 0x51, 0xd7, 0x77, 0x62, - 0x52, 0x10, 0xb8, 0x7a, 0x84, 0x9d, 0x15, 0x4e, - 0x07, 0xdc, 0x1e, 0x75, 0x0d, 0x0c, 0x3b, 0xdb, - 0x74, 0x58, 0x62, 0x02, 0x90, 0x54, 0x8b, 0x43}}, - {{0xa6, 0xfe, 0x0b, 0x87, 0x80, 0x43, 0x67, 0x25, - 0x57, 0x5d, 0xec, 0x40, 0x50, 0x08, 0xd5, 0x5d, - 0x43, 0xd7, 0xe0, 0xaa, 0xe0, 0x13, 0xb6, 0xb0, - 0xc0, 0xd4, 0xe5, 0x0d, 0x45, 0x83, 0xd6, 0x13}, - {0x40, 0x45, 0x0a, 0x92, 0x31, 0xea, 0x8c, 0x60, - 0x8c, 0x1f, 0xd8, 0x76, 0x45, 0xb9, 0x29, 0x00, - 0x26, 0x32, 0xd8, 0xa6, 0x96, 0x88, 0xe2, 0xc4, - 0x8b, 0xdb, 0x7f, 0x17, 0x87, 0xcc, 0xc8, 0xf2}}, - {{0xc2, 0x56, 0xe2, 0xb6, 0x1a, 0x81, 0xe7, 0x31, - 0x63, 0x2e, 0xbb, 0x0d, 0x2f, 0x81, 0x67, 0xd4, - 0x22, 0xe2, 0x38, 0x02, 0x25, 0x97, 0xc7, 0x88, - 0x6e, 0xdf, 0xbe, 0x2a, 0xa5, 0x73, 0x63, 0xaa}, - {0x50, 0x45, 0xe2, 0xc3, 0xbd, 0x89, 0xfc, 0x57, - 0xbd, 0x3c, 0xa3, 0x98, 0x7e, 0x7f, 0x36, 0x38, - 0x92, 0x39, 0x1f, 0x0f, 0x81, 0x1a, 0x06, 0x51, - 0x1f, 0x8d, 0x6a, 0xff, 0x47, 0x16, 0x06, 0x9c}}, - {{0x33, 0x95, 0xa2, 0x6f, 0x27, 0x5f, 0x9c, 0x9c, - 0x64, 0x45, 0xcb, 0xd1, 0x3c, 0xee, 0x5e, 0x5f, - 0x48, 0xa6, 0xaf, 0xe3, 0x79, 0xcf, 0xb1, 0xe2, - 0xbf, 0x55, 0x0e, 0xa2, 0x3b, 0x62, 0xf0, 0xe4}, - {0x14, 0xe8, 0x06, 0xe3, 0xbe, 0x7e, 0x67, 0x01, - 0xc5, 0x21, 0x67, 0xd8, 0x54, 0xb5, 0x7f, 0xa4, - 0xf9, 0x75, 0x70, 0x1c, 0xfd, 0x79, 0xdb, 0x86, - 0xad, 0x37, 0x85, 0x83, 0x56, 0x4e, 0xf0, 0xbf}}, - {{0xbc, 0xa6, 0xe0, 0x56, 0x4e, 0xef, 0xfa, 0xf5, - 0x1d, 0x5d, 0x3f, 0x2a, 0x5b, 0x19, 0xab, 0x51, - 0xc5, 0x8b, 0xdd, 0x98, 0x28, 0x35, 0x2f, 0xc3, - 0x81, 0x4f, 0x5c, 0xe5, 0x70, 0xb9, 0xeb, 0x62}, - {0xc4, 0x6d, 0x26, 0xb0, 0x17, 0x6b, 0xfe, 0x6c, - 0x12, 0xf8, 0xe7, 0xc1, 0xf5, 0x2f, 0xfa, 0x91, - 0x13, 0x27, 0xbd, 0x73, 0xcc, 0x33, 0x31, 0x1c, - 0x39, 0xe3, 0x27, 0x6a, 0x95, 0xcf, 0xc5, 0xfb}}, - {{0x30, 0xb2, 0x99, 0x84, 0xf0, 0x18, 0x2a, 0x6e, - 0x1e, 0x27, 0xed, 0xa2, 0x29, 0x99, 0x41, 0x56, - 0xe8, 0xd4, 0x0d, 0xef, 0x99, 0x9c, 0xf3, 0x58, - 0x29, 0x55, 0x1a, 0xc0, 0x68, 0xd6, 0x74, 0xa4}, - {0x07, 0x9c, 0xe7, 0xec, 0xf5, 0x36, 0x73, 0x41, - 0xa3, 0x1c, 0xe5, 0x93, 0x97, 0x6a, 0xfd, 0xf7, - 0x53, 0x18, 0xab, 0xaf, 0xeb, 0x85, 0xbd, 0x92, - 0x90, 0xab, 0x3c, 0xbf, 0x30, 0x82, 0xad, 0xf6}}, - {{0xc6, 0x87, 0x8a, 0x2a, 0xea, 0xc0, 0xa9, 0xec, - 0x6d, 0xd3, 0xdc, 0x32, 0x23, 0xce, 0x62, 0x19, - 0xa4, 0x7e, 0xa8, 0xdd, 0x1c, 0x33, 0xae, 0xd3, - 0x4f, 0x62, 0x9f, 0x52, 0xe7, 0x65, 0x46, 0xf4}, - {0x97, 0x51, 0x27, 0x67, 0x2d, 0xa2, 0x82, 0x87, - 0x98, 0xd3, 0xb6, 0x14, 0x7f, 0x51, 0xd3, 0x9a, - 0x0b, 0xd0, 0x76, 0x81, 0xb2, 0x4f, 0x58, 0x92, - 0xa4, 0x86, 0xa1, 0xa7, 0x09, 0x1d, 0xef, 0x9b}}, - {{0xb3, 0x0f, 0x2b, 0x69, 0x0d, 0x06, 0x90, 0x64, - 0xbd, 0x43, 0x4c, 0x10, 0xe8, 0x98, 0x1c, 0xa3, - 0xe1, 0x68, 0xe9, 0x79, 0x6c, 0x29, 0x51, 0x3f, - 0x41, 0xdc, 0xdf, 0x1f, 0xf3, 0x60, 0xbe, 0x33}, - {0xa1, 0x5f, 0xf7, 0x1d, 0xb4, 0x3e, 0x9b, 0x3c, - 0xe7, 0xbd, 0xb6, 0x06, 0xd5, 0x60, 0x06, 0x6d, - 0x50, 0xd2, 0xf4, 0x1a, 0x31, 0x08, 0xf2, 0xea, - 0x8e, 0xef, 0x5f, 0x7d, 0xb6, 0xd0, 0xc0, 0x27}}, - {{0x62, 0x9a, 0xd9, 0xbb, 0x38, 0x36, 0xce, 0xf7, - 0x5d, 0x2f, 0x13, 0xec, 0xc8, 0x2d, 0x02, 0x8a, - 0x2e, 0x72, 0xf0, 0xe5, 0x15, 0x9d, 0x72, 0xae, - 0xfc, 0xb3, 0x4f, 0x02, 0xea, 0xe1, 0x09, 0xfe}, - {0x00, 0x00, 0x00, 0x00, 0xfa, 0x0a, 0x3d, 0xbc, - 0xad, 0x16, 0x0c, 0xb6, 0xe7, 0x7c, 0x8b, 0x39, - 0x9a, 0x43, 0xbb, 0xe3, 0xc2, 0x55, 0x15, 0x14, - 0x75, 0xac, 0x90, 0x9b, 0x7f, 0x9a, 0x92, 0x00}}, - {{0x8b, 0xac, 0x70, 0x86, 0x29, 0x8f, 0x00, 0x23, - 0x7b, 0x45, 0x30, 0xaa, 0xb8, 0x4c, 0xc7, 0x8d, - 0x4e, 0x47, 0x85, 0xc6, 0x19, 0xe3, 0x96, 0xc2, - 0x9a, 0xa0, 0x12, 0xed, 0x6f, 0xd7, 0x76, 0x16}, - {0x45, 0xaf, 0x7e, 0x33, 0xc7, 0x7f, 0x10, 0x6c, - 0x7c, 0x9f, 0x29, 0xc1, 0xa8, 0x7e, 0x15, 0x84, - 0xe7, 0x7d, 0xc0, 0x6d, 0xab, 0x71, 0x5d, 0xd0, - 0x6b, 0x9f, 0x97, 0xab, 0xcb, 0x51, 0x0c, 0x9f}}, - {{0x9e, 0xc3, 0x92, 0xb4, 0x04, 0x9f, 0xc8, 0xbb, - 0xdd, 0x9e, 0xc6, 0x05, 0xfd, 0x65, 0xec, 0x94, - 0x7f, 0x2c, 0x16, 0xc4, 0x40, 0xac, 0x63, 0x7b, - 0x7d, 0xb8, 0x0c, 0xe4, 0x5b, 0xe3, 0xa7, 0x0e}, - {0x43, 0xf4, 0x44, 0xe8, 0xcc, 0xc8, 0xd4, 0x54, - 0x33, 0x37, 0x50, 0xf2, 0x87, 0x42, 0x2e, 0x00, - 0x49, 0x60, 0x62, 0x02, 0xfd, 0x1a, 0x7c, 0xdb, - 0x29, 0x6c, 0x6d, 0x54, 0x53, 0x08, 0xd1, 0xc8}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}, - {{0x27, 0x59, 0xc7, 0x35, 0x60, 0x71, 0xa6, 0xf1, - 0x79, 0xa5, 0xfd, 0x79, 0x16, 0xf3, 0x41, 0xf0, - 0x57, 0xb4, 0x02, 0x97, 0x32, 0xe7, 0xde, 0x59, - 0xe2, 0x2d, 0x9b, 0x11, 0xea, 0x2c, 0x35, 0x92}, - {0x27, 0x59, 0xc7, 0x35, 0x60, 0x71, 0xa6, 0xf1, - 0x79, 0xa5, 0xfd, 0x79, 0x16, 0xf3, 0x41, 0xf0, - 0x57, 0xb4, 0x02, 0x97, 0x32, 0xe7, 0xde, 0x59, - 0xe2, 0x2d, 0x9b, 0x11, 0xea, 0x2c, 0x35, 0x92}}, - {{0x28, 0x56, 0xac, 0x0e, 0x4f, 0x98, 0x09, 0xf0, - 0x49, 0xfa, 0x7f, 0x84, 0xac, 0x7e, 0x50, 0x5b, - 0x17, 0x43, 0x14, 0x89, 0x9c, 0x53, 0xa8, 0x94, - 0x30, 0xf2, 0x11, 0x4d, 0x92, 0x14, 0x27, 0xe8}, - {0x39, 0x7a, 0x84, 0x56, 0x79, 0x9d, 0xec, 0x26, - 0x2c, 0x53, 0xc1, 0x94, 0xc9, 0x8d, 0x9e, 0x9d, - 0x32, 0x1f, 0xdd, 0x84, 0x04, 0xe8, 0xe2, 0x0a, - 0x6b, 0xbe, 0xbb, 0x42, 0x40, 0x67, 0x30, 0x6c}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x45, 0x51, 0x23, 0x19, 0x50, 0xb7, 0x5f, 0xc4, - 0x40, 0x2d, 0xa1, 0x73, 0x2f, 0xc9, 0xbe, 0xbd}, - {0x27, 0x59, 0xc7, 0x35, 0x60, 0x71, 0xa6, 0xf1, - 0x79, 0xa5, 0xfd, 0x79, 0x16, 0xf3, 0x41, 0xf0, - 0x57, 0xb4, 0x02, 0x97, 0x32, 0xe7, 0xde, 0x59, - 0xe2, 0x2d, 0x9b, 0x11, 0xea, 0x2c, 0x35, 0x92}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}, - {{0x1c, 0xc4, 0xf7, 0xda, 0x0f, 0x65, 0xca, 0x39, - 0x70, 0x52, 0x92, 0x8e, 0xc3, 0xc8, 0x15, 0xea, - 0x7f, 0x10, 0x9e, 0x77, 0x4b, 0x6e, 0x2d, 0xdf, - 0xe8, 0x30, 0x9d, 0xda, 0xe8, 0x9a, 0x65, 0xae}, - {0x02, 0xb0, 0x16, 0xb1, 0x1d, 0xc8, 0x57, 0x7b, - 0xa2, 0x3a, 0xa2, 0xa3, 0x38, 0x5c, 0x8f, 0xeb, - 0x66, 0x37, 0x91, 0xa8, 0x5f, 0xef, 0x04, 0xf6, - 0x59, 0x75, 0xe1, 0xee, 0x92, 0xf6, 0x0e, 0x30}}, - {{0x8d, 0x76, 0x14, 0xa4, 0x14, 0x06, 0x9f, 0x9a, - 0xdf, 0x4a, 0x85, 0xa7, 0x6b, 0xbf, 0x29, 0x6f, - 0xbc, 0x34, 0x87, 0x5d, 0xeb, 0xbb, 0x2e, 0xa9, - 0xc9, 0x1f, 0x58, 0xd6, 0x9a, 0x82, 0xa0, 0x56}, - {0xd4, 0xb9, 0xdb, 0x88, 0x1d, 0x04, 0xe9, 0x93, - 0x8d, 0x3f, 0x20, 0xd5, 0x86, 0xa8, 0x83, 0x07, - 0xdb, 0x09, 0xd8, 0x22, 0x1f, 0x7f, 0xf1, 0x71, - 0xc8, 0xe7, 0x5d, 0x47, 0xaf, 0x8b, 0x72, 0xe9}}, - {{0x83, 0xb9, 0x39, 0xb2, 0xa4, 0xdf, 0x46, 0x87, - 0xc2, 0xb8, 0xf1, 0xe6, 0x4c, 0xd1, 0xe2, 0xa9, - 0xe4, 0x70, 0x30, 0x34, 0xbc, 0x52, 0x7c, 0x55, - 0xa6, 0xec, 0x80, 0xa4, 0xe5, 0xd2, 0xdc, 0x73}, - {0x08, 0xf1, 0x03, 0xcf, 0x16, 0x73, 0xe8, 0x7d, - 0xb6, 0x7e, 0x9b, 0xc0, 0xb4, 0xc2, 0xa5, 0x86, - 0x02, 0x77, 0xd5, 0x27, 0x86, 0xa5, 0x15, 0xfb, - 0xae, 0x9b, 0x8c, 0xa9, 0xf9, 0xf8, 0xa8, 0x4a}}, - {{0x8b, 0x00, 0x49, 0xdb, 0xfa, 0xf0, 0x1b, 0xa2, - 0xed, 0x8a, 0x9a, 0x7a, 0x36, 0x78, 0x4a, 0xc7, - 0xf7, 0xad, 0x39, 0xd0, 0x6c, 0x65, 0x7a, 0x41, - 0xce, 0xd6, 0xd6, 0x4c, 0x20, 0x21, 0x6b, 0xc7}, - {0xc6, 0xca, 0x78, 0x1d, 0x32, 0x6c, 0x6c, 0x06, - 0x91, 0xf2, 0x1a, 0xe8, 0x43, 0x16, 0xea, 0x04, - 0x3c, 0x1f, 0x07, 0x85, 0xf7, 0x09, 0x22, 0x08, - 0xba, 0x13, 0xfd, 0x78, 0x1e, 0x3f, 0x6f, 0x62}}, - {{0x25, 0x9b, 0x7c, 0xb0, 0xac, 0x72, 0x6f, 0xb2, - 0xe3, 0x53, 0x84, 0x7a, 0x1a, 0x9a, 0x98, 0x9b, - 0x44, 0xd3, 0x59, 0xd0, 0x8e, 0x57, 0x41, 0x40, - 0x78, 0xa7, 0x30, 0x2f, 0x4c, 0x9c, 0xb9, 0x68}, - {0xb7, 0x75, 0x03, 0x63, 0x61, 0xc2, 0x48, 0x6e, - 0x12, 0x3d, 0xbf, 0x4b, 0x27, 0xdf, 0xb1, 0x7a, - 0xff, 0x4e, 0x31, 0x07, 0x83, 0xf4, 0x62, 0x5b, - 0x19, 0xa5, 0xac, 0xa0, 0x32, 0x58, 0x0d, 0xa7}}, - {{0x43, 0x4f, 0x10, 0xa4, 0xca, 0xdb, 0x38, 0x67, - 0xfa, 0xae, 0x96, 0xb5, 0x6d, 0x97, 0xff, 0x1f, - 0xb6, 0x83, 0x43, 0xd3, 0xa0, 0x2d, 0x70, 0x7a, - 0x64, 0x05, 0x4c, 0xa7, 0xc1, 0xa5, 0x21, 0x51}, - {0xe4, 0xf1, 0x23, 0x84, 0xe1, 0xb5, 0x9d, 0xf2, - 0xb8, 0x73, 0x8b, 0x45, 0x2b, 0x35, 0x46, 0x38, - 0x10, 0x2b, 0x50, 0xf8, 0x8b, 0x35, 0xcd, 0x34, - 0xc8, 0x0e, 0xf6, 0xdb, 0x09, 0x35, 0xf0, 0xda}}, - {{0xdb, 0x21, 0x5c, 0x8d, 0x83, 0x1d, 0xb3, 0x34, - 0xc7, 0x0e, 0x43, 0xa1, 0x58, 0x79, 0x67, 0x13, - 0x1e, 0x86, 0x5d, 0x89, 0x63, 0xe6, 0x0a, 0x46, - 0x5c, 0x02, 0x97, 0x1b, 0x62, 0x43, 0x86, 0xf5}, - {0xdb, 0x21, 0x5c, 0x8d, 0x83, 0x1d, 0xb3, 0x34, - 0xc7, 0x0e, 0x43, 0xa1, 0x58, 0x79, 0x67, 0x13, - 0x1e, 0x86, 0x5d, 0x89, 0x63, 0xe6, 0x0a, 0x46, - 0x5c, 0x02, 0x97, 0x1b, 0x62, 0x43, 0x86, 0xf5}} - }; - secp256k1_scalar_set_int(&one, 1); - for (i = 0; i < 33; i++) { - secp256k1_scalar_set_b32(&x, chal[i][0], &overflow); - CHECK(!overflow); - secp256k1_scalar_set_b32(&y, chal[i][1], &overflow); - CHECK(!overflow); - secp256k1_scalar_set_b32(&r1, res[i][0], &overflow); - CHECK(!overflow); - secp256k1_scalar_set_b32(&r2, res[i][1], &overflow); - CHECK(!overflow); - secp256k1_scalar_mul(&z, &x, &y); - CHECK(!secp256k1_scalar_check_overflow(&z)); - CHECK(secp256k1_scalar_eq(&r1, &z)); - if (!secp256k1_scalar_is_zero(&y)) { - secp256k1_scalar_inverse(&zz, &y); - CHECK(!secp256k1_scalar_check_overflow(&zz)); -#if defined(USE_SCALAR_INV_NUM) - secp256k1_scalar_inverse_var(&zzv, &y); - CHECK(secp256k1_scalar_eq(&zzv, &zz)); -#endif - secp256k1_scalar_mul(&z, &z, &zz); - CHECK(!secp256k1_scalar_check_overflow(&z)); - CHECK(secp256k1_scalar_eq(&x, &z)); - secp256k1_scalar_mul(&zz, &zz, &y); - CHECK(!secp256k1_scalar_check_overflow(&zz)); - CHECK(secp256k1_scalar_eq(&one, &zz)); - } - secp256k1_scalar_mul(&z, &x, &x); - CHECK(!secp256k1_scalar_check_overflow(&z)); - secp256k1_scalar_sqr(&zz, &x); - CHECK(!secp256k1_scalar_check_overflow(&zz)); - CHECK(secp256k1_scalar_eq(&zz, &z)); - CHECK(secp256k1_scalar_eq(&r2, &zz)); - } - } -} - -/***** FIELD TESTS *****/ - -void random_fe(secp256k1_fe *x) { - unsigned char bin[32]; - do { - secp256k1_rand256(bin); - if (secp256k1_fe_set_b32(x, bin)) { - return; - } - } while(1); -} - -void random_fe_test(secp256k1_fe *x) { - unsigned char bin[32]; - do { - secp256k1_rand256_test(bin); - if (secp256k1_fe_set_b32(x, bin)) { - return; - } - } while(1); -} - -void random_fe_non_zero(secp256k1_fe *nz) { - int tries = 10; - while (--tries >= 0) { - random_fe(nz); - secp256k1_fe_normalize(nz); - if (!secp256k1_fe_is_zero(nz)) { - break; - } - } - /* Infinitesimal probability of spurious failure here */ - CHECK(tries >= 0); -} - -void random_fe_non_square(secp256k1_fe *ns) { - secp256k1_fe r; - random_fe_non_zero(ns); - if (secp256k1_fe_sqrt(&r, ns)) { - secp256k1_fe_negate(ns, ns, 1); - } -} - -int check_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe an = *a; - secp256k1_fe bn = *b; - secp256k1_fe_normalize_weak(&an); - secp256k1_fe_normalize_var(&bn); - return secp256k1_fe_equal_var(&an, &bn); -} - -int check_fe_inverse(const secp256k1_fe *a, const secp256k1_fe *ai) { - secp256k1_fe x; - secp256k1_fe one = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_fe_mul(&x, a, ai); - return check_fe_equal(&x, &one); -} - -void run_field_convert(void) { - static const unsigned char b32[32] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, - 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40 - }; - static const secp256k1_fe_storage fes = SECP256K1_FE_STORAGE_CONST( - 0x00010203UL, 0x04050607UL, 0x11121314UL, 0x15161718UL, - 0x22232425UL, 0x26272829UL, 0x33343536UL, 0x37383940UL - ); - static const secp256k1_fe fe = SECP256K1_FE_CONST( - 0x00010203UL, 0x04050607UL, 0x11121314UL, 0x15161718UL, - 0x22232425UL, 0x26272829UL, 0x33343536UL, 0x37383940UL - ); - secp256k1_fe fe2; - unsigned char b322[32]; - secp256k1_fe_storage fes2; - /* Check conversions to fe. */ - CHECK(secp256k1_fe_set_b32(&fe2, b32)); - CHECK(secp256k1_fe_equal_var(&fe, &fe2)); - secp256k1_fe_from_storage(&fe2, &fes); - CHECK(secp256k1_fe_equal_var(&fe, &fe2)); - /* Check conversion from fe. */ - secp256k1_fe_get_b32(b322, &fe); - CHECK(memcmp(b322, b32, 32) == 0); - secp256k1_fe_to_storage(&fes2, &fe); - CHECK(memcmp(&fes2, &fes, sizeof(fes)) == 0); -} - -int fe_memcmp(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe t = *b; -#ifdef VERIFY - t.magnitude = a->magnitude; - t.normalized = a->normalized; -#endif - return memcmp(a, &t, sizeof(secp256k1_fe)); -} - -void run_field_misc(void) { - secp256k1_fe x; - secp256k1_fe y; - secp256k1_fe z; - secp256k1_fe q; - secp256k1_fe fe5 = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 5); - int i, j; - for (i = 0; i < 5*count; i++) { - secp256k1_fe_storage xs, ys, zs; - random_fe(&x); - random_fe_non_zero(&y); - /* Test the fe equality and comparison operations. */ - CHECK(secp256k1_fe_cmp_var(&x, &x) == 0); - CHECK(secp256k1_fe_equal_var(&x, &x)); - z = x; - secp256k1_fe_add(&z,&y); - /* Test fe conditional move; z is not normalized here. */ - q = x; - secp256k1_fe_cmov(&x, &z, 0); - VERIFY_CHECK(!x.normalized && x.magnitude == z.magnitude); - secp256k1_fe_cmov(&x, &x, 1); - CHECK(fe_memcmp(&x, &z) != 0); - CHECK(fe_memcmp(&x, &q) == 0); - secp256k1_fe_cmov(&q, &z, 1); - VERIFY_CHECK(!q.normalized && q.magnitude == z.magnitude); - CHECK(fe_memcmp(&q, &z) == 0); - secp256k1_fe_normalize_var(&x); - secp256k1_fe_normalize_var(&z); - CHECK(!secp256k1_fe_equal_var(&x, &z)); - secp256k1_fe_normalize_var(&q); - secp256k1_fe_cmov(&q, &z, (i&1)); - VERIFY_CHECK(q.normalized && q.magnitude == 1); - for (j = 0; j < 6; j++) { - secp256k1_fe_negate(&z, &z, j+1); - secp256k1_fe_normalize_var(&q); - secp256k1_fe_cmov(&q, &z, (j&1)); - VERIFY_CHECK(!q.normalized && q.magnitude == (j+2)); - } - secp256k1_fe_normalize_var(&z); - /* Test storage conversion and conditional moves. */ - secp256k1_fe_to_storage(&xs, &x); - secp256k1_fe_to_storage(&ys, &y); - secp256k1_fe_to_storage(&zs, &z); - secp256k1_fe_storage_cmov(&zs, &xs, 0); - secp256k1_fe_storage_cmov(&zs, &zs, 1); - CHECK(memcmp(&xs, &zs, sizeof(xs)) != 0); - secp256k1_fe_storage_cmov(&ys, &xs, 1); - CHECK(memcmp(&xs, &ys, sizeof(xs)) == 0); - secp256k1_fe_from_storage(&x, &xs); - secp256k1_fe_from_storage(&y, &ys); - secp256k1_fe_from_storage(&z, &zs); - /* Test that mul_int, mul, and add agree. */ - secp256k1_fe_add(&y, &x); - secp256k1_fe_add(&y, &x); - z = x; - secp256k1_fe_mul_int(&z, 3); - CHECK(check_fe_equal(&y, &z)); - secp256k1_fe_add(&y, &x); - secp256k1_fe_add(&z, &x); - CHECK(check_fe_equal(&z, &y)); - z = x; - secp256k1_fe_mul_int(&z, 5); - secp256k1_fe_mul(&q, &x, &fe5); - CHECK(check_fe_equal(&z, &q)); - secp256k1_fe_negate(&x, &x, 1); - secp256k1_fe_add(&z, &x); - secp256k1_fe_add(&q, &x); - CHECK(check_fe_equal(&y, &z)); - CHECK(check_fe_equal(&q, &y)); - } -} - -void run_field_inv(void) { - secp256k1_fe x, xi, xii; - int i; - for (i = 0; i < 10*count; i++) { - random_fe_non_zero(&x); - secp256k1_fe_inv(&xi, &x); - CHECK(check_fe_inverse(&x, &xi)); - secp256k1_fe_inv(&xii, &xi); - CHECK(check_fe_equal(&x, &xii)); - } -} - -void run_field_inv_var(void) { - secp256k1_fe x, xi, xii; - int i; - for (i = 0; i < 10*count; i++) { - random_fe_non_zero(&x); - secp256k1_fe_inv_var(&xi, &x); - CHECK(check_fe_inverse(&x, &xi)); - secp256k1_fe_inv_var(&xii, &xi); - CHECK(check_fe_equal(&x, &xii)); - } -} - -void run_field_inv_all_var(void) { - secp256k1_fe x[16], xi[16], xii[16]; - int i; - /* Check it's safe to call for 0 elements */ - secp256k1_fe_inv_all_var(xi, x, 0); - for (i = 0; i < count; i++) { - size_t j; - size_t len = secp256k1_rand_int(15) + 1; - for (j = 0; j < len; j++) { - random_fe_non_zero(&x[j]); - } - secp256k1_fe_inv_all_var(xi, x, len); - for (j = 0; j < len; j++) { - CHECK(check_fe_inverse(&x[j], &xi[j])); - } - secp256k1_fe_inv_all_var(xii, xi, len); - for (j = 0; j < len; j++) { - CHECK(check_fe_equal(&x[j], &xii[j])); - } - } -} - -void run_sqr(void) { - secp256k1_fe x, s; - - { - int i; - secp256k1_fe_set_int(&x, 1); - secp256k1_fe_negate(&x, &x, 1); - - for (i = 1; i <= 512; ++i) { - secp256k1_fe_mul_int(&x, 2); - secp256k1_fe_normalize(&x); - secp256k1_fe_sqr(&s, &x); - } - } -} - -void test_sqrt(const secp256k1_fe *a, const secp256k1_fe *k) { - secp256k1_fe r1, r2; - int v = secp256k1_fe_sqrt(&r1, a); - CHECK((v == 0) == (k == NULL)); - - if (k != NULL) { - /* Check that the returned root is +/- the given known answer */ - secp256k1_fe_negate(&r2, &r1, 1); - secp256k1_fe_add(&r1, k); secp256k1_fe_add(&r2, k); - secp256k1_fe_normalize(&r1); secp256k1_fe_normalize(&r2); - CHECK(secp256k1_fe_is_zero(&r1) || secp256k1_fe_is_zero(&r2)); - } -} - -void run_sqrt(void) { - secp256k1_fe ns, x, s, t; - int i; - - /* Check sqrt(0) is 0 */ - secp256k1_fe_set_int(&x, 0); - secp256k1_fe_sqr(&s, &x); - test_sqrt(&s, &x); - - /* Check sqrt of small squares (and their negatives) */ - for (i = 1; i <= 100; i++) { - secp256k1_fe_set_int(&x, i); - secp256k1_fe_sqr(&s, &x); - test_sqrt(&s, &x); - secp256k1_fe_negate(&t, &s, 1); - test_sqrt(&t, NULL); - } - - /* Consistency checks for large random values */ - for (i = 0; i < 10; i++) { - int j; - random_fe_non_square(&ns); - for (j = 0; j < count; j++) { - random_fe(&x); - secp256k1_fe_sqr(&s, &x); - test_sqrt(&s, &x); - secp256k1_fe_negate(&t, &s, 1); - test_sqrt(&t, NULL); - secp256k1_fe_mul(&t, &s, &ns); - test_sqrt(&t, NULL); - } - } -} - -/***** GROUP TESTS *****/ - -void ge_equals_ge(const secp256k1_ge *a, const secp256k1_ge *b) { - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - CHECK(secp256k1_fe_equal_var(&a->x, &b->x)); - CHECK(secp256k1_fe_equal_var(&a->y, &b->y)); -} - -/* This compares jacobian points including their Z, not just their geometric meaning. */ -int gej_xyz_equals_gej(const secp256k1_gej *a, const secp256k1_gej *b) { - secp256k1_gej a2; - secp256k1_gej b2; - int ret = 1; - ret &= a->infinity == b->infinity; - if (ret && !a->infinity) { - a2 = *a; - b2 = *b; - secp256k1_fe_normalize(&a2.x); - secp256k1_fe_normalize(&a2.y); - secp256k1_fe_normalize(&a2.z); - secp256k1_fe_normalize(&b2.x); - secp256k1_fe_normalize(&b2.y); - secp256k1_fe_normalize(&b2.z); - ret &= secp256k1_fe_cmp_var(&a2.x, &b2.x) == 0; - ret &= secp256k1_fe_cmp_var(&a2.y, &b2.y) == 0; - ret &= secp256k1_fe_cmp_var(&a2.z, &b2.z) == 0; - } - return ret; -} - -void ge_equals_gej(const secp256k1_ge *a, const secp256k1_gej *b) { - secp256k1_fe z2s; - secp256k1_fe u1, u2, s1, s2; - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - /* Check a.x * b.z^2 == b.x && a.y * b.z^3 == b.y, to avoid inverses. */ - secp256k1_fe_sqr(&z2s, &b->z); - secp256k1_fe_mul(&u1, &a->x, &z2s); - u2 = b->x; secp256k1_fe_normalize_weak(&u2); - secp256k1_fe_mul(&s1, &a->y, &z2s); secp256k1_fe_mul(&s1, &s1, &b->z); - s2 = b->y; secp256k1_fe_normalize_weak(&s2); - CHECK(secp256k1_fe_equal_var(&u1, &u2)); - CHECK(secp256k1_fe_equal_var(&s1, &s2)); -} - -void test_ge(void) { - int i, i1; -#ifdef USE_ENDOMORPHISM - int runs = 6; -#else - int runs = 4; -#endif - /* Points: (infinity, p1, p1, -p1, -p1, p2, p2, -p2, -p2, p3, p3, -p3, -p3, p4, p4, -p4, -p4). - * The second in each pair of identical points uses a random Z coordinate in the Jacobian form. - * All magnitudes are randomized. - * All 17*17 combinations of points are added to each other, using all applicable methods. - * - * When the endomorphism code is compiled in, p5 = lambda*p1 and p6 = lambda^2*p1 are added as well. - */ - secp256k1_ge *ge = (secp256k1_ge *)malloc(sizeof(secp256k1_ge) * (1 + 4 * runs)); - secp256k1_gej *gej = (secp256k1_gej *)malloc(sizeof(secp256k1_gej) * (1 + 4 * runs)); - secp256k1_fe *zinv = (secp256k1_fe *)malloc(sizeof(secp256k1_fe) * (1 + 4 * runs)); - secp256k1_fe zf; - secp256k1_fe zfi2, zfi3; - - secp256k1_gej_set_infinity(&gej[0]); - secp256k1_ge_clear(&ge[0]); - secp256k1_ge_set_gej_var(&ge[0], &gej[0]); - for (i = 0; i < runs; i++) { - int j; - secp256k1_ge g; - random_group_element_test(&g); -#ifdef USE_ENDOMORPHISM - if (i >= runs - 2) { - secp256k1_ge_mul_lambda(&g, &ge[1]); - } - if (i >= runs - 1) { - secp256k1_ge_mul_lambda(&g, &g); - } -#endif - ge[1 + 4 * i] = g; - ge[2 + 4 * i] = g; - secp256k1_ge_neg(&ge[3 + 4 * i], &g); - secp256k1_ge_neg(&ge[4 + 4 * i], &g); - secp256k1_gej_set_ge(&gej[1 + 4 * i], &ge[1 + 4 * i]); - random_group_element_jacobian_test(&gej[2 + 4 * i], &ge[2 + 4 * i]); - secp256k1_gej_set_ge(&gej[3 + 4 * i], &ge[3 + 4 * i]); - random_group_element_jacobian_test(&gej[4 + 4 * i], &ge[4 + 4 * i]); - for (j = 0; j < 4; j++) { - random_field_element_magnitude(&ge[1 + j + 4 * i].x); - random_field_element_magnitude(&ge[1 + j + 4 * i].y); - random_field_element_magnitude(&gej[1 + j + 4 * i].x); - random_field_element_magnitude(&gej[1 + j + 4 * i].y); - random_field_element_magnitude(&gej[1 + j + 4 * i].z); - } - } - - /* Compute z inverses. */ - { - secp256k1_fe *zs = malloc(sizeof(secp256k1_fe) * (1 + 4 * runs)); - for (i = 0; i < 4 * runs + 1; i++) { - if (i == 0) { - /* The point at infinity does not have a meaningful z inverse. Any should do. */ - do { - random_field_element_test(&zs[i]); - } while(secp256k1_fe_is_zero(&zs[i])); - } else { - zs[i] = gej[i].z; - } - } - secp256k1_fe_inv_all_var(zinv, zs, 4 * runs + 1); - free(zs); - } - - /* Generate random zf, and zfi2 = 1/zf^2, zfi3 = 1/zf^3 */ - do { - random_field_element_test(&zf); - } while(secp256k1_fe_is_zero(&zf)); - random_field_element_magnitude(&zf); - secp256k1_fe_inv_var(&zfi3, &zf); - secp256k1_fe_sqr(&zfi2, &zfi3); - secp256k1_fe_mul(&zfi3, &zfi3, &zfi2); - - for (i1 = 0; i1 < 1 + 4 * runs; i1++) { - int i2; - for (i2 = 0; i2 < 1 + 4 * runs; i2++) { - /* Compute reference result using gej + gej (var). */ - secp256k1_gej refj, resj; - secp256k1_ge ref; - secp256k1_fe zr; - secp256k1_gej_add_var(&refj, &gej[i1], &gej[i2], secp256k1_gej_is_infinity(&gej[i1]) ? NULL : &zr); - /* Check Z ratio. */ - if (!secp256k1_gej_is_infinity(&gej[i1]) && !secp256k1_gej_is_infinity(&refj)) { - secp256k1_fe zrz; secp256k1_fe_mul(&zrz, &zr, &gej[i1].z); - CHECK(secp256k1_fe_equal_var(&zrz, &refj.z)); - } - secp256k1_ge_set_gej_var(&ref, &refj); - - /* Test gej + ge with Z ratio result (var). */ - secp256k1_gej_add_ge_var(&resj, &gej[i1], &ge[i2], secp256k1_gej_is_infinity(&gej[i1]) ? NULL : &zr); - ge_equals_gej(&ref, &resj); - if (!secp256k1_gej_is_infinity(&gej[i1]) && !secp256k1_gej_is_infinity(&resj)) { - secp256k1_fe zrz; secp256k1_fe_mul(&zrz, &zr, &gej[i1].z); - CHECK(secp256k1_fe_equal_var(&zrz, &resj.z)); - } - - /* Test gej + ge (var, with additional Z factor). */ - { - secp256k1_ge ge2_zfi = ge[i2]; /* the second term with x and y rescaled for z = 1/zf */ - secp256k1_fe_mul(&ge2_zfi.x, &ge2_zfi.x, &zfi2); - secp256k1_fe_mul(&ge2_zfi.y, &ge2_zfi.y, &zfi3); - random_field_element_magnitude(&ge2_zfi.x); - random_field_element_magnitude(&ge2_zfi.y); - secp256k1_gej_add_zinv_var(&resj, &gej[i1], &ge2_zfi, &zf); - ge_equals_gej(&ref, &resj); - } - - /* Test gej + ge (const). */ - if (i2 != 0) { - /* secp256k1_gej_add_ge does not support its second argument being infinity. */ - secp256k1_gej_add_ge(&resj, &gej[i1], &ge[i2]); - ge_equals_gej(&ref, &resj); - } - - /* Test doubling (var). */ - if ((i1 == 0 && i2 == 0) || ((i1 + 3)/4 == (i2 + 3)/4 && ((i1 + 3)%4)/2 == ((i2 + 3)%4)/2)) { - secp256k1_fe zr2; - /* Normal doubling with Z ratio result. */ - secp256k1_gej_double_var(&resj, &gej[i1], &zr2); - ge_equals_gej(&ref, &resj); - /* Check Z ratio. */ - secp256k1_fe_mul(&zr2, &zr2, &gej[i1].z); - CHECK(secp256k1_fe_equal_var(&zr2, &resj.z)); - /* Normal doubling. */ - secp256k1_gej_double_var(&resj, &gej[i2], NULL); - ge_equals_gej(&ref, &resj); - } - - /* Test adding opposites. */ - if ((i1 == 0 && i2 == 0) || ((i1 + 3)/4 == (i2 + 3)/4 && ((i1 + 3)%4)/2 != ((i2 + 3)%4)/2)) { - CHECK(secp256k1_ge_is_infinity(&ref)); - } - - /* Test adding infinity. */ - if (i1 == 0) { - CHECK(secp256k1_ge_is_infinity(&ge[i1])); - CHECK(secp256k1_gej_is_infinity(&gej[i1])); - ge_equals_gej(&ref, &gej[i2]); - } - if (i2 == 0) { - CHECK(secp256k1_ge_is_infinity(&ge[i2])); - CHECK(secp256k1_gej_is_infinity(&gej[i2])); - ge_equals_gej(&ref, &gej[i1]); - } - } - } - - /* Test adding all points together in random order equals infinity. */ - { - secp256k1_gej sum = SECP256K1_GEJ_CONST_INFINITY; - secp256k1_gej *gej_shuffled = (secp256k1_gej *)malloc((4 * runs + 1) * sizeof(secp256k1_gej)); - for (i = 0; i < 4 * runs + 1; i++) { - gej_shuffled[i] = gej[i]; - } - for (i = 0; i < 4 * runs + 1; i++) { - int swap = i + secp256k1_rand_int(4 * runs + 1 - i); - if (swap != i) { - secp256k1_gej t = gej_shuffled[i]; - gej_shuffled[i] = gej_shuffled[swap]; - gej_shuffled[swap] = t; - } - } - for (i = 0; i < 4 * runs + 1; i++) { - secp256k1_gej_add_var(&sum, &sum, &gej_shuffled[i], NULL); - } - CHECK(secp256k1_gej_is_infinity(&sum)); - free(gej_shuffled); - } - - /* Test batch gej -> ge conversion with and without known z ratios. */ - { - secp256k1_fe *zr = (secp256k1_fe *)malloc((4 * runs + 1) * sizeof(secp256k1_fe)); - secp256k1_ge *ge_set_table = (secp256k1_ge *)malloc((4 * runs + 1) * sizeof(secp256k1_ge)); - secp256k1_ge *ge_set_all = (secp256k1_ge *)malloc((4 * runs + 1) * sizeof(secp256k1_ge)); - for (i = 0; i < 4 * runs + 1; i++) { - /* Compute gej[i + 1].z / gez[i].z (with gej[n].z taken to be 1). */ - if (i < 4 * runs) { - secp256k1_fe_mul(&zr[i + 1], &zinv[i], &gej[i + 1].z); - } - } - secp256k1_ge_set_table_gej_var(ge_set_table, gej, zr, 4 * runs + 1); - secp256k1_ge_set_all_gej_var(ge_set_all, gej, 4 * runs + 1, &ctx->error_callback); - for (i = 0; i < 4 * runs + 1; i++) { - secp256k1_fe s; - random_fe_non_zero(&s); - secp256k1_gej_rescale(&gej[i], &s); - ge_equals_gej(&ge_set_table[i], &gej[i]); - ge_equals_gej(&ge_set_all[i], &gej[i]); - } - free(ge_set_table); - free(ge_set_all); - free(zr); - } - - free(ge); - free(gej); - free(zinv); -} - -void test_add_neg_y_diff_x(void) { - /* The point of this test is to check that we can add two points - * whose y-coordinates are negatives of each other but whose x - * coordinates differ. If the x-coordinates were the same, these - * points would be negatives of each other and their sum is - * infinity. This is cool because it "covers up" any degeneracy - * in the addition algorithm that would cause the xy coordinates - * of the sum to be wrong (since infinity has no xy coordinates). - * HOWEVER, if the x-coordinates are different, infinity is the - * wrong answer, and such degeneracies are exposed. This is the - * root of https://github.com/bitcoin-core/secp256k1/issues/257 - * which this test is a regression test for. - * - * These points were generated in sage as - * # secp256k1 params - * F = FiniteField (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F) - * C = EllipticCurve ([F (0), F (7)]) - * G = C.lift_x(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798) - * N = FiniteField(G.order()) - * - * # endomorphism values (lambda is 1^{1/3} in N, beta is 1^{1/3} in F) - * x = polygen(N) - * lam = (1 - x^3).roots()[1][0] - * - * # random "bad pair" - * P = C.random_element() - * Q = -int(lam) * P - * print " P: %x %x" % P.xy() - * print " Q: %x %x" % Q.xy() - * print "P + Q: %x %x" % (P + Q).xy() - */ - secp256k1_gej aj = SECP256K1_GEJ_CONST( - 0x8d24cd95, 0x0a355af1, 0x3c543505, 0x44238d30, - 0x0643d79f, 0x05a59614, 0x2f8ec030, 0xd58977cb, - 0x001e337a, 0x38093dcd, 0x6c0f386d, 0x0b1293a8, - 0x4d72c879, 0xd7681924, 0x44e6d2f3, 0x9190117d - ); - secp256k1_gej bj = SECP256K1_GEJ_CONST( - 0xc7b74206, 0x1f788cd9, 0xabd0937d, 0x164a0d86, - 0x95f6ff75, 0xf19a4ce9, 0xd013bd7b, 0xbf92d2a7, - 0xffe1cc85, 0xc7f6c232, 0x93f0c792, 0xf4ed6c57, - 0xb28d3786, 0x2897e6db, 0xbb192d0b, 0x6e6feab2 - ); - secp256k1_gej sumj = SECP256K1_GEJ_CONST( - 0x671a63c0, 0x3efdad4c, 0x389a7798, 0x24356027, - 0xb3d69010, 0x278625c3, 0x5c86d390, 0x184a8f7a, - 0x5f6409c2, 0x2ce01f2b, 0x511fd375, 0x25071d08, - 0xda651801, 0x70e95caf, 0x8f0d893c, 0xbed8fbbe - ); - secp256k1_ge b; - secp256k1_gej resj; - secp256k1_ge res; - secp256k1_ge_set_gej(&b, &bj); - - secp256k1_gej_add_var(&resj, &aj, &bj, NULL); - secp256k1_ge_set_gej(&res, &resj); - ge_equals_gej(&res, &sumj); - - secp256k1_gej_add_ge(&resj, &aj, &b); - secp256k1_ge_set_gej(&res, &resj); - ge_equals_gej(&res, &sumj); - - secp256k1_gej_add_ge_var(&resj, &aj, &b, NULL); - secp256k1_ge_set_gej(&res, &resj); - ge_equals_gej(&res, &sumj); -} - -void run_ge(void) { - int i; - for (i = 0; i < count * 32; i++) { - test_ge(); - } - test_add_neg_y_diff_x(); -} - -void test_ec_combine(void) { - secp256k1_scalar sum = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - secp256k1_pubkey data[6]; - const secp256k1_pubkey* d[6]; - secp256k1_pubkey sd; - secp256k1_pubkey sd2; - secp256k1_gej Qj; - secp256k1_ge Q; - int i; - for (i = 1; i <= 6; i++) { - secp256k1_scalar s; - random_scalar_order_test(&s); - secp256k1_scalar_add(&sum, &sum, &s); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &Qj, &s); - secp256k1_ge_set_gej(&Q, &Qj); - secp256k1_pubkey_save(&data[i - 1], &Q); - d[i - 1] = &data[i - 1]; - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &Qj, &sum); - secp256k1_ge_set_gej(&Q, &Qj); - secp256k1_pubkey_save(&sd, &Q); - CHECK(secp256k1_ec_pubkey_combine(ctx, &sd2, d, i) == 1); - CHECK(memcmp(&sd, &sd2, sizeof(sd)) == 0); - } -} - -void run_ec_combine(void) { - int i; - for (i = 0; i < count * 8; i++) { - test_ec_combine(); - } -} - -void test_group_decompress(const secp256k1_fe* x) { - /* The input itself, normalized. */ - secp256k1_fe fex = *x; - secp256k1_fe fez; - /* Results of set_xquad_var, set_xo_var(..., 0), set_xo_var(..., 1). */ - secp256k1_ge ge_quad, ge_even, ge_odd; - secp256k1_gej gej_quad; - /* Return values of the above calls. */ - int res_quad, res_even, res_odd; - - secp256k1_fe_normalize_var(&fex); - - res_quad = secp256k1_ge_set_xquad(&ge_quad, &fex); - res_even = secp256k1_ge_set_xo_var(&ge_even, &fex, 0); - res_odd = secp256k1_ge_set_xo_var(&ge_odd, &fex, 1); - - CHECK(res_quad == res_even); - CHECK(res_quad == res_odd); - - if (res_quad) { - secp256k1_fe_normalize_var(&ge_quad.x); - secp256k1_fe_normalize_var(&ge_odd.x); - secp256k1_fe_normalize_var(&ge_even.x); - secp256k1_fe_normalize_var(&ge_quad.y); - secp256k1_fe_normalize_var(&ge_odd.y); - secp256k1_fe_normalize_var(&ge_even.y); - - /* No infinity allowed. */ - CHECK(!ge_quad.infinity); - CHECK(!ge_even.infinity); - CHECK(!ge_odd.infinity); - - /* Check that the x coordinates check out. */ - CHECK(secp256k1_fe_equal_var(&ge_quad.x, x)); - CHECK(secp256k1_fe_equal_var(&ge_even.x, x)); - CHECK(secp256k1_fe_equal_var(&ge_odd.x, x)); - - /* Check that the Y coordinate result in ge_quad is a square. */ - CHECK(secp256k1_fe_is_quad_var(&ge_quad.y)); - - /* Check odd/even Y in ge_odd, ge_even. */ - CHECK(secp256k1_fe_is_odd(&ge_odd.y)); - CHECK(!secp256k1_fe_is_odd(&ge_even.y)); - - /* Check secp256k1_gej_has_quad_y_var. */ - secp256k1_gej_set_ge(&gej_quad, &ge_quad); - CHECK(secp256k1_gej_has_quad_y_var(&gej_quad)); - do { - random_fe_test(&fez); - } while (secp256k1_fe_is_zero(&fez)); - secp256k1_gej_rescale(&gej_quad, &fez); - CHECK(secp256k1_gej_has_quad_y_var(&gej_quad)); - secp256k1_gej_neg(&gej_quad, &gej_quad); - CHECK(!secp256k1_gej_has_quad_y_var(&gej_quad)); - do { - random_fe_test(&fez); - } while (secp256k1_fe_is_zero(&fez)); - secp256k1_gej_rescale(&gej_quad, &fez); - CHECK(!secp256k1_gej_has_quad_y_var(&gej_quad)); - secp256k1_gej_neg(&gej_quad, &gej_quad); - CHECK(secp256k1_gej_has_quad_y_var(&gej_quad)); - } -} - -void run_group_decompress(void) { - int i; - for (i = 0; i < count * 4; i++) { - secp256k1_fe fe; - random_fe_test(&fe); - test_group_decompress(&fe); - } -} - -/***** ECMULT TESTS *****/ - -void run_ecmult_chain(void) { - /* random starting point A (on the curve) */ - secp256k1_gej a = SECP256K1_GEJ_CONST( - 0x8b30bbe9, 0xae2a9906, 0x96b22f67, 0x0709dff3, - 0x727fd8bc, 0x04d3362c, 0x6c7bf458, 0xe2846004, - 0xa357ae91, 0x5c4a6528, 0x1309edf2, 0x0504740f, - 0x0eb33439, 0x90216b4f, 0x81063cb6, 0x5f2f7e0f - ); - /* two random initial factors xn and gn */ - secp256k1_scalar xn = SECP256K1_SCALAR_CONST( - 0x84cc5452, 0xf7fde1ed, 0xb4d38a8c, 0xe9b1b84c, - 0xcef31f14, 0x6e569be9, 0x705d357a, 0x42985407 - ); - secp256k1_scalar gn = SECP256K1_SCALAR_CONST( - 0xa1e58d22, 0x553dcd42, 0xb2398062, 0x5d4c57a9, - 0x6e9323d4, 0x2b3152e5, 0xca2c3990, 0xedc7c9de - ); - /* two small multipliers to be applied to xn and gn in every iteration: */ - static const secp256k1_scalar xf = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0x1337); - static const secp256k1_scalar gf = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0x7113); - /* accumulators with the resulting coefficients to A and G */ - secp256k1_scalar ae = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_scalar ge = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - /* actual points */ - secp256k1_gej x; - secp256k1_gej x2; - int i; - - /* the point being computed */ - x = a; - for (i = 0; i < 200*count; i++) { - /* in each iteration, compute X = xn*X + gn*G; */ - secp256k1_ecmult(&ctx->ecmult_ctx, &x, &x, &xn, &gn); - /* also compute ae and ge: the actual accumulated factors for A and G */ - /* if X was (ae*A+ge*G), xn*X + gn*G results in (xn*ae*A + (xn*ge+gn)*G) */ - secp256k1_scalar_mul(&ae, &ae, &xn); - secp256k1_scalar_mul(&ge, &ge, &xn); - secp256k1_scalar_add(&ge, &ge, &gn); - /* modify xn and gn */ - secp256k1_scalar_mul(&xn, &xn, &xf); - secp256k1_scalar_mul(&gn, &gn, &gf); - - /* verify */ - if (i == 19999) { - /* expected result after 19999 iterations */ - secp256k1_gej rp = SECP256K1_GEJ_CONST( - 0xD6E96687, 0xF9B10D09, 0x2A6F3543, 0x9D86CEBE, - 0xA4535D0D, 0x409F5358, 0x6440BD74, 0xB933E830, - 0xB95CBCA2, 0xC77DA786, 0x539BE8FD, 0x53354D2D, - 0x3B4F566A, 0xE6580454, 0x07ED6015, 0xEE1B2A88 - ); - - secp256k1_gej_neg(&rp, &rp); - secp256k1_gej_add_var(&rp, &rp, &x, NULL); - CHECK(secp256k1_gej_is_infinity(&rp)); - } - } - /* redo the computation, but directly with the resulting ae and ge coefficients: */ - secp256k1_ecmult(&ctx->ecmult_ctx, &x2, &a, &ae, &ge); - secp256k1_gej_neg(&x2, &x2); - secp256k1_gej_add_var(&x2, &x2, &x, NULL); - CHECK(secp256k1_gej_is_infinity(&x2)); -} - -void test_point_times_order(const secp256k1_gej *point) { - /* X * (point + G) + (order-X) * (pointer + G) = 0 */ - secp256k1_scalar x; - secp256k1_scalar nx; - secp256k1_scalar zero = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - secp256k1_scalar one = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_gej res1, res2; - secp256k1_ge res3; - unsigned char pub[65]; - size_t psize = 65; - random_scalar_order_test(&x); - secp256k1_scalar_negate(&nx, &x); - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &x, &x); /* calc res1 = x * point + x * G; */ - secp256k1_ecmult(&ctx->ecmult_ctx, &res2, point, &nx, &nx); /* calc res2 = (order - x) * point + (order - x) * G; */ - secp256k1_gej_add_var(&res1, &res1, &res2, NULL); - CHECK(secp256k1_gej_is_infinity(&res1)); - CHECK(secp256k1_gej_is_valid_var(&res1) == 0); - secp256k1_ge_set_gej(&res3, &res1); - CHECK(secp256k1_ge_is_infinity(&res3)); - CHECK(secp256k1_ge_is_valid_var(&res3) == 0); - CHECK(secp256k1_eckey_pubkey_serialize(&res3, pub, &psize, 0) == 0); - psize = 65; - CHECK(secp256k1_eckey_pubkey_serialize(&res3, pub, &psize, 1) == 0); - /* check zero/one edge cases */ - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &zero, &zero); - secp256k1_ge_set_gej(&res3, &res1); - CHECK(secp256k1_ge_is_infinity(&res3)); - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &one, &zero); - secp256k1_ge_set_gej(&res3, &res1); - ge_equals_gej(&res3, point); - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &zero, &one); - secp256k1_ge_set_gej(&res3, &res1); - ge_equals_ge(&res3, &secp256k1_ge_const_g); -} - -void run_point_times_order(void) { - int i; - secp256k1_fe x = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 2); - static const secp256k1_fe xr = SECP256K1_FE_CONST( - 0x7603CB59, 0xB0EF6C63, 0xFE608479, 0x2A0C378C, - 0xDB3233A8, 0x0F8A9A09, 0xA877DEAD, 0x31B38C45 - ); - for (i = 0; i < 500; i++) { - secp256k1_ge p; - if (secp256k1_ge_set_xo_var(&p, &x, 1)) { - secp256k1_gej j; - CHECK(secp256k1_ge_is_valid_var(&p)); - secp256k1_gej_set_ge(&j, &p); - CHECK(secp256k1_gej_is_valid_var(&j)); - test_point_times_order(&j); - } - secp256k1_fe_sqr(&x, &x); - } - secp256k1_fe_normalize_var(&x); - CHECK(secp256k1_fe_equal_var(&x, &xr)); -} - -void ecmult_const_random_mult(void) { - /* random starting point A (on the curve) */ - secp256k1_ge a = SECP256K1_GE_CONST( - 0x6d986544, 0x57ff52b8, 0xcf1b8126, 0x5b802a5b, - 0xa97f9263, 0xb1e88044, 0x93351325, 0x91bc450a, - 0x535c59f7, 0x325e5d2b, 0xc391fbe8, 0x3c12787c, - 0x337e4a98, 0xe82a9011, 0x0123ba37, 0xdd769c7d - ); - /* random initial factor xn */ - secp256k1_scalar xn = SECP256K1_SCALAR_CONST( - 0x649d4f77, 0xc4242df7, 0x7f2079c9, 0x14530327, - 0xa31b876a, 0xd2d8ce2a, 0x2236d5c6, 0xd7b2029b - ); - /* expected xn * A (from sage) */ - secp256k1_ge expected_b = SECP256K1_GE_CONST( - 0x23773684, 0x4d209dc7, 0x098a786f, 0x20d06fcd, - 0x070a38bf, 0xc11ac651, 0x03004319, 0x1e2a8786, - 0xed8c3b8e, 0xc06dd57b, 0xd06ea66e, 0x45492b0f, - 0xb84e4e1b, 0xfb77e21f, 0x96baae2a, 0x63dec956 - ); - secp256k1_gej b; - secp256k1_ecmult_const(&b, &a, &xn); - - CHECK(secp256k1_ge_is_valid_var(&a)); - ge_equals_gej(&expected_b, &b); -} - -void ecmult_const_commutativity(void) { - secp256k1_scalar a; - secp256k1_scalar b; - secp256k1_gej res1; - secp256k1_gej res2; - secp256k1_ge mid1; - secp256k1_ge mid2; - random_scalar_order_test(&a); - random_scalar_order_test(&b); - - secp256k1_ecmult_const(&res1, &secp256k1_ge_const_g, &a); - secp256k1_ecmult_const(&res2, &secp256k1_ge_const_g, &b); - secp256k1_ge_set_gej(&mid1, &res1); - secp256k1_ge_set_gej(&mid2, &res2); - secp256k1_ecmult_const(&res1, &mid1, &b); - secp256k1_ecmult_const(&res2, &mid2, &a); - secp256k1_ge_set_gej(&mid1, &res1); - secp256k1_ge_set_gej(&mid2, &res2); - ge_equals_ge(&mid1, &mid2); -} - -void ecmult_const_mult_zero_one(void) { - secp256k1_scalar zero = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - secp256k1_scalar one = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_scalar negone; - secp256k1_gej res1; - secp256k1_ge res2; - secp256k1_ge point; - secp256k1_scalar_negate(&negone, &one); - - random_group_element_test(&point); - secp256k1_ecmult_const(&res1, &point, &zero); - secp256k1_ge_set_gej(&res2, &res1); - CHECK(secp256k1_ge_is_infinity(&res2)); - secp256k1_ecmult_const(&res1, &point, &one); - secp256k1_ge_set_gej(&res2, &res1); - ge_equals_ge(&res2, &point); - secp256k1_ecmult_const(&res1, &point, &negone); - secp256k1_gej_neg(&res1, &res1); - secp256k1_ge_set_gej(&res2, &res1); - ge_equals_ge(&res2, &point); -} - -void ecmult_const_chain_multiply(void) { - /* Check known result (randomly generated test problem from sage) */ - const secp256k1_scalar scalar = SECP256K1_SCALAR_CONST( - 0x4968d524, 0x2abf9b7a, 0x466abbcf, 0x34b11b6d, - 0xcd83d307, 0x827bed62, 0x05fad0ce, 0x18fae63b - ); - const secp256k1_gej expected_point = SECP256K1_GEJ_CONST( - 0x5494c15d, 0x32099706, 0xc2395f94, 0x348745fd, - 0x757ce30e, 0x4e8c90fb, 0xa2bad184, 0xf883c69f, - 0x5d195d20, 0xe191bf7f, 0x1be3e55f, 0x56a80196, - 0x6071ad01, 0xf1462f66, 0xc997fa94, 0xdb858435 - ); - secp256k1_gej point; - secp256k1_ge res; - int i; - - secp256k1_gej_set_ge(&point, &secp256k1_ge_const_g); - for (i = 0; i < 100; ++i) { - secp256k1_ge tmp; - secp256k1_ge_set_gej(&tmp, &point); - secp256k1_ecmult_const(&point, &tmp, &scalar); - } - secp256k1_ge_set_gej(&res, &point); - ge_equals_gej(&res, &expected_point); -} - -void run_ecmult_const_tests(void) { - ecmult_const_mult_zero_one(); - ecmult_const_random_mult(); - ecmult_const_commutativity(); - ecmult_const_chain_multiply(); -} - -void test_wnaf(const secp256k1_scalar *number, int w) { - secp256k1_scalar x, two, t; - int wnaf[256]; - int zeroes = -1; - int i; - int bits; - secp256k1_scalar_set_int(&x, 0); - secp256k1_scalar_set_int(&two, 2); - bits = secp256k1_ecmult_wnaf(wnaf, 256, number, w); - CHECK(bits <= 256); - for (i = bits-1; i >= 0; i--) { - int v = wnaf[i]; - secp256k1_scalar_mul(&x, &x, &two); - if (v) { - CHECK(zeroes == -1 || zeroes >= w-1); /* check that distance between non-zero elements is at least w-1 */ - zeroes=0; - CHECK((v & 1) == 1); /* check non-zero elements are odd */ - CHECK(v <= (1 << (w-1)) - 1); /* check range below */ - CHECK(v >= -(1 << (w-1)) - 1); /* check range above */ - } else { - CHECK(zeroes != -1); /* check that no unnecessary zero padding exists */ - zeroes++; - } - if (v >= 0) { - secp256k1_scalar_set_int(&t, v); - } else { - secp256k1_scalar_set_int(&t, -v); - secp256k1_scalar_negate(&t, &t); - } - secp256k1_scalar_add(&x, &x, &t); - } - CHECK(secp256k1_scalar_eq(&x, number)); /* check that wnaf represents number */ -} - -void test_constant_wnaf_negate(const secp256k1_scalar *number) { - secp256k1_scalar neg1 = *number; - secp256k1_scalar neg2 = *number; - int sign1 = 1; - int sign2 = 1; - - if (!secp256k1_scalar_get_bits(&neg1, 0, 1)) { - secp256k1_scalar_negate(&neg1, &neg1); - sign1 = -1; - } - sign2 = secp256k1_scalar_cond_negate(&neg2, secp256k1_scalar_is_even(&neg2)); - CHECK(sign1 == sign2); - CHECK(secp256k1_scalar_eq(&neg1, &neg2)); -} - -void test_constant_wnaf(const secp256k1_scalar *number, int w) { - secp256k1_scalar x, shift; - int wnaf[256] = {0}; - int i; - int skew; - secp256k1_scalar num = *number; - - secp256k1_scalar_set_int(&x, 0); - secp256k1_scalar_set_int(&shift, 1 << w); - /* With USE_ENDOMORPHISM on we only consider 128-bit numbers */ -#ifdef USE_ENDOMORPHISM - for (i = 0; i < 16; ++i) { - secp256k1_scalar_shr_int(&num, 8); - } -#endif - skew = secp256k1_wnaf_const(wnaf, num, w); - - for (i = WNAF_SIZE(w); i >= 0; --i) { - secp256k1_scalar t; - int v = wnaf[i]; - CHECK(v != 0); /* check nonzero */ - CHECK(v & 1); /* check parity */ - CHECK(v > -(1 << w)); /* check range above */ - CHECK(v < (1 << w)); /* check range below */ - - secp256k1_scalar_mul(&x, &x, &shift); - if (v >= 0) { - secp256k1_scalar_set_int(&t, v); - } else { - secp256k1_scalar_set_int(&t, -v); - secp256k1_scalar_negate(&t, &t); - } - secp256k1_scalar_add(&x, &x, &t); - } - /* Skew num because when encoding numbers as odd we use an offset */ - secp256k1_scalar_cadd_bit(&num, skew == 2, 1); - CHECK(secp256k1_scalar_eq(&x, &num)); -} - -void run_wnaf(void) { - int i; - secp256k1_scalar n = {{0}}; - - /* Sanity check: 1 and 2 are the smallest odd and even numbers and should - * have easier-to-diagnose failure modes */ - n.d[0] = 1; - test_constant_wnaf(&n, 4); - n.d[0] = 2; - test_constant_wnaf(&n, 4); - /* Random tests */ - for (i = 0; i < count; i++) { - random_scalar_order(&n); - test_wnaf(&n, 4+(i%10)); - test_constant_wnaf_negate(&n); - test_constant_wnaf(&n, 4 + (i % 10)); - } - secp256k1_scalar_set_int(&n, 0); - CHECK(secp256k1_scalar_cond_negate(&n, 1) == -1); - CHECK(secp256k1_scalar_is_zero(&n)); - CHECK(secp256k1_scalar_cond_negate(&n, 0) == 1); - CHECK(secp256k1_scalar_is_zero(&n)); -} - -void test_ecmult_constants(void) { - /* Test ecmult_gen() for [0..36) and [order-36..0). */ - secp256k1_scalar x; - secp256k1_gej r; - secp256k1_ge ng; - int i; - int j; - secp256k1_ge_neg(&ng, &secp256k1_ge_const_g); - for (i = 0; i < 36; i++ ) { - secp256k1_scalar_set_int(&x, i); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &r, &x); - for (j = 0; j < i; j++) { - if (j == i - 1) { - ge_equals_gej(&secp256k1_ge_const_g, &r); - } - secp256k1_gej_add_ge(&r, &r, &ng); - } - CHECK(secp256k1_gej_is_infinity(&r)); - } - for (i = 1; i <= 36; i++ ) { - secp256k1_scalar_set_int(&x, i); - secp256k1_scalar_negate(&x, &x); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &r, &x); - for (j = 0; j < i; j++) { - if (j == i - 1) { - ge_equals_gej(&ng, &r); - } - secp256k1_gej_add_ge(&r, &r, &secp256k1_ge_const_g); - } - CHECK(secp256k1_gej_is_infinity(&r)); - } -} - -void run_ecmult_constants(void) { - test_ecmult_constants(); -} - -void test_ecmult_gen_blind(void) { - /* Test ecmult_gen() blinding and confirm that the blinding changes, the affine points match, and the z's don't match. */ - secp256k1_scalar key; - secp256k1_scalar b; - unsigned char seed32[32]; - secp256k1_gej pgej; - secp256k1_gej pgej2; - secp256k1_gej i; - secp256k1_ge pge; - random_scalar_order_test(&key); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pgej, &key); - secp256k1_rand256(seed32); - b = ctx->ecmult_gen_ctx.blind; - i = ctx->ecmult_gen_ctx.initial; - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, seed32); - CHECK(!secp256k1_scalar_eq(&b, &ctx->ecmult_gen_ctx.blind)); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pgej2, &key); - CHECK(!gej_xyz_equals_gej(&pgej, &pgej2)); - CHECK(!gej_xyz_equals_gej(&i, &ctx->ecmult_gen_ctx.initial)); - secp256k1_ge_set_gej(&pge, &pgej); - ge_equals_gej(&pge, &pgej2); -} - -void test_ecmult_gen_blind_reset(void) { - /* Test ecmult_gen() blinding reset and confirm that the blinding is consistent. */ - secp256k1_scalar b; - secp256k1_gej initial; - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, 0); - b = ctx->ecmult_gen_ctx.blind; - initial = ctx->ecmult_gen_ctx.initial; - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, 0); - CHECK(secp256k1_scalar_eq(&b, &ctx->ecmult_gen_ctx.blind)); - CHECK(gej_xyz_equals_gej(&initial, &ctx->ecmult_gen_ctx.initial)); -} - -void run_ecmult_gen_blind(void) { - int i; - test_ecmult_gen_blind_reset(); - for (i = 0; i < 10; i++) { - test_ecmult_gen_blind(); - } -} - -#ifdef USE_ENDOMORPHISM -/***** ENDOMORPHISH TESTS *****/ -void test_scalar_split(void) { - secp256k1_scalar full; - secp256k1_scalar s1, slam; - const unsigned char zero[32] = {0}; - unsigned char tmp[32]; - - random_scalar_order_test(&full); - secp256k1_scalar_split_lambda(&s1, &slam, &full); - - /* check that both are <= 128 bits in size */ - if (secp256k1_scalar_is_high(&s1)) { - secp256k1_scalar_negate(&s1, &s1); - } - if (secp256k1_scalar_is_high(&slam)) { - secp256k1_scalar_negate(&slam, &slam); - } - - secp256k1_scalar_get_b32(tmp, &s1); - CHECK(memcmp(zero, tmp, 16) == 0); - secp256k1_scalar_get_b32(tmp, &slam); - CHECK(memcmp(zero, tmp, 16) == 0); -} - -void run_endomorphism_tests(void) { - test_scalar_split(); -} -#endif - -void ec_pubkey_parse_pointtest(const unsigned char *input, int xvalid, int yvalid) { - unsigned char pubkeyc[65]; - secp256k1_pubkey pubkey; - secp256k1_ge ge; - size_t pubkeyclen; - int32_t ecount; - ecount = 0; - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - for (pubkeyclen = 3; pubkeyclen <= 65; pubkeyclen++) { - /* Smaller sizes are tested exhaustively elsewhere. */ - int32_t i; - memcpy(&pubkeyc[1], input, 64); - VG_UNDEF(&pubkeyc[pubkeyclen], 65 - pubkeyclen); - for (i = 0; i < 256; i++) { - /* Try all type bytes. */ - int xpass; - int ypass; - int ysign; - pubkeyc[0] = i; - /* What sign does this point have? */ - ysign = (input[63] & 1) + 2; - /* For the current type (i) do we expect parsing to work? Handled all of compressed/uncompressed/hybrid. */ - xpass = xvalid && (pubkeyclen == 33) && ((i & 254) == 2); - /* Do we expect a parse and re-serialize as uncompressed to give a matching y? */ - ypass = xvalid && yvalid && ((i & 4) == ((pubkeyclen == 65) << 2)) && - ((i == 4) || ((i & 251) == ysign)) && ((pubkeyclen == 33) || (pubkeyclen == 65)); - if (xpass || ypass) { - /* These cases must parse. */ - unsigned char pubkeyo[65]; - size_t outl; - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - ecount = 0; - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, pubkeyclen) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - outl = 65; - VG_UNDEF(pubkeyo, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, pubkeyo, &outl, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - VG_CHECK(pubkeyo, outl); - CHECK(outl == 33); - CHECK(memcmp(&pubkeyo[1], &pubkeyc[1], 32) == 0); - CHECK((pubkeyclen != 33) || (pubkeyo[0] == pubkeyc[0])); - if (ypass) { - /* This test isn't always done because we decode with alternative signs, so the y won't match. */ - CHECK(pubkeyo[0] == ysign); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 1); - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - secp256k1_pubkey_save(&pubkey, &ge); - VG_CHECK(&pubkey, sizeof(pubkey)); - outl = 65; - VG_UNDEF(pubkeyo, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, pubkeyo, &outl, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 1); - VG_CHECK(pubkeyo, outl); - CHECK(outl == 65); - CHECK(pubkeyo[0] == 4); - CHECK(memcmp(&pubkeyo[1], input, 64) == 0); - } - CHECK(ecount == 0); - } else { - /* These cases must fail to parse. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, pubkeyclen) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - } - } - } - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); -} - -void run_ec_pubkey_parse_test(void) { -#define SECP256K1_EC_PARSE_TEST_NVALID (12) - const unsigned char valid[SECP256K1_EC_PARSE_TEST_NVALID][64] = { - { - /* Point with leading and trailing zeros in x and y serialization. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x52, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x64, 0xef, 0xa1, 0x7b, 0x77, 0x61, 0xe1, 0xe4, 0x27, 0x06, 0x98, 0x9f, 0xb4, 0x83, - 0xb8, 0xd2, 0xd4, 0x9b, 0xf7, 0x8f, 0xae, 0x98, 0x03, 0xf0, 0x99, 0xb8, 0x34, 0xed, 0xeb, 0x00 - }, - { - /* Point with x equal to a 3rd root of unity.*/ - 0x7a, 0xe9, 0x6a, 0x2b, 0x65, 0x7c, 0x07, 0x10, 0x6e, 0x64, 0x47, 0x9e, 0xac, 0x34, 0x34, 0xe9, - 0x9c, 0xf0, 0x49, 0x75, 0x12, 0xf5, 0x89, 0x95, 0xc1, 0x39, 0x6c, 0x28, 0x71, 0x95, 0x01, 0xee, - 0x42, 0x18, 0xf2, 0x0a, 0xe6, 0xc6, 0x46, 0xb3, 0x63, 0xdb, 0x68, 0x60, 0x58, 0x22, 0xfb, 0x14, - 0x26, 0x4c, 0xa8, 0xd2, 0x58, 0x7f, 0xdd, 0x6f, 0xbc, 0x75, 0x0d, 0x58, 0x7e, 0x76, 0xa7, 0xee, - }, - { - /* Point with largest x. (1/2) */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2c, - 0x0e, 0x99, 0x4b, 0x14, 0xea, 0x72, 0xf8, 0xc3, 0xeb, 0x95, 0xc7, 0x1e, 0xf6, 0x92, 0x57, 0x5e, - 0x77, 0x50, 0x58, 0x33, 0x2d, 0x7e, 0x52, 0xd0, 0x99, 0x5c, 0xf8, 0x03, 0x88, 0x71, 0xb6, 0x7d, - }, - { - /* Point with largest x. (2/2) */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2c, - 0xf1, 0x66, 0xb4, 0xeb, 0x15, 0x8d, 0x07, 0x3c, 0x14, 0x6a, 0x38, 0xe1, 0x09, 0x6d, 0xa8, 0xa1, - 0x88, 0xaf, 0xa7, 0xcc, 0xd2, 0x81, 0xad, 0x2f, 0x66, 0xa3, 0x07, 0xfb, 0x77, 0x8e, 0x45, 0xb2, - }, - { - /* Point with smallest x. (1/2) */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x42, 0x18, 0xf2, 0x0a, 0xe6, 0xc6, 0x46, 0xb3, 0x63, 0xdb, 0x68, 0x60, 0x58, 0x22, 0xfb, 0x14, - 0x26, 0x4c, 0xa8, 0xd2, 0x58, 0x7f, 0xdd, 0x6f, 0xbc, 0x75, 0x0d, 0x58, 0x7e, 0x76, 0xa7, 0xee, - }, - { - /* Point with smallest x. (2/2) */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0xbd, 0xe7, 0x0d, 0xf5, 0x19, 0x39, 0xb9, 0x4c, 0x9c, 0x24, 0x97, 0x9f, 0xa7, 0xdd, 0x04, 0xeb, - 0xd9, 0xb3, 0x57, 0x2d, 0xa7, 0x80, 0x22, 0x90, 0x43, 0x8a, 0xf2, 0xa6, 0x81, 0x89, 0x54, 0x41, - }, - { - /* Point with largest y. (1/3) */ - 0x1f, 0xe1, 0xe5, 0xef, 0x3f, 0xce, 0xb5, 0xc1, 0x35, 0xab, 0x77, 0x41, 0x33, 0x3c, 0xe5, 0xa6, - 0xe8, 0x0d, 0x68, 0x16, 0x76, 0x53, 0xf6, 0xb2, 0xb2, 0x4b, 0xcb, 0xcf, 0xaa, 0xaf, 0xf5, 0x07, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - }, - { - /* Point with largest y. (2/3) */ - 0xcb, 0xb0, 0xde, 0xab, 0x12, 0x57, 0x54, 0xf1, 0xfd, 0xb2, 0x03, 0x8b, 0x04, 0x34, 0xed, 0x9c, - 0xb3, 0xfb, 0x53, 0xab, 0x73, 0x53, 0x91, 0x12, 0x99, 0x94, 0xa5, 0x35, 0xd9, 0x25, 0xf6, 0x73, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - }, - { - /* Point with largest y. (3/3) */ - 0x14, 0x6d, 0x3b, 0x65, 0xad, 0xd9, 0xf5, 0x4c, 0xcc, 0xa2, 0x85, 0x33, 0xc8, 0x8e, 0x2c, 0xbc, - 0x63, 0xf7, 0x44, 0x3e, 0x16, 0x58, 0x78, 0x3a, 0xb4, 0x1f, 0x8e, 0xf9, 0x7c, 0x2a, 0x10, 0xb5, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - }, - { - /* Point with smallest y. (1/3) */ - 0x1f, 0xe1, 0xe5, 0xef, 0x3f, 0xce, 0xb5, 0xc1, 0x35, 0xab, 0x77, 0x41, 0x33, 0x3c, 0xe5, 0xa6, - 0xe8, 0x0d, 0x68, 0x16, 0x76, 0x53, 0xf6, 0xb2, 0xb2, 0x4b, 0xcb, 0xcf, 0xaa, 0xaf, 0xf5, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }, - { - /* Point with smallest y. (2/3) */ - 0xcb, 0xb0, 0xde, 0xab, 0x12, 0x57, 0x54, 0xf1, 0xfd, 0xb2, 0x03, 0x8b, 0x04, 0x34, 0xed, 0x9c, - 0xb3, 0xfb, 0x53, 0xab, 0x73, 0x53, 0x91, 0x12, 0x99, 0x94, 0xa5, 0x35, 0xd9, 0x25, 0xf6, 0x73, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }, - { - /* Point with smallest y. (3/3) */ - 0x14, 0x6d, 0x3b, 0x65, 0xad, 0xd9, 0xf5, 0x4c, 0xcc, 0xa2, 0x85, 0x33, 0xc8, 0x8e, 0x2c, 0xbc, - 0x63, 0xf7, 0x44, 0x3e, 0x16, 0x58, 0x78, 0x3a, 0xb4, 0x1f, 0x8e, 0xf9, 0x7c, 0x2a, 0x10, 0xb5, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - } - }; -#define SECP256K1_EC_PARSE_TEST_NXVALID (4) - const unsigned char onlyxvalid[SECP256K1_EC_PARSE_TEST_NXVALID][64] = { - { - /* Valid if y overflow ignored (y = 1 mod p). (1/3) */ - 0x1f, 0xe1, 0xe5, 0xef, 0x3f, 0xce, 0xb5, 0xc1, 0x35, 0xab, 0x77, 0x41, 0x33, 0x3c, 0xe5, 0xa6, - 0xe8, 0x0d, 0x68, 0x16, 0x76, 0x53, 0xf6, 0xb2, 0xb2, 0x4b, 0xcb, 0xcf, 0xaa, 0xaf, 0xf5, 0x07, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - }, - { - /* Valid if y overflow ignored (y = 1 mod p). (2/3) */ - 0xcb, 0xb0, 0xde, 0xab, 0x12, 0x57, 0x54, 0xf1, 0xfd, 0xb2, 0x03, 0x8b, 0x04, 0x34, 0xed, 0x9c, - 0xb3, 0xfb, 0x53, 0xab, 0x73, 0x53, 0x91, 0x12, 0x99, 0x94, 0xa5, 0x35, 0xd9, 0x25, 0xf6, 0x73, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - }, - { - /* Valid if y overflow ignored (y = 1 mod p). (3/3)*/ - 0x14, 0x6d, 0x3b, 0x65, 0xad, 0xd9, 0xf5, 0x4c, 0xcc, 0xa2, 0x85, 0x33, 0xc8, 0x8e, 0x2c, 0xbc, - 0x63, 0xf7, 0x44, 0x3e, 0x16, 0x58, 0x78, 0x3a, 0xb4, 0x1f, 0x8e, 0xf9, 0x7c, 0x2a, 0x10, 0xb5, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - }, - { - /* x on curve, y is from y^2 = x^3 + 8. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 - } - }; -#define SECP256K1_EC_PARSE_TEST_NINVALID (7) - const unsigned char invalid[SECP256K1_EC_PARSE_TEST_NINVALID][64] = { - { - /* x is third root of -8, y is -1 * (x^3+7); also on the curve for y^2 = x^3 + 9. */ - 0x0a, 0x2d, 0x2b, 0xa9, 0x35, 0x07, 0xf1, 0xdf, 0x23, 0x37, 0x70, 0xc2, 0xa7, 0x97, 0x96, 0x2c, - 0xc6, 0x1f, 0x6d, 0x15, 0xda, 0x14, 0xec, 0xd4, 0x7d, 0x8d, 0x27, 0xae, 0x1c, 0xd5, 0xf8, 0x53, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }, - { - /* Valid if x overflow ignored (x = 1 mod p). */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - 0x42, 0x18, 0xf2, 0x0a, 0xe6, 0xc6, 0x46, 0xb3, 0x63, 0xdb, 0x68, 0x60, 0x58, 0x22, 0xfb, 0x14, - 0x26, 0x4c, 0xa8, 0xd2, 0x58, 0x7f, 0xdd, 0x6f, 0xbc, 0x75, 0x0d, 0x58, 0x7e, 0x76, 0xa7, 0xee, - }, - { - /* Valid if x overflow ignored (x = 1 mod p). */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - 0xbd, 0xe7, 0x0d, 0xf5, 0x19, 0x39, 0xb9, 0x4c, 0x9c, 0x24, 0x97, 0x9f, 0xa7, 0xdd, 0x04, 0xeb, - 0xd9, 0xb3, 0x57, 0x2d, 0xa7, 0x80, 0x22, 0x90, 0x43, 0x8a, 0xf2, 0xa6, 0x81, 0x89, 0x54, 0x41, - }, - { - /* x is -1, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 5. */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - 0xf4, 0x84, 0x14, 0x5c, 0xb0, 0x14, 0x9b, 0x82, 0x5d, 0xff, 0x41, 0x2f, 0xa0, 0x52, 0xa8, 0x3f, - 0xcb, 0x72, 0xdb, 0x61, 0xd5, 0x6f, 0x37, 0x70, 0xce, 0x06, 0x6b, 0x73, 0x49, 0xa2, 0xaa, 0x28, - }, - { - /* x is -1, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 5. */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - 0x0b, 0x7b, 0xeb, 0xa3, 0x4f, 0xeb, 0x64, 0x7d, 0xa2, 0x00, 0xbe, 0xd0, 0x5f, 0xad, 0x57, 0xc0, - 0x34, 0x8d, 0x24, 0x9e, 0x2a, 0x90, 0xc8, 0x8f, 0x31, 0xf9, 0x94, 0x8b, 0xb6, 0x5d, 0x52, 0x07, - }, - { - /* x is zero, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 7. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x8f, 0x53, 0x7e, 0xef, 0xdf, 0xc1, 0x60, 0x6a, 0x07, 0x27, 0xcd, 0x69, 0xb4, 0xa7, 0x33, 0x3d, - 0x38, 0xed, 0x44, 0xe3, 0x93, 0x2a, 0x71, 0x79, 0xee, 0xcb, 0x4b, 0x6f, 0xba, 0x93, 0x60, 0xdc, - }, - { - /* x is zero, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 7. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x70, 0xac, 0x81, 0x10, 0x20, 0x3e, 0x9f, 0x95, 0xf8, 0xd8, 0x32, 0x96, 0x4b, 0x58, 0xcc, 0xc2, - 0xc7, 0x12, 0xbb, 0x1c, 0x6c, 0xd5, 0x8e, 0x86, 0x11, 0x34, 0xb4, 0x8f, 0x45, 0x6c, 0x9b, 0x53 - } - }; - const unsigned char pubkeyc[66] = { - /* Serialization of G. */ - 0x04, 0x79, 0xBE, 0x66, 0x7E, 0xF9, 0xDC, 0xBB, 0xAC, 0x55, 0xA0, 0x62, 0x95, 0xCE, 0x87, 0x0B, - 0x07, 0x02, 0x9B, 0xFC, 0xDB, 0x2D, 0xCE, 0x28, 0xD9, 0x59, 0xF2, 0x81, 0x5B, 0x16, 0xF8, 0x17, - 0x98, 0x48, 0x3A, 0xDA, 0x77, 0x26, 0xA3, 0xC4, 0x65, 0x5D, 0xA4, 0xFB, 0xFC, 0x0E, 0x11, 0x08, - 0xA8, 0xFD, 0x17, 0xB4, 0x48, 0xA6, 0x85, 0x54, 0x19, 0x9C, 0x47, 0xD0, 0x8F, 0xFB, 0x10, 0xD4, - 0xB8, 0x00 - }; - unsigned char sout[65]; - unsigned char shortkey[2]; - secp256k1_ge ge; - secp256k1_pubkey pubkey; - size_t len; - int32_t i; - int32_t ecount; - int32_t ecount2; - ecount = 0; - /* Nothing should be reading this far into pubkeyc. */ - VG_UNDEF(&pubkeyc[65], 1); - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - /* Zero length claimed, fail, zeroize, no illegal arg error. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(shortkey, 2); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, shortkey, 0) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* Length one claimed, fail, zeroize, no illegal arg error. */ - for (i = 0; i < 256 ; i++) { - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - shortkey[0] = i; - VG_UNDEF(&shortkey[1], 1); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, shortkey, 1) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - } - /* Length two claimed, fail, zeroize, no illegal arg error. */ - for (i = 0; i < 65536 ; i++) { - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - shortkey[0] = i & 255; - shortkey[1] = i >> 8; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, shortkey, 2) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - } - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - /* 33 bytes claimed on otherwise valid input starting with 0x04, fail, zeroize output, no illegal arg error. */ - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 33) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* NULL pubkey, illegal arg error. Pubkey isn't rewritten before this step, since it's NULL into the parser. */ - CHECK(secp256k1_ec_pubkey_parse(ctx, NULL, pubkeyc, 65) == 0); - CHECK(ecount == 2); - /* NULL input string. Illegal arg and zeroize output. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, NULL, 65) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 1); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 2); - /* 64 bytes claimed on input starting with 0x04, fail, zeroize output, no illegal arg error. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 64) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* 66 bytes claimed, fail, zeroize output, no illegal arg error. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 66) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* Valid parse. */ - memset(&pubkey, 0, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 65) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - VG_UNDEF(&ge, sizeof(ge)); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 1); - VG_CHECK(&ge.x, sizeof(ge.x)); - VG_CHECK(&ge.y, sizeof(ge.y)); - VG_CHECK(&ge.infinity, sizeof(ge.infinity)); - ge_equals_ge(&secp256k1_ge_const_g, &ge); - CHECK(ecount == 0); - /* secp256k1_ec_pubkey_serialize illegal args. */ - ecount = 0; - len = 65; - CHECK(secp256k1_ec_pubkey_serialize(ctx, NULL, &len, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 0); - CHECK(ecount == 1); - CHECK(len == 0); - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, NULL, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 0); - CHECK(ecount == 2); - len = 65; - VG_UNDEF(sout, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, &len, NULL, SECP256K1_EC_UNCOMPRESSED) == 0); - VG_CHECK(sout, 65); - CHECK(ecount == 3); - CHECK(len == 0); - len = 65; - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, &len, &pubkey, ~0) == 0); - CHECK(ecount == 4); - CHECK(len == 0); - len = 65; - VG_UNDEF(sout, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, &len, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 1); - VG_CHECK(sout, 65); - CHECK(ecount == 4); - CHECK(len == 65); - /* Multiple illegal args. Should still set arg error only once. */ - ecount = 0; - ecount2 = 11; - CHECK(secp256k1_ec_pubkey_parse(ctx, NULL, NULL, 65) == 0); - CHECK(ecount == 1); - /* Does the illegal arg callback actually change the behavior? */ - secp256k1_context_set_illegal_callback(ctx, uncounting_illegal_callback_fn, &ecount2); - CHECK(secp256k1_ec_pubkey_parse(ctx, NULL, NULL, 65) == 0); - CHECK(ecount == 1); - CHECK(ecount2 == 10); - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); - /* Try a bunch of prefabbed points with all possible encodings. */ - for (i = 0; i < SECP256K1_EC_PARSE_TEST_NVALID; i++) { - ec_pubkey_parse_pointtest(valid[i], 1, 1); - } - for (i = 0; i < SECP256K1_EC_PARSE_TEST_NXVALID; i++) { - ec_pubkey_parse_pointtest(onlyxvalid[i], 1, 0); - } - for (i = 0; i < SECP256K1_EC_PARSE_TEST_NINVALID; i++) { - ec_pubkey_parse_pointtest(invalid[i], 0, 0); - } -} - -void run_eckey_edge_case_test(void) { - const unsigned char orderc[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41 - }; - const unsigned char zeros[sizeof(secp256k1_pubkey)] = {0x00}; - unsigned char ctmp[33]; - unsigned char ctmp2[33]; - secp256k1_pubkey pubkey; - secp256k1_pubkey pubkey2; - secp256k1_pubkey pubkey_one; - secp256k1_pubkey pubkey_negone; - const secp256k1_pubkey *pubkeys[3]; - size_t len; - int32_t ecount; - /* Group order is too large, reject. */ - CHECK(secp256k1_ec_seckey_verify(ctx, orderc) == 0); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, orderc) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* Maximum value is too large, reject. */ - memset(ctmp, 255, 32); - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 0); - memset(&pubkey, 1, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* Zero is too small, reject. */ - memset(ctmp, 0, 32); - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 0); - memset(&pubkey, 1, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* One must be accepted. */ - ctmp[31] = 0x01; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 1); - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - pubkey_one = pubkey; - /* Group order + 1 is too large, reject. */ - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x42; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 0); - memset(&pubkey, 1, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* -1 must be accepted. */ - ctmp[31] = 0x40; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 1); - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - pubkey_negone = pubkey; - /* Tweak of zero leaves the value changed. */ - memset(ctmp2, 0, 32); - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp, ctmp2) == 1); - CHECK(memcmp(orderc, ctmp, 31) == 0 && ctmp[31] == 0x40); - memcpy(&pubkey2, &pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - /* Multiply tweak of zero zeroizes the output. */ - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, ctmp, ctmp2) == 0); - CHECK(memcmp(zeros, ctmp, 32) == 0); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, ctmp2) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - /* Overflowing key tweak zeroizes. */ - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x40; - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp, orderc) == 0); - CHECK(memcmp(zeros, ctmp, 32) == 0); - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x40; - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, ctmp, orderc) == 0); - CHECK(memcmp(zeros, ctmp, 32) == 0); - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x40; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, orderc) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, orderc) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - /* Private key tweaks results in a key of zero. */ - ctmp2[31] = 1; - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp2, ctmp) == 0); - CHECK(memcmp(zeros, ctmp2, 32) == 0); - ctmp2[31] = 1; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - /* Tweak computation wraps and results in a key of 1. */ - ctmp2[31] = 2; - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp2, ctmp) == 1); - CHECK(memcmp(ctmp2, zeros, 31) == 0 && ctmp2[31] == 1); - ctmp2[31] = 2; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 1); - ctmp2[31] = 1; - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey2, ctmp2) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - /* Tweak mul * 2 = 1+1. */ - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 1); - ctmp2[31] = 2; - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey2, ctmp2) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - /* Test argument errors. */ - ecount = 0; - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - CHECK(ecount == 0); - /* Zeroize pubkey on parse error. */ - memset(&pubkey, 0, 32); - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - memset(&pubkey2, 0, 32); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey2, ctmp2) == 0); - CHECK(ecount == 2); - CHECK(memcmp(&pubkey2, zeros, sizeof(pubkey2)) == 0); - /* Plain argument errors. */ - ecount = 0; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 1); - CHECK(ecount == 0); - CHECK(secp256k1_ec_seckey_verify(ctx, NULL) == 0); - CHECK(ecount == 1); - ecount = 0; - memset(ctmp2, 0, 32); - ctmp2[31] = 4; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - memset(ctmp2, 0, 32); - ctmp2[31] = 4; - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - memset(ctmp2, 0, 32); - CHECK(secp256k1_ec_privkey_tweak_add(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - memset(ctmp2, 0, 32); - ctmp2[31] = 1; - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, ctmp, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - CHECK(secp256k1_ec_pubkey_create(ctx, NULL, ctmp) == 0); - CHECK(ecount == 1); - memset(&pubkey, 1, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 2); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* secp256k1_ec_pubkey_combine tests. */ - ecount = 0; - pubkeys[0] = &pubkey_one; - VG_UNDEF(&pubkeys[0], sizeof(secp256k1_pubkey *)); - VG_UNDEF(&pubkeys[1], sizeof(secp256k1_pubkey *)); - VG_UNDEF(&pubkeys[2], sizeof(secp256k1_pubkey *)); - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 0) == 0); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_pubkey_combine(ctx, NULL, pubkeys, 1) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 2); - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, NULL, 1) == 0); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 3); - pubkeys[0] = &pubkey_negone; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 1) == 1); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - CHECK(ecount == 3); - len = 33; - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp, &len, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp2, &len, &pubkey_negone, SECP256K1_EC_COMPRESSED) == 1); - CHECK(memcmp(ctmp, ctmp2, 33) == 0); - /* Result is infinity. */ - pubkeys[0] = &pubkey_one; - pubkeys[1] = &pubkey_negone; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 2) == 0); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 3); - /* Passes through infinity but comes out one. */ - pubkeys[2] = &pubkey_one; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 3) == 1); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - CHECK(ecount == 3); - len = 33; - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp, &len, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp2, &len, &pubkey_one, SECP256K1_EC_COMPRESSED) == 1); - CHECK(memcmp(ctmp, ctmp2, 33) == 0); - /* Adds to two. */ - pubkeys[1] = &pubkey_one; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 2) == 1); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - CHECK(ecount == 3); - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); -} - -void random_sign(secp256k1_scalar *sigr, secp256k1_scalar *sigs, const secp256k1_scalar *key, const secp256k1_scalar *msg, int *recid) { - secp256k1_scalar nonce; - do { - random_scalar_order_test(&nonce); - } while(!secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, sigr, sigs, key, msg, &nonce, recid)); -} - -void test_ecdsa_sign_verify(void) { - secp256k1_gej pubj; - secp256k1_ge pub; - secp256k1_scalar one; - secp256k1_scalar msg, key; - secp256k1_scalar sigr, sigs; - int recid; - int getrec; - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pubj, &key); - secp256k1_ge_set_gej(&pub, &pubj); - getrec = secp256k1_rand_bits(1); - random_sign(&sigr, &sigs, &key, &msg, getrec?&recid:NULL); - if (getrec) { - CHECK(recid >= 0 && recid < 4); - } - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &pub, &msg)); - secp256k1_scalar_set_int(&one, 1); - secp256k1_scalar_add(&msg, &msg, &one); - CHECK(!secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &pub, &msg)); -} - -void run_ecdsa_sign_verify(void) { - int i; - for (i = 0; i < 10*count; i++) { - test_ecdsa_sign_verify(); - } -} - -/** Dummy nonce generation function that just uses a precomputed nonce, and fails if it is not accepted. Use only for testing. */ -static int precomputed_nonce_function(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - (void)msg32; - (void)key32; - (void)algo16; - memcpy(nonce32, data, 32); - return (counter == 0); -} - -static int nonce_function_test_fail(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - /* Dummy nonce generator that has a fatal error on the first counter value. */ - if (counter == 0) { - return 0; - } - return nonce_function_rfc6979(nonce32, msg32, key32, algo16, data, counter - 1); -} - -static int nonce_function_test_retry(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - /* Dummy nonce generator that produces unacceptable nonces for the first several counter values. */ - if (counter < 3) { - memset(nonce32, counter==0 ? 0 : 255, 32); - if (counter == 2) { - nonce32[31]--; - } - return 1; - } - if (counter < 5) { - static const unsigned char order[] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, - 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, - 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x41 - }; - memcpy(nonce32, order, 32); - if (counter == 4) { - nonce32[31]++; - } - return 1; - } - /* Retry rate of 6979 is negligible esp. as we only call this in deterministic tests. */ - /* If someone does fine a case where it retries for secp256k1, we'd like to know. */ - if (counter > 5) { - return 0; - } - return nonce_function_rfc6979(nonce32, msg32, key32, algo16, data, counter - 5); -} - -int is_empty_signature(const secp256k1_ecdsa_signature *sig) { - static const unsigned char res[sizeof(secp256k1_ecdsa_signature)] = {0}; - return memcmp(sig, res, sizeof(secp256k1_ecdsa_signature)) == 0; -} - -void test_ecdsa_end_to_end(void) { - unsigned char extra[32] = {0x00}; - unsigned char privkey[32]; - unsigned char message[32]; - unsigned char privkey2[32]; - secp256k1_ecdsa_signature signature[6]; - secp256k1_scalar r, s; - unsigned char sig[74]; - size_t siglen = 74; - unsigned char pubkeyc[65]; - size_t pubkeyclen = 65; - secp256k1_pubkey pubkey; - unsigned char seckey[300]; - size_t seckeylen = 300; - - /* Generate a random key and message. */ - { - secp256k1_scalar msg, key; - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_scalar_get_b32(privkey, &key); - secp256k1_scalar_get_b32(message, &msg); - } - - /* Construct and verify corresponding public key. */ - CHECK(secp256k1_ec_seckey_verify(ctx, privkey) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, privkey) == 1); - - /* Verify exporting and importing public key. */ - CHECK(secp256k1_ec_pubkey_serialize(ctx, pubkeyc, &pubkeyclen, &pubkey, secp256k1_rand_bits(1) == 1 ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED)); - memset(&pubkey, 0, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, pubkeyclen) == 1); - - /* Verify private key import and export. */ - CHECK(ec_privkey_export_der(ctx, seckey, &seckeylen, privkey, secp256k1_rand_bits(1) == 1)); - CHECK(ec_privkey_import_der(ctx, privkey2, seckey, seckeylen) == 1); - CHECK(memcmp(privkey, privkey2, 32) == 0); - - /* Optionally tweak the keys using addition. */ - if (secp256k1_rand_int(3) == 0) { - int ret1; - int ret2; - unsigned char rnd[32]; - secp256k1_pubkey pubkey2; - secp256k1_rand256_test(rnd); - ret1 = secp256k1_ec_privkey_tweak_add(ctx, privkey, rnd); - ret2 = secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, rnd); - CHECK(ret1 == ret2); - if (ret1 == 0) { - return; - } - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey2, privkey) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - } - - /* Optionally tweak the keys using multiplication. */ - if (secp256k1_rand_int(3) == 0) { - int ret1; - int ret2; - unsigned char rnd[32]; - secp256k1_pubkey pubkey2; - secp256k1_rand256_test(rnd); - ret1 = secp256k1_ec_privkey_tweak_mul(ctx, privkey, rnd); - ret2 = secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, rnd); - CHECK(ret1 == ret2); - if (ret1 == 0) { - return; - } - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey2, privkey) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - } - - /* Sign. */ - CHECK(secp256k1_ecdsa_sign(ctx, &signature[0], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &signature[4], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &signature[1], message, privkey, NULL, extra) == 1); - extra[31] = 1; - CHECK(secp256k1_ecdsa_sign(ctx, &signature[2], message, privkey, NULL, extra) == 1); - extra[31] = 0; - extra[0] = 1; - CHECK(secp256k1_ecdsa_sign(ctx, &signature[3], message, privkey, NULL, extra) == 1); - CHECK(memcmp(&signature[0], &signature[4], sizeof(signature[0])) == 0); - CHECK(memcmp(&signature[0], &signature[1], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[0], &signature[2], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[0], &signature[3], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[1], &signature[2], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[1], &signature[3], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[2], &signature[3], sizeof(signature[0])) != 0); - /* Verify. */ - CHECK(secp256k1_ecdsa_verify(ctx, &signature[0], message, &pubkey) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[1], message, &pubkey) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[2], message, &pubkey) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[3], message, &pubkey) == 1); - /* Test lower-S form, malleate, verify and fail, test again, malleate again */ - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[0])); - secp256k1_ecdsa_signature_load(ctx, &r, &s, &signature[0]); - secp256k1_scalar_negate(&s, &s); - secp256k1_ecdsa_signature_save(&signature[5], &r, &s); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[5], message, &pubkey) == 0); - CHECK(secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[5])); - CHECK(secp256k1_ecdsa_signature_normalize(ctx, &signature[5], &signature[5])); - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[5])); - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, &signature[5], &signature[5])); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[5], message, &pubkey) == 1); - secp256k1_scalar_negate(&s, &s); - secp256k1_ecdsa_signature_save(&signature[5], &r, &s); - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[5])); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[5], message, &pubkey) == 1); - CHECK(memcmp(&signature[5], &signature[0], 64) == 0); - - /* Serialize/parse DER and verify again */ - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, sig, &siglen, &signature[0]) == 1); - memset(&signature[0], 0, sizeof(signature[0])); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &signature[0], sig, siglen) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[0], message, &pubkey) == 1); - /* Serialize/destroy/parse DER and verify again. */ - siglen = 74; - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, sig, &siglen, &signature[0]) == 1); - sig[secp256k1_rand_int(siglen)] += 1 + secp256k1_rand_int(255); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &signature[0], sig, siglen) == 0 || - secp256k1_ecdsa_verify(ctx, &signature[0], message, &pubkey) == 0); -} - -void test_random_pubkeys(void) { - secp256k1_ge elem; - secp256k1_ge elem2; - unsigned char in[65]; - /* Generate some randomly sized pubkeys. */ - size_t len = secp256k1_rand_bits(2) == 0 ? 65 : 33; - if (secp256k1_rand_bits(2) == 0) { - len = secp256k1_rand_bits(6); - } - if (len == 65) { - in[0] = secp256k1_rand_bits(1) ? 4 : (secp256k1_rand_bits(1) ? 6 : 7); - } else { - in[0] = secp256k1_rand_bits(1) ? 2 : 3; - } - if (secp256k1_rand_bits(3) == 0) { - in[0] = secp256k1_rand_bits(8); - } - if (len > 1) { - secp256k1_rand256(&in[1]); - } - if (len > 33) { - secp256k1_rand256(&in[33]); - } - if (secp256k1_eckey_pubkey_parse(&elem, in, len)) { - unsigned char out[65]; - unsigned char firstb; - int res; - size_t size = len; - firstb = in[0]; - /* If the pubkey can be parsed, it should round-trip... */ - CHECK(secp256k1_eckey_pubkey_serialize(&elem, out, &size, len == 33)); - CHECK(size == len); - CHECK(memcmp(&in[1], &out[1], len-1) == 0); - /* ... except for the type of hybrid inputs. */ - if ((in[0] != 6) && (in[0] != 7)) { - CHECK(in[0] == out[0]); - } - size = 65; - CHECK(secp256k1_eckey_pubkey_serialize(&elem, in, &size, 0)); - CHECK(size == 65); - CHECK(secp256k1_eckey_pubkey_parse(&elem2, in, size)); - ge_equals_ge(&elem,&elem2); - /* Check that the X9.62 hybrid type is checked. */ - in[0] = secp256k1_rand_bits(1) ? 6 : 7; - res = secp256k1_eckey_pubkey_parse(&elem2, in, size); - if (firstb == 2 || firstb == 3) { - if (in[0] == firstb + 4) { - CHECK(res); - } else { - CHECK(!res); - } - } - if (res) { - ge_equals_ge(&elem,&elem2); - CHECK(secp256k1_eckey_pubkey_serialize(&elem, out, &size, 0)); - CHECK(memcmp(&in[1], &out[1], 64) == 0); - } - } -} - -void run_random_pubkeys(void) { - int i; - for (i = 0; i < 10*count; i++) { - test_random_pubkeys(); - } -} - -void run_ecdsa_end_to_end(void) { - int i; - for (i = 0; i < 64*count; i++) { - test_ecdsa_end_to_end(); - } -} - -int test_ecdsa_der_parse(const unsigned char *sig, size_t siglen, int certainly_der, int certainly_not_der) { - static const unsigned char zeroes[32] = {0}; -#ifdef ENABLE_OPENSSL_TESTS - static const unsigned char max_scalar[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40 - }; -#endif - - int ret = 0; - - secp256k1_ecdsa_signature sig_der; - unsigned char roundtrip_der[2048]; - unsigned char compact_der[64]; - size_t len_der = 2048; - int parsed_der = 0, valid_der = 0, roundtrips_der = 0; - - secp256k1_ecdsa_signature sig_der_lax; - unsigned char roundtrip_der_lax[2048]; - unsigned char compact_der_lax[64]; - size_t len_der_lax = 2048; - int parsed_der_lax = 0, valid_der_lax = 0, roundtrips_der_lax = 0; - -#ifdef ENABLE_OPENSSL_TESTS - ECDSA_SIG *sig_openssl; - const unsigned char *sigptr; - unsigned char roundtrip_openssl[2048]; - int len_openssl = 2048; - int parsed_openssl, valid_openssl = 0, roundtrips_openssl = 0; -#endif - - parsed_der = secp256k1_ecdsa_signature_parse_der(ctx, &sig_der, sig, siglen); - if (parsed_der) { - ret |= (!secp256k1_ecdsa_signature_serialize_compact(ctx, compact_der, &sig_der)) << 0; - valid_der = (memcmp(compact_der, zeroes, 32) != 0) && (memcmp(compact_der + 32, zeroes, 32) != 0); - } - if (valid_der) { - ret |= (!secp256k1_ecdsa_signature_serialize_der(ctx, roundtrip_der, &len_der, &sig_der)) << 1; - roundtrips_der = (len_der == siglen) && memcmp(roundtrip_der, sig, siglen) == 0; - } - - parsed_der_lax = ecdsa_signature_parse_der_lax(ctx, &sig_der_lax, sig, siglen); - if (parsed_der_lax) { - ret |= (!secp256k1_ecdsa_signature_serialize_compact(ctx, compact_der_lax, &sig_der_lax)) << 10; - valid_der_lax = (memcmp(compact_der_lax, zeroes, 32) != 0) && (memcmp(compact_der_lax + 32, zeroes, 32) != 0); - } - if (valid_der_lax) { - ret |= (!secp256k1_ecdsa_signature_serialize_der(ctx, roundtrip_der_lax, &len_der_lax, &sig_der_lax)) << 11; - roundtrips_der_lax = (len_der_lax == siglen) && memcmp(roundtrip_der_lax, sig, siglen) == 0; - } - - if (certainly_der) { - ret |= (!parsed_der) << 2; - } - if (certainly_not_der) { - ret |= (parsed_der) << 17; - } - if (valid_der) { - ret |= (!roundtrips_der) << 3; - } - - if (valid_der) { - ret |= (!roundtrips_der_lax) << 12; - ret |= (len_der != len_der_lax) << 13; - ret |= (memcmp(roundtrip_der_lax, roundtrip_der, len_der) != 0) << 14; - } - ret |= (roundtrips_der != roundtrips_der_lax) << 15; - if (parsed_der) { - ret |= (!parsed_der_lax) << 16; - } - -#ifdef ENABLE_OPENSSL_TESTS - sig_openssl = ECDSA_SIG_new(); - sigptr = sig; - parsed_openssl = (d2i_ECDSA_SIG(&sig_openssl, &sigptr, siglen) != NULL); - if (parsed_openssl) { - valid_openssl = !BN_is_negative(sig_openssl->r) && !BN_is_negative(sig_openssl->s) && BN_num_bits(sig_openssl->r) > 0 && BN_num_bits(sig_openssl->r) <= 256 && BN_num_bits(sig_openssl->s) > 0 && BN_num_bits(sig_openssl->s) <= 256; - if (valid_openssl) { - unsigned char tmp[32] = {0}; - BN_bn2bin(sig_openssl->r, tmp + 32 - BN_num_bytes(sig_openssl->r)); - valid_openssl = memcmp(tmp, max_scalar, 32) < 0; - } - if (valid_openssl) { - unsigned char tmp[32] = {0}; - BN_bn2bin(sig_openssl->s, tmp + 32 - BN_num_bytes(sig_openssl->s)); - valid_openssl = memcmp(tmp, max_scalar, 32) < 0; - } - } - len_openssl = i2d_ECDSA_SIG(sig_openssl, NULL); - if (len_openssl <= 2048) { - unsigned char *ptr = roundtrip_openssl; - CHECK(i2d_ECDSA_SIG(sig_openssl, &ptr) == len_openssl); - roundtrips_openssl = valid_openssl && ((size_t)len_openssl == siglen) && (memcmp(roundtrip_openssl, sig, siglen) == 0); - } else { - len_openssl = 0; - } - ECDSA_SIG_free(sig_openssl); - - ret |= (parsed_der && !parsed_openssl) << 4; - ret |= (valid_der && !valid_openssl) << 5; - ret |= (roundtrips_openssl && !parsed_der) << 6; - ret |= (roundtrips_der != roundtrips_openssl) << 7; - if (roundtrips_openssl) { - ret |= (len_der != (size_t)len_openssl) << 8; - ret |= (memcmp(roundtrip_der, roundtrip_openssl, len_der) != 0) << 9; - } -#endif - return ret; -} - -static void assign_big_endian(unsigned char *ptr, size_t ptrlen, uint32_t val) { - size_t i; - for (i = 0; i < ptrlen; i++) { - int shift = ptrlen - 1 - i; - if (shift >= 4) { - ptr[i] = 0; - } else { - ptr[i] = (val >> shift) & 0xFF; - } - } -} - -static void damage_array(unsigned char *sig, size_t *len) { - int pos; - int action = secp256k1_rand_bits(3); - if (action < 1 && *len > 3) { - /* Delete a byte. */ - pos = secp256k1_rand_int(*len); - memmove(sig + pos, sig + pos + 1, *len - pos - 1); - (*len)--; - return; - } else if (action < 2 && *len < 2048) { - /* Insert a byte. */ - pos = secp256k1_rand_int(1 + *len); - memmove(sig + pos + 1, sig + pos, *len - pos); - sig[pos] = secp256k1_rand_bits(8); - (*len)++; - return; - } else if (action < 4) { - /* Modify a byte. */ - sig[secp256k1_rand_int(*len)] += 1 + secp256k1_rand_int(255); - return; - } else { /* action < 8 */ - /* Modify a bit. */ - sig[secp256k1_rand_int(*len)] ^= 1 << secp256k1_rand_bits(3); - return; - } -} - -static void random_ber_signature(unsigned char *sig, size_t *len, int* certainly_der, int* certainly_not_der) { - int der; - int nlow[2], nlen[2], nlenlen[2], nhbit[2], nhbyte[2], nzlen[2]; - size_t tlen, elen, glen; - int indet; - int n; - - *len = 0; - der = secp256k1_rand_bits(2) == 0; - *certainly_der = der; - *certainly_not_der = 0; - indet = der ? 0 : secp256k1_rand_int(10) == 0; - - for (n = 0; n < 2; n++) { - /* We generate two classes of numbers: nlow==1 "low" ones (up to 32 bytes), nlow==0 "high" ones (32 bytes with 129 top bits set, or larger than 32 bytes) */ - nlow[n] = der ? 1 : (secp256k1_rand_bits(3) != 0); - /* The length of the number in bytes (the first byte of which will always be nonzero) */ - nlen[n] = nlow[n] ? secp256k1_rand_int(33) : 32 + secp256k1_rand_int(200) * secp256k1_rand_int(8) / 8; - CHECK(nlen[n] <= 232); - /* The top bit of the number. */ - nhbit[n] = (nlow[n] == 0 && nlen[n] == 32) ? 1 : (nlen[n] == 0 ? 0 : secp256k1_rand_bits(1)); - /* The top byte of the number (after the potential hardcoded 16 0xFF characters for "high" 32 bytes numbers) */ - nhbyte[n] = nlen[n] == 0 ? 0 : (nhbit[n] ? 128 + secp256k1_rand_bits(7) : 1 + secp256k1_rand_int(127)); - /* The number of zero bytes in front of the number (which is 0 or 1 in case of DER, otherwise we extend up to 300 bytes) */ - nzlen[n] = der ? ((nlen[n] == 0 || nhbit[n]) ? 1 : 0) : (nlow[n] ? secp256k1_rand_int(3) : secp256k1_rand_int(300 - nlen[n]) * secp256k1_rand_int(8) / 8); - if (nzlen[n] > ((nlen[n] == 0 || nhbit[n]) ? 1 : 0)) { - *certainly_not_der = 1; - } - CHECK(nlen[n] + nzlen[n] <= 300); - /* The length of the length descriptor for the number. 0 means short encoding, anything else is long encoding. */ - nlenlen[n] = nlen[n] + nzlen[n] < 128 ? 0 : (nlen[n] + nzlen[n] < 256 ? 1 : 2); - if (!der) { - /* nlenlen[n] max 127 bytes */ - int add = secp256k1_rand_int(127 - nlenlen[n]) * secp256k1_rand_int(16) * secp256k1_rand_int(16) / 256; - nlenlen[n] += add; - if (add != 0) { - *certainly_not_der = 1; - } - } - CHECK(nlen[n] + nzlen[n] + nlenlen[n] <= 427); - } - - /* The total length of the data to go, so far */ - tlen = 2 + nlenlen[0] + nlen[0] + nzlen[0] + 2 + nlenlen[1] + nlen[1] + nzlen[1]; - CHECK(tlen <= 856); - - /* The length of the garbage inside the tuple. */ - elen = (der || indet) ? 0 : secp256k1_rand_int(980 - tlen) * secp256k1_rand_int(8) / 8; - if (elen != 0) { - *certainly_not_der = 1; - } - tlen += elen; - CHECK(tlen <= 980); - - /* The length of the garbage after the end of the tuple. */ - glen = der ? 0 : secp256k1_rand_int(990 - tlen) * secp256k1_rand_int(8) / 8; - if (glen != 0) { - *certainly_not_der = 1; - } - CHECK(tlen + glen <= 990); - - /* Write the tuple header. */ - sig[(*len)++] = 0x30; - if (indet) { - /* Indeterminate length */ - sig[(*len)++] = 0x80; - *certainly_not_der = 1; - } else { - int tlenlen = tlen < 128 ? 0 : (tlen < 256 ? 1 : 2); - if (!der) { - int add = secp256k1_rand_int(127 - tlenlen) * secp256k1_rand_int(16) * secp256k1_rand_int(16) / 256; - tlenlen += add; - if (add != 0) { - *certainly_not_der = 1; - } - } - if (tlenlen == 0) { - /* Short length notation */ - sig[(*len)++] = tlen; - } else { - /* Long length notation */ - sig[(*len)++] = 128 + tlenlen; - assign_big_endian(sig + *len, tlenlen, tlen); - *len += tlenlen; - } - tlen += tlenlen; - } - tlen += 2; - CHECK(tlen + glen <= 1119); - - for (n = 0; n < 2; n++) { - /* Write the integer header. */ - sig[(*len)++] = 0x02; - if (nlenlen[n] == 0) { - /* Short length notation */ - sig[(*len)++] = nlen[n] + nzlen[n]; - } else { - /* Long length notation. */ - sig[(*len)++] = 128 + nlenlen[n]; - assign_big_endian(sig + *len, nlenlen[n], nlen[n] + nzlen[n]); - *len += nlenlen[n]; - } - /* Write zero padding */ - while (nzlen[n] > 0) { - sig[(*len)++] = 0x00; - nzlen[n]--; - } - if (nlen[n] == 32 && !nlow[n]) { - /* Special extra 16 0xFF bytes in "high" 32-byte numbers */ - int i; - for (i = 0; i < 16; i++) { - sig[(*len)++] = 0xFF; - } - nlen[n] -= 16; - } - /* Write first byte of number */ - if (nlen[n] > 0) { - sig[(*len)++] = nhbyte[n]; - nlen[n]--; - } - /* Generate remaining random bytes of number */ - secp256k1_rand_bytes_test(sig + *len, nlen[n]); - *len += nlen[n]; - nlen[n] = 0; - } - - /* Generate random garbage inside tuple. */ - secp256k1_rand_bytes_test(sig + *len, elen); - *len += elen; - - /* Generate end-of-contents bytes. */ - if (indet) { - sig[(*len)++] = 0; - sig[(*len)++] = 0; - tlen += 2; - } - CHECK(tlen + glen <= 1121); - - /* Generate random garbage outside tuple. */ - secp256k1_rand_bytes_test(sig + *len, glen); - *len += glen; - tlen += glen; - CHECK(tlen <= 1121); - CHECK(tlen == *len); -} - -void run_ecdsa_der_parse(void) { - int i,j; - for (i = 0; i < 200 * count; i++) { - unsigned char buffer[2048]; - size_t buflen = 0; - int certainly_der = 0; - int certainly_not_der = 0; - random_ber_signature(buffer, &buflen, &certainly_der, &certainly_not_der); - CHECK(buflen <= 2048); - for (j = 0; j < 16; j++) { - int ret = 0; - if (j > 0) { - damage_array(buffer, &buflen); - /* We don't know anything anymore about the DERness of the result */ - certainly_der = 0; - certainly_not_der = 0; - } - ret = test_ecdsa_der_parse(buffer, buflen, certainly_der, certainly_not_der); - if (ret != 0) { - size_t k; - fprintf(stderr, "Failure %x on ", ret); - for (k = 0; k < buflen; k++) { - fprintf(stderr, "%02x ", buffer[k]); - } - fprintf(stderr, "\n"); - } - CHECK(ret == 0); - } - } -} - -/* Tests several edge cases. */ -void test_ecdsa_edge_cases(void) { - int t; - secp256k1_ecdsa_signature sig; - - /* Test the case where ECDSA recomputes a point that is infinity. */ - { - secp256k1_gej keyj; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_negate(&ss, &ss); - secp256k1_scalar_inverse(&ss, &ss); - secp256k1_scalar_set_int(&sr, 1); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &keyj, &sr); - secp256k1_ge_set_gej(&key, &keyj); - msg = ss; - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Verify signature with r of zero fails. */ - { - const unsigned char pubkey_mods_zero[33] = { - 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, - 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, - 0x41 - }; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_set_int(&msg, 0); - secp256k1_scalar_set_int(&sr, 0); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey_mods_zero, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Verify signature with s of zero fails. */ - { - const unsigned char pubkey[33] = { - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01 - }; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 0); - secp256k1_scalar_set_int(&msg, 0); - secp256k1_scalar_set_int(&sr, 1); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Verify signature with message 0 passes. */ - { - const unsigned char pubkey[33] = { - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02 - }; - const unsigned char pubkey2[33] = { - 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, - 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, - 0x43 - }; - secp256k1_ge key; - secp256k1_ge key2; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 2); - secp256k1_scalar_set_int(&msg, 0); - secp256k1_scalar_set_int(&sr, 2); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_eckey_pubkey_parse(&key2, pubkey2, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_negate(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_set_int(&ss, 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 0); - } - - /* Verify signature with message 1 passes. */ - { - const unsigned char pubkey[33] = { - 0x02, 0x14, 0x4e, 0x5a, 0x58, 0xef, 0x5b, 0x22, - 0x6f, 0xd2, 0xe2, 0x07, 0x6a, 0x77, 0xcf, 0x05, - 0xb4, 0x1d, 0xe7, 0x4a, 0x30, 0x98, 0x27, 0x8c, - 0x93, 0xe6, 0xe6, 0x3c, 0x0b, 0xc4, 0x73, 0x76, - 0x25 - }; - const unsigned char pubkey2[33] = { - 0x02, 0x8a, 0xd5, 0x37, 0xed, 0x73, 0xd9, 0x40, - 0x1d, 0xa0, 0x33, 0xd2, 0xdc, 0xf0, 0xaf, 0xae, - 0x34, 0xcf, 0x5f, 0x96, 0x4c, 0x73, 0x28, 0x0f, - 0x92, 0xc0, 0xf6, 0x9d, 0xd9, 0xb2, 0x09, 0x10, - 0x62 - }; - const unsigned char csr[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x45, 0x51, 0x23, 0x19, 0x50, 0xb7, 0x5f, 0xc4, - 0x40, 0x2d, 0xa1, 0x72, 0x2f, 0xc9, 0xba, 0xeb - }; - secp256k1_ge key; - secp256k1_ge key2; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_set_int(&msg, 1); - secp256k1_scalar_set_b32(&sr, csr, NULL); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_eckey_pubkey_parse(&key2, pubkey2, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_negate(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_set_int(&ss, 2); - secp256k1_scalar_inverse_var(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 0); - } - - /* Verify signature with message -1 passes. */ - { - const unsigned char pubkey[33] = { - 0x03, 0xaf, 0x97, 0xff, 0x7d, 0x3a, 0xf6, 0xa0, - 0x02, 0x94, 0xbd, 0x9f, 0x4b, 0x2e, 0xd7, 0x52, - 0x28, 0xdb, 0x49, 0x2a, 0x65, 0xcb, 0x1e, 0x27, - 0x57, 0x9c, 0xba, 0x74, 0x20, 0xd5, 0x1d, 0x20, - 0xf1 - }; - const unsigned char csr[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x45, 0x51, 0x23, 0x19, 0x50, 0xb7, 0x5f, 0xc4, - 0x40, 0x2d, 0xa1, 0x72, 0x2f, 0xc9, 0xba, 0xee - }; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_set_int(&msg, 1); - secp256k1_scalar_negate(&msg, &msg); - secp256k1_scalar_set_b32(&sr, csr, NULL); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - secp256k1_scalar_negate(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - secp256k1_scalar_set_int(&ss, 3); - secp256k1_scalar_inverse_var(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Signature where s would be zero. */ - { - secp256k1_pubkey pubkey; - size_t siglen; - int32_t ecount; - unsigned char signature[72]; - static const unsigned char nonce[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }; - static const unsigned char nonce2[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, - 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, - 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x40 - }; - const unsigned char key[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }; - unsigned char msg[32] = { - 0x86, 0x41, 0x99, 0x81, 0x06, 0x23, 0x44, 0x53, - 0xaa, 0x5f, 0x9d, 0x6a, 0x31, 0x78, 0xf4, 0xf7, - 0xb8, 0x12, 0xe0, 0x0b, 0x81, 0x7a, 0x77, 0x62, - 0x65, 0xdf, 0xdd, 0x31, 0xb9, 0x3e, 0x29, 0xa9, - }; - ecount = 0; - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce) == 0); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce2) == 0); - msg[31] = 0xaa; - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce) == 1); - CHECK(ecount == 0); - CHECK(secp256k1_ecdsa_sign(ctx, NULL, msg, key, precomputed_nonce_function, nonce2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, NULL, key, precomputed_nonce_function, nonce2) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, NULL, precomputed_nonce_function, nonce2) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce2) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, key) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, NULL, msg, &pubkey) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, NULL, &pubkey) == 0); - CHECK(ecount == 5); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg, NULL) == 0); - CHECK(ecount == 6); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg, &pubkey) == 1); - CHECK(ecount == 6); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 7); - /* That pubkeyload fails via an ARGCHECK is a little odd but makes sense because pubkeys are an opaque data type. */ - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg, &pubkey) == 0); - CHECK(ecount == 8); - siglen = 72; - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, NULL, &siglen, &sig) == 0); - CHECK(ecount == 9); - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, NULL, &sig) == 0); - CHECK(ecount == 10); - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, &siglen, NULL) == 0); - CHECK(ecount == 11); - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, &siglen, &sig) == 1); - CHECK(ecount == 11); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, NULL, signature, siglen) == 0); - CHECK(ecount == 12); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, NULL, siglen) == 0); - CHECK(ecount == 13); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, signature, siglen) == 1); - CHECK(ecount == 13); - siglen = 10; - /* Too little room for a signature does not fail via ARGCHECK. */ - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, &siglen, &sig) == 0); - CHECK(ecount == 13); - ecount = 0; - CHECK(secp256k1_ecdsa_signature_normalize(ctx, NULL, NULL) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_signature_serialize_compact(ctx, NULL, &sig) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_signature_serialize_compact(ctx, signature, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_signature_serialize_compact(ctx, signature, &sig) == 1); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, NULL, signature) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, &sig, NULL) == 0); - CHECK(ecount == 5); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, &sig, signature) == 1); - CHECK(ecount == 5); - memset(signature, 255, 64); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, &sig, signature) == 0); - CHECK(ecount == 5); - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); - } - - /* Nonce function corner cases. */ - for (t = 0; t < 2; t++) { - static const unsigned char zero[32] = {0x00}; - int i; - unsigned char key[32]; - unsigned char msg[32]; - secp256k1_ecdsa_signature sig2; - secp256k1_scalar sr[512], ss; - const unsigned char *extra; - extra = t == 0 ? NULL : zero; - memset(msg, 0, 32); - msg[31] = 1; - /* High key results in signature failure. */ - memset(key, 0xFF, 32); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, NULL, extra) == 0); - CHECK(is_empty_signature(&sig)); - /* Zero key results in signature failure. */ - memset(key, 0, 32); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, NULL, extra) == 0); - CHECK(is_empty_signature(&sig)); - /* Nonce function failure results in signature failure. */ - key[31] = 1; - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, nonce_function_test_fail, extra) == 0); - CHECK(is_empty_signature(&sig)); - /* The retry loop successfully makes its way to the first good value. */ - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, nonce_function_test_retry, extra) == 1); - CHECK(!is_empty_signature(&sig)); - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, nonce_function_rfc6979, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - CHECK(memcmp(&sig, &sig2, sizeof(sig)) == 0); - /* The default nonce function is deterministic. */ - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, NULL, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - CHECK(memcmp(&sig, &sig2, sizeof(sig)) == 0); - /* The default nonce function changes output with different messages. */ - for(i = 0; i < 256; i++) { - int j; - msg[0] = i; - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, NULL, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - secp256k1_ecdsa_signature_load(ctx, &sr[i], &ss, &sig2); - for (j = 0; j < i; j++) { - CHECK(!secp256k1_scalar_eq(&sr[i], &sr[j])); - } - } - msg[0] = 0; - msg[31] = 2; - /* The default nonce function changes output with different keys. */ - for(i = 256; i < 512; i++) { - int j; - key[0] = i - 256; - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, NULL, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - secp256k1_ecdsa_signature_load(ctx, &sr[i], &ss, &sig2); - for (j = 0; j < i; j++) { - CHECK(!secp256k1_scalar_eq(&sr[i], &sr[j])); - } - } - key[0] = 0; - } - - { - /* Check that optional nonce arguments do not have equivalent effect. */ - const unsigned char zeros[32] = {0}; - unsigned char nonce[32]; - unsigned char nonce2[32]; - unsigned char nonce3[32]; - unsigned char nonce4[32]; - VG_UNDEF(nonce,32); - VG_UNDEF(nonce2,32); - VG_UNDEF(nonce3,32); - VG_UNDEF(nonce4,32); - CHECK(nonce_function_rfc6979(nonce, zeros, zeros, NULL, NULL, 0) == 1); - VG_CHECK(nonce,32); - CHECK(nonce_function_rfc6979(nonce2, zeros, zeros, zeros, NULL, 0) == 1); - VG_CHECK(nonce2,32); - CHECK(nonce_function_rfc6979(nonce3, zeros, zeros, NULL, (void *)zeros, 0) == 1); - VG_CHECK(nonce3,32); - CHECK(nonce_function_rfc6979(nonce4, zeros, zeros, zeros, (void *)zeros, 0) == 1); - VG_CHECK(nonce4,32); - CHECK(memcmp(nonce, nonce2, 32) != 0); - CHECK(memcmp(nonce, nonce3, 32) != 0); - CHECK(memcmp(nonce, nonce4, 32) != 0); - CHECK(memcmp(nonce2, nonce3, 32) != 0); - CHECK(memcmp(nonce2, nonce4, 32) != 0); - CHECK(memcmp(nonce3, nonce4, 32) != 0); - } - - - /* Privkey export where pubkey is the point at infinity. */ - { - unsigned char privkey[300]; - unsigned char seckey[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, - }; - size_t outlen = 300; - CHECK(!ec_privkey_export_der(ctx, privkey, &outlen, seckey, 0)); - outlen = 300; - CHECK(!ec_privkey_export_der(ctx, privkey, &outlen, seckey, 1)); - } -} - -void run_ecdsa_edge_cases(void) { - test_ecdsa_edge_cases(); -} - -#ifdef ENABLE_OPENSSL_TESTS -EC_KEY *get_openssl_key(const unsigned char *key32) { - unsigned char privkey[300]; - size_t privkeylen; - const unsigned char* pbegin = privkey; - int compr = secp256k1_rand_bits(1); - EC_KEY *ec_key = EC_KEY_new_by_curve_name(NID_secp256k1); - CHECK(ec_privkey_export_der(ctx, privkey, &privkeylen, key32, compr)); - CHECK(d2i_ECPrivateKey(&ec_key, &pbegin, privkeylen)); - CHECK(EC_KEY_check_key(ec_key)); - return ec_key; -} - -void test_ecdsa_openssl(void) { - secp256k1_gej qj; - secp256k1_ge q; - secp256k1_scalar sigr, sigs; - secp256k1_scalar one; - secp256k1_scalar msg2; - secp256k1_scalar key, msg; - EC_KEY *ec_key; - unsigned int sigsize = 80; - size_t secp_sigsize = 80; - unsigned char message[32]; - unsigned char signature[80]; - unsigned char key32[32]; - secp256k1_rand256_test(message); - secp256k1_scalar_set_b32(&msg, message, NULL); - random_scalar_order_test(&key); - secp256k1_scalar_get_b32(key32, &key); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &qj, &key); - secp256k1_ge_set_gej(&q, &qj); - ec_key = get_openssl_key(key32); - CHECK(ec_key != NULL); - CHECK(ECDSA_sign(0, message, sizeof(message), signature, &sigsize, ec_key)); - CHECK(secp256k1_ecdsa_sig_parse(&sigr, &sigs, signature, sigsize)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &q, &msg)); - secp256k1_scalar_set_int(&one, 1); - secp256k1_scalar_add(&msg2, &msg, &one); - CHECK(!secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &q, &msg2)); - - random_sign(&sigr, &sigs, &key, &msg, NULL); - CHECK(secp256k1_ecdsa_sig_serialize(signature, &secp_sigsize, &sigr, &sigs)); - CHECK(ECDSA_verify(0, message, sizeof(message), signature, secp_sigsize, ec_key) == 1); - - EC_KEY_free(ec_key); -} - -void run_ecdsa_openssl(void) { - int i; - for (i = 0; i < 10*count; i++) { - test_ecdsa_openssl(); - } -} -#endif - -#ifdef ENABLE_MODULE_ECDH -# include "modules/ecdh/tests_impl.h" -#endif - -#ifdef ENABLE_MODULE_SCHNORR -# include "modules/schnorr/tests_impl.h" -#endif - -#ifdef ENABLE_MODULE_RECOVERY -# include "modules/recovery/tests_impl.h" -#endif - -int main(int argc, char **argv) { - unsigned char seed16[16] = {0}; - unsigned char run32[32] = {0}; - /* find iteration count */ - if (argc > 1) { - count = strtol(argv[1], NULL, 0); - } - - /* find random seed */ - if (argc > 2) { - int pos = 0; - const char* ch = argv[2]; - while (pos < 16 && ch[0] != 0 && ch[1] != 0) { - unsigned short sh; - if (sscanf(ch, "%2hx", &sh)) { - seed16[pos] = sh; - } else { - break; - } - ch += 2; - pos++; - } - } else { - FILE *frand = fopen("/dev/urandom", "r"); - if ((frand == NULL) || !fread(&seed16, sizeof(seed16), 1, frand)) { - uint64_t t = time(NULL) * (uint64_t)1337; - seed16[0] ^= t; - seed16[1] ^= t >> 8; - seed16[2] ^= t >> 16; - seed16[3] ^= t >> 24; - seed16[4] ^= t >> 32; - seed16[5] ^= t >> 40; - seed16[6] ^= t >> 48; - seed16[7] ^= t >> 56; - } - fclose(frand); - } - secp256k1_rand_seed(seed16); - - printf("test count = %i\n", count); - printf("random seed = %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", seed16[0], seed16[1], seed16[2], seed16[3], seed16[4], seed16[5], seed16[6], seed16[7], seed16[8], seed16[9], seed16[10], seed16[11], seed16[12], seed16[13], seed16[14], seed16[15]); - - /* initialize */ - run_context_tests(); - ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - if (secp256k1_rand_bits(1)) { - secp256k1_rand256(run32); - CHECK(secp256k1_context_randomize(ctx, secp256k1_rand_bits(1) ? run32 : NULL)); - } - - run_rand_bits(); - run_rand_int(); - - run_sha256_tests(); - run_hmac_sha256_tests(); - run_rfc6979_hmac_sha256_tests(); - -#ifndef USE_NUM_NONE - /* num tests */ - run_num_smalltests(); -#endif - - /* scalar tests */ - run_scalar_tests(); - - /* field tests */ - run_field_inv(); - run_field_inv_var(); - run_field_inv_all_var(); - run_field_misc(); - run_field_convert(); - run_sqr(); - run_sqrt(); - - /* group tests */ - run_ge(); - run_group_decompress(); - - /* ecmult tests */ - run_wnaf(); - run_point_times_order(); - run_ecmult_chain(); - run_ecmult_constants(); - run_ecmult_gen_blind(); - run_ecmult_const_tests(); - run_ec_combine(); - - /* endomorphism tests */ -#ifdef USE_ENDOMORPHISM - run_endomorphism_tests(); -#endif - - /* EC point parser test */ - run_ec_pubkey_parse_test(); - - /* EC key edge cases */ - run_eckey_edge_case_test(); - -#ifdef ENABLE_MODULE_ECDH - /* ecdh tests */ - run_ecdh_tests(); -#endif - - /* ecdsa tests */ - run_random_pubkeys(); - run_ecdsa_der_parse(); - run_ecdsa_sign_verify(); - run_ecdsa_end_to_end(); - run_ecdsa_edge_cases(); -#ifdef ENABLE_OPENSSL_TESTS - run_ecdsa_openssl(); -#endif - -#ifdef ENABLE_MODULE_SCHNORR - /* Schnorr tests */ - run_schnorr_tests(); -#endif - -#ifdef ENABLE_MODULE_RECOVERY - /* ECDSA pubkey recovery tests */ - run_recovery_tests(); -#endif - - secp256k1_rand256(run32); - printf("random run = %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", run32[0], run32[1], run32[2], run32[3], run32[4], run32[5], run32[6], run32[7], run32[8], run32[9], run32[10], run32[11], run32[12], run32[13], run32[14], run32[15]); - - /* shutdown */ - secp256k1_context_destroy(ctx); - - printf("no problems found\n"); - return 0; -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c deleted file mode 100644 index b040bb07..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c +++ /dev/null @@ -1,470 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2016 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include -#include - -#include - -#undef USE_ECMULT_STATIC_PRECOMPUTATION - -#ifndef EXHAUSTIVE_TEST_ORDER -/* see group_impl.h for allowable values */ -#define EXHAUSTIVE_TEST_ORDER 13 -#define EXHAUSTIVE_TEST_LAMBDA 9 /* cube root of 1 mod 13 */ -#endif - -#include "include/secp256k1.h" -#include "group.h" -#include "secp256k1.c" -#include "testrand_impl.h" - -#ifdef ENABLE_MODULE_RECOVERY -#include "src/modules/recovery/main_impl.h" -#include "include/secp256k1_recovery.h" -#endif - -/** stolen from tests.c */ -void ge_equals_ge(const secp256k1_ge *a, const secp256k1_ge *b) { - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - CHECK(secp256k1_fe_equal_var(&a->x, &b->x)); - CHECK(secp256k1_fe_equal_var(&a->y, &b->y)); -} - -void ge_equals_gej(const secp256k1_ge *a, const secp256k1_gej *b) { - secp256k1_fe z2s; - secp256k1_fe u1, u2, s1, s2; - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - /* Check a.x * b.z^2 == b.x && a.y * b.z^3 == b.y, to avoid inverses. */ - secp256k1_fe_sqr(&z2s, &b->z); - secp256k1_fe_mul(&u1, &a->x, &z2s); - u2 = b->x; secp256k1_fe_normalize_weak(&u2); - secp256k1_fe_mul(&s1, &a->y, &z2s); secp256k1_fe_mul(&s1, &s1, &b->z); - s2 = b->y; secp256k1_fe_normalize_weak(&s2); - CHECK(secp256k1_fe_equal_var(&u1, &u2)); - CHECK(secp256k1_fe_equal_var(&s1, &s2)); -} - -void random_fe(secp256k1_fe *x) { - unsigned char bin[32]; - do { - secp256k1_rand256(bin); - if (secp256k1_fe_set_b32(x, bin)) { - return; - } - } while(1); -} -/** END stolen from tests.c */ - -int secp256k1_nonce_function_smallint(unsigned char *nonce32, const unsigned char *msg32, - const unsigned char *key32, const unsigned char *algo16, - void *data, unsigned int attempt) { - secp256k1_scalar s; - int *idata = data; - (void)msg32; - (void)key32; - (void)algo16; - /* Some nonces cannot be used because they'd cause s and/or r to be zero. - * The signing function has retry logic here that just re-calls the nonce - * function with an increased `attempt`. So if attempt > 0 this means we - * need to change the nonce to avoid an infinite loop. */ - if (attempt > 0) { - *idata = (*idata + 1) % EXHAUSTIVE_TEST_ORDER; - } - secp256k1_scalar_set_int(&s, *idata); - secp256k1_scalar_get_b32(nonce32, &s); - return 1; -} - -#ifdef USE_ENDOMORPHISM -void test_exhaustive_endomorphism(const secp256k1_ge *group, int order) { - int i; - for (i = 0; i < order; i++) { - secp256k1_ge res; - secp256k1_ge_mul_lambda(&res, &group[i]); - ge_equals_ge(&group[i * EXHAUSTIVE_TEST_LAMBDA % EXHAUSTIVE_TEST_ORDER], &res); - } -} -#endif - -void test_exhaustive_addition(const secp256k1_ge *group, const secp256k1_gej *groupj, int order) { - int i, j; - - /* Sanity-check (and check infinity functions) */ - CHECK(secp256k1_ge_is_infinity(&group[0])); - CHECK(secp256k1_gej_is_infinity(&groupj[0])); - for (i = 1; i < order; i++) { - CHECK(!secp256k1_ge_is_infinity(&group[i])); - CHECK(!secp256k1_gej_is_infinity(&groupj[i])); - } - - /* Check all addition formulae */ - for (j = 0; j < order; j++) { - secp256k1_fe fe_inv; - secp256k1_fe_inv(&fe_inv, &groupj[j].z); - for (i = 0; i < order; i++) { - secp256k1_ge zless_gej; - secp256k1_gej tmp; - /* add_var */ - secp256k1_gej_add_var(&tmp, &groupj[i], &groupj[j], NULL); - ge_equals_gej(&group[(i + j) % order], &tmp); - /* add_ge */ - if (j > 0) { - secp256k1_gej_add_ge(&tmp, &groupj[i], &group[j]); - ge_equals_gej(&group[(i + j) % order], &tmp); - } - /* add_ge_var */ - secp256k1_gej_add_ge_var(&tmp, &groupj[i], &group[j], NULL); - ge_equals_gej(&group[(i + j) % order], &tmp); - /* add_zinv_var */ - zless_gej.infinity = groupj[j].infinity; - zless_gej.x = groupj[j].x; - zless_gej.y = groupj[j].y; - secp256k1_gej_add_zinv_var(&tmp, &groupj[i], &zless_gej, &fe_inv); - ge_equals_gej(&group[(i + j) % order], &tmp); - } - } - - /* Check doubling */ - for (i = 0; i < order; i++) { - secp256k1_gej tmp; - if (i > 0) { - secp256k1_gej_double_nonzero(&tmp, &groupj[i], NULL); - ge_equals_gej(&group[(2 * i) % order], &tmp); - } - secp256k1_gej_double_var(&tmp, &groupj[i], NULL); - ge_equals_gej(&group[(2 * i) % order], &tmp); - } - - /* Check negation */ - for (i = 1; i < order; i++) { - secp256k1_ge tmp; - secp256k1_gej tmpj; - secp256k1_ge_neg(&tmp, &group[i]); - ge_equals_ge(&group[order - i], &tmp); - secp256k1_gej_neg(&tmpj, &groupj[i]); - ge_equals_gej(&group[order - i], &tmpj); - } -} - -void test_exhaustive_ecmult(const secp256k1_context *ctx, const secp256k1_ge *group, const secp256k1_gej *groupj, int order) { - int i, j, r_log; - for (r_log = 1; r_log < order; r_log++) { - for (j = 0; j < order; j++) { - for (i = 0; i < order; i++) { - secp256k1_gej tmp; - secp256k1_scalar na, ng; - secp256k1_scalar_set_int(&na, i); - secp256k1_scalar_set_int(&ng, j); - - secp256k1_ecmult(&ctx->ecmult_ctx, &tmp, &groupj[r_log], &na, &ng); - ge_equals_gej(&group[(i * r_log + j) % order], &tmp); - - if (i > 0) { - secp256k1_ecmult_const(&tmp, &group[i], &ng); - ge_equals_gej(&group[(i * j) % order], &tmp); - } - } - } - } -} - -void r_from_k(secp256k1_scalar *r, const secp256k1_ge *group, int k) { - secp256k1_fe x; - unsigned char x_bin[32]; - k %= EXHAUSTIVE_TEST_ORDER; - x = group[k].x; - secp256k1_fe_normalize(&x); - secp256k1_fe_get_b32(x_bin, &x); - secp256k1_scalar_set_b32(r, x_bin, NULL); -} - -void test_exhaustive_verify(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - int s, r, msg, key; - for (s = 1; s < order; s++) { - for (r = 1; r < order; r++) { - for (msg = 1; msg < order; msg++) { - for (key = 1; key < order; key++) { - secp256k1_ge nonconst_ge; - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pk; - secp256k1_scalar sk_s, msg_s, r_s, s_s; - secp256k1_scalar s_times_k_s, msg_plus_r_times_sk_s; - int k, should_verify; - unsigned char msg32[32]; - - secp256k1_scalar_set_int(&s_s, s); - secp256k1_scalar_set_int(&r_s, r); - secp256k1_scalar_set_int(&msg_s, msg); - secp256k1_scalar_set_int(&sk_s, key); - - /* Verify by hand */ - /* Run through every k value that gives us this r and check that *one* works. - * Note there could be none, there could be multiple, ECDSA is weird. */ - should_verify = 0; - for (k = 0; k < order; k++) { - secp256k1_scalar check_x_s; - r_from_k(&check_x_s, group, k); - if (r_s == check_x_s) { - secp256k1_scalar_set_int(&s_times_k_s, k); - secp256k1_scalar_mul(&s_times_k_s, &s_times_k_s, &s_s); - secp256k1_scalar_mul(&msg_plus_r_times_sk_s, &r_s, &sk_s); - secp256k1_scalar_add(&msg_plus_r_times_sk_s, &msg_plus_r_times_sk_s, &msg_s); - should_verify |= secp256k1_scalar_eq(&s_times_k_s, &msg_plus_r_times_sk_s); - } - } - /* nb we have a "high s" rule */ - should_verify &= !secp256k1_scalar_is_high(&s_s); - - /* Verify by calling verify */ - secp256k1_ecdsa_signature_save(&sig, &r_s, &s_s); - memcpy(&nonconst_ge, &group[sk_s], sizeof(nonconst_ge)); - secp256k1_pubkey_save(&pk, &nonconst_ge); - secp256k1_scalar_get_b32(msg32, &msg_s); - CHECK(should_verify == - secp256k1_ecdsa_verify(ctx, &sig, msg32, &pk)); - } - } - } - } -} - -void test_exhaustive_sign(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - int i, j, k; - - /* Loop */ - for (i = 1; i < order; i++) { /* message */ - for (j = 1; j < order; j++) { /* key */ - for (k = 1; k < order; k++) { /* nonce */ - const int starting_k = k; - secp256k1_ecdsa_signature sig; - secp256k1_scalar sk, msg, r, s, expected_r; - unsigned char sk32[32], msg32[32]; - secp256k1_scalar_set_int(&msg, i); - secp256k1_scalar_set_int(&sk, j); - secp256k1_scalar_get_b32(sk32, &sk); - secp256k1_scalar_get_b32(msg32, &msg); - - secp256k1_ecdsa_sign(ctx, &sig, msg32, sk32, secp256k1_nonce_function_smallint, &k); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, &sig); - /* Note that we compute expected_r *after* signing -- this is important - * because our nonce-computing function function might change k during - * signing. */ - r_from_k(&expected_r, group, k); - CHECK(r == expected_r); - CHECK((k * s) % order == (i + r * j) % order || - (k * (EXHAUSTIVE_TEST_ORDER - s)) % order == (i + r * j) % order); - - /* Overflow means we've tried every possible nonce */ - if (k < starting_k) { - break; - } - } - } - } - - /* We would like to verify zero-knowledge here by counting how often every - * possible (s, r) tuple appears, but because the group order is larger - * than the field order, when coercing the x-values to scalar values, some - * appear more often than others, so we are actually not zero-knowledge. - * (This effect also appears in the real code, but the difference is on the - * order of 1/2^128th the field order, so the deviation is not useful to a - * computationally bounded attacker.) - */ -} - -#ifdef ENABLE_MODULE_RECOVERY -void test_exhaustive_recovery_sign(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - int i, j, k; - - /* Loop */ - for (i = 1; i < order; i++) { /* message */ - for (j = 1; j < order; j++) { /* key */ - for (k = 1; k < order; k++) { /* nonce */ - const int starting_k = k; - secp256k1_fe r_dot_y_normalized; - secp256k1_ecdsa_recoverable_signature rsig; - secp256k1_ecdsa_signature sig; - secp256k1_scalar sk, msg, r, s, expected_r; - unsigned char sk32[32], msg32[32]; - int expected_recid; - int recid; - secp256k1_scalar_set_int(&msg, i); - secp256k1_scalar_set_int(&sk, j); - secp256k1_scalar_get_b32(sk32, &sk); - secp256k1_scalar_get_b32(msg32, &msg); - - secp256k1_ecdsa_sign_recoverable(ctx, &rsig, msg32, sk32, secp256k1_nonce_function_smallint, &k); - - /* Check directly */ - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, &recid, &rsig); - r_from_k(&expected_r, group, k); - CHECK(r == expected_r); - CHECK((k * s) % order == (i + r * j) % order || - (k * (EXHAUSTIVE_TEST_ORDER - s)) % order == (i + r * j) % order); - /* In computing the recid, there is an overflow condition that is disabled in - * scalar_low_impl.h `secp256k1_scalar_set_b32` because almost every r.y value - * will exceed the group order, and our signing code always holds out for r - * values that don't overflow, so with a proper overflow check the tests would - * loop indefinitely. */ - r_dot_y_normalized = group[k].y; - secp256k1_fe_normalize(&r_dot_y_normalized); - /* Also the recovery id is flipped depending if we hit the low-s branch */ - if ((k * s) % order == (i + r * j) % order) { - expected_recid = secp256k1_fe_is_odd(&r_dot_y_normalized) ? 1 : 0; - } else { - expected_recid = secp256k1_fe_is_odd(&r_dot_y_normalized) ? 0 : 1; - } - CHECK(recid == expected_recid); - - /* Convert to a standard sig then check */ - secp256k1_ecdsa_recoverable_signature_convert(ctx, &sig, &rsig); - secp256k1_ecdsa_signature_load(ctx, &r, &s, &sig); - /* Note that we compute expected_r *after* signing -- this is important - * because our nonce-computing function function might change k during - * signing. */ - r_from_k(&expected_r, group, k); - CHECK(r == expected_r); - CHECK((k * s) % order == (i + r * j) % order || - (k * (EXHAUSTIVE_TEST_ORDER - s)) % order == (i + r * j) % order); - - /* Overflow means we've tried every possible nonce */ - if (k < starting_k) { - break; - } - } - } - } -} - -void test_exhaustive_recovery_verify(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - /* This is essentially a copy of test_exhaustive_verify, with recovery added */ - int s, r, msg, key; - for (s = 1; s < order; s++) { - for (r = 1; r < order; r++) { - for (msg = 1; msg < order; msg++) { - for (key = 1; key < order; key++) { - secp256k1_ge nonconst_ge; - secp256k1_ecdsa_recoverable_signature rsig; - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pk; - secp256k1_scalar sk_s, msg_s, r_s, s_s; - secp256k1_scalar s_times_k_s, msg_plus_r_times_sk_s; - int recid = 0; - int k, should_verify; - unsigned char msg32[32]; - - secp256k1_scalar_set_int(&s_s, s); - secp256k1_scalar_set_int(&r_s, r); - secp256k1_scalar_set_int(&msg_s, msg); - secp256k1_scalar_set_int(&sk_s, key); - secp256k1_scalar_get_b32(msg32, &msg_s); - - /* Verify by hand */ - /* Run through every k value that gives us this r and check that *one* works. - * Note there could be none, there could be multiple, ECDSA is weird. */ - should_verify = 0; - for (k = 0; k < order; k++) { - secp256k1_scalar check_x_s; - r_from_k(&check_x_s, group, k); - if (r_s == check_x_s) { - secp256k1_scalar_set_int(&s_times_k_s, k); - secp256k1_scalar_mul(&s_times_k_s, &s_times_k_s, &s_s); - secp256k1_scalar_mul(&msg_plus_r_times_sk_s, &r_s, &sk_s); - secp256k1_scalar_add(&msg_plus_r_times_sk_s, &msg_plus_r_times_sk_s, &msg_s); - should_verify |= secp256k1_scalar_eq(&s_times_k_s, &msg_plus_r_times_sk_s); - } - } - /* nb we have a "high s" rule */ - should_verify &= !secp256k1_scalar_is_high(&s_s); - - /* We would like to try recovering the pubkey and checking that it matches, - * but pubkey recovery is impossible in the exhaustive tests (the reason - * being that there are 12 nonzero r values, 12 nonzero points, and no - * overlap between the sets, so there are no valid signatures). */ - - /* Verify by converting to a standard signature and calling verify */ - secp256k1_ecdsa_recoverable_signature_save(&rsig, &r_s, &s_s, recid); - secp256k1_ecdsa_recoverable_signature_convert(ctx, &sig, &rsig); - memcpy(&nonconst_ge, &group[sk_s], sizeof(nonconst_ge)); - secp256k1_pubkey_save(&pk, &nonconst_ge); - CHECK(should_verify == - secp256k1_ecdsa_verify(ctx, &sig, msg32, &pk)); - } - } - } - } -} -#endif - -int main(void) { - int i; - secp256k1_gej groupj[EXHAUSTIVE_TEST_ORDER]; - secp256k1_ge group[EXHAUSTIVE_TEST_ORDER]; - - /* Build context */ - secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - /* TODO set z = 1, then do num_tests runs with random z values */ - - /* Generate the entire group */ - secp256k1_gej_set_infinity(&groupj[0]); - secp256k1_ge_set_gej(&group[0], &groupj[0]); - for (i = 1; i < EXHAUSTIVE_TEST_ORDER; i++) { - /* Set a different random z-value for each Jacobian point */ - secp256k1_fe z; - random_fe(&z); - - secp256k1_gej_add_ge(&groupj[i], &groupj[i - 1], &secp256k1_ge_const_g); - secp256k1_ge_set_gej(&group[i], &groupj[i]); - secp256k1_gej_rescale(&groupj[i], &z); - - /* Verify against ecmult_gen */ - { - secp256k1_scalar scalar_i; - secp256k1_gej generatedj; - secp256k1_ge generated; - - secp256k1_scalar_set_int(&scalar_i, i); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &generatedj, &scalar_i); - secp256k1_ge_set_gej(&generated, &generatedj); - - CHECK(group[i].infinity == 0); - CHECK(generated.infinity == 0); - CHECK(secp256k1_fe_equal_var(&generated.x, &group[i].x)); - CHECK(secp256k1_fe_equal_var(&generated.y, &group[i].y)); - } - } - - /* Run the tests */ -#ifdef USE_ENDOMORPHISM - test_exhaustive_endomorphism(group, EXHAUSTIVE_TEST_ORDER); -#endif - test_exhaustive_addition(group, groupj, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_ecmult(ctx, group, groupj, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_sign(ctx, group, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_verify(ctx, group, EXHAUSTIVE_TEST_ORDER); - -#ifdef ENABLE_MODULE_RECOVERY - test_exhaustive_recovery_sign(ctx, group, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_recovery_verify(ctx, group, EXHAUSTIVE_TEST_ORDER); -#endif - - secp256k1_context_destroy(ctx); - return 0; -} - diff --git a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h b/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h deleted file mode 100644 index 4092a86c..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h +++ /dev/null @@ -1,113 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_UTIL_H_ -#define _SECP256K1_UTIL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include -#include -#include - -typedef struct { - void (*fn)(const char *text, void* data); - const void* data; -} secp256k1_callback; - -static SECP256K1_INLINE void secp256k1_callback_call(const secp256k1_callback * const cb, const char * const text) { - cb->fn(text, (void*)cb->data); -} - -#ifdef DETERMINISTIC -#define TEST_FAILURE(msg) do { \ - fprintf(stderr, "%s\n", msg); \ - abort(); \ -} while(0); -#else -#define TEST_FAILURE(msg) do { \ - fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, msg); \ - abort(); \ -} while(0) -#endif - -#ifdef HAVE_BUILTIN_EXPECT -#define EXPECT(x,c) __builtin_expect((x),(c)) -#else -#define EXPECT(x,c) (x) -#endif - -#ifdef DETERMINISTIC -#define CHECK(cond) do { \ - if (EXPECT(!(cond), 0)) { \ - TEST_FAILURE("test condition failed"); \ - } \ -} while(0) -#else -#define CHECK(cond) do { \ - if (EXPECT(!(cond), 0)) { \ - TEST_FAILURE("test condition failed: " #cond); \ - } \ -} while(0) -#endif - -/* Like assert(), but when VERIFY is defined, and side-effect safe. */ -#if defined(COVERAGE) -#define VERIFY_CHECK(check) -#define VERIFY_SETUP(stmt) -#elif defined(VERIFY) -#define VERIFY_CHECK CHECK -#define VERIFY_SETUP(stmt) do { stmt; } while(0) -#else -#define VERIFY_CHECK(cond) do { (void)(cond); } while(0) -#define VERIFY_SETUP(stmt) -#endif - -static SECP256K1_INLINE void *checked_malloc(const secp256k1_callback* cb, size_t size) { - void *ret = malloc(size); - if (ret == NULL) { - secp256k1_callback_call(cb, "Out of memory"); - } - return ret; -} - -/* Macro for restrict, when available and not in a VERIFY build. */ -#if defined(SECP256K1_BUILD) && defined(VERIFY) -# define SECP256K1_RESTRICT -#else -# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) ) -# if SECP256K1_GNUC_PREREQ(3,0) -# define SECP256K1_RESTRICT __restrict__ -# elif (defined(_MSC_VER) && _MSC_VER >= 1400) -# define SECP256K1_RESTRICT __restrict -# else -# define SECP256K1_RESTRICT -# endif -# else -# define SECP256K1_RESTRICT restrict -# endif -#endif - -#if defined(_WIN32) -# define I64FORMAT "I64d" -# define I64uFORMAT "I64u" -#else -# define I64FORMAT "lld" -# define I64uFORMAT "llu" -#endif - -#if defined(HAVE___INT128) -# if defined(__GNUC__) -# define SECP256K1_GNUC_EXT __extension__ -# else -# define SECP256K1_GNUC_EXT -# endif -SECP256K1_GNUC_EXT typedef unsigned __int128 uint128_t; -#endif - -#endif diff --git a/crypto/keys/secp256k1/internal/secp256k1/panic_cb.go b/crypto/keys/secp256k1/internal/secp256k1/panic_cb.go deleted file mode 100644 index 6d59a1d2..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/panic_cb.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be found in -// the LICENSE file. - -package secp256k1 - -import "C" -import "unsafe" - -// Callbacks for converting libsecp256k1 internal faults into -// recoverable Go panics. - -//export secp256k1GoPanicIllegal -func secp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) { - panic("illegal argument: " + C.GoString(msg)) -} - -//export secp256k1GoPanicError -func secp256k1GoPanicError(msg *C.char, data unsafe.Pointer) { - panic("internal error: " + C.GoString(msg)) -} diff --git a/crypto/keys/secp256k1/internal/secp256k1/secp256.go b/crypto/keys/secp256k1/internal/secp256k1/secp256.go deleted file mode 100644 index 35d0eef3..00000000 --- a/crypto/keys/secp256k1/internal/secp256k1/secp256.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be found in -// the LICENSE file. - -// Package secp256k1 wraps the bitcoin secp256k1 C library. -package secp256k1 - -/* -#cgo CFLAGS: -I./libsecp256k1 -#cgo CFLAGS: -I./libsecp256k1/src/ -#define USE_NUM_NONE -#define USE_FIELD_10X26 -#define USE_FIELD_INV_BUILTIN -#define USE_SCALAR_8X32 -#define USE_SCALAR_INV_BUILTIN -#define NDEBUG -#include "./libsecp256k1/src/secp256k1.c" -#include "./libsecp256k1/src/modules/recovery/main_impl.h" -#include "ext.h" - -typedef void (*callbackFunc) (const char* msg, void* data); -extern void secp256k1GoPanicIllegal(const char* msg, void* data); -extern void secp256k1GoPanicError(const char* msg, void* data); -*/ -import "C" - -import ( - "errors" - "math/big" - "unsafe" -) - -var context *C.secp256k1_context - -func init() { - // around 20 ms on a modern CPU. - context = C.secp256k1_context_create_sign_verify() - C.secp256k1_context_set_illegal_callback(context, C.callbackFunc(C.secp256k1GoPanicIllegal), nil) - C.secp256k1_context_set_error_callback(context, C.callbackFunc(C.secp256k1GoPanicError), nil) -} - -var ( - ErrInvalidMsgLen = errors.New("invalid message length, need 32 bytes") - ErrInvalidSignatureLen = errors.New("invalid signature length") - ErrInvalidRecoveryID = errors.New("invalid signature recovery id") - ErrInvalidKey = errors.New("invalid private key") - ErrInvalidPubkey = errors.New("invalid public key") - ErrSignFailed = errors.New("signing failed") - ErrRecoverFailed = errors.New("recovery failed") -) - -// Sign creates a recoverable ECDSA signature. -// The produced signature is in the 65-byte [R || S || V] format where V is 0 or 1. -// -// The caller is responsible for ensuring that msg cannot be chosen -// directly by an attacker. It is usually preferable to use a cryptographic -// hash function on any input before handing it to this function. -func Sign(msg []byte, seckey []byte) ([]byte, error) { - if len(msg) != 32 { - return nil, ErrInvalidMsgLen - } - if len(seckey) != 32 { - return nil, ErrInvalidKey - } - seckeydata := (*C.uchar)(unsafe.Pointer(&seckey[0])) - if C.secp256k1_ec_seckey_verify(context, seckeydata) != 1 { - return nil, ErrInvalidKey - } - - var ( - msgdata = (*C.uchar)(unsafe.Pointer(&msg[0])) - noncefunc = C.secp256k1_nonce_function_rfc6979 - sigstruct C.secp256k1_ecdsa_recoverable_signature - ) - if C.secp256k1_ecdsa_sign_recoverable(context, &sigstruct, msgdata, seckeydata, noncefunc, nil) == 0 { - return nil, ErrSignFailed - } - - var ( - sig = make([]byte, 65) - sigdata = (*C.uchar)(unsafe.Pointer(&sig[0])) - recid C.int - ) - C.secp256k1_ecdsa_recoverable_signature_serialize_compact(context, sigdata, &recid, &sigstruct) - sig[64] = byte(recid) // add back recid to get 65 bytes sig - return sig, nil -} - -// RecoverPubkey returns the public key of the signer. -// msg must be the 32-byte hash of the message to be signed. -// sig must be a 65-byte compact ECDSA signature containing the -// recovery id as the last element. -func RecoverPubkey(msg []byte, sig []byte) ([]byte, error) { - if len(msg) != 32 { - return nil, ErrInvalidMsgLen - } - if err := checkSignature(sig); err != nil { - return nil, err - } - - var ( - pubkey = make([]byte, 65) - sigdata = (*C.uchar)(unsafe.Pointer(&sig[0])) - msgdata = (*C.uchar)(unsafe.Pointer(&msg[0])) - ) - if C.secp256k1_ext_ecdsa_recover(context, (*C.uchar)(unsafe.Pointer(&pubkey[0])), sigdata, msgdata) == 0 { - return nil, ErrRecoverFailed - } - return pubkey, nil -} - -// VerifySignature checks that the given pubkey created signature over message. -// The signature should be in [R || S] format. -func VerifySignature(pubkey, msg, signature []byte) bool { - if len(msg) != 32 || len(signature) != 64 || len(pubkey) == 0 { - return false - } - sigdata := (*C.uchar)(unsafe.Pointer(&signature[0])) - msgdata := (*C.uchar)(unsafe.Pointer(&msg[0])) - keydata := (*C.uchar)(unsafe.Pointer(&pubkey[0])) - return C.secp256k1_ext_ecdsa_verify(context, sigdata, msgdata, keydata, C.size_t(len(pubkey))) != 0 -} - -// DecompressPubkey parses a public key in the 33-byte compressed format. -// It returns non-nil coordinates if the public key is valid. -func DecompressPubkey(pubkey []byte) (x, y *big.Int) { - if len(pubkey) != 33 { - return nil, nil - } - var ( - pubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0])) - pubkeylen = C.size_t(len(pubkey)) - out = make([]byte, 65) - outdata = (*C.uchar)(unsafe.Pointer(&out[0])) - outlen = C.size_t(len(out)) - ) - if C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 { - return nil, nil - } - return new(big.Int).SetBytes(out[1:33]), new(big.Int).SetBytes(out[33:]) -} - -// CompressPubkey encodes a public key to 33-byte compressed format. -func CompressPubkey(x, y *big.Int) []byte { - var ( - pubkey = S256().Marshal(x, y) - pubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0])) - pubkeylen = C.size_t(len(pubkey)) - out = make([]byte, 33) - outdata = (*C.uchar)(unsafe.Pointer(&out[0])) - outlen = C.size_t(len(out)) - ) - if C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 { - panic("libsecp256k1 error") - } - return out -} - -func checkSignature(sig []byte) error { - if len(sig) != 65 { - return ErrInvalidSignatureLen - } - if sig[64] >= 4 { - return ErrInvalidRecoveryID - } - return nil -} diff --git a/crypto/keys/secp256k1/keys.pb.go b/crypto/keys/secp256k1/keys.pb.go deleted file mode 100644 index 037d57e1..00000000 --- a/crypto/keys/secp256k1/keys.pb.go +++ /dev/null @@ -1,499 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/secp256k1/keys.proto - -package secp256k1 - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// PubKey defines a secp256k1 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -type PubKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_e0835e68ebdcb224, []int{0} -} -func (m *PubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey.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 *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(m, src) -} -func (m *PubKey) XXX_Size() int { - return m.Size() -} -func (m *PubKey) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey proto.InternalMessageInfo - -func (m *PubKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -// PrivKey defines a secp256k1 private key. -type PrivKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PrivKey) Reset() { *m = PrivKey{} } -func (m *PrivKey) String() string { return proto.CompactTextString(m) } -func (*PrivKey) ProtoMessage() {} -func (*PrivKey) Descriptor() ([]byte, []int) { - return fileDescriptor_e0835e68ebdcb224, []int{1} -} -func (m *PrivKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PrivKey.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 *PrivKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrivKey.Merge(m, src) -} -func (m *PrivKey) XXX_Size() int { - return m.Size() -} -func (m *PrivKey) XXX_DiscardUnknown() { - xxx_messageInfo_PrivKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PrivKey proto.InternalMessageInfo - -func (m *PrivKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func init() { - proto.RegisterType((*PubKey)(nil), "cosmos.crypto.secp256k1.PubKey") - proto.RegisterType((*PrivKey)(nil), "cosmos.crypto.secp256k1.PrivKey") -} - -func init() { - proto.RegisterFile("cosmos/crypto/secp256k1/keys.proto", fileDescriptor_e0835e68ebdcb224) -} - -var fileDescriptor_e0835e68ebdcb224 = []byte{ - // 196 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x2f, 0x4e, 0x4d, 0x2e, 0x30, 0x32, - 0x35, 0xcb, 0x36, 0xd4, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, - 0x87, 0xa8, 0xd1, 0x83, 0xa8, 0xd1, 0x83, 0xab, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, - 0xd1, 0x07, 0xb1, 0x20, 0xca, 0x95, 0x14, 0xb8, 0xd8, 0x02, 0x4a, 0x93, 0xbc, 0x53, 0x2b, 0x85, - 0x04, 0xb8, 0x98, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x40, 0x4c, 0x2b, - 0x96, 0x19, 0x0b, 0xe4, 0x19, 0x94, 0xa4, 0xb9, 0xd8, 0x03, 0x8a, 0x32, 0xcb, 0xb0, 0x2a, 0x71, - 0x0a, 0x3c, 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, 0xf3, 0xf4, 0xcc, 0x92, - 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xcc, 0xa2, 0xcc, 0xe2, 0xbc, 0xd4, 0x12, 0x30, - 0x9d, 0x51, 0x9a, 0xa4, 0x5b, 0x9c, 0x92, 0xad, 0x9b, 0x9e, 0x0f, 0xf3, 0x06, 0xc8, 0xf1, 0x08, - 0xbf, 0x24, 0xb1, 0x81, 0x1d, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x79, 0x9f, 0x4f, 0xad, - 0xed, 0x00, 0x00, 0x00, -} - -func (m *PubKey) 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 *PubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PrivKey) 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 *PrivKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { - offset -= sovKeys(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func (m *PrivKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func sovKeys(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKeys(x uint64) (n int) { - return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PubKey) 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 ErrIntOverflowKeys - } - 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: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrivKey) 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 ErrIntOverflowKeys - } - 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: PrivKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrivKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKeys(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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrInvalidLengthKeys - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKeys - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKeys - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") -) diff --git a/crypto/keys/secp256k1/secp256k1.go b/crypto/keys/secp256k1/secp256k1.go deleted file mode 100644 index 338f058c..00000000 --- a/crypto/keys/secp256k1/secp256k1.go +++ /dev/null @@ -1,205 +0,0 @@ -package secp256k1 - -import ( - "bytes" - "crypto/sha256" - "crypto/subtle" - "fmt" - "io" - "math/big" - - secp256k1 "github.com/btcsuite/btcd/btcec" - "golang.org/x/crypto/ripemd160" // nolint: staticcheck // necessary for Bitcoin address format - - "github.com/irisnet/irishub-sdk-go/codec" - cryptotypes "github.com/irisnet/irishub-sdk-go/crypto/types" - - "github.com/tendermint/tendermint/crypto" -) - -var _ cryptotypes.PrivKey = &PrivKey{} -var _ codec.AminoMarshaler = &PrivKey{} - -const ( - PrivKeySize = 32 - keyType = "secp256k1" - PrivKeyName = "tendermint/PrivKeySecp256k1" - PubKeyName = "tendermint/PubKeySecp256k1" -) - -// Bytes returns the byte representation of the Private Key. -func (privKey *PrivKey) Bytes() []byte { - return privKey.Key -} - -// PubKey performs the point-scalar multiplication from the privKey on the -// generator point to get the pubkey. -func (privKey *PrivKey) PubKey() crypto.PubKey { - _, pubkeyObject := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey.Key) - pk := pubkeyObject.SerializeCompressed() - return &PubKey{Key: pk} -} - -// Equals - you probably don't need to use this. -// Runs in constant time based on length of the -func (privKey *PrivKey) Equals(other crypto.PrivKey) bool { - return privKey.Type() == other.Type() && subtle.ConstantTimeCompare(privKey.Bytes(), other.Bytes()) == 1 -} - -func (privKey *PrivKey) Type() string { - return keyType -} - -// MarshalAmino overrides Amino binary marshalling. -func (privKey PrivKey) MarshalAmino() ([]byte, error) { - return privKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PrivKeySize { - return fmt.Errorf("invalid privkey size") - } - privKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return privKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { - return privKey.UnmarshalAmino(bz) -} - -// GenPrivKey generates a new ECDSA private key on curve secp256k1 private key. -// It uses OS randomness to generate the private key. -func GenPrivKey() *PrivKey { - return &PrivKey{Key: genPrivKey(crypto.CReader())} -} - -// genPrivKey generates a new secp256k1 private key using the provided reader. -func genPrivKey(rand io.Reader) []byte { - var privKeyBytes [PrivKeySize]byte - d := new(big.Int) - for { - privKeyBytes = [PrivKeySize]byte{} - _, err := io.ReadFull(rand, privKeyBytes[:]) - if err != nil { - panic(err) - } - - d.SetBytes(privKeyBytes[:]) - // break if we found a valid point (i.e. > 0 and < N == curverOrder) - isValidFieldElement := 0 < d.Sign() && d.Cmp(secp256k1.S256().N) < 0 - if isValidFieldElement { - break - } - } - - return privKeyBytes[:] -} - -var one = new(big.Int).SetInt64(1) - -// GenPrivKeyFromSecret hashes the secret with SHA2, and uses -// that 32 byte output to create the private key. -// -// It makes sure the private key is a valid field element by setting: -// -// c = sha256(secret) -// k = (c mod (n − 1)) + 1, where n = curve order. -// -// NOTE: secret should be the output of a KDF like bcrypt, -// if it's derived from user input. -func GenPrivKeyFromSecret(secret []byte) *PrivKey { - secHash := sha256.Sum256(secret) - // to guarantee that we have a valid field element, we use the approach of: - // "Suite B Implementer’s Guide to FIPS 186-3", A.2.1 - // https://apps.nsa.gov/iaarchive/library/ia-guidance/ia-solutions-for-classified/algorithm-guidance/suite-b-implementers-guide-to-fips-186-3-ecdsa.cfm - // see also https://github.com/golang/go/blob/0380c9ad38843d523d9c9804fe300cb7edd7cd3c/src/crypto/ecdsa/ecdsa.go#L89-L101 - fe := new(big.Int).SetBytes(secHash[:]) - n := new(big.Int).Sub(secp256k1.S256().N, one) - fe.Mod(fe, n) - fe.Add(fe, one) - - feB := fe.Bytes() - privKey32 := make([]byte, PrivKeySize) - // copy feB over to fixed 32 byte privKey32 and pad (if necessary) - copy(privKey32[32-len(feB):32], feB) - - return &PrivKey{Key: privKey32} -} - -//------------------------------------- - -var _ cryptotypes.PubKey = &PubKey{} -var _ codec.AminoMarshaler = &PubKey{} - -// PubKeySize is comprised of 32 bytes for one field element -// (the x-coordinate), plus one byte for the parity of the y-coordinate. -const PubKeySize = 33 - -// Address returns a Bitcoin style addresses: RIPEMD160(SHA256(pubkey)) -func (pubKey *PubKey) Address() crypto.Address { - if len(pubKey.Key) != PubKeySize { - panic("length of pubkey is incorrect") - } - - hasherSHA256 := sha256.New() - _, _ = hasherSHA256.Write(pubKey.Key) // does not error - sha := hasherSHA256.Sum(nil) - - hasherRIPEMD160 := ripemd160.New() - _, _ = hasherRIPEMD160.Write(sha) // does not error - return crypto.Address(hasherRIPEMD160.Sum(nil)) -} - -// Bytes returns the pubkey byte format. -func (pubKey *PubKey) Bytes() []byte { - return pubKey.Key -} - -func (pubKey *PubKey) String() string { - return fmt.Sprintf("PubKeySecp256k1{%X}", pubKey.Key) -} - -func (pubKey *PubKey) Type() string { - return keyType -} - -func (pubKey *PubKey) Equals(other crypto.PubKey) bool { - return pubKey.Type() == other.Type() && bytes.Equal(pubKey.Bytes(), other.Bytes()) -} - -// MarshalAmino overrides Amino binary marshalling. -func (pubKey PubKey) MarshalAmino() ([]byte, error) { - return pubKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PubKeySize { - return fmt.Errorf("invalid pubkey size") - } - pubKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return pubKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { - return pubKey.UnmarshalAmino(bz) -} diff --git a/crypto/keys/secp256k1/secp256k1_cgo.go b/crypto/keys/secp256k1/secp256k1_cgo.go deleted file mode 100644 index d81b258f..00000000 --- a/crypto/keys/secp256k1/secp256k1_cgo.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build libsecp256k1 - -package secp256k1 - -import ( - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1/internal/secp256k1" -) - -// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg. -func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) { - rsv, err := secp256k1.Sign(crypto.Sha256(msg), privKey.Key) - if err != nil { - return nil, err - } - // we do not need v in r||s||v: - rs := rsv[:len(rsv)-1] - return rs, nil -} - -func (pubKey *PrivKey) VerifySignature(msg []byte, sig []byte) bool { - return secp256k1.VerifySignature(pubKey.Key, crypto.Sha256(msg), sig) -} diff --git a/crypto/keys/secp256k1/secp256k1_cgo_test.go b/crypto/keys/secp256k1/secp256k1_cgo_test.go deleted file mode 100644 index bfaa76ca..00000000 --- a/crypto/keys/secp256k1/secp256k1_cgo_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build libsecp256k1 - -package secp256k1 - -import ( - "testing" - - "github.com/magiconair/properties/assert" - - "github.com/stretchr/testify/require" -) - -func TestPrivKeySecp256k1SignVerify(t *testing.T) { - msg := []byte("A.1.2 ECC Key Pair Generation by Testing Candidates") - priv := GenPrivKey() - tests := []struct { - name string - privKey *PrivKey - wantSignErr bool - wantVerifyPasses bool - }{ - {name: "valid sign-verify round", privKey: priv, wantSignErr: false, wantVerifyPasses: true}, - {name: "invalid private key", privKey: &*PrivKey{Key: [32]byte{}}, wantSignErr: true, wantVerifyPasses: false}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := tt.privKey.Sign(msg) - if tt.wantSignErr { - require.Error(t, err) - t.Logf("Got error: %s", err) - return - } - require.NoError(t, err) - require.NotNil(t, got) - - pub := tt.privKey.PubKey() - assert.Equal(t, tt.wantVerifyPasses, pub.VerifyBytes(msg, got)) - }) - } -} diff --git a/crypto/keys/secp256k1/secp256k1_internal_test.go b/crypto/keys/secp256k1/secp256k1_internal_test.go deleted file mode 100644 index 3103413f..00000000 --- a/crypto/keys/secp256k1/secp256k1_internal_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package secp256k1 - -import ( - "bytes" - "math/big" - "testing" - - "github.com/stretchr/testify/require" - - underlyingSecp256k1 "github.com/btcsuite/btcd/btcec" -) - -func Test_genPrivKey(t *testing.T) { - - empty := make([]byte, 32) - oneB := big.NewInt(1).Bytes() - onePadded := make([]byte, 32) - copy(onePadded[32-len(oneB):32], oneB) - t.Logf("one padded: %v, len=%v", onePadded, len(onePadded)) - - validOne := append(empty, onePadded...) - tests := []struct { - name string - notSoRand []byte - shouldPanic bool - }{ - {"empty bytes (panics because 1st 32 bytes are zero and 0 is not a valid field element)", empty, true}, - {"curve order: N", underlyingSecp256k1.S256().N.Bytes(), true}, - {"valid because 0 < 1 < N", validOne, false}, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - if tt.shouldPanic { - require.Panics(t, func() { - genPrivKey(bytes.NewReader(tt.notSoRand)) - }) - return - } - got := genPrivKey(bytes.NewReader(tt.notSoRand)) - fe := new(big.Int).SetBytes(got[:]) - require.True(t, fe.Cmp(underlyingSecp256k1.S256().N) < 0) - require.True(t, fe.Sign() > 0) - }) - } -} diff --git a/crypto/keys/secp256k1/secp256k1_nocgo.go b/crypto/keys/secp256k1/secp256k1_nocgo.go deleted file mode 100644 index 2d605447..00000000 --- a/crypto/keys/secp256k1/secp256k1_nocgo.go +++ /dev/null @@ -1,70 +0,0 @@ -// +build !libsecp256k1 - -package secp256k1 - -import ( - "math/big" - - secp256k1 "github.com/btcsuite/btcd/btcec" - - "github.com/tendermint/tendermint/crypto" -) - -// used to reject malleable signatures -// see: -// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93 -// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/crypto.go#L39 -var secp256k1halfN = new(big.Int).Rsh(secp256k1.S256().N, 1) - -// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg. -// The returned signature will be of the form R || S (in lower-S form). -func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) { - priv, _ := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey.Key) - sig, err := priv.Sign(crypto.Sha256(msg)) - if err != nil { - return nil, err - } - sigBytes := serializeSig(sig) - return sigBytes, nil -} - -// VerifyBytes verifies a signature of the form R || S. -// It rejects signatures which are not in lower-S form. -func (pubKey *PubKey) VerifySignature(msg []byte, sigStr []byte) bool { - if len(sigStr) != 64 { - return false - } - pub, err := secp256k1.ParsePubKey(pubKey.Key, secp256k1.S256()) - if err != nil { - return false - } - // parse the signature: - signature := signatureFromBytes(sigStr) - // Reject malleable signatures. libsecp256k1 does this check but btcec doesn't. - // see: https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93 - if signature.S.Cmp(secp256k1halfN) > 0 { - return false - } - return signature.Verify(crypto.Sha256(msg), pub) -} - -// Read Signature struct from R || S. Caller needs to ensure -// that len(sigStr) == 64. -func signatureFromBytes(sigStr []byte) *secp256k1.Signature { - return &secp256k1.Signature{ - R: new(big.Int).SetBytes(sigStr[:32]), - S: new(big.Int).SetBytes(sigStr[32:64]), - } -} - -// Serialize signature to R || S. -// R, S are padded to 32 bytes respectively. -func serializeSig(sig *secp256k1.Signature) []byte { - rBytes := sig.R.Bytes() - sBytes := sig.S.Bytes() - sigBytes := make([]byte, 64) - // 0 pad the byte arrays from the left if they aren't big enough. - copy(sigBytes[32-len(rBytes):32], rBytes) - copy(sigBytes[64-len(sBytes):64], sBytes) - return sigBytes -} diff --git a/crypto/keys/secp256k1/secp256k1_nocgo_test.go b/crypto/keys/secp256k1/secp256k1_nocgo_test.go deleted file mode 100644 index 4c2c856e..00000000 --- a/crypto/keys/secp256k1/secp256k1_nocgo_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// +build !libsecp256k1 - -package secp256k1 - -import ( - "testing" - - secp256k1 "github.com/btcsuite/btcd/btcec" - "github.com/stretchr/testify/require" -) - -// Ensure that signature verification works, and that -// non-canonical signatures fail. -// Note: run with CGO_ENABLED=0 or go test -tags !cgo. -func TestSignatureVerificationAndRejectUpperS(t *testing.T) { - msg := []byte("We have lingered long enough on the shores of the cosmic ocean.") - for i := 0; i < 500; i++ { - priv := GenPrivKey() - sigStr, err := priv.Sign(msg) - require.NoError(t, err) - sig := signatureFromBytes(sigStr) - require.False(t, sig.S.Cmp(secp256k1halfN) > 0) - - pub := priv.PubKey() - require.True(t, pub.VerifySignature(msg, sigStr)) - - // malleate: - sig.S.Sub(secp256k1.S256().CurveParams.N, sig.S) - require.True(t, sig.S.Cmp(secp256k1halfN) > 0) - malSigStr := serializeSig(sig) - - require.False(t, pub.VerifySignature(msg, malSigStr), - "VerifyBytes incorrect with malleated & invalid S. sig=%v, key=%v", - sig, - priv, - ) - } -} diff --git a/crypto/keys/secp256k1/secp256k1_test.go b/crypto/keys/secp256k1/secp256k1_test.go deleted file mode 100644 index 924928f8..00000000 --- a/crypto/keys/secp256k1/secp256k1_test.go +++ /dev/null @@ -1,251 +0,0 @@ -package secp256k1_test - -import ( - "encoding/base64" - "encoding/hex" - "math/big" - "testing" - - "github.com/btcsuite/btcutil/base58" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/sr25519" - - underlyingSecp256k1 "github.com/btcsuite/btcd/btcec" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/irishub-sdk-go/crypto/types" -) - -type keyData struct { - priv string - pub string - addr string -} - -var secpDataTable = []keyData{ - { - priv: "a96e62ed3955e65be32703f12d87b6b5cf26039ecfa948dc5107a495418e5330", - pub: "02950e1cdfcb133d6024109fd489f734eeb4502418e538c28481f22bce276f248c", - addr: "1CKZ9Nx4zgds8tU7nJHotKSDr4a9bYJCa3", - }, -} - -func TestPubKeySecp256k1Address(t *testing.T) { - for _, d := range secpDataTable { - privB, _ := hex.DecodeString(d.priv) - pubB, _ := hex.DecodeString(d.pub) - addrBbz, _, _ := base58.CheckDecode(d.addr) - addrB := crypto.Address(addrBbz) - - var priv secp256k1.PrivKey = secp256k1.PrivKey{Key: privB} - - pubKey := priv.PubKey() - pubT, _ := pubKey.(*secp256k1.PubKey) - - addr := pubKey.Address() - assert.Equal(t, pubT, &secp256k1.PubKey{Key: pubB}, "Expected pub keys to match") - assert.Equal(t, addr, addrB, "Expected addresses to match") - } -} - -func TestSignAndValidateSecp256k1(t *testing.T) { - privKey := secp256k1.GenPrivKey() - pubKey := privKey.PubKey() - - msg := crypto.CRandBytes(128) - sig, err := privKey.Sign(msg) - require.Nil(t, err) - - assert.True(t, pubKey.VerifySignature(msg, sig)) - - // Mutate the signature, just one bit. - sig[3] ^= byte(0x01) - - assert.False(t, pubKey.VerifySignature(msg, sig)) -} - -// This test is intended to justify the removal of calls to the underlying library -// in creating the privkey. -func TestSecp256k1LoadPrivkeyAndSerializeIsIdentity(t *testing.T) { - numberOfTests := 256 - for i := 0; i < numberOfTests; i++ { - // Seed the test case with some random bytes - privKeyBytes := [32]byte{} - copy(privKeyBytes[:], crypto.CRandBytes(32)) - - // This function creates a private and public key in the underlying libraries format. - // The private key is basically calling new(big.Int).SetBytes(pk), which removes leading zero bytes - priv, _ := underlyingSecp256k1.PrivKeyFromBytes(underlyingSecp256k1.S256(), privKeyBytes[:]) - // this takes the bytes returned by `(big int).Bytes()`, and if the length is less than 32 bytes, - // pads the bytes from the left with zero bytes. Therefore these two functions composed - // result in the identity function on privKeyBytes, hence the following equality check - // always returning true. - serializedBytes := priv.Serialize() - require.Equal(t, privKeyBytes[:], serializedBytes) - } -} - -func TestGenPrivKeyFromSecret(t *testing.T) { - // curve oder N - N := underlyingSecp256k1.S256().N - tests := []struct { - name string - secret []byte - }{ - {"empty secret", []byte{}}, - { - "some long secret", - []byte("We live in a society exquisitely dependent on science and technology, " + - "in which hardly anyone knows anything about science and technology."), - }, - {"another seed used in cosmos tests #1", []byte{0}}, - {"another seed used in cosmos tests #2", []byte("mySecret")}, - {"another seed used in cosmos tests #3", []byte("")}, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - gotPrivKey := secp256k1.GenPrivKeyFromSecret(tt.secret) - require.NotNil(t, gotPrivKey) - // interpret as a big.Int and make sure it is a valid field element: - fe := new(big.Int).SetBytes(gotPrivKey.Key[:]) - require.True(t, fe.Cmp(N) < 0) - require.True(t, fe.Sign() > 0) - }) - } -} - -func TestPubKeyEquals(t *testing.T) { - secp256K1PubKey := secp256k1.GenPrivKey().PubKey().(*secp256k1.PubKey) - - testCases := []struct { - msg string - pubKey cryptotypes.PubKey - other crypto.PubKey - expectEq bool - }{ - { - "different bytes", - secp256K1PubKey, - secp256k1.GenPrivKey().PubKey(), - false, - }, - { - "equals", - secp256K1PubKey, - &secp256k1.PubKey{ - Key: secp256K1PubKey.Key, - }, - true, - }, - { - "different types", - secp256K1PubKey, - sr25519.GenPrivKey().PubKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.pubKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestPrivKeyEquals(t *testing.T) { - secp256K1PrivKey := secp256k1.GenPrivKey() - - testCases := []struct { - msg string - privKey cryptotypes.PrivKey - other crypto.PrivKey - expectEq bool - }{ - { - "different bytes", - secp256K1PrivKey, - secp256k1.GenPrivKey(), - false, - }, - { - "equals", - secp256K1PrivKey, - &secp256k1.PrivKey{ - Key: secp256K1PrivKey.Key, - }, - true, - }, - { - "different types", - secp256K1PrivKey, - sr25519.GenPrivKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.privKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestMarshalAmino(t *testing.T) { - aminoCdc := codec.NewLegacyAmino() - privKey := secp256k1.GenPrivKey() - pubKey := privKey.PubKey().(*secp256k1.PubKey) - - testCases := []struct { - desc string - msg codec.AminoMarshaler - typ interface{} - expBinary []byte - expJSON string - }{ - { - "secp256k1 private key", - privKey, - &secp256k1.PrivKey{}, - append([]byte{32}, privKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(privKey.Bytes()) + "\"", - }, - { - "secp256k1 public key", - pubKey, - &secp256k1.PubKey{}, - append([]byte{33}, pubKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(pubKey.Bytes()) + "\"", - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - // Do a round trip of encoding/decoding binary. - bz, err := aminoCdc.MarshalBinaryBare(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expBinary, bz) - - err = aminoCdc.UnmarshalBinaryBare(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - - // Do a round trip of encoding/decoding JSON. - bz, err = aminoCdc.MarshalJSON(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expJSON, string(bz)) - - err = aminoCdc.UnmarshalJSON(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - }) - } -} diff --git a/crypto/types/compact_bit_array.go b/crypto/types/compact_bit_array.go deleted file mode 100644 index 7c7188f6..00000000 --- a/crypto/types/compact_bit_array.go +++ /dev/null @@ -1,248 +0,0 @@ -package types - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "regexp" - "strings" -) - -// CompactBitArray is an implementation of a space efficient bit array. -// This is used to ensure that the encoded data takes up a minimal amount of -// space after amino encoding. -// This is not thread safe, and is not intended for concurrent usage. - -// NewCompactBitArray returns a new compact bit array. -// It returns nil if the number of bits is zero. -func NewCompactBitArray(bits int) *CompactBitArray { - if bits <= 0 { - return nil - } - return &CompactBitArray{ - ExtraBitsStored: uint32(bits % 8), - Elems: make([]byte, (bits+7)/8), - } -} - -// Count returns the number of bits in the bitarray -func (bA *CompactBitArray) Count() int { - if bA == nil { - return 0 - } else if bA.ExtraBitsStored == uint32(0) { - return len(bA.Elems) * 8 - } - - return (len(bA.Elems)-1)*8 + int(bA.ExtraBitsStored) -} - -// GetIndex returns the bit at index i within the bit array. -// The behavior is undefined if i >= bA.Count() -func (bA *CompactBitArray) GetIndex(i int) bool { - if bA == nil { - return false - } - if i >= bA.Count() { - return false - } - - return bA.Elems[i>>3]&(uint8(1)< 0 -} - -// SetIndex sets the bit at index i within the bit array. -// The behavior is undefined if i >= bA.Count() -func (bA *CompactBitArray) SetIndex(i int, v bool) bool { - if bA == nil { - return false - } - - if i >= bA.Count() { - return false - } - - if v { - bA.Elems[i>>3] |= (uint8(1) << uint8(7-(i%8))) - } else { - bA.Elems[i>>3] &= ^(uint8(1) << uint8(7-(i%8))) - } - - return true -} - -// NumTrueBitsBefore returns the number of bits set to true before the -// given index. e.g. if bA = _XX__XX, NumOfTrueBitsBefore(4) = 2, since -// there are two bits set to true before index 4. -func (bA *CompactBitArray) NumTrueBitsBefore(index int) int { - numTrueValues := 0 - for i := 0; i < index; i++ { - if bA.GetIndex(i) { - numTrueValues++ - } - } - - return numTrueValues -} - -// Copy returns a copy of the provided bit array. -func (bA *CompactBitArray) Copy() *CompactBitArray { - if bA == nil { - return nil - } - - c := make([]byte, len(bA.Elems)) - copy(c, bA.Elems) - - return &CompactBitArray{ - ExtraBitsStored: bA.ExtraBitsStored, - Elems: c, - } -} - -// String returns a string representation of CompactBitArray: BA{}, -// where is a sequence of 'x' (1) and '_' (0). -// The includes spaces and newlines to help people. -// For a simple sequence of 'x' and '_' characters with no spaces or newlines, -// see the MarshalJSON() method. -// Example: "BA{_x_}" or "nil-BitArray" for nil. -func (bA *CompactBitArray) String() string { return bA.StringIndented("") } - -// StringIndented returns the same thing as String(), but applies the indent -// at every 10th bit, and twice at every 50th bit. -func (bA *CompactBitArray) StringIndented(indent string) string { - if bA == nil { - return "nil-BitArray" - } - lines := []string{} - bits := "" - size := bA.Count() - for i := 0; i < size; i++ { - if bA.GetIndex(i) { - bits += "x" - } else { - bits += "_" - } - - if i%100 == 99 { - lines = append(lines, bits) - bits = "" - } - - if i%10 == 9 { - bits += indent - } - - if i%50 == 49 { - bits += indent - } - } - - if len(bits) > 0 { - lines = append(lines, bits) - } - - return fmt.Sprintf("BA{%v:%v}", size, strings.Join(lines, indent)) -} - -// MarshalJSON implements json.Marshaler interface by marshaling bit array -// using a custom format: a string of '-' or 'x' where 'x' denotes the 1 bit. -func (bA *CompactBitArray) MarshalJSON() ([]byte, error) { - if bA == nil { - return []byte("null"), nil - } - - bits := `"` - size := bA.Count() - for i := 0; i < size; i++ { - if bA.GetIndex(i) { - bits += `x` - } else { - bits += `_` - } - } - - bits += `"` - - return []byte(bits), nil -} - -var bitArrayJSONRegexp = regexp.MustCompile(`\A"([_x]*)"\z`) - -// UnmarshalJSON implements json.Unmarshaler interface by unmarshaling a custom -// JSON description. -func (bA *CompactBitArray) UnmarshalJSON(bz []byte) error { - b := string(bz) - if b == "null" { - // This is required e.g. for encoding/json when decoding - // into a pointer with pre-allocated BitArray. - bA.ExtraBitsStored = 0 - bA.Elems = nil - - return nil - } - - match := bitArrayJSONRegexp.FindStringSubmatch(b) - if match == nil { - return fmt.Errorf("bitArray in JSON should be a string of format %q but got %s", bitArrayJSONRegexp.String(), b) - } - - bits := match[1] - - // Construct new CompactBitArray and copy over. - numBits := len(bits) - bA2 := NewCompactBitArray(numBits) - for i := 0; i < numBits; i++ { - if bits[i] == 'x' { - bA2.SetIndex(i, true) - } - } - *bA = *bA2 - - return nil -} - -// CompactMarshal is a space efficient encoding for CompactBitArray. -// It is not amino compatible. -func (bA *CompactBitArray) CompactMarshal() []byte { - size := bA.Count() - if size <= 0 { - return []byte("null") - } - - bz := make([]byte, 0, size/8) - // length prefix number of bits, not number of bytes. This difference - // takes 3-4 bits in encoding, as opposed to instead encoding the number of - // bytes (saving 3-4 bits) and including the offset as a full byte. - bz = appendUvarint(bz, uint64(size)) - bz = append(bz, bA.Elems...) - - return bz -} - -// CompactUnmarshal is a space efficient decoding for CompactBitArray. -// It is not amino compatible. -func CompactUnmarshal(bz []byte) (*CompactBitArray, error) { - if len(bz) < 2 { - return nil, errors.New("compact bit array: invalid compact unmarshal size") - } else if bytes.Equal(bz, []byte("null")) { - return NewCompactBitArray(0), nil - } - - size, n := binary.Uvarint(bz) - bz = bz[n:] - - if len(bz) != int(size+7)/8 { - return nil, errors.New("compact bit array: invalid compact unmarshal size") - } - - bA := &CompactBitArray{uint32(size % 8), bz} - - return bA, nil -} - -func appendUvarint(b []byte, x uint64) []byte { - var a [binary.MaxVarintLen64]byte - n := binary.PutUvarint(a[:], x) - - return append(b, a[:n]...) -} diff --git a/crypto/types/multisig.pb.go b/crypto/types/multisig.pb.go deleted file mode 100644 index 5d6a5397..00000000 --- a/crypto/types/multisig.pb.go +++ /dev/null @@ -1,551 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/multisig/v1beta1/multisig.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. -// See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers -// signed and with which modes. -type MultiSignature struct { - Signatures [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MultiSignature) Reset() { *m = MultiSignature{} } -func (m *MultiSignature) String() string { return proto.CompactTextString(m) } -func (*MultiSignature) ProtoMessage() {} -func (*MultiSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_1177bdf7025769be, []int{0} -} -func (m *MultiSignature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MultiSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MultiSignature.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 *MultiSignature) XXX_Merge(src proto.Message) { - xxx_messageInfo_MultiSignature.Merge(m, src) -} -func (m *MultiSignature) XXX_Size() int { - return m.Size() -} -func (m *MultiSignature) XXX_DiscardUnknown() { - xxx_messageInfo_MultiSignature.DiscardUnknown(m) -} - -var xxx_messageInfo_MultiSignature proto.InternalMessageInfo - -func (m *MultiSignature) GetSignatures() [][]byte { - if m != nil { - return m.Signatures - } - return nil -} - -// CompactBitArray is an implementation of a space efficient bit array. -// This is used to ensure that the encoded data takes up a minimal amount of -// space after proto encoding. -// This is not thread safe, and is not intended for concurrent usage. -type CompactBitArray struct { - ExtraBitsStored uint32 `protobuf:"varint,1,opt,name=extra_bits_stored,json=extraBitsStored,proto3" json:"extra_bits_stored,omitempty"` - Elems []byte `protobuf:"bytes,2,opt,name=elems,proto3" json:"elems,omitempty"` -} - -func (m *CompactBitArray) Reset() { *m = CompactBitArray{} } -func (*CompactBitArray) ProtoMessage() {} -func (*CompactBitArray) Descriptor() ([]byte, []int) { - return fileDescriptor_1177bdf7025769be, []int{1} -} -func (m *CompactBitArray) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompactBitArray) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompactBitArray.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 *CompactBitArray) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompactBitArray.Merge(m, src) -} -func (m *CompactBitArray) XXX_Size() int { - return m.Size() -} -func (m *CompactBitArray) XXX_DiscardUnknown() { - xxx_messageInfo_CompactBitArray.DiscardUnknown(m) -} - -var xxx_messageInfo_CompactBitArray proto.InternalMessageInfo - -func (m *CompactBitArray) GetExtraBitsStored() uint32 { - if m != nil { - return m.ExtraBitsStored - } - return 0 -} - -func (m *CompactBitArray) GetElems() []byte { - if m != nil { - return m.Elems - } - return nil -} - -func init() { - proto.RegisterType((*MultiSignature)(nil), "cosmos.crypto.multisig.v1beta1.MultiSignature") - proto.RegisterType((*CompactBitArray)(nil), "cosmos.crypto.multisig.v1beta1.CompactBitArray") -} - -func init() { - proto.RegisterFile("cosmos/crypto/multisig/v1beta1/multisig.proto", fileDescriptor_1177bdf7025769be) -} - -var fileDescriptor_1177bdf7025769be = []byte{ - // 277 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x31, 0x4f, 0x83, 0x40, - 0x14, 0xc7, 0x39, 0xad, 0x0e, 0x97, 0x6a, 0x23, 0xe9, 0x40, 0x1c, 0xae, 0xa4, 0x13, 0x31, 0x01, - 0xd2, 0x98, 0x38, 0x74, 0x13, 0x17, 0x17, 0x17, 0x3a, 0xe9, 0xd2, 0x00, 0xbd, 0x5c, 0x2f, 0x96, - 0x3e, 0x72, 0xef, 0x61, 0xe4, 0x5b, 0x38, 0x3a, 0xea, 0xb7, 0x71, 0x64, 0x74, 0x34, 0xf0, 0x45, - 0x4c, 0xc1, 0x36, 0x4e, 0x77, 0xff, 0xdf, 0xff, 0xf7, 0x86, 0xf7, 0xb8, 0x9f, 0x01, 0xe6, 0x80, - 0x61, 0x66, 0xaa, 0x82, 0x20, 0xcc, 0xcb, 0x0d, 0x69, 0xd4, 0x2a, 0x7c, 0x99, 0xa5, 0x92, 0x92, - 0xd9, 0x01, 0x04, 0x85, 0x01, 0x02, 0x5b, 0xf4, 0x7a, 0xd0, 0xeb, 0xc1, 0xa1, 0xfd, 0xd3, 0x2f, - 0xc7, 0x0a, 0x14, 0x74, 0x6a, 0xb8, 0xfb, 0xf5, 0x53, 0xd3, 0x1b, 0x7e, 0xfe, 0xb0, 0x33, 0x17, - 0x5a, 0x6d, 0x13, 0x2a, 0x8d, 0xb4, 0x05, 0xe7, 0xb8, 0x0f, 0xe8, 0x30, 0xf7, 0xd8, 0x1b, 0xc6, - 0xff, 0xc8, 0x7c, 0x50, 0x7f, 0x4e, 0xd8, 0xf4, 0x91, 0x8f, 0xee, 0x20, 0x2f, 0x92, 0x8c, 0x22, - 0x4d, 0xb7, 0xc6, 0x24, 0x95, 0x7d, 0xc5, 0x2f, 0xe4, 0x2b, 0x99, 0x64, 0x99, 0x6a, 0xc2, 0x25, - 0x12, 0x18, 0xb9, 0x72, 0x98, 0xcb, 0xbc, 0xb3, 0x78, 0xd4, 0x15, 0x91, 0x26, 0x5c, 0x74, 0xd8, - 0x1e, 0xf3, 0x13, 0xb9, 0x91, 0x39, 0x3a, 0x47, 0x2e, 0xf3, 0x86, 0x71, 0x1f, 0xe6, 0x83, 0xf7, - 0x8f, 0x89, 0x15, 0xdd, 0x7f, 0x35, 0x82, 0xd5, 0x8d, 0x60, 0x3f, 0x8d, 0x60, 0x6f, 0xad, 0xb0, - 0xea, 0x56, 0x58, 0xdf, 0xad, 0xb0, 0x9e, 0x02, 0xa5, 0x69, 0x5d, 0xa6, 0x41, 0x06, 0x79, 0xa8, - 0x8d, 0xc6, 0xad, 0xa4, 0xee, 0x5d, 0x97, 0xa9, 0x8f, 0xab, 0x67, 0x5f, 0xc1, 0xfe, 0x58, 0x54, - 0x15, 0x12, 0xd3, 0xd3, 0x6e, 0xc7, 0xeb, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xa4, 0xef, - 0x9a, 0x4a, 0x01, 0x00, 0x00, -} - -func (m *MultiSignature) 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 *MultiSignature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MultiSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Signatures[iNdEx]) - copy(dAtA[i:], m.Signatures[iNdEx]) - i = encodeVarintMultisig(dAtA, i, uint64(len(m.Signatures[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *CompactBitArray) 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 *CompactBitArray) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompactBitArray) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Elems) > 0 { - i -= len(m.Elems) - copy(dAtA[i:], m.Elems) - i = encodeVarintMultisig(dAtA, i, uint64(len(m.Elems))) - i-- - dAtA[i] = 0x12 - } - if m.ExtraBitsStored != 0 { - i = encodeVarintMultisig(dAtA, i, uint64(m.ExtraBitsStored)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintMultisig(dAtA []byte, offset int, v uint64) int { - offset -= sovMultisig(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MultiSignature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - l = len(b) - n += 1 + l + sovMultisig(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CompactBitArray) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ExtraBitsStored != 0 { - n += 1 + sovMultisig(uint64(m.ExtraBitsStored)) - } - l = len(m.Elems) - if l > 0 { - n += 1 + l + sovMultisig(uint64(l)) - } - return n -} - -func sovMultisig(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMultisig(x uint64) (n int) { - return sovMultisig(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MultiSignature) 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 ErrIntOverflowMultisig - } - 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: MultiSignature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MultiSignature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMultisig - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMultisig - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMultisig - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, make([]byte, postIndex-iNdEx)) - copy(m.Signatures[len(m.Signatures)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMultisig(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMultisig - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompactBitArray) 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 ErrIntOverflowMultisig - } - 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: CompactBitArray: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompactBitArray: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtraBitsStored", wireType) - } - m.ExtraBitsStored = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMultisig - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExtraBitsStored |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Elems", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMultisig - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMultisig - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMultisig - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Elems = append(m.Elems[:0], dAtA[iNdEx:postIndex]...) - if m.Elems == nil { - m.Elems = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMultisig(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMultisig - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMultisig(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, ErrIntOverflowMultisig - } - 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, ErrIntOverflowMultisig - } - 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, ErrIntOverflowMultisig - } - 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, ErrInvalidLengthMultisig - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMultisig - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMultisig - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMultisig = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMultisig = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMultisig = fmt.Errorf("proto: unexpected end of group") -) diff --git a/crypto/types/multisig/multisignature.go b/crypto/types/multisig/multisignature.go deleted file mode 100644 index 3e5ca0e3..00000000 --- a/crypto/types/multisig/multisignature.go +++ /dev/null @@ -1,90 +0,0 @@ -package multisig - -import ( - "fmt" - "strings" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/crypto/types" - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// AminoMultisignature is used to represent amino multi-signatures for StdTx's. -// It is assumed that all signatures were made with SIGN_MODE_LEGACY_AMINO_JSON. -// Sigs is a list of signatures, sorted by corresponding index. -type AminoMultisignature struct { - BitArray *types.CompactBitArray - Sigs [][]byte -} - -// NewMultisig returns a new MultiSignatureData -func NewMultisig(n int) *signing.MultiSignatureData { - return &signing.MultiSignatureData{ - BitArray: types.NewCompactBitArray(n), - Signatures: make([]signing.SignatureData, 0, n), - } -} - -// GetIndex returns the index of pk in keys. Returns -1 if not found -func getIndex(pk crypto.PubKey, keys []crypto.PubKey) int { - for i := 0; i < len(keys); i++ { - if pk.Equals(keys[i]) { - return i - } - } - return -1 -} - -// AddSignature adds a signature to the multisig, at the corresponding index. -// If the signature already exists, replace it. -func AddSignature(mSig *signing.MultiSignatureData, sig signing.SignatureData, index int) { - newSigIndex := mSig.BitArray.NumTrueBitsBefore(index) - // Signature already exists, just replace the value there - if mSig.BitArray.GetIndex(index) { - mSig.Signatures[newSigIndex] = sig - return - } - mSig.BitArray.SetIndex(index, true) - // Optimization if the index is the greatest index - if newSigIndex == len(mSig.Signatures) { - mSig.Signatures = append(mSig.Signatures, sig) - return - } - // Expand slice by one with a dummy element, move all elements after i - // over by one, then place the new signature in that gap. - mSig.Signatures = append(mSig.Signatures, &signing.SingleSignatureData{}) - copy(mSig.Signatures[newSigIndex+1:], mSig.Signatures[newSigIndex:]) - mSig.Signatures[newSigIndex] = sig -} - -// AddSignatureFromPubKey adds a signature to the multisig, at the index in -// keys corresponding to the provided pubkey. -func AddSignatureFromPubKey(mSig *signing.MultiSignatureData, sig signing.SignatureData, pubkey crypto.PubKey, keys []crypto.PubKey) error { - if mSig == nil { - return fmt.Errorf("value of mSig is nil %v", mSig) - } - if sig == nil { - return fmt.Errorf("value of sig is nil %v", sig) - } - - if pubkey == nil || keys == nil { - return fmt.Errorf("pubkey or keys can't be nil %v %v", pubkey, keys) - } - index := getIndex(pubkey, keys) - if index == -1 { - keysStr := make([]string, len(keys)) - for i, k := range keys { - keysStr[i] = fmt.Sprintf("%X", k.Bytes()) - } - - return fmt.Errorf("provided key %X doesn't exist in pubkeys: \n%s", pubkey.Bytes(), strings.Join(keysStr, "\n")) - } - - AddSignature(mSig, sig, index) - return nil -} - -func AddSignatureV2(mSig *signing.MultiSignatureData, sig signing.SignatureV2, keys []crypto.PubKey) error { - return AddSignatureFromPubKey(mSig, sig.Data, sig.PubKey, keys) -} diff --git a/crypto/types/multisig/pubkey.go b/crypto/types/multisig/pubkey.go deleted file mode 100644 index cdfe5d2a..00000000 --- a/crypto/types/multisig/pubkey.go +++ /dev/null @@ -1,28 +0,0 @@ -package multisig - -import ( - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// PubKey defines a type which supports multi-signature verification via MultiSignatureData -// which supports multiple SignMode's. -type PubKey interface { - crypto.PubKey - - // VerifyMultisignature verifies the provide multi-signature represented by MultiSignatureData - // using getSignBytes to retrieve the sign bytes to verify against for the provided mode. - VerifyMultisignature(getSignBytes GetSignBytesFunc, sig *signing.MultiSignatureData) error - - // GetPubKeys returns the crypto.PubKey's nested within the multi-sig PubKey - GetPubKeys() []crypto.PubKey - - // GetThreshold returns the threshold number of signatures that must be obtained to verify a signature. - GetThreshold() uint -} - -// GetSignBytesFunc defines a function type which returns sign bytes for a given SignMode or an error. -// It will generally be implemented as a closure which wraps whatever signable object signatures are -// being verified against. -type GetSignBytesFunc func(mode signing.SignMode) ([]byte, error) diff --git a/crypto/types/types.go b/crypto/types/types.go deleted file mode 100644 index bce35d71..00000000 --- a/crypto/types/types.go +++ /dev/null @@ -1,30 +0,0 @@ -package types - -import ( - proto "github.com/gogo/protobuf/proto" - tmcrypto "github.com/tendermint/tendermint/crypto" -) - -// PubKey interface extends proto.Message -// and tendermint crypto.PubKey -type PubKey interface { - proto.Message - tmcrypto.PubKey -} - -// PrivKey interface extends proto.Message -// and tendermint crypto.PrivKey -type PrivKey interface { - proto.Message - tmcrypto.PrivKey -} - -type ( - Address = tmcrypto.Address -) - -// IntoTmPubKey allows our own PubKey types be converted into Tendermint's -// pubkey types. -type IntoTmPubKey interface { - AsTmPubKey() tmcrypto.PubKey -} diff --git a/doc.go b/doc.go deleted file mode 100644 index 2cf9d74a..00000000 --- a/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -// Package client is the entrance of the entire SDK function. SDKConfig is used to configure SDK parameters. -// -// The SDK mainly provides the functions of the following modules, including: -// asset, bank, distribution, gov, keys, oracle, random, service, slashing, staking -// -// As a quick start: -// -// fees, err := types.ParseCoins("1iris") -// if err != nil { -// panic(err) -// } -// -// client := sdk.NewClient(types.ClientConfig{ -// NodeURI: NodeURI, -// Network: Network, -// ChainID: ChainID, -// Gas: Gas, -// Fee: fees, -// Mode: Mode, -// Online: Online, -// StoreType: types.PrivKey, -// Level: "debug", -// }) -package sdk diff --git a/go.mod b/go.mod deleted file mode 100644 index eb295763..00000000 --- a/go.mod +++ /dev/null @@ -1,34 +0,0 @@ -module github.com/irisnet/irishub-sdk-go - -go 1.15 - -require ( - github.com/DataDog/zstd v1.4.5 // indirect - github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833 - github.com/btcsuite/btcd v0.21.0-beta - github.com/btcsuite/btcutil v1.0.2 - github.com/cosmos/go-bip39 v1.0.0 - github.com/dgraph-io/ristretto v0.0.3 // indirect - github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/gogo/protobuf v1.3.3 - github.com/golang/protobuf v1.4.3 - github.com/golang/snappy v0.0.2 // indirect - github.com/magiconair/properties v1.8.4 - github.com/pkg/errors v0.9.1 - github.com/prometheus/common v0.15.0 // indirect - github.com/regen-network/cosmos-proto v0.3.1 - github.com/sirupsen/logrus v1.6.0 - github.com/stretchr/objx v0.2.0 // indirect - github.com/stretchr/testify v1.7.0 - github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 - github.com/tendermint/go-amino v0.16.0 - github.com/tendermint/tendermint v0.34.8 - github.com/tendermint/tm-db v0.6.4 - golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad - google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f - google.golang.org/grpc v1.35.0 - google.golang.org/protobuf v1.25.0 - gopkg.in/yaml.v2 v2.4.0 -) - -replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/integration_test/bank_test.go b/integration_test/bank_test.go deleted file mode 100644 index 9064aef0..00000000 --- a/integration_test/bank_test.go +++ /dev/null @@ -1,185 +0,0 @@ -package integration_test - -import ( - "encoding/json" - "fmt" - "math/rand" - "sync" - "time" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/bank" - "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestBank() { - cases := []SubTest{ - { - "TestQueryAccount", - queryAccount, - }, - { - "TestSend", - send, - }, - { - "TestMultiSend", - multiSend, - }, - { - "TestSimulate", - simulate, - }, - { - "TestSendWitchSpecAccountInfo", - sendWitchSpecAccountInfo, - }, - } - - for _, t := range cases { - s.Run(t.testName, func() { - t.testCase(s) - }) - } -} - -func queryAccount(s IntegrationTestSuite) { - account, err := s.Bank.QueryAccount(s.Account().Address.String()) - s.NoError(err) - s.NotEmpty(account) - bz, _ := json.Marshal(account) - fmt.Println(string(bz)) -} - -func send(s IntegrationTestSuite) { - coins, err := types.ParseDecCoins("10iris") - s.NoError(err) - to := s.GetRandAccount().Address.String() - - ch := make(chan int) - s.Bank.SubscribeSendTx(s.Account().Address.String(), to, func(send bank.EventDataMsgSend) { - ch <- 1 - }) - - baseTx := types.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "TEST", - Mode: types.Commit, - Password: s.Account().Password, - } - - res, err := s.Bank.Send(to, coins, baseTx) - s.NoError(err) - s.NotEmpty(res.Hash) - time.Sleep(1 * time.Second) - - resp, err := s.Manager().QueryTx(res.Hash) - s.NoError(err) - s.Equal(resp.Result.Code, uint32(0)) - s.Equal(resp.Height, res.Height) - - <-ch -} - -func multiSend(s IntegrationTestSuite) { - baseTx := types.BaseTx{ - From: s.Account().Name, - Gas: 2000000, - Memo: "test", - Mode: types.Commit, - Password: s.Account().Password, - } - - coins, err := types.ParseDecCoins("1000iris") - s.NoError(err) - - accNum := 11 - acc := make([]string, accNum) - receipts := make([]bank.Receipt, accNum) - for i := 0; i < accNum; i++ { - acc[i] = s.RandStringOfLength(10) - addr, _, err := s.Key.Add(acc[i], "1234567890") - - s.NoError(err) - s.NotEmpty(addr) - - receipts[i] = bank.Receipt{ - Address: addr, - Amount: coins, - } - } - - _, err = s.Bank.MultiSend(bank.MultiSendRequest{Receipts: receipts}, baseTx) - s.NoError(err) - - coins, err = types.ParseDecCoins("1iris") - s.NoError(err) - to := s.GetRandAccount().Address.String() - begin := time.Now() - var wait sync.WaitGroup - for i := 1; i < 5; i++ { - wait.Add(1) - index := rand.Intn(accNum) - go func() { - defer wait.Done() - _, err := s.Bank.Send(to, coins, types.BaseTx{ - From: acc[index], - Gas: 200000, - Memo: "test", - Mode: types.Commit, - Password: "1234567890", - }) - s.NoError(err) - }() - } - wait.Wait() - end := time.Now() - fmt.Printf("total senconds:%s\n", end.Sub(begin).String()) -} - -func simulate(s IntegrationTestSuite) { - coins, err := types.ParseDecCoins("10iris") - s.NoError(err) - to := s.GetRandAccount().Address.String() - baseTx := types.BaseTx{ - From: s.Account().Name, - Password: s.Account().Password, - Gas: 200000, - Memo: "test", - Mode: types.Commit, - Simulate: true, - } - - result, err := s.Bank.Send(to, coins, baseTx) - s.NoError(err) - s.Greater(result.GasWanted, int64(0)) - fmt.Println(result) -} - -func sendWitchSpecAccountInfo(s IntegrationTestSuite) { - for i := 0; i < 10; i++ { - coins, err := types.ParseDecCoins("10iris") - baseTx := types.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Fee: coins, - Memo: "TEST", - Mode: types.Commit, - Password: s.Account().Password, - } - - curAccount, err := s.Bank.QueryAccount(s.Account().Address.String()) - require.NoError(s.T(), err) - - accountNumber := curAccount.AccountNumber - sequence := curAccount.Sequence - randomAddr := s.GetRandAccount().Address.String() - amount, _ := types.ParseDecCoins("10iris") - - res, err := s.Bank.SendWitchSpecAccountInfo(randomAddr, sequence, accountNumber, amount, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - } -} diff --git a/integration_test/coinswap_test.go b/integration_test/coinswap_test.go deleted file mode 100644 index 00dbb9ae..00000000 --- a/integration_test/coinswap_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package integration_test - -import ( - "time" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/coinswap" - "github.com/irisnet/irishub-sdk-go/modules/token" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestCoinSwap() { - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - issueTokenReq := token.IssueTokenRequest{ - Symbol: "bnb", - Name: s.RandStringOfLength(8), - Scale: 6, - MinUnit: "ubnb", - InitialSupply: 10000000, - MaxSupply: 21000000, - Mintable: true, - } - - result, er := s.Token.IssueToken(issueTokenReq, baseTx) - require.NoError(s.T(), er) - require.NotEmpty(s.T(), result.Hash) - - request := coinswap.AddLiquidityRequest{ - MaxToken: sdk.Coin{ - Denom: "ubnb", - Amount: sdk.NewInt(1000_000_000), - }, - BaseAmt: sdk.NewInt(1000_000_000), - MinLiquidity: sdk.NewInt(1000_000_000), - Deadline: time.Now().Add(time.Hour).Unix(), - } - - res, err := s.Swap.AddLiquidity(request, baseTx) - require.NoError(s.T(), err) - require.True(s.T(), res.Liquidity.GTE(request.MinLiquidity)) - require.NotEmpty(s.T(), res.TxHash) - require.True(s.T(), request.MaxToken.Amount.GTE(res.TokenAmt)) - - boughtCoin := sdk.NewCoin("uiris", sdk.NewInt(100)) - deadline := time.Now().Add(10 * time.Second).Unix() - resp, err := s.Swap.BuyTokenWithAutoEstimate("ubnb", boughtCoin, deadline, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), resp.TxHash) - require.True(s.T(), resp.InputAmt.Equal(sdk.NewInt(101))) - - soldCoin := sdk.NewCoin("uiris", sdk.NewInt(100)) - resp, err = s.Swap.SellTokenWithAutoEstimate("ubnb", soldCoin, deadline, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), resp.TxHash) - require.True(s.T(), resp.OutputAmt.Equal(sdk.NewInt(99))) -} diff --git a/integration_test/gov_test.go b/integration_test/gov_test.go deleted file mode 100644 index 1ded3a60..00000000 --- a/integration_test/gov_test.go +++ /dev/null @@ -1,131 +0,0 @@ -package integration_test - -import ( - "encoding/json" - "fmt" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/gov" - "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestGov() { - cases := []SubTest{ - { - "TestGov", - testGov, - }, - - { - "TestParams", - testParams, - }, - } - - for _, t := range cases { - s.Run(t.testName, func() { - t.testCase(s) - }) - } - -} - -func testGov(s IntegrationTestSuite) { - baseTx := types.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "TEST", - Mode: types.Commit, - Password: s.Account().Password, - } - - // send submitProposal tx - submitProposalReq := gov.SubmitProposalRequest{ - Title: s.RandStringOfLength(4), - Description: s.RandStringOfLength(6), - Type: "Text", - } - proposalId, res, err := s.Gov.SubmitProposal(submitProposalReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - // query proposal details based on ProposalID. - proposal, err := s.Gov.QueryProposal(proposalId) - require.NoError(s.T(), err) - require.Equal(s.T(), proposal.ProposalId, proposalId) - require.Equal(s.T(), "PROPOSAL_STATUS_DEPOSIT_PERIOD", proposal.Status) - - // query all proposals based on given status. - proposalStatus := proposal.Status - proposals, err := s.Gov.QueryProposals(proposalStatus) - var exists bool - require.NoError(s.T(), err) - require.NotEmpty(s.T(), proposals) - for _, proposal := range proposals { - if proposal.ProposalId == proposalId { - exists = true - } - } - require.True(s.T(), exists) - - // send Deposit tx - amount, e := types.ParseDecCoins("2000iris") - require.NoError(s.T(), e) - depositReq := gov.DepositRequest{ - ProposalId: proposalId, - Amount: amount, - } - res, err = s.Gov.Deposit(depositReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - // query single deposit information based proposalID, depositAddr. - depositor := s.Account().Address.String() - deposit, err := s.Gov.QueryDeposit(proposalId, depositor) - require.NoError(s.T(), err) - require.Equal(s.T(), "2000000000uiris", deposit.Amount.String()) - - // query all deposits of a single proposal. - deposits, err := s.Gov.QueryDeposits(proposalId) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), deposits) - for _, deposit := range deposits { - require.Equal(s.T(), proposalId, deposit.ProposalId) - } - - // send vote tx - voteReq := gov.VoteRequest{ - ProposalId: proposalId, - Option: "VOTE_OPTION_YES", - } - res, err = s.Gov.Vote(voteReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - // query voted information based on proposalID, voterAddr. - voter := s.Account().Address.String() - vote, err := s.Gov.QueryVote(proposalId, voter) - require.NoError(s.T(), err) - require.Equal(s.T(), proposalId, vote.ProposalId) - - // query votes of a given proposal. - votes, err := s.Gov.QueryVotes(proposalId) - require.NoError(s.T(), err) - require.Greater(s.T(), len(votes), 0) - - // query the tally of a proposal vote. - _, err = s.Gov.QueryTallyResult(proposalId) - require.NoError(s.T(), err) -} - -func testParams(s IntegrationTestSuite) { - paramsTypes := []string{"voting", "tallying", "deposit"} - for _, paramType := range paramsTypes { - res, err := s.Gov.QueryParams(paramType) - require.NoError(s.T(), err) - bz, e := json.Marshal(res) - require.NoError(s.T(), e) - fmt.Println(string(bz)) - } -} diff --git a/integration_test/htlc_test.go b/integration_test/htlc_test.go deleted file mode 100644 index f632f887..00000000 --- a/integration_test/htlc_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package integration_test - -import ( - "encoding/hex" - "encoding/json" - "fmt" - - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/tmhash" - - "github.com/irisnet/irishub-sdk-go/modules/htlc" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestHTLC() { - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - amount, err := sdk.ParseDecCoins("10iris") - require.NoError(s.T(), err) - secret := s.GetSecret() - hashLock := s.GetHashLock(secret, 0) - fmt.Println("hashLock: " + hashLock) - fmt.Println("secret: " + secret) - receiverOnOtherChain := "0x" + s.RandStringOfLength(14) - - to := s.GetRandAccount().Address - createHTLCRequest := htlc.CreateHTLCRequest{ - To: to.String(), - ReceiverOnOtherChain: receiverOnOtherChain, - Amount: amount, - HashLock: hashLock, - } - res, err := s.HTLC.CreateHTLC(createHTLCRequest, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - hashLockBytes, _ := hex.DecodeString(hashLock) - minCoins, _ := s.ToMinCoin(amount...) - htlcId := hex.EncodeToString(tmhash.Sum(append(append(append(hashLockBytes, s.Account().Address...), to...), []byte(minCoins.Sort().String())...))) - - queryHTLCResp, err := s.HTLC.QueryHTLC(htlcId) - require.NoError(s.T(), err) - require.Equal(s.T(), receiverOnOtherChain, queryHTLCResp.ReceiverOnOtherChain) - - res, err = s.HTLC.ClaimHTLC(htlcId, secret, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) -} - -// GetHashLock calculates the hash lock from the given secret and timestamp -func (s IntegrationTestSuite) GetHashLock(secret string, timestamp uint64) string { - secretBz, _ := hex.DecodeString(secret) - if timestamp > 0 { - return string(tmhash.Sum(append(secretBz, sdk.Uint64ToBigEndian(timestamp)...))) - } - sum := tmhash.Sum(secretBz) - return hex.EncodeToString(sum) -} - -func (s IntegrationTestSuite) GetSecret() string { - random := s.RandStringOfLength(10) - sum := tmhash.Sum([]byte(random)) - return hex.EncodeToString(sum) -} - -func (s IntegrationTestSuite) TestQueryParams() { - res, err := s.HTLC.QueryParams() - require.NoError(s.T(), err) - data, _ := json.Marshal(res) - fmt.Println(string(data)) -} diff --git a/integration_test/integration_test.go b/integration_test/integration_test.go deleted file mode 100644 index 763c2a30..00000000 --- a/integration_test/integration_test.go +++ /dev/null @@ -1,133 +0,0 @@ -package integration_test - -import ( - "io/ioutil" - "math/rand" - "os" - "path/filepath" - "testing" - "time" - - sdk "github.com/irisnet/irishub-sdk-go" - "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/store" - "github.com/irisnet/irishub-sdk-go/utils/log" - - "github.com/stretchr/testify/suite" -) - -const ( - nodeURI = "tcp://localhost:26657" - grpcAddr = "localhost:9090" - chainID = "test" - charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - addr = "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx" -) - -type IntegrationTestSuite struct { - suite.Suite - sdk.IRISHUBClient - r *rand.Rand - rootAccount MockAccount - randAccounts []MockAccount -} - -type SubTest struct { - testName string - testCase func(s IntegrationTestSuite) -} - -// MockAccount define a account for test -type MockAccount struct { - Name, Password string - Address types.AccAddress -} - -func TestSuite(t *testing.T) { - suite.Run(t, new(IntegrationTestSuite)) -} - -func (s *IntegrationTestSuite) SetupSuite() { - options := []types.Option{ - types.KeyDAOOption(store.NewMemory(nil)), - types.TimeoutOption(10), - } - cfg, err := types.NewClientConfig(nodeURI, grpcAddr, chainID, options...) - if err != nil { - panic(err) - } - - s.IRISHUBClient = sdk.NewIRISHUBClient(cfg) - s.r = rand.New(rand.NewSource(time.Now().UnixNano())) - s.rootAccount = MockAccount{ - Name: "validator", - Password: "1234567890", - Address: types.MustAccAddressFromBech32(addr), - } - s.SetLogger(log.NewLogger(log.Config{ - Format: log.FormatJSON, - Level: log.DebugLevel, - })) - s.initAccount() -} - -func (s *IntegrationTestSuite) initAccount() { - _, err := s.Key.Import( - s.Account().Name, - s.Account().Password, - string(getPrivKeyArmor()), - ) - if err != nil { - panic(err) - } - - //var receipts bank.Receipts - for i := 0; i < 5; i++ { - name := s.RandStringOfLength(10) - pwd := s.RandStringOfLength(16) - address, _, err := s.Key.Add(name, "11111111") - if err != nil { - panic("generate test account failed") - } - - s.randAccounts = append(s.randAccounts, MockAccount{ - Name: name, - Password: pwd, - Address: types.MustAccAddressFromBech32(address), - }) - } -} - -// RandStringOfLength return a random string -func (s *IntegrationTestSuite) RandStringOfLength(l int) string { - var result []byte - bytes := []byte(charset) - for i := 0; i < l; i++ { - result = append(result, bytes[s.r.Intn(len(bytes))]) - } - return string(result) -} - -// GetRandAccount return a random test account -func (s *IntegrationTestSuite) GetRandAccount() MockAccount { - return s.randAccounts[s.r.Intn(len(s.randAccounts))] -} - -// Account return a test account -func (s *IntegrationTestSuite) Account() MockAccount { - return s.rootAccount -} - -func getPrivKeyArmor() []byte { - path, err := os.Getwd() - if err != nil { - panic(err) - } - path = filepath.Dir(path) - path = filepath.Join(path, "integration_test/scripts/priv.key") - bz, err := ioutil.ReadFile(path) - if err != nil { - panic(err) - } - return bz -} diff --git a/integration_test/nft_test.go b/integration_test/nft_test.go deleted file mode 100644 index 50e642b4..00000000 --- a/integration_test/nft_test.go +++ /dev/null @@ -1,147 +0,0 @@ -package integration_test - -import ( - "fmt" - "strings" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/nft" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestNFT() { - - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - denomID := strings.ToLower(s.RandStringOfLength(4)) - denomName := strings.ToLower(s.RandStringOfLength(4)) - schema := strings.ToLower(s.RandStringOfLength(10)) - issueReq := nft.IssueDenomRequest{ - ID: denomID, - Name: denomName, - Schema: schema, - } - - msg := &nft.MsgIssueDenom{ - Id: denomID, - Name: denomName, - Schema: schema, - Sender: addr, - } - txhash, err := s.BuildTxHash([]sdk.Msg{msg}, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), txhash) - fmt.Println(txhash) - - res, err := s.NFT.IssueDenom(issueReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - fmt.Println(res.Hash) - - tokenID := strings.ToLower(s.RandStringOfLength(7)) - tokenName := strings.ToLower(s.RandStringOfLength(7)) - tokenData := strings.ToLower(s.RandStringOfLength(7)) - mintReq := nft.MintNFTRequest{ - Denom: denomID, - ID: tokenID, - Name: tokenName, - URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), - Data: tokenData, - } - res, err = s.NFT.MintNFT(mintReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - editReq := nft.EditNFTRequest{ - Denom: mintReq.Denom, - ID: mintReq.ID, - URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), - } - res, err = s.NFT.EditNFT(editReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - nftRes, err := s.NFT.QueryNFT(mintReq.Denom, mintReq.ID) - require.NoError(s.T(), err) - require.Equal(s.T(), editReq.URI, nftRes.URI) - - supply, err := s.NFT.QuerySupply(mintReq.Denom, nftRes.Creator) - require.NoError(s.T(), err) - require.Equal(s.T(), uint64(1), supply) - - owner, err := s.NFT.QueryOwner(nftRes.Creator, mintReq.Denom) - require.NoError(s.T(), err) - require.Len(s.T(), owner.IDCs, 1) - require.Len(s.T(), owner.IDCs[0].TokenIDs, 1) - require.Equal(s.T(), tokenID, owner.IDCs[0].TokenIDs[0]) - - uName := s.RandStringOfLength(10) - pwd := "11111111" - - recipient, _, err := s.Key.Add(uName, pwd) - require.NoError(s.T(), err) - - transferReq := nft.TransferNFTRequest{ - Recipient: recipient, - Denom: mintReq.Denom, - ID: mintReq.ID, - URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), - } - res, err = s.NFT.TransferNFT(transferReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - owner, err = s.NFT.QueryOwner(transferReq.Recipient, mintReq.Denom) - require.NoError(s.T(), err) - require.Len(s.T(), owner.IDCs, 1) - require.Len(s.T(), owner.IDCs[0].TokenIDs, 1) - require.Equal(s.T(), tokenID, owner.IDCs[0].TokenIDs[0]) - - supply, err = s.NFT.QuerySupply(mintReq.Denom, transferReq.Recipient) - require.NoError(s.T(), err) - require.Equal(s.T(), uint64(1), supply) - - denoms, err := s.NFT.QueryDenoms() - require.NoError(s.T(), err) - require.NotEmpty(s.T(), denoms) - - d, err := s.NFT.QueryDenom(denomID) - require.NoError(s.T(), err) - require.Equal(s.T(), denomID, d.ID) - require.Equal(s.T(), denomName, d.Name) - require.Equal(s.T(), schema, d.Schema) - - col, err := s.NFT.QueryCollection(denomID) - require.NoError(s.T(), err) - require.EqualValues(s.T(), d, col.Denom) - require.Len(s.T(), col.NFTs, 1) - require.Equal(s.T(), mintReq.ID, col.NFTs[0].ID) - - burnReq := nft.BurnNFTRequest{ - Denom: mintReq.Denom, - ID: mintReq.ID, - } - - amount, e := sdk.ParseDecCoins("10iris") - require.NoError(s.T(), e) - _, err = s.Bank.Send(recipient, amount, baseTx) - require.NoError(s.T(), err) - - baseTx.From = uName - baseTx.Password = pwd - res, err = s.NFT.BurnNFT(burnReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - supply, err = s.NFT.QuerySupply(mintReq.Denom, transferReq.Recipient) - require.NoError(s.T(), err) - require.Equal(s.T(), uint64(0), supply) - -} diff --git a/integration_test/oracle_test.go b/integration_test/oracle_test.go deleted file mode 100644 index 04311d11..00000000 --- a/integration_test/oracle_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package integration_test - -import ( - "fmt" - "time" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/oracle" - "github.com/irisnet/irishub-sdk-go/modules/service" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var serviceName = generateServiceName() - -func (s *IntegrationTestSuite) SetupService(ch chan<- int) { - schemas := `{"input":{"type":"object"},"output":{"type":"object"},"error":{"type":"object"}}` - pricing := `{"price":"1uiris"}` - output := `{"header":{},"body":{"last":"100"}}` - testResult := `{"code":200,"message":""}` - - coin, _ := sdk.ParseDecCoins("4iris") - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Fee: coin, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - definition := service.DefineServiceRequest{ - ServiceName: serviceName, - Description: "this is a test service", - Tags: nil, - AuthorDescription: "service provider", - Schemas: schemas, - } - - _, err := s.Service.DefineService(definition, baseTx) - require.NoError(s.T(), err) - deposit, _ := sdk.ParseDecCoins("6000iris") - binding := service.BindServiceRequest{ - ServiceName: definition.ServiceName, - Deposit: deposit, - Pricing: pricing, - QoS: 10, - Options: `{}`, - } - _, err = s.Service.BindService(binding, baseTx) - require.NoError(s.T(), err) - - _, err = s.Service.SubscribeServiceRequest( - definition.ServiceName, - func(reqCtxID, reqID, input string) (string, string) { - s.Logger().Info("Service received request", "input", input, "reqCtxID", reqCtxID, "reqID", reqID, "output", output) - ch <- 1 - return output, testResult - }, baseTx) - - require.NoError(s.T(), err) -} - -func (s IntegrationTestSuite) TestOracle() { - var ch = make(chan int) - s.SetupService(ch) - - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - input := `{"header":{},"body":{"pair":"iris-usdt"}}` - feedName := generateFeedName(serviceName) - serviceFeeCap, _ := sdk.ParseDecCoins("1000iris") - - sender := s.Account().Address - createReq := oracle.CreateFeedRequest{ - FeedName: feedName, - LatestHistory: 5, - Description: "fetch USDT-CNY ", - ServiceName: serviceName, - Providers: []string{sender.String()}, - Input: input, - Timeout: 50, - ServiceFeeCap: serviceFeeCap, - RepeatedFrequency: 50, - AggregateFunc: "avg", - ValueJsonPath: "last", - ResponseThreshold: 1, - } - - cfrs, err := s.Oracle.CreateFeed(createReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), cfrs.Hash) - - sfrs, err := s.Oracle.StartFeed(feedName, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), sfrs.Hash) - - select { - case <-ch: - - time.Sleep(2 * time.Second) - - feedValuesRep, err := s.Oracle.QueryFeedValue(feedName) - require.NoError(s.T(), err) - s.Logger().Info("Query feed value", "feedName", feedName, "result", feedValuesRep) - - editReq := oracle.EditFeedRequest{ - FeedName: feedName, - LatestHistory: 5, - Description: "fetch USDT-CNY ", - Timeout: 3, - ServiceFeeCap: serviceFeeCap, - ResponseThreshold: 1, - RepeatedFrequency: 5, - Providers: []string{sender.String()}, - } - - efrs, err := s.Oracle.EditFeed(editReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), efrs.Hash) - - pfrs, err := s.Oracle.PauseFeed(feedName, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), pfrs.Hash) - - feedRep, err := s.Oracle.QueryFeed(feedName) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), feedRep) - - feedsRep, err := s.Oracle.QueryFeeds("PAUSED") - require.NoError(s.T(), err) - require.NotEmpty(s.T(), feedsRep) - require.Equal(s.T(), int32(service.PAUSED), feedRep.State) - } -} - -func generateServiceName() string { - return fmt.Sprintf("service-%d", time.Now().Nanosecond()) -} - -func generateFeedName(serviceName string) string { - return fmt.Sprintf("feed-%s", serviceName) -} diff --git a/integration_test/random_test.go b/integration_test/random_test.go deleted file mode 100644 index 1a8d2df2..00000000 --- a/integration_test/random_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package integration_test - -import ( - "strconv" - "time" - - "github.com/irisnet/irishub-sdk-go/modules/random" - "github.com/irisnet/irishub-sdk-go/types" -) - -type TestRandom struct { - reqId string - generateHeight int64 -} - -var testRandom TestRandom - -func (s IntegrationTestSuite) TestRandom() { - - cases := []SubTest{ - { - "TestRequestRandom", - requestRandom, - }, - { - "TestQueryRandom", - queryRandom, - }, - { - "TestQueryRandomRequestQueue", - queryRandomRequestQueue, - }, - } - - for _, t := range cases { - s.Run(t.testName, func() { - t.testCase(s) - }) - } -} - -func requestRandom(s IntegrationTestSuite) { - baseTx := types.BaseTx{ - From: s.Account().Name, - Password: s.Account().Password, - Gas: 200000, - Memo: "test", - Mode: types.Commit, - } - serviceFeeCap, err := types.ParseCoins("10iris") - s.NoError(err) - - req := random.RequestRandomRequest{ - BlockInterval: 0, - Oracle: false, - ServiceFeeCap: serviceFeeCap, - } - - resp, res, err := s.Random.RequestRandom(req, baseTx) - s.NoError(err) - s.NotEmpty(res.Hash) - s.Len(resp.ReqID, 64) - s.Greater(resp.Height, int64(0)) - - testRandom.reqId = resp.ReqID - testRandom.generateHeight = resp.Height -} - -func queryRandom(s IntegrationTestSuite) { - // Wait for the transaction to be packaged into the block - time.Sleep(10 * time.Second) - res, err := s.Random.QueryRandom(testRandom.reqId) - s.NoError(err) - s.NotEmpty(res.RequestTxHash) - value, _ := strconv.ParseFloat(res.Value, 10) - s.Greater(value, float64(0)) -} - -func queryRandomRequestQueue(s IntegrationTestSuite) { - _, err := s.Random.QueryRandomRequestQueue(testRandom.generateHeight) - s.NoError(err) - //s.NotEmpty(queue) -} diff --git a/integration_test/record_test.go b/integration_test/record_test.go deleted file mode 100644 index ce4fbc4e..00000000 --- a/integration_test/record_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package integration_test - -import ( - "fmt" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/record" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestRecord() { - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - num := 5 - contents := make([]record.Content, num) - for i := 0; i < num; i++ { - contents[i] = record.Content{ - Digest: s.RandStringOfLength(10), - DigestAlgo: s.RandStringOfLength(5), - URI: fmt.Sprintf("https://%s", s.RandStringOfLength(10)), - Meta: s.RandStringOfLength(20), - } - } - - req := record.CreateRecordRequest{ - Contents: contents, - } - - recordID, err := s.Record.CreateRecord(req, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), recordID) - - request := record.QueryRecordReq{ - RecordID: recordID, - Prove: true, - Height: 0, - } - - result, err := s.Record.QueryRecord(request) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), result.Record.Contents) - - for i := 0; i < num; i++ { - require.EqualValues(s.T(), contents[i], result.Record.Contents[i]) - } -} diff --git a/integration_test/scripts/Dockerfile b/integration_test/scripts/Dockerfile deleted file mode 100644 index e5962c2e..00000000 --- a/integration_test/scripts/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM irisnet/irishub:latest - -COPY . /scripts - -RUN sh /scripts/setup.sh - -EXPOSE 26657 -EXPOSE 9090 - -CMD iris start \ No newline at end of file diff --git a/integration_test/scripts/build.sh b/integration_test/scripts/build.sh deleted file mode 100755 index bbadf696..00000000 --- a/integration_test/scripts/build.sh +++ /dev/null @@ -1 +0,0 @@ -docker build -t irishub-sdk-go . \ No newline at end of file diff --git a/integration_test/scripts/clean.sh b/integration_test/scripts/clean.sh deleted file mode 100755 index 6d6b3604..00000000 --- a/integration_test/scripts/clean.sh +++ /dev/null @@ -1,2 +0,0 @@ -docker stop irishub-sdk-go-test -docker rmi irishub-sdk-go \ No newline at end of file diff --git a/integration_test/scripts/node/config/app.toml b/integration_test/scripts/node/config/app.toml deleted file mode 100644 index 2d320877..00000000 --- a/integration_test/scripts/node/config/app.toml +++ /dev/null @@ -1,151 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Base Configuration ### -############################################################################### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "0.000006uiris" - -# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals -# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals -# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' -pruning = "default" - -# These are applied if and only if the pruning strategy is custom. -pruning-interval = "0" -pruning-keep-every = "0" -pruning-keep-recent = "0" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-time = 0 - -# MinRetainBlocks defines the minimum block height offset from the current -# block being committed, such that all blocks past this offset are pruned -# from Tendermint. It is used as part of the process of determining the -# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates -# that no blocks should be pruned. -# -# This configuration value is only responsible for pruning Tendermint blocks. -# It has no bearing on application state pruning which is determined by the -# "pruning-*" configurations. -# -# Note: Tendermint block pruning is dependant on this parameter in conunction -# with the unbonding (safety threshold) period, state pruning and state sync -# snapshot parameters to determine the correct minimum value of -# ResponseCommit.RetainHeight. -min-retain-blocks = 0 - -# InterBlockCache enables inter-block caching. -inter-block-cache = true - -# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, -# which informs Tendermint what to index. If empty, all events will be indexed. -# -# Example: -# ["message.sender", "message.recipient"] -index-events = [] - -############################################################################### -### Telemetry Configuration ### -############################################################################### - -[telemetry] - -# Prefixed with keys to separate services. -service-name = "" - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled = false - -# Enable prefixing gauge values with hostname. -enable-hostname = false - -# Enable adding hostname to labels. -enable-hostname-label = false - -# Enable adding service to labels. -enable-service-label = false - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 0 - -# GlobalLabels defines a global set of name/value label tuples applied to all -# metrics emitted using the wrapper functions defined in telemetry package. -# -# Example: -# [["chain_id", "cosmoshub-1"]] -global-labels = [] - -############################################################################### -### API Configuration ### -############################################################################### - -[api] - -# Enable defines if the API server should be enabled. -enable = true - -# Swagger defines if swagger documentation should automatically be registered. -swagger = false - -# Address defines the API server to listen on. -address = "tcp://0.0.0.0:1317" - -# MaxOpenConnections defines the number of maximum open connections. -max-open-connections = 1000 - -# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). -rpc-read-timeout = 10 - -# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). -rpc-write-timeout = 0 - -# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). -rpc-max-body-bytes = 1000000 - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enabled-unsafe-cors = false - -############################################################################### -### gRPC Configuration ### -############################################################################### - -[grpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the gRPC server address to bind to. -address = "0.0.0.0:9090" - -############################################################################### -### State Sync Configuration ### -############################################################################### - -# State sync snapshots allow other nodes to rapidly join the network without replaying historical -# blocks, instead downloading and applying a snapshot of the application state at a given height. -[state-sync] - -# snapshot-interval specifies the block interval at which local state sync snapshots are -# taken (0 to disable). Must be a multiple of pruning-keep-every. -snapshot-interval = 0 - -# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). -snapshot-keep-recent = 2 diff --git a/integration_test/scripts/node/config/config.toml b/integration_test/scripts/node/config/config.toml deleted file mode 100644 index 1daf37a6..00000000 --- a/integration_test/scripts/node/config/config.toml +++ /dev/null @@ -1,392 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or -# relative to the home directory (e.g. "data"). The home directory is -# "$HOME/.tendermint" by default, but could be changed via $TMHOME env variable -# or --home cmd flag. - -####################################################################### -### Main Base Config Options ### -####################################################################### - -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "node0" - -# If this node is many blocks behind the tip of the chain, FastSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -fast_sync = true - -# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb -# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) -# - pure go -# - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -# * rocksdb (uses github.com/tecbot/gorocksdb) -# - EXPERIMENTAL -# - requires gcc -# - use rocksdb build tag (go build -tags rocksdb) -# * badgerdb (uses github.com/dgraph-io/badger) -# - EXPERIMENTAL -# - use badgerdb build tag (go build -tags badgerdb) -db_backend = "goleveldb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "info" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_key_file = "config/priv_validator_key.json" - -# Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "data/priv_validator_state.json" - -# TCP or UNIX socket address for Tendermint to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -node_key_file = "config/node_key.json" - -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - -# If true, query the ABCI app on connecting to a new peer -# so the app can decide if we should keep the connection or not -filter_peers = false - -####################################################################### -### Advanced Configuration Options ### -####################################################################### - -####################################################### -### RPC Server Configuration Options ### -####################################################### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://0.0.0.0:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = [] - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = ["HEAD", "GET", "POST"] - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"] - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -# Maximum number of unique clientIDs that can /subscribe -# If you're using /broadcast_tx_commit, set to the estimated maximum number -# of broadcast_tx_commit calls per block. -max_subscription_clients = 100 - -# Maximum number of unique queries a given client can /subscribe to -# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to -# the estimated # maximum number of broadcast_tx_commit calls per block. -max_subscriptions_per_client = 5 - -# How long to wait for a tx to be committed during /broadcast_tx_commit. -# WARNING: Using a value larger than 10s will result in increasing the -# global HTTP write timeout, which applies to all connections and endpoints. -# See https://github.com/tendermint/tendermint/issues/3435 -timeout_broadcast_tx_commit = "10s" - -# Maximum size of request body, in bytes -max_body_bytes = 1000000 - -# Maximum size of request header, in bytes -max_header_bytes = 1048576 - -# The path to a file containing certificate that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# If the certificate is signed by a certificate authority, -# the certFile should be the concatenation of the server's certificate, any intermediates, -# and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_cert_file = "" - -# The path to a file containing matching private key that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_key_file = "" - -# pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "localhost:6060" - -####################################################### -### P2P Configuration Options ### -####################################################### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "" - -# UPNP port forwarding -upnp = false - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# List of node IDs, to which a connection will be (re)established ignoring any existing limits -unconditional_peer_ids = "" - -# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) -persistent_peers_max_dial_period = "0s" - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be sent, in bytes/second -send_rate = 5120000 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = false - -# Peer connection configuration. -dial_timeout = "3s" -handshake_timeout = "20s" - -####################################################### -### Mempool Configuration Option ### -####################################################### -[mempool] - -broadcast = true -recheck = true -wal_dir = "" - -# Maximum number of transactions in the mempool -size = 5000 - -# Limit the total size of all txs in the mempool. -# This only accounts for raw transactions (e.g. given 1MB transactions and -# max_txs_bytes=5MB, mempool will only accept 5 transactions). -max_txs_bytes = 1073741824 - -# Size of the cache (used to filter transactions we saw earlier) in transactions -cache_size = 10000 - -# Do not remove invalid transactions from the cache (default: false) -# Set to true if it's not possible for any invalid transaction to become valid -# again in the future. -keep-invalid-txs-in-cache = false - -# Maximum size of a single transaction. -# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. -max_tx_bytes = 1048576 - -# Maximum size of a batch of transactions to send to a peer -# Including space needed by encoding (one varint per transaction). -# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 -max_batch_bytes = 0 - -####################################################### -### State Sync Configuration Options ### -####################################################### -[statesync] -# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine -# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in -# the network to take and serve state machine snapshots. State sync is not attempted if the node -# has any local state (LastBlockHeight > 0). The node will have a truncated block history, -# starting from the height of the snapshot. -enable = false - -# RPC servers (comma-separated) for light client verification of the synced state machine and -# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding -# header hash obtained from a trusted source, and a period during which validators can be trusted. -# -# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 -# weeks) during which they can be financially punished (slashed) for misbehavior. -rpc_servers = "" -trust_hash = "" -trust_height = 0 -trust_period = "168h0m0s" - -# Time to spend discovering snapshots before initiating a restore. -discovery_time = "15s" - -# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). -# Will create a new, randomly named directory within, and remove it when done. -temp_dir = "" - -####################################################### -### Fast Sync Configuration Connections ### -####################################################### -[fastsync] - -# Fast Sync version to use: -# 1) "v0" (default) - the legacy fast sync implementation -# 2) "v1" - refactor of v0 version for better testability -# 2) "v2" - complete redesign of v0, optimized for testability & readability -version = "v0" - -####################################################### -### Consensus Configuration Options ### -####################################################### -[consensus] - -wal_file = "data/cs.wal/wal" - -# How long we wait for a proposal block before prevoting nil -timeout_propose = "3s" -# How much timeout_propose increases with each round -timeout_propose_delta = "500ms" -# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) -timeout_prevote = "1s" -# How much the timeout_prevote increases with each round -timeout_prevote_delta = "500ms" -# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) -timeout_precommit = "1s" -# How much the timeout_precommit increases with each round -timeout_precommit_delta = "500ms" -# How long we wait after committing a block, before starting on the new -# height (this gives us a chance to receive some more precommits, even -# though we already have +2/3). -timeout_commit = "1s" - -# How many blocks to look back to check existence of the node's consensus votes before joining consensus -# When non-zero, the node will panic upon restart -# if the same consensus key was used to sign {double_sign_check_height} last blocks. -# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. -double_sign_check_height = 0 - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -####################################################### -### Transaction Indexer Configuration Options ### -####################################################### -[tx_index] - -# What indexer to use for transactions -# -# The application will set which txs to index. In some cases a node operator will be able -# to decide which txs to index based on configuration set in the application. -# -# Options: -# 1) "null" -# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. -indexer = "kv" - -####################################################### -### Instrumentation Configuration Options ### -####################################################### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "tendermint" diff --git a/integration_test/scripts/node/config/genesis.json b/integration_test/scripts/node/config/genesis.json deleted file mode 100644 index 1816f52a..00000000 --- a/integration_test/scripts/node/config/genesis.json +++ /dev/null @@ -1,343 +0,0 @@ -{ - "genesis_time": "2021-04-29T07:03:47.75703Z", - "chain_id": "test", - "initial_height": "1", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "-1", - "time_iota_ms": "1000" - }, - "evidence": { - "max_age_num_blocks": "100000", - "max_age_duration": "172800000000000", - "max_bytes": "1048576" - }, - "validator": { - "pub_key_types": [ - "ed25519" - ] - }, - "version": {} - }, - "app_hash": "", - "app_state": { - "auth": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" - }, - "accounts": [ - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "pub_key": null, - "account_number": "0", - "sequence": "0" - } - ] - }, - "bank": { - "params": { - "send_enabled": [], - "default_send_enabled": true - }, - "balances": [ - { - "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "coins": [ - { - "denom": "uiris", - "amount": "2000000000000000" - } - ] - } - ], - "supply": [], - "denom_metadata": [] - }, - "capability": { - "index": "1", - "owners": [] - }, - "coinswap": { - "params": { - "fee": "0.003000000000000000" - }, - "standard_denom": "uiris" - }, - "crisis": { - "constant_fee": { - "denom": "uiris", - "amount": "1000" - } - }, - "distribution": { - "params": { - "community_tax": "0.020000000000000000", - "base_proposer_reward": "0.010000000000000000", - "bonus_proposer_reward": "0.040000000000000000", - "withdraw_addr_enabled": true - }, - "fee_pool": { - "community_pool": [] - }, - "delegator_withdraw_infos": [], - "previous_proposer": "", - "outstanding_rewards": [], - "validator_accumulated_commissions": [], - "validator_historical_rewards": [], - "validator_current_rewards": [], - "delegator_starting_infos": [], - "validator_slash_events": [] - }, - "evidence": { - "evidence": [] - }, - "genutil": { - "gen_txs": [ - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "node0", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "validator_address": "iva1w9lvhwlvkwqvg08q84n2k4nn896u9pqxsqxkzp", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "CJ6CJOrPeR0LhGNMJGRDUPiDrjCDVyPmRBRdZWp8kDg=" - }, - "value": { - "denom": "uiris", - "amount": "100000000" - } - } - ], - "memo": "a55eb068ac6f0fb991746b37a2a1bddba4da605a@10.1.4.123:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A+KPcrEkUOSKIW1RZwvNrtenvsKGKYkokDUP2lwnqAje" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - } - }, - "signatures": [ - "LQrLc4uGfaNTw9jCzYdUSpoGMiWAB5LA89WtClCDiTt7xHQITzFYugIInjPlT53H4ycgIzD2324qIaYUnk2AZQ==" - ] - } - ] - }, - "gov": { - "starting_proposal_id": "1", - "deposits": [], - "votes": [], - "proposals": [], - "deposit_params": { - "min_deposit": [ - { - "denom": "uiris", - "amount": "10000000" - } - ], - "max_deposit_period": "10s" - }, - "voting_params": { - "voting_period": "10s" - }, - "tally_params": { - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto_threshold": "0.334000000000000000" - } - }, - "guardian": { - "supers": [ - { - "description": "genesis", - "account_type": "GENESIS", - "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "added_by": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx" - } - ] - }, - "htlc": { - "params": { - "asset_params": [] - }, - "htlcs": [], - "supplies": [], - "previous_block_time": "1970-01-01T00:00:01Z" - }, - "ibc": { - "client_genesis": { - "clients": [], - "clients_consensus": [], - "clients_metadata": [], - "params": { - "allowed_clients": [ - "06-solomachine", - "07-tendermint" - ] - }, - "create_localhost": false, - "next_client_sequence": "0" - }, - "connection_genesis": { - "connections": [], - "client_connection_paths": [], - "next_connection_sequence": "0" - }, - "channel_genesis": { - "channels": [], - "acknowledgements": [], - "commitments": [], - "receipts": [], - "send_sequences": [], - "recv_sequences": [], - "ack_sequences": [], - "next_channel_sequence": "0" - } - }, - "mint": { - "minter": { - "last_update": "1970-01-01T00:00:00Z", - "inflation_base": "2000000000000000" - }, - "params": { - "mint_denom": "uiris", - "inflation": "0.040000000000000000" - } - }, - "nft": { - "collections": [] - }, - "oracle": { - "entries": [] - }, - "params": null, - "random": { - "pending_random_requests": {} - }, - "record": { - "records": [] - }, - "service": { - "params": { - "max_request_timeout": "100", - "min_deposit_multiple": "1000", - "min_deposit": [ - { - "denom": "uiris", - "amount": "5000" - } - ], - "service_fee_tax": "0.050000000000000000", - "slash_fraction": "0.001000000000000000", - "complaint_retrospect": "1296000s", - "arbitration_time_limit": "432000s", - "tx_size_limit": "4000", - "base_denom": "uiris", - "restricted_service_fee_denom": false - }, - "definitions": [], - "bindings": [], - "withdraw_addresses": {}, - "request_contexts": {} - }, - "slashing": { - "params": { - "signed_blocks_window": "100", - "min_signed_per_window": "0.500000000000000000", - "downtime_jail_duration": "600s", - "slash_fraction_double_sign": "0.050000000000000000", - "slash_fraction_downtime": "0.010000000000000000" - }, - "signing_infos": [], - "missed_blocks": [] - }, - "staking": { - "params": { - "unbonding_time": "10s", - "max_validators": 100, - "max_entries": 7, - "historical_entries": 10000, - "bond_denom": "uiris" - }, - "last_total_power": "0", - "last_validator_powers": [], - "validators": [], - "delegations": [], - "unbonding_delegations": [], - "redelegations": [], - "exported": false - }, - "token": { - "params": { - "token_tax_rate": "0.400000000000000000", - "issue_token_base_fee": { - "denom": "iris", - "amount": "60000" - }, - "mint_token_fee_ratio": "0.100000000000000000" - }, - "tokens": [ - { - "symbol": "iris", - "name": "Irishub staking token", - "scale": 6, - "min_unit": "uiris", - "initial_supply": "2000000000", - "max_supply": "10000000000", - "mintable": true, - "owner": "iaa183rfa8tvtp6ax7jr7dfaf7ywv870sykxxykejp" - } - ], - "burned_coins": [] - }, - "transfer": { - "port_id": "transfer", - "denom_traces": [], - "params": { - "send_enabled": true, - "receive_enabled": true - } - }, - "upgrade": {}, - "vesting": {} - } -} \ No newline at end of file diff --git a/integration_test/scripts/node/config/node_key.json b/integration_test/scripts/node/config/node_key.json deleted file mode 100644 index 3e61faba..00000000 --- a/integration_test/scripts/node/config/node_key.json +++ /dev/null @@ -1 +0,0 @@ -{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"Dyjc0bX/HiIXv+5rsZWvBwLqvI5fD5nitDC49L/H0PnPoRChRIMgaPqNbXA3cWbZHujkATDwGmgfcHjaBZ6BUw=="}} \ No newline at end of file diff --git a/integration_test/scripts/node/config/priv_validator_key.json b/integration_test/scripts/node/config/priv_validator_key.json deleted file mode 100644 index aab96264..00000000 --- a/integration_test/scripts/node/config/priv_validator_key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "address": "2FDA2E2186D90D9EFEB88C33749F2E4027EC3EC1", - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "CJ6CJOrPeR0LhGNMJGRDUPiDrjCDVyPmRBRdZWp8kDg=" - }, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "JcFps8b5GHiiev3qg9tczfjRE+livjjT0nfSnWbqjU8InoIk6s95HQuEY0wkZENQ+IOuMINXI+ZEFF1lanyQOA==" - } -} \ No newline at end of file diff --git a/integration_test/scripts/node/data/priv_validator_state.json b/integration_test/scripts/node/data/priv_validator_state.json deleted file mode 100644 index 48f3b67e..00000000 --- a/integration_test/scripts/node/data/priv_validator_state.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "height": "0", - "round": 0, - "step": 0 -} \ No newline at end of file diff --git a/integration_test/scripts/priv.key b/integration_test/scripts/priv.key deleted file mode 100644 index 20cd8b85..00000000 --- a/integration_test/scripts/priv.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN TENDERMINT PRIVATE KEY----- -kdf: bcrypt -salt: 298F51F7478AD9129407D92E3159D7E5 -type: secp256k1 - -Ek9wCZKdEvCu8hrIPr58cUyGHM12b5G6/EIdtWnXlmD9sRifgHt2pfNMD60+W85W -eiSls9IG9KtFM0vjcGWE+lkkxIVo0pBPlhi5NC4= -=jD+4 ------END TENDERMINT PRIVATE KEY----- \ No newline at end of file diff --git a/integration_test/scripts/setup.sh b/integration_test/scripts/setup.sh deleted file mode 100755 index bf73d002..00000000 --- a/integration_test/scripts/setup.sh +++ /dev/null @@ -1 +0,0 @@ - cp -r ./scripts/node/ ~/.iris \ No newline at end of file diff --git a/integration_test/scripts/start.sh b/integration_test/scripts/start.sh deleted file mode 100755 index db2a81cb..00000000 --- a/integration_test/scripts/start.sh +++ /dev/null @@ -1 +0,0 @@ -docker run -d -it --rm -p 26657:26657 -p 9090:9090 --name irishub-sdk-go-test irishub-sdk-go \ No newline at end of file diff --git a/integration_test/service_test.go b/integration_test/service_test.go deleted file mode 100644 index 1910067d..00000000 --- a/integration_test/service_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package integration_test - -import ( - "time" - - "github.com/stretchr/testify/require" - - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/query" - - "github.com/irisnet/irishub-sdk-go/modules/service" -) - -func (s IntegrationTestSuite) TestService() { - schemas := `{"input":{"type":"object"},"output":{"type":"object"},"error":{"type":"object"}}` - pricing := `{"price":"1uiris"}` - options := `{}` - - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - definition := service.DefineServiceRequest{ - ServiceName: s.RandStringOfLength(10), - Description: "this is a test service", - Tags: nil, - AuthorDescription: "service provider", - Schemas: schemas, - } - - result, err := s.Service.DefineService(definition, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), result.Hash) - - defi, err := s.Service.QueryServiceDefinition(definition.ServiceName) - require.NoError(s.T(), err) - require.Equal(s.T(), definition.ServiceName, defi.Name) - require.Equal(s.T(), definition.Description, defi.Description) - require.EqualValues(s.T(), definition.Tags, defi.Tags) - require.Equal(s.T(), definition.AuthorDescription, defi.AuthorDescription) - require.Equal(s.T(), definition.Schemas, defi.Schemas) - require.Equal(s.T(), s.Account().Address.String(), defi.Author) - - deposit, e := sdk.ParseDecCoins("20000uiris") - require.NoError(s.T(), e) - binding := service.BindServiceRequest{ - ServiceName: definition.ServiceName, - Deposit: deposit, - Pricing: pricing, - QoS: 10, - Options: options, - } - result, err = s.Service.BindService(binding, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), result.Hash) - - bindResp, err := s.Service.QueryServiceBinding(definition.ServiceName, s.Account().Address.String()) - require.NoError(s.T(), err) - require.Equal(s.T(), binding.ServiceName, bindResp.ServiceName) - require.Equal(s.T(), s.Account().Address.String(), bindResp.Provider) - require.Equal(s.T(), binding.Pricing, bindResp.Pricing) - - input := `{"header":{},"body":{"pair":"uiris-usdt"}}` - output := `{"header":{},"body":{"last":"1:100"}}` - testResult := `{"code":200,"message":""}` - - var sub1 sdk.Subscription - callback := func(reqCtxID, reqID, input string) (string, string) { - _, err := s.Service.QueryServiceRequest(reqID) - require.NoError(s.T(), err) - return output, testResult - } - sub1, err = s.Service.SubscribeServiceRequest(definition.ServiceName, callback, baseTx) - require.NoError(s.T(), err) - s.Logger().Info("SubscribeServiceRequest", "condition", sub1.Query) - - serviceFeeCap, e := sdk.ParseDecCoins("200uiris") - require.NoError(s.T(), e) - - invocation := service.InvokeServiceRequest{ - ServiceName: definition.ServiceName, - Providers: []string{s.Account().Address.String()}, - Input: input, - ServiceFeeCap: serviceFeeCap, - Timeout: 10, - Repeated: false, - RepeatedTotal: -1, - } - - var requestContextID string - var sub2 sdk.Subscription - var exit = make(chan int) - - requestContextID, result, err = s.Service.InvokeService(invocation, baseTx) - require.NoError(s.T(), err) - s.Logger().Info("InvokeService success", - "hash", result.Hash, - "requestContextID", requestContextID, - ) - - requestid, err := s.Service.QueryRequestsByReqCtx(requestContextID, 1, &query.PageRequest{}) - require.NoError(s.T(), err) - s.Logger().Info("request_id: ", requestid) - - sub2, err = s.Service.SubscribeServiceResponse(requestContextID, func(reqCtxID, reqID, responses string) { - require.Equal(s.T(), reqCtxID, requestContextID) - require.Equal(s.T(), output, responses) - request, err := s.Service.QueryServiceRequest(reqID) - require.NoError(s.T(), err) - require.Equal(s.T(), reqCtxID, request.RequestContextID) - require.Equal(s.T(), reqID, request.ID) - require.Equal(s.T(), input, request.Input) - - exit <- 1 - }) - require.NoError(s.T(), err) - - for { - select { - case <-exit: - err = s.Unsubscribe(sub1) - require.NoError(s.T(), err) - err = s.Unsubscribe(sub2) - require.NoError(s.T(), err) - goto loop - case <-time.After(2 * time.Minute): - require.Panics(s.T(), func() {}, "test service timeout") - } - } - -loop: - //_, err = s.Service.PauseRequestContext(requestContextID, baseTx) - //require.NoError(s.T(), err) - // - //_, err = s.Service.StartRequestContext(requestContextID, baseTx) - //require.NoError(s.T(), err) - - request, err := s.Service.QueryRequestContext(requestContextID) - require.NoError(s.T(), err) - require.Equal(s.T(), request.ServiceName, invocation.ServiceName) - require.Equal(s.T(), request.Input, invocation.Input) - - addr, _, err := s.Key.Add(s.RandStringOfLength(30), "1234567890") - require.NoError(s.T(), err) - require.NotEmpty(s.T(), addr) - - _, err = s.Service.SetWithdrawAddress(addr, baseTx) - require.NoError(s.T(), err) - - fee, err := s.Service.QueryFees(s.Account().Address.String()) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), fee) - - //acc := s.GetRandAccount() - - //TODO - //rs, err := s.ServiceI.WithdrawEarnedFees(acc.Address.String(), baseTx) - //require.NoError(s.T(), err) - // - //withdrawFee, er := rs.Events.GetValue("transfer", "amount") - //require.NoError(s.T(), er) - //require.Equal(s.T(), fee.String(), withdrawFee) -} diff --git a/integration_test/staking_test.go b/integration_test/staking_test.go deleted file mode 100644 index b0ba5e26..00000000 --- a/integration_test/staking_test.go +++ /dev/null @@ -1,294 +0,0 @@ -package integration_test - -import ( - "context" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/staking" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestStaking() { - cases := []SubTest{ - { - "TestStaking", - testStaking, - }, - //{ - // "TestCreateAndEdit", - // testCreateAndEdit, - //}, - { - "TestQueryHistoricalInfo", - queryHistoricalInfo, - }, - { - "TestQueryPool", - queryPool, - }, - { - "TestQueryParams", - queryParams, - }, - } - - for _, t := range cases { - s.Run(t.testName, func() { - t.testCase(s) - }) - } -} - -// this need another node to test -func testCreateAndEdit(s IntegrationTestSuite) { - // send createValidator tx - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - rate := sdk.MustNewDecFromStr("0.1") - maxRate := sdk.MustNewDecFromStr("0.1") - maxChangeRate := sdk.MustNewDecFromStr("0.01") - minSelfDelegation := sdk.OneInt() - value, _ := sdk.ParseDecCoin("1iris") - req1 := staking.CreateValidatorRequest{ - Moniker: "haha", - Rate: rate, - MaxRate: maxRate, - MaxChangeRate: maxChangeRate, - MinSelfDelegation: minSelfDelegation, - Pubkey: "", - Value: value, - } - res, err := s.Staking.CreateValidator(req1, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - // send editValidator tx - commissionRate := sdk.MustNewDecFromStr("0.1") - minSelfDelegation = sdk.OneInt() - req2 := staking.EditValidatorRequest{ - Moniker: "haha", - Identity: "identity", - Website: "website", - SecurityContact: "abbccdd", - Details: "fadsfas", - CommissionRate: commissionRate, - MinSelfDelegation: minSelfDelegation, - } - res, err = s.Staking.EditValidator(req2, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) -} - -func testStaking(s IntegrationTestSuite) { - // ================================ about delegate ============================== - delegateAddr := s.Account().Address.String() - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - // queries all validators that match the given status. - validatorsResp, err := s.Staking.QueryValidators("", 1, 10) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), validatorsResp.Validators) - - // queries validator info for given validator address. - validatorAddr := validatorsResp.Validators[0].OperatorAddress - validatorResp, err := s.Staking.QueryValidator(validatorAddr) - require.NoError(s.T(), err) - require.Equal(s.T(), validatorAddr, validatorResp.OperatorAddress) - - // send Delegate tx - amount, _ := sdk.ParseDecCoin("10000iris") - delegateReq := staking.DelegateRequest{ - ValidatorAddr: validatorAddr, - Amount: amount, - } - res, err := s.Staking.Delegate(delegateReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - // queries delegate info for given validator delegator pair. - delegation, err := s.Staking.QueryDelegation(delegateAddr, validatorAddr) - require.NoError(s.T(), err) - require.Equal(s.T(), delegateAddr, delegation.Delegation.DelegatorAddress) - require.Equal(s.T(), validatorAddr, delegation.Delegation.ValidatorAddress) - - // queries delegate info for given validator - delegationsToResp, err := s.Staking.QueryValidatorDelegations(validatorAddr, 1, 10) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), delegationsToResp.DelegationResponses) - require.Greater(s.T(), delegationsToResp.Total, uint64(0)) - var exists bool - for _, d := range delegationsToResp.DelegationResponses { - if d.Delegation.DelegatorAddress == delegateAddr { - exists = true - } - } - require.True(s.T(), exists) - - // queries all delegations of a given delegator address. - delegatorDelegations, err := s.Staking.QueryDelegatorDelegations(delegateAddr, 1, 10) - require.NoError(s.T(), err) - exists = false // init exists - for _, d := range delegatorDelegations.DelegationResponses { - if d.Delegation.ValidatorAddress == validatorAddr && d.Delegation.DelegatorAddress == delegateAddr { - exists = true - } - } - require.True(s.T(), exists) - - // queries all validators info for given delegator - delegatorValidators, err := s.Staking.QueryDelegatorValidators(delegateAddr, 1, 10) - require.NoError(s.T(), err) - exists = false // init exists - for _, v := range delegatorValidators.Validator { - if v.OperatorAddress == validatorAddr { - exists = true - } - } - require.True(s.T(), exists) - - // queries validator info for given delegator validator pair. - delegatorValidator, err := s.Staking.QueryDelegatorValidator(delegateAddr, validatorAddr) - require.NoError(s.T(), err) - require.Equal(s.T(), validatorAddr, delegatorValidator.OperatorAddress) - - // ================================ about unbonding ============================== - // send Undelegate tx - amount, _ = sdk.ParseDecCoin("500iris") - undelegateReq := staking.UndelegateRequest{ - ValidatorAddr: validatorAddr, - Amount: amount, - } - res, err = s.Staking.Undelegate(undelegateReq, baseTx) - require.NoError(s.T(), err) - require.Greater(s.T(), res.Height, int64(1)) - - // queries unbonding delegations of a validator. - unbondingDelegations, err := s.Staking.QueryValidatorUnbondingDelegations(validatorAddr, 1, 10) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), unbondingDelegations.UnbondingResponses) - exists = false // init exists - for _, u := range unbondingDelegations.UnbondingResponses { - if u.DelegatorAddress == delegateAddr && u.ValidatorAddress == validatorAddr { - exists = true - } - require.NotEmpty(s.T(), u.Entries) - } - require.True(s.T(), exists) - - // queries unbonding info for given validator delegator pair. - unbondingDelegation, err := s.Staking.QueryUnbondingDelegation(delegateAddr, validatorAddr) - require.NoError(s.T(), err) - require.Equal(s.T(), validatorAddr, unbondingDelegation.ValidatorAddress) - require.Equal(s.T(), delegateAddr, unbondingDelegation.DelegatorAddress) - - // queries all unbonding delegations of a given delegator address. - delegatorUnbondingDelegations, err := s.Staking.QueryDelegatorUnbondingDelegations(delegateAddr, 1, 10) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - exists = false // init exists - for _, d := range delegatorUnbondingDelegations.UnbondingDelegations { - if d.DelegatorAddress == delegateAddr && d.ValidatorAddress == validatorAddr { - exists = true - } - require.NotEmpty(s.T(), d.Entries) - } - require.True(s.T(), exists) - - // ================================ about redelegate ============================== - // send redelegate tx - /* amount, _ = sdk.ParseDecCoin("3000iris") - // you can use another node to create a validator, then assgin newValidatorAddr in ValidatorDstAddress to send this tx - newValidatorAddr := validatorAddr - redelegateReq := staking.BeginRedelegateRequest{ - ValidatorSrcAddress: validatorAddr, - ValidatorDstAddress: newValidatorAddr, - Amount: amount, - } - res, err = s.Staking.BeginRedelegate(redelegateReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - - // queries redelegations of given address. - redelegationsReq := staking.QueryRedelegationsReq{ - DelegatorAddr: "", - SrcValidatorAddr: "", - DstValidatorAddr: "", - Page: 0, - Size: 0, - } - redelegations, err := s.Staking.QueryRedelegations(redelegationsReq) - require.NoError(s.T(), err) - exists = false // init exists - for _, r := range redelegations.RedelegationResponses { - if r.Redelegation.ValidatorSrcAddress == validatorAddr && r.Redelegation.ValidatorDstAddress == newValidatorAddr { - exists = true - } - require.NotEmpty(s.T(), r.Entries) - } - require.True(s.T(), exists)*/ -} - -func queryHistoricalInfo(s IntegrationTestSuite) { - // get latestBlockHeight at first - status, err := s.Status(context.Background()) - require.NoError(s.T(), err) - height := status.SyncInfo.LatestBlockHeight - height -= 10 - - res, err := s.Staking.QueryHistoricalInfo(height) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Valset) - - var flag bool - for _, validator := range res.Valset { - if validator.OperatorAddress == s.curValAddr() { - flag = true - } - } - require.True(s.T(), flag) -} - -func queryPool(s IntegrationTestSuite) { - res, err := s.Staking.QueryPool() - require.NoError(s.T(), err) - require.Greater(s.T(), res.BondedTokens.Int64(), int64(0)) - require.GreaterOrEqual(s.T(), res.NotBondedTokens.Int64(), int64(0)) // NotBondedTokens can be 0 -} - -func queryParams(s IntegrationTestSuite) { - // this params is irishub default params - const ( - bondDenom = "uiris" - defaultHistorical = uint32(10000) - MaxValidators = uint32(100) - MaxEntries = uint32(7) - ) - - res, err := s.Staking.QueryParams() - require.NoError(s.T(), err) - require.Equal(s.T(), bondDenom, res.BondDenom) - require.Equal(s.T(), defaultHistorical, res.HistoricalEntries) - require.Equal(s.T(), MaxValidators, res.MaxValidators) - require.Equal(s.T(), MaxEntries, res.MaxEntries) -} - -func (s IntegrationTestSuite) curValAddr() string { - // queries all validators that match the given status. - validatorsResp, err := s.Staking.QueryValidators("", 1, 10) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), validatorsResp.Validators) - return validatorsResp.Validators[0].OperatorAddress -} diff --git a/integration_test/token_test.go b/integration_test/token_test.go deleted file mode 100644 index ee9a0108..00000000 --- a/integration_test/token_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package integration_test - -import ( - "strings" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/token" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func (s IntegrationTestSuite) TestToken() { - baseTx := sdk.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "test", - Mode: sdk.Commit, - Password: s.Account().Password, - } - - issueTokenReq := token.IssueTokenRequest{ - Symbol: strings.ToLower(s.RandStringOfLength(3)), - Name: s.RandStringOfLength(8), - Scale: 9, - MinUnit: strings.ToLower(s.RandStringOfLength(3)), - InitialSupply: 10000000, - MaxSupply: 21000000, - Mintable: true, - } - - //test issue token - rs, err := s.Token.IssueToken(issueTokenReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), rs.Hash) - - //test mint token - receipt := s.GetRandAccount().Address.String() - rs, err = s.Token.MintToken(issueTokenReq.Symbol, 1000, receipt, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), rs.Hash) - - account, err := s.Bank.QueryAccount(receipt) - require.NoError(s.T(), err) - - amt := sdk.NewIntWithDecimal(1000, int(issueTokenReq.Scale)) - require.Equal(s.T(), amt, account.Coins.AmountOf(issueTokenReq.MinUnit)) - - editTokenReq := token.EditTokenRequest{ - Symbol: issueTokenReq.Symbol, - Name: "ethereum network", - MaxSupply: 20000000, - Mintable: false, - } - - //test edit token - rs, err = s.Token.EditToken(editTokenReq, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), rs.Hash) - - //test transfer token - rs, err = s.Token.TransferToken(receipt, issueTokenReq.Symbol, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), rs.Hash) - - t1, er := s.Token.QueryToken(issueTokenReq.Symbol) - require.NoError(s.T(), er) - require.Equal(s.T(), t1.Name, editTokenReq.Name) - require.Equal(s.T(), t1.MaxSupply, editTokenReq.MaxSupply) - require.Equal(s.T(), t1.Mintable, editTokenReq.Mintable) - require.Equal(s.T(), receipt, t1.Owner) - - tokens, er := s.Token.QueryTokens("") - require.NoError(s.T(), er) - require.Contains(s.T(), tokens, t1) - - feeToken, er := s.Token.QueryFees(issueTokenReq.Symbol) - require.NoError(s.T(), er) - require.Equal(s.T(), true, feeToken.Exist) - require.Equal(s.T(), "60000000000uiris", feeToken.IssueFee.String()) - require.Equal(s.T(), "6000000000uiris", feeToken.MintFee.String()) - - res, er := s.Token.QueryParams() - require.NoError(s.T(), er) - require.Equal(s.T(), "0.100000000000000000", res.MintTokenFeeRatio) - require.Equal(s.T(), "0.400000000000000000", res.TokenTaxRate) - require.Equal(s.T(), "60000iris", res.IssueTokenBaseFee) -} diff --git a/keystore/keys.go b/keystore/keys.go deleted file mode 100644 index 4b5eade2..00000000 --- a/keystore/keys.go +++ /dev/null @@ -1,50 +0,0 @@ -package keystore - -import ( - "encoding/json" - "fmt" - - tmcrypto "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/secp256k1" - - "github.com/irisnet/irishub-sdk-go/crypto" - sdksecp256k1 "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1" -) - -// RecoveryAndExportPrivKeyArmor return the new private key armor(after IrisHubV1.0) from a old keystoreFile(before IrisHubV0.16) -func RecoveryAndExportPrivKeyArmor(keystore []byte, password string) (armor string, err error) { - priv, err := recoveryFromKeyStore(keystore, password) - if err != nil { - return "", err - } - return exportPrivKeyArmor(priv, password) -} - -func recoveryFromKeyStore(keystore []byte, password string) (tmcrypto.PrivKey, error) { - if password == "" { - return nil, fmt.Errorf("Password is missing ") - } - - var encryptedKey EncryptedKeyJSON - if err := json.Unmarshal(keystore, &encryptedKey); err != nil { - return nil, err - } - - keyBytes, err := decryptKey(&encryptedKey, password) - if err != nil { - return nil, err - } - - if len(keyBytes) != 32 { - return nil, fmt.Errorf("Len of Keyby tes is not equal to 32 ") - } - - return secp256k1.PrivKey(keyBytes), nil -} - -func exportPrivKeyArmor(privKey tmcrypto.PrivKey, password string) (armor string, err error) { - priv := sdksecp256k1.PrivKey{ - Key: privKey.Bytes(), - } - return crypto.EncryptArmorPrivKey(&priv, password, "secp256k1"), nil -} diff --git a/keystore/keys_test.go b/keystore/keys_test.go deleted file mode 100644 index 8cedca85..00000000 --- a/keystore/keys_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package keystore - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestRecoveryAndExportPrivKeyArmor(t *testing.T) { - keystore := `{"version":"1","id":"65177bc2-8240-4024-8180-dd0b2d888903","address":"faa1ljemm0yznz58qxxs8xyak7fashcfxf5lssn6jm","crypto":{"ciphertext":"793acc81ed7d3f8aead7872f81cc7297e0527ab9ee87a24f8aa7de6a6b4072e9","cipherparams":{"iv":"7ebe22befa6b278f0f348fe9e3f7c524"},"cipher":"aes-128-ctr","kdf":"pbkdf2","kdfparams":{"dklen":32,"salt":"0fa96f07f73d3dfe2bff410b708de347080a326c898e2d5631af4d598e851401","c":262144,"prf":"hmac-sha256"},"mac":"15467c52ade57fd59200544612cccd2310825f8378d3f52228b52d07b56fbdba"}}` - armor, err := RecoveryAndExportPrivKeyArmor([]byte(keystore), "1234567890") - require.NoError(t, err) - - t.Log(armor) -} diff --git a/keystore/keystore.go b/keystore/keystore.go deleted file mode 100644 index 2c4ab76f..00000000 --- a/keystore/keystore.go +++ /dev/null @@ -1,129 +0,0 @@ -package keystore - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/sha256" - "encoding/hex" - "errors" - "fmt" - - "golang.org/x/crypto/pbkdf2" -) - -var ( - errDecrypt = errors.New("could not decrypt key with given passphrase") -) - -// PlainKeyJSON define a struct -type PlainKeyJSON struct { - Address string `json:"address"` - PrivateKey string `json:"privatekey"` - ID string `json:"id"` - Version int `json:"version"` -} - -// EncryptedKeyJSON define a struct -type EncryptedKeyJSON struct { - Address string `json:"address"` - Crypto CryptoJSON `json:"crypto"` - ID string `json:"id"` - Version string `json:"version"` -} - -// CryptoJSON define a struct -type CryptoJSON struct { - Cipher string `json:"cipher"` - CipherText string `json:"ciphertext"` - CipherParams cipherparamsJSON `json:"cipherparams"` - KDF string `json:"kdf"` - KDFParams map[string]interface{} `json:"kdfparams"` - MAC string `json:"mac"` -} - -type cipherparamsJSON struct { - IV string `json:"iv"` -} - -func decryptKey(keyProtected *EncryptedKeyJSON, password string) ([]byte, error) { - mac, err := hex.DecodeString(keyProtected.Crypto.MAC) - if err != nil { - return nil, err - } - - iv, err := hex.DecodeString(keyProtected.Crypto.CipherParams.IV) - if err != nil { - return nil, err - } - - cipherText, err := hex.DecodeString(keyProtected.Crypto.CipherText) - if err != nil { - return nil, err - } - - derivedKey, err := getKDFKey(keyProtected.Crypto, password) - if err != nil { - return nil, err - } - - bufferValue := make([]byte, len(cipherText)+16) - copy(bufferValue[0:16], derivedKey[16:32]) - copy(bufferValue[16:], cipherText[:]) - calculatedMAC := sha256.Sum256([]byte((bufferValue))) - if !bytes.Equal(calculatedMAC[:], mac) { - return nil, errDecrypt - } - - plainText, err := aesCTRXOR(derivedKey[:16], cipherText, iv) - if err != nil { - return nil, err - } - return plainText, err -} - -func getKDFKey(cryptoJSON CryptoJSON, password string) ([]byte, error) { - authArray := []byte(password) - if cryptoJSON.KDFParams["salt"] == nil || cryptoJSON.KDFParams["dklen"] == nil || - cryptoJSON.KDFParams["c"] == nil || cryptoJSON.KDFParams["prf"] == nil { - return nil, errors.New("invalid KDF params, must contains c, dklen, prf and salt") - } - salt, err := hex.DecodeString(cryptoJSON.KDFParams["salt"].(string)) - if err != nil { - return nil, err - } - dkLen := ensureInt(cryptoJSON.KDFParams["dklen"]) - - if cryptoJSON.KDF == "pbkdf2" { - c := ensureInt(cryptoJSON.KDFParams["c"]) - prf := cryptoJSON.KDFParams["prf"].(string) - if prf != "hmac-sha256" { - return nil, fmt.Errorf("Unsupported PBKDF2 PRF: %s", prf) - } - key := pbkdf2.Key(authArray, salt, c, dkLen, sha256.New) - return key, nil - } - return nil, fmt.Errorf("Unsupported KDF: %s", cryptoJSON.KDF) -} - -func ensureInt(x interface{}) int { - res, ok := x.(int) - if !ok { - res = int(x.(float64)) - } - return res -} - -// algorithm: AES-128 -// mode: ctr -// padding: no-padding -func aesCTRXOR(key, inText, iv []byte) ([]byte, error) { - aesBlock, err := aes.NewCipher(key) - if err != nil { - return nil, err - } - stream := cipher.NewCTR(aesBlock, iv) - outText := make([]byte, len(inText)) - stream.XORKeyStream(outText, inText) - return outText, err -} diff --git a/module-sdk/Makefile b/module-sdk/Makefile index 7cc2dfdd..c4119b6f 100644 --- a/module-sdk/Makefile +++ b/module-sdk/Makefile @@ -5,7 +5,7 @@ export GO111MODULE = on format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/irishub-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/integration-test test-unit: @go test -v $(PACKAGES_UNITTEST) diff --git a/module-sdk/gov/gov.go b/module-sdk/gov/gov.go index 60688a67..26888fbf 100644 --- a/module-sdk/gov/gov.go +++ b/module-sdk/gov/gov.go @@ -100,7 +100,7 @@ func (gc govClient) Vote(request VoteRequest, baseTx sdk.BaseTx) (sdk.ResultTx, func (gc govClient) QueryProposal(proposalId uint64) (QueryProposalResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryProposalResp{}, sdk.Wrap(err) } @@ -120,7 +120,7 @@ func (gc govClient) QueryProposal(proposalId uint64) (QueryProposalResp, sdk.Err // about proposalStatus see VoteOption_value func (gc govClient) QueryProposals(proposalStatus string) ([]QueryProposalResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -144,7 +144,7 @@ func (gc govClient) QueryProposals(proposalStatus string) ([]QueryProposalResp, // about QueryVoteResp.Option see VoteOption_name func (gc govClient) QueryVote(proposalId uint64, voter string) (QueryVoteResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryVoteResp{}, sdk.Wrap(err) } @@ -163,7 +163,7 @@ func (gc govClient) QueryVote(proposalId uint64, voter string) (QueryVoteResp, s func (gc govClient) QueryVotes(proposalId uint64) ([]QueryVoteResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -187,7 +187,7 @@ func (gc govClient) QueryVotes(proposalId uint64) ([]QueryVoteResp, sdk.Error) { // QueryParams params_type("voting", "tallying", "deposit"), if don't pass will return all params_typ res func (gc govClient) QueryParams(paramsType string) (QueryParamsResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryParamsResp{}, sdk.Wrap(err) } @@ -206,7 +206,7 @@ func (gc govClient) QueryParams(paramsType string) (QueryParamsResp, sdk.Error) func (gc govClient) QueryDeposit(proposalId uint64, depositor string) (QueryDepositResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryDepositResp{}, sdk.Wrap(err) } @@ -226,7 +226,7 @@ func (gc govClient) QueryDeposit(proposalId uint64, depositor string) (QueryDepo func (gc govClient) QueryDeposits(proposalId uint64) ([]QueryDepositResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -250,7 +250,7 @@ func (gc govClient) QueryDeposits(proposalId uint64) ([]QueryDepositResp, sdk.Er func (gc govClient) QueryTallyResult(proposalId uint64) (QueryTallyResultResp, sdk.Error) { conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryTallyResultResp{}, sdk.Wrap(err) } diff --git a/module-sdk/htlc/htlc.go b/module-sdk/htlc/htlc.go index cf01a95b..3cde1546 100644 --- a/module-sdk/htlc/htlc.go +++ b/module-sdk/htlc/htlc.go @@ -76,7 +76,7 @@ func (hc htlcClient) QueryHTLC(hashLockId string) (QueryHTLCResp, sdk.Error) { } conn, err := hc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryHTLCResp{}, sdk.Wrap(err) } @@ -95,7 +95,7 @@ func (hc htlcClient) QueryHTLC(hashLockId string) (QueryHTLCResp, sdk.Error) { func (hc htlcClient) QueryParams() (QueryParamsResp, sdk.Error) { conn, err := hc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryParamsResp{}, sdk.Wrap(err) } diff --git a/client.go b/module-sdk/integration_test/client.go similarity index 69% rename from client.go rename to module-sdk/integration_test/client.go index 04e3fdb8..9fe1e65c 100644 --- a/client.go +++ b/module-sdk/integration_test/client.go @@ -1,29 +1,25 @@ -package sdk +package integrationtest import ( - "fmt" - - "github.com/irisnet/irishub-sdk-go/modules/coinswap" - "github.com/irisnet/irishub-sdk-go/modules/gov" - "github.com/irisnet/irishub-sdk-go/modules/htlc" - "github.com/irisnet/irishub-sdk-go/modules/nft" - "github.com/irisnet/irishub-sdk-go/modules/oracle" - "github.com/irisnet/irishub-sdk-go/modules/random" - "github.com/irisnet/irishub-sdk-go/modules/record" - "github.com/irisnet/irishub-sdk-go/modules/staking" - + "github.com/irisnet/coinswap-sdk-go" + "github.com/irisnet/core-sdk-go/bank" + "github.com/irisnet/core-sdk-go/client" + "github.com/irisnet/core-sdk-go/common/codec" + cdctypes "github.com/irisnet/core-sdk-go/common/codec/types" + cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" + "github.com/irisnet/core-sdk-go/types" + txtypes "github.com/irisnet/core-sdk-go/types/tx" + "github.com/irisnet/gov-sdk-go" + "github.com/irisnet/htlc-sdk-go" + "github.com/irisnet/keys-sdk-go" + "github.com/irisnet/nft-sdk-go" + "github.com/irisnet/oracle-sdk-go" + "github.com/irisnet/random-sdk-go" + "github.com/irisnet/record-sdk-go" + "github.com/irisnet/service-sdk-go" + "github.com/irisnet/staking-sdk-go" + "github.com/irisnet/token-sdk-go" "github.com/tendermint/tendermint/libs/log" - - "github.com/irisnet/irishub-sdk-go/codec" - cdctypes "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - "github.com/irisnet/irishub-sdk-go/modules" - "github.com/irisnet/irishub-sdk-go/modules/bank" - "github.com/irisnet/irishub-sdk-go/modules/keys" - "github.com/irisnet/irishub-sdk-go/modules/service" - "github.com/irisnet/irishub-sdk-go/modules/token" - "github.com/irisnet/irishub-sdk-go/types" - txtypes "github.com/irisnet/irishub-sdk-go/types/tx" ) type Client struct { @@ -46,11 +42,11 @@ type Client struct { Swap coinswap.Client } -func NewIRISHUBClient(cfg types.ClientConfig) Client { +func NewClient(cfg types.ClientConfig) Client { encodingConfig := makeEncodingConfig() // create a instance of baseClient - baseClient := modules.NewBaseClient(cfg, encodingConfig, nil) + baseClient := client.NewBaseClient(cfg, encodingConfig, nil) keysClient := keys.NewClient(baseClient) bankClient := bank.NewClient(baseClient, encodingConfig.Marshaler) @@ -101,40 +97,35 @@ func NewIRISHUBClient(cfg types.ClientConfig) Client { return *client } -func (client *Client) SetLogger(logger log.Logger) { +func (client Client) SetLogger(logger log.Logger) { client.BaseClient.SetLogger(logger) } -func (client *Client) Codec() *codec.LegacyAmino { +func (client Client) Codec() *codec.LegacyAmino { return client.encodingConfig.Amino } -func (client *Client) AppCodec() codec.Marshaler { +func (client Client) AppCodec() codec.Marshaler { return client.encodingConfig.Marshaler } -func (client *Client) EncodingConfig() types.EncodingConfig { +func (client Client) EncodingConfig() types.EncodingConfig { return client.encodingConfig } -func (client *Client) Manager() types.BaseClient { +func (client Client) Manager() types.BaseClient { return client.BaseClient } -func (client *Client) RegisterModule(ms ...types.Module) { +func (client Client) RegisterModule(ms ...types.Module) { for _, m := range ms { - _, ok := client.moduleManager[m.Name()] - if ok { - panic(fmt.Sprintf("%s has register", m.Name())) - } - // m.RegisterCodec(client.encodingConfig.Amino) m.RegisterInterfaceTypes(client.encodingConfig.InterfaceRegistry) - client.moduleManager[m.Name()] = m + } } -func (client *Client) Module(name string) types.Module { +func (client Client) Module(name string) types.Module { return client.moduleManager[name] } diff --git a/module-sdk/integration_test/coinswap_test.go b/module-sdk/integration_test/coinswap_test.go index b43c1133..19a48c66 100644 --- a/module-sdk/integration_test/coinswap_test.go +++ b/module-sdk/integration_test/coinswap_test.go @@ -1,12 +1,11 @@ -package integration_test +package integrationtest import ( - "time" - - "github.com/irisnet/irishub-sdk-go/modules/coinswap" - "github.com/irisnet/irishub-sdk-go/modules/token" - sdk "github.com/irisnet/irishub-sdk-go/types" + "github.com/irisnet/coinswap-sdk-go" + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/token-sdk-go" "github.com/stretchr/testify/require" + "time" ) func (s IntegrationTestSuite) TestCoinSwap() { diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index d837b556..d87f35f9 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -2,13 +2,35 @@ module github.com/irisnet/integration-test go 1.16 - require ( github.com/gogo/protobuf v1.3.3 github.com/irisnet/core-sdk-go v0.1.0 +github.com/irisnet/coinswap-sdk-go v0.1.0 +github.com/irisnet/gov-sdk-go v0.1.0 +github.com/irisnet/htlc-sdk-go v0.1.0 +github.com/irisnet/nft-sdk-go v0.1.0 +github.com/irisnet/random-sdk-go v0.1.0 +github.com/irisnet/service-sdk-go v0.1.0 +github.com/irisnet/record-sdk-go v0.1.0 +github.com/irisnet/staking-sdk-go v0.1.0 +github.com/irisnet/token-sdk-go v0.1.0 +github.com/irisnet/keys-sdk-go v0.1.0 +github.com/irisnet/oracle-sdk-go v0.1.0 + ) replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/coinswap-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/coinswap +github.com/irisnet/gov-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/gov +github.com/irisnet/htlc-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/htlc +github.com/irisnet/nft-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/nft +github.com/irisnet/random-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/random +github.com/irisnet/service-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/service +github.com/irisnet/record-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/record +github.com/irisnet/staking-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/staking +github.com/irisnet/token-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/token +github.com/irisnet/keys-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/keys +github.com/irisnet/oracle-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/oracle ) \ No newline at end of file diff --git a/go.sum b/module-sdk/integration_test/go.sum similarity index 88% rename from go.sum rename to module-sdk/integration_test/go.sum index 68c97243..ae927da5 100644 --- a/go.sum +++ b/module-sdk/integration_test/go.sum @@ -13,19 +13,13 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= -github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= 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= @@ -42,23 +36,20 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= 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= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833 h1:yCfXxYaelOyqnia8F/Yng47qhmfC9nKTRIbYRrRueq4= -github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833/go.mod h1:8c4/i2VlovMO2gBnHGQPN5EJw+H0lx1u/5p+cgsXtCk= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= 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= @@ -70,9 +61,7 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -81,7 +70,6 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/confio/ics23/go v0.6.3 h1:PuGK2V1NJWZ8sSkNDq91jgT/cahFEW9RGp4Y5jxulf0= github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -94,11 +82,8 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= -github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= -github.com/cosmos/iavl v0.15.3 h1:xE9r6HW8GeKeoYJN4zefpljZ1oukVScP/7M8oj6SUts= github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -106,22 +91,15 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsr github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= -github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3 h1:jh22xisGBjrEVnRZ1DVTpBVQm0Xndu8sMl0CWDzSIBI= -github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= -github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -132,34 +110,27 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= @@ -183,25 +154,20 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= -github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= @@ -215,7 +181,6 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= @@ -226,12 +191,9 @@ github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= -github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= @@ -263,7 +225,6 @@ github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -280,32 +241,24 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.4 h1:8KGKTcQQGm0Kv7vEbKFErAoAOFyyacLStRtQSeYtvkY= -github.com/magiconair/properties v1.8.4/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -328,9 +281,7 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= @@ -339,12 +290,10 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= 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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -360,16 +309,13 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -378,14 +324,12 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -394,41 +338,33 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= -github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= @@ -436,7 +372,6 @@ github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPH github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -457,33 +392,25 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= -github.com/tendermint/tendermint v0.34.8 h1:PMWgUx47FrNTsfhxCWzoiIlVAC1SE9+WBlnsF9oQW0I= -github.com/tendermint/tendermint v0.34.8/go.mod h1:JVuu3V1ZexOaZG8VJMRl8lnfrGw6hEB2TVnoUwKRbss= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= -github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= @@ -496,7 +423,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -525,12 +451,10 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -582,7 +506,7 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -631,13 +555,11 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -671,7 +593,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -702,8 +623,6 @@ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEY google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f h1:izedQ6yVIc5mZsRuXzmSreCOlzI0lCU1HpG8yEdMiKw= -google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -724,8 +643,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.35.0 h1:TwIQcH3es+MojMVojxxfQ3l3OF2KzlRxML2xZq0kRo8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -735,14 +654,12 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -750,7 +667,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= @@ -761,9 +677,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/module-sdk/integration_test/gov_test.go b/module-sdk/integration_test/gov_test.go index 1ded3a60..6fb5ca64 100644 --- a/module-sdk/integration_test/gov_test.go +++ b/module-sdk/integration_test/gov_test.go @@ -1,13 +1,11 @@ -package integration_test +package integrationtest import ( "encoding/json" "fmt" - + "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/gov-sdk-go" "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/gov" - "github.com/irisnet/irishub-sdk-go/types" ) func (s IntegrationTestSuite) TestGov() { diff --git a/module-sdk/integration_test/htlc_test.go b/module-sdk/integration_test/htlc_test.go index f632f887..1af77b73 100644 --- a/module-sdk/integration_test/htlc_test.go +++ b/module-sdk/integration_test/htlc_test.go @@ -1,15 +1,13 @@ -package integration_test +package integrationtest import ( "encoding/hex" "encoding/json" "fmt" - + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/htlc-sdk-go" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/tmhash" - - "github.com/irisnet/irishub-sdk-go/modules/htlc" - sdk "github.com/irisnet/irishub-sdk-go/types" ) func (s IntegrationTestSuite) TestHTLC() { diff --git a/module-sdk/integration_test/integration_test.go b/module-sdk/integration_test/integration_test.go index f128bcad..070ddf8a 100644 --- a/module-sdk/integration_test/integration_test.go +++ b/module-sdk/integration_test/integration_test.go @@ -1,19 +1,16 @@ -package integration_test +package integrationtest import ( + "github.com/irisnet/core-sdk-go/common/log" + "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/store" + "github.com/stretchr/testify/suite" "io/ioutil" "math/rand" "os" "path/filepath" "testing" "time" - - sdk "github.com/irisnet/irishub-sdk-go" - "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/store" - "github.com/irisnet/irishub-sdk-go/utils/log" - - "github.com/stretchr/testify/suite" ) const ( @@ -26,7 +23,7 @@ const ( type IntegrationTestSuite struct { suite.Suite - sdk.Client + Client r *rand.Rand rootAccount MockAccount randAccounts []MockAccount @@ -57,7 +54,7 @@ func (s *IntegrationTestSuite) SetupSuite() { panic(err) } - s.Client = sdk.NewIRISHUBClient(cfg) + s.Client = NewClient(cfg) s.r = rand.New(rand.NewSource(time.Now().UnixNano())) s.rootAccount = MockAccount{ Name: "validator", diff --git a/module-sdk/integration_test/nft_test.go b/module-sdk/integration_test/nft_test.go index 50e642b4..ce67b01e 100644 --- a/module-sdk/integration_test/nft_test.go +++ b/module-sdk/integration_test/nft_test.go @@ -1,13 +1,11 @@ -package integration_test +package integrationtest import ( "fmt" - "strings" - + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/nft-sdk-go" "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/nft" - sdk "github.com/irisnet/irishub-sdk-go/types" + "strings" ) func (s IntegrationTestSuite) TestNFT() { diff --git a/module-sdk/integration_test/oracle_test.go b/module-sdk/integration_test/oracle_test.go index 04311d11..d5ee0ee4 100644 --- a/module-sdk/integration_test/oracle_test.go +++ b/module-sdk/integration_test/oracle_test.go @@ -1,14 +1,12 @@ -package integration_test +package integrationtest import ( "fmt" - "time" - + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/oracle-sdk-go" + "github.com/irisnet/service-sdk-go" "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/oracle" - "github.com/irisnet/irishub-sdk-go/modules/service" - sdk "github.com/irisnet/irishub-sdk-go/types" + "time" ) var serviceName = generateServiceName() diff --git a/module-sdk/integration_test/random_test.go b/module-sdk/integration_test/random_test.go index 1a8d2df2..bf000e55 100644 --- a/module-sdk/integration_test/random_test.go +++ b/module-sdk/integration_test/random_test.go @@ -1,11 +1,10 @@ -package integration_test +package integrationtest import ( + "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/random-sdk-go" "strconv" "time" - - "github.com/irisnet/irishub-sdk-go/modules/random" - "github.com/irisnet/irishub-sdk-go/types" ) type TestRandom struct { diff --git a/module-sdk/integration_test/record_test.go b/module-sdk/integration_test/record_test.go index ce4fbc4e..43ca067f 100644 --- a/module-sdk/integration_test/record_test.go +++ b/module-sdk/integration_test/record_test.go @@ -1,12 +1,10 @@ -package integration_test +package integrationtest import ( "fmt" - + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/record-sdk-go" "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/record" - sdk "github.com/irisnet/irishub-sdk-go/types" ) func (s IntegrationTestSuite) TestRecord() { diff --git a/module-sdk/integration_test/service_test.go b/module-sdk/integration_test/service_test.go index 1910067d..93b90d5d 100644 --- a/module-sdk/integration_test/service_test.go +++ b/module-sdk/integration_test/service_test.go @@ -1,14 +1,11 @@ -package integration_test +package integrationtest import ( - "time" - + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/query" + "github.com/irisnet/service-sdk-go" "github.com/stretchr/testify/require" - - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/query" - - "github.com/irisnet/irishub-sdk-go/modules/service" + "time" ) func (s IntegrationTestSuite) TestService() { diff --git a/module-sdk/integration_test/staking_test.go b/module-sdk/integration_test/staking_test.go index b0ba5e26..cde4917b 100644 --- a/module-sdk/integration_test/staking_test.go +++ b/module-sdk/integration_test/staking_test.go @@ -1,12 +1,10 @@ -package integration_test +package integrationtest import ( "context" - + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/staking-sdk-go" "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/staking" - sdk "github.com/irisnet/irishub-sdk-go/types" ) func (s IntegrationTestSuite) TestStaking() { diff --git a/module-sdk/integration_test/token_test.go b/module-sdk/integration_test/token_test.go index ee9a0108..d2f04760 100644 --- a/module-sdk/integration_test/token_test.go +++ b/module-sdk/integration_test/token_test.go @@ -1,12 +1,10 @@ -package integration_test +package integrationtest import ( - "strings" - + sdk "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/token-sdk-go" "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/modules/token" - sdk "github.com/irisnet/irishub-sdk-go/types" + "strings" ) func (s IntegrationTestSuite) TestToken() { diff --git a/module-sdk/keys/export.go b/module-sdk/keys/export.go index 5e6c7e61..cf647732 100644 --- a/module-sdk/keys/export.go +++ b/module-sdk/keys/export.go @@ -1,7 +1,7 @@ package keys import ( - sdk "github.com/irisnet/irishub-sdk-go/types" + sdk "github.com/irisnet/core-sdk-go/types" ) type Client interface { diff --git a/module-sdk/keys/go.mod b/module-sdk/keys/go.mod new file mode 100644 index 00000000..58716753 --- /dev/null +++ b/module-sdk/keys/go.mod @@ -0,0 +1,13 @@ +module ithub.com/irisnet/keys-sdk-go + +go 1.16 + +require ( + github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 +) + +replace ( +github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +) \ No newline at end of file diff --git a/module-sdk/keys/keys.go b/module-sdk/keys/keys.go index 8fae3719..2fcae343 100644 --- a/module-sdk/keys/keys.go +++ b/module-sdk/keys/keys.go @@ -1,7 +1,7 @@ package keys import ( - sdk "github.com/irisnet/irishub-sdk-go/types" + sdk "github.com/irisnet/core-sdk-go/types" ) type keysClient struct { diff --git a/module-sdk/nft/nft.go b/module-sdk/nft/nft.go index 523fb77c..d9ae1efd 100644 --- a/module-sdk/nft/nft.go +++ b/module-sdk/nft/nft.go @@ -131,7 +131,7 @@ func (nc nftClient) QuerySupply(denom, creator string) (uint64, sdk.Error) { } conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return 0, sdk.Wrap(err) } @@ -160,7 +160,7 @@ func (nc nftClient) QueryOwner(creator, denom string) (QueryOwnerResp, sdk.Error } conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryOwnerResp{}, sdk.Wrap(err) } @@ -185,7 +185,7 @@ func (nc nftClient) QueryCollection(denom string) (QueryCollectionResp, sdk.Erro } conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryCollectionResp{}, sdk.Wrap(err) } @@ -203,7 +203,7 @@ func (nc nftClient) QueryCollection(denom string) (QueryCollectionResp, sdk.Erro func (nc nftClient) QueryDenoms() ([]QueryDenomResp, sdk.Error) { conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -221,7 +221,7 @@ func (nc nftClient) QueryDenoms() ([]QueryDenomResp, sdk.Error) { func (nc nftClient) QueryDenom(denom string) (QueryDenomResp, sdk.Error) { conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryDenomResp{}, sdk.Wrap(err) } @@ -247,7 +247,7 @@ func (nc nftClient) QueryNFT(denom, tokenID string) (QueryNFTResp, sdk.Error) { } conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryNFTResp{}, sdk.Wrap(err) } diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index bd4d7277..4a1b13dc 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -4,12 +4,12 @@ go 1.16 require ( github.com/irisnet/core-sdk-go v0.1.0 - github.com/irisnet/module-sdk/service v0.1.0 + github.com/irisnet/service-sdk-go v0.1.0 github.com/gogo/protobuf v1.3.3 ) replace ( github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk -github.com/irisnet/module-sdk/service => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/service + github.com/irisnet/service-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/service github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/oracle/oracle.go b/module-sdk/oracle/oracle.go index 08604fda..6fb3058e 100644 --- a/module-sdk/oracle/oracle.go +++ b/module-sdk/oracle/oracle.go @@ -113,7 +113,7 @@ func (oc oracleClient) QueryFeed(feedName string) (QueryFeedResp, sdk.Error) { } conn, err := oc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryFeedResp{}, sdk.Wrap(err) } @@ -135,7 +135,7 @@ func (oc oracleClient) QueryFeeds(state string) ([]QueryFeedResp, sdk.Error) { } conn, err := oc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -156,7 +156,7 @@ func (oc oracleClient) QueryFeedValue(feedName string) ([]QueryFeedValueResp, sd } conn, err := oc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } diff --git a/module-sdk/oracle/query.pb.go b/module-sdk/oracle/query.pb.go index af56f5c4..e695a9c0 100644 --- a/module-sdk/oracle/query.pb.go +++ b/module-sdk/oracle/query.pb.go @@ -9,7 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - service "github.com/irisnet/module-sdk/service" + service "github.com/irisnet/service-sdk-go" github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" types "github.com/irisnet/core-sdk-go/types" _ "google.golang.org/genproto/googleapis/api/annotations" diff --git a/module-sdk/random/random.go b/module-sdk/random/random.go index 2e30721a..ce6e1e15 100644 --- a/module-sdk/random/random.go +++ b/module-sdk/random/random.go @@ -71,7 +71,7 @@ func (rc randomClient) QueryRandom(reqID string) (QueryRandomResp, sdk.Error) { } conn, err := rc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryRandomResp{}, sdk.Wrap(err) } @@ -92,7 +92,7 @@ func (rc randomClient) QueryRandomRequestQueue(height int64) ([]QueryRandomReque } conn, err := rc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return []QueryRandomRequestQueueResp{}, sdk.Wrap(err) } diff --git a/module-sdk/service/service.go b/module-sdk/service/service.go index ba1c20c2..c26e3877 100644 --- a/module-sdk/service/service.go +++ b/module-sdk/service/service.go @@ -437,7 +437,7 @@ func (s serviceClient) SubscribeServiceRequest(serviceName string, // QueryServiceDefinition return a service definition of the specified name func (s serviceClient) QueryServiceDefinition(serviceName string) (QueryServiceDefinitionResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryServiceDefinitionResponse{}, sdk.Wrap(err) } @@ -456,7 +456,7 @@ func (s serviceClient) QueryServiceDefinition(serviceName string) (QueryServiceD // QueryServiceBinding return the specified service binding func (s serviceClient) QueryServiceBinding(serviceName string, provider string) (QueryServiceBindingResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryServiceBindingResponse{}, sdk.Wrap(err) } @@ -482,7 +482,7 @@ func (s serviceClient) QueryServiceBinding(serviceName string, provider string) // QueryServiceBindings returns all bindings of the specified service func (s serviceClient) QueryServiceBindings(serviceName string, pageReq *query.PageRequest) ([]QueryServiceBindingResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -504,7 +504,7 @@ func (s serviceClient) QueryServiceBindings(serviceName string, pageReq *query.P // QueryServiceRequest returns the active request of the specified requestID func (s serviceClient) QueryServiceRequest(requestID string) (QueryServiceRequestResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryServiceRequestResponse{}, sdk.Wrap(err) } @@ -530,7 +530,7 @@ func (s serviceClient) QueryServiceRequest(requestID string) (QueryServiceReques // QueryServiceRequests returns all the active requests of the specified service binding func (s serviceClient) QueryServiceRequests(serviceName string, provider string, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -557,7 +557,7 @@ func (s serviceClient) QueryServiceRequests(serviceName string, provider string, // QueryRequestsByReqCtx returns all requests of the specified request context ID and batch counter func (s serviceClient) QueryRequestsByReqCtx(reqCtxID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -580,7 +580,7 @@ func (s serviceClient) QueryRequestsByReqCtx(reqCtxID string, batchCounter uint6 // QueryServiceResponse returns a response with the speicified request ID func (s serviceClient) QueryServiceResponse(requestID string) (QueryServiceResponseResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryServiceResponseResponse{}, sdk.Wrap(err) } @@ -605,7 +605,7 @@ func (s serviceClient) QueryServiceResponse(requestID string) (QueryServiceRespo // QueryServiceResponses returns all responses of the specified request context and batch counter func (s serviceClient) QueryServiceResponses(reqCtxID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceResponseResponse, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -628,7 +628,7 @@ func (s serviceClient) QueryServiceResponses(reqCtxID string, batchCounter uint6 // QueryRequestContext return the specified request context func (s serviceClient) QueryRequestContext(reqCtxID string) (QueryRequestContextResp, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryRequestContextResp{}, sdk.Wrap(err) } @@ -656,7 +656,7 @@ func (s serviceClient) QueryFees(provider string) (sdk.Coins, sdk.Error) { } conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } @@ -673,7 +673,7 @@ func (s serviceClient) QueryFees(provider string) (sdk.Coins, sdk.Error) { func (s serviceClient) QueryParams() (QueryParamsResp, sdk.Error) { conn, err := s.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryParamsResp{}, sdk.Wrap(err) } diff --git a/module-sdk/staking/staking.go b/module-sdk/staking/staking.go index a6f4fdb4..238a3d13 100644 --- a/module-sdk/staking/staking.go +++ b/module-sdk/staking/staking.go @@ -156,7 +156,7 @@ func (sc stakingClient) BeginRedelegate(request BeginRedelegateRequest, baseTx s // about status, you can see BondStatus_value func (sc stakingClient) QueryValidators(status string, page, size uint64) (QueryValidatorsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryValidatorsResp{}, sdk.Wrap(err) } @@ -181,7 +181,7 @@ func (sc stakingClient) QueryValidators(status string, page, size uint64) (Query func (sc stakingClient) QueryValidator(validatorAddr string) (QueryValidatorResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryValidatorResp{}, sdk.Wrap(err) } @@ -200,7 +200,7 @@ func (sc stakingClient) QueryValidator(validatorAddr string) (QueryValidatorResp func (sc stakingClient) QueryValidatorDelegations(validatorAddr string, page, size uint64) (QueryValidatorDelegationsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryValidatorDelegationsResp{}, sdk.Wrap(err) } @@ -225,7 +225,7 @@ func (sc stakingClient) QueryValidatorDelegations(validatorAddr string, page, si func (sc stakingClient) QueryValidatorUnbondingDelegations(validatorAddr string, page, size uint64) (QueryValidatorUnbondingDelegationsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryValidatorUnbondingDelegationsResp{}, sdk.Wrap(err) } @@ -250,7 +250,7 @@ func (sc stakingClient) QueryValidatorUnbondingDelegations(validatorAddr string, func (sc stakingClient) QueryDelegation(delegatorAddr string, validatorAddr string) (QueryDelegationResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryDelegationResp{}, sdk.Wrap(err) } @@ -270,7 +270,7 @@ func (sc stakingClient) QueryDelegation(delegatorAddr string, validatorAddr stri func (sc stakingClient) QueryUnbondingDelegation(delegatorAddr string, validatorAddr string) (QueryUnbondingDelegationResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryUnbondingDelegationResp{}, sdk.Wrap(err) } @@ -290,7 +290,7 @@ func (sc stakingClient) QueryUnbondingDelegation(delegatorAddr string, validator func (sc stakingClient) QueryDelegatorDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorDelegationsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryDelegatorDelegationsResp{}, sdk.Wrap(err) } @@ -315,7 +315,7 @@ func (sc stakingClient) QueryDelegatorDelegations(delegatorAddr string, page, si func (sc stakingClient) QueryDelegatorUnbondingDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorUnbondingDelegationsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryDelegatorUnbondingDelegationsResp{}, sdk.Wrap(err) } @@ -340,7 +340,7 @@ func (sc stakingClient) QueryDelegatorUnbondingDelegations(delegatorAddr string, func (sc stakingClient) QueryRedelegations(request QueryRedelegationsReq) (QueryRedelegationsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryRedelegationsResp{}, sdk.Wrap(err) } @@ -367,7 +367,7 @@ func (sc stakingClient) QueryRedelegations(request QueryRedelegationsReq) (Query func (sc stakingClient) QueryDelegatorValidators(delegatorAddr string, page, size uint64) (QueryDelegatorValidatorsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryDelegatorValidatorsResp{}, sdk.Wrap(err) } @@ -392,7 +392,7 @@ func (sc stakingClient) QueryDelegatorValidators(delegatorAddr string, page, siz func (sc stakingClient) QueryDelegatorValidator(delegatorAddr string, validatorAddr string) (QueryValidatorResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryValidatorResp{}, sdk.Wrap(err) } @@ -413,7 +413,7 @@ func (sc stakingClient) QueryDelegatorValidator(delegatorAddr string, validatorA // QueryHistoricalInfo tendermint only save latest 100 block, previous block is aborted func (sc stakingClient) QueryHistoricalInfo(height int64) (QueryHistoricalInfoResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryHistoricalInfoResp{}, sdk.Wrap(err) } @@ -432,7 +432,7 @@ func (sc stakingClient) QueryHistoricalInfo(height int64) (QueryHistoricalInfoRe func (sc stakingClient) QueryPool() (QueryPoolResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryPoolResp{}, sdk.Wrap(err) } @@ -453,7 +453,7 @@ func (sc stakingClient) QueryPool() (QueryPoolResp, sdk.Error) { func (sc stakingClient) QueryParams() (QueryParamsResp, sdk.Error) { conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryParamsResp{}, sdk.Wrap(err) } diff --git a/third_party/github.com/confio/ics23/go/proofs.pb.go b/module-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go similarity index 100% rename from third_party/github.com/confio/ics23/go/proofs.pb.go rename to module-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go diff --git a/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/module-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go similarity index 100% rename from third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go rename to module-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go diff --git a/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go b/module-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go similarity index 100% rename from third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go rename to module-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go diff --git a/third_party/proto/confio/proofs.proto b/module-sdk/third_party/proto/confio/proofs.proto similarity index 100% rename from third_party/proto/confio/proofs.proto rename to module-sdk/third_party/proto/confio/proofs.proto diff --git a/third_party/proto/cosmos_proto/cosmos.proto b/module-sdk/third_party/proto/cosmos_proto/cosmos.proto similarity index 100% rename from third_party/proto/cosmos_proto/cosmos.proto rename to module-sdk/third_party/proto/cosmos_proto/cosmos.proto diff --git a/third_party/proto/gogoproto/gogo.proto b/module-sdk/third_party/proto/gogoproto/gogo.proto similarity index 100% rename from third_party/proto/gogoproto/gogo.proto rename to module-sdk/third_party/proto/gogoproto/gogo.proto diff --git a/third_party/proto/google/api/annotations.proto b/module-sdk/third_party/proto/google/api/annotations.proto similarity index 100% rename from third_party/proto/google/api/annotations.proto rename to module-sdk/third_party/proto/google/api/annotations.proto diff --git a/third_party/proto/google/api/http.proto b/module-sdk/third_party/proto/google/api/http.proto similarity index 100% rename from third_party/proto/google/api/http.proto rename to module-sdk/third_party/proto/google/api/http.proto diff --git a/third_party/proto/google/api/httpbody.proto b/module-sdk/third_party/proto/google/api/httpbody.proto similarity index 100% rename from third_party/proto/google/api/httpbody.proto rename to module-sdk/third_party/proto/google/api/httpbody.proto diff --git a/third_party/proto/google/protobuf/any.proto b/module-sdk/third_party/proto/google/protobuf/any.proto similarity index 100% rename from third_party/proto/google/protobuf/any.proto rename to module-sdk/third_party/proto/google/protobuf/any.proto diff --git a/third_party/proto/tendermint/abci/types.proto b/module-sdk/third_party/proto/tendermint/abci/types.proto similarity index 100% rename from third_party/proto/tendermint/abci/types.proto rename to module-sdk/third_party/proto/tendermint/abci/types.proto diff --git a/third_party/proto/tendermint/crypto/keys.proto b/module-sdk/third_party/proto/tendermint/crypto/keys.proto similarity index 100% rename from third_party/proto/tendermint/crypto/keys.proto rename to module-sdk/third_party/proto/tendermint/crypto/keys.proto diff --git a/third_party/proto/tendermint/crypto/proof.proto b/module-sdk/third_party/proto/tendermint/crypto/proof.proto similarity index 100% rename from third_party/proto/tendermint/crypto/proof.proto rename to module-sdk/third_party/proto/tendermint/crypto/proof.proto diff --git a/third_party/proto/tendermint/libs/bits/types.proto b/module-sdk/third_party/proto/tendermint/libs/bits/types.proto similarity index 100% rename from third_party/proto/tendermint/libs/bits/types.proto rename to module-sdk/third_party/proto/tendermint/libs/bits/types.proto diff --git a/third_party/proto/tendermint/types/evidence.proto b/module-sdk/third_party/proto/tendermint/types/evidence.proto similarity index 100% rename from third_party/proto/tendermint/types/evidence.proto rename to module-sdk/third_party/proto/tendermint/types/evidence.proto diff --git a/third_party/proto/tendermint/types/params.proto b/module-sdk/third_party/proto/tendermint/types/params.proto similarity index 100% rename from third_party/proto/tendermint/types/params.proto rename to module-sdk/third_party/proto/tendermint/types/params.proto diff --git a/third_party/proto/tendermint/types/types.proto b/module-sdk/third_party/proto/tendermint/types/types.proto similarity index 100% rename from third_party/proto/tendermint/types/types.proto rename to module-sdk/third_party/proto/tendermint/types/types.proto diff --git a/third_party/proto/tendermint/types/validator.proto b/module-sdk/third_party/proto/tendermint/types/validator.proto similarity index 100% rename from third_party/proto/tendermint/types/validator.proto rename to module-sdk/third_party/proto/tendermint/types/validator.proto diff --git a/third_party/proto/tendermint/version/types.proto b/module-sdk/third_party/proto/tendermint/version/types.proto similarity index 100% rename from third_party/proto/tendermint/version/types.proto rename to module-sdk/third_party/proto/tendermint/version/types.proto diff --git a/third_party/protocgen.sh b/module-sdk/third_party/protocgen.sh similarity index 100% rename from third_party/protocgen.sh rename to module-sdk/third_party/protocgen.sh diff --git a/module-sdk/token/token.go b/module-sdk/token/token.go index 033031a5..820c358f 100644 --- a/module-sdk/token/token.go +++ b/module-sdk/token/token.go @@ -124,7 +124,6 @@ func (t tokenClient) QueryTokens(owner string) (sdk.Tokens, error) { } conn, err := t.GenConn() - defer func() { _ = conn.Close() }() if err != nil { return sdk.Tokens{}, sdk.Wrap(err) @@ -155,7 +154,7 @@ func (t tokenClient) QueryTokens(owner string) (sdk.Tokens, error) { func (t tokenClient) QueryFees(symbol string) (QueryFeesResp, error) { conn, err := t.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryFeesResp{}, sdk.Wrap(err) } @@ -174,7 +173,7 @@ func (t tokenClient) QueryFees(symbol string) (QueryFeesResp, error) { func (t tokenClient) QueryParams() (QueryParamsResp, error) { conn, err := t.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return QueryParamsResp{}, sdk.Wrap(err) } diff --git a/modules/account.go b/modules/account.go deleted file mode 100644 index 8fdb86e2..00000000 --- a/modules/account.go +++ /dev/null @@ -1,142 +0,0 @@ -package modules - -import ( - "context" - "fmt" - "time" - - "github.com/tendermint/tendermint/libs/log" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/modules/auth" - "github.com/irisnet/irishub-sdk-go/modules/bank" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/utils/cache" -) - -// Must be used with locker, otherwise there are thread safety issues -type accountQuery struct { - sdk.Queries - sdk.GRPCClient - log.Logger - cache.Cache - cdc codec.Marshaler - km sdk.KeyManager - expiration time.Duration -} - -func (a accountQuery) QueryAndRefreshAccount(address string) (sdk.BaseAccount, sdk.Error) { - account, err := a.Get(a.prefixKey(address)) - if err != nil { - return a.refresh(address) - } - - acc := account.(accountInfo) - baseAcc := sdk.BaseAccount{ - Address: address, - AccountNumber: acc.N, - Sequence: acc.S + 1, - } - a.saveAccount(baseAcc) - - a.Debug("query account from cache", "address", address) - return baseAcc, nil -} - -func (a accountQuery) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { - conn, err := a.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - request := &auth.QueryAccountRequest{ - Address: address, - } - - response, err := auth.NewQueryClient(conn).Account(context.Background(), request) - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - var baseAccount auth.Account - if err := a.cdc.UnpackAny(response.Account, &baseAccount); err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - account := baseAccount.(*auth.BaseAccount).ConvertAccount(a.cdc).(sdk.BaseAccount) - - breq := &bank.QueryAllBalancesRequest{ - Address: address, - Pagination: nil, - } - balances, err := bank.NewQueryClient(conn).AllBalances(context.Background(), breq) - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - account.Coins = balances.Balances - return account, nil -} - -func (a accountQuery) QueryAddress(name, password string) (sdk.AccAddress, sdk.Error) { - addr, err := a.Get(a.prefixKey(name)) - if err == nil { - address, err := sdk.AccAddressFromBech32(addr.(string)) - if err != nil { - a.Debug("invalid address", "name", name) - _ = a.Remove(a.prefixKey(name)) - } else { - return address, nil - } - } - - _, address, err := a.km.Find(name, password) - if err != nil { - a.Debug("can't find account", "name", name) - return address, sdk.Wrap(err) - } - - if err := a.SetWithExpire(a.prefixKey(name), address.String(), a.expiration); err != nil { - a.Debug("cache user failed", "name", name) - } - a.Debug("query user from cache", "name", name, "address", address.String()) - return address, nil -} - -func (a accountQuery) removeCache(address string) bool { - return a.Remove(a.prefixKey(address)) -} - -func (a accountQuery) refresh(address string) (sdk.BaseAccount, sdk.Error) { - account, err := a.QueryAccount(address) - if err != nil { - a.Error("update cache failed", "address", address, "errMsg", err.Error()) - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - a.saveAccount(account) - return account, nil -} - -func (a accountQuery) saveAccount(account sdk.BaseAccount) { - address := account.Address - info := accountInfo{ - N: account.AccountNumber, - S: account.Sequence, - } - if err := a.SetWithExpire(a.prefixKey(address), info, a.expiration); err != nil { - a.Debug("cache user failed", "address", account.Address) - return - } - a.Debug("cache account", "address", address, "expiration", a.expiration.String()) -} - -func (a accountQuery) prefixKey(address string) string { - return fmt.Sprintf("account:%s", address) -} - -type accountInfo struct { - N uint64 `json:"n"` - S uint64 `json:"s"` -} diff --git a/modules/auth/auth.pb.go b/modules/auth/auth.pb.go deleted file mode 100644 index 8032fb30..00000000 --- a/modules/auth/auth.pb.go +++ /dev/null @@ -1,1048 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/auth/v1beta1/auth.proto - -package auth - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - _ "github.com/regen-network/cosmos-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 - -// BaseAccount defines a base account type. It contains all the necessary fields -// for basic account functionality. Any custom account type should extend this -// type for additional functionality (e.g. vesting). -type BaseAccount struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` - AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` - Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` -} - -func (m *BaseAccount) Reset() { *m = BaseAccount{} } -func (*BaseAccount) ProtoMessage() {} -func (*BaseAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_7e1f7e915d020d2d, []int{0} -} -func (m *BaseAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BaseAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BaseAccount.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 *BaseAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_BaseAccount.Merge(m, src) -} -func (m *BaseAccount) XXX_Size() int { - return m.Size() -} -func (m *BaseAccount) XXX_DiscardUnknown() { - xxx_messageInfo_BaseAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_BaseAccount proto.InternalMessageInfo - -// ModuleAccount defines an account for modules that holds coins on a pool. -type ModuleAccount struct { - *BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty" yaml:"base_account"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Permissions []string `protobuf:"bytes,3,rep,name=permissions,proto3" json:"permissions,omitempty"` -} - -func (m *ModuleAccount) Reset() { *m = ModuleAccount{} } -func (*ModuleAccount) ProtoMessage() {} -func (*ModuleAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_7e1f7e915d020d2d, []int{1} -} -func (m *ModuleAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModuleAccount.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 *ModuleAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleAccount.Merge(m, src) -} -func (m *ModuleAccount) XXX_Size() int { - return m.Size() -} -func (m *ModuleAccount) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleAccount proto.InternalMessageInfo - -// Params defines the parameters for the auth module. -type Params struct { - MaxMemoCharacters uint64 `protobuf:"varint,1,opt,name=max_memo_characters,json=maxMemoCharacters,proto3" json:"max_memo_characters,omitempty" yaml:"max_memo_characters"` - TxSigLimit uint64 `protobuf:"varint,2,opt,name=tx_sig_limit,json=txSigLimit,proto3" json:"tx_sig_limit,omitempty" yaml:"tx_sig_limit"` - TxSizeCostPerByte uint64 `protobuf:"varint,3,opt,name=tx_size_cost_per_byte,json=txSizeCostPerByte,proto3" json:"tx_size_cost_per_byte,omitempty" yaml:"tx_size_cost_per_byte"` - SigVerifyCostED25519 uint64 `protobuf:"varint,4,opt,name=sig_verify_cost_ed25519,json=sigVerifyCostEd25519,proto3" json:"sig_verify_cost_ed25519,omitempty" yaml:"sig_verify_cost_ed25519"` - SigVerifyCostSecp256k1 uint64 `protobuf:"varint,5,opt,name=sig_verify_cost_secp256k1,json=sigVerifyCostSecp256k1,proto3" json:"sig_verify_cost_secp256k1,omitempty" yaml:"sig_verify_cost_secp256k1"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_7e1f7e915d020d2d, []int{2} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetMaxMemoCharacters() uint64 { - if m != nil { - return m.MaxMemoCharacters - } - return 0 -} - -func (m *Params) GetTxSigLimit() uint64 { - if m != nil { - return m.TxSigLimit - } - return 0 -} - -func (m *Params) GetTxSizeCostPerByte() uint64 { - if m != nil { - return m.TxSizeCostPerByte - } - return 0 -} - -func (m *Params) GetSigVerifyCostED25519() uint64 { - if m != nil { - return m.SigVerifyCostED25519 - } - return 0 -} - -func (m *Params) GetSigVerifyCostSecp256k1() uint64 { - if m != nil { - return m.SigVerifyCostSecp256k1 - } - return 0 -} - -func init() { - proto.RegisterType((*BaseAccount)(nil), "cosmos.auth.v1beta1.BaseAccount") - proto.RegisterType((*ModuleAccount)(nil), "cosmos.auth.v1beta1.ModuleAccount") - proto.RegisterType((*Params)(nil), "cosmos.auth.v1beta1.Params") -} - -func init() { proto.RegisterFile("cosmos/auth/v1beta1/auth.proto", fileDescriptor_7e1f7e915d020d2d) } - -var fileDescriptor_7e1f7e915d020d2d = []byte{ - // 681 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0xcf, 0x4f, 0xdb, 0x48, - 0x14, 0x8e, 0x37, 0x59, 0x7e, 0x4c, 0x00, 0x09, 0x13, 0xc0, 0xc9, 0xae, 0x6c, 0xcb, 0xa7, 0x1c, - 0x36, 0x8e, 0x92, 0x15, 0x2b, 0x91, 0xc3, 0x6a, 0x31, 0x5b, 0xa9, 0xa8, 0x05, 0x21, 0x23, 0xf5, - 0x50, 0x55, 0x72, 0xc7, 0xce, 0xe0, 0x58, 0x64, 0x3c, 0xc6, 0x33, 0x46, 0x31, 0x7f, 0x41, 0x8f, - 0x3d, 0xf6, 0xc8, 0x1f, 0xc1, 0x7f, 0xd0, 0x4b, 0x8f, 0x88, 0x53, 0x4f, 0x6e, 0x15, 0x2e, 0x55, - 0x8f, 0xb9, 0x57, 0xaa, 0x32, 0xe3, 0x84, 0x04, 0xa5, 0xa7, 0xcc, 0xfb, 0xbe, 0xef, 0x7d, 0xef, - 0xcd, 0x7b, 0x13, 0x03, 0xd5, 0x23, 0x14, 0x13, 0xda, 0x84, 0x09, 0xeb, 0x35, 0xaf, 0x5a, 0x2e, - 0x62, 0xb0, 0xc5, 0x03, 0x33, 0x8a, 0x09, 0x23, 0xf2, 0x96, 0xe0, 0x4d, 0x0e, 0xe5, 0x7c, 0xad, - 0x2a, 0x40, 0x87, 0x4b, 0x9a, 0xb9, 0x82, 0x07, 0xb5, 0x8a, 0x4f, 0x7c, 0x22, 0xf0, 0xf1, 0x29, - 0x47, 0xab, 0x3e, 0x21, 0x7e, 0x1f, 0x35, 0x79, 0xe4, 0x26, 0xe7, 0x4d, 0x18, 0xa6, 0x82, 0x32, - 0x7e, 0x48, 0xa0, 0x6c, 0x41, 0x8a, 0x0e, 0x3c, 0x8f, 0x24, 0x21, 0x93, 0x15, 0xb0, 0x0c, 0xbb, - 0xdd, 0x18, 0x51, 0xaa, 0x48, 0xba, 0x54, 0x5f, 0xb5, 0x27, 0xa1, 0xfc, 0x06, 0x2c, 0x47, 0x89, - 0xeb, 0x5c, 0xa0, 0x54, 0xf9, 0x4d, 0x97, 0xea, 0xe5, 0x76, 0xc5, 0x14, 0xb6, 0xe6, 0xc4, 0xd6, - 0x3c, 0x08, 0x53, 0xab, 0xf1, 0x3d, 0xd3, 0x2a, 0x51, 0xe2, 0xf6, 0x03, 0x6f, 0xac, 0xfd, 0x8b, - 0xe0, 0x80, 0x21, 0x1c, 0xb1, 0x74, 0x94, 0x69, 0x9b, 0x29, 0xc4, 0xfd, 0x8e, 0xf1, 0xc8, 0x1a, - 0xf6, 0x52, 0x94, 0xb8, 0x2f, 0x50, 0x2a, 0xff, 0x07, 0x36, 0xa0, 0x68, 0xc1, 0x09, 0x13, 0xec, - 0xa2, 0x58, 0x29, 0xea, 0x52, 0xbd, 0x64, 0x55, 0x47, 0x99, 0xb6, 0x2d, 0xd2, 0xe6, 0x79, 0xc3, - 0x5e, 0xcf, 0x81, 0x13, 0x1e, 0xcb, 0x35, 0xb0, 0x42, 0xd1, 0x65, 0x82, 0x42, 0x0f, 0x29, 0xa5, - 0x71, 0xae, 0x3d, 0x8d, 0x3b, 0xca, 0xbb, 0x1b, 0xad, 0xf0, 0xe1, 0x46, 0x2b, 0x7c, 0xbb, 0xd1, - 0x0a, 0xf7, 0xb7, 0x8d, 0x95, 0xfc, 0xba, 0x47, 0xc6, 0x47, 0x09, 0xac, 0x1f, 0x93, 0x6e, 0xd2, - 0x9f, 0x4e, 0xe0, 0x2d, 0x58, 0x73, 0x21, 0x45, 0x4e, 0xee, 0xce, 0xc7, 0x50, 0x6e, 0xeb, 0xe6, - 0x82, 0x4d, 0x98, 0x33, 0x93, 0xb3, 0xfe, 0xb8, 0xcb, 0x34, 0x69, 0x94, 0x69, 0x5b, 0xa2, 0xdb, - 0x59, 0x0f, 0xc3, 0x2e, 0xbb, 0x33, 0x33, 0x96, 0x41, 0x29, 0x84, 0x18, 0xf1, 0x31, 0xae, 0xda, - 0xfc, 0x2c, 0xeb, 0xa0, 0x1c, 0xa1, 0x18, 0x07, 0x94, 0x06, 0x24, 0xa4, 0x4a, 0x51, 0x2f, 0xd6, - 0x57, 0xed, 0x59, 0xa8, 0x53, 0x9b, 0xdc, 0xe1, 0xfe, 0xb6, 0xb1, 0x31, 0xd7, 0xf2, 0x91, 0xf1, - 0xa5, 0x08, 0x96, 0x4e, 0x61, 0x0c, 0x31, 0x95, 0x4f, 0xc0, 0x16, 0x86, 0x03, 0x07, 0x23, 0x4c, - 0x1c, 0xaf, 0x07, 0x63, 0xe8, 0x31, 0x14, 0x8b, 0x65, 0x96, 0x2c, 0x75, 0x94, 0x69, 0x35, 0xd1, - 0xdf, 0x02, 0x91, 0x61, 0x6f, 0x62, 0x38, 0x38, 0x46, 0x98, 0x1c, 0x4e, 0x31, 0x79, 0x1f, 0xac, - 0xb1, 0x81, 0x43, 0x03, 0xdf, 0xe9, 0x07, 0x38, 0x60, 0xbc, 0xe9, 0x92, 0xb5, 0xfb, 0x78, 0xd1, - 0x59, 0xd6, 0xb0, 0x01, 0x1b, 0x9c, 0x05, 0xfe, 0xcb, 0x71, 0x20, 0xdb, 0x60, 0x9b, 0x93, 0xd7, - 0xc8, 0xf1, 0x08, 0x65, 0x4e, 0x84, 0x62, 0xc7, 0x4d, 0x19, 0xca, 0x57, 0xab, 0x8f, 0x32, 0xed, - 0xcf, 0x19, 0x8f, 0xa7, 0x32, 0xc3, 0xde, 0x1c, 0x9b, 0x5d, 0xa3, 0x43, 0x42, 0xd9, 0x29, 0x8a, - 0xad, 0x94, 0x21, 0xf9, 0x12, 0xec, 0x8e, 0xab, 0x5d, 0xa1, 0x38, 0x38, 0x4f, 0x85, 0x1e, 0x75, - 0xdb, 0x7b, 0x7b, 0xad, 0x7d, 0xb1, 0x74, 0xab, 0x33, 0xcc, 0xb4, 0xca, 0x59, 0xe0, 0xbf, 0xe2, - 0x8a, 0x71, 0xea, 0xb3, 0xff, 0x39, 0x3f, 0xca, 0x34, 0x55, 0x54, 0xfb, 0x85, 0x81, 0x61, 0x57, - 0xe8, 0x5c, 0x9e, 0x80, 0xe5, 0x14, 0x54, 0x9f, 0x66, 0x50, 0xe4, 0x45, 0xed, 0xbd, 0x7f, 0x2e, - 0x5a, 0xca, 0xef, 0xbc, 0xe8, 0xbf, 0xc3, 0x4c, 0xdb, 0x99, 0x2b, 0x7a, 0x36, 0x51, 0x8c, 0x32, - 0x4d, 0x5f, 0x5c, 0x76, 0x6a, 0x62, 0xd8, 0x3b, 0x74, 0x61, 0x6e, 0x67, 0x25, 0x7f, 0xb3, 0x92, - 0xf5, 0xfc, 0xd3, 0x50, 0x95, 0xee, 0x86, 0xaa, 0xf4, 0x75, 0xa8, 0x4a, 0xef, 0x1f, 0xd4, 0xc2, - 0xdd, 0x83, 0x5a, 0xf8, 0xfc, 0xa0, 0x16, 0x5e, 0x9b, 0x7e, 0xc0, 0x7a, 0x89, 0x6b, 0x7a, 0x04, - 0x37, 0x83, 0x38, 0xa0, 0x21, 0x62, 0xfc, 0xb7, 0x97, 0xb8, 0x0d, 0xda, 0xbd, 0x68, 0xf8, 0xa4, - 0x89, 0xf9, 0x6b, 0x11, 0x5f, 0x19, 0x77, 0x89, 0xff, 0x5d, 0xff, 0xfe, 0x19, 0x00, 0x00, 0xff, - 0xff, 0x6e, 0x7f, 0xc4, 0x1e, 0x7b, 0x04, 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 - } - if this.MaxMemoCharacters != that1.MaxMemoCharacters { - return false - } - if this.TxSigLimit != that1.TxSigLimit { - return false - } - if this.TxSizeCostPerByte != that1.TxSizeCostPerByte { - return false - } - if this.SigVerifyCostED25519 != that1.SigVerifyCostED25519 { - return false - } - if this.SigVerifyCostSecp256k1 != that1.SigVerifyCostSecp256k1 { - return false - } - return true -} -func (m *BaseAccount) 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 *BaseAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BaseAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sequence != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x20 - } - if m.AccountNumber != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.AccountNumber)) - i-- - dAtA[i] = 0x18 - } - if m.PubKey != nil { - { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuth(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ModuleAccount) 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 *ModuleAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Permissions) > 0 { - for iNdEx := len(m.Permissions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Permissions[iNdEx]) - copy(dAtA[i:], m.Permissions[iNdEx]) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Permissions[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if m.BaseAccount != nil { - { - size, err := m.BaseAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuth(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.SigVerifyCostSecp256k1 != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.SigVerifyCostSecp256k1)) - i-- - dAtA[i] = 0x28 - } - if m.SigVerifyCostED25519 != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.SigVerifyCostED25519)) - i-- - dAtA[i] = 0x20 - } - if m.TxSizeCostPerByte != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.TxSizeCostPerByte)) - i-- - dAtA[i] = 0x18 - } - if m.TxSigLimit != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.TxSigLimit)) - i-- - dAtA[i] = 0x10 - } - if m.MaxMemoCharacters != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.MaxMemoCharacters)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintAuth(dAtA []byte, offset int, v uint64) int { - offset -= sovAuth(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BaseAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - if m.PubKey != nil { - l = m.PubKey.Size() - n += 1 + l + sovAuth(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovAuth(uint64(m.AccountNumber)) - } - if m.Sequence != 0 { - n += 1 + sovAuth(uint64(m.Sequence)) - } - return n -} - -func (m *ModuleAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BaseAccount != nil { - l = m.BaseAccount.Size() - n += 1 + l + sovAuth(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - if len(m.Permissions) > 0 { - for _, s := range m.Permissions { - l = len(s) - n += 1 + l + sovAuth(uint64(l)) - } - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MaxMemoCharacters != 0 { - n += 1 + sovAuth(uint64(m.MaxMemoCharacters)) - } - if m.TxSigLimit != 0 { - n += 1 + sovAuth(uint64(m.TxSigLimit)) - } - if m.TxSizeCostPerByte != 0 { - n += 1 + sovAuth(uint64(m.TxSizeCostPerByte)) - } - if m.SigVerifyCostED25519 != 0 { - n += 1 + sovAuth(uint64(m.SigVerifyCostED25519)) - } - if m.SigVerifyCostSecp256k1 != 0 { - n += 1 + sovAuth(uint64(m.SigVerifyCostSecp256k1)) - } - return n -} - -func sovAuth(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAuth(x uint64) (n int) { - return sovAuth(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BaseAccount) 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 ErrIntOverflowAuth - } - 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: BaseAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BaseAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - 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 ErrInvalidLengthAuth - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PubKey == nil { - m.PubKey = &types.Any{} - } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) - } - m.AccountNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AccountNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleAccount) 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 ErrIntOverflowAuth - } - 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: ModuleAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BaseAccount == nil { - m.BaseAccount = &BaseAccount{} - } - if err := m.BaseAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - 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 ErrInvalidLengthAuth - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - 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 ErrInvalidLengthAuth - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Permissions = append(m.Permissions, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxMemoCharacters", wireType) - } - m.MaxMemoCharacters = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxMemoCharacters |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxSigLimit", wireType) - } - m.TxSigLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxSigLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxSizeCostPerByte", wireType) - } - m.TxSizeCostPerByte = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxSizeCostPerByte |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigVerifyCostED25519", wireType) - } - m.SigVerifyCostED25519 = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigVerifyCostED25519 |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigVerifyCostSecp256k1", wireType) - } - m.SigVerifyCostSecp256k1 = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigVerifyCostSecp256k1 |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAuth(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, ErrIntOverflowAuth - } - 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, ErrIntOverflowAuth - } - 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, ErrIntOverflowAuth - } - 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, ErrInvalidLengthAuth - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAuth - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAuth - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAuth = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/auth/params.go b/modules/auth/params.go deleted file mode 100644 index 68cd240b..00000000 --- a/modules/auth/params.go +++ /dev/null @@ -1,11 +0,0 @@ -package auth - -import ( - yaml "gopkg.in/yaml.v2" -) - -// String implements the stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/modules/auth/query.pb.go b/modules/auth/query.pb.go deleted file mode 100644 index adc79ca4..00000000 --- a/modules/auth/query.pb.go +++ /dev/null @@ -1,930 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/auth/v1beta1/query.proto - -package auth - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - _ "github.com/regen-network/cosmos-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 - -// QueryAccountRequest is the request type for the Query/Account RPC method. -type QueryAccountRequest struct { - // address defines the address to query for. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *QueryAccountRequest) Reset() { *m = QueryAccountRequest{} } -func (m *QueryAccountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAccountRequest) ProtoMessage() {} -func (*QueryAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c451370b3929a27c, []int{0} -} -func (m *QueryAccountRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAccountRequest.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 *QueryAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAccountRequest.Merge(m, src) -} -func (m *QueryAccountRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAccountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAccountRequest proto.InternalMessageInfo - -// QueryAccountResponse is the response type for the Query/Account RPC method. -type QueryAccountResponse struct { - // account defines the account of the corresponding address. - Account *types.Any `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` -} - -func (m *QueryAccountResponse) Reset() { *m = QueryAccountResponse{} } -func (m *QueryAccountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAccountResponse) ProtoMessage() {} -func (*QueryAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c451370b3929a27c, []int{1} -} -func (m *QueryAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAccountResponse.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 *QueryAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAccountResponse.Merge(m, src) -} -func (m *QueryAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAccountResponse proto.InternalMessageInfo - -func (m *QueryAccountResponse) GetAccount() *types.Any { - if m != nil { - return m.Account - } - return nil -} - -// 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_c451370b3929a27c, []int{2} -} -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 defines the parameters of the module. - 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_c451370b3929a27c, []int{3} -} -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{} -} - -func init() { - proto.RegisterType((*QueryAccountRequest)(nil), "cosmos.auth.v1beta1.QueryAccountRequest") - proto.RegisterType((*QueryAccountResponse)(nil), "cosmos.auth.v1beta1.QueryAccountResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.auth.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.auth.v1beta1.QueryParamsResponse") -} - -func init() { proto.RegisterFile("cosmos/auth/v1beta1/query.proto", fileDescriptor_c451370b3929a27c) } - -var fileDescriptor_c451370b3929a27c = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x31, 0x8f, 0xd3, 0x30, - 0x14, 0xc7, 0x93, 0x13, 0xb4, 0x87, 0x61, 0xf2, 0x65, 0x38, 0x72, 0x90, 0xa0, 0x30, 0x5c, 0x3b, - 0xd4, 0x56, 0xcb, 0x54, 0xc4, 0xd2, 0x4e, 0xb0, 0x95, 0x88, 0x89, 0x05, 0x39, 0x89, 0x49, 0x23, - 0x1a, 0x3b, 0x8d, 0x6d, 0xa4, 0x0a, 0x21, 0x21, 0x26, 0x36, 0x90, 0x58, 0x19, 0xfa, 0x21, 0xf8, - 0x10, 0x15, 0x53, 0x25, 0x16, 0x26, 0x84, 0x5a, 0x06, 0x3e, 0x06, 0xaa, 0xed, 0x0c, 0x95, 0x82, - 0xb8, 0xa9, 0x7d, 0xef, 0xfd, 0xff, 0xff, 0xf7, 0xcb, 0x33, 0x08, 0x53, 0x2e, 0x4a, 0x2e, 0x30, - 0x51, 0x72, 0x8e, 0x5f, 0x0f, 0x13, 0x2a, 0xc9, 0x10, 0x2f, 0x15, 0xad, 0x57, 0xa8, 0xaa, 0xb9, - 0xe4, 0xf0, 0xcc, 0x08, 0xd0, 0x41, 0x80, 0xac, 0xc0, 0xf7, 0x72, 0x9e, 0x73, 0x3d, 0xc7, 0x87, - 0x7f, 0x46, 0xea, 0xdf, 0xce, 0x39, 0xcf, 0x17, 0x14, 0xeb, 0x2a, 0x51, 0x2f, 0x31, 0x61, 0x36, - 0xc5, 0xbf, 0x63, 0x47, 0xa4, 0x2a, 0x30, 0x61, 0x8c, 0x4b, 0x22, 0x0b, 0xce, 0x84, 0x9d, 0x06, - 0x6d, 0x10, 0x7a, 0xa1, 0x0d, 0x36, 0xf3, 0x17, 0x66, 0xa3, 0x05, 0xd2, 0x45, 0x34, 0x06, 0x67, - 0x4f, 0x0f, 0xb4, 0x93, 0x34, 0xe5, 0x8a, 0xc9, 0x98, 0x2e, 0x15, 0x15, 0x12, 0x9e, 0x83, 0x2e, - 0xc9, 0xb2, 0x9a, 0x0a, 0x71, 0xee, 0xde, 0x73, 0x7b, 0x37, 0xe2, 0xa6, 0x7c, 0x78, 0xfa, 0x61, - 0x1d, 0x3a, 0x7f, 0xd6, 0xa1, 0x13, 0x3d, 0x03, 0xde, 0xb1, 0x55, 0x54, 0x9c, 0x09, 0x0a, 0x1f, - 0x81, 0x2e, 0x31, 0x2d, 0xed, 0xbd, 0x39, 0xf2, 0x90, 0xa1, 0x47, 0xcd, 0x87, 0xa1, 0x09, 0x5b, - 0x4d, 0x6f, 0x7d, 0xfb, 0x3a, 0x38, 0xb5, 0xde, 0x27, 0x71, 0x63, 0x89, 0x3c, 0x00, 0x75, 0xea, - 0x8c, 0xd4, 0xa4, 0x14, 0x96, 0x27, 0x9a, 0x59, 0xcc, 0xa6, 0x6b, 0x57, 0x8d, 0x41, 0xa7, 0xd2, - 0x1d, 0xbb, 0xe9, 0x02, 0xb5, 0x5c, 0x1b, 0x19, 0xd3, 0xf4, 0xda, 0xe6, 0x67, 0xe8, 0xc4, 0xd6, - 0x30, 0xfa, 0x72, 0x02, 0xae, 0xeb, 0x48, 0xf8, 0xd1, 0x05, 0x5d, 0xcb, 0x01, 0x7b, 0xad, 0x01, - 0x2d, 0x17, 0xf2, 0xfb, 0x57, 0x50, 0x1a, 0xca, 0x08, 0xbf, 0xff, 0xfe, 0xfb, 0xf3, 0x49, 0x1f, - 0x5e, 0xe2, 0xd6, 0x77, 0x32, 0x6a, 0x81, 0xdf, 0xd8, 0x13, 0xbf, 0x85, 0xef, 0x5c, 0xd0, 0x31, - 0xd0, 0xf0, 0xf2, 0xdf, 0x6b, 0x8e, 0x2e, 0xe4, 0xf7, 0xfe, 0x2f, 0xb4, 0x38, 0xf7, 0x35, 0xce, - 0x5d, 0x78, 0xd1, 0x8a, 0x63, 0xce, 0x33, 0x7d, 0xbc, 0xd9, 0x05, 0xee, 0x76, 0x17, 0xb8, 0xbf, - 0x76, 0x81, 0xfb, 0x69, 0x1f, 0x38, 0xdb, 0x7d, 0xe0, 0xfc, 0xd8, 0x07, 0xce, 0x73, 0x94, 0x17, - 0x72, 0xae, 0x12, 0x94, 0xf2, 0x12, 0x17, 0x75, 0x21, 0x18, 0x95, 0xfa, 0x77, 0xae, 0x92, 0x81, - 0xc8, 0x5e, 0x0d, 0x72, 0x8e, 0x4b, 0x9e, 0xa9, 0x05, 0x35, 0xc1, 0x49, 0x47, 0xbf, 0xfa, 0x83, - 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x60, 0x3b, 0x07, 0x2a, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Account returns account details based on address. - Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) - // Params queries all parameters. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) { - out := new(QueryAccountResponse) - err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/Account", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Account returns account details based on address. - Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error) - // Params queries all parameters. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Account(ctx context.Context, req *QueryAccountRequest) (*QueryAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Account not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Account_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Account(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.auth.v1beta1.Query/Account", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Account(ctx, req.(*QueryAccountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/cosmos.auth.v1beta1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.auth.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Account", - Handler: _Query_Account_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/auth/v1beta1/query.proto", -} - -func (m *QueryAccountRequest) 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 *QueryAccountRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAccountResponse) 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 *QueryAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Account != nil { - { - size, err := m.Account.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 *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 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 *QueryAccountRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Account != nil { - l = m.Account.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -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 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 *QueryAccountRequest) 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: QueryAccountRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = 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 *QueryAccountResponse) 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: QueryAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", 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.Account == nil { - m.Account = &types.Any{} - } - if err := m.Account.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 *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 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/modules/auth/types.go b/modules/auth/types.go deleted file mode 100644 index 292b1f64..00000000 --- a/modules/auth/types.go +++ /dev/null @@ -1,147 +0,0 @@ -package auth - -import ( - "encoding/json" - "errors" - "fmt" - - "github.com/gogo/protobuf/proto" - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/codec" - codectypes "github.com/irisnet/irishub-sdk-go/codec/types" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// Account is an interface used to store coins at a given address within state. -// It presumes a notion of sequence numbers for replay protection, -// a notion of account numbers for replay protection for previously pruned accounts, -// and a pubkey for authentication purposes. -// -// Many complex conditions can be used in the concrete struct which implements Account. -type Account interface { - GetAddress() sdk.AccAddress - SetAddress(sdk.AccAddress) error // errors if already set. - - GetPubKey() crypto.PubKey // can return nil. - SetPubKey(crypto.PubKey) error - - GetAccountNumber() uint64 - SetAccountNumber(uint64) error - - GetSequence() uint64 - SetSequence(uint64) error -} - -var _ Account = (*BaseAccount)(nil) - -// GetAddress - Implements sdk.AccountI. -func (acc BaseAccount) GetAddress() sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(acc.Address) - return addr -} - -// SetAddress - Implements sdk.AccountI. -func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error { - if len(acc.Address) != 0 { - return errors.New("cannot override BaseAccount address") - } - - acc.Address = addr.String() - return nil -} - -// GetPubKey - Implements sdk.AccountI. -func (acc BaseAccount) GetPubKey() (pk crypto.PubKey) { - if acc.PubKey == nil { - return nil - } - content, ok := acc.PubKey.GetCachedValue().(crypto.PubKey) - if !ok { - return nil - } - return content -} - -// SetPubKey - Implements sdk.AccountI. -func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error { - if pubKey == nil { - acc.PubKey = nil - } else { - protoMsg, ok := pubKey.(proto.Message) - if !ok { - return sdk.Wrap(fmt.Errorf("err invalid key, can't proto encode %T", protoMsg)) - } - - any, err := codectypes.NewAnyWithValue(protoMsg) - if err != nil { - return err - } - - acc.PubKey = any - } - - return nil -} - -// GetAccountNumber - Implements AccountI -func (acc BaseAccount) GetAccountNumber() uint64 { - return acc.AccountNumber -} - -// SetAccountNumber - Implements AccountI -func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error { - acc.AccountNumber = accNumber - return nil -} - -// GetSequence - Implements sdk.AccountI. -func (acc BaseAccount) GetSequence() uint64 { - return acc.Sequence -} - -// SetSequence - Implements sdk.AccountI. -func (acc *BaseAccount) SetSequence(seq uint64) error { - acc.Sequence = seq - return nil -} - -func (acc BaseAccount) String() string { - out, _ := json.Marshal(acc) - return string(out) -} - -// Convert return a sdk.BaseAccount -func (acc *BaseAccount) Convert() interface{} { - // error don't use it - return nil -} - -// Convert return a sdk.BaseAccount -// in order to unpack pubKey so not use Convert() -func (acc *BaseAccount) ConvertAccount(cdc codec.Marshaler) interface{} { - account := sdk.BaseAccount{ - Address: acc.Address, - AccountNumber: acc.AccountNumber, - Sequence: acc.Sequence, - } - - var pkStr string - if acc.PubKey == nil { - return account - } - - var pk crypto.PubKey - if err := cdc.UnpackAny(acc.PubKey, &pk); err != nil { - return sdk.BaseAccount{} - } - - pkStr, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pk) - if err != nil { - panic(err) - } - - account.PubKey = pkStr - return account -} diff --git a/modules/bank/bank.go b/modules/bank/bank.go deleted file mode 100644 index 3932fb43..00000000 --- a/modules/bank/bank.go +++ /dev/null @@ -1,198 +0,0 @@ -package bank - -import ( - "context" - "fmt" - "strings" - - "github.com/irisnet/irishub-sdk-go/utils" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type bankClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { - return bankClient{ - BaseClient: bc, - Marshaler: cdc, - } -} - -func (b bankClient) Name() string { - return ModuleName -} - -func (b bankClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -// QueryAccount return account information specified address -func (b bankClient) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { - account, err := b.BaseClient.QueryAccount(address) - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - return account, nil -} - -// TotalSupply queries the total supply of all coins. -func (b bankClient) TotalSupply() (sdk.Coins, sdk.Error) { - conn, err := b.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).TotalSupply( - context.Background(), - &QueryTotalSupplyRequest{}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return resp.Supply, nil -} - -// Send is responsible for transferring tokens from `From` to `to` account -func (b bankClient) Send(to string, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := b.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf("%s not found", baseTx.From) - } - - amt, err := b.ToMinCoin(amount...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - outAddr, err := sdk.AccAddressFromBech32(to) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf(fmt.Sprintf("%s invalid address", to)) - } - - msg := NewMsgSend(sender, outAddr, amt) - return b.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (b bankClient) SendWitchSpecAccountInfo(to string, sequence, accountNumber uint64, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := b.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf("%s not found", baseTx.From) - } - - amt, err := b.ToMinCoin(amount...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - outAddr, err := sdk.AccAddressFromBech32(to) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf(fmt.Sprintf("%s invalid address", to)) - } - - msg := NewMsgSend(sender, outAddr, amt) - return b.BuildAndSendWithAccount(sender.String(), accountNumber, sequence, []sdk.Msg{msg}, baseTx) -} - -func (b bankClient) MultiSend(request MultiSendRequest, baseTx sdk.BaseTx) (resTxs []sdk.ResultTx, err sdk.Error) { - sender, err := b.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrapf("%s not found", baseTx.From) - } - - if len(request.Receipts) > maxMsgLen { - return b.SendBatch(sender, request, baseTx) - } - - var inputs = make([]Input, len(request.Receipts)) - var outputs = make([]Output, len(request.Receipts)) - for i, receipt := range request.Receipts { - amt, err := b.ToMinCoin(receipt.Amount...) - if err != nil { - return nil, sdk.Wrap(err) - } - - outAddr, e := sdk.AccAddressFromBech32(receipt.Address) - if e != nil { - return nil, sdk.Wrapf(fmt.Sprintf("%s invalid address", receipt.Address)) - } - - inputs[i] = NewInput(sender, amt) - outputs[i] = NewOutput(outAddr, amt) - } - - msg := NewMsgMultiSend(inputs, outputs) - res, err := b.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, sdk.Wrap(err) - } - - resTxs = append(resTxs, res) - return -} - -func (b bankClient) SendBatch(sender sdk.AccAddress, - request MultiSendRequest, baseTx sdk.BaseTx) ([]sdk.ResultTx, sdk.Error) { - batchReceipts := utils.SubArray(maxMsgLen, request) - - var msgs sdk.Msgs - for _, receipts := range batchReceipts { - req := receipts.(MultiSendRequest) - var inputs = make([]Input, len(req.Receipts)) - var outputs = make([]Output, len(req.Receipts)) - for i, receipt := range req.Receipts { - amt, err := b.ToMinCoin(receipt.Amount...) - if err != nil { - return nil, sdk.Wrap(err) - } - - outAddr, e := sdk.AccAddressFromBech32(receipt.Address) - if e != nil { - return nil, sdk.Wrapf(fmt.Sprintf("%s invalid address", receipt.Address)) - } - - inputs[i] = NewInput(sender, amt) - outputs[i] = NewOutput(outAddr, amt) - } - msgs = append(msgs, NewMsgMultiSend(inputs, outputs)) - } - return b.BaseClient.SendBatch(msgs, baseTx) -} - -// SubscribeSendTx Subscribe MsgSend event and return subscription -func (b bankClient) SubscribeSendTx(from, to string, callback EventMsgSendCallback) sdk.Subscription { - var builder = sdk.NewEventQueryBuilder() - - from = strings.TrimSpace(from) - if len(from) != 0 { - builder.AddCondition(sdk.NewCond(sdk.EventTypeMessage, - sdk.AttributeKeySender).EQ(sdk.EventValue(from))) - } - - to = strings.TrimSpace(to) - if len(to) != 0 { - builder.AddCondition(sdk.Cond("transfer.recipient").EQ(sdk.EventValue(to))) - } - - subscription, _ := b.SubscribeTx(builder, func(data sdk.EventDataTx) { - for _, msg := range data.Tx.GetMsgs() { - if value, ok := msg.(*MsgSend); ok { - callback(EventDataMsgSend{ - Height: data.Height, - Hash: data.Hash, - From: value.FromAddress, - To: value.ToAddress, - Amount: value.Amount, - }) - } - } - }) - return subscription -} diff --git a/modules/bank/bank.pb.go b/modules/bank/bank.pb.go deleted file mode 100644 index ce565f5f..00000000 --- a/modules/bank/bank.pb.go +++ /dev/null @@ -1,1887 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/bank/v1beta1/bank.proto - -package bank - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - _ "github.com/regen-network/cosmos-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 - -// Params defines the parameters for the bank module. -type Params struct { - SendEnabled []*SendEnabled `protobuf:"bytes,1,rep,name=send_enabled,json=sendEnabled,proto3" json:"send_enabled,omitempty" yaml:"send_enabled,omitempty"` - DefaultSendEnabled bool `protobuf:"varint,2,opt,name=default_send_enabled,json=defaultSendEnabled,proto3" json:"default_send_enabled,omitempty" yaml:"default_send_enabled,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []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 - -func (m *Params) GetSendEnabled() []*SendEnabled { - if m != nil { - return m.SendEnabled - } - return nil -} - -func (m *Params) GetDefaultSendEnabled() bool { - if m != nil { - return m.DefaultSendEnabled - } - return false -} - -// SendEnabled maps coin denom to a send_enabled status (whether a denom is -// sendable). -type SendEnabled struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` -} - -func (m *SendEnabled) Reset() { *m = SendEnabled{} } -func (*SendEnabled) ProtoMessage() {} -func (*SendEnabled) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{1} -} -func (m *SendEnabled) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SendEnabled) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SendEnabled.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 *SendEnabled) XXX_Merge(src proto.Message) { - xxx_messageInfo_SendEnabled.Merge(m, src) -} -func (m *SendEnabled) XXX_Size() int { - return m.Size() -} -func (m *SendEnabled) XXX_DiscardUnknown() { - xxx_messageInfo_SendEnabled.DiscardUnknown(m) -} - -var xxx_messageInfo_SendEnabled proto.InternalMessageInfo - -func (m *SendEnabled) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *SendEnabled) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -// Input models transaction input. -type Input struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coins github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"coins"` -} - -func (m *Input) Reset() { *m = Input{} } -func (m *Input) String() string { return proto.CompactTextString(m) } -func (*Input) ProtoMessage() {} -func (*Input) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{2} -} -func (m *Input) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Input.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 *Input) XXX_Merge(src proto.Message) { - xxx_messageInfo_Input.Merge(m, src) -} -func (m *Input) XXX_Size() int { - return m.Size() -} -func (m *Input) XXX_DiscardUnknown() { - xxx_messageInfo_Input.DiscardUnknown(m) -} - -var xxx_messageInfo_Input proto.InternalMessageInfo - -// Output models transaction outputs. -type Output struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coins github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"coins"` -} - -func (m *Output) Reset() { *m = Output{} } -func (m *Output) String() string { return proto.CompactTextString(m) } -func (*Output) ProtoMessage() {} -func (*Output) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{3} -} -func (m *Output) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Output.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 *Output) XXX_Merge(src proto.Message) { - xxx_messageInfo_Output.Merge(m, src) -} -func (m *Output) XXX_Size() int { - return m.Size() -} -func (m *Output) XXX_DiscardUnknown() { - xxx_messageInfo_Output.DiscardUnknown(m) -} - -var xxx_messageInfo_Output proto.InternalMessageInfo - -// Supply represents a struct that passively keeps track of the total supply -// amounts in the network. -type Supply struct { - Total github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=total,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"total"` -} - -func (m *Supply) Reset() { *m = Supply{} } -func (*Supply) ProtoMessage() {} -func (*Supply) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{4} -} -func (m *Supply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Supply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Supply.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 *Supply) XXX_Merge(src proto.Message) { - xxx_messageInfo_Supply.Merge(m, src) -} -func (m *Supply) XXX_Size() int { - return m.Size() -} -func (m *Supply) XXX_DiscardUnknown() { - xxx_messageInfo_Supply.DiscardUnknown(m) -} - -var xxx_messageInfo_Supply proto.InternalMessageInfo - -// DenomUnit represents a struct that describes a given -// denomination unit of the basic token. -type DenomUnit struct { - // denom represents the string name of the given denom unit (e.g uatom). - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // exponent represents power of 10 exponent that one must - // raise the base_denom to in order to equal the given DenomUnit's denom - // 1 denom = 1^exponent base_denom - // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - // exponent = 6, thus: 1 atom = 10^6 uatom). - Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"` - // aliases is a list of string aliases for the given denom - Aliases []string `protobuf:"bytes,3,rep,name=aliases,proto3" json:"aliases,omitempty"` -} - -func (m *DenomUnit) Reset() { *m = DenomUnit{} } -func (m *DenomUnit) String() string { return proto.CompactTextString(m) } -func (*DenomUnit) ProtoMessage() {} -func (*DenomUnit) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{5} -} -func (m *DenomUnit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DenomUnit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DenomUnit.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 *DenomUnit) XXX_Merge(src proto.Message) { - xxx_messageInfo_DenomUnit.Merge(m, src) -} -func (m *DenomUnit) XXX_Size() int { - return m.Size() -} -func (m *DenomUnit) XXX_DiscardUnknown() { - xxx_messageInfo_DenomUnit.DiscardUnknown(m) -} - -var xxx_messageInfo_DenomUnit proto.InternalMessageInfo - -func (m *DenomUnit) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *DenomUnit) GetExponent() uint32 { - if m != nil { - return m.Exponent - } - return 0 -} - -func (m *DenomUnit) GetAliases() []string { - if m != nil { - return m.Aliases - } - return nil -} - -// Metadata represents a struct that describes -// a basic token. -type Metadata struct { - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - // denom_units represents the list of DenomUnit's for a given coin - DenomUnits []*DenomUnit `protobuf:"bytes,2,rep,name=denom_units,json=denomUnits,proto3" json:"denom_units,omitempty"` - // base represents the base denom (should be the DenomUnit with exponent = 0). - Base string `protobuf:"bytes,3,opt,name=base,proto3" json:"base,omitempty"` - // display indicates the suggested denom that should be - // displayed in clients. - Display string `protobuf:"bytes,4,opt,name=display,proto3" json:"display,omitempty"` -} - -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{6} -} -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Metadata.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 *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) -} -func (m *Metadata) XXX_Size() int { - return m.Size() -} -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) -} - -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func (m *Metadata) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Metadata) GetDenomUnits() []*DenomUnit { - if m != nil { - return m.DenomUnits - } - return nil -} - -func (m *Metadata) GetBase() string { - if m != nil { - return m.Base - } - return "" -} - -func (m *Metadata) GetDisplay() string { - if m != nil { - return m.Display - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "cosmos.bank.v1beta1.Params") - proto.RegisterType((*SendEnabled)(nil), "cosmos.bank.v1beta1.SendEnabled") - proto.RegisterType((*Input)(nil), "cosmos.bank.v1beta1.Input") - proto.RegisterType((*Output)(nil), "cosmos.bank.v1beta1.Output") - proto.RegisterType((*Supply)(nil), "cosmos.bank.v1beta1.Supply") - proto.RegisterType((*DenomUnit)(nil), "cosmos.bank.v1beta1.DenomUnit") - proto.RegisterType((*Metadata)(nil), "cosmos.bank.v1beta1.Metadata") -} - -func init() { proto.RegisterFile("cosmos/bank/v1beta1/bank.proto", fileDescriptor_dd052eee12edf988) } - -var fileDescriptor_dd052eee12edf988 = []byte{ - // 579 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0x3f, 0x8b, 0x13, 0x4f, - 0x18, 0xde, 0xb9, 0xdc, 0xe5, 0x97, 0x9b, 0xfc, 0x6c, 0xd6, 0x14, 0x7b, 0x01, 0x77, 0xd7, 0x05, - 0x21, 0x8a, 0xd9, 0x70, 0x8a, 0x4d, 0x1a, 0x25, 0x2a, 0x7a, 0x85, 0x78, 0xec, 0x21, 0x82, 0x16, - 0x61, 0x36, 0x33, 0xc9, 0x0d, 0xb7, 0x3b, 0xb3, 0xec, 0xcc, 0x8a, 0xf9, 0x06, 0x96, 0x82, 0x16, - 0x82, 0xcd, 0xd5, 0xd6, 0x7e, 0x02, 0xab, 0x2b, 0x0f, 0x6d, 0xac, 0xa2, 0x24, 0x8d, 0xf5, 0x7d, - 0x02, 0x99, 0x99, 0xcd, 0x9f, 0x83, 0x88, 0x58, 0x08, 0x56, 0x3b, 0xef, 0xbc, 0xcf, 0xfb, 0x3c, - 0x0f, 0xef, 0xfb, 0xce, 0x42, 0x77, 0xc0, 0x45, 0xca, 0x45, 0x27, 0x46, 0xec, 0xa8, 0xf3, 0x62, - 0x37, 0x26, 0x12, 0xed, 0xea, 0x20, 0xcc, 0x72, 0x2e, 0xb9, 0x7d, 0xd1, 0xe4, 0x43, 0x7d, 0x55, - 0xe6, 0x9b, 0x8d, 0x11, 0x1f, 0x71, 0x9d, 0xef, 0xa8, 0x93, 0x81, 0x36, 0x77, 0x0c, 0xb4, 0x6f, - 0x12, 0x65, 0x9d, 0x49, 0x2d, 0x55, 0x04, 0x59, 0xa8, 0x0c, 0x38, 0x65, 0x26, 0x1f, 0x7c, 0x01, - 0xb0, 0xba, 0x8f, 0x72, 0x94, 0x0a, 0x7b, 0x08, 0xff, 0x17, 0x84, 0xe1, 0x3e, 0x61, 0x28, 0x4e, - 0x08, 0x76, 0x80, 0x5f, 0x69, 0xd5, 0x6f, 0xf8, 0xe1, 0x1a, 0x1f, 0xe1, 0x01, 0x61, 0xf8, 0xbe, - 0xc1, 0xf5, 0x2e, 0x9f, 0x4d, 0xbc, 0x4b, 0x63, 0x94, 0x26, 0xdd, 0x60, 0xb5, 0xfe, 0x3a, 0x4f, - 0xa9, 0x24, 0x69, 0x26, 0xc7, 0x41, 0x54, 0x17, 0x4b, 0xbc, 0xfd, 0x1c, 0x36, 0x30, 0x19, 0xa2, - 0x22, 0x91, 0xfd, 0x73, 0x7a, 0x1b, 0x3e, 0x68, 0xd5, 0x7a, 0x57, 0xcf, 0x26, 0xde, 0x15, 0xc3, - 0xb6, 0x0e, 0xb5, 0xca, 0x6a, 0x97, 0x80, 0x15, 0x33, 0xdd, 0xcd, 0x77, 0xc7, 0x9e, 0x15, 0x3c, - 0x80, 0xf5, 0x95, 0x4b, 0xbb, 0x01, 0xb7, 0x30, 0x61, 0x3c, 0x75, 0x80, 0x0f, 0x5a, 0xdb, 0x91, - 0x09, 0x6c, 0x07, 0xfe, 0x77, 0x4e, 0x3a, 0x9a, 0x87, 0xdd, 0x9a, 0x22, 0xf9, 0x71, 0xec, 0x81, - 0xe0, 0x0d, 0x80, 0x5b, 0x7b, 0x2c, 0x2b, 0xa4, 0x42, 0x23, 0x8c, 0x73, 0x22, 0x44, 0xc9, 0x32, - 0x0f, 0xed, 0x21, 0xdc, 0x52, 0x0d, 0x15, 0xce, 0x86, 0x6e, 0xd8, 0xce, 0xb2, 0x61, 0x82, 0x2c, - 0x1a, 0x76, 0x97, 0x53, 0xd6, 0xbb, 0x75, 0x32, 0xf1, 0xac, 0x0f, 0xdf, 0xbc, 0xf6, 0x88, 0xca, - 0xc3, 0x22, 0x0e, 0x07, 0x3c, 0xed, 0xd0, 0x9c, 0x0a, 0x46, 0xa4, 0xfe, 0x1e, 0x16, 0x71, 0x5b, - 0xe0, 0xa3, 0xf6, 0x88, 0x77, 0xe4, 0x38, 0x23, 0x42, 0x57, 0x89, 0xc8, 0xd0, 0x77, 0x6b, 0xaf, - 0x8c, 0x2b, 0x2b, 0x78, 0x0b, 0x60, 0xf5, 0x71, 0x21, 0xff, 0x35, 0x5b, 0x9f, 0x00, 0xac, 0x1e, - 0x14, 0x59, 0x96, 0x8c, 0x95, 0xb8, 0xe4, 0x12, 0x25, 0xe5, 0x12, 0xfd, 0x05, 0x71, 0x4d, 0xdf, - 0xdd, 0x57, 0xe2, 0xf3, 0x69, 0x7d, 0xfe, 0xd8, 0xbe, 0x73, 0xed, 0xf7, 0x34, 0x29, 0xc7, 0x45, - 0x42, 0xca, 0x87, 0x47, 0x5e, 0x66, 0x3c, 0x97, 0x04, 0x87, 0xc6, 0xf8, 0x5e, 0xf0, 0x14, 0x6e, - 0xdf, 0x53, 0xeb, 0xf1, 0x84, 0x51, 0xf9, 0x8b, 0xc5, 0x69, 0xc2, 0x9a, 0x2a, 0x63, 0x84, 0x49, - 0xbd, 0x39, 0x17, 0xa2, 0x45, 0xac, 0xe7, 0x91, 0x50, 0x24, 0x88, 0x70, 0x2a, 0x7e, 0x45, 0xcf, - 0xc3, 0x84, 0xc1, 0x7b, 0x00, 0x6b, 0x8f, 0x88, 0x44, 0x18, 0x49, 0x64, 0xfb, 0xb0, 0x8e, 0x89, - 0x18, 0xe4, 0x34, 0x93, 0x94, 0xb3, 0x92, 0x7e, 0xf5, 0xca, 0xbe, 0xad, 0x10, 0x8c, 0xa7, 0xfd, - 0x82, 0x51, 0x39, 0x1f, 0xa2, 0xbb, 0xf6, 0x31, 0x2e, 0xfc, 0x46, 0x10, 0xcf, 0x8f, 0xc2, 0xb6, - 0xe1, 0xa6, 0xea, 0xb6, 0x53, 0xd1, 0xdc, 0xfa, 0xac, 0xdc, 0x61, 0x2a, 0xb2, 0x04, 0x8d, 0x9d, - 0x4d, 0xb3, 0x2d, 0x65, 0xd8, 0x7b, 0x78, 0x32, 0x75, 0xc1, 0xe9, 0xd4, 0x05, 0xdf, 0xa7, 0x2e, - 0x78, 0x3d, 0x73, 0xad, 0xd3, 0x99, 0x6b, 0x7d, 0x9d, 0xb9, 0xd6, 0xb3, 0xf0, 0xcf, 0x3a, 0x1a, - 0x57, 0xf5, 0x8f, 0xe5, 0xe6, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x87, 0x74, 0xf2, 0x72, 0xe0, - 0x04, 0x00, 0x00, -} - -func (this *SendEnabled) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*SendEnabled) - if !ok { - that2, ok := that.(SendEnabled) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if this.Enabled != that1.Enabled { - return false - } - return true -} -func (this *Supply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Supply) - if !ok { - that2, ok := that.(Supply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Total) != len(that1.Total) { - return false - } - for i := range this.Total { - if !this.Total[i].Equal(&that1.Total[i]) { - 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 - if m.DefaultSendEnabled { - i-- - if m.DefaultSendEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.SendEnabled) > 0 { - for iNdEx := len(m.SendEnabled) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SendEnabled[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SendEnabled) 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 *SendEnabled) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SendEnabled) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintBank(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Input) 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 *Input) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Coins) > 0 { - for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintBank(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Output) 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 *Output) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Coins) > 0 { - for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintBank(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Supply) 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 *Supply) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Total) > 0 { - for iNdEx := len(m.Total) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Total[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DenomUnit) 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 *DenomUnit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DenomUnit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Aliases) > 0 { - for iNdEx := len(m.Aliases) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Aliases[iNdEx]) - copy(dAtA[i:], m.Aliases[iNdEx]) - i = encodeVarintBank(dAtA, i, uint64(len(m.Aliases[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.Exponent != 0 { - i = encodeVarintBank(dAtA, i, uint64(m.Exponent)) - i-- - dAtA[i] = 0x10 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintBank(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Metadata) 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 *Metadata) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Display) > 0 { - i -= len(m.Display) - copy(dAtA[i:], m.Display) - i = encodeVarintBank(dAtA, i, uint64(len(m.Display))) - i-- - dAtA[i] = 0x22 - } - if len(m.Base) > 0 { - i -= len(m.Base) - copy(dAtA[i:], m.Base) - i = encodeVarintBank(dAtA, i, uint64(len(m.Base))) - i-- - dAtA[i] = 0x1a - } - if len(m.DenomUnits) > 0 { - for iNdEx := len(m.DenomUnits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DenomUnits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintBank(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintBank(dAtA []byte, offset int, v uint64) int { - offset -= sovBank(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 - if len(m.SendEnabled) > 0 { - for _, e := range m.SendEnabled { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - if m.DefaultSendEnabled { - n += 2 - } - return n -} - -func (m *SendEnabled) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if m.Enabled { - n += 2 - } - return n -} - -func (m *Input) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if len(m.Coins) > 0 { - for _, e := range m.Coins { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *Output) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if len(m.Coins) > 0 { - for _, e := range m.Coins { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *Supply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Total) > 0 { - for _, e := range m.Total { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *DenomUnit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if m.Exponent != 0 { - n += 1 + sovBank(uint64(m.Exponent)) - } - if len(m.Aliases) > 0 { - for _, s := range m.Aliases { - l = len(s) - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *Metadata) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Description) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if len(m.DenomUnits) > 0 { - for _, e := range m.DenomUnits { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - l = len(m.Base) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - l = len(m.Display) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - return n -} - -func sovBank(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozBank(x uint64) (n int) { - return sovBank(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 ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SendEnabled", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SendEnabled = append(m.SendEnabled, &SendEnabled{}) - if err := m.SendEnabled[len(m.SendEnabled)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultSendEnabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DefaultSendEnabled = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SendEnabled) 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 ErrIntOverflowBank - } - 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: SendEnabled: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SendEnabled: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Input) 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 ErrIntOverflowBank - } - 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: Input: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Coins = append(m.Coins, types.Coin{}) - if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Output) 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 ErrIntOverflowBank - } - 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: Output: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Coins = append(m.Coins, types.Coin{}) - if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Supply) 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 ErrIntOverflowBank - } - 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: Supply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Total = append(m.Total, types.Coin{}) - if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DenomUnit) 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 ErrIntOverflowBank - } - 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: DenomUnit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DenomUnit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) - } - m.Exponent = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exponent |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Aliases = append(m.Aliases, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Metadata) 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 ErrIntOverflowBank - } - 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: Metadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomUnits", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DenomUnits = append(m.DenomUnits, &DenomUnit{}) - if err := m.DenomUnits[len(m.DenomUnits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Base", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Base = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Display", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Display = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipBank(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, ErrIntOverflowBank - } - 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, ErrIntOverflowBank - } - 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, ErrIntOverflowBank - } - 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, ErrInvalidLengthBank - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupBank - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthBank - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthBank = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowBank = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupBank = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/bank/codec.go b/modules/bank/codec.go deleted file mode 100644 index a3888a29..00000000 --- a/modules/bank/codec.go +++ /dev/null @@ -1,32 +0,0 @@ -package bank - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - "github.com/irisnet/irishub-sdk-go/modules/auth" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgSend{}, - &MsgMultiSend{}, - ) - - registry.RegisterImplementations( - (*auth.Account)(nil), - &auth.BaseAccount{}, - ) -} diff --git a/modules/bank/export.go b/modules/bank/export.go deleted file mode 100644 index 755e1254..00000000 --- a/modules/bank/export.go +++ /dev/null @@ -1,45 +0,0 @@ -package bank - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// expose bank module api for user -type Client interface { - sdk.Module - - Send(to string, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - SendWitchSpecAccountInfo(to string, sequence, accountNumber uint64, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - MultiSend(receipts MultiSendRequest, baseTx sdk.BaseTx) ([]sdk.ResultTx, sdk.Error) - SubscribeSendTx(from, to string, callback EventMsgSendCallback) sdk.Subscription - - QueryAccount(address string) (sdk.BaseAccount, sdk.Error) - TotalSupply() (sdk.Coins, sdk.Error) -} - -type Receipt struct { - Address string `json:"address"` - Amount sdk.DecCoins `json:"amount"` -} - -type MultiSendRequest struct { - Receipts []Receipt -} - -func (msr MultiSendRequest) Len() int { - return len(msr.Receipts) -} - -func (msr MultiSendRequest) Sub(begin, end int) sdk.SplitAble { - return MultiSendRequest{Receipts: msr.Receipts[begin:end]} -} - -type EventDataMsgSend struct { - Height int64 `json:"height"` - Hash string `json:"hash"` - From string `json:"from"` - To string `json:"to"` - Amount []sdk.Coin `json:"amount"` -} - -type EventMsgSendCallback func(EventDataMsgSend) diff --git a/modules/bank/params.go b/modules/bank/params.go deleted file mode 100644 index 30d94d2b..00000000 --- a/modules/bank/params.go +++ /dev/null @@ -1,23 +0,0 @@ -package bank - -import ( - yaml "gopkg.in/yaml.v2" -) - -// String implements the stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// String implements stringer insterface -func (se SendEnabled) String() string { - out, _ := yaml.Marshal(se) - return string(out) -} - -// String returns a human readable string representation of a supplier. -func (supply Supply) String() string { - bz, _ := yaml.Marshal(supply) - return string(bz) -} diff --git a/modules/bank/query.pb.go b/modules/bank/query.pb.go deleted file mode 100644 index 08300ae8..00000000 --- a/modules/bank/query.pb.go +++ /dev/null @@ -1,2220 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/bank/v1beta1/query.proto - -package bank - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - query "github.com/irisnet/irishub-sdk-go/types/query" - _ "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 - -// QueryBalanceRequest is the request type for the Query/Balance RPC method. -type QueryBalanceRequest struct { - // address is the address to query balances for. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // denom is the coin denom to query balances for. - Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QueryBalanceRequest) Reset() { *m = QueryBalanceRequest{} } -func (m *QueryBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBalanceRequest) ProtoMessage() {} -func (*QueryBalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{0} -} -func (m *QueryBalanceRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBalanceRequest.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 *QueryBalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBalanceRequest.Merge(m, src) -} -func (m *QueryBalanceRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryBalanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBalanceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBalanceRequest proto.InternalMessageInfo - -// QueryBalanceResponse is the response type for the Query/Balance RPC method. -type QueryBalanceResponse struct { - // balance is the balance of the coin. - Balance *types.Coin `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` -} - -func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} } -func (m *QueryBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBalanceResponse) ProtoMessage() {} -func (*QueryBalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{1} -} -func (m *QueryBalanceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBalanceResponse.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 *QueryBalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBalanceResponse.Merge(m, src) -} -func (m *QueryBalanceResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryBalanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBalanceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo - -func (m *QueryBalanceResponse) GetBalance() *types.Coin { - if m != nil { - return m.Balance - } - return nil -} - -// QueryBalanceRequest is the request type for the Query/AllBalances RPC method. -type QueryAllBalancesRequest struct { - // address is the address to query balances for. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllBalancesRequest) Reset() { *m = QueryAllBalancesRequest{} } -func (m *QueryAllBalancesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllBalancesRequest) ProtoMessage() {} -func (*QueryAllBalancesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{2} -} -func (m *QueryAllBalancesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllBalancesRequest.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 *QueryAllBalancesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBalancesRequest.Merge(m, src) -} -func (m *QueryAllBalancesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllBalancesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBalancesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllBalancesRequest proto.InternalMessageInfo - -// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC -// method. -type QueryAllBalancesResponse struct { - // balances is the balances of all the coins. - Balances github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=balances,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"balances"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllBalancesResponse) Reset() { *m = QueryAllBalancesResponse{} } -func (m *QueryAllBalancesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllBalancesResponse) ProtoMessage() {} -func (*QueryAllBalancesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{3} -} -func (m *QueryAllBalancesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllBalancesResponse.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 *QueryAllBalancesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBalancesResponse.Merge(m, src) -} -func (m *QueryAllBalancesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllBalancesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBalancesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllBalancesResponse proto.InternalMessageInfo - -func (m *QueryAllBalancesResponse) GetBalances() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.Balances - } - return nil -} - -func (m *QueryAllBalancesResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC -// method. -type QueryTotalSupplyRequest struct { -} - -func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} } -func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTotalSupplyRequest) ProtoMessage() {} -func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{4} -} -func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTotalSupplyRequest.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 *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src) -} -func (m *QueryTotalSupplyRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo - -// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC -// method -type QueryTotalSupplyResponse struct { - // supply is the supply of the coins - Supply github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=supply,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"supply"` -} - -func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} } -func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTotalSupplyResponse) ProtoMessage() {} -func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{5} -} -func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTotalSupplyResponse.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 *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src) -} -func (m *QueryTotalSupplyResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo - -func (m *QueryTotalSupplyResponse) GetSupply() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.Supply - } - return nil -} - -// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. -type QuerySupplyOfRequest struct { - // denom is the coin denom to query balances for. - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QuerySupplyOfRequest) Reset() { *m = QuerySupplyOfRequest{} } -func (m *QuerySupplyOfRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySupplyOfRequest) ProtoMessage() {} -func (*QuerySupplyOfRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{6} -} -func (m *QuerySupplyOfRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySupplyOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySupplyOfRequest.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 *QuerySupplyOfRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupplyOfRequest.Merge(m, src) -} -func (m *QuerySupplyOfRequest) XXX_Size() int { - return m.Size() -} -func (m *QuerySupplyOfRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupplyOfRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySupplyOfRequest proto.InternalMessageInfo - -func (m *QuerySupplyOfRequest) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. -type QuerySupplyOfResponse struct { - // amount is the supply of the coin. - Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` -} - -func (m *QuerySupplyOfResponse) Reset() { *m = QuerySupplyOfResponse{} } -func (m *QuerySupplyOfResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySupplyOfResponse) ProtoMessage() {} -func (*QuerySupplyOfResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{7} -} -func (m *QuerySupplyOfResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySupplyOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySupplyOfResponse.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 *QuerySupplyOfResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupplyOfResponse.Merge(m, src) -} -func (m *QuerySupplyOfResponse) XXX_Size() int { - return m.Size() -} -func (m *QuerySupplyOfResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupplyOfResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySupplyOfResponse proto.InternalMessageInfo - -func (m *QuerySupplyOfResponse) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -// QueryParamsRequest defines the request type for querying x/bank parameters. -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_9c6fc1939682df13, []int{8} -} -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 defines the response type for querying x/bank parameters. -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_9c6fc1939682df13, []int{9} -} -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{} -} - -func init() { - proto.RegisterType((*QueryBalanceRequest)(nil), "cosmos.bank.v1beta1.QueryBalanceRequest") - proto.RegisterType((*QueryBalanceResponse)(nil), "cosmos.bank.v1beta1.QueryBalanceResponse") - proto.RegisterType((*QueryAllBalancesRequest)(nil), "cosmos.bank.v1beta1.QueryAllBalancesRequest") - proto.RegisterType((*QueryAllBalancesResponse)(nil), "cosmos.bank.v1beta1.QueryAllBalancesResponse") - proto.RegisterType((*QueryTotalSupplyRequest)(nil), "cosmos.bank.v1beta1.QueryTotalSupplyRequest") - proto.RegisterType((*QueryTotalSupplyResponse)(nil), "cosmos.bank.v1beta1.QueryTotalSupplyResponse") - proto.RegisterType((*QuerySupplyOfRequest)(nil), "cosmos.bank.v1beta1.QuerySupplyOfRequest") - proto.RegisterType((*QuerySupplyOfResponse)(nil), "cosmos.bank.v1beta1.QuerySupplyOfResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.bank.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.bank.v1beta1.QueryParamsResponse") -} - -func init() { proto.RegisterFile("cosmos/bank/v1beta1/query.proto", fileDescriptor_9c6fc1939682df13) } - -var fileDescriptor_9c6fc1939682df13 = []byte{ - // 685 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x85, 0xa6, 0xe5, 0xb2, 0x5d, 0x83, 0x48, 0x53, 0x70, 0x90, 0x2b, 0xe8, 0x0f, - 0x1a, 0x9f, 0xda, 0x0a, 0x55, 0xb0, 0x11, 0x24, 0x40, 0x62, 0x68, 0x08, 0x4c, 0x6c, 0xe7, 0xe4, - 0x70, 0xad, 0xda, 0x77, 0x6e, 0xce, 0x46, 0xaa, 0xaa, 0x4a, 0x08, 0x81, 0xc4, 0x04, 0x48, 0x0c, - 0x0c, 0x2c, 0x9d, 0xf9, 0x4b, 0x3a, 0x16, 0xb1, 0x30, 0x01, 0x6a, 0x41, 0xe2, 0xcf, 0x40, 0xb9, - 0x1f, 0xc6, 0x69, 0xdc, 0x24, 0x0b, 0x53, 0xec, 0xbb, 0xf7, 0xbe, 0xef, 0xf3, 0xde, 0x7d, 0xcf, - 0x81, 0xb5, 0x36, 0x17, 0x21, 0x17, 0xd8, 0x25, 0x6c, 0x1b, 0x3f, 0x5f, 0x75, 0x69, 0x4c, 0x56, - 0xf1, 0x4e, 0x42, 0xbb, 0xbb, 0x4e, 0xd4, 0xe5, 0x31, 0x47, 0x33, 0x2a, 0xc0, 0xe9, 0x05, 0x38, - 0x3a, 0xa0, 0xba, 0x9c, 0x66, 0x09, 0xaa, 0xa2, 0xd3, 0xdc, 0x88, 0x78, 0x3e, 0x23, 0xb1, 0xcf, - 0x99, 0x12, 0xa8, 0x96, 0x3d, 0xee, 0x71, 0xf9, 0x88, 0x7b, 0x4f, 0x7a, 0xf5, 0xb2, 0xc7, 0xb9, - 0x17, 0x50, 0x4c, 0x22, 0x1f, 0x13, 0xc6, 0x78, 0x2c, 0x53, 0x84, 0xde, 0xb5, 0xb2, 0xfa, 0x46, - 0xb9, 0xcd, 0x7d, 0x36, 0xb0, 0x9f, 0xa1, 0x96, 0x84, 0x72, 0xdf, 0xde, 0x84, 0x33, 0x8f, 0x7a, - 0x54, 0x0d, 0x12, 0x10, 0xd6, 0xa6, 0x2d, 0xba, 0x93, 0x50, 0x11, 0xa3, 0x0a, 0x9c, 0x22, 0x9d, - 0x4e, 0x97, 0x0a, 0x51, 0x01, 0x57, 0xc1, 0xe2, 0x85, 0x96, 0x79, 0x45, 0x65, 0x38, 0xd9, 0xa1, - 0x8c, 0x87, 0x95, 0x09, 0xb9, 0xae, 0x5e, 0x6e, 0x4f, 0xbf, 0x39, 0xa8, 0x15, 0xfe, 0x1c, 0xd4, - 0x0a, 0xf6, 0x43, 0x58, 0xee, 0x17, 0x14, 0x11, 0x67, 0x82, 0xa2, 0x75, 0x38, 0xe5, 0xaa, 0x25, - 0xa9, 0x58, 0x5a, 0x9b, 0x75, 0xd2, 0x79, 0x09, 0x6a, 0xe6, 0xe5, 0xdc, 0xe5, 0x3e, 0x6b, 0x99, - 0x48, 0xfb, 0x35, 0x80, 0x97, 0xa4, 0xda, 0x9d, 0x20, 0xd0, 0x82, 0x62, 0x34, 0xe2, 0x3d, 0x08, - 0xff, 0xcd, 0x56, 0x72, 0x96, 0xd6, 0xae, 0xf7, 0x55, 0x53, 0xc7, 0x66, 0x6a, 0x36, 0x89, 0x67, - 0x1a, 0x6f, 0x65, 0x32, 0x33, 0x4d, 0x7d, 0x01, 0xb0, 0x32, 0xc8, 0xa1, 0x3b, 0x0b, 0xe0, 0xb4, - 0xe6, 0xed, 0x91, 0x9c, 0x1b, 0xda, 0x5a, 0xe3, 0xe6, 0xe1, 0xf7, 0x5a, 0xe1, 0xf3, 0x8f, 0x5a, - 0xdd, 0xf3, 0xe3, 0xad, 0xc4, 0x75, 0xda, 0x3c, 0xc4, 0x7e, 0xd7, 0x17, 0x8c, 0xc6, 0xf2, 0x77, - 0x2b, 0x71, 0xeb, 0xa2, 0xb3, 0x5d, 0xf7, 0x38, 0x8e, 0x77, 0x23, 0x2a, 0x64, 0x96, 0x68, 0xa5, - 0x15, 0xd0, 0xfd, 0x9c, 0xe6, 0x16, 0x46, 0x36, 0xa7, 0x50, 0xb3, 0xdd, 0xd9, 0xb3, 0x7a, 0xb4, - 0x4f, 0x78, 0x4c, 0x82, 0xc7, 0x49, 0x14, 0x05, 0xbb, 0x7a, 0x08, 0xf6, 0x2b, 0xd3, 0x6e, 0xdf, - 0x9e, 0x6e, 0x77, 0x0b, 0x16, 0x85, 0x5c, 0xf9, 0x6f, 0xcd, 0x6a, 0x7d, 0x7b, 0x45, 0x5b, 0x49, - 0x01, 0x6c, 0x3e, 0x33, 0x27, 0x9f, 0x5a, 0x10, 0x64, 0x2c, 0x68, 0x37, 0xe1, 0xc5, 0x53, 0xd1, - 0x1a, 0x78, 0x03, 0x16, 0x49, 0xc8, 0x13, 0x16, 0x8f, 0x34, 0x5e, 0xe3, 0x7c, 0x0f, 0xb8, 0xa5, - 0xc3, 0xed, 0x32, 0x44, 0x52, 0xb1, 0x49, 0xba, 0x24, 0x34, 0xbe, 0xb3, 0x9b, 0xfa, 0xc6, 0x98, - 0x55, 0x5d, 0xe5, 0x16, 0x2c, 0x46, 0x72, 0x45, 0x57, 0x99, 0x73, 0x72, 0x3e, 0x07, 0x8e, 0x4a, - 0x32, 0x75, 0x54, 0xc2, 0xda, 0xef, 0x49, 0x38, 0x29, 0x25, 0xd1, 0x47, 0x00, 0xa7, 0xb4, 0xbf, - 0xd0, 0x62, 0xae, 0x40, 0xce, 0x65, 0xad, 0x2e, 0x8d, 0x11, 0xa9, 0x28, 0xed, 0x8d, 0x97, 0x5f, - 0x7f, 0x7d, 0x98, 0x58, 0x45, 0x18, 0xe7, 0x7f, 0x17, 0x94, 0xc9, 0xf0, 0x9e, 0xbe, 0x4a, 0xfb, - 0x78, 0x4f, 0x0e, 0x77, 0x1f, 0x7d, 0x02, 0xb0, 0x94, 0x31, 0x3f, 0x5a, 0x39, 0xbb, 0xe6, 0xe0, - 0x5d, 0xad, 0xd6, 0xc7, 0x8c, 0xd6, 0x94, 0x58, 0x52, 0x2e, 0xa1, 0x85, 0x31, 0x29, 0xd1, 0x3b, - 0x00, 0x4b, 0x19, 0xaf, 0x0e, 0xa3, 0x1b, 0xb4, 0xfb, 0x30, 0xba, 0x9c, 0x0b, 0x60, 0xcf, 0x4b, - 0xba, 0x2b, 0x68, 0x2e, 0x97, 0x4e, 0x79, 0x17, 0xbd, 0x05, 0x70, 0xda, 0x38, 0x11, 0x0d, 0x39, - 0xa0, 0x53, 0xde, 0xae, 0x2e, 0x8f, 0x13, 0xaa, 0x41, 0x6e, 0x48, 0x90, 0x6b, 0x68, 0x7e, 0x08, - 0x48, 0x7a, 0x80, 0x2f, 0x00, 0x2c, 0x2a, 0xf7, 0xa1, 0x85, 0xb3, 0x6b, 0xf4, 0x59, 0xbd, 0xba, - 0x38, 0x3a, 0x70, 0xac, 0x99, 0x28, 0x9f, 0x37, 0x1e, 0x1c, 0x1e, 0x5b, 0xe0, 0xe8, 0xd8, 0x02, - 0x3f, 0x8f, 0x2d, 0xf0, 0xfe, 0xc4, 0x2a, 0x1c, 0x9d, 0x58, 0x85, 0x6f, 0x27, 0x56, 0xe1, 0xa9, - 0x33, 0xfa, 0x03, 0x11, 0xf2, 0x4e, 0x12, 0x50, 0x25, 0xec, 0x16, 0xe5, 0x9f, 0xd7, 0xfa, 0xdf, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x7b, 0xcd, 0x85, 0x94, 0x07, 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 { - // Balance queries the balance of a single coin for a single account. - Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) - // AllBalances queries the balance of all coins for a single account. - AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) - // TotalSupply queries the total supply of all coins. - TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) - // SupplyOf queries the supply of a single coin. - SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) - // Params queries the parameters of x/bank module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) { - out := new(QueryBalanceResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/Balance", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) { - out := new(QueryAllBalancesResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/AllBalances", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) { - out := new(QueryTotalSupplyResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/TotalSupply", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) { - out := new(QuerySupplyOfResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/SupplyOf", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Balance queries the balance of a single coin for a single account. - Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) - // AllBalances queries the balance of all coins for a single account. - AllBalances(context.Context, *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) - // TotalSupply queries the total supply of all coins. - TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) - // SupplyOf queries the supply of a single coin. - SupplyOf(context.Context, *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) - // Params queries the parameters of x/bank module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Balance(ctx context.Context, req *QueryBalanceRequest) (*QueryBalanceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") -} -func (*UnimplementedQueryServer) AllBalances(ctx context.Context, req *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllBalances not implemented") -} -func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented") -} -func (*UnimplementedQueryServer) SupplyOf(ctx context.Context, req *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SupplyOf not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBalanceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Balance(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/Balance", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Balance(ctx, req.(*QueryBalanceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AllBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllBalancesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AllBalances(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/AllBalances", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AllBalances(ctx, req.(*QueryAllBalancesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTotalSupplyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).TotalSupply(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/TotalSupply", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_SupplyOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySupplyOfRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).SupplyOf(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/SupplyOf", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).SupplyOf(ctx, req.(*QuerySupplyOfRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/cosmos.bank.v1beta1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.bank.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Balance", - Handler: _Query_Balance_Handler, - }, - { - MethodName: "AllBalances", - Handler: _Query_AllBalances_Handler, - }, - { - MethodName: "TotalSupply", - Handler: _Query_TotalSupply_Handler, - }, - { - MethodName: "SupplyOf", - Handler: _Query_SupplyOf_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/bank/v1beta1/query.proto", -} - -func (m *QueryBalanceRequest) 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 *QueryBalanceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryBalanceResponse) 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 *QueryBalanceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Balance != nil { - { - size, err := m.Balance.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 *QueryAllBalancesRequest) 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 *QueryAllBalancesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllBalancesRequest) 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.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllBalancesResponse) 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 *QueryAllBalancesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllBalancesResponse) 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.Balances) > 0 { - for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Balances[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 *QueryTotalSupplyRequest) 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 *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryTotalSupplyResponse) 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 *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Supply) > 0 { - for iNdEx := len(m.Supply) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Supply[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 *QuerySupplyOfRequest) 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 *QuerySupplyOfRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySupplyOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QuerySupplyOfResponse) 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 *QuerySupplyOfResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySupplyOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.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 *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 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 *QueryBalanceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBalanceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Balance != nil { - l = m.Balance.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllBalancesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllBalancesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Balances) > 0 { - for _, e := range m.Balances { - 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 *QueryTotalSupplyRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryTotalSupplyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Supply) > 0 { - for _, e := range m.Supply { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QuerySupplyOfRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QuerySupplyOfResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Amount.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -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 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 *QueryBalanceRequest) 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: QueryBalanceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryBalanceResponse) 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: QueryBalanceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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.Balance == nil { - m.Balance = &types.Coin{} - } - if err := m.Balance.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 *QueryAllBalancesRequest) 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: QueryAllBalancesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllBalancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) - 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.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 *QueryAllBalancesResponse) 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: QueryAllBalancesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balances", 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.Balances = append(m.Balances, types.Coin{}) - if err := m.Balances[len(m.Balances)-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 *QueryTotalSupplyRequest) 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: QueryTotalSupplyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTotalSupplyRequest: 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 *QueryTotalSupplyResponse) 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: QueryTotalSupplyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Supply", 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.Supply = append(m.Supply, types.Coin{}) - if err := m.Supply[len(m.Supply)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QuerySupplyOfRequest) 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: QuerySupplyOfRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupplyOfRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QuerySupplyOfResponse) 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: QuerySupplyOfResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupplyOfResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.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 *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 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/modules/bank/tx.pb.go b/modules/bank/tx.pb.go deleted file mode 100644 index 407d4bc3..00000000 --- a/modules/bank/tx.pb.go +++ /dev/null @@ -1,669 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/bank/v1beta1/tx.proto - -package bank - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgSend represents a message to send coins from one account to another. -type MsgSend struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` - Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` -} - -func (m *MsgSend) Reset() { *m = MsgSend{} } -func (m *MsgSend) String() string { return proto.CompactTextString(m) } -func (*MsgSend) ProtoMessage() {} -func (*MsgSend) Descriptor() ([]byte, []int) { - return fileDescriptor_1d8cb1613481f5b7, []int{0} -} -func (m *MsgSend) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSend.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 *MsgSend) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSend.Merge(m, src) -} -func (m *MsgSend) XXX_Size() int { - return m.Size() -} -func (m *MsgSend) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSend.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSend proto.InternalMessageInfo - -// MsgMultiSend represents an arbitrary multi-in, multi-out send message. -type MsgMultiSend struct { - Inputs []Input `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs"` - Outputs []Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs"` -} - -func (m *MsgMultiSend) Reset() { *m = MsgMultiSend{} } -func (m *MsgMultiSend) String() string { return proto.CompactTextString(m) } -func (*MsgMultiSend) ProtoMessage() {} -func (*MsgMultiSend) Descriptor() ([]byte, []int) { - return fileDescriptor_1d8cb1613481f5b7, []int{1} -} -func (m *MsgMultiSend) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMultiSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMultiSend.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 *MsgMultiSend) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMultiSend.Merge(m, src) -} -func (m *MsgMultiSend) XXX_Size() int { - return m.Size() -} -func (m *MsgMultiSend) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMultiSend.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMultiSend proto.InternalMessageInfo - -func (m *MsgMultiSend) GetInputs() []Input { - if m != nil { - return m.Inputs - } - return nil -} - -func (m *MsgMultiSend) GetOutputs() []Output { - if m != nil { - return m.Outputs - } - return nil -} - -func init() { - proto.RegisterType((*MsgSend)(nil), "cosmos.bank.v1beta1.MsgSend") - proto.RegisterType((*MsgMultiSend)(nil), "cosmos.bank.v1beta1.MsgMultiSend") -} - -func init() { proto.RegisterFile("cosmos/bank/v1beta1/tx.proto", fileDescriptor_1d8cb1613481f5b7) } - -var fileDescriptor_1d8cb1613481f5b7 = []byte{ - // 387 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xbd, 0x6e, 0xe2, 0x40, - 0x14, 0x85, 0x6d, 0x40, 0xb0, 0x0c, 0x34, 0x6b, 0x76, 0xb5, 0x2c, 0xbb, 0xb2, 0x91, 0x2b, 0x1a, - 0xc6, 0x62, 0x7f, 0xa4, 0xc8, 0xa9, 0xe2, 0x34, 0x49, 0x81, 0x22, 0x39, 0x5d, 0x9a, 0xc8, 0xc6, - 0x13, 0x63, 0x81, 0x7d, 0x91, 0x67, 0x1c, 0x85, 0x37, 0x88, 0x94, 0x26, 0x8f, 0x40, 0x9d, 0x27, - 0xa1, 0xa4, 0x4c, 0x45, 0x22, 0x68, 0xd2, 0x45, 0xe2, 0x09, 0xa2, 0x19, 0x1b, 0x07, 0x29, 0x48, - 0xa9, 0xec, 0xd1, 0x77, 0xbf, 0xe3, 0x7b, 0x3c, 0xe8, 0xf7, 0x00, 0x68, 0x08, 0xd4, 0x70, 0x9d, - 0x68, 0x64, 0x5c, 0xf7, 0x5c, 0xc2, 0x9c, 0x9e, 0xc1, 0x6e, 0xf0, 0x24, 0x06, 0x06, 0x4a, 0x23, - 0xa5, 0x98, 0x53, 0x9c, 0xd1, 0xd6, 0x37, 0x1f, 0x7c, 0x10, 0xdc, 0xe0, 0x6f, 0xe9, 0x68, 0x4b, - 0xcd, 0x83, 0x28, 0xc9, 0x83, 0x06, 0x10, 0x44, 0x1f, 0xf8, 0xce, 0x87, 0x44, 0xae, 0xe0, 0xfa, - 0xab, 0x8c, 0x2a, 0x7d, 0xea, 0x9f, 0x93, 0xc8, 0x53, 0x4c, 0x54, 0xbf, 0x8a, 0x21, 0xbc, 0x74, - 0x3c, 0x2f, 0x26, 0x94, 0x36, 0xe5, 0xb6, 0xdc, 0xa9, 0x5a, 0x3f, 0x36, 0x4b, 0xad, 0x31, 0x75, - 0xc2, 0xb1, 0xa9, 0xef, 0x52, 0xdd, 0xae, 0xf1, 0xe3, 0x51, 0x7a, 0x52, 0xfe, 0x21, 0xc4, 0x20, - 0x37, 0x0b, 0xc2, 0xfc, 0xbe, 0x59, 0x6a, 0x5f, 0x53, 0xf3, 0x9d, 0xe9, 0x76, 0x95, 0xc1, 0xd6, - 0x1a, 0xa2, 0xb2, 0x13, 0x42, 0x12, 0xb1, 0x66, 0xb1, 0x5d, 0xec, 0xd4, 0xfe, 0xfc, 0xc4, 0x79, - 0x73, 0x4a, 0xb6, 0xcd, 0xf1, 0x31, 0x04, 0x91, 0xf5, 0x7f, 0xbe, 0xd4, 0xa4, 0x87, 0x27, 0xad, - 0xeb, 0x07, 0x6c, 0x98, 0xb8, 0x78, 0x00, 0xa1, 0x11, 0xc4, 0x01, 0x8d, 0x08, 0x13, 0xcf, 0x61, - 0xe2, 0x76, 0xa9, 0x37, 0xea, 0xfa, 0x60, 0xb0, 0xe9, 0x84, 0x50, 0x61, 0x51, 0x3b, 0xcb, 0x37, - 0xbf, 0xdc, 0xce, 0x34, 0xe9, 0x65, 0xa6, 0x49, 0xfa, 0x9d, 0x8c, 0xea, 0x7d, 0xea, 0xf7, 0x93, - 0x31, 0x0b, 0x44, 0xed, 0x03, 0x54, 0x0e, 0xa2, 0x49, 0xc2, 0x78, 0x61, 0xbe, 0x44, 0x0b, 0xef, - 0xf9, 0xfd, 0xf8, 0x94, 0x8f, 0x58, 0x25, 0xbe, 0x85, 0x9d, 0xcd, 0x2b, 0x87, 0xa8, 0x02, 0x09, - 0x13, 0x6a, 0x41, 0xa8, 0xbf, 0xf6, 0xaa, 0x67, 0x62, 0x26, 0x73, 0xb7, 0x86, 0x59, 0xe2, 0xdb, - 0x58, 0x27, 0xf3, 0x95, 0x2a, 0x2f, 0x56, 0xaa, 0xfc, 0xbc, 0x52, 0xe5, 0xfb, 0xb5, 0x2a, 0x2d, - 0xd6, 0xaa, 0xf4, 0xb8, 0x56, 0xa5, 0x0b, 0xfc, 0x79, 0xd1, 0x10, 0xbc, 0x64, 0x4c, 0xd2, 0xcb, - 0x75, 0xcb, 0xe2, 0x42, 0xff, 0xbe, 0x05, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xeb, 0x3d, 0x9a, 0x5b, - 0x02, 0x00, 0x00, -} - -func (m *MsgSend) 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 *MsgSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ToAddress) > 0 { - i -= len(m.ToAddress) - copy(dAtA[i:], m.ToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgMultiSend) 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 *MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Outputs) > 0 { - for iNdEx := len(m.Outputs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Outputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Inputs) > 0 { - for iNdEx := len(m.Inputs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Inputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func 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 *MsgSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgMultiSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Inputs) > 0 { - for _, e := range m.Inputs { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.Outputs) > 0 { - for _, e := range m.Outputs { - l = e.Size() - n += 1 + l + sovTx(uint64(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 *MsgSend) 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: MsgSend: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSend: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", 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.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", 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.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].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 *MsgMultiSend) 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: MsgMultiSend: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMultiSend: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Inputs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Inputs = append(m.Inputs, Input{}) - if err := m.Inputs[len(m.Inputs)-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 Outputs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Outputs = append(m.Outputs, Output{}) - if err := m.Outputs[len(m.Outputs)-1].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 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/modules/bank/types.go b/modules/bank/types.go deleted file mode 100644 index 10188ab2..00000000 --- a/modules/bank/types.go +++ /dev/null @@ -1,219 +0,0 @@ -package bank - -import ( - "errors" - "fmt" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - maxMsgLen = 5 - ModuleName = "bank" - - TypeMsgSend = "send" - TypeMsgMultiSend = "multisend" -) - -var _ sdk.Msg = &MsgSend{} - -// NewMsgSend - construct a msg to send coins from one account to another. -//nolint:interfacer -func NewMsgSend(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgSend { - return &MsgSend{ - FromAddress: fromAddr.String(), - ToAddress: toAddr.String(), - Amount: amount, - } -} - -// Route Implements Msg. -func (msg MsgSend) Route() string { return ModuleName } - -// Type Implements Msg. -func (msg MsgSend) Type() string { return TypeMsgSend } - -func (msg MsgSend) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.FromAddress) - if err != nil { - return errors.New("invalid sender address") - } - - _, err = sdk.AccAddressFromBech32(msg.ToAddress) - if err != nil { - return errors.New("invalid recipient address") - } - - if !msg.Amount.IsValid() { - return errors.New("invalid coins") - } - - if !msg.Amount.IsAllPositive() { - return errors.New("invalid coins") - } - - return nil -} - -// GetSignBytes Implements Msg. -func (msg MsgSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners Implements Msg. -func (msg MsgSend) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.FromAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{from} -} - -var _ sdk.Msg = &MsgMultiSend{} - -// NewMsgMultiSend - construct arbitrary multi-in, multi-out send msg. -func NewMsgMultiSend(in []Input, out []Output) *MsgMultiSend { - return &MsgMultiSend{Inputs: in, Outputs: out} -} - -func (msg MsgMultiSend) Route() string { return ModuleName } - -// Type Implements Msg -func (msg MsgMultiSend) Type() string { return TypeMsgMultiSend } - -// Implements Msg. -func (msg MsgMultiSend) ValidateBasic() error { - // this just makes sure all the inputs and outputs are properly formatted, - // not that they actually have the money inside - if len(msg.Inputs) == 0 { - return errors.New("invalid input coins") - } - if len(msg.Outputs) == 0 { - return errors.New("invalid output coins") - } - // make sure all inputs and outputs are individually valid - var totalIn, totalOut sdk.Coins - for _, in := range msg.Inputs { - if err := in.ValidateBasic(); err != nil { - return err - } - totalIn = totalIn.Add(in.Coins...) - } - for _, out := range msg.Outputs { - if err := out.ValidateBasic(); err != nil { - return err - } - totalOut = totalOut.Add(out.Coins...) - } - // make sure inputs and outputs match - if !totalIn.IsEqual(totalOut) { - return errors.New("inputs and outputs don't match") - } - return nil -} - -// GetSignBytes Implements Msg. -func (msg MsgMultiSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners Implements Msg. -func (msg MsgMultiSend) GetSigners() []sdk.AccAddress { - addrs := make([]sdk.AccAddress, len(msg.Inputs)) - for i, in := range msg.Inputs { - addr, _ := sdk.AccAddressFromBech32(in.Address) - addrs[i] = addr - } - - return addrs -} - -// ValidateBasic - validate transaction input -func (in Input) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(in.Address) - if err != nil { - return err - } - - if in.Coins.Empty() { - return errors.New("empty input coins") - } - - if !in.Coins.IsValid() { - return fmt.Errorf("invalid input coins [%s]", in.Coins) - } - - if !in.Coins.IsAllPositive() { - return fmt.Errorf("invalid input coins [%s]", in.Coins) - } - - return nil -} - -// NewInput - create a transaction input, used with MsgMultiSend -//nolint:interfacer -func NewInput(addr sdk.AccAddress, coins sdk.Coins) Input { - return Input{ - Address: addr.String(), - Coins: coins, - } -} - -// ValidateBasic - validate transaction output -func (out Output) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(out.Address) - if err != nil { - return fmt.Errorf("invalid output address (%s)", err) - } - - if out.Coins.Empty() { - return errors.New("empty input coins") - } - - if !out.Coins.IsValid() { - return fmt.Errorf("invalid input coins [%s]", out.Coins) - } - - if !out.Coins.IsAllPositive() { - return fmt.Errorf("invalid input coins [%s]", out.Coins) - } - return nil -} - -// NewOutput - create a transaction output, used with MsgMultiSend -//nolint:interfacer -func NewOutput(addr sdk.AccAddress, coins sdk.Coins) Output { - return Output{ - Address: addr.String(), - Coins: coins, - } -} - -// ValidateInputsOutputs validates that each respective input and output is -// valid and that the sum of inputs is equal to the sum of outputs. -func ValidateInputsOutputs(inputs []Input, outputs []Output) error { - var totalIn, totalOut sdk.Coins - - for _, in := range inputs { - if err := in.ValidateBasic(); err != nil { - return err - } - - totalIn = totalIn.Add(in.Coins...) - } - - for _, out := range outputs { - if err := out.ValidateBasic(); err != nil { - return err - } - - totalOut = totalOut.Add(out.Coins...) - } - - // make sure inputs and outputs match - if !totalIn.IsEqual(totalOut) { - return errors.New("sum inputs != sum outputs") - } - - return nil -} diff --git a/modules/base_client.go b/modules/base_client.go deleted file mode 100644 index ebb59194..00000000 --- a/modules/base_client.go +++ /dev/null @@ -1,465 +0,0 @@ -// Package modules is to warpped the API provided by each module of IRIS-Hub -// -// -package modules - -import ( - "context" - "encoding/hex" - "errors" - "fmt" - "strings" - "time" - - "github.com/tendermint/tendermint/crypto/tmhash" - - clienttx "github.com/irisnet/irishub-sdk-go/client/tx" - - "github.com/gogo/protobuf/proto" - - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - rpcclient "github.com/tendermint/tendermint/rpc/client" - - "github.com/irisnet/irishub-sdk-go/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/tx" - "github.com/irisnet/irishub-sdk-go/utils" - "github.com/irisnet/irishub-sdk-go/utils/cache" - sdklog "github.com/irisnet/irishub-sdk-go/utils/log" -) - -const ( - concurrency = 16 - cacheCapacity = 100 - cacheExpirePeriod = 1 * time.Minute - tryThreshold = 3 - maxBatch = 100 -) - -type baseClient struct { - sdk.TmClient - sdk.GRPCClient - sdk.KeyManager - logger log.Logger - cfg *sdk.ClientConfig - encodingConfig sdk.EncodingConfig - l *locker - - accountQuery - tokenQuery -} - -// NewBaseClient return the baseClient for every sub modules -func NewBaseClient(cfg sdk.ClientConfig, encodingConfig sdk.EncodingConfig, logger log.Logger) sdk.BaseClient { - // create logger - if logger == nil { - logger = sdklog.NewLogger(sdklog.Config{ - Format: sdklog.FormatText, - Level: sdklog.InfoLevel, - }) - } - - base := baseClient{ - TmClient: NewRPCClient(cfg.NodeURI, encodingConfig.Amino, encodingConfig.TxConfig.TxDecoder(), logger, cfg.Timeout), - GRPCClient: NewGRPCClient(cfg.GRPCAddr), - logger: logger, - cfg: &cfg, - encodingConfig: encodingConfig, - l: NewLocker(concurrency), - } - - base.KeyManager = keyManager{ - keyDAO: cfg.KeyDAO, - algo: cfg.Algo, - } - - c := cache.NewCache(cacheCapacity, cfg.Cached) - base.accountQuery = accountQuery{ - Queries: base, - GRPCClient: base.GRPCClient, - Logger: base.Logger(), - Cache: c, - cdc: encodingConfig.Marshaler, - km: base.KeyManager, - expiration: cacheExpirePeriod, - } - - base.tokenQuery = tokenQuery{ - q: base, - GRPCClient: base.GRPCClient, - cdc: encodingConfig.Marshaler, - Logger: base.Logger(), - Cache: c, - } - - return &base -} - -func (base *baseClient) Logger() log.Logger { - return base.logger -} - -func (base *baseClient) SetLogger(logger log.Logger) { - base.logger = logger -} - -// Codec returns codec. -func (base *baseClient) Marshaler() codec.Marshaler { - return base.encodingConfig.Marshaler -} - -func (base *baseClient) BuildTxHash(msg []sdk.Msg, baseTx sdk.BaseTx) (string, sdk.Error) { - txByte, _, err := base.buildTx(msg, baseTx) - if err != nil { - return "", sdk.Wrap(err) - } - return strings.ToUpper(hex.EncodeToString(tmhash.Sum(txByte))), nil -} - -func (base *baseClient) BuildAndSign(msg []sdk.Msg, baseTx sdk.BaseTx) ([]byte, sdk.Error) { - builder, err := base.prepare(baseTx) - if err != nil { - return nil, sdk.Wrap(err) - } - - txByte, err := builder.BuildAndSign(baseTx.From, msg, true) - if err != nil { - return nil, sdk.Wrap(err) - } - - base.Logger().Debug("sign transaction success") - return txByte, nil -} - -func (base *baseClient) BuildAndSend(msg []sdk.Msg, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - txByte, ctx, err := base.buildTx(msg, baseTx) - if err != nil { - return sdk.ResultTx{}, err - } - - if err := base.ValidateTxSize(len(txByte), msg); err != nil { - return sdk.ResultTx{}, err - } - - res, err := base.broadcastTx(txByte, ctx.Mode(), baseTx.Simulate) - if err != nil { - if base.cfg.Cached { - _ = base.removeCache(ctx.Address()) - } - - base.Logger().Error("broadcast transaction failed", "errMsg", err.Error()) - return res, err - } - return res, nil -} - -func (base *baseClient) BuildAndSendWithAccount(addr string, accountNumber, sequence uint64, msg []sdk.Msg, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - txByte, ctx, err := base.buildTxWithAccount(addr, accountNumber, sequence, msg, baseTx) - if err != nil { - return sdk.ResultTx{}, err - } - - if err := base.ValidateTxSize(len(txByte), msg); err != nil { - return sdk.ResultTx{}, err - } - return base.broadcastTx(txByte, ctx.Mode(), baseTx.Simulate) -} - -func (base *baseClient) SendBatch(msgs sdk.Msgs, baseTx sdk.BaseTx) (rs []sdk.ResultTx, err sdk.Error) { - if msgs == nil || len(msgs) == 0 { - return rs, sdk.Wrapf("must have at least one message in list") - } - - defer sdk.CatchPanic(func(errMsg string) { - base.Logger().Error("broadcast msg failed", "errMsg", errMsg) - }) - // validate msg - for _, m := range msgs { - if err := m.ValidateBasic(); err != nil { - return rs, sdk.Wrap(err) - } - } - base.Logger().Debug("validate msg success") - - // lock the account - base.l.Lock(baseTx.From) - defer base.l.Unlock(baseTx.From) - - batch := maxBatch - var tryCnt = 0 - -resize: - for i, ms := range utils.SubArray(batch, msgs) { - mss := ms.(sdk.Msgs) - - retry: - txByte, ctx, err := base.buildTx(mss, baseTx) - if err != nil { - return rs, err - } - - if err := base.ValidateTxSize(len(txByte), mss); err != nil { - base.Logger().Debug("tx is too large", "msgsLength", batch, "errMsg", err.Error()) - - // filter out transactions that have been sent - msgs = msgs[i*batch:] - // reset the maximum number of msg in each transaction - batch = batch / 2 - _ = base.removeCache(ctx.Address()) - goto resize - } - - res, err := base.broadcastTx(txByte, ctx.Mode(), baseTx.Simulate) - if err != nil { - if base.cfg.Cached { - base.Logger().Debug("something wrong,retrying ...", "address", ctx.Address(), "tryCnt", tryCnt) - - _ = base.removeCache(ctx.Address()) - if tryCnt++; tryCnt >= tryThreshold { - return rs, err - } - goto retry - } - - base.Logger().Error("broadcast transaction failed", "errMsg", err.Error()) - return rs, err - } - rs = append(rs, res) - - base.Logger().Info("broadcast transaction success", "txHash", res.Hash, "height", res.Height) - } - return rs, nil -} - -func (base baseClient) QueryWithResponse(path string, data interface{}, result sdk.Response) error { - res, err := base.Query(path, data) - if err != nil { - return err - } - - if err := base.encodingConfig.Marshaler.UnmarshalJSON(res, result.(proto.Message)); err != nil { - return err - } - - return nil -} - -func (base baseClient) Query(path string, data interface{}) ([]byte, error) { - var bz []byte - var err error - if data != nil { - bz, err = base.encodingConfig.Marshaler.MarshalJSON(data.(proto.Message)) - if err != nil { - return nil, err - } - } - - opts := rpcclient.ABCIQueryOptions{ - // Height: cliCtx.Height, - Prove: false, - } - result, err := base.ABCIQueryWithOptions(context.Background(), path, bz, opts) - if err != nil { - return nil, err - } - - resp := result.Response - if !resp.IsOK() { - return nil, errors.New(resp.Log) - } - - return resp.Value, nil -} - -func (base baseClient) QueryStore(key sdk.HexBytes, storeName string, height int64, prove bool) (res abci.ResponseQuery, err error) { - path := fmt.Sprintf("/store/%s/%s", storeName, "key") - opts := rpcclient.ABCIQueryOptions{ - Prove: prove, - Height: height, - } - - result, err := base.ABCIQueryWithOptions(context.Background(), path, key, opts) - if err != nil { - return res, err - } - - resp := result.Response - if !resp.IsOK() { - return res, errors.New(resp.Log) - } - return resp, nil -} - -func (base *baseClient) prepare(baseTx sdk.BaseTx) (*clienttx.Factory, error) { - factory := clienttx.NewFactory(). - WithChainID(base.cfg.ChainID). - WithKeyManager(base.KeyManager). - WithMode(base.cfg.Mode). - WithSimulateAndExecute(baseTx.Simulate). - WithGas(base.cfg.Gas). - WithSignModeHandler(tx.MakeSignModeHandler(tx.DefaultSignModes)). - WithTxConfig(base.encodingConfig.TxConfig) - - addr, err := base.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, err - } - factory.WithAddress(addr.String()) - - if baseTx.AccountNumber != 0 && baseTx.Sequence != 0 { - factory.WithAccountNumber(baseTx.AccountNumber). - WithSequence(baseTx.Sequence). - WithPassword(baseTx.Password) - } else { - account, err := base.QueryAndRefreshAccount(addr.String()) - if err != nil { - return nil, err - } - factory.WithAccountNumber(account.AccountNumber). - WithSequence(account.Sequence). - WithPassword(baseTx.Password) - } - - if !baseTx.Fee.Empty() && baseTx.Fee.IsValid() { - fees, err := base.ToMinCoin(baseTx.Fee...) - if err != nil { - return nil, err - } - factory.WithFee(fees) - } else { - fees, err := base.ToMinCoin(base.cfg.Fee...) - if err != nil { - panic(err) - } - factory.WithFee(fees) - } - - if len(baseTx.Mode) > 0 { - factory.WithMode(baseTx.Mode) - } - - if baseTx.Gas > 0 { - factory.WithGas(baseTx.Gas) - } - - if len(baseTx.Memo) > 0 { - factory.WithMemo(baseTx.Memo) - } - return factory, nil -} - -// TODO -func (base *baseClient) prepareTemp(addr string, accountNumber, sequence uint64, baseTx sdk.BaseTx) (*clienttx.Factory, error) { - factory := clienttx.NewFactory(). - WithChainID(base.cfg.ChainID). - WithKeyManager(base.KeyManager). - WithMode(base.cfg.Mode). - WithSimulateAndExecute(baseTx.Simulate). - WithGas(base.cfg.Gas). - WithSignModeHandler(tx.MakeSignModeHandler(tx.DefaultSignModes)). - WithTxConfig(base.encodingConfig.TxConfig) - - factory.WithAddress(addr). - WithAccountNumber(accountNumber). - WithSequence(sequence). - WithPassword(baseTx.Password) - - if !baseTx.Fee.Empty() && baseTx.Fee.IsValid() { - fees, err := base.ToMinCoin(baseTx.Fee...) - if err != nil { - return nil, err - } - factory.WithFee(fees) - } else { - fees, err := base.ToMinCoin(base.cfg.Fee...) - if err != nil { - panic(err) - } - factory.WithFee(fees) - } - - if len(baseTx.Mode) > 0 { - factory.WithMode(baseTx.Mode) - } - - if baseTx.Gas > 0 { - factory.WithGas(baseTx.Gas) - } - - if len(baseTx.Memo) > 0 { - factory.WithMemo(baseTx.Memo) - } - return factory, nil -} - -func (base *baseClient) ValidateTxSize(txSize int, msgs []sdk.Msg) sdk.Error { - //var isServiceTx bool - //for _, msg := range msgs { - // if msg.Route() == service.ModuleName { - // isServiceTx = true - // break - // } - //} - //if isServiceTx { - // var param service.Params - // - // err := base.QueryParams(service.ModuleName, ¶m) - // if err != nil { - // panic(err) - // } - // - // if uint64(txSize) > param.TxSizeLimit { - // return sdk.Wrapf("tx size too large, expected: <= %d, got %d", param.TxSizeLimit, txSize) - // } - // return nil - // - //} else { - // if uint64(txSize) > base.cfg.MaxTxBytes { - // return sdk.Wrapf("tx size too large, expected: <= %d, got %d", base.cfg.MaxTxBytes, txSize) - // } - //} - return nil -} - -type locker struct { - shards []chan int - size int -} - -//NewLocker implement the function of lock, can lock resources according to conditions -func NewLocker(size int) *locker { - shards := make([]chan int, size) - for i := 0; i < size; i++ { - shards[i] = make(chan int, 1) - } - return &locker{ - shards: shards, - size: size, - } -} - -func (l *locker) Lock(key string) { - ch := l.getShard(key) - ch <- 1 -} - -func (l *locker) Unlock(key string) { - ch := l.getShard(key) - <-ch -} - -func (l *locker) getShard(key string) chan int { - index := uint(l.indexFor(key)) % uint(l.size) - return l.shards[index] -} - -func (l *locker) indexFor(key string) uint32 { - hash := uint32(2166136261) - const prime32 = uint32(16777619) - for i := 0; i < len(key); i++ { - hash *= prime32 - hash ^= uint32(key[i]) - } - return hash -} diff --git a/modules/coinswap/codec.go b/modules/coinswap/codec.go deleted file mode 100644 index aa105239..00000000 --- a/modules/coinswap/codec.go +++ /dev/null @@ -1,27 +0,0 @@ -package coinswap - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgAddLiquidity{}, - &MsgRemoveLiquidity{}, - &MsgSwapOrder{}, - ) -} diff --git a/modules/coinswap/coinswap.go b/modules/coinswap/coinswap.go deleted file mode 100644 index 165569ef..00000000 --- a/modules/coinswap/coinswap.go +++ /dev/null @@ -1,390 +0,0 @@ -package coinswap - -import ( - "context" - "errors" - "fmt" - "strings" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type coinswapClient struct { - sdk.BaseClient - codec.Marshaler - totalSupply -} - -func NewClient(bc sdk.BaseClient, cdc codec.Marshaler, queryTotalSupply totalSupply) Client { - return coinswapClient{ - BaseClient: bc, - Marshaler: cdc, - totalSupply: queryTotalSupply, - } -} - -func (swap coinswapClient) Name() string { - return ModuleName -} - -func (swap coinswapClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (swap coinswapClient) AddLiquidity(request AddLiquidityRequest, - baseTx sdk.BaseTx) (*AddLiquidityResponse, error) { - creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrap(err) - } - - msg := &MsgAddLiquidity{ - MaxToken: request.MaxToken, - ExactStandardAmt: request.BaseAmt, - MinLiquidity: request.MinLiquidity, - Deadline: request.Deadline, - Sender: creator.String(), - } - - res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, err - } - - var totalCoins = sdk.NewCoins() - coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) - for _, coinStr := range coinStrs { - coins, er := sdk.ParseCoins(coinStr) - if er != nil { - swap.Logger().Error("Parse coin str failed", "coin", coinStr) - continue - } - totalCoins = totalCoins.Add(coins...) - } - - liquidityDenom, er := GetLiquidityDenomFrom(request.MaxToken.Denom) - if er != nil { - return nil, er - } - response := &AddLiquidityResponse{ - TokenAmt: totalCoins.AmountOf(request.MaxToken.Denom), - BaseAmt: request.BaseAmt, - Liquidity: totalCoins.AmountOf(liquidityDenom), - TxHash: res.Hash, - } - return response, nil -} - -func (swap coinswapClient) RemoveLiquidity(request RemoveLiquidityRequest, - baseTx sdk.BaseTx) (*RemoveLiquidityResponse, error) { - creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrap(err) - } - - msg := &MsgRemoveLiquidity{ - WithdrawLiquidity: request.Liquidity, - MinToken: request.MinTokenAmt, - MinStandardAmt: request.MinBaseAmt, - Deadline: request.Deadline, - Sender: creator.String(), - } - - res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, err - } - - var totalCoins = sdk.NewCoins() - coinStrs := res.Events.GetValues(eventTypeTransfer, attributeKeyAmount) - for _, coinStr := range coinStrs { - coins, er := sdk.ParseCoins(coinStr) - if er != nil { - swap.Logger().Error("Parse coin str failed", "coin", coinStr) - continue - } - totalCoins = totalCoins.Add(coins...) - } - - tokenDenom, er := GetTokenDenomFrom(request.Liquidity.Denom) - if er != nil { - return nil, er - } - - response := &RemoveLiquidityResponse{ - TokenAmt: totalCoins.AmountOf(tokenDenom), - BaseAmt: totalCoins.AmountOf(sdk.BaseDenom), - Liquidity: request.Liquidity, - TxHash: res.Hash, - } - return response, nil -} - -func (swap coinswapClient) SwapCoin(request SwapCoinRequest, baseTx sdk.BaseTx) (*SwapCoinResponse, error) { - creator, err := swap.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrap(err) - } - - input := Input{ - Address: creator.String(), - Coin: request.Input, - } - - if len(request.Receiver) == 0 { - request.Receiver = input.Address - } - - output := Output{ - Address: request.Receiver, - Coin: request.Output, - } - - msg := &MsgSwapOrder{ - Input: input, - Output: output, - Deadline: request.Deadline, - IsBuyOrder: request.IsBuyOrder, - } - - res, err := swap.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, err - } - - amount, er := res.Events.GetValue(eventTypeSwap, attributeKeyAmount) - if er != nil { - return nil, er - } - - amt, ok := sdk.NewIntFromString(amount) - if !ok { - return nil, sdk.Wrapf("%s can not convert to sdk.Int type", amount) - } - - inputAmt := request.Input.Amount - outputAmt := request.Output.Amount - if request.IsBuyOrder { - inputAmt = amt - } else { - outputAmt = amt - } - - response := &SwapCoinResponse{ - InputAmt: inputAmt, - OutputAmt: outputAmt, - TxHash: res.Hash, - } - return response, nil -} - -func (swap coinswapClient) BuyTokenWithAutoEstimate(paidTokenDenom string, boughtCoin sdk.Coin, - deadline int64, - baseTx sdk.BaseTx, -) (res *SwapCoinResponse, err error) { - var amount = sdk.ZeroInt() - switch { - case paidTokenDenom == sdk.BaseDenom: - amount, err = swap.EstimateBaseForBoughtToken(boughtCoin) - break - case boughtCoin.Denom == sdk.BaseDenom: - amount, err = swap.EstimateTokenForBoughtBase(paidTokenDenom, boughtCoin.Amount) - break - default: - amount, err = swap.EstimateTokenForBoughtToken(paidTokenDenom, boughtCoin) - break - } - - if err != nil { - return nil, err - } - - req := SwapCoinRequest{ - Input: sdk.NewCoin(paidTokenDenom, amount), - Output: boughtCoin, - Deadline: deadline, - IsBuyOrder: true, - } - return swap.SwapCoin(req, baseTx) -} - -func (swap coinswapClient) SellTokenWithAutoEstimate(gotTokenDenom string, soldCoin sdk.Coin, - deadline int64, - baseTx sdk.BaseTx, -) (res *SwapCoinResponse, err error) { - var amount = sdk.ZeroInt() - switch { - case gotTokenDenom == sdk.BaseDenom: - amount, err = swap.EstimateBaseForSoldToken(soldCoin) - break - case soldCoin.Denom == sdk.BaseDenom: - amount, err = swap.EstimateTokenForSoldBase(gotTokenDenom, soldCoin.Amount) - break - default: - amount, err = swap.EstimateTokenForSoldToken(gotTokenDenom, soldCoin) - break - } - - if err != nil { - return nil, err - } - - req := SwapCoinRequest{ - Input: soldCoin, - Output: sdk.NewCoin(gotTokenDenom, amount), - Deadline: deadline, - IsBuyOrder: false, - } - return swap.SwapCoin(req, baseTx) -} - -func (swap coinswapClient) QueryPool(denom string) (*QueryPoolResponse, error) { - conn, err := swap.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Liquidity( - context.Background(), - &QueryLiquidityRequest{Denom: denom}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return resp.Convert().(*QueryPoolResponse), err -} - -func (swap coinswapClient) QueryAllPools() (*QueryAllPoolsResponse, error) { - coins, err := swap.totalSupply() - if err != nil { - return nil, sdk.Wrap(err) - } - - var pools []QueryPoolResponse - for _, coin := range coins { - //Compatible with old data - if strings.HasPrefix(coin.Denom, "swap/") { - continue - } - denom, err := GetTokenDenomFrom(coin.Denom) - if err != nil { - continue - } - res, err := swap.QueryPool(denom) - if err != nil { - return nil, sdk.Wrap(err) - } - pools = append(pools, *res) - } - return &QueryAllPoolsResponse{pools}, err -} - -func (swap coinswapClient) EstimateTokenForSoldBase(tokenDenom string, - soldBaseAmt sdk.Int, -) (sdk.Int, error) { - result, err := swap.QueryPool(tokenDenom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getInputPrice(soldBaseAmt, - result.BaseCoin.Amount, result.TokenCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateBaseForSoldToken(soldToken sdk.Coin) (sdk.Int, error) { - result, err := swap.QueryPool(soldToken.Denom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getInputPrice(soldToken.Amount, - result.TokenCoin.Amount, result.BaseCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateTokenForSoldToken(boughtTokenDenom string, - soldToken sdk.Coin) (sdk.Int, error) { - if boughtTokenDenom == soldToken.Denom { - return sdk.ZeroInt(), errors.New("invalid trade") - } - - boughtBaseAmt, err := swap.EstimateBaseForSoldToken(soldToken) - if err != nil { - return sdk.ZeroInt(), err - } - return swap.EstimateTokenForSoldBase(boughtTokenDenom, boughtBaseAmt) -} - -func (swap coinswapClient) EstimateTokenForBoughtBase(soldTokenDenom string, - exactBoughtBaseAmt sdk.Int) (sdk.Int, error) { - result, err := swap.QueryPool(soldTokenDenom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getOutputPrice(exactBoughtBaseAmt, - result.TokenCoin.Amount, result.BaseCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateBaseForBoughtToken(boughtToken sdk.Coin) (sdk.Int, error) { - result, err := swap.QueryPool(boughtToken.Denom) - if err != nil { - return sdk.ZeroInt(), err - } - fee := sdk.MustNewDecFromStr(result.Fee) - amount := getOutputPrice(boughtToken.Amount, - result.BaseCoin.Amount, result.TokenCoin.Amount, fee) - return amount, nil -} - -func (swap coinswapClient) EstimateTokenForBoughtToken(soldTokenDenom string, - boughtToken sdk.Coin) (sdk.Int, error) { - if soldTokenDenom == boughtToken.Denom { - return sdk.ZeroInt(), errors.New("invalid trade") - } - - soldBaseAmt, err := swap.EstimateBaseForBoughtToken(boughtToken) - if err != nil { - return sdk.ZeroInt(), err - } - return swap.EstimateTokenForBoughtBase(soldTokenDenom, soldBaseAmt) -} - -func GetLiquidityDenomFrom(denom string) (string, error) { - if denom == sdk.BaseDenom { - return "", sdk.Wrapf("should not be base denom : %s", denom) - } - return fmt.Sprintf("swap%s", denom), nil -} - -func GetTokenDenomFrom(liquidityDenom string) (string, error) { - if !strings.HasPrefix(liquidityDenom, "swap") { - return "", sdk.Wrapf("wrong liquidity denom : %s", liquidityDenom) - } - return strings.TrimPrefix(liquidityDenom, "swap"), nil -} - -// getInputPrice returns the amount of coins bought (calculated) given the input amount being sold (exact) -// The fee is included in the input coins being bought -// https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf -func getInputPrice(inputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { - deltaFee := sdk.OneDec().Sub(fee) - inputAmtWithFee := inputAmt.Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) - numerator := inputAmtWithFee.Mul(outputReserve) - denominator := inputReserve.Mul(sdk.NewIntWithDecimal(1, sdk.Precision)).Add(inputAmtWithFee) - return numerator.Quo(denominator) -} - -// getOutputPrice returns the amount of coins sold (calculated) given the output amount being bought (exact) -// The fee is included in the output coins being bought -func getOutputPrice(outputAmt, inputReserve, outputReserve sdk.Int, fee sdk.Dec) sdk.Int { - deltaFee := sdk.OneDec().Sub(fee) - numerator := inputReserve.Mul(outputAmt).Mul(sdk.NewIntWithDecimal(1, sdk.Precision)) - denominator := (outputReserve.Sub(outputAmt)).Mul(sdk.NewIntFromBigInt(deltaFee.BigInt())) - return numerator.Quo(denominator).Add(sdk.OneInt()) -} diff --git a/modules/coinswap/coinswap.pb.go b/modules/coinswap/coinswap.pb.go deleted file mode 100644 index 8487a674..00000000 --- a/modules/coinswap/coinswap.pb.go +++ /dev/null @@ -1,766 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: coinswap/coinswap.proto - -package coinswap - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Input defines the properties of order's input -type Input struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` -} - -func (m *Input) Reset() { *m = Input{} } -func (m *Input) String() string { return proto.CompactTextString(m) } -func (*Input) ProtoMessage() {} -func (*Input) Descriptor() ([]byte, []int) { - return fileDescriptor_ac63172e3bfc925a, []int{0} -} -func (m *Input) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Input.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 *Input) XXX_Merge(src proto.Message) { - xxx_messageInfo_Input.Merge(m, src) -} -func (m *Input) XXX_Size() int { - return m.Size() -} -func (m *Input) XXX_DiscardUnknown() { - xxx_messageInfo_Input.DiscardUnknown(m) -} - -var xxx_messageInfo_Input proto.InternalMessageInfo - -// Output defines the properties of order's output -type Output struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` -} - -func (m *Output) Reset() { *m = Output{} } -func (m *Output) String() string { return proto.CompactTextString(m) } -func (*Output) ProtoMessage() {} -func (*Output) Descriptor() ([]byte, []int) { - return fileDescriptor_ac63172e3bfc925a, []int{1} -} -func (m *Output) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Output.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 *Output) XXX_Merge(src proto.Message) { - xxx_messageInfo_Output.Merge(m, src) -} -func (m *Output) XXX_Size() int { - return m.Size() -} -func (m *Output) XXX_DiscardUnknown() { - xxx_messageInfo_Output.DiscardUnknown(m) -} - -var xxx_messageInfo_Output proto.InternalMessageInfo - -// Params defines token module's parameters -type Params struct { - Fee github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` -} - -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_ac63172e3bfc925a, []int{2} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Input)(nil), "irismod.coinswap.Input") - proto.RegisterType((*Output)(nil), "irismod.coinswap.Output") - proto.RegisterType((*Params)(nil), "irismod.coinswap.Params") -} - -func init() { proto.RegisterFile("coinswap/coinswap.proto", fileDescriptor_ac63172e3bfc925a) } - -var fileDescriptor_ac63172e3bfc925a = []byte{ - // 298 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xce, 0xcf, 0xcc, - 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x87, 0x31, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x04, 0x32, - 0x8b, 0x32, 0x8b, 0x73, 0xf3, 0x53, 0xf4, 0x60, 0xe2, 0x52, 0x72, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, - 0xc5, 0xfa, 0x49, 0x89, 0xc5, 0xa9, 0xfa, 0x65, 0x86, 0x49, 0xa9, 0x25, 0x89, 0x86, 0x60, 0x5d, - 0x10, 0x1d, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x0a, - 0xe3, 0x62, 0xf5, 0xcc, 0x2b, 0x28, 0x2d, 0x11, 0x92, 0xe0, 0x62, 0x4f, 0x4c, 0x49, 0x29, 0x4a, - 0x2d, 0x2e, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x71, 0x85, 0x8c, 0xb9, 0x58, 0x40, - 0xc6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xea, 0x41, 0xec, 0xd1, 0x03, 0xd9, 0xa3, - 0x07, 0xb5, 0x47, 0xcf, 0x39, 0x3f, 0x33, 0xcf, 0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xb0, - 0x62, 0xa5, 0x70, 0x2e, 0x36, 0xff, 0xd2, 0x12, 0x1a, 0x18, 0x5c, 0xc2, 0xc5, 0x16, 0x90, 0x58, - 0x94, 0x98, 0x5b, 0x2c, 0x94, 0xc0, 0xc5, 0x9c, 0x96, 0x9a, 0x0a, 0x36, 0x14, 0xaf, 0x6e, 0x63, - 0x90, 0xee, 0x5b, 0xf7, 0xe4, 0xb5, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, - 0xf5, 0x41, 0xa1, 0x97, 0x97, 0x5a, 0x02, 0xa6, 0x33, 0x4a, 0x93, 0x74, 0x8b, 0x53, 0xb2, 0x75, - 0xd3, 0xf3, 0xf5, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0xf5, 0x5c, 0x52, 0x93, 0x83, 0x40, 0x46, 0x5b, - 0x71, 0xcc, 0x58, 0x20, 0xcf, 0xf8, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xc0, 0x89, 0x87, 0x72, 0x0c, - 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, 0x65, 0x44, 0xd8, 0xe4, 0xdc, 0xfc, - 0x94, 0xd2, 0x9c, 0xd4, 0x62, 0x78, 0x34, 0x26, 0xb1, 0x81, 0xc3, 0xdf, 0x18, 0x10, 0x00, 0x00, - 0xff, 0xff, 0x9d, 0x26, 0xc1, 0x1c, 0xe2, 0x01, 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 - } - if !this.Fee.Equal(that1.Fee) { - return false - } - return true -} -func (m *Input) 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 *Input) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCoinswap(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Output) 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 *Output) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCoinswap(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintCoinswap(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Fee.Size() - i -= size - if _, err := m.Fee.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoinswap(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintCoinswap(dAtA []byte, offset int, v uint64) int { - offset -= sovCoinswap(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Input) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovCoinswap(uint64(l)) - } - l = m.Coin.Size() - n += 1 + l + sovCoinswap(uint64(l)) - return n -} - -func (m *Output) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovCoinswap(uint64(l)) - } - l = m.Coin.Size() - n += 1 + l + sovCoinswap(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Fee.Size() - n += 1 + l + sovCoinswap(uint64(l)) - return n -} - -func sovCoinswap(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCoinswap(x uint64) (n int) { - return sovCoinswap(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Input) 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 ErrIntOverflowCoinswap - } - 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: Input: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - 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 ErrInvalidLengthCoinswap - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoinswap - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoinswap(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoinswap - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Output) 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 ErrIntOverflowCoinswap - } - 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: Output: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - 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 ErrInvalidLengthCoinswap - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoinswap - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoinswap(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoinswap - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoinswap - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCoinswap - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCoinswap - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Fee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoinswap(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoinswap - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCoinswap(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, ErrIntOverflowCoinswap - } - 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, ErrIntOverflowCoinswap - } - 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, ErrIntOverflowCoinswap - } - 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, ErrInvalidLengthCoinswap - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCoinswap - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCoinswap - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCoinswap = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCoinswap = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCoinswap = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/coinswap/export.go b/modules/coinswap/export.go deleted file mode 100644 index 162b4e68..00000000 --- a/modules/coinswap/export.go +++ /dev/null @@ -1,93 +0,0 @@ -package coinswap - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// expose Record module api for user -type Client interface { - sdk.Module - AddLiquidity(request AddLiquidityRequest, - baseTx sdk.BaseTx) (*AddLiquidityResponse, error) - RemoveLiquidity(request RemoveLiquidityRequest, - baseTx sdk.BaseTx) (*RemoveLiquidityResponse, error) - SwapCoin(request SwapCoinRequest, - baseTx sdk.BaseTx) (*SwapCoinResponse, error) - - BuyTokenWithAutoEstimate(paidTokenDenom string, boughtCoin sdk.Coin, - deadline int64, - baseTx sdk.BaseTx, - ) (res *SwapCoinResponse, err error) - SellTokenWithAutoEstimate(gotTokenDenom string, soldCoin sdk.Coin, - deadline int64, - baseTx sdk.BaseTx, - ) (res *SwapCoinResponse, err error) - - QueryPool(denom string) (*QueryPoolResponse, error) - QueryAllPools() (*QueryAllPoolsResponse, error) - - EstimateTokenForSoldBase(tokenDenom string, - soldBase sdk.Int, - ) (sdk.Int, error) - EstimateBaseForSoldToken(soldToken sdk.Coin) (sdk.Int, error) - EstimateTokenForSoldToken(boughtTokenDenom string, - soldToken sdk.Coin) (sdk.Int, error) - EstimateTokenForBoughtBase(soldTokenDenom string, - boughtBase sdk.Int) (sdk.Int, error) - EstimateBaseForBoughtToken(boughtToken sdk.Coin) (sdk.Int, error) - EstimateTokenForBoughtToken(soldTokenDenom string, - boughtToken sdk.Coin) (sdk.Int, error) -} - -type AddLiquidityRequest struct { - MaxToken sdk.Coin - BaseAmt sdk.Int - MinLiquidity sdk.Int - Deadline int64 -} - -type AddLiquidityResponse struct { - TokenAmt sdk.Int - BaseAmt sdk.Int - Liquidity sdk.Int - TxHash string -} - -type RemoveLiquidityRequest struct { - MinTokenAmt sdk.Int - MinBaseAmt sdk.Int - Liquidity sdk.Coin - Deadline int64 -} - -type RemoveLiquidityResponse struct { - TokenAmt sdk.Int - BaseAmt sdk.Int - Liquidity sdk.Coin - TxHash string -} - -type SwapCoinRequest struct { - Input sdk.Coin - Output sdk.Coin - Receiver string - Deadline int64 - IsBuyOrder bool -} - -type SwapCoinResponse struct { - InputAmt sdk.Int - OutputAmt sdk.Int - TxHash string -} - -type QueryPoolResponse struct { - BaseCoin sdk.Coin - TokenCoin sdk.Coin - Liquidity sdk.Coin - Fee string -} - -type QueryAllPoolsResponse struct { - Pools []QueryPoolResponse -} diff --git a/modules/coinswap/genesis.pb.go b/modules/coinswap/genesis.pb.go deleted file mode 100644 index a4bac7ed..00000000 --- a/modules/coinswap/genesis.pb.go +++ /dev/null @@ -1,375 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: coinswap/genesis.proto - -package coinswap - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 coinswap module's genesis state -type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - StandardDenom string `protobuf:"bytes,2,opt,name=standard_denom,json=standardDenom,proto3" json:"standard_denom,omitempty" yaml:"standard_denom"` -} - -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_2ec819868131a4f8, []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) GetStandardDenom() string { - if m != nil { - return m.StandardDenom - } - return "" -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "irismod.coinswap.GenesisState") -} - -func init() { proto.RegisterFile("coinswap/genesis.proto", fileDescriptor_2ec819868131a4f8) } - -var fileDescriptor_2ec819868131a4f8 = []byte{ - // 246 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xce, 0xcf, 0xcc, - 0x2b, 0x2e, 0x4f, 0x2c, 0xd0, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, - 0x2f, 0xc9, 0x17, 0x12, 0xc8, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0xc9, 0x4b, 0x89, - 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x25, 0xf5, 0x41, 0x2c, 0x88, 0x3a, 0x29, 0x71, 0xb8, 0x7e, 0x18, - 0x03, 0x22, 0xa1, 0xd4, 0xc1, 0xc8, 0xc5, 0xe3, 0x0e, 0x31, 0x32, 0xb8, 0x24, 0xb1, 0x24, 0x55, - 0xc8, 0x8c, 0x8b, 0xad, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, - 0x48, 0x42, 0x0f, 0xdd, 0x0a, 0xbd, 0x00, 0xb0, 0xbc, 0x13, 0xcb, 0x89, 0x7b, 0xf2, 0x0c, 0x41, - 0x50, 0xd5, 0x42, 0x0e, 0x5c, 0x7c, 0xc5, 0x25, 0x89, 0x79, 0x29, 0x89, 0x45, 0x29, 0xf1, 0x29, - 0xa9, 0x79, 0xf9, 0xb9, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x92, 0x9f, 0xee, 0xc9, 0x8b, - 0x56, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xa1, 0xca, 0x2b, 0x05, 0xf1, 0xc2, 0x04, 0x5c, 0x40, 0x7c, - 0x27, 0x9f, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, - 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4a, 0xcf, 0x2c, - 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0xb9, 0x26, 0x2f, 0xb5, 0x04, 0x4c, 0x67, - 0x94, 0x26, 0xe9, 0x16, 0xa7, 0x64, 0xeb, 0xa6, 0xe7, 0xeb, 0xe7, 0xe6, 0xa7, 0x94, 0xe6, 0xa4, - 0x16, 0xc3, 0xbd, 0x97, 0xc4, 0x06, 0xf6, 0x9f, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xea, 0xd9, - 0x0a, 0x0d, 0x3a, 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.StandardDenom) > 0 { - i -= len(m.StandardDenom) - copy(dAtA[i:], m.StandardDenom) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.StandardDenom))) - 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)) - l = len(m.StandardDenom) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field 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 StandardDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StandardDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/coinswap/query.pb.go b/modules/coinswap/query.pb.go deleted file mode 100644 index 0b07e097..00000000 --- a/modules/coinswap/query.pb.go +++ /dev/null @@ -1,751 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: coinswap/query.proto - -package coinswap - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/types" - _ "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 - -// QueryLiquidityRequest is request type for the Query/Liquidity RPC method -type QueryLiquidityRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QueryLiquidityRequest) Reset() { *m = QueryLiquidityRequest{} } -func (m *QueryLiquidityRequest) String() string { return proto.CompactTextString(m) } -func (*QueryLiquidityRequest) ProtoMessage() {} -func (*QueryLiquidityRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2cabf8423404f12f, []int{0} -} -func (m *QueryLiquidityRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLiquidityRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLiquidityRequest.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 *QueryLiquidityRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLiquidityRequest.Merge(m, src) -} -func (m *QueryLiquidityRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryLiquidityRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLiquidityRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLiquidityRequest proto.InternalMessageInfo - -func (m *QueryLiquidityRequest) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// QueryLiquidityResponse is response type for the Query/Liquidity RPC method -type QueryLiquidityResponse struct { - Standard types.Coin `protobuf:"bytes,1,opt,name=standard,proto3" json:"standard"` - Token types.Coin `protobuf:"bytes,2,opt,name=token,proto3" json:"token"` - Liquidity types.Coin `protobuf:"bytes,3,opt,name=liquidity,proto3" json:"liquidity"` - Fee string `protobuf:"bytes,4,opt,name=fee,proto3" json:"fee,omitempty"` -} - -func (m *QueryLiquidityResponse) Reset() { *m = QueryLiquidityResponse{} } -func (m *QueryLiquidityResponse) String() string { return proto.CompactTextString(m) } -func (*QueryLiquidityResponse) ProtoMessage() {} -func (*QueryLiquidityResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2cabf8423404f12f, []int{1} -} -func (m *QueryLiquidityResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryLiquidityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryLiquidityResponse.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 *QueryLiquidityResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryLiquidityResponse.Merge(m, src) -} -func (m *QueryLiquidityResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryLiquidityResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryLiquidityResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryLiquidityResponse proto.InternalMessageInfo - -func (m *QueryLiquidityResponse) GetStandard() types.Coin { - if m != nil { - return m.Standard - } - return types.Coin{} -} - -func (m *QueryLiquidityResponse) GetToken() types.Coin { - if m != nil { - return m.Token - } - return types.Coin{} -} - -func (m *QueryLiquidityResponse) GetLiquidity() types.Coin { - if m != nil { - return m.Liquidity - } - return types.Coin{} -} - -func (m *QueryLiquidityResponse) GetFee() string { - if m != nil { - return m.Fee - } - return "" -} - -func init() { - proto.RegisterType((*QueryLiquidityRequest)(nil), "irismod.coinswap.QueryLiquidityRequest") - proto.RegisterType((*QueryLiquidityResponse)(nil), "irismod.coinswap.QueryLiquidityResponse") -} - -func init() { proto.RegisterFile("coinswap/query.proto", fileDescriptor_2cabf8423404f12f) } - -var fileDescriptor_2cabf8423404f12f = []byte{ - // 380 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xbf, 0x6b, 0xdb, 0x40, - 0x14, 0xc7, 0x75, 0xfe, 0x51, 0xea, 0xeb, 0x62, 0x0e, 0xb7, 0xa8, 0xa6, 0xa8, 0xc5, 0x50, 0xec, - 0x45, 0x77, 0xd8, 0xa5, 0x53, 0xe9, 0xe2, 0xae, 0x5e, 0xea, 0xb1, 0xdb, 0xc9, 0xba, 0xca, 0x87, - 0xad, 0x7b, 0xb2, 0xee, 0x94, 0x60, 0x42, 0x96, 0xec, 0x81, 0x40, 0x86, 0xfc, 0x4b, 0x1e, 0x0d, - 0x59, 0xb2, 0x24, 0x04, 0x3b, 0x7f, 0x48, 0xd0, 0xc9, 0x56, 0xc0, 0x04, 0xe2, 0x49, 0x4f, 0xf7, - 0xde, 0xe7, 0xde, 0xf7, 0x7d, 0xdf, 0xe1, 0xd6, 0x04, 0xa4, 0xd2, 0xa7, 0x3c, 0x61, 0x8b, 0x4c, - 0xa4, 0x4b, 0x9a, 0xa4, 0x60, 0x80, 0x34, 0x65, 0x2a, 0x75, 0x0c, 0x21, 0xdd, 0x67, 0xdb, 0xde, - 0x04, 0x74, 0x0c, 0x9a, 0x05, 0x5c, 0x0b, 0x76, 0xd2, 0x0f, 0x84, 0xe1, 0x7d, 0x96, 0x67, 0x0b, - 0xa2, 0xdd, 0x8a, 0x20, 0x02, 0x1b, 0xb2, 0x3c, 0xda, 0x9d, 0x7e, 0x89, 0x00, 0xa2, 0xb9, 0x60, - 0x3c, 0x91, 0x8c, 0x2b, 0x05, 0x86, 0x1b, 0x09, 0x4a, 0x17, 0xd9, 0x8e, 0x8f, 0x3f, 0xfe, 0xcd, - 0x9b, 0x8e, 0xe4, 0x22, 0x93, 0xa1, 0x34, 0xcb, 0xb1, 0x58, 0x64, 0x42, 0x1b, 0xd2, 0xc2, 0xf5, - 0x50, 0x28, 0x88, 0x5d, 0xf4, 0x0d, 0xf5, 0x1a, 0xe3, 0xe2, 0xa7, 0x73, 0x8f, 0xf0, 0xa7, 0xc3, - 0x7a, 0x9d, 0x80, 0xd2, 0x82, 0xfc, 0xc2, 0xef, 0xb5, 0xe1, 0x2a, 0xe4, 0x69, 0x68, 0x99, 0x0f, - 0x83, 0xcf, 0xb4, 0x10, 0x4c, 0x73, 0xc1, 0x74, 0x27, 0x98, 0xfe, 0x01, 0xa9, 0x86, 0xb5, 0xd5, - 0xc3, 0x57, 0x67, 0x5c, 0x02, 0xe4, 0x27, 0xae, 0x1b, 0x98, 0x09, 0xe5, 0x56, 0x8e, 0x23, 0x8b, - 0x6a, 0xf2, 0x1b, 0x37, 0xe6, 0x7b, 0x21, 0x6e, 0xf5, 0x38, 0xf4, 0x85, 0x20, 0x4d, 0x5c, 0xfd, - 0x2f, 0x84, 0x5b, 0xb3, 0x13, 0xe6, 0xe1, 0xe0, 0x06, 0xe1, 0xba, 0x9d, 0x8f, 0x5c, 0x22, 0xdc, - 0x28, 0x87, 0x24, 0x5d, 0x7a, 0xb8, 0x0d, 0xfa, 0xaa, 0x6d, 0xed, 0xde, 0xdb, 0x85, 0x85, 0x5f, - 0x1d, 0xff, 0xe2, 0xf6, 0xe9, 0xba, 0xd2, 0x25, 0xdf, 0xd9, 0x8e, 0x60, 0xe5, 0x33, 0xd8, 0x2b, - 0x94, 0x42, 0xb3, 0x33, 0x6b, 0xfc, 0xf9, 0x70, 0xb4, 0xda, 0x78, 0x68, 0xbd, 0xf1, 0xd0, 0xe3, - 0xc6, 0x43, 0x57, 0x5b, 0xcf, 0x59, 0x6f, 0x3d, 0xe7, 0x6e, 0xeb, 0x39, 0xff, 0x06, 0x91, 0x34, - 0xd3, 0x2c, 0xa0, 0x13, 0x88, 0xed, 0x55, 0x4a, 0x18, 0xfb, 0x9d, 0x66, 0x81, 0xaf, 0xc3, 0x99, - 0x1f, 0x01, 0x8b, 0x21, 0xcc, 0xe6, 0x42, 0x97, 0x1d, 0x82, 0x77, 0x76, 0xfb, 0x3f, 0x9e, 0x03, - 0x00, 0x00, 0xff, 0xff, 0x4f, 0x9c, 0xdd, 0x1a, 0x7b, 0x02, 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 { - // Liquidity returns the total liquidity available for the provided - // denomination - Liquidity(ctx context.Context, in *QueryLiquidityRequest, opts ...grpc.CallOption) (*QueryLiquidityResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Liquidity(ctx context.Context, in *QueryLiquidityRequest, opts ...grpc.CallOption) (*QueryLiquidityResponse, error) { - out := new(QueryLiquidityResponse) - err := c.cc.Invoke(ctx, "/irismod.coinswap.Query/Liquidity", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Liquidity returns the total liquidity available for the provided - // denomination - Liquidity(context.Context, *QueryLiquidityRequest) (*QueryLiquidityResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Liquidity(ctx context.Context, req *QueryLiquidityRequest) (*QueryLiquidityResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Liquidity not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Liquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryLiquidityRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Liquidity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.coinswap.Query/Liquidity", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Liquidity(ctx, req.(*QueryLiquidityRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.coinswap.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Liquidity", - Handler: _Query_Liquidity_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "coinswap/query.proto", -} - -func (m *QueryLiquidityRequest) 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 *QueryLiquidityRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLiquidityRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryLiquidityResponse) 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 *QueryLiquidityResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryLiquidityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Fee) > 0 { - i -= len(m.Fee) - copy(dAtA[i:], m.Fee) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Fee))) - i-- - dAtA[i] = 0x22 - } - { - size, err := m.Liquidity.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Standard.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 *QueryLiquidityRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryLiquidityResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Standard.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.Token.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.Liquidity.Size() - n += 1 + l + sovQuery(uint64(l)) - l = len(m.Fee) - if l > 0 { - 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 *QueryLiquidityRequest) 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: QueryLiquidityRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLiquidityRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryLiquidityResponse) 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: QueryLiquidityResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryLiquidityResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Standard", 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.Standard.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Liquidity", 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.Liquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fee", 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.Fee = 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 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/modules/coinswap/tx.pb.go b/modules/coinswap/tx.pb.go deleted file mode 100644 index 120edc9a..00000000 --- a/modules/coinswap/tx.pb.go +++ /dev/null @@ -1,1756 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: coinswap/tx.proto - -package coinswap - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - 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 - -// MsgAddLiquidity defines a msg for adding liquidity to a reserve pool -type MsgAddLiquidity struct { - MaxToken types.Coin `protobuf:"bytes,1,opt,name=max_token,json=maxToken,proto3" json:"max_token" yaml:"max_token"` - ExactStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=exact_standard_amt,json=exactStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"exact_standard_amt" yaml:"exact_standard_amt"` - MinLiquidity github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_liquidity,json=minLiquidity,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_liquidity" yaml:"min_liquidity"` - Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` - Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` -} - -func (m *MsgAddLiquidity) Reset() { *m = MsgAddLiquidity{} } -func (m *MsgAddLiquidity) String() string { return proto.CompactTextString(m) } -func (*MsgAddLiquidity) ProtoMessage() {} -func (*MsgAddLiquidity) Descriptor() ([]byte, []int) { - return fileDescriptor_f3a5860d70ca9b75, []int{0} -} -func (m *MsgAddLiquidity) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddLiquidity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddLiquidity.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 *MsgAddLiquidity) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddLiquidity.Merge(m, src) -} -func (m *MsgAddLiquidity) XXX_Size() int { - return m.Size() -} -func (m *MsgAddLiquidity) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddLiquidity.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddLiquidity proto.InternalMessageInfo - -// MsgAddLiquidityResponse defines the Msg/AddLiquidity response type -type MsgAddLiquidityResponse struct { - MintToken *types.Coin `protobuf:"bytes,1,opt,name=mint_token,json=mintToken,proto3" json:"mint_token,omitempty"` -} - -func (m *MsgAddLiquidityResponse) Reset() { *m = MsgAddLiquidityResponse{} } -func (m *MsgAddLiquidityResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAddLiquidityResponse) ProtoMessage() {} -func (*MsgAddLiquidityResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f3a5860d70ca9b75, []int{1} -} -func (m *MsgAddLiquidityResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgAddLiquidityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgAddLiquidityResponse.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 *MsgAddLiquidityResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddLiquidityResponse.Merge(m, src) -} -func (m *MsgAddLiquidityResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgAddLiquidityResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddLiquidityResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgAddLiquidityResponse proto.InternalMessageInfo - -// MsgRemoveLiquidity defines a msg for removing liquidity from a reserve pool -type MsgRemoveLiquidity struct { - WithdrawLiquidity types.Coin `protobuf:"bytes,1,opt,name=withdraw_liquidity,json=withdrawLiquidity,proto3" json:"withdraw_liquidity" yaml:"withdraw_liquidity"` - MinToken github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=min_token,json=minToken,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_token" yaml:"min_token"` - MinStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_standard_amt,json=minStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_standard_amt" yaml:"min_standard_amt"` - Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` - Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` -} - -func (m *MsgRemoveLiquidity) Reset() { *m = MsgRemoveLiquidity{} } -func (m *MsgRemoveLiquidity) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveLiquidity) ProtoMessage() {} -func (*MsgRemoveLiquidity) Descriptor() ([]byte, []int) { - return fileDescriptor_f3a5860d70ca9b75, []int{2} -} -func (m *MsgRemoveLiquidity) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveLiquidity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveLiquidity.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 *MsgRemoveLiquidity) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveLiquidity.Merge(m, src) -} -func (m *MsgRemoveLiquidity) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveLiquidity) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveLiquidity.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveLiquidity proto.InternalMessageInfo - -// MsgRemoveLiquidityResponse defines the Msg/RemoveLiquidity response type -type MsgRemoveLiquidityResponse struct { - WithdrawCoins []*types.Coin `protobuf:"bytes,1,rep,name=withdraw_coins,json=withdrawCoins,proto3" json:"withdraw_coins,omitempty"` -} - -func (m *MsgRemoveLiquidityResponse) Reset() { *m = MsgRemoveLiquidityResponse{} } -func (m *MsgRemoveLiquidityResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveLiquidityResponse) ProtoMessage() {} -func (*MsgRemoveLiquidityResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f3a5860d70ca9b75, []int{3} -} -func (m *MsgRemoveLiquidityResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveLiquidityResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveLiquidityResponse.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 *MsgRemoveLiquidityResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveLiquidityResponse.Merge(m, src) -} -func (m *MsgRemoveLiquidityResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveLiquidityResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveLiquidityResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveLiquidityResponse proto.InternalMessageInfo - -// MsgSwapOrder defines a msg for swap order -type MsgSwapOrder struct { - Input Input `protobuf:"bytes,1,opt,name=input,proto3" json:"input"` - Output Output `protobuf:"bytes,2,opt,name=output,proto3" json:"output"` - Deadline int64 `protobuf:"varint,3,opt,name=deadline,proto3" json:"deadline,omitempty"` - IsBuyOrder bool `protobuf:"varint,4,opt,name=is_buy_order,json=isBuyOrder,proto3" json:"is_buy_order,omitempty" yaml:"is_buy_order"` -} - -func (m *MsgSwapOrder) Reset() { *m = MsgSwapOrder{} } -func (m *MsgSwapOrder) String() string { return proto.CompactTextString(m) } -func (*MsgSwapOrder) ProtoMessage() {} -func (*MsgSwapOrder) Descriptor() ([]byte, []int) { - return fileDescriptor_f3a5860d70ca9b75, []int{4} -} -func (m *MsgSwapOrder) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSwapOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSwapOrder.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 *MsgSwapOrder) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSwapOrder.Merge(m, src) -} -func (m *MsgSwapOrder) XXX_Size() int { - return m.Size() -} -func (m *MsgSwapOrder) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSwapOrder.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSwapOrder proto.InternalMessageInfo - -// MsgSwapCoinResponse defines the Msg/SwapCoin response type -type MsgSwapCoinResponse struct { -} - -func (m *MsgSwapCoinResponse) Reset() { *m = MsgSwapCoinResponse{} } -func (m *MsgSwapCoinResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSwapCoinResponse) ProtoMessage() {} -func (*MsgSwapCoinResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f3a5860d70ca9b75, []int{5} -} -func (m *MsgSwapCoinResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSwapCoinResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSwapCoinResponse.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 *MsgSwapCoinResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSwapCoinResponse.Merge(m, src) -} -func (m *MsgSwapCoinResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSwapCoinResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSwapCoinResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSwapCoinResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgAddLiquidity)(nil), "irismod.coinswap.MsgAddLiquidity") - proto.RegisterType((*MsgAddLiquidityResponse)(nil), "irismod.coinswap.MsgAddLiquidityResponse") - proto.RegisterType((*MsgRemoveLiquidity)(nil), "irismod.coinswap.MsgRemoveLiquidity") - proto.RegisterType((*MsgRemoveLiquidityResponse)(nil), "irismod.coinswap.MsgRemoveLiquidityResponse") - proto.RegisterType((*MsgSwapOrder)(nil), "irismod.coinswap.MsgSwapOrder") - proto.RegisterType((*MsgSwapCoinResponse)(nil), "irismod.coinswap.MsgSwapCoinResponse") -} - -func init() { proto.RegisterFile("coinswap/tx.proto", fileDescriptor_f3a5860d70ca9b75) } - -var fileDescriptor_f3a5860d70ca9b75 = []byte{ - // 699 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0xee, 0x52, 0x20, 0x65, 0x7e, 0x05, 0xca, 0xc2, 0xcf, 0x2e, 0x7b, 0xd8, 0x96, 0x8d, 0x26, - 0x18, 0x65, 0x1b, 0x20, 0x31, 0xea, 0x49, 0xea, 0xc1, 0x10, 0xad, 0xe0, 0xe2, 0xc9, 0x18, 0x9b, - 0x6d, 0x67, 0xb2, 0x4c, 0xe8, 0xcc, 0xac, 0x3b, 0xb3, 0xb4, 0xbd, 0x78, 0xf7, 0xe6, 0xc5, 0xa3, - 0xdf, 0x87, 0x23, 0xf1, 0x64, 0x3c, 0x34, 0x0a, 0xdf, 0x80, 0x4f, 0x60, 0x66, 0x77, 0xba, 0xfd, - 0x87, 0x42, 0x7a, 0xea, 0xcc, 0xfb, 0xbe, 0xcf, 0xfb, 0xe7, 0x79, 0xde, 0xe9, 0x82, 0x95, 0x26, - 0xc3, 0x94, 0xb7, 0xbd, 0xa0, 0x22, 0x3a, 0x4e, 0x10, 0x32, 0xc1, 0xf4, 0x02, 0x0e, 0x31, 0x27, - 0x0c, 0x3a, 0x7d, 0x97, 0x59, 0x4c, 0x83, 0xfa, 0x87, 0x24, 0xd4, 0xb4, 0x9a, 0x8c, 0x13, 0xc6, - 0x2b, 0x0d, 0x8f, 0xa3, 0xca, 0xe9, 0x76, 0x03, 0x09, 0x6f, 0x3b, 0x8e, 0x51, 0xfe, 0x35, 0x9f, - 0xf9, 0x2c, 0x3e, 0x56, 0xe4, 0x29, 0xb1, 0xda, 0x9f, 0xb3, 0x60, 0xb9, 0xc6, 0xfd, 0x3d, 0x08, - 0x5f, 0xe1, 0x8f, 0x11, 0x86, 0x58, 0x74, 0xf5, 0x43, 0xb0, 0x40, 0xbc, 0x4e, 0x5d, 0xb0, 0x13, - 0x44, 0x0d, 0xad, 0xac, 0x6d, 0xfe, 0xb7, 0xb3, 0xee, 0x24, 0xd9, 0x1d, 0x99, 0xdd, 0x51, 0xd9, - 0x9d, 0xe7, 0x0c, 0xd3, 0xaa, 0x71, 0xd6, 0x2b, 0x65, 0xae, 0x7a, 0xa5, 0x42, 0xd7, 0x23, 0xad, - 0xa7, 0x76, 0x8a, 0xb4, 0xdd, 0x1c, 0xf1, 0x3a, 0x6f, 0xe5, 0x51, 0xff, 0x04, 0x74, 0xd4, 0xf1, - 0x9a, 0xa2, 0xce, 0x85, 0x47, 0xa1, 0x17, 0xc2, 0xba, 0x47, 0x84, 0x31, 0x53, 0xd6, 0x36, 0x17, - 0xaa, 0x87, 0x12, 0xff, 0xb3, 0x57, 0x7a, 0xe0, 0x63, 0x71, 0x1c, 0x35, 0x9c, 0x26, 0x23, 0x15, - 0x39, 0x35, 0x45, 0x22, 0xfe, 0x3d, 0x8e, 0x1a, 0x5b, 0x1c, 0x9e, 0x6c, 0xf9, 0xac, 0x22, 0xba, - 0x01, 0xe2, 0xce, 0x3e, 0x15, 0x57, 0xbd, 0xd2, 0x7a, 0x52, 0x6e, 0x32, 0xad, 0xed, 0x16, 0x62, - 0xe3, 0x91, 0xb2, 0xed, 0x11, 0xa1, 0x07, 0x60, 0x91, 0x60, 0x5a, 0x6f, 0xf5, 0x47, 0x34, 0xb2, - 0x71, 0xe9, 0x97, 0xd3, 0x95, 0x5e, 0x53, 0x93, 0x0e, 0x67, 0xb4, 0xdd, 0x3c, 0xc1, 0x74, 0xc0, - 0xa1, 0x09, 0x72, 0x10, 0x79, 0xb0, 0x85, 0x29, 0x32, 0x66, 0xcb, 0xda, 0x66, 0xd6, 0x4d, 0xef, - 0xfa, 0x1d, 0x30, 0xcf, 0x11, 0x85, 0x28, 0x34, 0xe6, 0x64, 0x1b, 0xae, 0xba, 0xd9, 0x47, 0xa0, - 0x38, 0x26, 0x85, 0x8b, 0x78, 0xc0, 0x28, 0x47, 0xfa, 0x63, 0x00, 0x08, 0xa6, 0xe2, 0x96, 0x9a, - 0xb8, 0x0b, 0x32, 0x38, 0xa6, 0xde, 0xfe, 0x9a, 0x05, 0x7a, 0x8d, 0xfb, 0x2e, 0x22, 0xec, 0x14, - 0x0d, 0xfa, 0x3b, 0x01, 0x7a, 0x1b, 0x8b, 0x63, 0x18, 0x7a, 0xed, 0x21, 0x5a, 0x6e, 0x14, 0x7b, - 0x43, 0x89, 0xad, 0xd8, 0x9f, 0x4c, 0x61, 0xbb, 0x2b, 0x7d, 0xe3, 0xa0, 0x18, 0x04, 0xb2, 0x21, - 0xd5, 0x7c, 0xa2, 0xfa, 0x8b, 0xe9, 0xa8, 0x2f, 0x0c, 0xa8, 0x4f, 0x97, 0x0c, 0xd3, 0x64, 0xc9, - 0x3a, 0xa0, 0x20, 0xed, 0x23, 0x2b, 0x96, 0xe8, 0xfc, 0x7a, 0xba, 0x62, 0xc5, 0x41, 0xb1, 0xd1, - 0x05, 0x5b, 0x22, 0x98, 0x0e, 0xaf, 0xd7, 0x34, 0x62, 0x7f, 0x00, 0xe6, 0xa4, 0x2c, 0xa9, 0xde, - 0xcf, 0xc0, 0x52, 0xca, 0x6d, 0xfc, 0xce, 0x0d, 0xad, 0x9c, 0xfd, 0xb7, 0xe6, 0x8b, 0x7d, 0x80, - 0xbc, 0x71, 0xfb, 0xbb, 0x06, 0xf2, 0x35, 0xee, 0x1f, 0xb5, 0xbd, 0xe0, 0x20, 0x84, 0x28, 0xd4, - 0x77, 0xc1, 0x1c, 0xa6, 0x41, 0x24, 0x94, 0xc8, 0x45, 0x67, 0xfc, 0xaf, 0xc5, 0xd9, 0x97, 0xee, - 0xea, 0xac, 0x24, 0xcb, 0x4d, 0x62, 0xf5, 0x47, 0x60, 0x9e, 0x45, 0x42, 0xa2, 0x66, 0x62, 0x94, - 0x31, 0x89, 0x3a, 0x88, 0xfd, 0x0a, 0xa6, 0xa2, 0x47, 0x18, 0xc9, 0x8e, 0x31, 0xf2, 0x04, 0xe4, - 0x31, 0xaf, 0x37, 0xa2, 0x6e, 0x9d, 0xc9, 0xc6, 0x62, 0xc6, 0x72, 0xd5, 0xe2, 0x55, 0xaf, 0xb4, - 0x9a, 0x10, 0x3e, 0xec, 0xb5, 0x5d, 0x80, 0x79, 0x35, 0xea, 0xc6, 0x33, 0xd8, 0xff, 0x83, 0x55, - 0x35, 0x53, 0x3c, 0xb2, 0x62, 0x6b, 0xe7, 0xdb, 0x0c, 0xc8, 0xd6, 0xb8, 0xaf, 0xbf, 0x07, 0xf9, - 0x91, 0x3f, 0xb2, 0x8d, 0xc9, 0x6e, 0xc7, 0x1e, 0x98, 0x79, 0xff, 0xc6, 0x90, 0x54, 0x13, 0x04, - 0x96, 0xc7, 0x5f, 0xd1, 0xdd, 0x6b, 0xd1, 0x63, 0x51, 0xe6, 0xc3, 0xdb, 0x44, 0xa5, 0x65, 0xde, - 0x80, 0x5c, 0x7f, 0x40, 0xdd, 0xba, 0x16, 0x99, 0x6a, 0x6a, 0xde, 0xfb, 0xab, 0x7f, 0x98, 0x9f, - 0xea, 0xe1, 0xd9, 0x6f, 0x2b, 0x73, 0x76, 0x61, 0x69, 0xe7, 0x17, 0x96, 0xf6, 0xeb, 0xc2, 0xd2, - 0xbe, 0x5c, 0x5a, 0x99, 0xf3, 0x4b, 0x2b, 0xf3, 0xe3, 0xd2, 0xca, 0xbc, 0xdb, 0xb9, 0xf9, 0x55, - 0x10, 0x06, 0xa3, 0x16, 0xe2, 0xe9, 0x27, 0xa7, 0x31, 0x1f, 0x7f, 0x3d, 0x76, 0xff, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x24, 0x3f, 0x54, 0x92, 0xb3, 0x06, 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 { - // AddLiquidity defines a method for depositing some tokens to the liquidity - // pool - AddLiquidity(ctx context.Context, in *MsgAddLiquidity, opts ...grpc.CallOption) (*MsgAddLiquidityResponse, error) - // RemoveLiquidity defines a method for withdraw some tokens from the - // liquidity pool - RemoveLiquidity(ctx context.Context, in *MsgRemoveLiquidity, opts ...grpc.CallOption) (*MsgRemoveLiquidityResponse, error) - // SwapCoin defines a method for swapping a token with the other token from - // the liquidity pool - SwapCoin(ctx context.Context, in *MsgSwapOrder, opts ...grpc.CallOption) (*MsgSwapCoinResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) AddLiquidity(ctx context.Context, in *MsgAddLiquidity, opts ...grpc.CallOption) (*MsgAddLiquidityResponse, error) { - out := new(MsgAddLiquidityResponse) - err := c.cc.Invoke(ctx, "/irismod.coinswap.Msg/AddLiquidity", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RemoveLiquidity(ctx context.Context, in *MsgRemoveLiquidity, opts ...grpc.CallOption) (*MsgRemoveLiquidityResponse, error) { - out := new(MsgRemoveLiquidityResponse) - err := c.cc.Invoke(ctx, "/irismod.coinswap.Msg/RemoveLiquidity", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) SwapCoin(ctx context.Context, in *MsgSwapOrder, opts ...grpc.CallOption) (*MsgSwapCoinResponse, error) { - out := new(MsgSwapCoinResponse) - err := c.cc.Invoke(ctx, "/irismod.coinswap.Msg/SwapCoin", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // AddLiquidity defines a method for depositing some tokens to the liquidity - // pool - AddLiquidity(context.Context, *MsgAddLiquidity) (*MsgAddLiquidityResponse, error) - // RemoveLiquidity defines a method for withdraw some tokens from the - // liquidity pool - RemoveLiquidity(context.Context, *MsgRemoveLiquidity) (*MsgRemoveLiquidityResponse, error) - // SwapCoin defines a method for swapping a token with the other token from - // the liquidity pool - SwapCoin(context.Context, *MsgSwapOrder) (*MsgSwapCoinResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) AddLiquidity(ctx context.Context, req *MsgAddLiquidity) (*MsgAddLiquidityResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddLiquidity not implemented") -} -func (*UnimplementedMsgServer) RemoveLiquidity(ctx context.Context, req *MsgRemoveLiquidity) (*MsgRemoveLiquidityResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveLiquidity not implemented") -} -func (*UnimplementedMsgServer) SwapCoin(ctx context.Context, req *MsgSwapOrder) (*MsgSwapCoinResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SwapCoin not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_AddLiquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddLiquidity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).AddLiquidity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.coinswap.Msg/AddLiquidity", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddLiquidity(ctx, req.(*MsgAddLiquidity)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RemoveLiquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveLiquidity) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RemoveLiquidity(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.coinswap.Msg/RemoveLiquidity", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveLiquidity(ctx, req.(*MsgRemoveLiquidity)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_SwapCoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSwapOrder) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SwapCoin(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.coinswap.Msg/SwapCoin", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SwapCoin(ctx, req.(*MsgSwapOrder)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.coinswap.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "AddLiquidity", - Handler: _Msg_AddLiquidity_Handler, - }, - { - MethodName: "RemoveLiquidity", - Handler: _Msg_RemoveLiquidity_Handler, - }, - { - MethodName: "SwapCoin", - Handler: _Msg_SwapCoin_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "coinswap/tx.proto", -} - -func (m *MsgAddLiquidity) 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 *MsgAddLiquidity) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddLiquidity) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x2a - } - if m.Deadline != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Deadline)) - i-- - dAtA[i] = 0x20 - } - { - size := m.MinLiquidity.Size() - i -= size - if _, err := m.MinLiquidity.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.ExactStandardAmt.Size() - i -= size - if _, err := m.ExactStandardAmt.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.MaxToken.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgAddLiquidityResponse) 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 *MsgAddLiquidityResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgAddLiquidityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MintToken != nil { - { - size, err := m.MintToken.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgRemoveLiquidity) 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 *MsgRemoveLiquidity) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveLiquidity) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x2a - } - if m.Deadline != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Deadline)) - i-- - dAtA[i] = 0x20 - } - { - size := m.MinStandardAmt.Size() - i -= size - if _, err := m.MinStandardAmt.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.MinToken.Size() - i -= size - if _, err := m.MinToken.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.WithdrawLiquidity.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgRemoveLiquidityResponse) 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 *MsgRemoveLiquidityResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveLiquidityResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.WithdrawCoins) > 0 { - for iNdEx := len(m.WithdrawCoins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.WithdrawCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MsgSwapOrder) 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 *MsgSwapOrder) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSwapOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.IsBuyOrder { - i-- - if m.IsBuyOrder { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Deadline != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Deadline)) - i-- - dAtA[i] = 0x18 - } - { - size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgSwapCoinResponse) 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 *MsgSwapCoinResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSwapCoinResponse) 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 *MsgAddLiquidity) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MaxToken.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.ExactStandardAmt.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.MinLiquidity.Size() - n += 1 + l + sovTx(uint64(l)) - if m.Deadline != 0 { - n += 1 + sovTx(uint64(m.Deadline)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgAddLiquidityResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MintToken != nil { - l = m.MintToken.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRemoveLiquidity) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.WithdrawLiquidity.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.MinToken.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.MinStandardAmt.Size() - n += 1 + l + sovTx(uint64(l)) - if m.Deadline != 0 { - n += 1 + sovTx(uint64(m.Deadline)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRemoveLiquidityResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.WithdrawCoins) > 0 { - for _, e := range m.WithdrawCoins { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgSwapOrder) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Input.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Output.Size() - n += 1 + l + sovTx(uint64(l)) - if m.Deadline != 0 { - n += 1 + sovTx(uint64(m.Deadline)) - } - if m.IsBuyOrder { - n += 2 - } - return n -} - -func (m *MsgSwapCoinResponse) 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 *MsgAddLiquidity) 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: MsgAddLiquidity: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddLiquidity: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxToken", 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.MaxToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExactStandardAmt", 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 - } - if err := m.ExactStandardAmt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinLiquidity", 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 - } - if err := m.MinLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Deadline", wireType) - } - m.Deadline = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Deadline |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgAddLiquidityResponse) 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: MsgAddLiquidityResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddLiquidityResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MintToken", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MintToken == nil { - m.MintToken = &types.Coin{} - } - if err := m.MintToken.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 *MsgRemoveLiquidity) 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: MsgRemoveLiquidity: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveLiquidity: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawLiquidity", 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.WithdrawLiquidity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinToken", 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 - } - if err := m.MinToken.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStandardAmt", 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 - } - if err := m.MinStandardAmt.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Deadline", wireType) - } - m.Deadline = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Deadline |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgRemoveLiquidityResponse) 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: MsgRemoveLiquidityResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveLiquidityResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawCoins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WithdrawCoins = append(m.WithdrawCoins, &types.Coin{}) - if err := m.WithdrawCoins[len(m.WithdrawCoins)-1].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 *MsgSwapOrder) 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: MsgSwapOrder: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapOrder: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Output", 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.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Deadline", wireType) - } - m.Deadline = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Deadline |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsBuyOrder", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.IsBuyOrder = bool(v != 0) - 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 *MsgSwapCoinResponse) 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: MsgSwapCoinResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSwapCoinResponse: 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/modules/coinswap/types.go b/modules/coinswap/types.go deleted file mode 100644 index 62791ee6..00000000 --- a/modules/coinswap/types.go +++ /dev/null @@ -1,164 +0,0 @@ -package coinswap - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "coinswap" - - eventTypeTransfer = "transfer" - eventTypeSwap = "swap" - - attributeKeyAmount = "amount" -) - -var ( - _ sdk.Msg = &MsgAddLiquidity{} - _ sdk.Msg = &MsgRemoveLiquidity{} - _ sdk.Msg = &MsgSwapOrder{} -) - -type totalSupply = func() (sdk.Coins, sdk.Error) - -// Route implements Msg. -func (msg MsgAddLiquidity) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgAddLiquidity) Type() string { return "add_liquidity" } - -// GetSignBytes implements Msg. -func (msg MsgAddLiquidity) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgAddLiquidity) ValidateBasic() error { - if !(msg.MaxToken.IsValid() && msg.MaxToken.IsPositive()) { - return sdk.Wrapf("invalid MaxToken: %s", msg.MaxToken.String()) - } - - if !msg.ExactStandardAmt.IsPositive() { - return sdk.Wrapf("standard token amount must be positive") - } - - if msg.MinLiquidity.IsNegative() { - return sdk.Wrapf("minimum liquidity can not be negative") - } - - if msg.Deadline <= 0 { - return sdk.Wrapf("deadline %d must be greater than 0", msg.Deadline) - } - - if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdk.Wrap(err) - } - return nil -} - -// GetSigners implements Msg. -func (msg MsgAddLiquidity) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Sender)} -} - -// Route implements Msg. -func (msg MsgRemoveLiquidity) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgRemoveLiquidity) Type() string { return "remove_liquidity" } - -// GetSignBytes implements Msg. -func (msg MsgRemoveLiquidity) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgRemoveLiquidity) ValidateBasic() error { - if msg.MinToken.IsNegative() { - return sdk.Wrapf("minimum token amount can not be negative") - } - if !msg.WithdrawLiquidity.IsValid() || !msg.WithdrawLiquidity.IsPositive() { - return sdk.Wrapf("invalid withdrawLiquidity (%s)", msg.WithdrawLiquidity.String()) - } - if msg.MinStandardAmt.IsNegative() { - return sdk.Wrapf("minimum standard token amount %s can not be negative", msg.MinStandardAmt.String()) - } - if msg.Deadline <= 0 { - return sdk.Wrapf("deadline %d must be greater than 0", msg.Deadline) - } - return nil -} - -// GetSigners implements Msg. -func (msg MsgRemoveLiquidity) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Sender)} -} - -// Route implements Msg. -func (msg MsgSwapOrder) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgSwapOrder) Type() string { return "swap_order" } - -// GetSignBytes implements Msg. -func (msg MsgSwapOrder) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgSwapOrder) ValidateBasic() error { - if !(msg.Input.Coin.IsValid() && msg.Input.Coin.IsPositive()) { - return sdk.Wrapf("invalid input (%s)", msg.Input.Coin.String()) - } - - if _, err := sdk.AccAddressFromBech32(msg.Input.Address); err != nil { - return sdk.Wrap(err) - } - - if !(msg.Output.Coin.IsValid() && msg.Output.Coin.IsPositive()) { - return sdk.Wrapf("invalid output (%s)", msg.Output.Coin.String()) - } - - if _, err := sdk.AccAddressFromBech32(msg.Output.Address); err != nil { - return sdk.Wrap(err) - } - - if msg.Input.Coin.Denom == msg.Output.Coin.Denom { - return sdk.Wrapf("invalid swap") - } - - if msg.Deadline <= 0 { - return sdk.Wrapf("deadline %d must be greater than 0", msg.Deadline) - } - return nil -} - -// GetSigners implements Msg. -func (msg MsgSwapOrder) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.Input.Address) - if err != nil { - panic(err) - } - return []sdk.AccAddress{from} -} - -func (m QueryLiquidityResponse) Convert() interface{} { - return &QueryPoolResponse{ - BaseCoin: m.Standard, - TokenCoin: m.Token, - Liquidity: m.Liquidity, - Fee: m.Fee, - } -} diff --git a/modules/gov/codec.go b/modules/gov/codec.go deleted file mode 100644 index 4231655e..00000000 --- a/modules/gov/codec.go +++ /dev/null @@ -1,25 +0,0 @@ -package gov - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgSubmitProposal{}, - &MsgDeposit{}, - &MsgVote{}, - ) -} diff --git a/modules/gov/content.go b/modules/gov/content.go deleted file mode 100644 index bda6e310..00000000 --- a/modules/gov/content.go +++ /dev/null @@ -1,22 +0,0 @@ -package gov - -// Constants pertaining to a Content object -const ( - MaxDescriptionLength int = 5000 - MaxTitleLength int = 140 -) - -// Content defines an interface that a proposal must implement. It contains -// information such as the title and description along with the type and routing -// information for the appropriate handler to process the proposal. Content can -// have additional fields, which will handled by a proposal's Handler. -// TODO Try to unify this interface with types/module/simulation -// https://github.com/cosmos/cosmos-sdk/issues/5853 -type Content interface { - GetTitle() string - GetDescription() string - ProposalRoute() string - ProposalType() string - ValidateBasic() error - String() string -} diff --git a/modules/gov/export.go b/modules/gov/export.go deleted file mode 100644 index 5a18ceb0..00000000 --- a/modules/gov/export.go +++ /dev/null @@ -1,92 +0,0 @@ -package gov - -import ( - "time" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// expose Gov module api for user -type Client interface { - sdk.Module - SubmitProposal(request SubmitProposalRequest, baseTx sdk.BaseTx) (uint64, sdk.ResultTx, sdk.Error) - Deposit(request DepositRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - Vote(request VoteRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - - QueryProposal(proposalId uint64) (QueryProposalResp, sdk.Error) - QueryProposals(proposalStatus string) ([]QueryProposalResp, sdk.Error) - QueryVote(proposalId uint64, voter string) (QueryVoteResp, sdk.Error) - QueryVotes(proposalId uint64) ([]QueryVoteResp, sdk.Error) - QueryParams(paramsType string) (QueryParamsResp, sdk.Error) - QueryDeposit(proposalId uint64, depositor string) (QueryDepositResp, sdk.Error) - QueryDeposits(proposalId uint64) ([]QueryDepositResp, sdk.Error) - QueryTallyResult(proposalId uint64) (QueryTallyResultResp, sdk.Error) -} - -type SubmitProposalRequest struct { - Title string `json:"title"` - Description string `json:"description"` - Type string `json:"type"` - InitialDeposit sdk.DecCoins `json:"initial_deposit"` -} - -type DepositRequest struct { - ProposalId uint64 `json:"proposal_id"` - Amount sdk.DecCoins `json:"amount"` -} - -type VoteRequest struct { - ProposalId uint64 `json:"proposal_id"` - Option string `json:"option"` -} - -type QueryProposalResp struct { - ProposalId uint64 `json:"proposal_id"` - Content Content `json:"content"` - Status string `json:"status"` - FinalTallyResult QueryTallyResultResp `json:"final_tally_result"` - SubmitTime time.Time `json:"submit_time"` - DepositEndTime time.Time `json:"deposit_end_time"` - TotalDeposit sdk.Coins `json:"total_deposit"` - VotingStartTime time.Time `json:"voting_start_time"` - VotingEndTime time.Time `json:"voting_end_time"` -} - -type QueryVoteResp struct { - ProposalId uint64 `json:"proposal_id"` - Voter string `json:"voter"` - Option int32 `json:"option"` -} - -type ( - votingParams struct { - VotingPeriod time.Duration `json:"voting_period"` - } - depositParams struct { - MinDeposit sdk.Coins `json:"min_deposit"` - MaxDepositPeriod time.Duration `json:"max_deposit_period"` - } - tallyParams struct { - Quorum sdk.Dec `json:"quorum"` - Threshold sdk.Dec `json:"threshold"` - VetoThreshold sdk.Dec `json:"veto_threshold"` - } - QueryParamsResp struct { - VotingParams votingParams `json:"voting_params"` - DepositParams depositParams `json:"deposit_params"` - TallyParams tallyParams `json:"tally_params"` - } -) - -type QueryDepositResp struct { - ProposalId uint64 `json:"proposal_id"` - Depositor string `json:"depositor"` - Amount sdk.Coins `json:"amount"` -} - -type QueryTallyResultResp struct { - Yes sdk.Int `json:"yes"` - Abstain sdk.Int `json:"abstain"` - No sdk.Int `json:"no"` - NoWithVeto sdk.Int `json:"no_with_veto"` -} diff --git a/modules/gov/gov.go b/modules/gov/gov.go deleted file mode 100644 index 3fc62656..00000000 --- a/modules/gov/gov.go +++ /dev/null @@ -1,269 +0,0 @@ -package gov - -import ( - "context" - "strconv" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/query" -) - -type govClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { - return govClient{ - BaseClient: baseClient, - Marshaler: marshaler, - } -} - -func (gc govClient) Name() string { - return ModuleName -} - -func (gc govClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (gc govClient) SubmitProposal(request SubmitProposalRequest, baseTx sdk.BaseTx) (uint64, sdk.ResultTx, sdk.Error) { - proposer, err := gc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return 0, sdk.ResultTx{}, sdk.Wrap(err) - } - - deposit, err := gc.ToMinCoin(request.InitialDeposit...) - if err != nil { - return 0, sdk.ResultTx{}, sdk.Wrap(err) - } - - content := ContentFromProposalType(request.Title, request.Description, request.Type) - msg, e := NewMsgSubmitProposal(content, deposit, proposer) - if e != nil { - return 0, sdk.ResultTx{}, sdk.Wrap(err) - } - - result, err := gc.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return 0, sdk.ResultTx{}, sdk.Wrap(err) - } - - proposalIdStr, e := result.Events.GetValue(sdk.EventTypeSubmitProposal, AttributeKeyProposalId) - if e != nil { - return 0, result, sdk.Wrap(e) - } - - proposalId, e := strconv.Atoi(proposalIdStr) - if e != nil { - return 0, result, sdk.Wrap(e) - } - return uint64(proposalId), result, err -} - -func (gc govClient) Deposit(request DepositRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - depositor, err := gc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - amount, err := gc.ToMinCoin(request.Amount...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgDeposit{ - ProposalId: request.ProposalId, - Depositor: depositor.String(), - Amount: amount, - } - return gc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// about VoteRequest.Option see VoteOption_value -func (gc govClient) Vote(request VoteRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - voter, err := gc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - option := VoteOption_value[request.Option] - msg := &MsgVote{ - ProposalId: request.ProposalId, - Voter: voter.String(), - Option: VoteOption(option), - } - return gc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (gc govClient) QueryProposal(proposalId uint64) (QueryProposalResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryProposalResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Proposal( - context.Background(), - &QueryProposalRequest{ - ProposalId: proposalId, - }) - if err != nil { - return QueryProposalResp{}, sdk.Wrap(err) - } - return res.Proposal.Convert().(QueryProposalResp), nil -} - -// if proposalStatus is nil will return all status's proposals -// about proposalStatus see VoteOption_value -func (gc govClient) QueryProposals(proposalStatus string) ([]QueryProposalResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Proposals( - context.Background(), - &QueryProposalsRequest{ - ProposalStatus: ProposalStatus(VoteOption_value[proposalStatus]), - Pagination: &query.PageRequest{ - Offset: 0, - Limit: 100, - CountTotal: true, - }, - }) - if err != nil { - return nil, sdk.Wrap(err) - } - return Proposals(res.Proposals).Convert().([]QueryProposalResp), nil -} - -// about QueryVoteResp.Option see VoteOption_name -func (gc govClient) QueryVote(proposalId uint64, voter string) (QueryVoteResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryVoteResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Vote( - context.Background(), - &QueryVoteRequest{ - ProposalId: proposalId, - Voter: voter, - }) - if err != nil { - return QueryVoteResp{}, sdk.Wrap(err) - } - return res.Vote.Convert().(QueryVoteResp), nil -} - -func (gc govClient) QueryVotes(proposalId uint64) ([]QueryVoteResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Votes( - context.Background(), - &QueryVotesRequest{ - ProposalId: proposalId, - Pagination: &query.PageRequest{ - Offset: 0, - Limit: 100, - CountTotal: true, - }, - }) - if err != nil { - return nil, sdk.Wrap(err) - } - return Votes(res.Votes).Convert().([]QueryVoteResp), nil -} - -// QueryParams params_type("voting", "tallying", "deposit"), if don't pass will return all params_typ res -func (gc govClient) QueryParams(paramsType string) (QueryParamsResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Params( - context.Background(), - &QueryParamsRequest{ - ParamsType: paramsType, - }, - ) - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - return res.Convert().(QueryParamsResp), nil -} - -func (gc govClient) QueryDeposit(proposalId uint64, depositor string) (QueryDepositResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryDepositResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Deposit( - context.Background(), - &QueryDepositRequest{ - ProposalId: proposalId, - Depositor: depositor, - }, - ) - if err != nil { - return QueryDepositResp{}, sdk.Wrap(err) - } - return res.Deposit.Convert().(QueryDepositResp), nil -} - -func (gc govClient) QueryDeposits(proposalId uint64) ([]QueryDepositResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Deposits( - context.Background(), - &QueryDepositsRequest{ - ProposalId: proposalId, - Pagination: &query.PageRequest{ - Offset: 0, - Limit: 100, - CountTotal: true, - }, - }, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return Deposits(res.Deposits).Convert().([]QueryDepositResp), nil -} - -func (gc govClient) QueryTallyResult(proposalId uint64) (QueryTallyResultResp, sdk.Error) { - conn, err := gc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryTallyResultResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).TallyResult( - context.Background(), - &QueryTallyResultRequest{ - ProposalId: proposalId, - }, - ) - if err != nil { - return QueryTallyResultResp{}, sdk.Wrap(err) - } - return res.Tally.Convert().(QueryTallyResultResp), nil -} diff --git a/modules/gov/gov.pb.go b/modules/gov/gov.pb.go deleted file mode 100644 index 86e8209c..00000000 --- a/modules/gov/gov.pb.go +++ /dev/null @@ -1,2569 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta1/gov.proto - -package gov - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" - _ "github.com/golang/protobuf/ptypes/timestamp" - types1 "github.com/irisnet/irishub-sdk-go/codec/types" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - _ "github.com/regen-network/cosmos-proto" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// VoteOption enumerates the valid vote options for a given governance proposal. -type VoteOption int32 - -const ( - // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - OptionEmpty VoteOption = 0 - // VOTE_OPTION_YES defines a yes vote option. - OptionYes VoteOption = 1 - // VOTE_OPTION_ABSTAIN defines an abstain vote option. - OptionAbstain VoteOption = 2 - // VOTE_OPTION_NO defines a no vote option. - OptionNo VoteOption = 3 - // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - OptionNoWithVeto VoteOption = 4 -) - -var VoteOption_name = map[int32]string{ - 0: "VOTE_OPTION_UNSPECIFIED", - 1: "VOTE_OPTION_YES", - 2: "VOTE_OPTION_ABSTAIN", - 3: "VOTE_OPTION_NO", - 4: "VOTE_OPTION_NO_WITH_VETO", -} - -var VoteOption_value = map[string]int32{ - "VOTE_OPTION_UNSPECIFIED": 0, - "VOTE_OPTION_YES": 1, - "VOTE_OPTION_ABSTAIN": 2, - "VOTE_OPTION_NO": 3, - "VOTE_OPTION_NO_WITH_VETO": 4, -} - -func (x VoteOption) String() string { - return proto.EnumName(VoteOption_name, int32(x)) -} - -func (VoteOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{0} -} - -// ProposalStatus enumerates the valid statuses of a proposal. -type ProposalStatus int32 - -const ( - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. - StatusNil ProposalStatus = 0 - // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - // period. - StatusDepositPeriod ProposalStatus = 1 - // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - // period. - StatusVotingPeriod ProposalStatus = 2 - // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - // passed. - StatusPassed ProposalStatus = 3 - // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - // been rejected. - StatusRejected ProposalStatus = 4 - // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - // failed. - StatusFailed ProposalStatus = 5 -) - -var ProposalStatus_name = map[int32]string{ - 0: "PROPOSAL_STATUS_UNSPECIFIED", - 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", - 2: "PROPOSAL_STATUS_VOTING_PERIOD", - 3: "PROPOSAL_STATUS_PASSED", - 4: "PROPOSAL_STATUS_REJECTED", - 5: "PROPOSAL_STATUS_FAILED", -} - -var ProposalStatus_value = map[string]int32{ - "PROPOSAL_STATUS_UNSPECIFIED": 0, - "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, - "PROPOSAL_STATUS_VOTING_PERIOD": 2, - "PROPOSAL_STATUS_PASSED": 3, - "PROPOSAL_STATUS_REJECTED": 4, - "PROPOSAL_STATUS_FAILED": 5, -} - -func (x ProposalStatus) String() string { - return proto.EnumName(ProposalStatus_name, int32(x)) -} - -func (ProposalStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{1} -} - -// TextProposal defines a standard text proposal whose changes need to be -// manually updated in case of approval. -type TextProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` -} - -func (m *TextProposal) Reset() { *m = TextProposal{} } -func (*TextProposal) ProtoMessage() {} -func (*TextProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{0} -} -func (m *TextProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TextProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TextProposal.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 *TextProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_TextProposal.Merge(m, src) -} -func (m *TextProposal) XXX_Size() int { - return m.Size() -} -func (m *TextProposal) XXX_DiscardUnknown() { - xxx_messageInfo_TextProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_TextProposal proto.InternalMessageInfo - -// Deposit defines an amount deposited by an account address to an active -// proposal. -type Deposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` -} - -func (m *Deposit) Reset() { *m = Deposit{} } -func (*Deposit) ProtoMessage() {} -func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{1} -} -func (m *Deposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Deposit.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 *Deposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_Deposit.Merge(m, src) -} -func (m *Deposit) XXX_Size() int { - return m.Size() -} -func (m *Deposit) XXX_DiscardUnknown() { - xxx_messageInfo_Deposit.DiscardUnknown(m) -} - -var xxx_messageInfo_Deposit proto.InternalMessageInfo - -// Proposal defines the core field members of a governance proposal. -type Proposal struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` - Content *types1.Any `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` - Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"status,omitempty" yaml:"proposal_status"` - FinalTallyResult TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result" yaml:"final_tally_result"` - SubmitTime time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"` - DepositEndTime time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time" yaml:"deposit_end_time"` - TotalDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"total_deposit" yaml:"total_deposit"` - VotingStartTime time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time" yaml:"voting_start_time"` - VotingEndTime time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"` -} - -func (m *Proposal) Reset() { *m = Proposal{} } -func (*Proposal) ProtoMessage() {} -func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{2} -} -func (m *Proposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Proposal.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 *Proposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proposal.Merge(m, src) -} -func (m *Proposal) XXX_Size() int { - return m.Size() -} -func (m *Proposal) XXX_DiscardUnknown() { - xxx_messageInfo_Proposal.DiscardUnknown(m) -} - -var xxx_messageInfo_Proposal proto.InternalMessageInfo - -// TallyResult defines a standard tally for a governance proposal. -type TallyResult struct { - Yes github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,1,opt,name=yes,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"yes"` - Abstain github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=abstain,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"abstain"` - No github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=no,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"no"` - NoWithVeto github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=no_with_veto,json=noWithVeto,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"no_with_veto" yaml:"no_with_veto"` -} - -func (m *TallyResult) Reset() { *m = TallyResult{} } -func (*TallyResult) ProtoMessage() {} -func (*TallyResult) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{3} -} -func (m *TallyResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TallyResult.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 *TallyResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_TallyResult.Merge(m, src) -} -func (m *TallyResult) XXX_Size() int { - return m.Size() -} -func (m *TallyResult) XXX_DiscardUnknown() { - xxx_messageInfo_TallyResult.DiscardUnknown(m) -} - -var xxx_messageInfo_TallyResult proto.InternalMessageInfo - -// Vote defines a vote on a governance proposal. -// A Vote consists of a proposal ID, the voter, and the vote option. -type Vote struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` -} - -func (m *Vote) Reset() { *m = Vote{} } -func (*Vote) ProtoMessage() {} -func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{4} -} -func (m *Vote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Vote.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 *Vote) XXX_Merge(src proto.Message) { - xxx_messageInfo_Vote.Merge(m, src) -} -func (m *Vote) XXX_Size() int { - return m.Size() -} -func (m *Vote) XXX_DiscardUnknown() { - xxx_messageInfo_Vote.DiscardUnknown(m) -} - -var xxx_messageInfo_Vote proto.InternalMessageInfo - -// DepositParams defines the params for deposits on governance proposals. -type DepositParams struct { - // Minimum deposit for a proposal to enter voting period. - MinDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"min_deposit,omitempty" yaml:"min_deposit"` - // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - // months. - MaxDepositPeriod time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty" yaml:"max_deposit_period"` -} - -func (m *DepositParams) Reset() { *m = DepositParams{} } -func (*DepositParams) ProtoMessage() {} -func (*DepositParams) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{5} -} -func (m *DepositParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DepositParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DepositParams.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 *DepositParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_DepositParams.Merge(m, src) -} -func (m *DepositParams) XXX_Size() int { - return m.Size() -} -func (m *DepositParams) XXX_DiscardUnknown() { - xxx_messageInfo_DepositParams.DiscardUnknown(m) -} - -var xxx_messageInfo_DepositParams proto.InternalMessageInfo - -// VotingParams defines the params for voting on governance proposals. -type VotingParams struct { - // Length of the voting period. - VotingPeriod time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty" yaml:"voting_period"` -} - -func (m *VotingParams) Reset() { *m = VotingParams{} } -func (*VotingParams) ProtoMessage() {} -func (*VotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{6} -} -func (m *VotingParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VotingParams.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 *VotingParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_VotingParams.Merge(m, src) -} -func (m *VotingParams) XXX_Size() int { - return m.Size() -} -func (m *VotingParams) XXX_DiscardUnknown() { - xxx_messageInfo_VotingParams.DiscardUnknown(m) -} - -var xxx_messageInfo_VotingParams proto.InternalMessageInfo - -// TallyParams defines the params for tallying votes on governance proposals. -type TallyParams struct { - // Minimum percentage of total stake needed to vote for a result to be - // considered valid. - Quorum github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=quorum,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"quorum,omitempty"` - // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - Threshold github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,2,opt,name=threshold,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"threshold,omitempty"` - // Minimum value of Veto votes to Total votes ratio for proposal to be - // vetoed. Default value: 1/3. - VetoThreshold github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"veto_threshold,omitempty" yaml:"veto_threshold"` -} - -func (m *TallyParams) Reset() { *m = TallyParams{} } -func (*TallyParams) ProtoMessage() {} -func (*TallyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_6e82113c1a9a4b7c, []int{7} -} -func (m *TallyParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TallyParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TallyParams.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 *TallyParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_TallyParams.Merge(m, src) -} -func (m *TallyParams) XXX_Size() int { - return m.Size() -} -func (m *TallyParams) XXX_DiscardUnknown() { - xxx_messageInfo_TallyParams.DiscardUnknown(m) -} - -var xxx_messageInfo_TallyParams proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("cosmos.gov.v1beta1.VoteOption", VoteOption_name, VoteOption_value) - proto.RegisterEnum("cosmos.gov.v1beta1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) - proto.RegisterType((*TextProposal)(nil), "cosmos.gov.v1beta1.TextProposal") - proto.RegisterType((*Deposit)(nil), "cosmos.gov.v1beta1.Deposit") - proto.RegisterType((*Proposal)(nil), "cosmos.gov.v1beta1.Proposal") - proto.RegisterType((*TallyResult)(nil), "cosmos.gov.v1beta1.TallyResult") - proto.RegisterType((*Vote)(nil), "cosmos.gov.v1beta1.Vote") - proto.RegisterType((*DepositParams)(nil), "cosmos.gov.v1beta1.DepositParams") - proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1beta1.VotingParams") - proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1beta1.TallyParams") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) } - -var fileDescriptor_6e82113c1a9a4b7c = []byte{ - // 1389 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xbf, 0x6f, 0xdb, 0xd6, - 0x16, 0x16, 0xe5, 0xdf, 0x57, 0xb2, 0xcd, 0x5c, 0x3b, 0xb6, 0xcc, 0x97, 0x47, 0xf2, 0xf1, 0x75, - 0x08, 0xd2, 0x58, 0x6e, 0x9c, 0xfe, 0x40, 0x9d, 0x49, 0xb2, 0x98, 0x54, 0x41, 0x62, 0x09, 0x14, - 0xa3, 0x20, 0xed, 0x40, 0x50, 0xe6, 0x8d, 0xc4, 0x96, 0xe4, 0x55, 0xc5, 0x2b, 0x37, 0x42, 0x97, - 0x8e, 0x81, 0x8a, 0xb6, 0xd9, 0x9a, 0x45, 0x80, 0x81, 0x6e, 0x9d, 0xfb, 0x1f, 0x74, 0x09, 0x8a, - 0x0e, 0x41, 0xd1, 0x21, 0x28, 0x0a, 0xa5, 0x71, 0x80, 0x22, 0xf0, 0xe8, 0xb5, 0x4b, 0x41, 0xde, - 0x4b, 0x8b, 0x92, 0x0c, 0x38, 0xf1, 0x14, 0xf2, 0xdc, 0xf3, 0x7d, 0xdf, 0xb9, 0x1f, 0xcf, 0x39, - 0x8a, 0xc1, 0x85, 0x5d, 0xec, 0xbb, 0xd8, 0xdf, 0xa8, 0xe3, 0xbd, 0x8d, 0xbd, 0x2b, 0x35, 0x44, - 0xcc, 0x2b, 0xc1, 0x73, 0xb6, 0xd9, 0xc2, 0x04, 0x43, 0x48, 0x4f, 0xb3, 0x41, 0x84, 0x9d, 0x0a, - 0x22, 0x43, 0xd4, 0x4c, 0x1f, 0x1d, 0x43, 0x76, 0xb1, 0xed, 0x51, 0x8c, 0xb0, 0x5c, 0xc7, 0x75, - 0x1c, 0x3e, 0x6e, 0x04, 0x4f, 0x2c, 0xba, 0x46, 0x51, 0x06, 0x3d, 0x60, 0xb4, 0xf4, 0x48, 0xaa, - 0x63, 0x5c, 0x77, 0xd0, 0x46, 0xf8, 0x56, 0x6b, 0xdf, 0xdf, 0x20, 0xb6, 0x8b, 0x7c, 0x62, 0xba, - 0xcd, 0x08, 0x3b, 0x9a, 0x60, 0x7a, 0x1d, 0x76, 0x24, 0x8e, 0x1e, 0x59, 0xed, 0x96, 0x49, 0x6c, - 0xcc, 0x8a, 0x51, 0xee, 0x82, 0xb4, 0x8e, 0x1e, 0x90, 0x72, 0x0b, 0x37, 0xb1, 0x6f, 0x3a, 0x70, - 0x19, 0x4c, 0x11, 0x9b, 0x38, 0x28, 0xc3, 0xc9, 0xdc, 0xc5, 0x39, 0x8d, 0xbe, 0x40, 0x19, 0xa4, - 0x2c, 0xe4, 0xef, 0xb6, 0xec, 0x66, 0x00, 0xcd, 0x24, 0xc3, 0xb3, 0x78, 0x68, 0x6b, 0xf1, 0xd5, - 0xbe, 0xc4, 0xfd, 0xf6, 0xd3, 0xfa, 0xcc, 0x36, 0xf6, 0x08, 0xf2, 0x88, 0xf2, 0x3b, 0x07, 0x66, - 0x0a, 0xa8, 0x89, 0x7d, 0x9b, 0xc0, 0x0f, 0x40, 0xaa, 0xc9, 0x04, 0x0c, 0xdb, 0x0a, 0xa9, 0x27, - 0xf3, 0x2b, 0x47, 0x7d, 0x09, 0x76, 0x4c, 0xd7, 0xd9, 0x52, 0x62, 0x87, 0x8a, 0x06, 0xa2, 0xb7, - 0xa2, 0x05, 0x2f, 0x80, 0x39, 0x8b, 0x72, 0xe0, 0x16, 0x53, 0x1d, 0x04, 0x60, 0x03, 0x4c, 0x9b, - 0x2e, 0x6e, 0x7b, 0x24, 0x33, 0x21, 0x4f, 0x5c, 0x4c, 0x6d, 0xae, 0x65, 0x99, 0x6d, 0x81, 0xf3, - 0xd1, 0xe7, 0xc8, 0x6e, 0x63, 0xdb, 0xcb, 0xbf, 0xf7, 0xa4, 0x2f, 0x25, 0x7e, 0x7c, 0x2e, 0xad, - 0xd7, 0x6d, 0xd2, 0x68, 0xd7, 0xb2, 0xbb, 0xd8, 0xdd, 0xb0, 0x5b, 0xb6, 0xef, 0x21, 0x12, 0xfe, - 0xdb, 0x68, 0xd7, 0xd6, 0x7d, 0xeb, 0xb3, 0xf5, 0x3a, 0xde, 0x20, 0x9d, 0x26, 0xf2, 0x43, 0x94, - 0xaf, 0x31, 0xfe, 0xad, 0xd9, 0x87, 0xfb, 0x52, 0xe2, 0xd5, 0xbe, 0x94, 0x50, 0xfe, 0x99, 0x06, - 0xb3, 0xc7, 0x66, 0xbd, 0x7b, 0xd2, 0xbd, 0x96, 0x0e, 0xfb, 0x52, 0xd2, 0xb6, 0x8e, 0xfa, 0xd2, - 0x1c, 0xbd, 0xdd, 0xe8, 0xa5, 0xae, 0x81, 0x99, 0x5d, 0x6a, 0x52, 0x78, 0xa5, 0xd4, 0xe6, 0x72, - 0x96, 0x7e, 0xa4, 0x6c, 0xf4, 0x91, 0xb2, 0x39, 0xaf, 0x93, 0x4f, 0xfd, 0x32, 0x70, 0x53, 0x8b, - 0x10, 0xb0, 0x0a, 0xa6, 0x7d, 0x62, 0x92, 0xb6, 0x9f, 0x99, 0x90, 0xb9, 0x8b, 0x0b, 0x9b, 0x4a, - 0x76, 0xbc, 0x03, 0xb3, 0x51, 0x81, 0x95, 0x30, 0x33, 0x2f, 0x1c, 0xf5, 0xa5, 0x95, 0x11, 0xa7, - 0x29, 0x89, 0xa2, 0x31, 0x36, 0xd8, 0x04, 0xf0, 0xbe, 0xed, 0x99, 0x8e, 0x41, 0x4c, 0xc7, 0xe9, - 0x18, 0x2d, 0xe4, 0xb7, 0x1d, 0x92, 0x99, 0x0c, 0xeb, 0x93, 0x4e, 0xd2, 0xd0, 0x83, 0x3c, 0x2d, - 0x4c, 0xcb, 0xff, 0x2f, 0x70, 0xf7, 0xa8, 0x2f, 0xad, 0x51, 0x91, 0x71, 0x22, 0x45, 0xe3, 0xc3, - 0x60, 0x0c, 0x04, 0x3f, 0x01, 0x29, 0xbf, 0x5d, 0x73, 0x6d, 0x62, 0x04, 0xed, 0x9c, 0x99, 0x0a, - 0xa5, 0x84, 0x31, 0x2b, 0xf4, 0xa8, 0xd7, 0xf3, 0x22, 0x53, 0x61, 0x4d, 0x13, 0x03, 0x2b, 0x8f, - 0x9e, 0x4b, 0x9c, 0x06, 0x68, 0x24, 0x00, 0x40, 0x1b, 0xf0, 0xac, 0x4f, 0x0c, 0xe4, 0x59, 0x54, - 0x61, 0xfa, 0x54, 0x85, 0xff, 0x33, 0x85, 0x55, 0xaa, 0x30, 0xca, 0x40, 0x65, 0x16, 0x58, 0x58, - 0xf5, 0xac, 0x50, 0xea, 0x1b, 0x0e, 0xcc, 0x13, 0x4c, 0x4c, 0xc7, 0x60, 0x07, 0x99, 0x99, 0xd3, - 0xba, 0xf1, 0x36, 0xd3, 0x59, 0xa6, 0x3a, 0x43, 0x68, 0xe5, 0xcd, 0xbb, 0x34, 0x1d, 0x12, 0x44, - 0xc3, 0xe6, 0x80, 0x73, 0x7b, 0x98, 0xd8, 0x5e, 0x3d, 0xf8, 0xc6, 0x2d, 0xe6, 0xee, 0xec, 0xa9, - 0x77, 0x7f, 0x8b, 0xd5, 0x94, 0xa1, 0x35, 0x8d, 0x51, 0xd0, 0xcb, 0x2f, 0xd2, 0x78, 0x25, 0x08, - 0x87, 0xb7, 0xbf, 0x0f, 0x58, 0x68, 0xe0, 0xf3, 0xdc, 0xa9, 0x5a, 0x0a, 0xd3, 0x5a, 0x19, 0xd2, - 0x1a, 0xb6, 0x79, 0x9e, 0x46, 0x99, 0xcb, 0x5b, 0x93, 0xc1, 0x7e, 0x51, 0xfe, 0x4c, 0x82, 0x54, - 0xbc, 0x87, 0x54, 0x30, 0xd1, 0x41, 0x3e, 0xdd, 0x55, 0xf9, 0xab, 0x01, 0xeb, 0x1f, 0x7d, 0xe9, - 0xed, 0xd7, 0x75, 0xaf, 0xe8, 0x11, 0x2d, 0xc0, 0xc3, 0xdb, 0x60, 0xc6, 0xac, 0xf9, 0xc4, 0xb4, - 0xd9, 0x6a, 0x3b, 0x1b, 0x55, 0xc4, 0x01, 0xb7, 0x41, 0xd2, 0xc3, 0xe1, 0x7c, 0x9e, 0x91, 0x29, - 0xe9, 0x61, 0xe8, 0x80, 0xb4, 0x87, 0x8d, 0x2f, 0x6c, 0xd2, 0x30, 0xf6, 0x10, 0xc1, 0xe1, 0x28, - 0xce, 0xe5, 0x6f, 0x9e, 0x81, 0xee, 0xa8, 0x2f, 0x2d, 0x51, 0xa3, 0xe3, 0x84, 0x8a, 0x06, 0x3c, - 0x7c, 0xd7, 0x26, 0x8d, 0x2a, 0x22, 0x98, 0xd9, 0xfb, 0x3d, 0x07, 0x26, 0xab, 0x98, 0xa0, 0xb3, - 0x2f, 0xec, 0x65, 0x30, 0xb5, 0x87, 0x09, 0x8a, 0x96, 0x35, 0x7d, 0x81, 0xef, 0x83, 0x69, 0x4c, - 0x7f, 0x39, 0xe8, 0xd2, 0x12, 0x4f, 0x5a, 0x28, 0x81, 0x70, 0x29, 0xcc, 0xd2, 0x58, 0xf6, 0xd6, - 0xec, 0xe3, 0x68, 0xed, 0xfe, 0x9c, 0x04, 0xf3, 0xac, 0xc1, 0xcb, 0x66, 0xcb, 0x74, 0x7d, 0xb8, - 0xcf, 0x81, 0x94, 0x6b, 0x7b, 0xc7, 0x43, 0xc7, 0x9d, 0x36, 0x74, 0x56, 0x60, 0xdd, 0x61, 0x5f, - 0x3a, 0x1f, 0x43, 0x5d, 0xc6, 0xae, 0x4d, 0x90, 0xdb, 0x24, 0x9d, 0xc1, 0xdd, 0x62, 0xc7, 0x67, - 0x98, 0x45, 0xe0, 0xda, 0x5e, 0x34, 0x89, 0xdf, 0x72, 0x00, 0xba, 0xe6, 0x83, 0x88, 0xcd, 0x68, - 0xa2, 0x96, 0x8d, 0x2d, 0xb6, 0xf4, 0xd7, 0xc6, 0xe6, 0xa3, 0xc0, 0x7e, 0x99, 0xf3, 0x2a, 0xab, - 0xf4, 0xc2, 0x38, 0x78, 0xa8, 0x60, 0xb6, 0x6e, 0xc7, 0xb3, 0x94, 0xc7, 0xc1, 0x04, 0xf1, 0xae, - 0xf9, 0x20, 0xf2, 0x8c, 0x86, 0xbf, 0xe6, 0x40, 0xba, 0x1a, 0x8e, 0x15, 0x33, 0xf1, 0x4b, 0xc0, - 0xc6, 0x2c, 0xaa, 0x8d, 0x3b, 0xad, 0xb6, 0x6b, 0xac, 0xb6, 0xd5, 0x21, 0xdc, 0x50, 0x59, 0xcb, - 0x43, 0x53, 0x1d, 0xaf, 0x28, 0x4d, 0x63, 0xac, 0x9a, 0xc3, 0x68, 0x98, 0x59, 0x31, 0x06, 0x98, - 0xfe, 0xbc, 0x8d, 0x5b, 0x6d, 0x37, 0xac, 0x22, 0x9d, 0xbf, 0xf1, 0xa6, 0xbd, 0x5e, 0x40, 0xbb, - 0x87, 0x7d, 0x89, 0xa7, 0x24, 0x83, 0x92, 0x34, 0x46, 0x0b, 0x1b, 0x60, 0x8e, 0x34, 0x5a, 0xc8, - 0x6f, 0x60, 0x87, 0x7e, 0x85, 0xf4, 0x9b, 0xcf, 0x13, 0xd5, 0x58, 0x3a, 0xe6, 0x89, 0xc9, 0x0c, - 0xc8, 0xe1, 0x77, 0x1c, 0x58, 0x08, 0x86, 0xcc, 0x18, 0xe8, 0x4d, 0x84, 0x7a, 0x8d, 0xb3, 0xe9, - 0x65, 0x86, 0xc9, 0x86, 0xec, 0x3e, 0xcf, 0xec, 0x1e, 0xca, 0x50, 0xb4, 0xf9, 0x20, 0xa0, 0x47, - 0xef, 0x97, 0xfe, 0xe6, 0x00, 0x18, 0x4c, 0x18, 0xbc, 0x0c, 0x56, 0xab, 0x25, 0x5d, 0x35, 0x4a, - 0x65, 0xbd, 0x58, 0xda, 0x31, 0xee, 0xec, 0x54, 0xca, 0xea, 0x76, 0xf1, 0x7a, 0x51, 0x2d, 0xf0, - 0x09, 0x61, 0xb1, 0xdb, 0x93, 0x53, 0x34, 0x51, 0x0d, 0x44, 0xa0, 0x02, 0x16, 0xe3, 0xd9, 0xf7, - 0xd4, 0x0a, 0xcf, 0x09, 0xf3, 0xdd, 0x9e, 0x3c, 0x47, 0xb3, 0xee, 0x21, 0x1f, 0x5e, 0x02, 0x4b, - 0xf1, 0x9c, 0x5c, 0xbe, 0xa2, 0xe7, 0x8a, 0x3b, 0x7c, 0x52, 0x38, 0xd7, 0xed, 0xc9, 0xf3, 0x34, - 0x2f, 0xc7, 0x16, 0xa4, 0x0c, 0x16, 0xe2, 0xb9, 0x3b, 0x25, 0x7e, 0x42, 0x48, 0x77, 0x7b, 0xf2, - 0x2c, 0x4d, 0xdb, 0xc1, 0x70, 0x13, 0x64, 0x86, 0x33, 0x8c, 0xbb, 0x45, 0xfd, 0x23, 0xa3, 0xaa, - 0xea, 0x25, 0x7e, 0x52, 0x58, 0xee, 0xf6, 0x64, 0x3e, 0xca, 0x8d, 0x76, 0x98, 0x30, 0xf9, 0xf0, - 0x07, 0x31, 0x71, 0xe9, 0xd7, 0x24, 0x58, 0x18, 0xfe, 0xff, 0x0f, 0xcc, 0x82, 0xff, 0x94, 0xb5, - 0x52, 0xb9, 0x54, 0xc9, 0xdd, 0x32, 0x2a, 0x7a, 0x4e, 0xbf, 0x53, 0x19, 0xb9, 0x70, 0x78, 0x15, - 0x9a, 0xbc, 0x63, 0x3b, 0xf0, 0x1a, 0x10, 0x47, 0xf3, 0x0b, 0x6a, 0xb9, 0x54, 0x29, 0xea, 0x46, - 0x59, 0xd5, 0x8a, 0xa5, 0x02, 0xcf, 0x09, 0xab, 0xdd, 0x9e, 0xbc, 0x44, 0x21, 0x43, 0x33, 0x06, - 0x3f, 0x04, 0xff, 0x1d, 0x05, 0x57, 0x4b, 0x7a, 0x71, 0xe7, 0x46, 0x84, 0x4d, 0x0a, 0x2b, 0xdd, - 0x9e, 0x0c, 0x29, 0xb6, 0x1a, 0x1b, 0x08, 0x78, 0x19, 0xac, 0x8c, 0x42, 0xcb, 0xb9, 0x4a, 0x45, - 0x2d, 0xf0, 0x13, 0x02, 0xdf, 0xed, 0xc9, 0x69, 0x8a, 0x29, 0x9b, 0xbe, 0x8f, 0x2c, 0xf8, 0x0e, - 0xc8, 0x8c, 0x66, 0x6b, 0xea, 0x4d, 0x75, 0x5b, 0x57, 0x0b, 0xfc, 0xa4, 0x00, 0xbb, 0x3d, 0x79, - 0x81, 0xe6, 0x6b, 0xe8, 0x53, 0xb4, 0x4b, 0xd0, 0x89, 0xfc, 0xd7, 0x73, 0xc5, 0x5b, 0x6a, 0x81, - 0x9f, 0x8a, 0xf3, 0x5f, 0x37, 0x6d, 0x07, 0x59, 0xd4, 0xce, 0x7c, 0xe5, 0xc9, 0x0b, 0x31, 0xf1, - 0xec, 0x85, 0x98, 0xf8, 0xea, 0x40, 0x4c, 0x3c, 0x39, 0x10, 0xb9, 0xa7, 0x07, 0x22, 0xf7, 0xd7, - 0x81, 0xc8, 0x3d, 0x7a, 0x29, 0x26, 0x9e, 0xbe, 0x14, 0x13, 0xcf, 0x5e, 0x8a, 0x89, 0x8f, 0x5f, - 0x63, 0x49, 0xba, 0xd8, 0x6a, 0x3b, 0x28, 0xfc, 0x3b, 0xaa, 0x36, 0x1d, 0xee, 0x95, 0xab, 0xff, - 0x06, 0x00, 0x00, 0xff, 0xff, 0x5b, 0x5b, 0xda, 0x9c, 0x5c, 0x0d, 0x00, 0x00, -} - -func (this *TextProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*TextProposal) - if !ok { - that2, ok := that.(TextProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Title != that1.Title { - return false - } - if this.Description != that1.Description { - return false - } - return true -} -func (this *Proposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Proposal) - if !ok { - that2, ok := that.(Proposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ProposalId != that1.ProposalId { - return false - } - if !this.Content.Equal(that1.Content) { - return false - } - if this.Status != that1.Status { - return false - } - if !this.FinalTallyResult.Equal(&that1.FinalTallyResult) { - return false - } - if !this.SubmitTime.Equal(that1.SubmitTime) { - return false - } - if !this.DepositEndTime.Equal(that1.DepositEndTime) { - return false - } - if len(this.TotalDeposit) != len(that1.TotalDeposit) { - return false - } - for i := range this.TotalDeposit { - if !this.TotalDeposit[i].Equal(&that1.TotalDeposit[i]) { - return false - } - } - if !this.VotingStartTime.Equal(that1.VotingStartTime) { - return false - } - if !this.VotingEndTime.Equal(that1.VotingEndTime) { - return false - } - return true -} -func (this *TallyResult) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*TallyResult) - if !ok { - that2, ok := that.(TallyResult) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Yes.Equal(that1.Yes) { - return false - } - if !this.Abstain.Equal(that1.Abstain) { - return false - } - if !this.No.Equal(that1.No) { - return false - } - if !this.NoWithVeto.Equal(that1.NoWithVeto) { - return false - } - return true -} -func (m *TextProposal) 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 *TextProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TextProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGov(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Deposit) 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 *Deposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintGov(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Proposal) 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 *Proposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintGov(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x4a - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.VotingStartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintGov(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x42 - if len(m.TotalDeposit) > 0 { - for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TotalDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DepositEndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGov(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x32 - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SubmitTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintGov(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x2a - { - size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if m.Status != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x18 - } - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *TallyResult) 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 *TallyResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.NoWithVeto.Size() - i -= size - if _, err := m.NoWithVeto.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.No.Size() - i -= size - if _, err := m.No.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Abstain.Size() - i -= size - if _, err := m.Abstain.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Yes.Size() - i -= size - if _, err := m.Yes.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Vote) 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 *Vote) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Option != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Option)) - i-- - dAtA[i] = 0x18 - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintGov(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DepositParams) 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 *DepositParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxDepositPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintGov(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0x12 - if len(m.MinDeposit) > 0 { - for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *VotingParams) 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 *VotingParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintGov(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *TallyParams) 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 *TallyParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.VetoThreshold.Size() - i -= size - if _, err := m.VetoThreshold.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.Threshold.Size() - i -= size - if _, err := m.Threshold.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Quorum.Size() - i -= size - if _, err := m.Quorum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGov(dAtA []byte, offset int, v uint64) int { - offset -= sovGov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *TextProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *Deposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - return n -} - -func (m *Proposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovGov(uint64(l)) - } - if m.Status != 0 { - n += 1 + sovGov(uint64(m.Status)) - } - l = m.FinalTallyResult.Size() - n += 1 + l + sovGov(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.SubmitTime) - n += 1 + l + sovGov(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.DepositEndTime) - n += 1 + l + sovGov(uint64(l)) - if len(m.TotalDeposit) > 0 { - for _, e := range m.TotalDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingStartTime) - n += 1 + l + sovGov(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.VotingEndTime) - n += 1 + l + sovGov(uint64(l)) - return n -} - -func (m *TallyResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Yes.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.Abstain.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.No.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.NoWithVeto.Size() - n += 1 + l + sovGov(uint64(l)) - return n -} - -func (m *Vote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if m.Option != 0 { - n += 1 + sovGov(uint64(m.Option)) - } - return n -} - -func (m *DepositParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxDepositPeriod) - n += 1 + l + sovGov(uint64(l)) - return n -} - -func (m *VotingParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod) - n += 1 + l + sovGov(uint64(l)) - return n -} - -func (m *TallyParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Quorum.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.Threshold.Size() - n += 1 + l + sovGov(uint64(l)) - l = m.VetoThreshold.Size() - n += 1 + l + sovGov(uint64(l)) - return n -} - -func sovGov(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGov(x uint64) (n int) { - return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *TextProposal) 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 ErrIntOverflowGov - } - 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: TextProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TextProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Deposit) 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 ErrIntOverflowGov - } - 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: Deposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Proposal) 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 ErrIntOverflowGov - } - 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: Proposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Content == nil { - m.Content = &types1.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - 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 ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= ProposalStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) - if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TallyResult) 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 ErrIntOverflowGov - } - 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: TallyResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Yes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Yes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Abstain", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Abstain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field No", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.No.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NoWithVeto", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NoWithVeto.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Vote) 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 ErrIntOverflowGov - } - 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: Vote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - 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 ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DepositParams) 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 ErrIntOverflowGov - } - 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: DepositParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DepositParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinDeposit = append(m.MinDeposit, types.Coin{}) - if err := m.MinDeposit[len(m.MinDeposit)-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 MaxDepositPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VotingParams) 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 ErrIntOverflowGov - } - 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: VotingParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VotingParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TallyParams) 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 ErrIntOverflowGov - } - 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: TallyParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TallyParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Quorum.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Threshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.VetoThreshold.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGov(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, ErrIntOverflowGov - } - 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, ErrIntOverflowGov - } - 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, ErrIntOverflowGov - } - 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, ErrInvalidLengthGov - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGov - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGov - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/gov/params.go b/modules/gov/params.go deleted file mode 100644 index 01c582a6..00000000 --- a/modules/gov/params.go +++ /dev/null @@ -1,33 +0,0 @@ -package gov - -import yaml "gopkg.in/yaml.v2" - -func (d Deposit) String() string { - out, _ := yaml.Marshal(d) - return string(out) -} - -func (tr TallyResult) String() string { - out, _ := yaml.Marshal(tr) - return string(out) -} - -func (v Vote) String() string { - out, _ := yaml.Marshal(v) - return string(out) -} - -func (dp DepositParams) String() string { - out, _ := yaml.Marshal(dp) - return string(out) -} - -func (vp VotingParams) String() string { - out, _ := yaml.Marshal(vp) - return string(out) -} - -func (tp TallyParams) String() string { - out, _ := yaml.Marshal(tp) - return string(out) -} diff --git a/modules/gov/proposal.go b/modules/gov/proposal.go deleted file mode 100644 index ef948d72..00000000 --- a/modules/gov/proposal.go +++ /dev/null @@ -1,281 +0,0 @@ -package gov - -import ( - "fmt" - "strings" - "time" - - "github.com/gogo/protobuf/proto" - yaml "gopkg.in/yaml.v2" - - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// DefaultStartingProposalID is 1 -const DefaultStartingProposalID uint64 = 1 - -// NewProposal creates a new Proposal instance -func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) (Proposal, error) { - p := Proposal{ - ProposalId: id, - Status: StatusDepositPeriod, - FinalTallyResult: TallyResult{ - Yes: sdk.ZeroInt(), - Abstain: sdk.ZeroInt(), - No: sdk.ZeroInt(), - NoWithVeto: sdk.ZeroInt(), - }, - TotalDeposit: sdk.NewCoins(), - SubmitTime: submitTime, - DepositEndTime: depositEndTime, - } - - msg, ok := content.(proto.Message) - if !ok { - return Proposal{}, fmt.Errorf("%T does not implement proto.Message", content) - } - - any, err := types.NewAnyWithValue(msg) - if err != nil { - return Proposal{}, err - } - - p.Content = any - - return p, nil -} - -// String implements stringer interface -func (p Proposal) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// GetContent returns the proposal Content -func (p Proposal) GetContent() Content { - content, ok := p.Content.GetCachedValue().(Content) - if !ok { - return nil - } - return content -} - -func (p Proposal) ProposalType() string { - content := p.GetContent() - if content == nil { - return "" - } - return content.ProposalType() -} - -func (p Proposal) ProposalRoute() string { - content := p.GetContent() - if content == nil { - return "" - } - return content.ProposalRoute() -} - -func (p Proposal) GetTitle() string { - content := p.GetContent() - if content == nil { - return "" - } - return content.GetTitle() -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { - var content Content - return unpacker.UnpackAny(p.Content, &content) -} - -var _ types.UnpackInterfacesMessage = Proposals{} - -// Equal returns true if two slices (order-dependant) of proposals are equal. -func (p Proposals) Equal(other Proposals) bool { - if len(p) != len(other) { - return false - } - - for i, proposal := range p { - if !proposal.Equal(other[i]) { - return false - } - } - - return true -} - -// String implements stringer interface -func (p Proposals) String() string { - out := "ID - (Status) [Type] Title\n" - for _, prop := range p { - out += fmt.Sprintf("%d - (%s) [%s] %s\n", - prop.ProposalId, prop.Status, - prop.ProposalType(), prop.GetTitle()) - } - return strings.TrimSpace(out) -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (p Proposals) UnpackInterfaces(unpacker types.AnyUnpacker) error { - for _, x := range p { - err := x.UnpackInterfaces(unpacker) - if err != nil { - return err - } - } - return nil -} - -type ( - // ProposalQueue defines a queue for proposal ids - ProposalQueue []uint64 -) - -// ProposalStatusFromString turns a string into a ProposalStatus -func ProposalStatusFromString(str string) (ProposalStatus, error) { - num, ok := ProposalStatus_value[str] - if !ok { - return StatusNil, fmt.Errorf("'%s' is not a valid proposal status", str) - } - return ProposalStatus(num), nil -} - -// ValidProposalStatus returns true if the proposal status is valid and false -// otherwise. -func ValidProposalStatus(status ProposalStatus) bool { - if status == StatusDepositPeriod || - status == StatusVotingPeriod || - status == StatusPassed || - status == StatusRejected || - status == StatusFailed { - return true - } - return false -} - -// Marshal needed for protobuf compatibility -func (status ProposalStatus) Marshal() ([]byte, error) { - return []byte{byte(status)}, nil -} - -// Unmarshal needed for protobuf compatibility -func (status *ProposalStatus) Unmarshal(data []byte) error { - *status = ProposalStatus(data[0]) - return nil -} - -// Format implements the fmt.Formatter interface. -// nolint: errcheck -func (status ProposalStatus) Format(s fmt.State, verb rune) { - switch verb { - case 's': - s.Write([]byte(status.String())) - default: - // TODO: Do this conversion more directly - s.Write([]byte(fmt.Sprintf("%v", byte(status)))) - } -} - -// Proposal types -const ( - ProposalTypeText string = "Text" -) - -// Implements Content Interface -var _ Content = &TextProposal{} - -// NewTextProposal creates a text proposal Content -func NewTextProposal(title, description string) Content { - return &TextProposal{title, description} -} - -// GetTitle returns the proposal title -func (tp *TextProposal) GetTitle() string { return tp.Title } - -// GetDescription returns the proposal description -func (tp *TextProposal) GetDescription() string { return tp.Description } - -// ProposalRoute returns the proposal router key -func (tp *TextProposal) ProposalRoute() string { return ModuleName } - -// ProposalType is "Text" -func (tp *TextProposal) ProposalType() string { return ProposalTypeText } - -// ValidateBasic validates the content's title and description of the proposal -func (tp *TextProposal) ValidateBasic() error { - title := tp.GetTitle() - if len(strings.TrimSpace(title)) == 0 { - return sdk.Wrapf("proposal title cannot be blank") - } - if len(title) > MaxTitleLength { - return sdk.Wrapf("proposal title is longer than max length of %d", MaxTitleLength) - } - - description := tp.GetDescription() - if len(description) == 0 { - return sdk.Wrapf("proposal description cannot be blank") - } - if len(description) > MaxDescriptionLength { - return sdk.Wrapf("proposal description is longer than max length of %d", MaxDescriptionLength) - } - return nil -} - -// String implements Stringer interface -func (tp TextProposal) String() string { - out, _ := yaml.Marshal(tp) - return string(out) -} - -var validProposalTypes = map[string]struct{}{ - ProposalTypeText: {}, -} - -// RegisterProposalType registers a proposal type. It will panic if the type is -// already registered. -func RegisterProposalType(ty string) { - if _, ok := validProposalTypes[ty]; ok { - panic(fmt.Sprintf("already registered proposal type: %s", ty)) - } - - validProposalTypes[ty] = struct{}{} -} - -// ContentFromProposalType returns a Content object based on the proposal type. -func ContentFromProposalType(title, desc, ty string) Content { - switch ty { - case ProposalTypeText: - return NewTextProposal(title, desc) - - default: - return nil - } -} - -// IsValidProposalType returns a boolean determining if the proposal type is -// valid. -// -// NOTE: Modules with their own proposal types must register them. -func IsValidProposalType(ty string) bool { - _, ok := validProposalTypes[ty] - return ok -} - -// ProposalHandler implements the Handler interface for governance module-based -// proposals (ie. TextProposal ). Since these are -// merely signaling mechanisms at the moment and do not affect state, it -// performs a no-op. -//func ProposalHandler(_ sdk.Context, c Content) error { -// switch c.ProposalType() { -// case ProposalTypeText: -// // both proposal types do not change state so this performs a no-op -// return nil -// -// default: -// return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized gov proposal type: %s", c.ProposalType()) -// } -//} diff --git a/modules/gov/query.pb.go b/modules/gov/query.pb.go deleted file mode 100644 index 7a319943..00000000 --- a/modules/gov/query.pb.go +++ /dev/null @@ -1,3859 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta1/query.proto - -package gov - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - query "github.com/irisnet/irishub-sdk-go/types/query" - _ "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 - -// QueryProposalRequest is the request type for the Query/Proposal RPC method. -type QueryProposalRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` -} - -func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } -func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } -func (*QueryProposalRequest) ProtoMessage() {} -func (*QueryProposalRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{0} -} -func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalRequest.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 *QueryProposalRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalRequest.Merge(m, src) -} -func (m *QueryProposalRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo - -func (m *QueryProposalRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -// QueryProposalResponse is the response type for the Query/Proposal RPC method. -type QueryProposalResponse struct { - Proposal Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal"` -} - -func (m *QueryProposalResponse) Reset() { *m = QueryProposalResponse{} } -func (m *QueryProposalResponse) String() string { return proto.CompactTextString(m) } -func (*QueryProposalResponse) ProtoMessage() {} -func (*QueryProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{1} -} -func (m *QueryProposalResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalResponse.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 *QueryProposalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalResponse.Merge(m, src) -} -func (m *QueryProposalResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalResponse proto.InternalMessageInfo - -func (m *QueryProposalResponse) GetProposal() Proposal { - if m != nil { - return m.Proposal - } - return Proposal{} -} - -// QueryProposalsRequest is the request type for the Query/Proposals RPC method. -type QueryProposalsRequest struct { - // proposal_status defines the status of the proposals. - ProposalStatus ProposalStatus `protobuf:"varint,1,opt,name=proposal_status,json=proposalStatus,proto3,enum=cosmos.gov.v1beta1.ProposalStatus" json:"proposal_status,omitempty"` - // voter defines the voter address for the proposals. - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - // depositor defines the deposit addresses from the proposals. - Depositor string `protobuf:"bytes,3,opt,name=depositor,proto3" json:"depositor,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryProposalsRequest) Reset() { *m = QueryProposalsRequest{} } -func (m *QueryProposalsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryProposalsRequest) ProtoMessage() {} -func (*QueryProposalsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{2} -} -func (m *QueryProposalsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalsRequest.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 *QueryProposalsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalsRequest.Merge(m, src) -} -func (m *QueryProposalsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalsRequest proto.InternalMessageInfo - -// QueryProposalsResponse is the response type for the Query/Proposals RPC -// method. -type QueryProposalsResponse struct { - Proposals []Proposal `protobuf:"bytes,1,rep,name=proposals,proto3" json:"proposals"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryProposalsResponse) Reset() { *m = QueryProposalsResponse{} } -func (m *QueryProposalsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryProposalsResponse) ProtoMessage() {} -func (*QueryProposalsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{3} -} -func (m *QueryProposalsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryProposalsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryProposalsResponse.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 *QueryProposalsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryProposalsResponse.Merge(m, src) -} -func (m *QueryProposalsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryProposalsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryProposalsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryProposalsResponse proto.InternalMessageInfo - -func (m *QueryProposalsResponse) GetProposals() []Proposal { - if m != nil { - return m.Proposals - } - return nil -} - -func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryVoteRequest is the request type for the Query/Vote RPC method. -type QueryVoteRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // voter defines the oter address for the proposals. - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` -} - -func (m *QueryVoteRequest) Reset() { *m = QueryVoteRequest{} } -func (m *QueryVoteRequest) String() string { return proto.CompactTextString(m) } -func (*QueryVoteRequest) ProtoMessage() {} -func (*QueryVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{4} -} -func (m *QueryVoteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVoteRequest.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 *QueryVoteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVoteRequest.Merge(m, src) -} -func (m *QueryVoteRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryVoteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVoteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVoteRequest proto.InternalMessageInfo - -// QueryVoteResponse is the response type for the Query/Vote RPC method. -type QueryVoteResponse struct { - // vote defined the queried vote. - Vote Vote `protobuf:"bytes,1,opt,name=vote,proto3" json:"vote"` -} - -func (m *QueryVoteResponse) Reset() { *m = QueryVoteResponse{} } -func (m *QueryVoteResponse) String() string { return proto.CompactTextString(m) } -func (*QueryVoteResponse) ProtoMessage() {} -func (*QueryVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{5} -} -func (m *QueryVoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVoteResponse.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 *QueryVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVoteResponse.Merge(m, src) -} -func (m *QueryVoteResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVoteResponse proto.InternalMessageInfo - -func (m *QueryVoteResponse) GetVote() Vote { - if m != nil { - return m.Vote - } - return Vote{} -} - -// QueryVotesRequest is the request type for the Query/Votes RPC method. -type QueryVotesRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryVotesRequest) Reset() { *m = QueryVotesRequest{} } -func (m *QueryVotesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryVotesRequest) ProtoMessage() {} -func (*QueryVotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{6} -} -func (m *QueryVotesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVotesRequest.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 *QueryVotesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVotesRequest.Merge(m, src) -} -func (m *QueryVotesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryVotesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVotesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVotesRequest proto.InternalMessageInfo - -func (m *QueryVotesRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *QueryVotesRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryVotesResponse is the response type for the Query/Votes RPC method. -type QueryVotesResponse struct { - // votes defined the queried votes. - Votes []Vote `protobuf:"bytes,1,rep,name=votes,proto3" json:"votes"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryVotesResponse) Reset() { *m = QueryVotesResponse{} } -func (m *QueryVotesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryVotesResponse) ProtoMessage() {} -func (*QueryVotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{7} -} -func (m *QueryVotesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryVotesResponse.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 *QueryVotesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryVotesResponse.Merge(m, src) -} -func (m *QueryVotesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryVotesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryVotesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryVotesResponse proto.InternalMessageInfo - -func (m *QueryVotesResponse) GetVotes() []Vote { - if m != nil { - return m.Votes - } - return nil -} - -func (m *QueryVotesResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { - // params_type defines which parameters to query for, can be one of "voting", - // "tallying" or "deposit". - ParamsType string `protobuf:"bytes,1,opt,name=params_type,json=paramsType,proto3" json:"params_type,omitempty"` -} - -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_e35c0d133e91c0a2, []int{8} -} -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 - -func (m *QueryParamsRequest) GetParamsType() string { - if m != nil { - return m.ParamsType - } - return "" -} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // voting_params defines the parameters related to voting. - VotingParams VotingParams `protobuf:"bytes,1,opt,name=voting_params,json=votingParams,proto3" json:"voting_params"` - // deposit_params defines the parameters related to deposit. - DepositParams DepositParams `protobuf:"bytes,2,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params"` - // tally_params defines the parameters related to tally. - TallyParams TallyParams `protobuf:"bytes,3,opt,name=tally_params,json=tallyParams,proto3" json:"tally_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_e35c0d133e91c0a2, []int{9} -} -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) GetVotingParams() VotingParams { - if m != nil { - return m.VotingParams - } - return VotingParams{} -} - -func (m *QueryParamsResponse) GetDepositParams() DepositParams { - if m != nil { - return m.DepositParams - } - return DepositParams{} -} - -func (m *QueryParamsResponse) GetTallyParams() TallyParams { - if m != nil { - return m.TallyParams - } - return TallyParams{} -} - -// QueryDepositRequest is the request type for the Query/Deposit RPC method. -type QueryDepositRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // depositor defines the deposit addresses from the proposals. - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` -} - -func (m *QueryDepositRequest) Reset() { *m = QueryDepositRequest{} } -func (m *QueryDepositRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDepositRequest) ProtoMessage() {} -func (*QueryDepositRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{10} -} -func (m *QueryDepositRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositRequest.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 *QueryDepositRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositRequest.Merge(m, src) -} -func (m *QueryDepositRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositRequest proto.InternalMessageInfo - -// QueryDepositResponse is the response type for the Query/Deposit RPC method. -type QueryDepositResponse struct { - // deposit defines the requested deposit. - Deposit Deposit `protobuf:"bytes,1,opt,name=deposit,proto3" json:"deposit"` -} - -func (m *QueryDepositResponse) Reset() { *m = QueryDepositResponse{} } -func (m *QueryDepositResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDepositResponse) ProtoMessage() {} -func (*QueryDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{11} -} -func (m *QueryDepositResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositResponse.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 *QueryDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositResponse.Merge(m, src) -} -func (m *QueryDepositResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositResponse proto.InternalMessageInfo - -func (m *QueryDepositResponse) GetDeposit() Deposit { - if m != nil { - return m.Deposit - } - return Deposit{} -} - -// QueryDepositsRequest is the request type for the Query/Deposits RPC method. -type QueryDepositsRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDepositsRequest) Reset() { *m = QueryDepositsRequest{} } -func (m *QueryDepositsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDepositsRequest) ProtoMessage() {} -func (*QueryDepositsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{12} -} -func (m *QueryDepositsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositsRequest.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 *QueryDepositsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositsRequest.Merge(m, src) -} -func (m *QueryDepositsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositsRequest proto.InternalMessageInfo - -func (m *QueryDepositsRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *QueryDepositsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryDepositsResponse is the response type for the Query/Deposits RPC method. -type QueryDepositsResponse struct { - Deposits []Deposit `protobuf:"bytes,1,rep,name=deposits,proto3" json:"deposits"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDepositsResponse) Reset() { *m = QueryDepositsResponse{} } -func (m *QueryDepositsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDepositsResponse) ProtoMessage() {} -func (*QueryDepositsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{13} -} -func (m *QueryDepositsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDepositsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDepositsResponse.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 *QueryDepositsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDepositsResponse.Merge(m, src) -} -func (m *QueryDepositsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDepositsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDepositsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDepositsResponse proto.InternalMessageInfo - -func (m *QueryDepositsResponse) GetDeposits() []Deposit { - if m != nil { - return m.Deposits - } - return nil -} - -func (m *QueryDepositsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryTallyResultRequest is the request type for the Query/Tally RPC method. -type QueryTallyResultRequest struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` -} - -func (m *QueryTallyResultRequest) Reset() { *m = QueryTallyResultRequest{} } -func (m *QueryTallyResultRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTallyResultRequest) ProtoMessage() {} -func (*QueryTallyResultRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{14} -} -func (m *QueryTallyResultRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTallyResultRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTallyResultRequest.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 *QueryTallyResultRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTallyResultRequest.Merge(m, src) -} -func (m *QueryTallyResultRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryTallyResultRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTallyResultRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTallyResultRequest proto.InternalMessageInfo - -func (m *QueryTallyResultRequest) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -// QueryTallyResultResponse is the response type for the Query/Tally RPC method. -type QueryTallyResultResponse struct { - // tally defines the requested tally. - Tally TallyResult `protobuf:"bytes,1,opt,name=tally,proto3" json:"tally"` -} - -func (m *QueryTallyResultResponse) Reset() { *m = QueryTallyResultResponse{} } -func (m *QueryTallyResultResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTallyResultResponse) ProtoMessage() {} -func (*QueryTallyResultResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e35c0d133e91c0a2, []int{15} -} -func (m *QueryTallyResultResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTallyResultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTallyResultResponse.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 *QueryTallyResultResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTallyResultResponse.Merge(m, src) -} -func (m *QueryTallyResultResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTallyResultResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTallyResultResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTallyResultResponse proto.InternalMessageInfo - -func (m *QueryTallyResultResponse) GetTally() TallyResult { - if m != nil { - return m.Tally - } - return TallyResult{} -} - -func init() { - proto.RegisterType((*QueryProposalRequest)(nil), "cosmos.gov.v1beta1.QueryProposalRequest") - proto.RegisterType((*QueryProposalResponse)(nil), "cosmos.gov.v1beta1.QueryProposalResponse") - proto.RegisterType((*QueryProposalsRequest)(nil), "cosmos.gov.v1beta1.QueryProposalsRequest") - proto.RegisterType((*QueryProposalsResponse)(nil), "cosmos.gov.v1beta1.QueryProposalsResponse") - proto.RegisterType((*QueryVoteRequest)(nil), "cosmos.gov.v1beta1.QueryVoteRequest") - proto.RegisterType((*QueryVoteResponse)(nil), "cosmos.gov.v1beta1.QueryVoteResponse") - proto.RegisterType((*QueryVotesRequest)(nil), "cosmos.gov.v1beta1.QueryVotesRequest") - proto.RegisterType((*QueryVotesResponse)(nil), "cosmos.gov.v1beta1.QueryVotesResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.gov.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.gov.v1beta1.QueryParamsResponse") - proto.RegisterType((*QueryDepositRequest)(nil), "cosmos.gov.v1beta1.QueryDepositRequest") - proto.RegisterType((*QueryDepositResponse)(nil), "cosmos.gov.v1beta1.QueryDepositResponse") - proto.RegisterType((*QueryDepositsRequest)(nil), "cosmos.gov.v1beta1.QueryDepositsRequest") - proto.RegisterType((*QueryDepositsResponse)(nil), "cosmos.gov.v1beta1.QueryDepositsResponse") - proto.RegisterType((*QueryTallyResultRequest)(nil), "cosmos.gov.v1beta1.QueryTallyResultRequest") - proto.RegisterType((*QueryTallyResultResponse)(nil), "cosmos.gov.v1beta1.QueryTallyResultResponse") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta1/query.proto", fileDescriptor_e35c0d133e91c0a2) } - -var fileDescriptor_e35c0d133e91c0a2 = []byte{ - // 973 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x24, 0x4e, 0x6b, 0xbf, 0xb4, 0x01, 0x1e, 0x01, 0xac, 0x25, 0xd8, 0x61, 0x45, 0x5b, - 0x93, 0x12, 0x2f, 0x49, 0x0a, 0xa8, 0x2d, 0xa0, 0x12, 0xa1, 0xa6, 0xa8, 0x12, 0x2a, 0x4e, 0x05, - 0x12, 0x07, 0xa2, 0x75, 0xbd, 0xda, 0xae, 0x70, 0x76, 0xb6, 0x9e, 0xb1, 0xa5, 0x28, 0x44, 0x48, - 0x9c, 0x40, 0x5c, 0x40, 0x45, 0xdc, 0x10, 0x95, 0x2a, 0xf1, 0x5b, 0x7a, 0xac, 0x04, 0x07, 0x4e, - 0x08, 0x25, 0x1c, 0x10, 0xbf, 0x81, 0x03, 0xda, 0xd9, 0x37, 0xeb, 0x5d, 0x67, 0x9d, 0xdd, 0x94, - 0xaa, 0xa7, 0xd8, 0x33, 0xdf, 0x7b, 0xef, 0xfb, 0xde, 0x9b, 0xf9, 0x26, 0x86, 0xfa, 0x2d, 0x2e, - 0xb6, 0xb9, 0xb0, 0x5c, 0x3e, 0xb4, 0x86, 0x2b, 0x1d, 0x47, 0xda, 0x2b, 0xd6, 0x9d, 0x81, 0xd3, - 0xdf, 0x69, 0x05, 0x7d, 0x2e, 0x39, 0x62, 0xb4, 0xdf, 0x72, 0xf9, 0xb0, 0x45, 0xfb, 0xc6, 0x12, - 0xc5, 0x74, 0x6c, 0xe1, 0x44, 0xe0, 0x38, 0x34, 0xb0, 0x5d, 0xcf, 0xb7, 0xa5, 0xc7, 0xfd, 0x28, - 0xde, 0x98, 0x77, 0xb9, 0xcb, 0xd5, 0x47, 0x2b, 0xfc, 0x44, 0xab, 0x0b, 0x2e, 0xe7, 0x6e, 0xcf, - 0xb1, 0xec, 0xc0, 0xb3, 0x6c, 0xdf, 0xe7, 0x52, 0x85, 0x08, 0xbd, 0x9b, 0xc1, 0x29, 0xac, 0xaf, - 0x76, 0xcd, 0xb7, 0x60, 0xfe, 0xa3, 0xb0, 0xe6, 0x8d, 0x3e, 0x0f, 0xb8, 0xb0, 0x7b, 0x6d, 0xe7, - 0xce, 0xc0, 0x11, 0x12, 0x1b, 0x30, 0x1b, 0xd0, 0xd2, 0x96, 0xd7, 0xad, 0xb1, 0x45, 0xd6, 0x2c, - 0xb7, 0x41, 0x2f, 0x7d, 0xd0, 0x35, 0x3f, 0x81, 0xe7, 0xc6, 0x02, 0x45, 0xc0, 0x7d, 0xe1, 0xe0, - 0xbb, 0x50, 0xd1, 0x30, 0x15, 0x36, 0xbb, 0xba, 0xd0, 0x3a, 0x2c, 0xbb, 0xa5, 0xe3, 0xd6, 0xcb, - 0x0f, 0xfe, 0x68, 0x94, 0xda, 0x71, 0x8c, 0xf9, 0x0f, 0x1b, 0xcb, 0x2c, 0x34, 0xa7, 0xeb, 0xf0, - 0x54, 0xcc, 0x49, 0x48, 0x5b, 0x0e, 0x84, 0x2a, 0x30, 0xb7, 0x6a, 0x1e, 0x55, 0x60, 0x53, 0x21, - 0xdb, 0x73, 0x41, 0xea, 0x3b, 0xce, 0xc3, 0xcc, 0x90, 0x4b, 0xa7, 0x5f, 0x9b, 0x5a, 0x64, 0xcd, - 0x6a, 0x3b, 0xfa, 0x82, 0x0b, 0x50, 0xed, 0x3a, 0x01, 0x17, 0x9e, 0xe4, 0xfd, 0xda, 0xb4, 0xda, - 0x19, 0x2d, 0xe0, 0x55, 0x80, 0xd1, 0x48, 0x6a, 0x65, 0x25, 0xee, 0xac, 0xae, 0x1d, 0xce, 0xaf, - 0x15, 0x0d, 0x3b, 0xa6, 0x60, 0xbb, 0x0e, 0x91, 0x6f, 0x27, 0x22, 0x2f, 0x55, 0xbe, 0xbe, 0xd7, - 0x28, 0xfd, 0x7d, 0xaf, 0x51, 0x32, 0xef, 0x33, 0x78, 0x7e, 0x5c, 0x2c, 0xf5, 0xf1, 0x0a, 0x54, - 0x35, 0xe5, 0x50, 0xe7, 0x74, 0xc1, 0x46, 0x8e, 0x82, 0x70, 0x23, 0x45, 0x77, 0x4a, 0xd1, 0x3d, - 0x97, 0x4b, 0x37, 0x2a, 0x9f, 0xe4, 0x6b, 0x6e, 0xc2, 0xd3, 0x8a, 0xe4, 0xc7, 0x5c, 0x3a, 0x45, - 0x0f, 0x48, 0x76, 0x83, 0x13, 0xd2, 0x37, 0xe0, 0x99, 0x44, 0x52, 0x12, 0xbd, 0x0a, 0xe5, 0x10, - 0x47, 0x07, 0xa7, 0x96, 0xa5, 0x37, 0xc4, 0x93, 0x56, 0x85, 0x35, 0xbf, 0x48, 0x24, 0x12, 0x85, - 0xe9, 0x5d, 0xcd, 0x68, 0xce, 0x23, 0xcc, 0xd2, 0xbc, 0xcb, 0x00, 0x93, 0xe5, 0x49, 0xc8, 0x85, - 0x48, 0xbd, 0x9e, 0x5c, 0x9e, 0x92, 0x08, 0xfc, 0xf8, 0x26, 0xf6, 0x06, 0x91, 0xba, 0x61, 0xf7, - 0xed, 0xed, 0x54, 0x53, 0xd4, 0xc2, 0x96, 0xdc, 0x09, 0xa2, 0x26, 0x57, 0xc3, 0xb0, 0x70, 0xe9, - 0xe6, 0x4e, 0xe0, 0x98, 0xff, 0x32, 0x78, 0x36, 0x15, 0x47, 0x6a, 0xae, 0xc3, 0xe9, 0x21, 0x97, - 0x9e, 0xef, 0x6e, 0x45, 0x60, 0x9a, 0xcf, 0xe2, 0x04, 0x55, 0x9e, 0xef, 0x46, 0x09, 0x48, 0xdd, - 0xa9, 0x61, 0x62, 0x0d, 0x3f, 0x84, 0x39, 0xba, 0x52, 0x3a, 0x5b, 0x24, 0xf4, 0xe5, 0xac, 0x6c, - 0xef, 0x47, 0xc8, 0x54, 0xba, 0xd3, 0xdd, 0xe4, 0x22, 0x5e, 0x83, 0x53, 0xd2, 0xee, 0xf5, 0x76, - 0x74, 0xb6, 0x69, 0x95, 0xad, 0x91, 0x95, 0xed, 0x66, 0x88, 0x4b, 0xe5, 0x9a, 0x95, 0xa3, 0x25, - 0xf3, 0x33, 0x52, 0x4f, 0x45, 0x0b, 0x9f, 0xa5, 0x94, 0x6b, 0x4c, 0x8d, 0xb9, 0x46, 0xe2, 0xc8, - 0x6f, 0x92, 0xd9, 0xc6, 0xf9, 0xa9, 0xbd, 0x97, 0xe1, 0x24, 0xc1, 0xa9, 0xb1, 0x2f, 0x1e, 0xd1, - 0x0a, 0x22, 0xae, 0x23, 0xcc, 0x2f, 0xd3, 0x49, 0x9f, 0xfc, 0x0d, 0xf8, 0x59, 0x1b, 0xf6, 0x88, - 0x01, 0xe9, 0x7a, 0x07, 0x2a, 0xc4, 0x52, 0xdf, 0x83, 0x02, 0xc2, 0xe2, 0x90, 0xc7, 0x77, 0x1b, - 0x2e, 0xc1, 0x0b, 0x8a, 0xa0, 0x1a, 0x7f, 0xdb, 0x11, 0x83, 0x9e, 0x3c, 0xc6, 0x3b, 0x57, 0x3b, - 0x1c, 0x1b, 0xcf, 0x6d, 0x46, 0x1d, 0x1f, 0x9a, 0xda, 0xe4, 0x23, 0x17, 0xc5, 0xe9, 0xbb, 0xae, - 0x62, 0x56, 0x7f, 0xab, 0xc2, 0x8c, 0xca, 0x8c, 0x3f, 0x30, 0xa8, 0x68, 0x17, 0xc7, 0x66, 0x56, - 0x92, 0xac, 0x27, 0xda, 0x78, 0xb5, 0x00, 0x32, 0x22, 0x6a, 0xae, 0x7d, 0xf5, 0xeb, 0x5f, 0x77, - 0xa7, 0x96, 0xf1, 0xbc, 0x95, 0xf1, 0xcf, 0x40, 0xfc, 0x60, 0x58, 0xbb, 0x89, 0x56, 0xec, 0xe1, - 0x37, 0x0c, 0xaa, 0xf1, 0xb3, 0x84, 0xf9, 0xd5, 0xf4, 0xc9, 0x33, 0x96, 0x8a, 0x40, 0x89, 0xd9, - 0x19, 0xc5, 0xac, 0x81, 0x2f, 0x1d, 0xc9, 0x0c, 0x7f, 0x64, 0x50, 0x0e, 0xed, 0x12, 0x5f, 0x99, - 0x98, 0x3b, 0xf1, 0x38, 0x19, 0x67, 0x72, 0x50, 0x54, 0xfc, 0x3d, 0x55, 0xfc, 0x32, 0x5e, 0x3c, - 0x46, 0x5b, 0x2c, 0xe5, 0xd4, 0xd6, 0xae, 0x7a, 0xce, 0xf6, 0xf0, 0x7b, 0x06, 0x33, 0xca, 0xf9, - 0xf1, 0xe8, 0x9a, 0x71, 0x73, 0xce, 0xe6, 0xc1, 0x88, 0xdb, 0x45, 0xc5, 0x6d, 0x0d, 0x57, 0x8e, - 0xcd, 0x0d, 0xbf, 0x65, 0x70, 0x82, 0xbc, 0x71, 0x72, 0xb5, 0xd4, 0xcb, 0x60, 0x9c, 0xcb, 0xc5, - 0x11, 0xad, 0xd7, 0x15, 0xad, 0x25, 0x6c, 0x66, 0xd2, 0x52, 0x58, 0x6b, 0x37, 0xf1, 0xc8, 0xec, - 0xe1, 0x2f, 0x0c, 0x4e, 0xd2, 0x0d, 0xc7, 0xc9, 0x65, 0xd2, 0x96, 0x6b, 0x34, 0xf3, 0x81, 0x44, - 0xe8, 0x9a, 0x22, 0xb4, 0x8e, 0x57, 0x8e, 0xd3, 0x27, 0x6d, 0x31, 0xd6, 0x6e, 0x6c, 0xd3, 0x7b, - 0xf8, 0x13, 0x83, 0x8a, 0xb6, 0x30, 0xcc, 0x25, 0x20, 0xf2, 0xaf, 0xe1, 0xb8, 0x1f, 0x9a, 0x6f, - 0x2b, 0xae, 0x6f, 0xe2, 0x85, 0x47, 0xe1, 0x8a, 0xf7, 0x19, 0xcc, 0x26, 0xdc, 0x04, 0xcf, 0x4f, - 0x2c, 0x7c, 0xd8, 0xe7, 0x8c, 0xd7, 0x8a, 0x81, 0xff, 0xcf, 0xe1, 0x53, 0xb6, 0xb6, 0xbe, 0xf1, - 0x60, 0xbf, 0xce, 0x1e, 0xee, 0xd7, 0xd9, 0x9f, 0xfb, 0x75, 0xf6, 0xdd, 0x41, 0xbd, 0xf4, 0xf0, - 0xa0, 0x5e, 0xfa, 0xfd, 0xa0, 0x5e, 0xfa, 0x74, 0xd9, 0xf5, 0xe4, 0xed, 0x41, 0xa7, 0x75, 0x8b, - 0x6f, 0x5b, 0x5e, 0xdf, 0x13, 0xbe, 0x23, 0xd5, 0xdf, 0xdb, 0x83, 0xce, 0xb2, 0xe8, 0x7e, 0xbe, - 0xec, 0x72, 0x6b, 0x9b, 0x77, 0x07, 0x3d, 0x47, 0x95, 0xeb, 0x9c, 0x50, 0x3f, 0x50, 0xd6, 0xfe, - 0x0b, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xea, 0x9d, 0xde, 0x54, 0x0d, 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 { - // Proposal queries proposal details based on ProposalID. - Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryProposalResponse, error) { - out := new(QueryProposalResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposal", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Proposals(ctx context.Context, in *QueryProposalsRequest, opts ...grpc.CallOption) (*QueryProposalsResponse, error) { - out := new(QueryProposalsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Proposals", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Vote(ctx context.Context, in *QueryVoteRequest, opts ...grpc.CallOption) (*QueryVoteResponse, error) { - out := new(QueryVoteResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Vote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Votes(ctx context.Context, in *QueryVotesRequest, opts ...grpc.CallOption) (*QueryVotesResponse, error) { - out := new(QueryVotesResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Votes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Deposit(ctx context.Context, in *QueryDepositRequest, opts ...grpc.CallOption) (*QueryDepositResponse, error) { - out := new(QueryDepositResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Deposits(ctx context.Context, in *QueryDepositsRequest, opts ...grpc.CallOption) (*QueryDepositsResponse, error) { - out := new(QueryDepositsResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/Deposits", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) TallyResult(ctx context.Context, in *QueryTallyResultRequest, opts ...grpc.CallOption) (*QueryTallyResultResponse, error) { - out := new(QueryTallyResultResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Query/TallyResult", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Proposal queries proposal details based on ProposalID. - Proposal(context.Context, *QueryProposalRequest) (*QueryProposalResponse, error) - // Proposals queries all proposals based on given status. - Proposals(context.Context, *QueryProposalsRequest) (*QueryProposalsResponse, error) - // Vote queries voted information based on proposalID, voterAddr. - Vote(context.Context, *QueryVoteRequest) (*QueryVoteResponse, error) - // Votes queries votes of a given proposal. - Votes(context.Context, *QueryVotesRequest) (*QueryVotesResponse, error) - // Params queries all parameters of the gov module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Deposit queries single deposit information based proposalID, depositAddr. - Deposit(context.Context, *QueryDepositRequest) (*QueryDepositResponse, error) - // Deposits queries all deposits of a single proposal. - Deposits(context.Context, *QueryDepositsRequest) (*QueryDepositsResponse, error) - // TallyResult queries the tally of a proposal vote. - TallyResult(context.Context, *QueryTallyResultRequest) (*QueryTallyResultResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") -} -func (*UnimplementedQueryServer) Proposals(ctx context.Context, req *QueryProposalsRequest) (*QueryProposalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposals not implemented") -} -func (*UnimplementedQueryServer) Vote(ctx context.Context, req *QueryVoteRequest) (*QueryVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") -} -func (*UnimplementedQueryServer) Votes(ctx context.Context, req *QueryVotesRequest) (*QueryVotesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Votes not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) Deposit(ctx context.Context, req *QueryDepositRequest) (*QueryDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") -} -func (*UnimplementedQueryServer) Deposits(ctx context.Context, req *QueryDepositsRequest) (*QueryDepositsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposits not implemented") -} -func (*UnimplementedQueryServer) TallyResult(ctx context.Context, req *QueryTallyResultRequest) (*QueryTallyResultResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TallyResult not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposal(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Proposal", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Proposals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryProposalsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Proposals(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Proposals", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposals(ctx, req.(*QueryProposalsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Vote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Vote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Vote(ctx, req.(*QueryVoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Votes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryVotesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Votes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Votes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Votes(ctx, req.(*QueryVotesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/cosmos.gov.v1beta1.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_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Deposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposit(ctx, req.(*QueryDepositRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Deposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDepositsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Deposits(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/Deposits", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Deposits(ctx, req.(*QueryDepositsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_TallyResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTallyResultRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).TallyResult(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Query/TallyResult", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TallyResult(ctx, req.(*QueryTallyResultRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.gov.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Proposal", - Handler: _Query_Proposal_Handler, - }, - { - MethodName: "Proposals", - Handler: _Query_Proposals_Handler, - }, - { - MethodName: "Vote", - Handler: _Query_Vote_Handler, - }, - { - MethodName: "Votes", - Handler: _Query_Votes_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "Deposit", - Handler: _Query_Deposit_Handler, - }, - { - MethodName: "Deposits", - Handler: _Query_Deposits_Handler, - }, - { - MethodName: "TallyResult", - Handler: _Query_TallyResult_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/gov/v1beta1/query.proto", -} - -func (m *QueryProposalRequest) 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 *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryProposalResponse) 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 *QueryProposalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Proposal.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 *QueryProposalsRequest) 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 *QueryProposalsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalsRequest) 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] = 0x22 - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x1a - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalStatus != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryProposalsResponse) 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 *QueryProposalsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryProposalsResponse) 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.Proposals) > 0 { - for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Proposals[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 *QueryVoteRequest) 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 *QueryVoteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryVoteResponse) 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 *QueryVoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Vote.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 *QueryVotesRequest) 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 *QueryVotesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVotesRequest) 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 m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryVotesResponse) 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 *QueryVotesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryVotesResponse) 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.Votes) > 0 { - for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Votes[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 *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 - if len(m.ParamsType) > 0 { - i -= len(m.ParamsType) - copy(dAtA[i:], m.ParamsType) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ParamsType))) - i-- - dAtA[i] = 0xa - } - 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.TallyParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.VotingParams.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 *QueryDepositRequest) 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 *QueryDepositRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryDepositResponse) 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 *QueryDepositResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Deposit.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 *QueryDepositsRequest) 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 *QueryDepositsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositsRequest) 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 m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryDepositsResponse) 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 *QueryDepositsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDepositsResponse) 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.Deposits) > 0 { - for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Deposits[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 *QueryTallyResultRequest) 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 *QueryTallyResultRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTallyResultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryTallyResultResponse) 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 *QueryTallyResultResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTallyResultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Tally.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 *QueryProposalRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - return n -} - -func (m *QueryProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Proposal.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryProposalsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalStatus != 0 { - n += 1 + sovQuery(uint64(m.ProposalStatus)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryProposalsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Proposals) > 0 { - for _, e := range m.Proposals { - 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 *QueryVoteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Vote.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryVotesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryVotesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Votes) > 0 { - for _, e := range m.Votes { - 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 *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ParamsType) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.VotingParams.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.DepositParams.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.TallyParams.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryDepositRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDepositResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Deposit.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryDepositsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDepositsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Deposits) > 0 { - for _, e := range m.Deposits { - 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 *QueryTallyResultRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovQuery(uint64(m.ProposalId)) - } - return n -} - -func (m *QueryTallyResultResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Tally.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 *QueryProposalRequest) 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: QueryProposalRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryProposalResponse) 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: QueryProposalResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposal", 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.Proposal.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 *QueryProposalsRequest) 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: QueryProposalsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalStatus", wireType) - } - m.ProposalStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalStatus |= ProposalStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - 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 *QueryProposalsResponse) 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: QueryProposalsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryProposalsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposals", 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.Proposals = append(m.Proposals, Proposal{}) - if err := m.Proposals[len(m.Proposals)-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 *QueryVoteRequest) 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: QueryVoteRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = 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 *QueryVoteResponse) 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: QueryVoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vote", 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.Vote.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 *QueryVotesRequest) 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: QueryVotesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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.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 *QueryVotesResponse) 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: QueryVotesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Votes", 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.Votes = append(m.Votes, Vote{}) - if err := m.Votes[len(m.Votes)-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 *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 { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ParamsType", 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.ParamsType = 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 *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 VotingParams", 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.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", 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.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", 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.TallyParams.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 *QueryDepositRequest) 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: QueryDepositRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = 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 *QueryDepositResponse) 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: QueryDepositResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", 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.Deposit.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 *QueryDepositsRequest) 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: QueryDepositsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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.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 *QueryDepositsResponse) 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: QueryDepositsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDepositsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposits", 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.Deposits = append(m.Deposits, Deposit{}) - if err := m.Deposits[len(m.Deposits)-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 *QueryTallyResultRequest) 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: QueryTallyResultRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryTallyResultResponse) 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: QueryTallyResultResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTallyResultResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tally", 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.Tally.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/modules/gov/tx.pb.go b/modules/gov/tx.pb.go deleted file mode 100644 index f131685d..00000000 --- a/modules/gov/tx.pb.go +++ /dev/null @@ -1,1472 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/gov/v1beta1/tx.proto - -package gov - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types1 "github.com/irisnet/irishub-sdk-go/types" - _ "github.com/regen-network/cosmos-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 - -// MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary -// proposal Content. -type MsgSubmitProposal struct { - Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` - InitialDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"initial_deposit" yaml:"initial_deposit"` - Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` -} - -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (*MsgSubmitProposal) ProtoMessage() {} -func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{0} -} -func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitProposal.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 *MsgSubmitProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposal.Merge(m, src) -} -func (m *MsgSubmitProposal) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitProposal) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo - -// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. -type MsgSubmitProposalResponse struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` -} - -func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResponse{} } -func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposalResponse) ProtoMessage() {} -func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{1} -} -func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitProposalResponse.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 *MsgSubmitProposalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposalResponse.Merge(m, src) -} -func (m *MsgSubmitProposalResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitProposalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposalResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposalResponse proto.InternalMessageInfo - -func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -// MsgVote defines a message to cast a vote. -type MsgVote struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` -} - -func (m *MsgVote) Reset() { *m = MsgVote{} } -func (*MsgVote) ProtoMessage() {} -func (*MsgVote) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{2} -} -func (m *MsgVote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVote.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 *MsgVote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVote.Merge(m, src) -} -func (m *MsgVote) XXX_Size() int { - return m.Size() -} -func (m *MsgVote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVote.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVote proto.InternalMessageInfo - -// MsgVoteResponse defines the Msg/Vote response type. -type MsgVoteResponse struct { -} - -func (m *MsgVoteResponse) Reset() { *m = MsgVoteResponse{} } -func (m *MsgVoteResponse) String() string { return proto.CompactTextString(m) } -func (*MsgVoteResponse) ProtoMessage() {} -func (*MsgVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{3} -} -func (m *MsgVoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgVoteResponse.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 *MsgVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgVoteResponse.Merge(m, src) -} -func (m *MsgVoteResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgVoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgVoteResponse proto.InternalMessageInfo - -// MsgDeposit defines a message to submit a deposit to an existing proposal. -type MsgDeposit struct { - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` -} - -func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } -func (*MsgDeposit) ProtoMessage() {} -func (*MsgDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{4} -} -func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeposit.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 *MsgDeposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeposit.Merge(m, src) -} -func (m *MsgDeposit) XXX_Size() int { - return m.Size() -} -func (m *MsgDeposit) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeposit.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo - -// MsgDepositResponse defines the Msg/Deposit response type. -type MsgDepositResponse struct { -} - -func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } -func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDepositResponse) ProtoMessage() {} -func (*MsgDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3c053992595e3dce, []int{5} -} -func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDepositResponse.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 *MsgDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDepositResponse.Merge(m, src) -} -func (m *MsgDepositResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgSubmitProposal)(nil), "cosmos.gov.v1beta1.MsgSubmitProposal") - proto.RegisterType((*MsgSubmitProposalResponse)(nil), "cosmos.gov.v1beta1.MsgSubmitProposalResponse") - proto.RegisterType((*MsgVote)(nil), "cosmos.gov.v1beta1.MsgVote") - proto.RegisterType((*MsgVoteResponse)(nil), "cosmos.gov.v1beta1.MsgVoteResponse") - proto.RegisterType((*MsgDeposit)(nil), "cosmos.gov.v1beta1.MsgDeposit") - proto.RegisterType((*MsgDepositResponse)(nil), "cosmos.gov.v1beta1.MsgDepositResponse") -} - -func init() { proto.RegisterFile("cosmos/gov/v1beta1/tx.proto", fileDescriptor_3c053992595e3dce) } - -var fileDescriptor_3c053992595e3dce = []byte{ - // 600 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xb6, 0x93, 0xd2, 0xd0, 0x8b, 0xd4, 0xd2, 0x53, 0x84, 0x52, 0xb7, 0xb2, 0x23, 0xa3, 0xa2, - 0x2e, 0xb1, 0xd5, 0x20, 0x18, 0xca, 0x44, 0x8a, 0xf8, 0x31, 0x44, 0x05, 0x23, 0x31, 0xb0, 0x54, - 0x76, 0x72, 0xbd, 0x9e, 0x88, 0xfd, 0xac, 0xdc, 0x39, 0x22, 0x1b, 0x23, 0x62, 0x42, 0x82, 0x81, - 0xb1, 0x33, 0x1b, 0x12, 0x7f, 0x44, 0xc5, 0xd4, 0x91, 0x01, 0x05, 0xd4, 0x2c, 0x88, 0x81, 0xa1, - 0x7f, 0x01, 0xf2, 0x9d, 0x9d, 0x56, 0x4d, 0x5a, 0x8a, 0xd4, 0x29, 0x79, 0xef, 0x7b, 0xdf, 0xa7, - 0xfb, 0xbe, 0x7b, 0x3e, 0xb4, 0xdc, 0x06, 0x1e, 0x02, 0x77, 0x29, 0xf4, 0xdd, 0xfe, 0x7a, 0x40, - 0x84, 0xbf, 0xee, 0x8a, 0x57, 0x4e, 0xdc, 0x03, 0x01, 0x18, 0x2b, 0xd0, 0xa1, 0xd0, 0x77, 0x32, - 0xd0, 0x30, 0x33, 0x42, 0xe0, 0x73, 0x32, 0x66, 0xb4, 0x81, 0x45, 0x8a, 0x63, 0xac, 0x4c, 0x11, - 0x4c, 0xf9, 0x0a, 0x5d, 0x52, 0xe8, 0xb6, 0xac, 0xdc, 0x4c, 0x5e, 0x41, 0x15, 0x0a, 0x14, 0x54, - 0x3f, 0xfd, 0x97, 0x13, 0x28, 0x00, 0xed, 0x12, 0x57, 0x56, 0x41, 0xb2, 0xe3, 0xfa, 0xd1, 0x40, - 0x41, 0xf6, 0x87, 0x02, 0x5a, 0x6c, 0x71, 0xfa, 0x2c, 0x09, 0x42, 0x26, 0x9e, 0xf4, 0x20, 0x06, - 0xee, 0x77, 0xf1, 0x5d, 0x54, 0x6a, 0x43, 0x24, 0x48, 0x24, 0xaa, 0x7a, 0x4d, 0x5f, 0x2b, 0x37, - 0x2a, 0x8e, 0x92, 0x70, 0x72, 0x09, 0xe7, 0x5e, 0x34, 0x68, 0x96, 0xbf, 0x7e, 0xa9, 0x97, 0x36, - 0xd5, 0xa0, 0x97, 0x33, 0xf0, 0x7b, 0x1d, 0x2d, 0xb0, 0x88, 0x09, 0xe6, 0x77, 0xb7, 0x3b, 0x24, - 0x06, 0xce, 0x44, 0xb5, 0x50, 0x2b, 0xae, 0x95, 0x1b, 0x4b, 0x4e, 0x76, 0xd8, 0xd4, 0x77, 0x1e, - 0x86, 0xb3, 0x09, 0x2c, 0x6a, 0x6e, 0xed, 0x0f, 0x2d, 0xed, 0x68, 0x68, 0x5d, 0x1f, 0xf8, 0x61, - 0x77, 0xc3, 0x3e, 0xc5, 0xb7, 0x3f, 0xfd, 0xb0, 0xea, 0x94, 0x89, 0xdd, 0x24, 0x70, 0xda, 0x10, - 0xba, 0xac, 0xc7, 0x78, 0x44, 0x84, 0xfc, 0xdd, 0x4d, 0x82, 0x3a, 0xef, 0xbc, 0xac, 0x53, 0x70, - 0xc5, 0x20, 0x26, 0x5c, 0xea, 0x71, 0x6f, 0x3e, 0x93, 0xb8, 0xaf, 0x14, 0xb0, 0x81, 0xae, 0xc6, - 0xd2, 0x1e, 0xe9, 0x55, 0x8b, 0x35, 0x7d, 0x6d, 0xce, 0x1b, 0xd7, 0x1b, 0xd7, 0xde, 0xec, 0x59, - 0xda, 0xc7, 0x3d, 0x4b, 0xfb, 0xb5, 0x67, 0x69, 0xaf, 0xbf, 0xd7, 0x34, 0xbb, 0x8d, 0x96, 0x26, - 0x52, 0xf1, 0x08, 0x8f, 0x21, 0xe2, 0x04, 0x3f, 0x40, 0xe5, 0x38, 0xeb, 0x6d, 0xb3, 0x8e, 0x4c, - 0x68, 0xa6, 0xb9, 0xfa, 0x7b, 0x68, 0x9d, 0x6c, 0x1f, 0x0d, 0x2d, 0xac, 0xbc, 0x9c, 0x68, 0xda, - 0x1e, 0xca, 0xab, 0xc7, 0x1d, 0xfb, 0xb3, 0x8e, 0x4a, 0x2d, 0x4e, 0x9f, 0x83, 0xb8, 0x34, 0x4d, - 0x5c, 0x41, 0x57, 0xfa, 0x20, 0x48, 0xaf, 0x5a, 0x90, 0x1e, 0x55, 0x81, 0xef, 0xa0, 0x59, 0x88, - 0x05, 0x83, 0x48, 0x5a, 0x9f, 0x6f, 0x98, 0xce, 0xe4, 0x52, 0x3a, 0xe9, 0x39, 0xb6, 0xe4, 0x94, - 0x97, 0x4d, 0x4f, 0x09, 0x66, 0x11, 0x2d, 0x64, 0x47, 0xce, 0xe3, 0xb0, 0xff, 0xe8, 0x08, 0xb5, - 0x38, 0xcd, 0x83, 0xbe, 0x2c, 0x27, 0x2b, 0x68, 0x2e, 0xbb, 0x7d, 0xc8, 0xdd, 0x1c, 0x37, 0xf0, - 0x2e, 0x9a, 0xf5, 0x43, 0x48, 0x22, 0x51, 0x2d, 0xfe, 0x6b, 0xb5, 0x6e, 0xa7, 0xab, 0xf5, 0xff, - 0x0b, 0x94, 0xe9, 0x4f, 0xc9, 0xa0, 0x82, 0xf0, 0xb1, 0xdf, 0x3c, 0x86, 0xc6, 0xdb, 0x02, 0x2a, - 0xb6, 0x38, 0xc5, 0x3b, 0x68, 0xfe, 0xd4, 0xd7, 0xb4, 0x3a, 0x2d, 0xed, 0x89, 0xf5, 0x32, 0xea, - 0x17, 0x1a, 0x1b, 0x6f, 0xe1, 0x23, 0x34, 0x23, 0x37, 0x67, 0xf9, 0x0c, 0x5a, 0x0a, 0x1a, 0x37, - 0xce, 0x01, 0xc7, 0x4a, 0x4f, 0x51, 0x29, 0xbf, 0x3c, 0xf3, 0x8c, 0xf9, 0x0c, 0x37, 0x6e, 0x9e, - 0x8f, 0xe7, 0x92, 0xcd, 0x87, 0xfb, 0x87, 0xa6, 0x7e, 0x70, 0x68, 0xea, 0x3f, 0x0f, 0x4d, 0xfd, - 0xdd, 0xc8, 0xd4, 0x0e, 0x46, 0xa6, 0xf6, 0x6d, 0x64, 0x6a, 0x2f, 0x2e, 0x70, 0x0b, 0x21, 0x74, - 0x92, 0x2e, 0x91, 0xaf, 0x5f, 0x30, 0x2b, 0x1f, 0x9c, 0x5b, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0xdd, 0x15, 0xe5, 0x99, 0x63, 0x05, 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 { - // SubmitProposal defines a method to create new proposal given a content. - SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) - // Vote defines a method to add a vote on a specific proposal. - Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) - // Deposit defines a method to add deposit on a specific proposal. - Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) { - out := new(MsgSubmitProposalResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/SubmitProposal", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) { - out := new(MsgVoteResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Vote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { - out := new(MsgDepositResponse) - err := c.cc.Invoke(ctx, "/cosmos.gov.v1beta1.Msg/Deposit", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // SubmitProposal defines a method to create new proposal given a content. - SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) - // Vote defines a method to add a vote on a specific proposal. - Vote(context.Context, *MsgVote) (*MsgVoteResponse, error) - // Deposit defines a method to add deposit on a specific proposal. - Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") -} -func (*UnimplementedMsgServer) Vote(ctx context.Context, req *MsgVote) (*MsgVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") -} -func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSubmitProposal) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SubmitProposal(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Msg/SubmitProposal", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SubmitProposal(ctx, req.(*MsgSubmitProposal)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgVote) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Vote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Msg/Vote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Vote(ctx, req.(*MsgVote)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeposit) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Deposit(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.gov.v1beta1.Msg/Deposit", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.gov.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SubmitProposal", - Handler: _Msg_SubmitProposal_Handler, - }, - { - MethodName: "Vote", - Handler: _Msg_Vote_Handler, - }, - { - MethodName: "Deposit", - Handler: _Msg_Deposit_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/gov/v1beta1/tx.proto", -} - -func (m *MsgSubmitProposal) 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 *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Proposer) > 0 { - i -= len(m.Proposer) - copy(dAtA[i:], m.Proposer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) - i-- - dAtA[i] = 0x1a - } - if len(m.InitialDeposit) > 0 { - for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Content != nil { - { - size, err := m.Content.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSubmitProposalResponse) 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 *MsgSubmitProposalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSubmitProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgVote) 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 *MsgVote) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Option != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Option)) - i-- - dAtA[i] = 0x18 - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgVoteResponse) 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 *MsgVoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDeposit) 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 *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgDepositResponse) 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 *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDepositResponse) 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 *MsgSubmitProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Content != nil { - l = m.Content.Size() - n += 1 + l + sovTx(uint64(l)) - } - if len(m.InitialDeposit) > 0 { - for _, e := range m.InitialDeposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Proposer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgSubmitProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - return n -} - -func (m *MsgVote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Option != 0 { - n += 1 + sovTx(uint64(m.Option)) - } - return n -} - -func (m *MsgVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgDepositResponse) 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 *MsgSubmitProposal) 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: MsgSubmitProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Content", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Content == nil { - m.Content = &types.Any{} - } - if err := m.Content.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) - if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposer", 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.Proposer = 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 *MsgSubmitProposalResponse) 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: MsgSubmitProposalResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(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 *MsgVote) 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: MsgVote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", 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.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(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 *MsgVoteResponse) 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: MsgVoteResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgVoteResponse: 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 *MsgDeposit) 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: MsgDeposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", 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.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].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 *MsgDepositResponse) 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: MsgDepositResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: 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/modules/gov/types.go b/modules/gov/types.go deleted file mode 100644 index 6498c2e5..00000000 --- a/modules/gov/types.go +++ /dev/null @@ -1,292 +0,0 @@ -package gov - -import ( - fmt "fmt" - - "github.com/gogo/protobuf/proto" - yaml "gopkg.in/yaml.v2" - - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "gov" - - AttributeKeyProposalId = "proposal_id" -) - -var ( - _ sdk.Msg = &MsgSubmitProposal{} - _ sdk.Msg = &MsgDeposit{} - _ sdk.Msg = &MsgVote{} -) - -// NewMsgSubmitProposal creates a new MsgSubmitProposal. -//nolint:interfacer -func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer sdk.AccAddress) (*MsgSubmitProposal, error) { - m := &MsgSubmitProposal{ - InitialDeposit: initialDeposit, - Proposer: proposer.String(), - } - err := m.SetContent(content) - if err != nil { - return nil, err - } - return m, nil -} - -func (m *MsgSubmitProposal) GetInitialDeposit() sdk.Coins { return m.InitialDeposit } - -func (m *MsgSubmitProposal) GetProposer() sdk.AccAddress { - proposer, _ := sdk.AccAddressFromBech32(m.Proposer) - return proposer -} - -func (m *MsgSubmitProposal) SetContent(content Content) error { - msg, ok := content.(proto.Message) - if !ok { - return fmt.Errorf("can't proto marshal %T", msg) - } - any, err := types.NewAnyWithValue(msg) - if err != nil { - return err - } - m.Content = any - return nil -} - -func (m *MsgSubmitProposal) GetContent() Content { - content, ok := m.Content.GetCachedValue().(Content) - if !ok { - return nil - } - return content -} - -func (m MsgSubmitProposal) Route() string { return ModuleName } - -// Type implements Msg -func (m MsgSubmitProposal) Type() string { return "submit_proposal" } - -// ValidateBasic implements Msg -func (m MsgSubmitProposal) ValidateBasic() error { - if m.Proposer == "" { - return sdk.Wrapf("missing Proposer") - } - if !m.InitialDeposit.IsValid() { - return sdk.Wrapf("invalidCoins coins, %s", m.InitialDeposit.String()) - } - if m.InitialDeposit.IsAnyNegative() { - return sdk.Wrapf("invalidCoins coins, %s", m.InitialDeposit.String()) - } - - content := m.GetContent() - if content == nil { - return sdk.Wrapf("missing content") - } - - if err := content.ValidateBasic(); err != nil { - return err - } - - return nil -} - -// GetSignBytes implements Msg -func (m MsgSubmitProposal) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - -// GetSigners implements Msg -func (m MsgSubmitProposal) GetSigners() []sdk.AccAddress { - proposer, _ := sdk.AccAddressFromBech32(m.Proposer) - return []sdk.AccAddress{proposer} -} - -// String implements the Stringer interface -func (m MsgSubmitProposal) String() string { - out, _ := yaml.Marshal(m) - return string(out) -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m MsgSubmitProposal) UnpackInterfaces(unpacker types.AnyUnpacker) error { - var content Content - return unpacker.UnpackAny(m.Content, &content) -} - -func (msg MsgDeposit) Route() string { return ModuleName } - -// Type implements Msg -func (msg MsgDeposit) Type() string { return "deposit" } - -// ValidateBasic implements Msg -func (msg MsgDeposit) ValidateBasic() error { - if msg.Depositor == "" { - return sdk.Wrapf("missing Proposer") - } - if !msg.Amount.IsValid() { - return sdk.Wrapf("invalidCoins coins, %s", msg.Amount.String()) - } - if msg.Amount.IsAnyNegative() { - return sdk.Wrapf("invalidCoins coins, %s", msg.Amount.String()) - } - - return nil -} - -// String implements the Stringer interface -func (msg MsgDeposit) String() string { - out, _ := yaml.Marshal(msg) - return string(out) -} - -// GetSignBytes implements Msg -func (msg MsgDeposit) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners implements Msg -func (msg MsgDeposit) GetSigners() []sdk.AccAddress { - depositor, _ := sdk.AccAddressFromBech32(msg.Depositor) - return []sdk.AccAddress{depositor} -} - -func (msg MsgVote) Route() string { return ModuleName } - -// Type implements Msg -func (msg MsgVote) Type() string { return "vote" } - -// ValidateBasic implements Msg -func (msg MsgVote) ValidateBasic() error { - if msg.Voter == "" { - return sdk.Wrapf("missing Proposer") - } - - if !ValidVoteOption(msg.Option) { - return sdk.Wrapf("invalid vote option %s", msg.Option.String()) - } - - return nil -} - -func ValidVoteOption(option VoteOption) bool { - if option == OptionYes || - option == OptionAbstain || - option == OptionNo || - option == OptionNoWithVeto { - return true - } - return false -} - -// String implements the Stringer interface -func (msg MsgVote) String() string { - out, _ := yaml.Marshal(msg) - return string(out) -} - -// GetSignBytes implements Msg -func (msg MsgVote) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -// GetSigners implements Msg -func (msg MsgVote) GetSigners() []sdk.AccAddress { - voter, _ := sdk.AccAddressFromBech32(msg.Voter) - return []sdk.AccAddress{voter} -} - -func (q Proposal) Convert() interface{} { - return QueryProposalResp{ - ProposalId: q.ProposalId, - Status: ProposalStatus_name[int32(q.Status)], - FinalTallyResult: QueryTallyResultResp{ - Yes: q.FinalTallyResult.Yes, - Abstain: q.FinalTallyResult.Abstain, - No: q.FinalTallyResult.No, - NoWithVeto: q.FinalTallyResult.NoWithVeto, - }, - SubmitTime: q.SubmitTime, - DepositEndTime: q.DepositEndTime, - TotalDeposit: q.TotalDeposit, - VotingStartTime: q.VotingStartTime, - VotingEndTime: q.VotingEndTime, - } -} - -type Proposals []Proposal - -func (qs Proposals) Convert() interface{} { - var res []QueryProposalResp - for _, q := range qs { - res = append(res, q.Convert().(QueryProposalResp)) - } - return res -} - -func (v Vote) Convert() interface{} { - return QueryVoteResp{ - ProposalId: v.ProposalId, - Voter: v.Voter, - Option: int32(v.Option), - } -} - -type Votes []Vote - -func (vs Votes) Convert() interface{} { - var res []QueryVoteResp - for _, v := range vs { - res = append(res, v.Convert().(QueryVoteResp)) - } - return res -} - -func (q QueryParamsResponse) Convert() interface{} { - return QueryParamsResp{ - VotingParams: votingParams{ - VotingPeriod: q.VotingParams.VotingPeriod, - }, - DepositParams: depositParams{ - MinDeposit: q.DepositParams.MinDeposit, - MaxDepositPeriod: q.DepositParams.MaxDepositPeriod, - }, - TallyParams: tallyParams{ - Quorum: q.TallyParams.Quorum, - Threshold: q.TallyParams.Threshold, - VetoThreshold: q.TallyParams.VetoThreshold, - }, - } -} - -func (d Deposit) Convert() interface{} { - return QueryDepositResp{ - ProposalId: d.ProposalId, - Depositor: d.Depositor, - Amount: d.Amount, - } -} - -type Deposits []Deposit - -func (ds Deposits) Convert() interface{} { - var res []QueryDepositResp - for _, d := range ds { - res = append(res, d.Convert().(QueryDepositResp)) - } - return res -} - -func (t TallyResult) Convert() interface{} { - return QueryTallyResultResp{ - Yes: t.Yes, - Abstain: t.Abstain, - No: t.No, - NoWithVeto: t.NoWithVeto, - } -} diff --git a/modules/grpc_client.go b/modules/grpc_client.go deleted file mode 100644 index e598eb41..00000000 --- a/modules/grpc_client.go +++ /dev/null @@ -1,17 +0,0 @@ -package modules - -import ( - "google.golang.org/grpc" -) - -type grpcClient struct { - url string -} - -func NewGRPCClient(url string) grpcClient { - return grpcClient{url: url} -} - -func (g grpcClient) GenConn() (*grpc.ClientConn, error) { - return grpc.Dial(g.url, grpc.WithInsecure()) -} diff --git a/modules/htlc/codec.go b/modules/htlc/codec.go deleted file mode 100644 index 76118a4c..00000000 --- a/modules/htlc/codec.go +++ /dev/null @@ -1,25 +0,0 @@ -package htlc - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateHTLC{}, - &MsgClaimHTLC{}, - ) -} diff --git a/modules/htlc/export.go b/modules/htlc/export.go deleted file mode 100644 index 6e043ce7..00000000 --- a/modules/htlc/export.go +++ /dev/null @@ -1,61 +0,0 @@ -package htlc - -import sdk "github.com/irisnet/irishub-sdk-go/types" - -// expose HTLC module api for user -type Client interface { - sdk.Module - - CreateHTLC(request CreateHTLCRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - ClaimHTLC(hashLock string, secret string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - - QueryHTLC(hashLock string) (QueryHTLCResp, sdk.Error) - QueryParams() (QueryParamsResp, sdk.Error) -} - -type CreateHTLCRequest struct { - To string `json:"to"` - ReceiverOnOtherChain string `json:"receiver_on_other_chain"` - SenderOnOtherChain string `json:"sender_on_other_chain"` - Amount sdk.DecCoins `json:"amount"` - HashLock string `json:"hash_lock"` - Timestamp uint64 `json:"timestamp"` - TimeLock uint64 `json:"time_lock"` - Transfer bool ` json:"transfer"` -} - -type QueryHTLCResp struct { - Sender string `json:"sender"` - To string `json:"to"` - ReceiverOnOtherChain string `json:"receiver_on_other_chain"` - SenderOnOtherChain string `json:"sender_on_other_chain"` - Amount sdk.Coins `json:"amount"` - Secret string `json:"secret"` - Timestamp uint64 `json:"timestamp"` - ExpirationHeight uint64 `json:"expiration_height"` - State int32 `json:"state"` - Transfer bool ` json:"transfer"` -} - -type QueryParamsResp struct { - AssetParams []AssetParamDto `json:"asset_params"` -} - -type AssetParamDto struct { - Denom string `json:"denom"` - SupplyLimit SupplyLimitDto `json:"supply_limit"` - Active bool `json:"active"` - DeputyAddress string `json:"deputy_address"` - FixedFee uint64 `json:"fixed_fee"` - MinSwapAmount uint64 `json:"min_swap_amount"` - MaxSwapAmount uint64 `json:"max_swap_amount"` - MinBlockLock uint64 `json:"min_block_lock"` - MaxBlockLock uint64 `json:"max_block_lock"` -} - -type SupplyLimitDto struct { - Limit uint64 `json:"limit"` - TimeLimited bool `json:"time_limited"` - TimePeriod int64 `json:"time_period"` - TimeBasedLimit uint64 `json:"time_based_limit"` -} diff --git a/modules/htlc/htlc.go b/modules/htlc/htlc.go deleted file mode 100644 index b1a65041..00000000 --- a/modules/htlc/htlc.go +++ /dev/null @@ -1,111 +0,0 @@ -package htlc - -import ( - "context" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type htlcClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { - return htlcClient{ - BaseClient: baseClient, - Marshaler: marshaler, - } -} - -func (hc htlcClient) Name() string { - return ModuleName -} - -func (hc htlcClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (hc htlcClient) CreateHTLC(request CreateHTLCRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := hc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if request.TimeLock == 0 { - request.TimeLock = MinTimeLock - } - - amount, err := hc.ToMinCoin(request.Amount...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgCreateHTLC{ - Sender: sender.String(), - To: request.To, - ReceiverOnOtherChain: request.ReceiverOnOtherChain, - SenderOnOtherChain: request.SenderOnOtherChain, - Amount: amount, - HashLock: request.HashLock, - Timestamp: request.Timestamp, - TimeLock: request.TimeLock, - Transfer: request.Transfer, - } - return hc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (hc htlcClient) ClaimHTLC(hashLockId string, secret string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := hc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgClaimHTLC{ - Sender: sender.String(), - Id: hashLockId, - Secret: secret, - } - return hc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (hc htlcClient) QueryHTLC(hashLockId string) (QueryHTLCResp, sdk.Error) { - if len(hashLockId) == 0 { - return QueryHTLCResp{}, sdk.Wrapf("hashLock id is required") - } - - conn, err := hc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryHTLCResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).HTLC( - context.Background(), - &QueryHTLCRequest{ - Id: hashLockId, - }) - if err != nil { - return QueryHTLCResp{}, sdk.Wrap(err) - } - return res.Htlc.Convert().(QueryHTLCResp), nil -} - -func (hc htlcClient) QueryParams() (QueryParamsResp, sdk.Error) { - - conn, err := hc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Params( - context.Background(), - &QueryParamsRequest{}) - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - return res.Params.Convert().(QueryParamsResp), nil -} diff --git a/modules/htlc/htlc.pb.go b/modules/htlc/htlc.pb.go deleted file mode 100644 index 9db0c621..00000000 --- a/modules/htlc/htlc.pb.go +++ /dev/null @@ -1,2417 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: htlc/htlc.proto - -package htlc - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// HTLCState defines the state of an HTLC -type HTLCState int32 - -const ( - // HTLC_STATE_OPEN defines an open state. - Open HTLCState = 0 - // HTLC_STATE_COMPLETED defines a completed state. - Completed HTLCState = 1 - // HTLC_STATE_REFUNDED defines a refunded state. - Refunded HTLCState = 2 -) - -var HTLCState_name = map[int32]string{ - 0: "HTLC_STATE_OPEN", - 1: "HTLC_STATE_COMPLETED", - 2: "HTLC_STATE_REFUNDED", -} - -var HTLCState_value = map[string]int32{ - "HTLC_STATE_OPEN": 0, - "HTLC_STATE_COMPLETED": 1, - "HTLC_STATE_REFUNDED": 2, -} - -func (x HTLCState) String() string { - return proto.EnumName(HTLCState_name, int32(x)) -} - -func (HTLCState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_c03699801a204f8b, []int{0} -} - -// SwapDirection defines the direction of an HTLT -type SwapDirection int32 - -const ( - // INVALID defines an htlt invalid direction. - Invalid SwapDirection = 0 - // INCOMING defines an htlt incoming direction. - Incoming SwapDirection = 1 - // OUTGOING defines an htlt outgoing direction. - Outgoing SwapDirection = 2 -) - -var SwapDirection_name = map[int32]string{ - 0: "INVALID", - 1: "INCOMING", - 2: "OUTGOING", -} - -var SwapDirection_value = map[string]int32{ - "INVALID": 0, - "INCOMING": 1, - "OUTGOING": 2, -} - -func (x SwapDirection) String() string { - return proto.EnumName(SwapDirection_name, int32(x)) -} - -func (SwapDirection) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_c03699801a204f8b, []int{1} -} - -// HTLC defines the struct of an HTLC -type HTLC struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` - To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` - ReceiverOnOtherChain string `protobuf:"bytes,4,opt,name=receiver_on_other_chain,json=receiverOnOtherChain,proto3" json:"receiver_on_other_chain,omitempty" yaml:"receiver_on_other_chain"` - SenderOnOtherChain string `protobuf:"bytes,5,opt,name=sender_on_other_chain,json=senderOnOtherChain,proto3" json:"sender_on_other_chain,omitempty" yaml:"sender_on_other_chain"` - Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` - HashLock string `protobuf:"bytes,7,opt,name=hash_lock,json=hashLock,proto3" json:"hash_lock,omitempty" yaml:"hash_lock"` - Secret string `protobuf:"bytes,8,opt,name=secret,proto3" json:"secret,omitempty"` - Timestamp uint64 `protobuf:"varint,9,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - ExpirationHeight uint64 `protobuf:"varint,10,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height,omitempty" yaml:"expiration_height"` - State HTLCState `protobuf:"varint,11,opt,name=state,proto3,enum=irismod.htlc.HTLCState" json:"state,omitempty"` - ClosedBlock uint64 `protobuf:"varint,12,opt,name=closed_block,json=closedBlock,proto3" json:"closed_block,omitempty" yaml:"closed_block"` - Transfer bool `protobuf:"varint,13,opt,name=transfer,proto3" json:"transfer,omitempty"` - Direction SwapDirection `protobuf:"varint,14,opt,name=direction,proto3,enum=irismod.htlc.SwapDirection" json:"direction,omitempty"` -} - -func (m *HTLC) Reset() { *m = HTLC{} } -func (m *HTLC) String() string { return proto.CompactTextString(m) } -func (*HTLC) ProtoMessage() {} -func (*HTLC) Descriptor() ([]byte, []int) { - return fileDescriptor_c03699801a204f8b, []int{0} -} -func (m *HTLC) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HTLC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HTLC.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 *HTLC) XXX_Merge(src proto.Message) { - xxx_messageInfo_HTLC.Merge(m, src) -} -func (m *HTLC) XXX_Size() int { - return m.Size() -} -func (m *HTLC) XXX_DiscardUnknown() { - xxx_messageInfo_HTLC.DiscardUnknown(m) -} - -var xxx_messageInfo_HTLC proto.InternalMessageInfo - -type AssetSupply struct { - IncomingSupply types.Coin `protobuf:"bytes,1,opt,name=incoming_supply,json=incomingSupply,proto3" json:"incoming_supply" yaml:"incoming_supply"` - OutgoingSupply types.Coin `protobuf:"bytes,2,opt,name=outgoing_supply,json=outgoingSupply,proto3" json:"outgoing_supply" yaml:"assetoutgoing_supply_params"` - CurrentSupply types.Coin `protobuf:"bytes,3,opt,name=current_supply,json=currentSupply,proto3" json:"current_supply" yaml:"current_supply"` - TimeLimitedCurrentSupply types.Coin `protobuf:"bytes,4,opt,name=time_limited_current_supply,json=timeLimitedCurrentSupply,proto3" json:"time_limited_current_supply" yaml:"time_limited_current_supply"` - TimeElapsed time.Duration `protobuf:"bytes,5,opt,name=time_elapsed,json=timeElapsed,proto3,stdduration" json:"time_elapsed" yaml:"time_elapsed"` -} - -func (m *AssetSupply) Reset() { *m = AssetSupply{} } -func (m *AssetSupply) String() string { return proto.CompactTextString(m) } -func (*AssetSupply) ProtoMessage() {} -func (*AssetSupply) Descriptor() ([]byte, []int) { - return fileDescriptor_c03699801a204f8b, []int{1} -} -func (m *AssetSupply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AssetSupply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AssetSupply.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 *AssetSupply) XXX_Merge(src proto.Message) { - xxx_messageInfo_AssetSupply.Merge(m, src) -} -func (m *AssetSupply) XXX_Size() int { - return m.Size() -} -func (m *AssetSupply) XXX_DiscardUnknown() { - xxx_messageInfo_AssetSupply.DiscardUnknown(m) -} - -var xxx_messageInfo_AssetSupply proto.InternalMessageInfo - -// Params defines token module's parameters -type Params struct { - AssetParams []AssetParam `protobuf:"bytes,1,rep,name=asset_params,json=assetParams,proto3" json:"asset_params" yaml:"asset_params"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_c03699801a204f8b, []int{2} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -type AssetParam struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - SupplyLimit SupplyLimit `protobuf:"bytes,2,opt,name=supply_limit,json=supplyLimit,proto3" json:"supply_limit" yaml:"supply_limit"` - Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` - DeputyAddress string `protobuf:"bytes,4,opt,name=deputy_address,json=deputyAddress,proto3" json:"deputy_address,omitempty" yaml:"deputy_address"` - FixedFee github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,5,opt,name=fixed_fee,json=fixedFee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"fixed_fee"` - MinSwapAmount github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,6,opt,name=min_swap_amount,json=minSwapAmount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_swap_amount"` - MaxSwapAmount github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,7,opt,name=max_swap_amount,json=maxSwapAmount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"max_swap_amount"` - MinBlockLock uint64 `protobuf:"varint,8,opt,name=min_block_lock,json=minBlockLock,proto3" json:"min_block_lock,omitempty" yaml:"min_block_lock"` - MaxBlockLock uint64 `protobuf:"varint,9,opt,name=max_block_lock,json=maxBlockLock,proto3" json:"max_block_lock,omitempty" yaml:"max_block_lock"` -} - -func (m *AssetParam) Reset() { *m = AssetParam{} } -func (m *AssetParam) String() string { return proto.CompactTextString(m) } -func (*AssetParam) ProtoMessage() {} -func (*AssetParam) Descriptor() ([]byte, []int) { - return fileDescriptor_c03699801a204f8b, []int{3} -} -func (m *AssetParam) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AssetParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AssetParam.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 *AssetParam) XXX_Merge(src proto.Message) { - xxx_messageInfo_AssetParam.Merge(m, src) -} -func (m *AssetParam) XXX_Size() int { - return m.Size() -} -func (m *AssetParam) XXX_DiscardUnknown() { - xxx_messageInfo_AssetParam.DiscardUnknown(m) -} - -var xxx_messageInfo_AssetParam proto.InternalMessageInfo - -type SupplyLimit struct { - Limit github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,1,opt,name=limit,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"limit"` - TimeLimited bool `protobuf:"varint,2,opt,name=time_limited,json=timeLimited,proto3" json:"time_limited,omitempty" yaml:"time_limited"` - TimePeriod time.Duration `protobuf:"bytes,3,opt,name=time_period,json=timePeriod,proto3,stdduration" json:"time_period" yaml:"time_period"` - TimeBasedLimit github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=time_based_limit,json=timeBasedLimit,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"time_based_limit"` -} - -func (m *SupplyLimit) Reset() { *m = SupplyLimit{} } -func (m *SupplyLimit) String() string { return proto.CompactTextString(m) } -func (*SupplyLimit) ProtoMessage() {} -func (*SupplyLimit) Descriptor() ([]byte, []int) { - return fileDescriptor_c03699801a204f8b, []int{4} -} -func (m *SupplyLimit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SupplyLimit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SupplyLimit.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 *SupplyLimit) XXX_Merge(src proto.Message) { - xxx_messageInfo_SupplyLimit.Merge(m, src) -} -func (m *SupplyLimit) XXX_Size() int { - return m.Size() -} -func (m *SupplyLimit) XXX_DiscardUnknown() { - xxx_messageInfo_SupplyLimit.DiscardUnknown(m) -} - -var xxx_messageInfo_SupplyLimit proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("irismod.htlc.HTLCState", HTLCState_name, HTLCState_value) - proto.RegisterEnum("irismod.htlc.SwapDirection", SwapDirection_name, SwapDirection_value) - proto.RegisterType((*HTLC)(nil), "irismod.htlc.HTLC") - proto.RegisterType((*AssetSupply)(nil), "irismod.htlc.AssetSupply") - proto.RegisterType((*Params)(nil), "irismod.htlc.Params") - proto.RegisterType((*AssetParam)(nil), "irismod.htlc.AssetParam") - proto.RegisterType((*SupplyLimit)(nil), "irismod.htlc.SupplyLimit") -} - -func init() { proto.RegisterFile("htlc/htlc.proto", fileDescriptor_c03699801a204f8b) } - -var fileDescriptor_c03699801a204f8b = []byte{ - // 1245 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0x13, 0xc7, - 0x1b, 0xf6, 0x06, 0x27, 0xb1, 0xc7, 0x8e, 0xe3, 0xdf, 0x10, 0x60, 0x31, 0x60, 0x5b, 0x2b, 0xfd, - 0xd4, 0x88, 0x2a, 0xb6, 0x00, 0xf5, 0x50, 0x2e, 0x6d, 0xec, 0x18, 0xb0, 0x14, 0xe2, 0x68, 0x12, - 0xaa, 0x42, 0x85, 0x56, 0xe3, 0xdd, 0x89, 0x3d, 0xc2, 0xbb, 0xb3, 0xda, 0x19, 0x87, 0xe4, 0xd6, - 0x43, 0x0f, 0x55, 0x4e, 0x3d, 0xf6, 0x12, 0xa9, 0x52, 0x2f, 0x55, 0x3f, 0x09, 0x47, 0x0e, 0xad, - 0x54, 0xf5, 0x60, 0x5a, 0xb8, 0x54, 0xea, 0x2d, 0x9f, 0xa0, 0x9a, 0x3f, 0x76, 0x76, 0x43, 0x81, - 0x96, 0x5e, 0xc0, 0xef, 0xbf, 0xe7, 0x79, 0xf7, 0x9d, 0x77, 0x9e, 0x09, 0x58, 0x1e, 0x8a, 0x91, - 0xd7, 0x94, 0xff, 0x34, 0xa2, 0x98, 0x09, 0x06, 0x8b, 0x34, 0xa6, 0x3c, 0x60, 0x7e, 0x43, 0xfa, - 0x2a, 0x55, 0x8f, 0xf1, 0x80, 0xf1, 0x66, 0x1f, 0x73, 0xd2, 0xdc, 0xbf, 0xd1, 0x27, 0x02, 0xdf, - 0x68, 0x7a, 0x8c, 0x86, 0x3a, 0xbb, 0xb2, 0x32, 0x60, 0x03, 0xa6, 0x7e, 0x36, 0xe5, 0x2f, 0xe3, - 0xad, 0x0e, 0x18, 0x1b, 0x8c, 0x48, 0x53, 0x59, 0xfd, 0xf1, 0x5e, 0xd3, 0x1f, 0xc7, 0x58, 0x50, - 0x66, 0xaa, 0x9c, 0x9f, 0xe6, 0x41, 0xf6, 0xde, 0xee, 0x66, 0x1b, 0x96, 0xc0, 0x1c, 0xf5, 0x6d, - 0xab, 0x6e, 0xad, 0xe6, 0xd1, 0x1c, 0xf5, 0xe1, 0x45, 0xb0, 0xc0, 0x49, 0xe8, 0x93, 0xd8, 0x9e, - 0x53, 0x3e, 0x63, 0xc9, 0x3c, 0xc1, 0xec, 0x73, 0x3a, 0x4f, 0x30, 0xf8, 0x10, 0x5c, 0x8a, 0x89, - 0x47, 0xe8, 0x3e, 0x89, 0x5d, 0x16, 0xba, 0x4c, 0x0c, 0x49, 0xec, 0x7a, 0x43, 0x4c, 0x43, 0x3b, - 0x2b, 0x93, 0x5a, 0xce, 0xc9, 0xa4, 0x56, 0x3d, 0xc4, 0xc1, 0xe8, 0xb6, 0xf3, 0x86, 0x44, 0x07, - 0xad, 0x4c, 0x23, 0xbd, 0xb0, 0x27, 0xfd, 0x6d, 0xe9, 0x86, 0x3b, 0xe0, 0x82, 0x26, 0x3d, 0x0b, - 0x3c, 0xaf, 0x80, 0xeb, 0x27, 0x93, 0xda, 0x55, 0x0d, 0xfc, 0xb7, 0x69, 0x0e, 0x82, 0xda, 0x9f, - 0x02, 0x1d, 0x82, 0x05, 0x1c, 0xb0, 0x71, 0x28, 0xec, 0x85, 0xfa, 0xb9, 0xd5, 0xc2, 0xcd, 0xcb, - 0x0d, 0x3d, 0xd7, 0x86, 0x9c, 0x6b, 0xc3, 0xcc, 0xb5, 0xd1, 0x66, 0x34, 0x6c, 0x7d, 0xf4, 0x6c, - 0x52, 0xcb, 0xfc, 0xf8, 0xa2, 0xb6, 0x36, 0xa0, 0x62, 0x38, 0xee, 0x37, 0x3c, 0x16, 0x34, 0xe5, - 0x91, 0x84, 0x44, 0xa8, 0xff, 0x87, 0xe3, 0xfe, 0x1a, 0xf7, 0x9f, 0xac, 0x0d, 0x58, 0x53, 0x1c, - 0x46, 0x84, 0xab, 0x2a, 0x8e, 0x0c, 0x3e, 0xbc, 0x01, 0xf2, 0x43, 0xcc, 0x87, 0xee, 0x88, 0x79, - 0x4f, 0xec, 0x45, 0xd5, 0xf2, 0xca, 0xc9, 0xa4, 0x56, 0xd6, 0x2d, 0xcf, 0x42, 0x0e, 0xca, 0xc9, - 0xdf, 0x9b, 0xcc, 0x7b, 0xa2, 0x87, 0xee, 0xc5, 0x44, 0xd8, 0xb9, 0xe9, 0xd0, 0xa5, 0x05, 0xaf, - 0x82, 0xbc, 0xa0, 0x01, 0xe1, 0x02, 0x07, 0x91, 0x9d, 0xaf, 0x5b, 0xab, 0x59, 0x74, 0xea, 0x80, - 0x5d, 0xf0, 0x3f, 0x72, 0x10, 0x51, 0x7d, 0xae, 0xee, 0x90, 0xd0, 0xc1, 0x50, 0xd8, 0x40, 0x66, - 0xb5, 0xae, 0x9e, 0x4c, 0x6a, 0xb6, 0x26, 0x7c, 0x2d, 0xc5, 0x41, 0xe5, 0x53, 0xdf, 0x3d, 0xe5, - 0x82, 0x6b, 0x60, 0x9e, 0x0b, 0x2c, 0x88, 0x5d, 0xa8, 0x5b, 0xab, 0xa5, 0x9b, 0x97, 0x1a, 0xc9, - 0x15, 0x6c, 0xc8, 0x45, 0xd9, 0x91, 0x61, 0xa4, 0xb3, 0xe0, 0x6d, 0x50, 0xf4, 0x46, 0x8c, 0x13, - 0xdf, 0xed, 0xab, 0xaf, 0x2c, 0x2a, 0xd2, 0x4b, 0x27, 0x93, 0xda, 0x79, 0x4d, 0x9a, 0x8c, 0x3a, - 0xa8, 0xa0, 0xcd, 0x96, 0xb4, 0x60, 0x05, 0xe4, 0x44, 0x8c, 0x43, 0xbe, 0x47, 0x62, 0x7b, 0xa9, - 0x6e, 0xad, 0xe6, 0xd0, 0xcc, 0x86, 0x1f, 0x83, 0xbc, 0x4f, 0x63, 0xe2, 0xc9, 0xce, 0xec, 0x92, - 0x6a, 0xe5, 0x4a, 0xba, 0x95, 0x9d, 0xa7, 0x38, 0xda, 0x98, 0xa6, 0xa0, 0xd3, 0xec, 0xdb, 0xd9, - 0x3f, 0xbe, 0xab, 0x59, 0xce, 0x0f, 0x59, 0x50, 0x58, 0xe7, 0x9c, 0x88, 0x9d, 0x71, 0x14, 0x8d, - 0x0e, 0x61, 0x1f, 0x2c, 0xd3, 0xd0, 0x63, 0x01, 0x0d, 0x07, 0x2e, 0x57, 0x2e, 0xb5, 0xea, 0x6f, - 0x3d, 0xfe, 0xaa, 0x3c, 0xfe, 0x93, 0x49, 0xed, 0xa2, 0xfe, 0x94, 0x33, 0xf5, 0x0e, 0x2a, 0x4d, - 0x3d, 0x86, 0x23, 0x04, 0xcb, 0x6c, 0x2c, 0x06, 0x2c, 0xc1, 0x31, 0xf7, 0x2e, 0x8e, 0xeb, 0x86, - 0xc3, 0xd1, 0x1c, 0x58, 0xb6, 0x7c, 0x06, 0xc4, 0x8d, 0x70, 0x8c, 0x03, 0xee, 0xa0, 0xd2, 0x34, - 0x60, 0xf8, 0x5c, 0x50, 0xf2, 0xc6, 0x71, 0x4c, 0x42, 0x31, 0xa5, 0x3b, 0xf7, 0x2e, 0xba, 0x6b, - 0x86, 0xee, 0x82, 0x39, 0x9d, 0x54, 0xb9, 0x83, 0x96, 0x8c, 0xc3, 0x10, 0x7c, 0x65, 0x81, 0x2b, - 0x72, 0xcb, 0xdc, 0x11, 0x0d, 0xa8, 0x20, 0xbe, 0x7b, 0x86, 0x2e, 0xfb, 0x2f, 0xbf, 0xee, 0x2d, - 0x58, 0x0e, 0xb2, 0x65, 0x74, 0x53, 0x07, 0xdb, 0xa9, 0x36, 0x1e, 0x83, 0xa2, 0xaa, 0x24, 0x23, - 0x1c, 0x71, 0xe2, 0xab, 0xdb, 0x2f, 0x69, 0xb5, 0xb2, 0x35, 0xa6, 0xca, 0xd6, 0xd8, 0x30, 0xca, - 0xd6, 0xaa, 0x19, 0xda, 0xf3, 0x09, 0x5a, 0x53, 0xec, 0x7c, 0xfb, 0xa2, 0x66, 0xa1, 0x82, 0x74, - 0x75, 0x8c, 0x67, 0x08, 0x16, 0xb6, 0xd5, 0x84, 0xe1, 0xe7, 0xa0, 0xa8, 0x0e, 0xc0, 0x4c, 0xdc, - 0xb6, 0x94, 0x40, 0xd8, 0xe9, 0xc5, 0x53, 0x5b, 0xa5, 0x0a, 0x5a, 0x57, 0xd2, 0x3c, 0xc9, 0x5a, - 0x07, 0x15, 0xf0, 0x2c, 0x91, 0x9b, 0xa5, 0xfc, 0x33, 0x0b, 0xc0, 0x69, 0x39, 0x5c, 0x01, 0xf3, - 0x3e, 0x09, 0x59, 0x60, 0x44, 0x57, 0x1b, 0xf0, 0x21, 0x28, 0x9a, 0x73, 0x57, 0x93, 0x9a, 0xad, - 0x50, 0x7a, 0xfb, 0x55, 0x86, 0x9a, 0xd6, 0xd9, 0x2e, 0x92, 0xc5, 0x0e, 0x2a, 0xf0, 0xd3, 0x4c, - 0xa9, 0x2e, 0xd8, 0x13, 0x74, 0x9f, 0xa8, 0x45, 0xc9, 0x21, 0x63, 0xc1, 0x4f, 0x41, 0xc9, 0x27, - 0xd1, 0x58, 0x1c, 0xba, 0xd8, 0xf7, 0x63, 0xc2, 0xb9, 0x51, 0xee, 0xcb, 0xa7, 0x9b, 0x92, 0x8e, - 0x3b, 0x68, 0x49, 0x3b, 0xd6, 0xb5, 0x0d, 0xb7, 0x41, 0x7e, 0x8f, 0x1e, 0x10, 0xdf, 0xdd, 0x23, - 0xc4, 0xa8, 0xf3, 0x2d, 0xd9, 0xd6, 0xaf, 0x93, 0xda, 0x87, 0xff, 0x54, 0x3c, 0xbb, 0xa1, 0x40, - 0x39, 0x85, 0x72, 0x87, 0x10, 0xf8, 0x05, 0x58, 0x0e, 0x68, 0xe8, 0xf2, 0xa7, 0x38, 0x72, 0x67, - 0x7a, 0xfd, 0xde, 0xb8, 0x4b, 0x01, 0x0d, 0xa5, 0x62, 0xac, 0x6b, 0x65, 0x96, 0xe0, 0xf8, 0x20, - 0x05, 0xbe, 0xf8, 0x5f, 0xc0, 0xf1, 0x41, 0x02, 0xfc, 0x13, 0x50, 0x92, 0x9d, 0x2b, 0xc9, 0xd3, - 0xda, 0x9f, 0x53, 0xaa, 0x98, 0x98, 0x66, 0x3a, 0xee, 0xa0, 0x62, 0x40, 0x43, 0x25, 0x8a, 0xea, - 0x11, 0x90, 0x00, 0xf8, 0x20, 0x09, 0x90, 0x7f, 0x0d, 0x20, 0x15, 0x97, 0x00, 0xf8, 0x60, 0x06, - 0x60, 0xb6, 0xed, 0xe7, 0x39, 0x50, 0x48, 0xec, 0x09, 0xec, 0x82, 0x79, 0xbd, 0x51, 0xd6, 0xfb, - 0x7f, 0xaa, 0x46, 0x90, 0xb2, 0x9f, 0xbc, 0xcb, 0x6a, 0x47, 0x73, 0x49, 0xd9, 0x4f, 0x46, 0x1d, - 0x7d, 0xdd, 0xcc, 0xd5, 0x86, 0x8f, 0x80, 0x32, 0xdd, 0x88, 0xc4, 0x94, 0xf9, 0x33, 0xc9, 0x7a, - 0xe3, 0x65, 0x9e, 0xaa, 0x30, 0x4c, 0x20, 0xeb, 0x5a, 0x7d, 0x97, 0x81, 0xf4, 0x6c, 0x2b, 0x07, - 0x7c, 0x0c, 0xca, 0x2a, 0x2e, 0x95, 0xc8, 0x37, 0xf7, 0x27, 0xfb, 0xfe, 0x5f, 0x5b, 0x92, 0x60, - 0x2d, 0x89, 0xa5, 0x9a, 0xd7, 0x73, 0xbd, 0xfe, 0xa5, 0x05, 0xf2, 0xb3, 0x87, 0x10, 0x5e, 0x03, - 0xcb, 0xd2, 0x70, 0x77, 0x76, 0xd7, 0x77, 0x3b, 0x6e, 0x6f, 0xbb, 0xb3, 0x55, 0xce, 0x54, 0x72, - 0x47, 0xc7, 0xf5, 0x6c, 0x2f, 0x22, 0x21, 0xfc, 0x00, 0xac, 0x24, 0xc2, 0xed, 0xde, 0xfd, 0xed, - 0xcd, 0xce, 0x6e, 0x67, 0xa3, 0x6c, 0x55, 0x96, 0x8e, 0x8e, 0xeb, 0xf9, 0x36, 0x0b, 0xa2, 0x11, - 0x91, 0x63, 0xf9, 0x3f, 0x38, 0x9f, 0x48, 0x44, 0x9d, 0x3b, 0x0f, 0xb6, 0x36, 0x3a, 0x1b, 0xe5, - 0xb9, 0x4a, 0xf1, 0xe8, 0xb8, 0x9e, 0x43, 0x64, 0x6f, 0x1c, 0xfa, 0xc4, 0xaf, 0x64, 0xbf, 0xfe, - 0xbe, 0x9a, 0xb9, 0x3e, 0x00, 0x4b, 0xa9, 0xf7, 0x0f, 0xda, 0x60, 0xb1, 0xbb, 0xf5, 0xd9, 0xfa, - 0x66, 0x77, 0xa3, 0x9c, 0xa9, 0x14, 0x8e, 0x8e, 0xeb, 0x8b, 0xdd, 0x70, 0x1f, 0x8f, 0xa8, 0x2f, - 0x5f, 0xd9, 0xee, 0x56, 0xbb, 0x77, 0xbf, 0xbb, 0x75, 0xb7, 0x6c, 0x69, 0xb0, 0xae, 0x79, 0xb6, - 0x64, 0xac, 0xf7, 0x60, 0xf7, 0x6e, 0x4f, 0xc6, 0x0c, 0x51, 0xcf, 0x3c, 0x31, 0x9a, 0xa8, 0xb5, - 0xf9, 0xec, 0xf7, 0x6a, 0xe6, 0xd9, 0xcb, 0xaa, 0xf5, 0xfc, 0x65, 0xd5, 0xfa, 0xed, 0x65, 0xd5, - 0xfa, 0xe6, 0x55, 0x35, 0xf3, 0xfc, 0x55, 0x35, 0xf3, 0xcb, 0xab, 0x6a, 0xe6, 0x51, 0xe3, 0xdd, - 0xc3, 0x0c, 0x98, 0x3f, 0x1e, 0x11, 0xae, 0xfe, 0xaa, 0xed, 0x2f, 0xa8, 0xd3, 0xbd, 0xf5, 0x57, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xa9, 0xd6, 0xc2, 0x45, 0xe9, 0x0a, 0x00, 0x00, -} - -func (this *HTLC) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*HTLC) - if !ok { - that2, ok := that.(HTLC) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.Sender != that1.Sender { - return false - } - if this.To != that1.To { - return false - } - if this.ReceiverOnOtherChain != that1.ReceiverOnOtherChain { - return false - } - if this.SenderOnOtherChain != that1.SenderOnOtherChain { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - if this.HashLock != that1.HashLock { - return false - } - if this.Secret != that1.Secret { - return false - } - if this.Timestamp != that1.Timestamp { - return false - } - if this.ExpirationHeight != that1.ExpirationHeight { - return false - } - if this.State != that1.State { - return false - } - if this.ClosedBlock != that1.ClosedBlock { - return false - } - if this.Transfer != that1.Transfer { - return false - } - if this.Direction != that1.Direction { - return false - } - return true -} -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 - } - if len(this.AssetParams) != len(that1.AssetParams) { - return false - } - for i := range this.AssetParams { - if !this.AssetParams[i].Equal(&that1.AssetParams[i]) { - return false - } - } - return true -} -func (this *AssetParam) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*AssetParam) - if !ok { - that2, ok := that.(AssetParam) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if !this.SupplyLimit.Equal(&that1.SupplyLimit) { - return false - } - if this.Active != that1.Active { - return false - } - if this.DeputyAddress != that1.DeputyAddress { - return false - } - if !this.FixedFee.Equal(that1.FixedFee) { - return false - } - if !this.MinSwapAmount.Equal(that1.MinSwapAmount) { - return false - } - if !this.MaxSwapAmount.Equal(that1.MaxSwapAmount) { - return false - } - if this.MinBlockLock != that1.MinBlockLock { - return false - } - if this.MaxBlockLock != that1.MaxBlockLock { - return false - } - return true -} -func (this *SupplyLimit) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*SupplyLimit) - if !ok { - that2, ok := that.(SupplyLimit) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Limit.Equal(that1.Limit) { - return false - } - if this.TimeLimited != that1.TimeLimited { - return false - } - if this.TimePeriod != that1.TimePeriod { - return false - } - if !this.TimeBasedLimit.Equal(that1.TimeBasedLimit) { - return false - } - return true -} -func (m *HTLC) 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 *HTLC) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HTLC) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Direction != 0 { - i = encodeVarintHtlc(dAtA, i, uint64(m.Direction)) - i-- - dAtA[i] = 0x70 - } - if m.Transfer { - i-- - if m.Transfer { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if m.ClosedBlock != 0 { - i = encodeVarintHtlc(dAtA, i, uint64(m.ClosedBlock)) - i-- - dAtA[i] = 0x60 - } - if m.State != 0 { - i = encodeVarintHtlc(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x58 - } - if m.ExpirationHeight != 0 { - i = encodeVarintHtlc(dAtA, i, uint64(m.ExpirationHeight)) - i-- - dAtA[i] = 0x50 - } - if m.Timestamp != 0 { - i = encodeVarintHtlc(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x48 - } - if len(m.Secret) > 0 { - i -= len(m.Secret) - copy(dAtA[i:], m.Secret) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.Secret))) - i-- - dAtA[i] = 0x42 - } - if len(m.HashLock) > 0 { - i -= len(m.HashLock) - copy(dAtA[i:], m.HashLock) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.HashLock))) - i-- - dAtA[i] = 0x3a - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.SenderOnOtherChain) > 0 { - i -= len(m.SenderOnOtherChain) - copy(dAtA[i:], m.SenderOnOtherChain) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.SenderOnOtherChain))) - i-- - dAtA[i] = 0x2a - } - if len(m.ReceiverOnOtherChain) > 0 { - i -= len(m.ReceiverOnOtherChain) - copy(dAtA[i:], m.ReceiverOnOtherChain) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.ReceiverOnOtherChain))) - i-- - dAtA[i] = 0x22 - } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.To))) - i-- - dAtA[i] = 0x1a - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AssetSupply) 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 *AssetSupply) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AssetSupply) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TimeElapsed, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimeElapsed):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintHtlc(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x2a - { - size, err := m.TimeLimitedCurrentSupply.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size, err := m.CurrentSupply.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.OutgoingSupply.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.IncomingSupply.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AssetParams) > 0 { - for iNdEx := len(m.AssetParams) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AssetParams[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *AssetParam) 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 *AssetParam) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AssetParam) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MaxBlockLock != 0 { - i = encodeVarintHtlc(dAtA, i, uint64(m.MaxBlockLock)) - i-- - dAtA[i] = 0x48 - } - if m.MinBlockLock != 0 { - i = encodeVarintHtlc(dAtA, i, uint64(m.MinBlockLock)) - i-- - dAtA[i] = 0x40 - } - { - size := m.MaxSwapAmount.Size() - i -= size - if _, err := m.MaxSwapAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - { - size := m.MinSwapAmount.Size() - i -= size - if _, err := m.MinSwapAmount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size := m.FixedFee.Size() - i -= size - if _, err := m.FixedFee.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if len(m.DeputyAddress) > 0 { - i -= len(m.DeputyAddress) - copy(dAtA[i:], m.DeputyAddress) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.DeputyAddress))) - i-- - dAtA[i] = 0x22 - } - if m.Active { - i-- - if m.Active { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - { - size, err := m.SupplyLimit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintHtlc(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SupplyLimit) 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 *SupplyLimit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SupplyLimit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.TimeBasedLimit.Size() - i -= size - if _, err := m.TimeBasedLimit.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TimePeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimePeriod):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintHtlc(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0x1a - if m.TimeLimited { - i-- - if m.TimeLimited { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - { - size := m.Limit.Size() - i -= size - if _, err := m.Limit.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintHtlc(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintHtlc(dAtA []byte, offset int, v uint64) int { - offset -= sovHtlc(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *HTLC) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - l = len(m.To) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - l = len(m.ReceiverOnOtherChain) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - l = len(m.SenderOnOtherChain) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovHtlc(uint64(l)) - } - } - l = len(m.HashLock) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - l = len(m.Secret) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - if m.Timestamp != 0 { - n += 1 + sovHtlc(uint64(m.Timestamp)) - } - if m.ExpirationHeight != 0 { - n += 1 + sovHtlc(uint64(m.ExpirationHeight)) - } - if m.State != 0 { - n += 1 + sovHtlc(uint64(m.State)) - } - if m.ClosedBlock != 0 { - n += 1 + sovHtlc(uint64(m.ClosedBlock)) - } - if m.Transfer { - n += 2 - } - if m.Direction != 0 { - n += 1 + sovHtlc(uint64(m.Direction)) - } - return n -} - -func (m *AssetSupply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.IncomingSupply.Size() - n += 1 + l + sovHtlc(uint64(l)) - l = m.OutgoingSupply.Size() - n += 1 + l + sovHtlc(uint64(l)) - l = m.CurrentSupply.Size() - n += 1 + l + sovHtlc(uint64(l)) - l = m.TimeLimitedCurrentSupply.Size() - n += 1 + l + sovHtlc(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimeElapsed) - n += 1 + l + sovHtlc(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.AssetParams) > 0 { - for _, e := range m.AssetParams { - l = e.Size() - n += 1 + l + sovHtlc(uint64(l)) - } - } - return n -} - -func (m *AssetParam) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - l = m.SupplyLimit.Size() - n += 1 + l + sovHtlc(uint64(l)) - if m.Active { - n += 2 - } - l = len(m.DeputyAddress) - if l > 0 { - n += 1 + l + sovHtlc(uint64(l)) - } - l = m.FixedFee.Size() - n += 1 + l + sovHtlc(uint64(l)) - l = m.MinSwapAmount.Size() - n += 1 + l + sovHtlc(uint64(l)) - l = m.MaxSwapAmount.Size() - n += 1 + l + sovHtlc(uint64(l)) - if m.MinBlockLock != 0 { - n += 1 + sovHtlc(uint64(m.MinBlockLock)) - } - if m.MaxBlockLock != 0 { - n += 1 + sovHtlc(uint64(m.MaxBlockLock)) - } - return n -} - -func (m *SupplyLimit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Limit.Size() - n += 1 + l + sovHtlc(uint64(l)) - if m.TimeLimited { - n += 2 - } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.TimePeriod) - n += 1 + l + sovHtlc(uint64(l)) - l = m.TimeBasedLimit.Size() - n += 1 + l + sovHtlc(uint64(l)) - return n -} - -func sovHtlc(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozHtlc(x uint64) (n int) { - return sovHtlc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *HTLC) 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 ErrIntOverflowHtlc - } - 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: HTLC: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HTLC: 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 ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - 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 Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.To = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiverOnOtherChain", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ReceiverOnOtherChain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SenderOnOtherChain", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SenderOnOtherChain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HashLock", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HashLock = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Secret", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Secret = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpirationHeight", wireType) - } - m.ExpirationHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExpirationHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - 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 ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= HTLCState(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClosedBlock", wireType) - } - m.ClosedBlock = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClosedBlock |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Transfer", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Transfer = bool(v != 0) - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Direction", wireType) - } - m.Direction = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Direction |= SwapDirection(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipHtlc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthHtlc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AssetSupply) 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 ErrIntOverflowHtlc - } - 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: AssetSupply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AssetSupply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncomingSupply", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IncomingSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutgoingSupply", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.OutgoingSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentSupply", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrentSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeLimitedCurrentSupply", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TimeLimitedCurrentSupply.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeElapsed", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.TimeElapsed, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipHtlc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthHtlc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AssetParams = append(m.AssetParams, AssetParam{}) - if err := m.AssetParams[len(m.AssetParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipHtlc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthHtlc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AssetParam) 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 ErrIntOverflowHtlc - } - 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: AssetParam: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AssetParam: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SupplyLimit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SupplyLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Active", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Active = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeputyAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DeputyAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FixedFee", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.FixedFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSwapAmount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinSwapAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSwapAmount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxSwapAmount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinBlockLock", wireType) - } - m.MinBlockLock = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinBlockLock |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxBlockLock", wireType) - } - m.MaxBlockLock = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxBlockLock |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipHtlc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthHtlc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SupplyLimit) 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 ErrIntOverflowHtlc - } - 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: SupplyLimit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SupplyLimit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Limit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeLimited", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TimeLimited = bool(v != 0) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimePeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthHtlc - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.TimePeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeBasedLimit", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowHtlc - } - 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 ErrInvalidLengthHtlc - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthHtlc - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TimeBasedLimit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipHtlc(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthHtlc - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipHtlc(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, ErrIntOverflowHtlc - } - 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, ErrIntOverflowHtlc - } - 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, ErrIntOverflowHtlc - } - 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, ErrInvalidLengthHtlc - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupHtlc - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthHtlc - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthHtlc = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowHtlc = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupHtlc = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/htlc/query.pb.go b/modules/htlc/query.pb.go deleted file mode 100644 index c420684b..00000000 --- a/modules/htlc/query.pb.go +++ /dev/null @@ -1,1668 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: htlc/query.proto - -package htlc - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/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 - -// QueryHTLCRequest is the request type for the Query/HTLC RPC method -type QueryHTLCRequest struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *QueryHTLCRequest) Reset() { *m = QueryHTLCRequest{} } -func (m *QueryHTLCRequest) String() string { return proto.CompactTextString(m) } -func (*QueryHTLCRequest) ProtoMessage() {} -func (*QueryHTLCRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a99e89fd1d8bb804, []int{0} -} -func (m *QueryHTLCRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryHTLCRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryHTLCRequest.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 *QueryHTLCRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryHTLCRequest.Merge(m, src) -} -func (m *QueryHTLCRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryHTLCRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryHTLCRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryHTLCRequest proto.InternalMessageInfo - -func (m *QueryHTLCRequest) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -// QueryBalanceResponse is the response type for the Query/HTLC RPC method -type QueryHTLCResponse struct { - Htlc *HTLC `protobuf:"bytes,1,opt,name=htlc,proto3" json:"htlc,omitempty"` -} - -func (m *QueryHTLCResponse) Reset() { *m = QueryHTLCResponse{} } -func (m *QueryHTLCResponse) String() string { return proto.CompactTextString(m) } -func (*QueryHTLCResponse) ProtoMessage() {} -func (*QueryHTLCResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a99e89fd1d8bb804, []int{1} -} -func (m *QueryHTLCResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryHTLCResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryHTLCResponse.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 *QueryHTLCResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryHTLCResponse.Merge(m, src) -} -func (m *QueryHTLCResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryHTLCResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryHTLCResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryHTLCResponse proto.InternalMessageInfo - -func (m *QueryHTLCResponse) GetHtlc() *HTLC { - if m != nil { - return m.Htlc - } - return nil -} - -// QueryAssetSupplyRequest is request type for the Query/AssetSupply RPC method -type QueryAssetSupplyRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QueryAssetSupplyRequest) Reset() { *m = QueryAssetSupplyRequest{} } -func (m *QueryAssetSupplyRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAssetSupplyRequest) ProtoMessage() {} -func (*QueryAssetSupplyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a99e89fd1d8bb804, []int{2} -} -func (m *QueryAssetSupplyRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAssetSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAssetSupplyRequest.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 *QueryAssetSupplyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAssetSupplyRequest.Merge(m, src) -} -func (m *QueryAssetSupplyRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAssetSupplyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAssetSupplyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAssetSupplyRequest proto.InternalMessageInfo - -func (m *QueryAssetSupplyRequest) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// QueryAssetSupplyResponse is response type for the Query/AssetSupply RPC method -type QueryAssetSupplyResponse struct { - AssetSupply *AssetSupply `protobuf:"bytes,1,opt,name=asset_supply,json=assetSupply,proto3" json:"asset_supply,omitempty" yaml:"asset_supply"` -} - -func (m *QueryAssetSupplyResponse) Reset() { *m = QueryAssetSupplyResponse{} } -func (m *QueryAssetSupplyResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAssetSupplyResponse) ProtoMessage() {} -func (*QueryAssetSupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a99e89fd1d8bb804, []int{3} -} -func (m *QueryAssetSupplyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAssetSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAssetSupplyResponse.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 *QueryAssetSupplyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAssetSupplyResponse.Merge(m, src) -} -func (m *QueryAssetSupplyResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAssetSupplyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAssetSupplyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAssetSupplyResponse proto.InternalMessageInfo - -func (m *QueryAssetSupplyResponse) GetAssetSupply() *AssetSupply { - if m != nil { - return m.AssetSupply - } - return nil -} - -// QueryAssetSuppliesRequest is request type for the Query/AssetSupplies RPC method -type QueryAssetSuppliesRequest struct { -} - -func (m *QueryAssetSuppliesRequest) Reset() { *m = QueryAssetSuppliesRequest{} } -func (m *QueryAssetSuppliesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAssetSuppliesRequest) ProtoMessage() {} -func (*QueryAssetSuppliesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a99e89fd1d8bb804, []int{4} -} -func (m *QueryAssetSuppliesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAssetSuppliesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAssetSuppliesRequest.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 *QueryAssetSuppliesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAssetSuppliesRequest.Merge(m, src) -} -func (m *QueryAssetSuppliesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAssetSuppliesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAssetSuppliesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAssetSuppliesRequest proto.InternalMessageInfo - -// QueryAssetSuppliesResponse is response type for the Query/AssetSupplies RPC method -type QueryAssetSuppliesResponse struct { - AssetSupplies []AssetSupply `protobuf:"bytes,1,rep,name=asset_supplies,json=assetSupplies,proto3" json:"asset_supplies" yaml:"asset_supplies"` -} - -func (m *QueryAssetSuppliesResponse) Reset() { *m = QueryAssetSuppliesResponse{} } -func (m *QueryAssetSuppliesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAssetSuppliesResponse) ProtoMessage() {} -func (*QueryAssetSuppliesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a99e89fd1d8bb804, []int{5} -} -func (m *QueryAssetSuppliesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAssetSuppliesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAssetSuppliesResponse.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 *QueryAssetSuppliesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAssetSuppliesResponse.Merge(m, src) -} -func (m *QueryAssetSuppliesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAssetSuppliesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAssetSuppliesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAssetSuppliesResponse proto.InternalMessageInfo - -func (m *QueryAssetSuppliesResponse) GetAssetSupplies() []AssetSupply { - if m != nil { - return m.AssetSupplies - } - return nil -} - -// QueryParamsRequest is request type for the Query/Parameters 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_a99e89fd1d8bb804, []int{6} -} -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 response type for the Query/Parameters 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_a99e89fd1d8bb804, []int{7} -} -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{} -} - -func init() { - proto.RegisterType((*QueryHTLCRequest)(nil), "irismod.htlc.QueryHTLCRequest") - proto.RegisterType((*QueryHTLCResponse)(nil), "irismod.htlc.QueryHTLCResponse") - proto.RegisterType((*QueryAssetSupplyRequest)(nil), "irismod.htlc.QueryAssetSupplyRequest") - proto.RegisterType((*QueryAssetSupplyResponse)(nil), "irismod.htlc.QueryAssetSupplyResponse") - proto.RegisterType((*QueryAssetSuppliesRequest)(nil), "irismod.htlc.QueryAssetSuppliesRequest") - proto.RegisterType((*QueryAssetSuppliesResponse)(nil), "irismod.htlc.QueryAssetSuppliesResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "irismod.htlc.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "irismod.htlc.QueryParamsResponse") -} - -func init() { proto.RegisterFile("htlc/query.proto", fileDescriptor_a99e89fd1d8bb804) } - -var fileDescriptor_a99e89fd1d8bb804 = []byte{ - // 535 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0xe3, 0x36, 0x8d, 0xc4, 0x4b, 0x5b, 0xca, 0xd5, 0xb4, 0xae, 0x29, 0x8e, 0x39, 0x89, - 0xd0, 0xa5, 0x3e, 0x29, 0x6c, 0x30, 0x11, 0x96, 0x22, 0x31, 0x80, 0x81, 0x85, 0xa5, 0x72, 0xea, - 0x93, 0x73, 0xaa, 0xed, 0x73, 0x72, 0xf6, 0x10, 0x55, 0x59, 0x2a, 0x3e, 0x00, 0x12, 0x5f, 0xaa, - 0x63, 0x25, 0x16, 0xa6, 0x08, 0x25, 0x6c, 0x6c, 0xfd, 0x04, 0xc8, 0xe7, 0x6b, 0x6b, 0x37, 0x21, - 0x5d, 0xec, 0xf3, 0x7b, 0xff, 0xf7, 0xfe, 0x3f, 0xdd, 0x7b, 0x32, 0x6c, 0xf5, 0xd3, 0xf0, 0x84, - 0x0c, 0x32, 0x3a, 0x1c, 0x39, 0xc9, 0x90, 0xa7, 0x1c, 0xad, 0xb3, 0x21, 0x13, 0x11, 0xf7, 0x9d, - 0x3c, 0x63, 0xee, 0x07, 0x9c, 0x07, 0x21, 0x25, 0x5e, 0xc2, 0x88, 0x17, 0xc7, 0x3c, 0xf5, 0x52, - 0xc6, 0x63, 0x51, 0x68, 0xcd, 0x87, 0xb2, 0x3a, 0x7f, 0xa8, 0x80, 0x1e, 0xf0, 0x80, 0xcb, 0x23, - 0xc9, 0x4f, 0x45, 0x14, 0x63, 0xd8, 0xfa, 0x98, 0x3b, 0x1c, 0x7d, 0x7e, 0xff, 0xd6, 0xa5, 0x83, - 0x8c, 0x8a, 0x14, 0x6d, 0xc2, 0x0a, 0xf3, 0x0d, 0xcd, 0xd6, 0x0e, 0x1e, 0xb8, 0x2b, 0xcc, 0xc7, - 0xaf, 0xe1, 0x51, 0x49, 0x23, 0x12, 0x1e, 0x0b, 0x8a, 0xda, 0x50, 0xcf, 0x9b, 0x4b, 0x59, 0xb3, - 0x83, 0x9c, 0x32, 0x9a, 0x23, 0x95, 0x32, 0x8f, 0x09, 0xec, 0xca, 0xe2, 0x37, 0x42, 0xd0, 0xf4, - 0x53, 0x96, 0x24, 0xe1, 0xe8, 0xda, 0x47, 0x87, 0x35, 0x9f, 0xc6, 0x3c, 0x52, 0x56, 0xc5, 0x07, - 0x1e, 0x80, 0x31, 0x5f, 0xa0, 0x4c, 0xbf, 0xc0, 0xba, 0x97, 0x87, 0x8f, 0x85, 0x8c, 0x2b, 0xf3, - 0xbd, 0xaa, 0x79, 0xa9, 0xb0, 0xbb, 0x7b, 0x35, 0x69, 0x6d, 0x8f, 0xbc, 0x28, 0x7c, 0x85, 0xcb, - 0x85, 0xd8, 0x6d, 0x7a, 0xb7, 0x2a, 0xfc, 0x04, 0xf6, 0xee, 0x58, 0x32, 0x2a, 0x14, 0x25, 0x1e, - 0x83, 0xb9, 0x28, 0xa9, 0x88, 0x8e, 0x61, 0xb3, 0xd4, 0x98, 0x51, 0x61, 0x68, 0xf6, 0xea, 0x72, - 0xa6, 0xa7, 0x17, 0x93, 0x56, 0xed, 0x6a, 0xd2, 0x7a, 0x3c, 0xc7, 0xc5, 0xa8, 0xc0, 0xee, 0x86, - 0x57, 0x36, 0xc2, 0x3a, 0x20, 0x69, 0xff, 0xc1, 0x1b, 0x7a, 0xd1, 0x0d, 0xd4, 0x3b, 0xd8, 0xae, - 0x44, 0x15, 0x4d, 0x07, 0x1a, 0x89, 0x8c, 0xa8, 0x9b, 0xd1, 0xab, 0x14, 0x85, 0xba, 0x5b, 0xcf, - 0x01, 0x5c, 0xa5, 0xec, 0xfc, 0x5d, 0x85, 0x35, 0xd9, 0x0b, 0x31, 0xa8, 0xe7, 0x83, 0x43, 0x56, - 0xb5, 0xea, 0xee, 0x7e, 0x98, 0xad, 0xff, 0xe6, 0x0b, 0x0c, 0x6c, 0x9f, 0xff, 0xfc, 0xf3, 0x63, - 0xc5, 0x44, 0x06, 0x51, 0x42, 0x72, 0xb3, 0x8c, 0x82, 0x9c, 0x31, 0x7f, 0x8c, 0xbe, 0x69, 0xd0, - 0x2c, 0xdd, 0x09, 0x7a, 0xbe, 0xa0, 0xe5, 0xfc, 0xc6, 0x98, 0xed, 0xfb, 0x64, 0x0a, 0xa0, 0x2d, - 0x01, 0x6c, 0x64, 0x55, 0x01, 0xae, 0x2f, 0x99, 0x9c, 0xc9, 0x55, 0x1b, 0xa3, 0x73, 0x0d, 0x36, - 0x2a, 0x73, 0x45, 0x2f, 0x96, 0x3a, 0xdc, 0xae, 0x85, 0x79, 0x70, 0xbf, 0x50, 0xc1, 0x58, 0x12, - 0xc6, 0x40, 0x3b, 0x8b, 0x61, 0xd0, 0x29, 0x34, 0x8a, 0xc1, 0x20, 0x7b, 0x41, 0xcf, 0xca, 0xdc, - 0xcd, 0x67, 0x4b, 0x14, 0xca, 0x6e, 0x5f, 0xda, 0xed, 0x20, 0xbd, 0x6a, 0x57, 0x4c, 0xbb, 0x7b, - 0x74, 0x31, 0xb5, 0xb4, 0xcb, 0xa9, 0xa5, 0xfd, 0x9e, 0x5a, 0xda, 0xf7, 0x99, 0x55, 0xbb, 0x9c, - 0x59, 0xb5, 0x5f, 0x33, 0xab, 0xf6, 0xd5, 0x09, 0x58, 0xda, 0xcf, 0x7a, 0xce, 0x09, 0x8f, 0x64, - 0x65, 0x4c, 0x53, 0xf9, 0xee, 0x67, 0xbd, 0x43, 0xe1, 0x9f, 0x1e, 0x06, 0x9c, 0x44, 0xdc, 0xcf, - 0x42, 0x2a, 0x64, 0xc3, 0x5e, 0x43, 0xfe, 0x40, 0x5e, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x98, - 0x3c, 0x8c, 0x8c, 0xa7, 0x04, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// 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 { - // HTLC queries the HTLC by the specified hash lock - HTLC(ctx context.Context, in *QueryHTLCRequest, opts ...grpc.CallOption) (*QueryHTLCResponse, error) - // AssetSupply queries the supply of an asset - AssetSupply(ctx context.Context, in *QueryAssetSupplyRequest, opts ...grpc.CallOption) (*QueryAssetSupplyResponse, error) - // AssetSupplies queries the supplies of all assets - AssetSupplies(ctx context.Context, in *QueryAssetSuppliesRequest, opts ...grpc.CallOption) (*QueryAssetSuppliesResponse, error) - // Params queries the htlc parameters - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) HTLC(ctx context.Context, in *QueryHTLCRequest, opts ...grpc.CallOption) (*QueryHTLCResponse, error) { - out := new(QueryHTLCResponse) - err := c.cc.Invoke(ctx, "/irismod.htlc.Query/HTLC", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AssetSupply(ctx context.Context, in *QueryAssetSupplyRequest, opts ...grpc.CallOption) (*QueryAssetSupplyResponse, error) { - out := new(QueryAssetSupplyResponse) - err := c.cc.Invoke(ctx, "/irismod.htlc.Query/AssetSupply", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AssetSupplies(ctx context.Context, in *QueryAssetSuppliesRequest, opts ...grpc.CallOption) (*QueryAssetSuppliesResponse, error) { - out := new(QueryAssetSuppliesResponse) - err := c.cc.Invoke(ctx, "/irismod.htlc.Query/AssetSupplies", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/irismod.htlc.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // HTLC queries the HTLC by the specified hash lock - HTLC(context.Context, *QueryHTLCRequest) (*QueryHTLCResponse, error) - // AssetSupply queries the supply of an asset - AssetSupply(context.Context, *QueryAssetSupplyRequest) (*QueryAssetSupplyResponse, error) - // AssetSupplies queries the supplies of all assets - AssetSupplies(context.Context, *QueryAssetSuppliesRequest) (*QueryAssetSuppliesResponse, error) - // Params queries the htlc parameters - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) HTLC(ctx context.Context, req *QueryHTLCRequest) (*QueryHTLCResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HTLC not implemented") -} -func (*UnimplementedQueryServer) AssetSupply(ctx context.Context, req *QueryAssetSupplyRequest) (*QueryAssetSupplyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AssetSupply not implemented") -} -func (*UnimplementedQueryServer) AssetSupplies(ctx context.Context, req *QueryAssetSuppliesRequest) (*QueryAssetSuppliesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AssetSupplies not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_HTLC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryHTLCRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).HTLC(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.htlc.Query/HTLC", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).HTLC(ctx, req.(*QueryHTLCRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AssetSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAssetSupplyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AssetSupply(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.htlc.Query/AssetSupply", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AssetSupply(ctx, req.(*QueryAssetSupplyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AssetSupplies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAssetSuppliesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AssetSupplies(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.htlc.Query/AssetSupplies", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AssetSupplies(ctx, req.(*QueryAssetSuppliesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/irismod.htlc.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.htlc.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "HTLC", - Handler: _Query_HTLC_Handler, - }, - { - MethodName: "AssetSupply", - Handler: _Query_AssetSupply_Handler, - }, - { - MethodName: "AssetSupplies", - Handler: _Query_AssetSupplies_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "htlc/query.proto", -} - -func (m *QueryHTLCRequest) 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 *QueryHTLCRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryHTLCRequest) 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 *QueryHTLCResponse) 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 *QueryHTLCResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryHTLCResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Htlc != nil { - { - size, err := m.Htlc.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 *QueryAssetSupplyRequest) 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 *QueryAssetSupplyRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAssetSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAssetSupplyResponse) 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 *QueryAssetSupplyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAssetSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AssetSupply != nil { - { - size, err := m.AssetSupply.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 *QueryAssetSuppliesRequest) 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 *QueryAssetSuppliesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAssetSuppliesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAssetSuppliesResponse) 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 *QueryAssetSuppliesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAssetSuppliesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AssetSupplies) > 0 { - for iNdEx := len(m.AssetSupplies) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AssetSupplies[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 *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 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 *QueryHTLCRequest) 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 *QueryHTLCResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Htlc != nil { - l = m.Htlc.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAssetSupplyRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAssetSupplyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.AssetSupply != nil { - l = m.AssetSupply.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAssetSuppliesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAssetSuppliesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.AssetSupplies) > 0 { - for _, e := range m.AssetSupplies { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -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 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 *QueryHTLCRequest) 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: QueryHTLCRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHTLCRequest: 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 *QueryHTLCResponse) 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: QueryHTLCResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHTLCResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Htlc", 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.Htlc == nil { - m.Htlc = &HTLC{} - } - if err := m.Htlc.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 *QueryAssetSupplyRequest) 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: QueryAssetSupplyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAssetSupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryAssetSupplyResponse) 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: QueryAssetSupplyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAssetSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetSupply", 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.AssetSupply == nil { - m.AssetSupply = &AssetSupply{} - } - if err := m.AssetSupply.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 *QueryAssetSuppliesRequest) 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: QueryAssetSuppliesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAssetSuppliesRequest: 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 *QueryAssetSuppliesResponse) 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: QueryAssetSuppliesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAssetSuppliesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetSupplies", 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.AssetSupplies = append(m.AssetSupplies, AssetSupply{}) - if err := m.AssetSupplies[len(m.AssetSupplies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *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 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/modules/htlc/tx.pb.go b/modules/htlc/tx.pb.go deleted file mode 100644 index d3ca5ba0..00000000 --- a/modules/htlc/tx.pb.go +++ /dev/null @@ -1,1358 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: htlc/tx.proto - -package htlc - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - 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 - -// MsgCreateHTLC defines a message to create an HTLC -type MsgCreateHTLC struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` - ReceiverOnOtherChain string `protobuf:"bytes,3,opt,name=receiver_on_other_chain,json=receiverOnOtherChain,proto3" json:"receiver_on_other_chain,omitempty" yaml:"receiver_on_other_chain"` - SenderOnOtherChain string `protobuf:"bytes,4,opt,name=sender_on_other_chain,json=senderOnOtherChain,proto3" json:"sender_on_other_chain,omitempty" yaml:"sender_on_other_chain"` - Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` - HashLock string `protobuf:"bytes,6,opt,name=hash_lock,json=hashLock,proto3" json:"hash_lock,omitempty" yaml:"hash_lock"` - Timestamp uint64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - TimeLock uint64 `protobuf:"varint,8,opt,name=time_lock,json=timeLock,proto3" json:"time_lock,omitempty" yaml:"time_lock"` - Transfer bool `protobuf:"varint,9,opt,name=transfer,proto3" json:"transfer,omitempty"` -} - -func (m *MsgCreateHTLC) Reset() { *m = MsgCreateHTLC{} } -func (m *MsgCreateHTLC) String() string { return proto.CompactTextString(m) } -func (*MsgCreateHTLC) ProtoMessage() {} -func (*MsgCreateHTLC) Descriptor() ([]byte, []int) { - return fileDescriptor_07729a8273c903af, []int{0} -} -func (m *MsgCreateHTLC) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateHTLC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateHTLC.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 *MsgCreateHTLC) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateHTLC.Merge(m, src) -} -func (m *MsgCreateHTLC) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateHTLC) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateHTLC.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateHTLC proto.InternalMessageInfo - -// MsgCreateHTLCResponse defines the Msg/CreateHTLC response type -type MsgCreateHTLCResponse struct { -} - -func (m *MsgCreateHTLCResponse) Reset() { *m = MsgCreateHTLCResponse{} } -func (m *MsgCreateHTLCResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateHTLCResponse) ProtoMessage() {} -func (*MsgCreateHTLCResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07729a8273c903af, []int{1} -} -func (m *MsgCreateHTLCResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateHTLCResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateHTLCResponse.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 *MsgCreateHTLCResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateHTLCResponse.Merge(m, src) -} -func (m *MsgCreateHTLCResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateHTLCResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateHTLCResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateHTLCResponse proto.InternalMessageInfo - -// MsgClaimHTLC defines a message to claim an HTLC -type MsgClaimHTLC struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty" yaml:"id"` - Secret string `protobuf:"bytes,3,opt,name=secret,proto3" json:"secret,omitempty"` -} - -func (m *MsgClaimHTLC) Reset() { *m = MsgClaimHTLC{} } -func (m *MsgClaimHTLC) String() string { return proto.CompactTextString(m) } -func (*MsgClaimHTLC) ProtoMessage() {} -func (*MsgClaimHTLC) Descriptor() ([]byte, []int) { - return fileDescriptor_07729a8273c903af, []int{2} -} -func (m *MsgClaimHTLC) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgClaimHTLC) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgClaimHTLC.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 *MsgClaimHTLC) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaimHTLC.Merge(m, src) -} -func (m *MsgClaimHTLC) XXX_Size() int { - return m.Size() -} -func (m *MsgClaimHTLC) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaimHTLC.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgClaimHTLC proto.InternalMessageInfo - -// MsgClaimHTLCResponse defines the Msg/ClaimHTLC response type -type MsgClaimHTLCResponse struct { -} - -func (m *MsgClaimHTLCResponse) Reset() { *m = MsgClaimHTLCResponse{} } -func (m *MsgClaimHTLCResponse) String() string { return proto.CompactTextString(m) } -func (*MsgClaimHTLCResponse) ProtoMessage() {} -func (*MsgClaimHTLCResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_07729a8273c903af, []int{3} -} -func (m *MsgClaimHTLCResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgClaimHTLCResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgClaimHTLCResponse.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 *MsgClaimHTLCResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaimHTLCResponse.Merge(m, src) -} -func (m *MsgClaimHTLCResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgClaimHTLCResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaimHTLCResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgClaimHTLCResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateHTLC)(nil), "irismod.htlc.MsgCreateHTLC") - proto.RegisterType((*MsgCreateHTLCResponse)(nil), "irismod.htlc.MsgCreateHTLCResponse") - proto.RegisterType((*MsgClaimHTLC)(nil), "irismod.htlc.MsgClaimHTLC") - proto.RegisterType((*MsgClaimHTLCResponse)(nil), "irismod.htlc.MsgClaimHTLCResponse") -} - -func init() { proto.RegisterFile("htlc/tx.proto", fileDescriptor_07729a8273c903af) } - -var fileDescriptor_07729a8273c903af = []byte{ - // 547 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x31, 0x8f, 0xd3, 0x4c, - 0x10, 0x8d, 0x93, 0x7c, 0xf9, 0xe2, 0xe5, 0x82, 0x90, 0x95, 0xbb, 0x33, 0xe6, 0xb0, 0xa3, 0xa5, - 0x49, 0x13, 0x5b, 0x39, 0x44, 0x73, 0x65, 0xd2, 0x20, 0x91, 0xe3, 0xa4, 0x85, 0x06, 0x9a, 0xc8, - 0xb1, 0x17, 0x7b, 0x95, 0xd8, 0x13, 0x79, 0x37, 0x27, 0xee, 0x5f, 0xf0, 0x13, 0x10, 0x25, 0xbf, - 0x24, 0xe5, 0x95, 0x54, 0x01, 0x92, 0x86, 0x3a, 0x0d, 0x2d, 0x5a, 0x6f, 0x9c, 0x4b, 0x80, 0x3b, - 0x2a, 0xcf, 0xbc, 0x37, 0xf3, 0x66, 0x3c, 0x7e, 0x46, 0x8d, 0x58, 0x4c, 0x02, 0x4f, 0xbc, 0x77, - 0xa7, 0x19, 0x08, 0x30, 0x0e, 0x58, 0xc6, 0x78, 0x02, 0xa1, 0x2b, 0x61, 0xcb, 0x0e, 0x80, 0x27, - 0xc0, 0xbd, 0x91, 0xcf, 0xa9, 0x77, 0xd9, 0x1d, 0x51, 0xe1, 0x77, 0xbd, 0x00, 0x58, 0xaa, 0xaa, - 0xad, 0x66, 0x04, 0x11, 0xe4, 0xa1, 0x27, 0x23, 0x85, 0xe2, 0x9f, 0x15, 0xd4, 0x38, 0xe7, 0x51, - 0x3f, 0xa3, 0xbe, 0xa0, 0xcf, 0x5f, 0x0f, 0xfa, 0xc6, 0x11, 0xaa, 0x71, 0x9a, 0x86, 0x34, 0x33, - 0xb5, 0x96, 0xd6, 0xd6, 0xc9, 0x26, 0x33, 0xee, 0xa3, 0xb2, 0x00, 0xb3, 0x9c, 0x63, 0x65, 0x01, - 0xc6, 0x1b, 0x74, 0x9c, 0xd1, 0x80, 0xb2, 0x4b, 0x9a, 0x0d, 0x21, 0x1d, 0x82, 0x88, 0x69, 0x36, - 0x0c, 0x62, 0x9f, 0xa5, 0x66, 0x45, 0x16, 0xf5, 0xf0, 0x7a, 0xe1, 0xd8, 0x57, 0x7e, 0x32, 0x39, - 0xc3, 0xb7, 0x14, 0x62, 0xd2, 0x2c, 0x98, 0x8b, 0xf4, 0x42, 0xe2, 0x7d, 0x09, 0x1b, 0xaf, 0xd0, - 0xa1, 0x1a, 0xfa, 0xbb, 0x70, 0x35, 0x17, 0x6e, 0xad, 0x17, 0xce, 0x89, 0x12, 0xfe, 0x6b, 0x19, - 0x26, 0x86, 0xc2, 0xf7, 0x44, 0x63, 0x54, 0xf3, 0x13, 0x98, 0xa5, 0xc2, 0xfc, 0xaf, 0x55, 0x69, - 0xdf, 0x3b, 0x7d, 0xe8, 0xaa, 0x83, 0xb9, 0xf2, 0x60, 0xee, 0xe6, 0x60, 0x6e, 0x1f, 0x58, 0xda, - 0x7b, 0x36, 0x5f, 0x38, 0xa5, 0xcf, 0x5f, 0x9d, 0x4e, 0xc4, 0x44, 0x3c, 0x1b, 0xb9, 0x01, 0x24, - 0x9e, 0xbc, 0x75, 0x4a, 0x45, 0xfe, 0x8c, 0x67, 0xa3, 0x0e, 0x0f, 0xc7, 0x9d, 0x08, 0x3c, 0x71, - 0x35, 0xa5, 0x3c, 0xef, 0xe2, 0x64, 0xa3, 0x6f, 0x74, 0x91, 0x1e, 0xfb, 0x3c, 0x1e, 0x4e, 0x20, - 0x18, 0x9b, 0xb5, 0x7c, 0xe5, 0xe6, 0x7a, 0xe1, 0x3c, 0x50, 0x2b, 0x6f, 0x29, 0x4c, 0xea, 0x32, - 0x1e, 0x40, 0x30, 0x36, 0x4e, 0x90, 0x2e, 0x58, 0x42, 0xb9, 0xf0, 0x93, 0xa9, 0xf9, 0x7f, 0x4b, - 0x6b, 0x57, 0xc9, 0x0d, 0x20, 0x05, 0x65, 0xa2, 0x04, 0xeb, 0x92, 0xdd, 0x15, 0xdc, 0x52, 0x98, - 0xd4, 0x65, 0x9c, 0x0b, 0x5a, 0xa8, 0x2e, 0x32, 0x3f, 0xe5, 0xef, 0x68, 0x66, 0xea, 0x2d, 0xad, - 0x5d, 0x27, 0xdb, 0xfc, 0xac, 0xfa, 0xe3, 0xa3, 0xa3, 0xe1, 0x63, 0x74, 0xb8, 0xf7, 0xe1, 0x09, - 0xe5, 0x53, 0x48, 0x39, 0xc5, 0x01, 0x3a, 0x90, 0xc4, 0xc4, 0x67, 0xc9, 0x9d, 0x86, 0x78, 0x8c, - 0xca, 0x2c, 0x54, 0x86, 0xe8, 0x35, 0xd6, 0x0b, 0x47, 0x57, 0xeb, 0xb0, 0x10, 0x93, 0x32, 0x0b, - 0x55, 0x5b, 0x90, 0x51, 0xa1, 0xec, 0x40, 0x36, 0xd9, 0x66, 0xfa, 0x11, 0x6a, 0xee, 0x0e, 0x29, - 0x86, 0x9f, 0x7e, 0xd2, 0x50, 0xe5, 0x9c, 0x47, 0xc6, 0x4b, 0x84, 0x76, 0x3c, 0xf9, 0xc8, 0xdd, - 0xb5, 0xba, 0xbb, 0xb7, 0xb7, 0xf5, 0xe4, 0x0e, 0xb2, 0xd0, 0x35, 0x5e, 0x20, 0xfd, 0xe6, 0x8d, - 0xac, 0x3f, 0x3b, 0x0a, 0xce, 0xc2, 0xb7, 0x73, 0x85, 0x58, 0x6f, 0x30, 0xff, 0x6e, 0x97, 0xe6, - 0x4b, 0x5b, 0xbb, 0x5e, 0xda, 0xda, 0xb7, 0xa5, 0xad, 0x7d, 0x58, 0xd9, 0xa5, 0xeb, 0x95, 0x5d, - 0xfa, 0xb2, 0xb2, 0x4b, 0x6f, 0xdd, 0x7f, 0xbb, 0x26, 0x81, 0x70, 0x36, 0xa1, 0xdc, 0x93, 0x23, - 0x46, 0xb5, 0xfc, 0x4f, 0x7c, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x41, 0xc1, 0x22, 0x85, 0xde, - 0x03, 0x00, 0x00, -} - -func (this *MsgCreateHTLC) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgCreateHTLC) - if !ok { - that2, ok := that.(MsgCreateHTLC) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Sender != that1.Sender { - return false - } - if this.To != that1.To { - return false - } - if this.ReceiverOnOtherChain != that1.ReceiverOnOtherChain { - return false - } - if this.SenderOnOtherChain != that1.SenderOnOtherChain { - return false - } - if len(this.Amount) != len(that1.Amount) { - return false - } - for i := range this.Amount { - if !this.Amount[i].Equal(&that1.Amount[i]) { - return false - } - } - if this.HashLock != that1.HashLock { - return false - } - if this.Timestamp != that1.Timestamp { - return false - } - if this.TimeLock != that1.TimeLock { - return false - } - if this.Transfer != that1.Transfer { - return false - } - return true -} -func (this *MsgClaimHTLC) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgClaimHTLC) - if !ok { - that2, ok := that.(MsgClaimHTLC) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Sender != that1.Sender { - return false - } - if this.Id != that1.Id { - return false - } - if this.Secret != that1.Secret { - return false - } - return true -} - -// 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 { - // CreateHTLC defines a method for creating a HTLC - CreateHTLC(ctx context.Context, in *MsgCreateHTLC, opts ...grpc.CallOption) (*MsgCreateHTLCResponse, error) - // ClaimHTLC defines a method for claiming a HTLC - ClaimHTLC(ctx context.Context, in *MsgClaimHTLC, opts ...grpc.CallOption) (*MsgClaimHTLCResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateHTLC(ctx context.Context, in *MsgCreateHTLC, opts ...grpc.CallOption) (*MsgCreateHTLCResponse, error) { - out := new(MsgCreateHTLCResponse) - err := c.cc.Invoke(ctx, "/irismod.htlc.Msg/CreateHTLC", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) ClaimHTLC(ctx context.Context, in *MsgClaimHTLC, opts ...grpc.CallOption) (*MsgClaimHTLCResponse, error) { - out := new(MsgClaimHTLCResponse) - err := c.cc.Invoke(ctx, "/irismod.htlc.Msg/ClaimHTLC", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateHTLC defines a method for creating a HTLC - CreateHTLC(context.Context, *MsgCreateHTLC) (*MsgCreateHTLCResponse, error) - // ClaimHTLC defines a method for claiming a HTLC - ClaimHTLC(context.Context, *MsgClaimHTLC) (*MsgClaimHTLCResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateHTLC(ctx context.Context, req *MsgCreateHTLC) (*MsgCreateHTLCResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateHTLC not implemented") -} -func (*UnimplementedMsgServer) ClaimHTLC(ctx context.Context, req *MsgClaimHTLC) (*MsgClaimHTLCResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClaimHTLC not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateHTLC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateHTLC) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateHTLC(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.htlc.Msg/CreateHTLC", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateHTLC(ctx, req.(*MsgCreateHTLC)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_ClaimHTLC_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgClaimHTLC) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).ClaimHTLC(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.htlc.Msg/ClaimHTLC", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).ClaimHTLC(ctx, req.(*MsgClaimHTLC)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.htlc.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateHTLC", - Handler: _Msg_CreateHTLC_Handler, - }, - { - MethodName: "ClaimHTLC", - Handler: _Msg_ClaimHTLC_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "htlc/tx.proto", -} - -func (m *MsgCreateHTLC) 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 *MsgCreateHTLC) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateHTLC) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Transfer { - i-- - if m.Transfer { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.TimeLock != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeLock)) - i-- - dAtA[i] = 0x40 - } - if m.Timestamp != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x38 - } - if len(m.HashLock) > 0 { - i -= len(m.HashLock) - copy(dAtA[i:], m.HashLock) - i = encodeVarintTx(dAtA, i, uint64(len(m.HashLock))) - i-- - dAtA[i] = 0x32 - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.SenderOnOtherChain) > 0 { - i -= len(m.SenderOnOtherChain) - copy(dAtA[i:], m.SenderOnOtherChain) - i = encodeVarintTx(dAtA, i, uint64(len(m.SenderOnOtherChain))) - i-- - dAtA[i] = 0x22 - } - if len(m.ReceiverOnOtherChain) > 0 { - i -= len(m.ReceiverOnOtherChain) - copy(dAtA[i:], m.ReceiverOnOtherChain) - i = encodeVarintTx(dAtA, i, uint64(len(m.ReceiverOnOtherChain))) - i-- - dAtA[i] = 0x1a - } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintTx(dAtA, i, uint64(len(m.To))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateHTLCResponse) 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 *MsgCreateHTLCResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateHTLCResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgClaimHTLC) 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 *MsgClaimHTLC) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgClaimHTLC) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Secret) > 0 { - i -= len(m.Secret) - copy(dAtA[i:], m.Secret) - i = encodeVarintTx(dAtA, i, uint64(len(m.Secret))) - i-- - dAtA[i] = 0x1a - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgClaimHTLCResponse) 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 *MsgClaimHTLCResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgClaimHTLCResponse) 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 *MsgCreateHTLC) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.To) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ReceiverOnOtherChain) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.SenderOnOtherChain) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.HashLock) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Timestamp != 0 { - n += 1 + sovTx(uint64(m.Timestamp)) - } - if m.TimeLock != 0 { - n += 1 + sovTx(uint64(m.TimeLock)) - } - if m.Transfer { - n += 2 - } - return n -} - -func (m *MsgCreateHTLCResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgClaimHTLC) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Id) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Secret) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgClaimHTLCResponse) 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 *MsgCreateHTLC) 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: MsgCreateHTLC: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateHTLC: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiverOnOtherChain", 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.ReceiverOnOtherChain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SenderOnOtherChain", 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.SenderOnOtherChain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HashLock", 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.HashLock = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeLock", wireType) - } - m.TimeLock = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimeLock |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Transfer", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Transfer = bool(v != 0) - 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 *MsgCreateHTLCResponse) 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: MsgCreateHTLCResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateHTLCResponse: 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 *MsgClaimHTLC) 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: MsgClaimHTLC: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaimHTLC: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Secret", 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.Secret = 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 *MsgClaimHTLCResponse) 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: MsgClaimHTLCResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaimHTLCResponse: 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/modules/htlc/types.go b/modules/htlc/types.go deleted file mode 100644 index 9ccb0d67..00000000 --- a/modules/htlc/types.go +++ /dev/null @@ -1,141 +0,0 @@ -package htlc - -import ( - "encoding/hex" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "htlc" - - SecretLength = 64 // length for the secret in bytes - HashLockLength = 64 // length for the hash lock in bytes - HTLCIDLength = 64 // HTLCIDLength is the length for the hash lock in hex string - MaxLengthForAddressOnOtherChain = 128 // maximum length for the address on other chains - MinTimeLock = 50 // minimum time span for HTLC - MaxTimeLock = 25480 // maximum time span for HTLC -) - -var ( - _ sdk.Msg = &MsgCreateHTLC{} - _ sdk.Msg = &MsgClaimHTLC{} -) - -func (msg MsgCreateHTLC) Route() string { return ModuleName } - -func (msg MsgCreateHTLC) Type() string { return "create_htlc" } - -func (msg MsgCreateHTLC) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdk.Wrapf("invalid sender address (%s)", err) - } - if len(msg.To) == 0 { - return sdk.Wrapf("recipient missing") - } - if len(msg.ReceiverOnOtherChain) > MaxLengthForAddressOnOtherChain { - return sdk.Wrapf("length of the receiver on other chain must be between [0,%d]", MaxLengthForAddressOnOtherChain) - } - if !msg.Amount.IsValid() || !msg.Amount.IsAllPositive() { - return sdk.Wrapf("the transferred amount must be valid") - } - if _, err := hex.DecodeString(msg.HashLock); err != nil { - return sdk.Wrapf("hash lock must be a hex encoded string") - } - if len(msg.HashLock) != HashLockLength { - return sdk.Wrapf("length of the hash lock must be %d in bytes", HashLockLength) - } - if msg.TimeLock < MinTimeLock || msg.TimeLock > MaxTimeLock { - return sdk.Wrapf("the time lock must be between [%d,%d]", MinTimeLock, MaxTimeLock) - } - return nil -} - -func (msg MsgCreateHTLC) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgCreateHTLC) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - panic(err) - } - return []sdk.AccAddress{from} -} - -func (msg MsgClaimHTLC) Route() string { return ModuleName } - -func (msg MsgClaimHTLC) Type() string { return "claim_htlc" } - -func (msg MsgClaimHTLC) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { - return sdk.Wrapf("invalid sender address (%s)", err) - } - if _, err := hex.DecodeString(msg.Id); err != nil { - return sdk.Wrapf("htlc id must be a hex encoded string") - } - if len(msg.Id) != HTLCIDLength { - return sdk.Wrapf("length of the htlc id must be %d in bytes", HashLockLength) - } - if _, err := hex.DecodeString(msg.Secret); err != nil { - return sdk.Wrapf("secret must be a hex encoded string") - } - if len(msg.Secret) != SecretLength { - return sdk.Wrapf("length of the secret must be %d in bytes", SecretLength) - } - return nil -} - -func (msg MsgClaimHTLC) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgClaimHTLC) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - panic(err) - } - return []sdk.AccAddress{from} -} - -func (h HTLC) Convert() interface{} { - return QueryHTLCResp{ - Sender: h.Sender, - To: h.To, - ReceiverOnOtherChain: h.ReceiverOnOtherChain, - SenderOnOtherChain: h.SenderOnOtherChain, - Amount: h.Amount, - Secret: h.Secret, - Timestamp: h.Timestamp, - ExpirationHeight: h.ExpirationHeight, - State: int32(h.State), - Transfer: h.Transfer, - } -} - -func (h Params) Convert() interface{} { - var params []AssetParamDto - for _, val := range h.AssetParams { - params = append(params, AssetParamDto{ - Denom: val.Denom, - Active: val.Active, - DeputyAddress: val.DeputyAddress, - FixedFee: val.FixedFee.Uint64(), - MinSwapAmount: val.MinSwapAmount.Uint64(), - MinBlockLock: val.MinBlockLock, - MaxSwapAmount: val.MaxSwapAmount.Uint64(), - MaxBlockLock: val.MaxBlockLock, - SupplyLimit: SupplyLimitDto{ - Limit: val.SupplyLimit.Limit.Uint64(), - TimeLimited: val.SupplyLimit.TimeLimited, - TimePeriod: int64(val.SupplyLimit.TimePeriod), - TimeBasedLimit: val.SupplyLimit.TimeBasedLimit.Uint64(), - }, - }) - } - return QueryParamsResp{ - AssetParams: params, - } -} diff --git a/modules/keys.go b/modules/keys.go deleted file mode 100644 index 27318c60..00000000 --- a/modules/keys.go +++ /dev/null @@ -1,164 +0,0 @@ -package modules - -import ( - "fmt" - - tmcrypto "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/crypto" - cryptoamino "github.com/irisnet/irishub-sdk-go/crypto/codec" - "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/store" -) - -type keyManager struct { - keyDAO store.KeyDAO - algo string -} - -func (k keyManager) Sign(name, password string, data []byte) ([]byte, tmcrypto.PubKey, error) { - info, err := k.keyDAO.Read(name, password) - if err != nil { - return nil, nil, fmt.Errorf("name %s not exist", name) - } - - km, err := crypto.NewPrivateKeyManager([]byte(info.PrivKeyArmor), string(info.Algo)) - if err != nil { - return nil, nil, fmt.Errorf("name %s not exist", name) - } - - signByte, err := km.Sign(data) - if err != nil { - return nil, nil, err - } - - return signByte, km.ExportPubKey(), nil -} - -func (k keyManager) Insert(name, password string) (string, string, error) { - if k.keyDAO.Has(name) { - return "", "", fmt.Errorf("name %s has existed", name) - } - - km, err := crypto.NewAlgoKeyManager(k.algo) - if err != nil { - return "", "", err - } - - mnemonic, priv := km.Generate() - - pubKey := km.ExportPubKey() - address := types.AccAddress(pubKey.Address().Bytes()).String() - - info := store.KeyInfo{ - Name: name, - PubKey: cryptoamino.MarshalPubkey(pubKey), - PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.algo, - } - - if err = k.keyDAO.Write(name, password, info); err != nil { - return "", "", err - } - return address, mnemonic, nil -} - -func (k keyManager) Recover(name, password, mnemonic, hdPath string) (string, error) { - if k.keyDAO.Has(name) { - return "", fmt.Errorf("name %s has existed", name) - } - - var ( - km crypto.KeyManager - err error - ) - - if hdPath == "" { - km, err = crypto.NewMnemonicKeyManager(mnemonic, k.algo) - } else { - km, err = crypto.NewMnemonicKeyManagerWithHDPath(mnemonic, k.algo, hdPath) - } - - if err != nil { - return "", err - } - - _, priv := km.Generate() - - pubKey := km.ExportPubKey() - address := types.AccAddress(pubKey.Address().Bytes()).String() - - info := store.KeyInfo{ - Name: name, - PubKey: cryptoamino.MarshalPubkey(pubKey), - PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.algo, - } - - if err = k.keyDAO.Write(name, password, info); err != nil { - return "", err - } - - return address, nil -} - -func (k keyManager) Import(name, password, armor string) (string, error) { - if k.keyDAO.Has(name) { - return "", fmt.Errorf("%s has existed", name) - } - - km := crypto.NewKeyManager() - - priv, _, err := km.ImportPrivKey(armor, password) - if err != nil { - return "", err - } - - pubKey := km.ExportPubKey() - address := types.AccAddress(pubKey.Address().Bytes()).String() - - info := store.KeyInfo{ - Name: name, - PubKey: cryptoamino.MarshalPubkey(pubKey), - PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.algo, - } - - err = k.keyDAO.Write(name, password, info) - if err != nil { - return "", err - } - return address, nil -} - -func (k keyManager) Export(name, password string) (armor string, err error) { - info, err := k.keyDAO.Read(name, password) - if err != nil { - return armor, fmt.Errorf("name %s not exist", name) - } - - km, err := crypto.NewPrivateKeyManager([]byte(info.PrivKeyArmor), info.Algo) - if err != nil { - return "", err - } - - return km.ExportPrivKey(password) -} - -func (k keyManager) Delete(name, password string) error { - return k.keyDAO.Delete(name, password) -} - -func (k keyManager) Find(name, password string) (tmcrypto.PubKey, types.AccAddress, error) { - info, err := k.keyDAO.Read(name, password) - if err != nil { - return nil, nil, types.WrapWithMessage(err, "name %s not exist", name) - } - - pubKey, err := cryptoamino.PubKeyFromBytes(info.PubKey) - if err != nil { - return nil, nil, types.WrapWithMessage(err, "name %s not exist", name) - } - - return pubKey, types.AccAddress(pubKey.Address().Bytes()), nil -} diff --git a/modules/keys/doc.go b/modules/keys/doc.go deleted file mode 100644 index 1ce83fdf..00000000 --- a/modules/keys/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Package keys allows you to manage your local tendermint keystore (wallets) for iris. -// -// **NOTE:** You need to implement the [[KeyDAO]] Interface first. -// -// As a quick start: -// -// CreateRecord a new key. -// -// client := test.NewClient() -// name, password := "test2", "1234567890" -// -// address, mnemonic, err := client.KeyI.Add(name, password) -// require.NoError(client.T(), err) -// require.NotEmpty(client.T(), address) -// require.NotEmpty(client.T(), mnemonic) -// -package keys diff --git a/modules/keys/export.go b/modules/keys/export.go deleted file mode 100644 index 5e6c7e61..00000000 --- a/modules/keys/export.go +++ /dev/null @@ -1,15 +0,0 @@ -package keys - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type Client interface { - Add(name, password string) (address string, mnemonic string, err sdk.Error) - Recover(name, password, mnemonic string) (address string, err sdk.Error) - RecoverWithHDPath(name, password, mnemonic, hdPath string) (address string, err sdk.Error) - Import(name, password, privKeyArmor string) (address string, err sdk.Error) - Export(name, password string) (privKeyArmor string, err sdk.Error) - Delete(name, password string) sdk.Error - Show(name, password string) (string, sdk.Error) -} diff --git a/modules/keys/keys.go b/modules/keys/keys.go deleted file mode 100644 index 8fae3719..00000000 --- a/modules/keys/keys.go +++ /dev/null @@ -1,51 +0,0 @@ -package keys - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type keysClient struct { - sdk.KeyManager -} - -func NewClient(keyManager sdk.KeyManager) Client { - return keysClient{keyManager} -} - -func (k keysClient) Add(name, password string) (string, string, sdk.Error) { - address, mnemonic, err := k.Insert(name, password) - return address, mnemonic, sdk.Wrap(err) -} - -func (k keysClient) Recover(name, password, mnemonic string) (string, sdk.Error) { - address, err := k.KeyManager.Recover(name, password, mnemonic, "") - return address, sdk.Wrap(err) -} - -func (k keysClient) RecoverWithHDPath(name, password, mnemonic, hdPath string) (string, sdk.Error) { - address, err := k.KeyManager.Recover(name, password, mnemonic, hdPath) - return address, sdk.Wrap(err) -} - -func (k keysClient) Import(name, password, privKeyArmor string) (string, sdk.Error) { - address, err := k.KeyManager.Import(name, password, privKeyArmor) - return address, sdk.Wrap(err) -} - -func (k keysClient) Export(name, password string) (string, sdk.Error) { - keystore, err := k.KeyManager.Export(name, password) - return keystore, sdk.Wrap(err) -} - -func (k keysClient) Delete(name, password string) sdk.Error { - err := k.KeyManager.Delete(name, password) - return sdk.Wrap(err) -} - -func (k keysClient) Show(name, password string) (string, sdk.Error) { - _, address, err := k.KeyManager.Find(name, password) - if err != nil { - return "", sdk.Wrap(err) - } - return address.String(), nil -} diff --git a/modules/nft/codec.go b/modules/nft/codec.go deleted file mode 100644 index 0b4bb447..00000000 --- a/modules/nft/codec.go +++ /dev/null @@ -1,29 +0,0 @@ -package nft - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgIssueDenom{}, - &MsgMintNFT{}, - &MsgEditNFT{}, - &MsgTransferNFT{}, - &MsgBurnNFT{}, - ) -} diff --git a/modules/nft/export.go b/modules/nft/export.go deleted file mode 100644 index 04b88a41..00000000 --- a/modules/nft/export.go +++ /dev/null @@ -1,90 +0,0 @@ -package nft - -import sdk "github.com/irisnet/irishub-sdk-go/types" - -// expose NFT module api for user -type Client interface { - sdk.Module - - IssueDenom(request IssueDenomRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - MintNFT(request MintNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - EditNFT(request EditNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - TransferNFT(request TransferNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - BurnNFT(request BurnNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - - QuerySupply(denomID, creator string) (uint64, sdk.Error) - QueryOwner(creator, denomID string) (QueryOwnerResp, sdk.Error) - QueryCollection(denomID string) (QueryCollectionResp, sdk.Error) - QueryDenom(denomID string) (QueryDenomResp, sdk.Error) - QueryDenoms() ([]QueryDenomResp, sdk.Error) - QueryNFT(denomID, tokenID string) (QueryNFTResp, sdk.Error) -} - -type IssueDenomRequest struct { - ID string `json:"id"` - Name string `json:"name"` - Schema string `json:"schema"` -} - -type MintNFTRequest struct { - Denom string `json:"denom"` - ID string `json:"id"` - Name string `json:"name"` - URI string `json:"uri"` - Data string `json:"data"` - Recipient string `json:"recipient"` -} - -type EditNFTRequest struct { - Denom string `json:"denom"` - ID string `json:"id"` - Name string `json:"name"` - URI string `json:"uri"` - Data string `json:"data"` -} - -type TransferNFTRequest struct { - Denom string `json:"denom"` - ID string `json:"id"` - URI string `json:"uri"` - Data string `json:"data"` - Name string `json:"name"` - Recipient string `json:"recipient"` -} - -type BurnNFTRequest struct { - Denom string `json:"denom"` - ID string `json:"id"` -} - -// IDC defines a set of nft ids that belong to a specific -type IDC struct { - Denom string `json:"denom" yaml:"denom"` - TokenIDs []string `json:"token_ids" yaml:"token_ids"` -} - -type QueryOwnerResp struct { - Address string `json:"address" yaml:"address"` - IDCs []IDC `json:"idcs" yaml:"idcs"` -} - -// BaseNFT non fungible token definition -type QueryNFTResp struct { - ID string `json:"id"` - Name string `json:"name"` - URI string `json:"uri"` - Data string `json:"data"` - Creator string `json:"creator"` -} - -type QueryDenomResp struct { - ID string `json:"id"` - Name string `json:"name"` - Schema string `json:"schema"` - Creator string `json:"creator"` -} - -type QueryCollectionResp struct { - Denom QueryDenomResp `json:"denom" yaml:"denom"` - NFTs []QueryNFTResp `json:"nfts" yaml:"nfts"` -} diff --git a/modules/nft/nft.go b/modules/nft/nft.go deleted file mode 100644 index fbff311d..00000000 --- a/modules/nft/nft.go +++ /dev/null @@ -1,269 +0,0 @@ -package nft - -import ( - "context" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type nftClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { - return nftClient{ - BaseClient: bc, - Marshaler: cdc, - } -} - -func (nc nftClient) Name() string { - return ModuleName -} - -func (nc nftClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (nc nftClient) IssueDenom(request IssueDenomRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgIssueDenom{ - Id: request.ID, - Name: request.Name, - Schema: request.Schema, - Sender: sender.String(), - } - return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (nc nftClient) MintNFT(request MintNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - var recipient = sender.String() - if len(request.Recipient) > 0 { - if err := sdk.ValidateAccAddress(request.Recipient); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - recipient = request.Recipient - } - - msg := &MsgMintNFT{ - Id: request.ID, - DenomId: request.Denom, - Name: request.Name, - URI: request.URI, - Data: request.Data, - Sender: sender.String(), - Recipient: recipient, - } - return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (nc nftClient) EditNFT(request EditNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgEditNFT{ - Id: request.ID, - Name: request.Name, - DenomId: request.Denom, - URI: request.URI, - Data: request.Data, - Sender: sender.String(), - } - return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (nc nftClient) TransferNFT(request TransferNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if err := sdk.ValidateAccAddress(request.Recipient); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgTransferNFT{ - Id: request.ID, - Name: request.Name, - DenomId: request.Denom, - URI: request.URI, - Data: request.Data, - Sender: sender.String(), - Recipient: request.Recipient, - } - return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (nc nftClient) BurnNFT(request BurnNFTRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := nc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgBurnNFT{ - Sender: sender.String(), - Id: request.ID, - DenomId: request.Denom, - } - return nc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (nc nftClient) QuerySupply(denom, creator string) (uint64, sdk.Error) { - if len(denom) == 0 { - return 0, sdk.Wrapf("denom is required") - } - - if err := sdk.ValidateAccAddress(creator); err != nil { - return 0, sdk.Wrap(err) - } - - conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return 0, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Supply( - context.Background(), - &QuerySupplyRequest{ - Owner: creator, - DenomId: denom, - }, - ) - if err != nil { - return 0, sdk.Wrap(err) - } - - return res.Amount, nil -} - -func (nc nftClient) QueryOwner(creator, denom string) (QueryOwnerResp, sdk.Error) { - if len(denom) == 0 { - return QueryOwnerResp{}, sdk.Wrapf("denom is required") - } - - if err := sdk.ValidateAccAddress(creator); err != nil { - return QueryOwnerResp{}, sdk.Wrap(err) - } - - conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryOwnerResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Owner( - context.Background(), - &QueryOwnerRequest{ - Owner: creator, - DenomId: denom, - }, - ) - if err != nil { - return QueryOwnerResp{}, sdk.Wrap(err) - } - - return res.Owner.Convert().(QueryOwnerResp), nil -} - -func (nc nftClient) QueryCollection(denom string) (QueryCollectionResp, sdk.Error) { - if len(denom) == 0 { - return QueryCollectionResp{}, sdk.Wrapf("denom is required") - } - - conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryCollectionResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Collection( - context.Background(), - &QueryCollectionRequest{DenomId: denom}, - ) - if err != nil { - return QueryCollectionResp{}, sdk.Wrap(err) - } - - return res.Collection.Convert().(QueryCollectionResp), nil -} - -func (nc nftClient) QueryDenoms() ([]QueryDenomResp, sdk.Error) { - conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Denoms( - context.Background(), - &QueryDenomsRequest{}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - - return denoms(res.Denoms).Convert().([]QueryDenomResp), nil -} - -func (nc nftClient) QueryDenom(denom string) (QueryDenomResp, sdk.Error) { - conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryDenomResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Denom( - context.Background(), - &QueryDenomRequest{DenomId: denom}, - ) - if err != nil { - return QueryDenomResp{}, sdk.Wrap(err) - } - - return res.Denom.Convert().(QueryDenomResp), nil -} - -func (nc nftClient) QueryNFT(denom, tokenID string) (QueryNFTResp, sdk.Error) { - if len(denom) == 0 { - return QueryNFTResp{}, sdk.Wrapf("denom is required") - } - - if len(tokenID) == 0 { - return QueryNFTResp{}, sdk.Wrapf("tokenID is required") - } - - conn, err := nc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryNFTResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).NFT( - context.Background(), - &QueryNFTRequest{ - DenomId: denom, - TokenId: tokenID, - }, - ) - if err != nil { - return QueryNFTResp{}, sdk.Wrap(err) - } - - return res.NFT.Convert().(QueryNFTResp), nil -} diff --git a/modules/nft/nft.pb.go b/modules/nft/nft.pb.go deleted file mode 100644 index 7ee31434..00000000 --- a/modules/nft/nft.pb.go +++ /dev/null @@ -1,1615 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nft/nft.proto - -package nft - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// BaseNFT defines a non fungible token. -type BaseNFT struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - URI string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"` - Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` - Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *BaseNFT) Reset() { *m = BaseNFT{} } -func (m *BaseNFT) String() string { return proto.CompactTextString(m) } -func (*BaseNFT) ProtoMessage() {} -func (*BaseNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{0} -} -func (m *BaseNFT) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BaseNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BaseNFT.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 *BaseNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_BaseNFT.Merge(m, src) -} -func (m *BaseNFT) XXX_Size() int { - return m.Size() -} -func (m *BaseNFT) XXX_DiscardUnknown() { - xxx_messageInfo_BaseNFT.DiscardUnknown(m) -} - -var xxx_messageInfo_BaseNFT proto.InternalMessageInfo - -// Denom defines a type of NFT. -type Denom struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Schema string `protobuf:"bytes,3,opt,name=schema,proto3" json:"schema,omitempty"` - Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` -} - -func (m *Denom) Reset() { *m = Denom{} } -func (m *Denom) String() string { return proto.CompactTextString(m) } -func (*Denom) ProtoMessage() {} -func (*Denom) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{1} -} -func (m *Denom) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Denom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Denom.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 *Denom) XXX_Merge(src proto.Message) { - xxx_messageInfo_Denom.Merge(m, src) -} -func (m *Denom) XXX_Size() int { - return m.Size() -} -func (m *Denom) XXX_DiscardUnknown() { - xxx_messageInfo_Denom.DiscardUnknown(m) -} - -var xxx_messageInfo_Denom proto.InternalMessageInfo - -type IDCollection struct { - DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - TokenIds []string `protobuf:"bytes,2,rep,name=token_ids,json=tokenIds,proto3" json:"token_ids,omitempty" yaml:"token_ids"` -} - -func (m *IDCollection) Reset() { *m = IDCollection{} } -func (m *IDCollection) String() string { return proto.CompactTextString(m) } -func (*IDCollection) ProtoMessage() {} -func (*IDCollection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{2} -} -func (m *IDCollection) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IDCollection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IDCollection.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 *IDCollection) XXX_Merge(src proto.Message) { - xxx_messageInfo_IDCollection.Merge(m, src) -} -func (m *IDCollection) XXX_Size() int { - return m.Size() -} -func (m *IDCollection) XXX_DiscardUnknown() { - xxx_messageInfo_IDCollection.DiscardUnknown(m) -} - -var xxx_messageInfo_IDCollection proto.InternalMessageInfo - -type Owner struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - IDCollections []IDCollection `protobuf:"bytes,2,rep,name=id_collections,json=idCollections,proto3" json:"id_collections" yaml:"idcs"` -} - -func (m *Owner) Reset() { *m = Owner{} } -func (m *Owner) String() string { return proto.CompactTextString(m) } -func (*Owner) ProtoMessage() {} -func (*Owner) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{3} -} -func (m *Owner) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Owner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Owner.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 *Owner) XXX_Merge(src proto.Message) { - xxx_messageInfo_Owner.Merge(m, src) -} -func (m *Owner) XXX_Size() int { - return m.Size() -} -func (m *Owner) XXX_DiscardUnknown() { - xxx_messageInfo_Owner.DiscardUnknown(m) -} - -var xxx_messageInfo_Owner proto.InternalMessageInfo - -type Collection struct { - Denom Denom `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom"` - NFTs []BaseNFT `protobuf:"bytes,2,rep,name=nfts,proto3" json:"nfts"` -} - -func (m *Collection) Reset() { *m = Collection{} } -func (m *Collection) String() string { return proto.CompactTextString(m) } -func (*Collection) ProtoMessage() {} -func (*Collection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{4} -} -func (m *Collection) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Collection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Collection.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 *Collection) XXX_Merge(src proto.Message) { - xxx_messageInfo_Collection.Merge(m, src) -} -func (m *Collection) XXX_Size() int { - return m.Size() -} -func (m *Collection) XXX_DiscardUnknown() { - xxx_messageInfo_Collection.DiscardUnknown(m) -} - -var xxx_messageInfo_Collection proto.InternalMessageInfo - -func init() { - proto.RegisterType((*BaseNFT)(nil), "irismod.nft.BaseNFT") - proto.RegisterType((*Denom)(nil), "irismod.nft.Denom") - proto.RegisterType((*IDCollection)(nil), "irismod.nft.IDCollection") - proto.RegisterType((*Owner)(nil), "irismod.nft.Owner") - proto.RegisterType((*Collection)(nil), "irismod.nft.Collection") -} - -func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } - -var fileDescriptor_fe8ab7e15b7f0646 = []byte{ - // 472 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x6e, 0xd3, 0x30, - 0x18, 0xc7, 0x93, 0x36, 0x59, 0x57, 0x77, 0x1d, 0xc8, 0x54, 0x28, 0xe3, 0x90, 0x4c, 0x11, 0x87, - 0x5d, 0x9a, 0x8a, 0x21, 0x71, 0xd8, 0x31, 0x4c, 0x93, 0x2a, 0xa4, 0x21, 0x59, 0xe3, 0xc2, 0xa5, - 0x4a, 0x63, 0xa7, 0xb5, 0xd6, 0xd8, 0x28, 0x76, 0x35, 0xe0, 0x25, 0xe0, 0x11, 0x78, 0x9c, 0x1e, - 0x77, 0xe4, 0x14, 0x41, 0x7a, 0xe1, 0xdc, 0x27, 0x40, 0xb6, 0x93, 0x2a, 0xbd, 0xed, 0x94, 0xef, - 0xfb, 0xfb, 0x9f, 0xfc, 0xfe, 0x5f, 0xfc, 0x81, 0x21, 0xcb, 0xe4, 0x84, 0x65, 0x32, 0xfa, 0x52, - 0x70, 0xc9, 0xe1, 0x80, 0x16, 0x54, 0xe4, 0x1c, 0x47, 0x2c, 0x93, 0xaf, 0x46, 0x0b, 0xbe, 0xe0, - 0x5a, 0x9f, 0xa8, 0xca, 0x58, 0xc2, 0xaf, 0xa0, 0x17, 0x27, 0x82, 0xdc, 0xde, 0xdc, 0xc1, 0x53, - 0xd0, 0xa1, 0xd8, 0xb3, 0xcf, 0xed, 0x8b, 0x3e, 0xea, 0x50, 0x0c, 0x21, 0x70, 0x58, 0x92, 0x13, - 0xaf, 0xa3, 0x15, 0x5d, 0xc3, 0x33, 0xd0, 0x5d, 0x17, 0xd4, 0xeb, 0x2a, 0x29, 0xee, 0x55, 0x65, - 0xd0, 0xfd, 0x84, 0xa6, 0x48, 0x69, 0xca, 0x8e, 0x13, 0x99, 0x78, 0x8e, 0xb1, 0xab, 0x1a, 0x8e, - 0x80, 0xcb, 0x1f, 0x18, 0x29, 0x3c, 0x57, 0x8b, 0xa6, 0xb9, 0x72, 0xfe, 0xfd, 0x0a, 0xec, 0x30, - 0x05, 0xee, 0x35, 0x61, 0x3c, 0x7f, 0x12, 0xf7, 0x25, 0x38, 0x12, 0xe9, 0x92, 0xe4, 0x89, 0x41, - 0xa3, 0xba, 0x83, 0x1e, 0xe8, 0xa5, 0x05, 0x49, 0x24, 0x2f, 0x6a, 0x6e, 0xd3, 0xd6, 0x90, 0x07, - 0x70, 0x32, 0xbd, 0x7e, 0xcf, 0x57, 0x2b, 0x92, 0x4a, 0xca, 0x19, 0x8c, 0xc0, 0x31, 0x56, 0xd0, - 0x59, 0x43, 0x8c, 0x5f, 0xec, 0xca, 0xe0, 0xd9, 0xb7, 0x24, 0x5f, 0x5d, 0x85, 0xcd, 0x49, 0x88, - 0x7a, 0xba, 0x9c, 0x62, 0xf8, 0x06, 0xf4, 0x25, 0xbf, 0x27, 0x6c, 0x46, 0xb1, 0xf0, 0x3a, 0xe7, - 0xdd, 0x8b, 0x7e, 0x3c, 0xda, 0x95, 0xc1, 0x73, 0xf3, 0xc2, 0xfe, 0x28, 0x44, 0xc7, 0xba, 0x9e, - 0x62, 0x51, 0x83, 0x7f, 0xd8, 0xc0, 0xfd, 0xa8, 0xa6, 0x55, 0x11, 0x13, 0x8c, 0x0b, 0x22, 0x44, - 0x3d, 0x63, 0xd3, 0xc2, 0x0c, 0x9c, 0x52, 0x3c, 0x4b, 0xf7, 0xe9, 0x0c, 0x61, 0x70, 0x79, 0x16, - 0xb5, 0xee, 0x2d, 0x6a, 0xe7, 0x8f, 0x5f, 0x6f, 0xca, 0xc0, 0xaa, 0xca, 0x60, 0xd8, 0x56, 0xc5, - 0xae, 0x0c, 0x06, 0x26, 0x11, 0xc5, 0xa9, 0x08, 0xd1, 0x90, 0xe2, 0xd6, 0x69, 0x9d, 0xe8, 0x3b, - 0x00, 0x07, 0x3f, 0xc2, 0xd5, 0x33, 0xea, 0x4c, 0x83, 0x4b, 0x78, 0x80, 0xd4, 0xf7, 0x12, 0x3b, - 0x8a, 0x85, 0x8c, 0x0d, 0xbe, 0x03, 0x0e, 0xcb, 0x64, 0x93, 0x70, 0x74, 0x60, 0xaf, 0x17, 0x28, - 0x3e, 0xa9, 0xc3, 0x39, 0xb7, 0x37, 0x77, 0x02, 0x69, 0xbf, 0x61, 0xc7, 0x1f, 0x36, 0x7f, 0x7d, - 0x6b, 0x53, 0xf9, 0xf6, 0x63, 0xe5, 0xdb, 0x7f, 0x2a, 0xdf, 0xfe, 0xb9, 0xf5, 0xad, 0xc7, 0xad, - 0x6f, 0xfd, 0xde, 0xfa, 0xd6, 0xe7, 0xf1, 0x82, 0xca, 0xe5, 0x7a, 0x1e, 0xa5, 0x3c, 0x9f, 0xa8, - 0xef, 0x32, 0x22, 0xf5, 0x73, 0xb9, 0x9e, 0x8f, 0x05, 0xbe, 0x1f, 0x2f, 0xf8, 0x24, 0xe7, 0x78, - 0xbd, 0x22, 0x42, 0xed, 0xf6, 0xfc, 0x48, 0x6f, 0xee, 0xdb, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x67, 0xaa, 0x4a, 0x2a, 0xed, 0x02, 0x00, 0x00, -} - -func (this *BaseNFT) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*BaseNFT) - if !ok { - that2, ok := that.(BaseNFT) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.Name != that1.Name { - return false - } - if this.URI != that1.URI { - return false - } - if this.Data != that1.Data { - return false - } - if this.Owner != that1.Owner { - return false - } - return true -} -func (this *Denom) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Denom) - if !ok { - that2, ok := that.(Denom) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.Name != that1.Name { - return false - } - if this.Schema != that1.Schema { - return false - } - if this.Creator != that1.Creator { - return false - } - return true -} -func (this *IDCollection) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*IDCollection) - if !ok { - that2, ok := that.(IDCollection) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.DenomId != that1.DenomId { - return false - } - if len(this.TokenIds) != len(that1.TokenIds) { - return false - } - for i := range this.TokenIds { - if this.TokenIds[i] != that1.TokenIds[i] { - return false - } - } - return true -} -func (this *Owner) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Owner) - if !ok { - that2, ok := that.(Owner) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Address != that1.Address { - return false - } - if len(this.IDCollections) != len(that1.IDCollections) { - return false - } - for i := range this.IDCollections { - if !this.IDCollections[i].Equal(&that1.IDCollections[i]) { - return false - } - } - return true -} -func (this *Collection) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Collection) - if !ok { - that2, ok := that.(Collection) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Denom.Equal(&that1.Denom) { - return false - } - if len(this.NFTs) != len(that1.NFTs) { - return false - } - for i := range this.NFTs { - if !this.NFTs[i].Equal(&that1.NFTs[i]) { - return false - } - } - return true -} -func (m *BaseNFT) 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 *BaseNFT) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BaseNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintNft(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x2a - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintNft(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x22 - } - if len(m.URI) > 0 { - i -= len(m.URI) - copy(dAtA[i:], m.URI) - i = encodeVarintNft(dAtA, i, uint64(len(m.URI))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintNft(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintNft(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Denom) 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 *Denom) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintNft(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0x22 - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarintNft(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintNft(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintNft(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *IDCollection) 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 *IDCollection) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IDCollection) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TokenIds) > 0 { - for iNdEx := len(m.TokenIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TokenIds[iNdEx]) - copy(dAtA[i:], m.TokenIds[iNdEx]) - i = encodeVarintNft(dAtA, i, uint64(len(m.TokenIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintNft(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Owner) 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 *Owner) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Owner) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.IDCollections) > 0 { - for iNdEx := len(m.IDCollections) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.IDCollections[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNft(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintNft(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Collection) 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 *Collection) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Collection) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NFTs) > 0 { - for iNdEx := len(m.NFTs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.NFTs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNft(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Denom.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNft(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintNft(dAtA []byte, offset int, v uint64) int { - offset -= sovNft(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BaseNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - l = len(m.URI) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - return n -} - -func (m *Denom) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - l = len(m.Schema) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - return n -} - -func (m *IDCollection) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - if len(m.TokenIds) > 0 { - for _, s := range m.TokenIds { - l = len(s) - n += 1 + l + sovNft(uint64(l)) - } - } - return n -} - -func (m *Owner) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovNft(uint64(l)) - } - if len(m.IDCollections) > 0 { - for _, e := range m.IDCollections { - l = e.Size() - n += 1 + l + sovNft(uint64(l)) - } - } - return n -} - -func (m *Collection) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Denom.Size() - n += 1 + l + sovNft(uint64(l)) - if len(m.NFTs) > 0 { - for _, e := range m.NFTs { - l = e.Size() - n += 1 + l + sovNft(uint64(l)) - } - } - return n -} - -func sovNft(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozNft(x uint64) (n int) { - return sovNft(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BaseNFT) 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 ErrIntOverflowNft - } - 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: BaseNFT: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BaseNFT: 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 ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - 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 Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field URI", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.URI = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - 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 ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNft(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNft - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Denom) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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: Denom: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Denom: 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 ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - 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 Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - 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 ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNft(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNft - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IDCollection) 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 ErrIntOverflowNft - } - 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: IDCollection: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IDCollection: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DenomId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TokenIds = append(m.TokenIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNft(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNft - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Owner) 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 ErrIntOverflowNft - } - 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: Owner: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Owner: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - 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 ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IDCollections", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNft - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IDCollections = append(m.IDCollections, IDCollection{}) - if err := m.IDCollections[len(m.IDCollections)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNft(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNft - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Collection) 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 ErrIntOverflowNft - } - 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: Collection: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Collection: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNft - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Denom.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NFTs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNft - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthNft - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NFTs = append(m.NFTs, BaseNFT{}) - if err := m.NFTs[len(m.NFTs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNft(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNft - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipNft(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, ErrIntOverflowNft - } - 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, ErrIntOverflowNft - } - 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, ErrIntOverflowNft - } - 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, ErrInvalidLengthNft - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupNft - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthNft - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthNft = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowNft = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupNft = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/nft/query.pb.go b/modules/nft/query.pb.go deleted file mode 100644 index 6e11ef7c..00000000 --- a/modules/nft/query.pb.go +++ /dev/null @@ -1,2642 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nft/query.proto - -package nft - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/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 - -// QuerySupplyRequest is the request type for the Query/HTLC RPC method -type QuerySupplyRequest struct { - DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *QuerySupplyRequest) Reset() { *m = QuerySupplyRequest{} } -func (m *QuerySupplyRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySupplyRequest) ProtoMessage() {} -func (*QuerySupplyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{0} -} -func (m *QuerySupplyRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySupplyRequest.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 *QuerySupplyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupplyRequest.Merge(m, src) -} -func (m *QuerySupplyRequest) XXX_Size() int { - return m.Size() -} -func (m *QuerySupplyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupplyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySupplyRequest proto.InternalMessageInfo - -func (m *QuerySupplyRequest) GetDenomId() string { - if m != nil { - return m.DenomId - } - return "" -} - -func (m *QuerySupplyRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -// QuerySupplyResponse is the response type for the Query/Supply RPC method -type QuerySupplyResponse struct { - Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` -} - -func (m *QuerySupplyResponse) Reset() { *m = QuerySupplyResponse{} } -func (m *QuerySupplyResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySupplyResponse) ProtoMessage() {} -func (*QuerySupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{1} -} -func (m *QuerySupplyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySupplyResponse.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 *QuerySupplyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupplyResponse.Merge(m, src) -} -func (m *QuerySupplyResponse) XXX_Size() int { - return m.Size() -} -func (m *QuerySupplyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupplyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySupplyResponse proto.InternalMessageInfo - -func (m *QuerySupplyResponse) GetAmount() uint64 { - if m != nil { - return m.Amount - } - return 0 -} - -// QueryOwnerRequest is the request type for the Query/Owner RPC method -type QueryOwnerRequest struct { - DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *QueryOwnerRequest) Reset() { *m = QueryOwnerRequest{} } -func (m *QueryOwnerRequest) String() string { return proto.CompactTextString(m) } -func (*QueryOwnerRequest) ProtoMessage() {} -func (*QueryOwnerRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{2} -} -func (m *QueryOwnerRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOwnerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOwnerRequest.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 *QueryOwnerRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOwnerRequest.Merge(m, src) -} -func (m *QueryOwnerRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryOwnerRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOwnerRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOwnerRequest proto.InternalMessageInfo - -func (m *QueryOwnerRequest) GetDenomId() string { - if m != nil { - return m.DenomId - } - return "" -} - -func (m *QueryOwnerRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -// QueryOwnerResponse is the response type for the Query/Owner RPC method -type QueryOwnerResponse struct { - Owner *Owner `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *QueryOwnerResponse) Reset() { *m = QueryOwnerResponse{} } -func (m *QueryOwnerResponse) String() string { return proto.CompactTextString(m) } -func (*QueryOwnerResponse) ProtoMessage() {} -func (*QueryOwnerResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{3} -} -func (m *QueryOwnerResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOwnerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOwnerResponse.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 *QueryOwnerResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOwnerResponse.Merge(m, src) -} -func (m *QueryOwnerResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryOwnerResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOwnerResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOwnerResponse proto.InternalMessageInfo - -func (m *QueryOwnerResponse) GetOwner() *Owner { - if m != nil { - return m.Owner - } - return nil -} - -// QueryCollectionRequest is the request type for the Query/Collection RPC -// method -type QueryCollectionRequest struct { - DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` -} - -func (m *QueryCollectionRequest) Reset() { *m = QueryCollectionRequest{} } -func (m *QueryCollectionRequest) String() string { return proto.CompactTextString(m) } -func (*QueryCollectionRequest) ProtoMessage() {} -func (*QueryCollectionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{4} -} -func (m *QueryCollectionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryCollectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryCollectionRequest.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 *QueryCollectionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCollectionRequest.Merge(m, src) -} -func (m *QueryCollectionRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryCollectionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCollectionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryCollectionRequest proto.InternalMessageInfo - -func (m *QueryCollectionRequest) GetDenomId() string { - if m != nil { - return m.DenomId - } - return "" -} - -// QueryCollectionResponse is the response type for the Query/Collection RPC -// method -type QueryCollectionResponse struct { - Collection *Collection `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` -} - -func (m *QueryCollectionResponse) Reset() { *m = QueryCollectionResponse{} } -func (m *QueryCollectionResponse) String() string { return proto.CompactTextString(m) } -func (*QueryCollectionResponse) ProtoMessage() {} -func (*QueryCollectionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{5} -} -func (m *QueryCollectionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryCollectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryCollectionResponse.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 *QueryCollectionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryCollectionResponse.Merge(m, src) -} -func (m *QueryCollectionResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryCollectionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryCollectionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryCollectionResponse proto.InternalMessageInfo - -func (m *QueryCollectionResponse) GetCollection() *Collection { - if m != nil { - return m.Collection - } - return nil -} - -// QueryDenomRequest is the request type for the Query/Denom RPC method -type QueryDenomRequest struct { - DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` -} - -func (m *QueryDenomRequest) Reset() { *m = QueryDenomRequest{} } -func (m *QueryDenomRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDenomRequest) ProtoMessage() {} -func (*QueryDenomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{6} -} -func (m *QueryDenomRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomRequest.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 *QueryDenomRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomRequest.Merge(m, src) -} -func (m *QueryDenomRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomRequest proto.InternalMessageInfo - -func (m *QueryDenomRequest) GetDenomId() string { - if m != nil { - return m.DenomId - } - return "" -} - -// QueryDenomResponse is the response type for the Query/Denom RPC method -type QueryDenomResponse struct { - Denom *Denom `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QueryDenomResponse) Reset() { *m = QueryDenomResponse{} } -func (m *QueryDenomResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDenomResponse) ProtoMessage() {} -func (*QueryDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{7} -} -func (m *QueryDenomResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomResponse.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 *QueryDenomResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomResponse.Merge(m, src) -} -func (m *QueryDenomResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomResponse proto.InternalMessageInfo - -func (m *QueryDenomResponse) GetDenom() *Denom { - if m != nil { - return m.Denom - } - return nil -} - -// QueryDenomsRequest is the request type for the Query/Denoms RPC method -type QueryDenomsRequest struct { -} - -func (m *QueryDenomsRequest) Reset() { *m = QueryDenomsRequest{} } -func (m *QueryDenomsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDenomsRequest) ProtoMessage() {} -func (*QueryDenomsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{8} -} -func (m *QueryDenomsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomsRequest.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 *QueryDenomsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomsRequest.Merge(m, src) -} -func (m *QueryDenomsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomsRequest proto.InternalMessageInfo - -// QueryDenomsResponse is the response type for the Query/Denoms RPC method -type QueryDenomsResponse struct { - Denoms []Denom `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms"` -} - -func (m *QueryDenomsResponse) Reset() { *m = QueryDenomsResponse{} } -func (m *QueryDenomsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDenomsResponse) ProtoMessage() {} -func (*QueryDenomsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{9} -} -func (m *QueryDenomsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDenomsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDenomsResponse.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 *QueryDenomsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDenomsResponse.Merge(m, src) -} -func (m *QueryDenomsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDenomsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDenomsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDenomsResponse proto.InternalMessageInfo - -func (m *QueryDenomsResponse) GetDenoms() []Denom { - if m != nil { - return m.Denoms - } - return nil -} - -// QueryNFTRequest is the request type for the Query/NFT RPC method -type QueryNFTRequest struct { - DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - TokenId string `protobuf:"bytes,2,opt,name=token_id,json=tokenId,proto3" json:"token_id,omitempty" yaml:"token_id"` -} - -func (m *QueryNFTRequest) Reset() { *m = QueryNFTRequest{} } -func (m *QueryNFTRequest) String() string { return proto.CompactTextString(m) } -func (*QueryNFTRequest) ProtoMessage() {} -func (*QueryNFTRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{10} -} -func (m *QueryNFTRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNFTRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNFTRequest.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 *QueryNFTRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTRequest.Merge(m, src) -} -func (m *QueryNFTRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryNFTRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNFTRequest proto.InternalMessageInfo - -func (m *QueryNFTRequest) GetDenomId() string { - if m != nil { - return m.DenomId - } - return "" -} - -func (m *QueryNFTRequest) GetTokenId() string { - if m != nil { - return m.TokenId - } - return "" -} - -// QueryNFTResponse is the response type for the Query/NFT RPC method -type QueryNFTResponse struct { - NFT *BaseNFT `protobuf:"bytes,1,opt,name=nft,proto3" json:"nft,omitempty"` -} - -func (m *QueryNFTResponse) Reset() { *m = QueryNFTResponse{} } -func (m *QueryNFTResponse) String() string { return proto.CompactTextString(m) } -func (*QueryNFTResponse) ProtoMessage() {} -func (*QueryNFTResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce02d034d3adf2e9, []int{11} -} -func (m *QueryNFTResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryNFTResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryNFTResponse.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 *QueryNFTResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryNFTResponse.Merge(m, src) -} -func (m *QueryNFTResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryNFTResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryNFTResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryNFTResponse proto.InternalMessageInfo - -func (m *QueryNFTResponse) GetNFT() *BaseNFT { - if m != nil { - return m.NFT - } - return nil -} - -func init() { - proto.RegisterType((*QuerySupplyRequest)(nil), "irismod.nft.QuerySupplyRequest") - proto.RegisterType((*QuerySupplyResponse)(nil), "irismod.nft.QuerySupplyResponse") - proto.RegisterType((*QueryOwnerRequest)(nil), "irismod.nft.QueryOwnerRequest") - proto.RegisterType((*QueryOwnerResponse)(nil), "irismod.nft.QueryOwnerResponse") - proto.RegisterType((*QueryCollectionRequest)(nil), "irismod.nft.QueryCollectionRequest") - proto.RegisterType((*QueryCollectionResponse)(nil), "irismod.nft.QueryCollectionResponse") - proto.RegisterType((*QueryDenomRequest)(nil), "irismod.nft.QueryDenomRequest") - proto.RegisterType((*QueryDenomResponse)(nil), "irismod.nft.QueryDenomResponse") - proto.RegisterType((*QueryDenomsRequest)(nil), "irismod.nft.QueryDenomsRequest") - proto.RegisterType((*QueryDenomsResponse)(nil), "irismod.nft.QueryDenomsResponse") - proto.RegisterType((*QueryNFTRequest)(nil), "irismod.nft.QueryNFTRequest") - proto.RegisterType((*QueryNFTResponse)(nil), "irismod.nft.QueryNFTResponse") -} - -func init() { proto.RegisterFile("nft/query.proto", fileDescriptor_ce02d034d3adf2e9) } - -var fileDescriptor_ce02d034d3adf2e9 = []byte{ - // 665 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x4f, 0x13, 0x41, - 0x18, 0xee, 0x02, 0x2d, 0xf8, 0x12, 0x83, 0x0e, 0x15, 0x48, 0x81, 0x6d, 0x33, 0xf8, 0x81, 0x1f, - 0xdd, 0x31, 0x78, 0x30, 0xf1, 0xe0, 0xa1, 0x18, 0x90, 0x0b, 0xc6, 0x95, 0x8b, 0x5c, 0x4c, 0x61, - 0xa7, 0xa5, 0x61, 0x77, 0x66, 0xe9, 0xcc, 0xc6, 0x10, 0x42, 0x4c, 0x8c, 0x3f, 0xc0, 0xc4, 0x3f, - 0xc5, 0x4d, 0x12, 0x2f, 0x9e, 0x88, 0x29, 0xfe, 0x02, 0x7f, 0x81, 0x99, 0xd9, 0x59, 0xbb, 0xeb, - 0xb6, 0xc4, 0x34, 0x9e, 0x76, 0x3e, 0x9e, 0xf7, 0x79, 0x9e, 0x79, 0xfb, 0x3e, 0x29, 0xcc, 0xb0, - 0x96, 0x24, 0x47, 0x11, 0xed, 0x1e, 0x3b, 0x61, 0x97, 0x4b, 0x8e, 0xa6, 0x3b, 0xdd, 0x8e, 0x08, - 0xb8, 0xe7, 0xb0, 0x96, 0xac, 0x94, 0xdb, 0xbc, 0xcd, 0xf5, 0x39, 0x51, 0xab, 0x18, 0x52, 0x59, - 0x6a, 0x73, 0xde, 0xf6, 0x29, 0x69, 0x86, 0x1d, 0xd2, 0x64, 0x8c, 0xcb, 0xa6, 0xec, 0x70, 0x26, - 0xcc, 0xed, 0x75, 0xc5, 0xc8, 0x5a, 0x32, 0xde, 0xe2, 0x5d, 0x40, 0xaf, 0x15, 0xfd, 0x9b, 0x28, - 0x0c, 0xfd, 0x63, 0x97, 0x1e, 0x45, 0x54, 0x48, 0xe4, 0xc0, 0x94, 0x47, 0x19, 0x0f, 0xde, 0x75, - 0xbc, 0x05, 0xab, 0x66, 0xad, 0x5e, 0x6b, 0xcc, 0xfe, 0xba, 0xa8, 0xce, 0x1c, 0x37, 0x03, 0xff, - 0x19, 0x4e, 0x6e, 0xb0, 0x3b, 0xa9, 0x97, 0x5b, 0x1e, 0x2a, 0x43, 0x91, 0xbf, 0x67, 0xb4, 0xbb, - 0x30, 0xa6, 0xc0, 0x6e, 0xbc, 0xc1, 0x75, 0x98, 0xcd, 0x70, 0x8b, 0x90, 0x33, 0x41, 0xd1, 0x1c, - 0x94, 0x9a, 0x01, 0x8f, 0x98, 0xd4, 0xd4, 0x13, 0xae, 0xd9, 0xe1, 0xb7, 0x70, 0x53, 0xc3, 0x5f, - 0xa9, 0xe2, 0xff, 0xeb, 0xe4, 0xb9, 0x79, 0xa5, 0xa1, 0x36, 0x46, 0x56, 0x13, 0xac, 0x22, 0x9e, - 0x5e, 0x43, 0x4e, 0xaa, 0xb7, 0x4e, 0x0c, 0x35, 0xf5, 0x2f, 0x61, 0x4e, 0xd7, 0xaf, 0x73, 0xdf, - 0xa7, 0xfb, 0xaa, 0x9d, 0x23, 0xfa, 0xc3, 0x2e, 0xcc, 0xe7, 0x98, 0x8c, 0x9d, 0xa7, 0x00, 0xfb, - 0x7f, 0x4e, 0x8d, 0xa7, 0xf9, 0x8c, 0xa7, 0x54, 0x51, 0x0a, 0x8a, 0xd7, 0x4d, 0xe3, 0x5e, 0x28, - 0x8d, 0x51, 0x8d, 0x25, 0x2d, 0x32, 0x24, 0xfd, 0x16, 0x69, 0xc0, 0xc0, 0x16, 0xc5, 0xd0, 0x18, - 0x80, 0xcb, 0xe9, 0x7a, 0x61, 0x5c, 0xe0, 0x4d, 0x33, 0x02, 0xc9, 0xa9, 0xa1, 0x7d, 0x0c, 0x25, - 0x5d, 0x25, 0x16, 0xac, 0xda, 0xf8, 0x60, 0xde, 0xc6, 0xc4, 0xd9, 0x45, 0xb5, 0xe0, 0x1a, 0x1c, - 0x3e, 0x82, 0x19, 0x4d, 0xb4, 0xbd, 0xb1, 0x33, 0xea, 0x68, 0x38, 0x30, 0x25, 0xf9, 0x21, 0x65, - 0x0a, 0x3f, 0xf6, 0x37, 0x3e, 0xb9, 0xc1, 0xee, 0xa4, 0x5e, 0x6e, 0x79, 0x78, 0x1d, 0x6e, 0xf4, - 0x25, 0x8d, 0x71, 0x02, 0xe3, 0xac, 0x25, 0x4d, 0x37, 0xca, 0x19, 0xd7, 0x8d, 0xa6, 0xa0, 0xdb, - 0x1b, 0x3b, 0x8d, 0xc9, 0xde, 0x45, 0x75, 0x5c, 0xd5, 0x28, 0xe4, 0xda, 0xd7, 0x22, 0x14, 0x35, - 0x0b, 0xfa, 0x00, 0xa5, 0x38, 0x08, 0xa8, 0x9a, 0xa9, 0xcb, 0xc7, 0xaf, 0x52, 0x1b, 0x0e, 0x88, - 0x7d, 0xe0, 0xb5, 0x8f, 0xdf, 0x7e, 0x7e, 0x19, 0x7b, 0x84, 0x1e, 0x10, 0x83, 0x54, 0x91, 0x26, - 0xfd, 0x99, 0x10, 0xe4, 0x24, 0xe9, 0xc0, 0x29, 0x11, 0xb1, 0x6c, 0x00, 0x45, 0x3d, 0xd4, 0xc8, - 0xce, 0xd3, 0xa7, 0x33, 0x57, 0xa9, 0x0e, 0xbd, 0x37, 0xea, 0x2b, 0x5a, 0x7d, 0x19, 0x2d, 0x66, - 0xd4, 0x75, 0x54, 0x04, 0x39, 0xd1, 0xdf, 0x53, 0xf4, 0xc9, 0x02, 0xe8, 0x0f, 0x2c, 0x5a, 0xc9, - 0x93, 0xe6, 0xd2, 0x54, 0xb9, 0x7d, 0x35, 0xc8, 0xc8, 0x3f, 0xd4, 0xf2, 0x77, 0xd0, 0xca, 0x3f, - 0x3c, 0x1e, 0x85, 0x50, 0xd4, 0xf3, 0x34, 0xe8, 0xd5, 0xe9, 0xc0, 0x0c, 0x7a, 0x75, 0x26, 0x0b, - 0xf8, 0xae, 0x96, 0xad, 0x21, 0x3b, 0x23, 0x1b, 0xcf, 0x67, 0x5a, 0xf1, 0x00, 0x4a, 0xf1, 0xb8, - 0xa3, 0x61, 0x94, 0xe2, 0x8a, 0x1f, 0x3a, 0x9b, 0x14, 0xbc, 0xa8, 0x45, 0x6f, 0xa1, 0xd9, 0x01, - 0xa2, 0x48, 0x80, 0x1a, 0x34, 0xb4, 0x94, 0x67, 0xe9, 0xc7, 0xa4, 0xb2, 0x3c, 0xe4, 0xd6, 0x08, - 0x10, 0x2d, 0x70, 0x1f, 0xdd, 0xcb, 0x08, 0xb0, 0x96, 0xcc, 0x8c, 0xd0, 0x49, 0x92, 0x8f, 0xd3, - 0xc6, 0xe6, 0x59, 0xcf, 0xb6, 0xce, 0x7b, 0xb6, 0xf5, 0xa3, 0x67, 0x5b, 0x9f, 0x2f, 0xed, 0xc2, - 0xf9, 0xa5, 0x5d, 0xf8, 0x7e, 0x69, 0x17, 0x76, 0xeb, 0xed, 0x8e, 0x3c, 0x88, 0xf6, 0x9c, 0x7d, - 0x1e, 0x68, 0x32, 0x46, 0xa5, 0xfe, 0x1e, 0x44, 0x7b, 0x75, 0xe1, 0x1d, 0xd6, 0xdb, 0x9c, 0x04, - 0xdc, 0x8b, 0x7c, 0x2a, 0x14, 0xff, 0x5e, 0x49, 0xff, 0x03, 0x3d, 0xf9, 0x1d, 0x00, 0x00, 0xff, - 0xff, 0x40, 0xb6, 0x0e, 0xd9, 0xe4, 0x06, 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 { - // Supply queries the total supply of a given denom or owner - Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) - // Owner queries the NFTs of the specified owner - Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) - // Collection queries the NFTs of the specified denom - Collection(ctx context.Context, in *QueryCollectionRequest, opts ...grpc.CallOption) (*QueryCollectionResponse, error) - // Denom queries the definition of a given denom - Denom(ctx context.Context, in *QueryDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) - // Denoms queries all the denoms - Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) - // NFT queries the NFT for the given denom and token ID - NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Supply(ctx context.Context, in *QuerySupplyRequest, opts ...grpc.CallOption) (*QuerySupplyResponse, error) { - out := new(QuerySupplyResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Query/Supply", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Owner(ctx context.Context, in *QueryOwnerRequest, opts ...grpc.CallOption) (*QueryOwnerResponse, error) { - out := new(QueryOwnerResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Query/Owner", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Collection(ctx context.Context, in *QueryCollectionRequest, opts ...grpc.CallOption) (*QueryCollectionResponse, error) { - out := new(QueryCollectionResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Query/Collection", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Denom(ctx context.Context, in *QueryDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) { - out := new(QueryDenomResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Query/Denom", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) { - out := new(QueryDenomsResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Query/Denoms", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) { - out := new(QueryNFTResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Query/NFT", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Supply queries the total supply of a given denom or owner - Supply(context.Context, *QuerySupplyRequest) (*QuerySupplyResponse, error) - // Owner queries the NFTs of the specified owner - Owner(context.Context, *QueryOwnerRequest) (*QueryOwnerResponse, error) - // Collection queries the NFTs of the specified denom - Collection(context.Context, *QueryCollectionRequest) (*QueryCollectionResponse, error) - // Denom queries the definition of a given denom - Denom(context.Context, *QueryDenomRequest) (*QueryDenomResponse, error) - // Denoms queries all the denoms - Denoms(context.Context, *QueryDenomsRequest) (*QueryDenomsResponse, error) - // NFT queries the NFT for the given denom and token ID - NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Supply(ctx context.Context, req *QuerySupplyRequest) (*QuerySupplyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Supply not implemented") -} -func (*UnimplementedQueryServer) Owner(ctx context.Context, req *QueryOwnerRequest) (*QueryOwnerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Owner not implemented") -} -func (*UnimplementedQueryServer) Collection(ctx context.Context, req *QueryCollectionRequest) (*QueryCollectionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Collection not implemented") -} -func (*UnimplementedQueryServer) Denom(ctx context.Context, req *QueryDenomRequest) (*QueryDenomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Denom not implemented") -} -func (*UnimplementedQueryServer) Denoms(ctx context.Context, req *QueryDenomsRequest) (*QueryDenomsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Denoms not implemented") -} -func (*UnimplementedQueryServer) NFT(ctx context.Context, req *QueryNFTRequest) (*QueryNFTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NFT not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Supply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySupplyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Supply(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.nft.Query/Supply", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Supply(ctx, req.(*QuerySupplyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Owner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOwnerRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Owner(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.nft.Query/Owner", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Owner(ctx, req.(*QueryOwnerRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Collection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryCollectionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Collection(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.nft.Query/Collection", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Collection(ctx, req.(*QueryCollectionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Denom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDenomRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Denom(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.nft.Query/Denom", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Denom(ctx, req.(*QueryDenomRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Denoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDenomsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Denoms(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.nft.Query/Denoms", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Denoms(ctx, req.(*QueryDenomsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_NFT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryNFTRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).NFT(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.nft.Query/NFT", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).NFT(ctx, req.(*QueryNFTRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.nft.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Supply", - Handler: _Query_Supply_Handler, - }, - { - MethodName: "Owner", - Handler: _Query_Owner_Handler, - }, - { - MethodName: "Collection", - Handler: _Query_Collection_Handler, - }, - { - MethodName: "Denom", - Handler: _Query_Denom_Handler, - }, - { - MethodName: "Denoms", - Handler: _Query_Denoms_Handler, - }, - { - MethodName: "NFT", - Handler: _Query_NFT_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "nft/query.proto", -} - -func (m *QuerySupplyRequest) 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 *QuerySupplyRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QuerySupplyResponse) 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 *QuerySupplyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Amount != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Amount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryOwnerRequest) 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 *QueryOwnerRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOwnerRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryOwnerResponse) 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 *QueryOwnerResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOwnerResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Owner != nil { - { - size, err := m.Owner.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 *QueryCollectionRequest) 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 *QueryCollectionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryCollectionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryCollectionResponse) 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 *QueryCollectionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryCollectionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Collection != nil { - { - size, err := m.Collection.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 *QueryDenomRequest) 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 *QueryDenomRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDenomResponse) 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 *QueryDenomResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Denom != nil { - { - size, err := m.Denom.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 *QueryDenomsRequest) 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 *QueryDenomsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryDenomsResponse) 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 *QueryDenomsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denoms) > 0 { - for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Denoms[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 *QueryNFTRequest) 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 *QueryNFTRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNFTRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.TokenId) > 0 { - i -= len(m.TokenId) - copy(dAtA[i:], m.TokenId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.TokenId))) - i-- - dAtA[i] = 0x12 - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryNFTResponse) 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 *QueryNFTResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.NFT != nil { - { - size, err := m.NFT.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 *QuerySupplyRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QuerySupplyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Amount != 0 { - n += 1 + sovQuery(uint64(m.Amount)) - } - return n -} - -func (m *QueryOwnerRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryOwnerResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Owner != nil { - l = m.Owner.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryCollectionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryCollectionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Collection != nil { - l = m.Collection.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDenomRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDenomResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Denom != nil { - l = m.Denom.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDenomsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryDenomsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Denoms) > 0 { - for _, e := range m.Denoms { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryNFTRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.TokenId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryNFTResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.NFT != nil { - l = m.NFT.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 *QuerySupplyRequest) 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: QuerySupplyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupplyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 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.Owner = 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 *QuerySupplyResponse) 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: QuerySupplyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryOwnerRequest) 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: QueryOwnerRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOwnerRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 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.Owner = 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 *QueryOwnerResponse) 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: QueryOwnerResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOwnerResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner == nil { - m.Owner = &Owner{} - } - if err := m.Owner.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 *QueryCollectionRequest) 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: QueryCollectionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCollectionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 *QueryCollectionResponse) 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: QueryCollectionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryCollectionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Collection", 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.Collection == nil { - m.Collection = &Collection{} - } - if err := m.Collection.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 *QueryDenomRequest) 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: QueryDenomRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = 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 *QueryDenomResponse) 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: QueryDenomResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom == nil { - m.Denom = &Denom{} - } - if err := m.Denom.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 *QueryDenomsRequest) 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: QueryDenomsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsRequest: 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 *QueryDenomsResponse) 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: QueryDenomsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denoms", 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.Denoms = append(m.Denoms, Denom{}) - if err := m.Denoms[len(m.Denoms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryNFTRequest) 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: QueryNFTRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenId", 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.TokenId = 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 *QueryNFTResponse) 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: QueryNFTResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryNFTResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NFT", 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.NFT == nil { - m.NFT = &BaseNFT{} - } - if err := m.NFT.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/modules/nft/tx.pb.go b/modules/nft/tx.pb.go deleted file mode 100644 index 96891f85..00000000 --- a/modules/nft/tx.pb.go +++ /dev/null @@ -1,2133 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: nft/tx.proto - -package nft - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// MsgIssueDenom defines an SDK message for creating a new denom. -type MsgIssueDenom struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Schema string `protobuf:"bytes,3,opt,name=schema,proto3" json:"schema,omitempty"` - Sender string `protobuf:"bytes,4,opt,name=sender,proto3" json:"sender,omitempty"` -} - -func (m *MsgIssueDenom) Reset() { *m = MsgIssueDenom{} } -func (m *MsgIssueDenom) String() string { return proto.CompactTextString(m) } -func (*MsgIssueDenom) ProtoMessage() {} -func (*MsgIssueDenom) Descriptor() ([]byte, []int) { - return fileDescriptor_09d30374d974e015, []int{0} -} -func (m *MsgIssueDenom) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgIssueDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgIssueDenom.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 *MsgIssueDenom) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgIssueDenom.Merge(m, src) -} -func (m *MsgIssueDenom) XXX_Size() int { - return m.Size() -} -func (m *MsgIssueDenom) XXX_DiscardUnknown() { - xxx_messageInfo_MsgIssueDenom.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgIssueDenom proto.InternalMessageInfo - -// MsgTransferNFT defines an SDK message for transferring an NFT to recipient. -type MsgTransferNFT struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - URI string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` - Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` - Sender string `protobuf:"bytes,6,opt,name=sender,proto3" json:"sender,omitempty"` - Recipient string `protobuf:"bytes,7,opt,name=recipient,proto3" json:"recipient,omitempty"` -} - -func (m *MsgTransferNFT) Reset() { *m = MsgTransferNFT{} } -func (m *MsgTransferNFT) String() string { return proto.CompactTextString(m) } -func (*MsgTransferNFT) ProtoMessage() {} -func (*MsgTransferNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_09d30374d974e015, []int{1} -} -func (m *MsgTransferNFT) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgTransferNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgTransferNFT.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 *MsgTransferNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgTransferNFT.Merge(m, src) -} -func (m *MsgTransferNFT) XXX_Size() int { - return m.Size() -} -func (m *MsgTransferNFT) XXX_DiscardUnknown() { - xxx_messageInfo_MsgTransferNFT.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgTransferNFT proto.InternalMessageInfo - -// MsgEditNFT defines an SDK message for editing a nft. -type MsgEditNFT struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - URI string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` - Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` - Sender string `protobuf:"bytes,6,opt,name=sender,proto3" json:"sender,omitempty"` -} - -func (m *MsgEditNFT) Reset() { *m = MsgEditNFT{} } -func (m *MsgEditNFT) String() string { return proto.CompactTextString(m) } -func (*MsgEditNFT) ProtoMessage() {} -func (*MsgEditNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_09d30374d974e015, []int{2} -} -func (m *MsgEditNFT) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEditNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEditNFT.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 *MsgEditNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEditNFT.Merge(m, src) -} -func (m *MsgEditNFT) XXX_Size() int { - return m.Size() -} -func (m *MsgEditNFT) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEditNFT.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEditNFT proto.InternalMessageInfo - -// MsgMintNFT defines an SDK message for creating a new NFT. -type MsgMintNFT struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - URI string `protobuf:"bytes,4,opt,name=uri,proto3" json:"uri,omitempty"` - Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` - Sender string `protobuf:"bytes,6,opt,name=sender,proto3" json:"sender,omitempty"` - Recipient string `protobuf:"bytes,7,opt,name=recipient,proto3" json:"recipient,omitempty"` -} - -func (m *MsgMintNFT) Reset() { *m = MsgMintNFT{} } -func (m *MsgMintNFT) String() string { return proto.CompactTextString(m) } -func (*MsgMintNFT) ProtoMessage() {} -func (*MsgMintNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_09d30374d974e015, []int{3} -} -func (m *MsgMintNFT) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintNFT.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 *MsgMintNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintNFT.Merge(m, src) -} -func (m *MsgMintNFT) XXX_Size() int { - return m.Size() -} -func (m *MsgMintNFT) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintNFT.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintNFT proto.InternalMessageInfo - -// MsgBurnNFT defines an SDK message for burning a NFT. -type MsgBurnNFT struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` - Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` -} - -func (m *MsgBurnNFT) Reset() { *m = MsgBurnNFT{} } -func (m *MsgBurnNFT) String() string { return proto.CompactTextString(m) } -func (*MsgBurnNFT) ProtoMessage() {} -func (*MsgBurnNFT) Descriptor() ([]byte, []int) { - return fileDescriptor_09d30374d974e015, []int{4} -} -func (m *MsgBurnNFT) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBurnNFT) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBurnNFT.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 *MsgBurnNFT) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBurnNFT.Merge(m, src) -} -func (m *MsgBurnNFT) XXX_Size() int { - return m.Size() -} -func (m *MsgBurnNFT) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBurnNFT.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBurnNFT proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgIssueDenom)(nil), "irismod.nft.MsgIssueDenom") - proto.RegisterType((*MsgTransferNFT)(nil), "irismod.nft.MsgTransferNFT") - proto.RegisterType((*MsgEditNFT)(nil), "irismod.nft.MsgEditNFT") - proto.RegisterType((*MsgMintNFT)(nil), "irismod.nft.MsgMintNFT") - proto.RegisterType((*MsgBurnNFT)(nil), "irismod.nft.MsgBurnNFT") -} - -func init() { proto.RegisterFile("nft/tx.proto", fileDescriptor_09d30374d974e015) } - -var fileDescriptor_09d30374d974e015 = []byte{ - // 377 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0xb1, 0x4a, 0xc3, 0x40, - 0x18, 0xc7, 0x73, 0x4d, 0x6d, 0xed, 0xa9, 0x15, 0xa2, 0x48, 0x14, 0x49, 0x25, 0x93, 0x4b, 0x93, - 0xc1, 0xad, 0x63, 0x50, 0xa1, 0x48, 0x1c, 0x42, 0x5d, 0x5c, 0x24, 0xed, 0x5d, 0xd2, 0xd3, 0xe6, - 0xae, 0xdc, 0x5d, 0x40, 0xdf, 0xc2, 0x47, 0xf0, 0x05, 0x7c, 0x8f, 0x82, 0x83, 0x1d, 0x9d, 0x8a, - 0xa6, 0x8b, 0xb3, 0x4f, 0x20, 0xb9, 0x44, 0x5a, 0xe8, 0xea, 0x20, 0x4e, 0xf7, 0xbf, 0xff, 0xf7, - 0xc1, 0xf7, 0xfb, 0x7f, 0xf0, 0xc1, 0x4d, 0x1a, 0x49, 0x57, 0xde, 0x3b, 0x63, 0xce, 0x24, 0x33, - 0x36, 0x08, 0x27, 0x22, 0x61, 0xc8, 0xa1, 0x91, 0x3c, 0xd8, 0x8d, 0x59, 0xcc, 0x94, 0xef, 0xe6, - 0xaa, 0x68, 0xb1, 0x09, 0xdc, 0xf2, 0x45, 0xdc, 0x15, 0x22, 0xc5, 0xa7, 0x98, 0xb2, 0xc4, 0x68, - 0xc2, 0x0a, 0x41, 0x26, 0x38, 0x02, 0xc7, 0x8d, 0xa0, 0x42, 0x90, 0x61, 0xc0, 0x2a, 0x0d, 0x13, - 0x6c, 0x56, 0x94, 0xa3, 0xb4, 0xb1, 0x07, 0x6b, 0x62, 0x30, 0xc4, 0x49, 0x68, 0xea, 0xca, 0x2d, - 0x7f, 0xca, 0xc7, 0x14, 0x61, 0x6e, 0x56, 0x4b, 0x5f, 0xfd, 0x3a, 0xd5, 0xcf, 0xa7, 0x16, 0xb0, - 0x5f, 0x01, 0x6c, 0xfa, 0x22, 0xee, 0xf1, 0x90, 0x8a, 0x08, 0xf3, 0xcb, 0xf3, 0xde, 0xca, 0x30, - 0x07, 0xae, 0xa3, 0x9c, 0xe2, 0x86, 0xa0, 0x62, 0xa0, 0xb7, 0xf3, 0x35, 0x6b, 0x6d, 0x3f, 0x84, - 0xc9, 0xa8, 0x63, 0xff, 0x54, 0xec, 0xa0, 0xae, 0x64, 0x77, 0x01, 0xa7, 0x2f, 0xc1, 0xed, 0x43, - 0x3d, 0xe5, 0xa4, 0x20, 0xf0, 0xea, 0xd9, 0xac, 0xa5, 0x5f, 0x05, 0xdd, 0x20, 0xf7, 0xf2, 0x76, - 0x14, 0xca, 0xd0, 0x5c, 0x2b, 0xda, 0x73, 0xbd, 0xc4, 0x5c, 0x5b, 0x66, 0x36, 0x0e, 0x61, 0x83, - 0xe3, 0x01, 0x19, 0x13, 0x4c, 0xa5, 0x59, 0x57, 0xa5, 0x85, 0x51, 0x26, 0x7a, 0x06, 0x10, 0xfa, - 0x22, 0x3e, 0x43, 0x44, 0xfe, 0xed, 0x34, 0x25, 0xef, 0x4b, 0xc1, 0xeb, 0x13, 0x2a, 0xff, 0xc1, - 0xf6, 0x6f, 0x55, 0x18, 0x2f, 0xe5, 0xf4, 0x37, 0xc2, 0x2c, 0x48, 0xf4, 0xd5, 0xcd, 0x79, 0x17, - 0x93, 0x0f, 0x4b, 0x9b, 0x64, 0x16, 0x98, 0x66, 0x16, 0x78, 0xcf, 0x2c, 0xf0, 0x38, 0xb7, 0xb4, - 0xe9, 0xdc, 0xd2, 0xde, 0xe6, 0x96, 0x76, 0xdd, 0x8e, 0x89, 0x1c, 0xa6, 0x7d, 0x67, 0xc0, 0x12, - 0x37, 0x3f, 0x39, 0x8a, 0xa5, 0x7a, 0x87, 0x69, 0xbf, 0x2d, 0xd0, 0x5d, 0x3b, 0x66, 0x6e, 0xc2, - 0x50, 0x3a, 0xc2, 0xc2, 0xa5, 0x91, 0xec, 0xd7, 0xd4, 0xe9, 0x9d, 0x7c, 0x07, 0x00, 0x00, 0xff, - 0xff, 0x75, 0x7b, 0x7b, 0x3c, 0xad, 0x03, 0x00, 0x00, -} - -func (this *MsgIssueDenom) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgIssueDenom) - if !ok { - that2, ok := that.(MsgIssueDenom) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.Name != that1.Name { - return false - } - if this.Schema != that1.Schema { - return false - } - if this.Sender != that1.Sender { - return false - } - return true -} -func (this *MsgTransferNFT) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgTransferNFT) - if !ok { - that2, ok := that.(MsgTransferNFT) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.DenomId != that1.DenomId { - return false - } - if this.Name != that1.Name { - return false - } - if this.URI != that1.URI { - return false - } - if this.Data != that1.Data { - return false - } - if this.Sender != that1.Sender { - return false - } - if this.Recipient != that1.Recipient { - return false - } - return true -} -func (this *MsgEditNFT) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgEditNFT) - if !ok { - that2, ok := that.(MsgEditNFT) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.DenomId != that1.DenomId { - return false - } - if this.Name != that1.Name { - return false - } - if this.URI != that1.URI { - return false - } - if this.Data != that1.Data { - return false - } - if this.Sender != that1.Sender { - return false - } - return true -} -func (this *MsgMintNFT) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgMintNFT) - if !ok { - that2, ok := that.(MsgMintNFT) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.DenomId != that1.DenomId { - return false - } - if this.Name != that1.Name { - return false - } - if this.URI != that1.URI { - return false - } - if this.Data != that1.Data { - return false - } - if this.Sender != that1.Sender { - return false - } - if this.Recipient != that1.Recipient { - return false - } - return true -} -func (this *MsgBurnNFT) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgBurnNFT) - if !ok { - that2, ok := that.(MsgBurnNFT) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Id != that1.Id { - return false - } - if this.DenomId != that1.DenomId { - return false - } - if this.Sender != that1.Sender { - return false - } - return true -} -func (m *MsgIssueDenom) 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 *MsgIssueDenom) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgIssueDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x22 - } - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarintTx(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0x1a - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgTransferNFT) 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 *MsgTransferNFT) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgTransferNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) - i-- - dAtA[i] = 0x3a - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x32 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x2a - } - if len(m.URI) > 0 { - i -= len(m.URI) - copy(dAtA[i:], m.URI) - i = encodeVarintTx(dAtA, i, uint64(len(m.URI))) - i-- - dAtA[i] = 0x22 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgEditNFT) 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 *MsgEditNFT) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x32 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x2a - } - if len(m.URI) > 0 { - i -= len(m.URI) - copy(dAtA[i:], m.URI) - i = encodeVarintTx(dAtA, i, uint64(len(m.URI))) - i-- - dAtA[i] = 0x22 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgMintNFT) 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 *MsgMintNFT) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMintNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Recipient) > 0 { - i -= len(m.Recipient) - copy(dAtA[i:], m.Recipient) - i = encodeVarintTx(dAtA, i, uint64(len(m.Recipient))) - i-- - dAtA[i] = 0x3a - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x32 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x2a - } - if len(m.URI) > 0 { - i -= len(m.URI) - copy(dAtA[i:], m.URI) - i = encodeVarintTx(dAtA, i, uint64(len(m.URI))) - i-- - dAtA[i] = 0x22 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgBurnNFT) 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 *MsgBurnNFT) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBurnNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x1a - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintTx(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - 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 *MsgIssueDenom) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Schema) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgTransferNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.URI) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Recipient) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgEditNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.URI) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgMintNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.URI) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Recipient) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgBurnNFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(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 *MsgIssueDenom) 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: MsgIssueDenom: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIssueDenom: 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 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", 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.Schema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgTransferNFT) 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: MsgTransferNFT: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgTransferNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field URI", 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.URI = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", 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.Recipient = 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 *MsgEditNFT) 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: MsgEditNFT: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field URI", 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.URI = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 *MsgMintNFT) 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: MsgMintNFT: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field URI", 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.URI = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", 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.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Recipient", 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.Recipient = 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 *MsgBurnNFT) 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: MsgBurnNFT: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnNFT: 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 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.Id = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", 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.DenomId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = 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 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/modules/nft/types.go b/modules/nft/types.go deleted file mode 100644 index f3076bc6..00000000 --- a/modules/nft/types.go +++ /dev/null @@ -1,283 +0,0 @@ -package nft - -import ( - "strings" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "nft" -) - -var ( - _ sdk.Msg = &MsgIssueDenom{} - _ sdk.Msg = &MsgTransferNFT{} - _ sdk.Msg = &MsgEditNFT{} - _ sdk.Msg = &MsgMintNFT{} - _ sdk.Msg = &MsgBurnNFT{} -) - -func (m MsgIssueDenom) Route() string { - return ModuleName -} - -func (m MsgIssueDenom) Type() string { - return "issue_denom" -} - -func (m MsgIssueDenom) ValidateBasic() error { - if len(m.Sender) == 0 { - return sdk.Wrapf("missing sender address") - } - - if err := sdk.ValidateAccAddress(m.Sender); err != nil { - return sdk.Wrap(err) - } - id := strings.TrimSpace(m.Id) - if len(id) == 0 { - return sdk.Wrapf("missing id") - } - return nil -} - -func (m MsgIssueDenom) GetSignBytes() []byte { - bz, err := ModuleCdc.MarshalJSON(&m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(bz) -} - -func (m MsgIssueDenom) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} -} - -func (m MsgTransferNFT) Route() string { - return ModuleName -} - -func (m MsgTransferNFT) Type() string { - return "transfer_nft" -} - -func (m MsgTransferNFT) ValidateBasic() error { - if len(m.Sender) == 0 { - return sdk.Wrapf("missing sender address") - } - if err := sdk.ValidateAccAddress(m.Sender); err != nil { - return sdk.Wrap(err) - } - - if len(m.Recipient) == 0 { - return sdk.Wrapf("missing recipient address") - } - if err := sdk.ValidateAccAddress(m.Recipient); err != nil { - return sdk.Wrap(err) - } - - denom := strings.TrimSpace(m.DenomId) - if len(denom) == 0 { - return sdk.Wrapf("missing denom") - } - - tokenID := strings.TrimSpace(m.Id) - if len(tokenID) == 0 { - return sdk.Wrapf("missing ID") - } - return nil -} - -func (m MsgTransferNFT) GetSignBytes() []byte { - bz, err := ModuleCdc.MarshalJSON(&m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(bz) -} - -func (m MsgTransferNFT) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} -} - -func (m MsgEditNFT) Route() string { - return ModuleName -} - -func (m MsgEditNFT) Type() string { - return "edit_nft" -} - -func (m MsgEditNFT) ValidateBasic() error { - if len(m.Sender) == 0 { - return sdk.Wrapf("missing sender address") - } - if err := sdk.ValidateAccAddress(m.Sender); err != nil { - return sdk.Wrap(err) - } - - denom := strings.TrimSpace(m.DenomId) - if len(denom) == 0 { - return sdk.Wrapf("missing denom") - } - - tokenID := strings.TrimSpace(m.Id) - if len(tokenID) == 0 { - return sdk.Wrapf("missing ID") - } - return nil -} - -func (m MsgEditNFT) GetSignBytes() []byte { - bz, err := ModuleCdc.MarshalJSON(&m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(bz) -} - -func (m MsgEditNFT) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} -} - -func (m MsgMintNFT) Route() string { - return ModuleName -} - -func (m MsgMintNFT) Type() string { - return "mint_nft" -} - -func (m MsgMintNFT) ValidateBasic() error { - if len(m.Sender) == 0 { - return sdk.Wrapf("missing sender address") - } - if err := sdk.ValidateAccAddress(m.Sender); err != nil { - return sdk.Wrap(err) - } - - denom := strings.TrimSpace(m.DenomId) - if len(denom) == 0 { - return sdk.Wrapf("missing denom") - } - - tokenID := strings.TrimSpace(m.Id) - if len(tokenID) == 0 { - return sdk.Wrapf("missing ID") - } - return nil -} - -func (m MsgMintNFT) GetSignBytes() []byte { - bz, err := ModuleCdc.MarshalJSON(&m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(bz) -} - -func (m MsgMintNFT) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} -} - -func (m MsgBurnNFT) Route() string { - return ModuleName -} - -func (m MsgBurnNFT) Type() string { - return "burn_nft" -} - -func (m MsgBurnNFT) ValidateBasic() error { - if len(m.Sender) == 0 { - return sdk.Wrapf("missing sender address") - } - if err := sdk.ValidateAccAddress(m.Sender); err != nil { - return sdk.Wrap(err) - } - - denom := strings.TrimSpace(m.DenomId) - if len(denom) == 0 { - return sdk.Wrapf("missing denom") - } - - tokenID := strings.TrimSpace(m.Id) - if len(tokenID) == 0 { - return sdk.Wrapf("missing ID") - } - return nil -} - -func (m MsgBurnNFT) GetSignBytes() []byte { - bz, err := ModuleCdc.MarshalJSON(&m) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(bz) -} - -func (m MsgBurnNFT) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(m.Sender)} -} - -func (o Owner) Convert() interface{} { - var idcs []IDC - for _, idc := range o.IDCollections { - idcs = append(idcs, IDC{ - Denom: idc.DenomId, - TokenIDs: idc.TokenIds, - }) - } - return QueryOwnerResp{ - Address: o.Address, - IDCs: idcs, - } -} - -func (this BaseNFT) Convert() interface{} { - return QueryNFTResp{ - ID: this.Id, - Name: this.Name, - URI: this.URI, - Data: this.Data, - Creator: this.Owner, - } -} - -type NFTs []BaseNFT - -func (this Denom) Convert() interface{} { - return QueryDenomResp{ - ID: this.Id, - Name: this.Name, - Schema: this.Schema, - Creator: this.Creator, - } -} - -type denoms []Denom - -func (this denoms) Convert() interface{} { - var denoms []QueryDenomResp - for _, denom := range this { - denoms = append(denoms, denom.Convert().(QueryDenomResp)) - } - return denoms -} - -func (c Collection) Convert() interface{} { - var nfts []QueryNFTResp - for _, nft := range c.NFTs { - nfts = append(nfts, QueryNFTResp{ - ID: nft.Id, - Name: nft.Name, - URI: nft.URI, - Data: nft.Data, - Creator: nft.Owner, - }) - } - return QueryCollectionResp{ - Denom: c.Denom.Convert().(QueryDenomResp), - NFTs: nfts, - } -} diff --git a/modules/oracle/codec.go b/modules/oracle/codec.go deleted file mode 100644 index 856ba883..00000000 --- a/modules/oracle/codec.go +++ /dev/null @@ -1,26 +0,0 @@ -package oracle - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateFeed{}, - &MsgStartFeed{}, - &MsgPauseFeed{}, - &MsgEditFeed{}, - ) -} diff --git a/modules/oracle/export.go b/modules/oracle/export.go deleted file mode 100644 index a3842cb5..00000000 --- a/modules/oracle/export.go +++ /dev/null @@ -1,72 +0,0 @@ -package oracle - -import ( - "time" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// expose Oracle module api for user -type Client interface { - sdk.Module - - CreateFeed(request CreateFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - StartFeed(feedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - PauseFeed(FeedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - EditFeed(request EditFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - - QueryFeed(feedName string) (QueryFeedResp, sdk.Error) - QueryFeeds(state string) ([]QueryFeedResp, sdk.Error) - QueryFeedValue(feedName string) ([]QueryFeedValueResp, sdk.Error) -} - -type CreateFeedRequest struct { - FeedName string `json:"feed_name"` - LatestHistory uint64 `json:"latest_history"` - Description string `json:"description"` - ServiceName string `json:"service_name"` - Providers []string `json:"providers"` - Input string `json:"input"` - Timeout int64 `json:"timeout"` - ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` - RepeatedFrequency uint64 `json:"repeated_frequency"` - AggregateFunc string `json:"aggregate_func"` - ValueJsonPath string `json:"value_json_path"` - ResponseThreshold uint32 `json:"response_threshold"` -} - -type EditFeedRequest struct { - FeedName string `json:"feed_name"` - Description string `json:"description"` - LatestHistory uint64 `json:"latest_history"` - Providers []string `json:"providers"` - Timeout int64 `json:"timeout"` - ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` - RepeatedFrequency uint64 `json:"repeated_frequency"` - ResponseThreshold uint32 `json:"response_threshold"` -} - -type QueryFeedResp struct { - Feed struct { - FeedName string `json:"feed_name"` - Description string `json:"description"` - AggregateFunc string `json:"aggregate_func"` - ValueJsonPath string `json:"value_json_path"` - LatestHistory uint64 `json:"latest_history"` - RequestContextID string `json:"request_context_id"` - Creator string `json:"creator"` - } `json:"feed"` - ServiceName string `json:"service_name"` - Providers []string `json:"providers"` - Input string `json:"input"` - Timeout int64 `json:"timeout"` - ServiceFeeCap sdk.Coins `json:"service_fee_cap"` - RepeatedFrequency uint64 `json:"repeated_frequency"` - ResponseThreshold uint32 `json:"response_threshold"` - State int32 `json:"state"` -} - -type QueryFeedValueResp struct { - Data string `json:"data"` - Timestamp time.Time `json:"timestamp"` -} diff --git a/modules/oracle/oracle.go b/modules/oracle/oracle.go deleted file mode 100644 index 33d90e82..00000000 --- a/modules/oracle/oracle.go +++ /dev/null @@ -1,173 +0,0 @@ -package oracle - -import ( - "context" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type oracleClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { - return oracleClient{ - BaseClient: baseClient, - Marshaler: marshaler, - } -} - -func (oc oracleClient) Name() string { - return ModuleName -} - -func (oc oracleClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (oc oracleClient) CreateFeed(request CreateFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - serviceFeeCap, e := oc.ToMinCoin(request.ServiceFeeCap...) - if e != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgCreateFeed{ - FeedName: request.FeedName, - LatestHistory: request.LatestHistory, - Description: request.Description, - Creator: sender.String(), - ServiceName: request.ServiceName, - Providers: request.Providers, - Input: request.Input, - Timeout: request.Timeout, - ServiceFeeCap: serviceFeeCap, - RepeatedFrequency: request.RepeatedFrequency, - AggregateFunc: request.AggregateFunc, - ValueJsonPath: request.ValueJsonPath, - ResponseThreshold: request.ResponseThreshold, - } - return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (oc oracleClient) StartFeed(feedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgStartFeed{ - FeedName: feedName, - Creator: sender.String(), - } - return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (oc oracleClient) PauseFeed(feedName string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgPauseFeed{ - FeedName: feedName, - Creator: sender.String(), - } - return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (oc oracleClient) EditFeed(request EditFeedRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := oc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - serviceFeeCap, e := oc.ToMinCoin(request.ServiceFeeCap...) - if e != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgEditFeed{ - FeedName: request.FeedName, - Description: request.Description, - LatestHistory: request.LatestHistory, - Providers: request.Providers, - Timeout: request.Timeout, - ServiceFeeCap: serviceFeeCap, - RepeatedFrequency: request.RepeatedFrequency, - ResponseThreshold: request.ResponseThreshold, - Creator: sender.String(), - } - return oc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (oc oracleClient) QueryFeed(feedName string) (QueryFeedResp, sdk.Error) { - if len(feedName) == 0 { - return QueryFeedResp{}, sdk.Wrapf("feedName is required") - } - - conn, err := oc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryFeedResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Feed( - context.Background(), - &QueryFeedRequest{FeedName: feedName}, - ) - if err != nil { - return QueryFeedResp{}, sdk.Wrap(err) - } - return res.Feed.Convert().(QueryFeedResp), nil -} - -func (oc oracleClient) QueryFeeds(state string) ([]QueryFeedResp, sdk.Error) { - // todo state (whether state is required) - if len(state) == 0 { - return nil, sdk.Wrapf("state is required") - } - - conn, err := oc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Feeds( - context.Background(), - &QueryFeedsRequest{State: state}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return feedContexts(res.Feeds).Convert().([]QueryFeedResp), nil -} - -func (oc oracleClient) QueryFeedValue(feedName string) ([]QueryFeedValueResp, sdk.Error) { - if len(feedName) == 0 { - return nil, sdk.Wrapf("feedName is required") - } - - conn, err := oc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).FeedValue( - context.Background(), - &QueryFeedValueRequest{FeedName: feedName}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return feedValues(res.FeedValues).Convert().([]QueryFeedValueResp), nil -} diff --git a/modules/oracle/oracle.pb.go b/modules/oracle/oracle.pb.go deleted file mode 100644 index 115f1fd3..00000000 --- a/modules/oracle/oracle.pb.go +++ /dev/null @@ -1,857 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: oracle/oracle.proto - -package oracle - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/timestamp" - io "io" - math "math" - math_bits "math/bits" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Feed defines the feed standard -type Feed struct { - FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - AggregateFunc string `protobuf:"bytes,3,opt,name=aggregate_func,json=aggregateFunc,proto3" json:"aggregate_func,omitempty" yaml:"aggregate_func"` - ValueJsonPath string `protobuf:"bytes,4,opt,name=value_json_path,json=valueJsonPath,proto3" json:"value_json_path,omitempty" yaml:"value_json_path"` - LatestHistory uint64 `protobuf:"varint,5,opt,name=latest_history,json=latestHistory,proto3" json:"latest_history,omitempty" yaml:"latest_history"` - RequestContextID string `protobuf:"bytes,6,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - Creator string `protobuf:"bytes,7,opt,name=creator,proto3" json:"creator,omitempty"` -} - -func (m *Feed) Reset() { *m = Feed{} } -func (m *Feed) String() string { return proto.CompactTextString(m) } -func (*Feed) ProtoMessage() {} -func (*Feed) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{0} -} -func (m *Feed) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Feed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Feed.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 *Feed) XXX_Merge(src proto.Message) { - xxx_messageInfo_Feed.Merge(m, src) -} -func (m *Feed) XXX_Size() int { - return m.Size() -} -func (m *Feed) XXX_DiscardUnknown() { - xxx_messageInfo_Feed.DiscardUnknown(m) -} - -var xxx_messageInfo_Feed proto.InternalMessageInfo - -func (m *Feed) GetFeedName() string { - if m != nil { - return m.FeedName - } - return "" -} - -func (m *Feed) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Feed) GetAggregateFunc() string { - if m != nil { - return m.AggregateFunc - } - return "" -} - -func (m *Feed) GetValueJsonPath() string { - if m != nil { - return m.ValueJsonPath - } - return "" -} - -func (m *Feed) GetLatestHistory() uint64 { - if m != nil { - return m.LatestHistory - } - return 0 -} - -func (m *Feed) GetRequestContextID() string { - if m != nil { - return m.RequestContextID - } - return "" -} - -func (m *Feed) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -// FeedValue defines the feed result standard -type FeedValue struct { - Data string `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"` -} - -func (m *FeedValue) Reset() { *m = FeedValue{} } -func (m *FeedValue) String() string { return proto.CompactTextString(m) } -func (*FeedValue) ProtoMessage() {} -func (*FeedValue) Descriptor() ([]byte, []int) { - return fileDescriptor_dc470b50b143d488, []int{1} -} -func (m *FeedValue) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FeedValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FeedValue.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 *FeedValue) XXX_Merge(src proto.Message) { - xxx_messageInfo_FeedValue.Merge(m, src) -} -func (m *FeedValue) XXX_Size() int { - return m.Size() -} -func (m *FeedValue) XXX_DiscardUnknown() { - xxx_messageInfo_FeedValue.DiscardUnknown(m) -} - -var xxx_messageInfo_FeedValue proto.InternalMessageInfo - -func (m *FeedValue) GetData() string { - if m != nil { - return m.Data - } - return "" -} - -func (m *FeedValue) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - -func init() { - proto.RegisterType((*Feed)(nil), "irismod.oracle.Feed") - proto.RegisterType((*FeedValue)(nil), "irismod.oracle.FeedValue") -} - -func init() { proto.RegisterFile("oracle/oracle.proto", fileDescriptor_dc470b50b143d488) } - -var fileDescriptor_dc470b50b143d488 = []byte{ - // 456 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x69, 0x68, 0x9b, 0xad, 0x52, 0xa2, 0xa5, 0x20, 0x37, 0x07, 0x3b, 0xf2, 0xa9, 0x97, - 0xda, 0x14, 0x6e, 0x9c, 0x90, 0x41, 0x15, 0xf4, 0x80, 0x90, 0x85, 0x38, 0x70, 0xb1, 0x36, 0xde, - 0xc9, 0xda, 0x60, 0x7b, 0xc2, 0xee, 0x1a, 0xd1, 0xbf, 0xe8, 0x17, 0xf0, 0x3d, 0x3d, 0xf6, 0xc8, - 0xc9, 0xa0, 0xe4, 0x0f, 0xf2, 0x05, 0xc8, 0xbb, 0x24, 0x24, 0x70, 0xda, 0x99, 0xf7, 0xde, 0x3c, - 0x8f, 0xf7, 0x2d, 0x79, 0x88, 0x92, 0x65, 0x25, 0x44, 0xf6, 0x08, 0xe7, 0x12, 0x35, 0xd2, 0xe3, - 0x42, 0x16, 0xaa, 0x42, 0x1e, 0x5a, 0x74, 0x7c, 0x22, 0x50, 0xa0, 0xa1, 0xa2, 0xae, 0xb2, 0xaa, - 0xb1, 0x2f, 0x10, 0x45, 0x09, 0x91, 0xe9, 0xa6, 0xcd, 0x2c, 0xd2, 0x45, 0x05, 0x4a, 0xb3, 0x6a, - 0x6e, 0x05, 0xc1, 0xf7, 0x3d, 0xd2, 0xbf, 0x04, 0xe0, 0xf4, 0x82, 0x0c, 0x66, 0x00, 0x3c, 0xad, - 0x59, 0x05, 0xae, 0x33, 0x71, 0xce, 0x06, 0xf1, 0xc9, 0xaa, 0xf5, 0x47, 0xd7, 0xac, 0x2a, 0x9f, - 0x07, 0x1b, 0x2a, 0x48, 0x0e, 0xbb, 0xfa, 0x2d, 0xab, 0x80, 0x4e, 0xc8, 0x11, 0x07, 0x95, 0xc9, - 0x62, 0xae, 0x0b, 0xac, 0xdd, 0x7b, 0xdd, 0x50, 0xb2, 0x0d, 0xd1, 0x17, 0xe4, 0x98, 0x09, 0x21, - 0x41, 0x30, 0x0d, 0xe9, 0xac, 0xa9, 0x33, 0x77, 0xcf, 0x38, 0x9f, 0xae, 0x5a, 0xff, 0x91, 0x75, - 0xde, 0xe5, 0x83, 0x64, 0xb8, 0x01, 0x2e, 0x9b, 0x3a, 0xa3, 0x31, 0x79, 0xf0, 0x95, 0x95, 0x0d, - 0xa4, 0x9f, 0x14, 0xd6, 0xe9, 0x9c, 0xe9, 0xdc, 0xed, 0x1b, 0x8b, 0xf1, 0xaa, 0xf5, 0x1f, 0x5b, - 0x8b, 0x7f, 0x04, 0x41, 0x32, 0x34, 0xc8, 0x95, 0xc2, 0xfa, 0x1d, 0xd3, 0x79, 0xb7, 0x45, 0xc9, - 0x34, 0x28, 0x9d, 0xe6, 0x85, 0xd2, 0x28, 0xaf, 0xdd, 0xfb, 0x13, 0xe7, 0xac, 0xbf, 0xbd, 0xc5, - 0x2e, 0x1f, 0x24, 0x43, 0x0b, 0xbc, 0xb6, 0x3d, 0x4d, 0x09, 0x95, 0xf0, 0xa5, 0xe9, 0x24, 0x19, - 0xd6, 0x1a, 0xbe, 0xe9, 0xb4, 0xe0, 0xee, 0xbe, 0x59, 0xe4, 0x62, 0xd1, 0xfa, 0xa3, 0xc4, 0xb2, - 0x2f, 0x2d, 0xf9, 0xe6, 0xd5, 0xaa, 0xf5, 0x4f, 0xad, 0xf3, 0xff, 0x73, 0x41, 0x32, 0x92, 0xbb, - 0x72, 0x4e, 0x5d, 0x72, 0x90, 0x49, 0x60, 0x1a, 0xa5, 0x7b, 0x60, 0xae, 0x71, 0xdd, 0x06, 0x19, - 0x19, 0x74, 0xf9, 0x7c, 0xe8, 0xfe, 0x88, 0x52, 0xd2, 0xe7, 0x4c, 0x33, 0x9b, 0x4f, 0x62, 0x6a, - 0x1a, 0x93, 0xc1, 0x26, 0x54, 0x93, 0xc1, 0xd1, 0xd3, 0x71, 0x68, 0x63, 0x0f, 0xd7, 0xb1, 0x87, - 0xef, 0xd7, 0x8a, 0xf8, 0xf0, 0xb6, 0xf5, 0x7b, 0x37, 0x3f, 0x7d, 0x27, 0xf9, 0x3b, 0x16, 0x5f, - 0xdd, 0x2e, 0x3c, 0xe7, 0x6e, 0xe1, 0x39, 0xbf, 0x16, 0x9e, 0x73, 0xb3, 0xf4, 0x7a, 0x77, 0x4b, - 0xaf, 0xf7, 0x63, 0xe9, 0xf5, 0x3e, 0x3e, 0x11, 0x85, 0xce, 0x9b, 0x69, 0x98, 0x61, 0x15, 0x75, - 0x2f, 0xae, 0x06, 0x6d, 0xce, 0xbc, 0x99, 0x9e, 0x2b, 0xfe, 0xf9, 0x5c, 0x60, 0x54, 0x21, 0x6f, - 0x4a, 0x50, 0x7f, 0x9e, 0xe7, 0x74, 0xdf, 0x7c, 0xf4, 0xd9, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x07, 0xc2, 0x17, 0x7c, 0xb6, 0x02, 0x00, 0x00, -} - -func (m *Feed) 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 *Feed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Feed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0x3a - } - if len(m.RequestContextID) > 0 { - i -= len(m.RequestContextID) - copy(dAtA[i:], m.RequestContextID) - i = encodeVarintOracle(dAtA, i, uint64(len(m.RequestContextID))) - i-- - dAtA[i] = 0x32 - } - if m.LatestHistory != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.LatestHistory)) - i-- - dAtA[i] = 0x28 - } - if len(m.ValueJsonPath) > 0 { - i -= len(m.ValueJsonPath) - copy(dAtA[i:], m.ValueJsonPath) - i = encodeVarintOracle(dAtA, i, uint64(len(m.ValueJsonPath))) - i-- - dAtA[i] = 0x22 - } - if len(m.AggregateFunc) > 0 { - i -= len(m.AggregateFunc) - copy(dAtA[i:], m.AggregateFunc) - i = encodeVarintOracle(dAtA, i, uint64(len(m.AggregateFunc))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.FeedName) > 0 { - i -= len(m.FeedName) - copy(dAtA[i:], m.FeedName) - i = encodeVarintOracle(dAtA, i, uint64(len(m.FeedName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *FeedValue) 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 *FeedValue) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FeedValue) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintOracle(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x12 - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintOracle(dAtA []byte, offset int, v uint64) int { - offset -= sovOracle(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Feed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeedName) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - l = len(m.AggregateFunc) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - l = len(m.ValueJsonPath) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - if m.LatestHistory != 0 { - n += 1 + sovOracle(uint64(m.LatestHistory)) - } - l = len(m.RequestContextID) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - return n -} - -func (m *FeedValue) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) - n += 1 + l + sovOracle(uint64(l)) - return n -} - -func sovOracle(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozOracle(x uint64) (n int) { - return sovOracle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Feed) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Feed: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Feed: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FeedName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregateFunc", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AggregateFunc = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValueJsonPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValueJsonPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestHistory", wireType) - } - m.LatestHistory = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LatestHistory |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextID", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequestContextID = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - 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 ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipOracle(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthOracle - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthOracle - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FeedValue) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FeedValue: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FeedValue: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthOracle - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipOracle(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthOracle - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthOracle - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipOracle(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, ErrIntOverflowOracle - } - 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, ErrIntOverflowOracle - } - 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, ErrIntOverflowOracle - } - 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, ErrInvalidLengthOracle - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupOracle - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthOracle - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthOracle = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowOracle = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupOracle = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/oracle/query.pb.go b/modules/oracle/query.pb.go deleted file mode 100644 index 1b9f3e54..00000000 --- a/modules/oracle/query.pb.go +++ /dev/null @@ -1,1958 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: oracle/query.proto - -package oracle - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - service "github.com/irisnet/irishub-sdk-go/modules/service" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - _ "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 - -// QueryFeedRequest is request type for the Query/Feed RPC method -type QueryFeedRequest struct { - FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty"` -} - -func (m *QueryFeedRequest) Reset() { *m = QueryFeedRequest{} } -func (m *QueryFeedRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFeedRequest) ProtoMessage() {} -func (*QueryFeedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{0} -} -func (m *QueryFeedRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeedRequest.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 *QueryFeedRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeedRequest.Merge(m, src) -} -func (m *QueryFeedRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryFeedRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeedRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeedRequest proto.InternalMessageInfo - -func (m *QueryFeedRequest) GetFeedName() string { - if m != nil { - return m.FeedName - } - return "" -} - -// QueryFeedResponse is response type for the Query/Feed RPC method -type QueryFeedResponse struct { - Feed FeedContext `protobuf:"bytes,1,opt,name=feed,proto3" json:"feed"` -} - -func (m *QueryFeedResponse) Reset() { *m = QueryFeedResponse{} } -func (m *QueryFeedResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFeedResponse) ProtoMessage() {} -func (*QueryFeedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{1} -} -func (m *QueryFeedResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeedResponse.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 *QueryFeedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeedResponse.Merge(m, src) -} -func (m *QueryFeedResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryFeedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeedResponse proto.InternalMessageInfo - -func (m *QueryFeedResponse) GetFeed() FeedContext { - if m != nil { - return m.Feed - } - return FeedContext{} -} - -// QueryFeedsRequest is request type for the Query/Feeds RPC method -type QueryFeedsRequest struct { - State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` -} - -func (m *QueryFeedsRequest) Reset() { *m = QueryFeedsRequest{} } -func (m *QueryFeedsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFeedsRequest) ProtoMessage() {} -func (*QueryFeedsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{2} -} -func (m *QueryFeedsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeedsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeedsRequest.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 *QueryFeedsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeedsRequest.Merge(m, src) -} -func (m *QueryFeedsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryFeedsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeedsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeedsRequest proto.InternalMessageInfo - -func (m *QueryFeedsRequest) GetState() string { - if m != nil { - return m.State - } - return "" -} - -// QueryFeedsResponse is response type for the Query/Feeds RPC method -type QueryFeedsResponse struct { - Feeds []FeedContext `protobuf:"bytes,1,rep,name=feeds,proto3" json:"feeds"` -} - -func (m *QueryFeedsResponse) Reset() { *m = QueryFeedsResponse{} } -func (m *QueryFeedsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFeedsResponse) ProtoMessage() {} -func (*QueryFeedsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{3} -} -func (m *QueryFeedsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeedsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeedsResponse.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 *QueryFeedsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeedsResponse.Merge(m, src) -} -func (m *QueryFeedsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryFeedsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeedsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeedsResponse proto.InternalMessageInfo - -func (m *QueryFeedsResponse) GetFeeds() []FeedContext { - if m != nil { - return m.Feeds - } - return nil -} - -// QueryFeedValueRequest is request type for the Query/FeedValue RPC method -type QueryFeedValueRequest struct { - FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty"` -} - -func (m *QueryFeedValueRequest) Reset() { *m = QueryFeedValueRequest{} } -func (m *QueryFeedValueRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFeedValueRequest) ProtoMessage() {} -func (*QueryFeedValueRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{4} -} -func (m *QueryFeedValueRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeedValueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeedValueRequest.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 *QueryFeedValueRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeedValueRequest.Merge(m, src) -} -func (m *QueryFeedValueRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryFeedValueRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeedValueRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeedValueRequest proto.InternalMessageInfo - -func (m *QueryFeedValueRequest) GetFeedName() string { - if m != nil { - return m.FeedName - } - return "" -} - -// QueryFeedValueResponse is response type for the Query/FeedValue RPC method -type QueryFeedValueResponse struct { - FeedValues []FeedValue `protobuf:"bytes,1,rep,name=feed_values,json=feedValues,proto3" json:"feed_values"` -} - -func (m *QueryFeedValueResponse) Reset() { *m = QueryFeedValueResponse{} } -func (m *QueryFeedValueResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFeedValueResponse) ProtoMessage() {} -func (*QueryFeedValueResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{5} -} -func (m *QueryFeedValueResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeedValueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeedValueResponse.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 *QueryFeedValueResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeedValueResponse.Merge(m, src) -} -func (m *QueryFeedValueResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryFeedValueResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeedValueResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeedValueResponse proto.InternalMessageInfo - -func (m *QueryFeedValueResponse) GetFeedValues() []FeedValue { - if m != nil { - return m.FeedValues - } - return nil -} - -// FeedContext defines the feed context struct -type FeedContext struct { - Feed *Feed `protobuf:"bytes,1,opt,name=feed,proto3" json:"feed,omitempty"` - ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Providers []string `protobuf:"bytes,3,rep,name=providers,proto3" json:"providers,omitempty"` - Input string `protobuf:"bytes,4,opt,name=input,proto3" json:"input,omitempty"` - Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` - RepeatedFrequency uint64 `protobuf:"varint,7,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` - ResponseThreshold uint32 `protobuf:"varint,8,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` - State service.RequestContextState `protobuf:"varint,9,opt,name=state,proto3,enum=irismod.service.RequestContextState" json:"state,omitempty"` -} - -func (m *FeedContext) Reset() { *m = FeedContext{} } -func (*FeedContext) ProtoMessage() {} -func (*FeedContext) Descriptor() ([]byte, []int) { - return fileDescriptor_562b782cb9ac197e, []int{6} -} -func (m *FeedContext) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *FeedContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_FeedContext.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 *FeedContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_FeedContext.Merge(m, src) -} -func (m *FeedContext) XXX_Size() int { - return m.Size() -} -func (m *FeedContext) XXX_DiscardUnknown() { - xxx_messageInfo_FeedContext.DiscardUnknown(m) -} - -var xxx_messageInfo_FeedContext proto.InternalMessageInfo - -func (m *FeedContext) GetFeed() *Feed { - if m != nil { - return m.Feed - } - return nil -} - -func (m *FeedContext) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *FeedContext) GetProviders() []string { - if m != nil { - return m.Providers - } - return nil -} - -func (m *FeedContext) GetInput() string { - if m != nil { - return m.Input - } - return "" -} - -func (m *FeedContext) GetTimeout() int64 { - if m != nil { - return m.Timeout - } - return 0 -} - -func (m *FeedContext) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.ServiceFeeCap - } - return nil -} - -func (m *FeedContext) GetRepeatedFrequency() uint64 { - if m != nil { - return m.RepeatedFrequency - } - return 0 -} - -func (m *FeedContext) GetResponseThreshold() uint32 { - if m != nil { - return m.ResponseThreshold - } - return 0 -} - -func (m *FeedContext) GetState() service.RequestContextState { - if m != nil { - return m.State - } - return service.RUNNING -} - -func init() { - proto.RegisterType((*QueryFeedRequest)(nil), "irismod.oracle.QueryFeedRequest") - proto.RegisterType((*QueryFeedResponse)(nil), "irismod.oracle.QueryFeedResponse") - proto.RegisterType((*QueryFeedsRequest)(nil), "irismod.oracle.QueryFeedsRequest") - proto.RegisterType((*QueryFeedsResponse)(nil), "irismod.oracle.QueryFeedsResponse") - proto.RegisterType((*QueryFeedValueRequest)(nil), "irismod.oracle.QueryFeedValueRequest") - proto.RegisterType((*QueryFeedValueResponse)(nil), "irismod.oracle.QueryFeedValueResponse") - proto.RegisterType((*FeedContext)(nil), "irismod.oracle.FeedContext") -} - -func init() { proto.RegisterFile("oracle/query.proto", fileDescriptor_562b782cb9ac197e) } - -var fileDescriptor_562b782cb9ac197e = []byte{ - // 745 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xbd, 0x6f, 0xdb, 0x38, - 0x1c, 0xb5, 0x62, 0x3b, 0x89, 0xe9, 0x4b, 0xee, 0xc2, 0x7c, 0x29, 0x4e, 0x62, 0x2b, 0xba, 0x0f, - 0x28, 0x07, 0x44, 0x4a, 0x72, 0x77, 0x38, 0xc0, 0xd3, 0xc1, 0x01, 0x32, 0x04, 0xf7, 0x81, 0x53, - 0x8b, 0x0e, 0x59, 0x0c, 0xd9, 0xfa, 0xd9, 0x16, 0x6a, 0x89, 0x8a, 0x48, 0x19, 0x35, 0x8a, 0x2e, - 0x9d, 0x3b, 0x14, 0xed, 0xd2, 0xb1, 0x73, 0xe7, 0xfe, 0x11, 0x19, 0x03, 0x74, 0xe9, 0xe4, 0x16, - 0x49, 0xff, 0x82, 0xec, 0x05, 0x0a, 0x8a, 0x94, 0x6b, 0xbb, 0xf9, 0x9a, 0x28, 0xfe, 0xf8, 0xf8, - 0xde, 0x8f, 0xe4, 0x7b, 0x42, 0x98, 0x44, 0x4e, 0xb3, 0x0b, 0xd6, 0x49, 0x0c, 0x51, 0xdf, 0x0c, - 0x23, 0xc2, 0x08, 0x9e, 0xf7, 0x22, 0x8f, 0xfa, 0xc4, 0x35, 0xc5, 0x5a, 0x69, 0x51, 0x62, 0xc4, - 0x20, 0x40, 0xa5, 0x65, 0x0a, 0x51, 0xcf, 0x6b, 0x82, 0x25, 0x47, 0x59, 0x5e, 0x6a, 0x93, 0x36, - 0x49, 0x3e, 0x2d, 0xfe, 0x25, 0xab, 0x1b, 0x6d, 0x42, 0xda, 0x5d, 0xb0, 0x9c, 0xd0, 0xb3, 0x9c, - 0x20, 0x20, 0xcc, 0x61, 0x1e, 0x09, 0xa8, 0x5c, 0x2d, 0x37, 0x09, 0xf5, 0x09, 0xb5, 0x1a, 0x0e, - 0x05, 0xab, 0xb7, 0xd7, 0x00, 0xe6, 0xec, 0x59, 0x4d, 0xe2, 0x05, 0x62, 0x5d, 0xb7, 0xd0, 0x0f, - 0xff, 0xf3, 0xf6, 0x0e, 0x01, 0x5c, 0x1b, 0x4e, 0x62, 0xa0, 0x0c, 0xaf, 0xa3, 0x42, 0x0b, 0xc0, - 0xad, 0x07, 0x8e, 0x0f, 0xaa, 0xa2, 0x29, 0x46, 0xc1, 0x9e, 0xe5, 0x85, 0x7f, 0x1d, 0x1f, 0xf4, - 0x23, 0xb4, 0x30, 0xb2, 0x81, 0x86, 0x24, 0xa0, 0x80, 0xff, 0x40, 0x39, 0x0e, 0x48, 0xc0, 0xc5, - 0xfd, 0x75, 0x73, 0xfc, 0x90, 0x26, 0xc7, 0x1e, 0x90, 0x80, 0xc1, 0x23, 0x56, 0xcb, 0x9d, 0x0e, - 0x2a, 0x19, 0x3b, 0x81, 0xeb, 0xdb, 0x23, 0x5c, 0x34, 0x55, 0x5f, 0x42, 0x79, 0xca, 0x1c, 0x96, - 0x2a, 0x8b, 0x89, 0xfe, 0x0f, 0xc2, 0xa3, 0x50, 0xa9, 0xfb, 0x27, 0xca, 0x73, 0x22, 0xaa, 0x2a, - 0x5a, 0xf6, 0x6e, 0xc2, 0x02, 0xaf, 0xff, 0x8e, 0x96, 0x87, 0x74, 0x0f, 0x9c, 0x6e, 0x0c, 0x77, - 0x3a, 0xfb, 0x31, 0x5a, 0x99, 0xdc, 0x25, 0x1b, 0xf9, 0x0b, 0x15, 0x93, 0x6d, 0x3d, 0x5e, 0x4d, - 0xdb, 0x59, 0xbb, 0xaa, 0x9d, 0x64, 0x9f, 0x6c, 0x06, 0xb5, 0xd2, 0x02, 0xd5, 0xdf, 0xe6, 0x50, - 0x71, 0xa4, 0x5d, 0x6c, 0x8c, 0x5d, 0xe9, 0xd2, 0x55, 0x54, 0xe2, 0x16, 0x71, 0x15, 0x7d, 0x27, - 0x7d, 0x22, 0xba, 0x9e, 0xe2, 0x5d, 0xd7, 0x56, 0x2f, 0x07, 0x95, 0xc5, 0xbe, 0xe3, 0x77, 0xab, - 0xfa, 0xe8, 0xaa, 0x6e, 0x17, 0xe5, 0x94, 0x9f, 0x08, 0x6f, 0xa0, 0x42, 0x18, 0x91, 0x9e, 0xe7, - 0x42, 0x44, 0xd5, 0xac, 0x96, 0x35, 0x0a, 0xf6, 0xd7, 0x02, 0x7f, 0x0a, 0x2f, 0x08, 0x63, 0xa6, - 0xe6, 0xc4, 0x53, 0x24, 0x13, 0xac, 0xa2, 0x19, 0xe6, 0xf9, 0x40, 0x62, 0xa6, 0xe6, 0x35, 0xc5, - 0xc8, 0xda, 0xe9, 0x14, 0xbf, 0x50, 0xd0, 0xf7, 0xa9, 0x58, 0x0b, 0xa0, 0xde, 0x74, 0x42, 0x75, - 0x5a, 0x5e, 0x85, 0xf0, 0xa1, 0xc9, 0x7d, 0x68, 0x4a, 0x1f, 0x9a, 0x07, 0xc4, 0x0b, 0x6a, 0xff, - 0xf1, 0xab, 0xb8, 0x1c, 0x54, 0x56, 0xc6, 0x9b, 0x95, 0xfb, 0xf5, 0x37, 0x1f, 0x2a, 0x3b, 0x6d, - 0x8f, 0x75, 0xe2, 0x86, 0xd9, 0x24, 0xbe, 0xc5, 0xaf, 0x21, 0x00, 0x96, 0x8c, 0x9d, 0xb8, 0xb1, - 0x43, 0xdd, 0x87, 0x3b, 0x6d, 0x62, 0xb1, 0x7e, 0x08, 0x34, 0xe1, 0xa3, 0xf6, 0x9c, 0xa4, 0x38, - 0x04, 0x38, 0x70, 0x42, 0xfc, 0x37, 0xc2, 0x11, 0x84, 0xe0, 0x30, 0x70, 0xeb, 0xad, 0x88, 0x3f, - 0x73, 0xd0, 0xec, 0xab, 0x33, 0x9a, 0x62, 0xe4, 0x6a, 0x9b, 0x97, 0x83, 0xca, 0x9a, 0xd0, 0xfd, - 0x16, 0xa3, 0xdb, 0x0b, 0x69, 0xf1, 0x30, 0xad, 0x09, 0x36, 0xf1, 0xe8, 0x75, 0xd6, 0x89, 0x80, - 0x76, 0x48, 0xd7, 0x55, 0x67, 0x35, 0xc5, 0x98, 0x1b, 0x67, 0x9b, 0xc4, 0x24, 0x6c, 0xa2, 0x78, - 0x3f, 0xad, 0xe1, 0x6a, 0xea, 0xf5, 0x82, 0xa6, 0x18, 0xf3, 0xfb, 0x3f, 0x0d, 0x5f, 0x39, 0x0d, - 0xbe, 0xb4, 0xa5, 0x34, 0xc5, 0x3d, 0x8e, 0x95, 0x89, 0xa8, 0xe6, 0x5e, 0xbd, 0xae, 0x64, 0xf6, - 0x3f, 0x4f, 0xa1, 0x7c, 0xe2, 0x49, 0xdc, 0x43, 0x39, 0x6e, 0x0a, 0xac, 0x4d, 0x5a, 0x65, 0x32, - 0xdf, 0xa5, 0xad, 0x1b, 0x10, 0xa2, 0x43, 0x7d, 0xfb, 0xe9, 0xbb, 0x4f, 0x2f, 0xa7, 0x7e, 0xc4, - 0x5b, 0x96, 0x84, 0xca, 0x1f, 0x94, 0x95, 0xc4, 0xc7, 0x7a, 0x3c, 0xcc, 0xc8, 0x13, 0xec, 0xa3, - 0x7c, 0x12, 0x4a, 0x7c, 0x3d, 0x6d, 0x9a, 0xed, 0x92, 0x7e, 0x13, 0x44, 0x4a, 0x6f, 0x26, 0xd2, - 0xab, 0x78, 0xf9, 0x4a, 0x69, 0xfc, 0x4c, 0x41, 0x85, 0x61, 0x8e, 0xf0, 0xcf, 0xd7, 0x12, 0x8e, - 0xa6, 0xba, 0xf4, 0xcb, 0x6d, 0x30, 0xa9, 0xbd, 0x9b, 0x68, 0xff, 0x8a, 0x8d, 0x5b, 0x8f, 0x6d, - 0x89, 0xa4, 0xd7, 0x8e, 0x4e, 0xcf, 0xcb, 0xca, 0xd9, 0x79, 0x59, 0xf9, 0x78, 0x5e, 0x56, 0x9e, - 0x5f, 0x94, 0x33, 0x67, 0x17, 0xe5, 0xcc, 0xfb, 0x8b, 0x72, 0xe6, 0x78, 0xf7, 0x76, 0xd7, 0xfa, - 0xc4, 0x8d, 0xbb, 0x40, 0xa5, 0x48, 0x63, 0x3a, 0xf9, 0x25, 0xff, 0xf6, 0x25, 0x00, 0x00, 0xff, - 0xff, 0xb7, 0xe1, 0x19, 0x0d, 0x38, 0x06, 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 { - // Feed queries the feed - Feed(ctx context.Context, in *QueryFeedRequest, opts ...grpc.CallOption) (*QueryFeedResponse, error) - // QueryFeedsRequest queries the feed list - Feeds(ctx context.Context, in *QueryFeedsRequest, opts ...grpc.CallOption) (*QueryFeedsResponse, error) - // FeedValue queries the feed value - FeedValue(ctx context.Context, in *QueryFeedValueRequest, opts ...grpc.CallOption) (*QueryFeedValueResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Feed(ctx context.Context, in *QueryFeedRequest, opts ...grpc.CallOption) (*QueryFeedResponse, error) { - out := new(QueryFeedResponse) - err := c.cc.Invoke(ctx, "/irismod.oracle.Query/Feed", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Feeds(ctx context.Context, in *QueryFeedsRequest, opts ...grpc.CallOption) (*QueryFeedsResponse, error) { - out := new(QueryFeedsResponse) - err := c.cc.Invoke(ctx, "/irismod.oracle.Query/Feeds", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) FeedValue(ctx context.Context, in *QueryFeedValueRequest, opts ...grpc.CallOption) (*QueryFeedValueResponse, error) { - out := new(QueryFeedValueResponse) - err := c.cc.Invoke(ctx, "/irismod.oracle.Query/FeedValue", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Feed queries the feed - Feed(context.Context, *QueryFeedRequest) (*QueryFeedResponse, error) - // QueryFeedsRequest queries the feed list - Feeds(context.Context, *QueryFeedsRequest) (*QueryFeedsResponse, error) - // FeedValue queries the feed value - FeedValue(context.Context, *QueryFeedValueRequest) (*QueryFeedValueResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Feed(ctx context.Context, req *QueryFeedRequest) (*QueryFeedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Feed not implemented") -} -func (*UnimplementedQueryServer) Feeds(ctx context.Context, req *QueryFeedsRequest) (*QueryFeedsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Feeds not implemented") -} -func (*UnimplementedQueryServer) FeedValue(ctx context.Context, req *QueryFeedValueRequest) (*QueryFeedValueResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FeedValue not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Feed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFeedRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Feed(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.oracle.Query/Feed", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Feed(ctx, req.(*QueryFeedRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Feeds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFeedsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Feeds(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.oracle.Query/Feeds", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Feeds(ctx, req.(*QueryFeedsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_FeedValue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFeedValueRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).FeedValue(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.oracle.Query/FeedValue", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).FeedValue(ctx, req.(*QueryFeedValueRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.oracle.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Feed", - Handler: _Query_Feed_Handler, - }, - { - MethodName: "Feeds", - Handler: _Query_Feeds_Handler, - }, - { - MethodName: "FeedValue", - Handler: _Query_FeedValue_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "oracle/query.proto", -} - -func (m *QueryFeedRequest) 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 *QueryFeedRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FeedName) > 0 { - i -= len(m.FeedName) - copy(dAtA[i:], m.FeedName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.FeedName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryFeedResponse) 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 *QueryFeedResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Feed.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 *QueryFeedsRequest) 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 *QueryFeedsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeedsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.State) > 0 { - i -= len(m.State) - copy(dAtA[i:], m.State) - i = encodeVarintQuery(dAtA, i, uint64(len(m.State))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryFeedsResponse) 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 *QueryFeedsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeedsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Feeds) > 0 { - for iNdEx := len(m.Feeds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Feeds[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 *QueryFeedValueRequest) 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 *QueryFeedValueRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeedValueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FeedName) > 0 { - i -= len(m.FeedName) - copy(dAtA[i:], m.FeedName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.FeedName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryFeedValueResponse) 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 *QueryFeedValueResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeedValueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FeedValues) > 0 { - for iNdEx := len(m.FeedValues) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FeedValues[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 *FeedContext) 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 *FeedContext) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FeedContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.State != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x48 - } - if m.ResponseThreshold != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.ResponseThreshold)) - i-- - dAtA[i] = 0x40 - } - if m.RepeatedFrequency != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.RepeatedFrequency)) - i-- - dAtA[i] = 0x38 - } - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if m.Timeout != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Timeout)) - i-- - dAtA[i] = 0x28 - } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x22 - } - if len(m.Providers) > 0 { - for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Providers[iNdEx]) - copy(dAtA[i:], m.Providers[iNdEx]) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Providers[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0x12 - } - if m.Feed != nil { - { - size, err := m.Feed.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 *QueryFeedRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeedName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryFeedResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Feed.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryFeedsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.State) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryFeedsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Feeds) > 0 { - for _, e := range m.Feeds { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryFeedValueRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeedName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryFeedValueResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.FeedValues) > 0 { - for _, e := range m.FeedValues { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *FeedContext) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Feed != nil { - l = m.Feed.Size() - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if len(m.Providers) > 0 { - for _, s := range m.Providers { - l = len(s) - n += 1 + l + sovQuery(uint64(l)) - } - } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Timeout != 0 { - n += 1 + sovQuery(uint64(m.Timeout)) - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - if m.RepeatedFrequency != 0 { - n += 1 + sovQuery(uint64(m.RepeatedFrequency)) - } - if m.ResponseThreshold != 0 { - n += 1 + sovQuery(uint64(m.ResponseThreshold)) - } - if m.State != 0 { - n += 1 + sovQuery(uint64(m.State)) - } - 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 *QueryFeedRequest) 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: QueryFeedRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeedRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryFeedResponse) 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: QueryFeedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeedResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Feed", 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.Feed.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryFeedsRequest) 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: QueryFeedsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeedsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field State", 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.State = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryFeedsResponse) 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: QueryFeedsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeedsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Feeds", 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.Feeds = append(m.Feeds, FeedContext{}) - if err := m.Feeds[len(m.Feeds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryFeedValueRequest) 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: QueryFeedValueRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeedValueRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryFeedValueResponse) 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: QueryFeedValueResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeedValueResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedValues", 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.FeedValues = append(m.FeedValues, FeedValue{}) - if err := m.FeedValues[len(m.FeedValues)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FeedContext) 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: FeedContext: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FeedContext: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Feed", 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.Feed == nil { - m.Feed = &Feed{} - } - if err := m.Feed.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - m.Timeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timeout |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", 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.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) - } - m.RepeatedFrequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedFrequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) - } - m.ResponseThreshold = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ResponseThreshold |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - 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 ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= service.RequestContextState(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (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/modules/oracle/tx.pb.go b/modules/oracle/tx.pb.go deleted file mode 100644 index fd417231..00000000 --- a/modules/oracle/tx.pb.go +++ /dev/null @@ -1,2598 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: oracle/tx.proto - -package oracle - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - 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 - -// MsgCreateFeed defines an sdk.Msg type that supports creating a feed -type MsgCreateFeed struct { - FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` - LatestHistory uint64 `protobuf:"varint,2,opt,name=latest_history,json=latestHistory,proto3" json:"latest_history,omitempty" yaml:"latest_history"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"` - ServiceName string `protobuf:"bytes,5,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Providers []string `protobuf:"bytes,6,rep,name=providers,proto3" json:"providers,omitempty"` - Input string `protobuf:"bytes,7,opt,name=input,proto3" json:"input,omitempty"` - Timeout int64 `protobuf:"varint,8,opt,name=timeout,proto3" json:"timeout,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,9,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` - RepeatedFrequency uint64 `protobuf:"varint,10,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` - AggregateFunc string `protobuf:"bytes,11,opt,name=aggregate_func,json=aggregateFunc,proto3" json:"aggregate_func,omitempty" yaml:"aggregate_func"` - ValueJsonPath string `protobuf:"bytes,12,opt,name=value_json_path,json=valueJsonPath,proto3" json:"value_json_path,omitempty" yaml:"value_json_path"` - ResponseThreshold uint32 `protobuf:"varint,13,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` -} - -func (m *MsgCreateFeed) Reset() { *m = MsgCreateFeed{} } -func (m *MsgCreateFeed) String() string { return proto.CompactTextString(m) } -func (*MsgCreateFeed) ProtoMessage() {} -func (*MsgCreateFeed) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{0} -} -func (m *MsgCreateFeed) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateFeed.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 *MsgCreateFeed) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateFeed.Merge(m, src) -} -func (m *MsgCreateFeed) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateFeed) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateFeed.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateFeed proto.InternalMessageInfo - -func (m *MsgCreateFeed) GetFeedName() string { - if m != nil { - return m.FeedName - } - return "" -} - -func (m *MsgCreateFeed) GetLatestHistory() uint64 { - if m != nil { - return m.LatestHistory - } - return 0 -} - -func (m *MsgCreateFeed) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *MsgCreateFeed) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -func (m *MsgCreateFeed) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *MsgCreateFeed) GetProviders() []string { - if m != nil { - return m.Providers - } - return nil -} - -func (m *MsgCreateFeed) GetInput() string { - if m != nil { - return m.Input - } - return "" -} - -func (m *MsgCreateFeed) GetTimeout() int64 { - if m != nil { - return m.Timeout - } - return 0 -} - -func (m *MsgCreateFeed) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.ServiceFeeCap - } - return nil -} - -func (m *MsgCreateFeed) GetRepeatedFrequency() uint64 { - if m != nil { - return m.RepeatedFrequency - } - return 0 -} - -func (m *MsgCreateFeed) GetAggregateFunc() string { - if m != nil { - return m.AggregateFunc - } - return "" -} - -func (m *MsgCreateFeed) GetValueJsonPath() string { - if m != nil { - return m.ValueJsonPath - } - return "" -} - -func (m *MsgCreateFeed) GetResponseThreshold() uint32 { - if m != nil { - return m.ResponseThreshold - } - return 0 -} - -// MsgCreateFeedResponse defines the Msg/CreateFeed response type. -type MsgCreateFeedResponse struct { -} - -func (m *MsgCreateFeedResponse) Reset() { *m = MsgCreateFeedResponse{} } -func (m *MsgCreateFeedResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateFeedResponse) ProtoMessage() {} -func (*MsgCreateFeedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{1} -} -func (m *MsgCreateFeedResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateFeedResponse.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 *MsgCreateFeedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateFeedResponse.Merge(m, src) -} -func (m *MsgCreateFeedResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateFeedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateFeedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateFeedResponse proto.InternalMessageInfo - -// MsgPauseFeed defines an sdk.Msg type that supports stating a feed -type MsgStartFeed struct { - FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` - Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` -} - -func (m *MsgStartFeed) Reset() { *m = MsgStartFeed{} } -func (m *MsgStartFeed) String() string { return proto.CompactTextString(m) } -func (*MsgStartFeed) ProtoMessage() {} -func (*MsgStartFeed) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{2} -} -func (m *MsgStartFeed) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgStartFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgStartFeed.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 *MsgStartFeed) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgStartFeed.Merge(m, src) -} -func (m *MsgStartFeed) XXX_Size() int { - return m.Size() -} -func (m *MsgStartFeed) XXX_DiscardUnknown() { - xxx_messageInfo_MsgStartFeed.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgStartFeed proto.InternalMessageInfo - -func (m *MsgStartFeed) GetFeedName() string { - if m != nil { - return m.FeedName - } - return "" -} - -func (m *MsgStartFeed) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -// MsgStartFeedResponse defines the Msg/StartFeed response type. -type MsgStartFeedResponse struct { -} - -func (m *MsgStartFeedResponse) Reset() { *m = MsgStartFeedResponse{} } -func (m *MsgStartFeedResponse) String() string { return proto.CompactTextString(m) } -func (*MsgStartFeedResponse) ProtoMessage() {} -func (*MsgStartFeedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{3} -} -func (m *MsgStartFeedResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgStartFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgStartFeedResponse.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 *MsgStartFeedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgStartFeedResponse.Merge(m, src) -} -func (m *MsgStartFeedResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgStartFeedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgStartFeedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgStartFeedResponse proto.InternalMessageInfo - -// MsgPauseFeed defines an sdk.Msg type that supports pausing a feed -type MsgPauseFeed struct { - FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` - Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` -} - -func (m *MsgPauseFeed) Reset() { *m = MsgPauseFeed{} } -func (m *MsgPauseFeed) String() string { return proto.CompactTextString(m) } -func (*MsgPauseFeed) ProtoMessage() {} -func (*MsgPauseFeed) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{4} -} -func (m *MsgPauseFeed) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPauseFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPauseFeed.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 *MsgPauseFeed) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPauseFeed.Merge(m, src) -} -func (m *MsgPauseFeed) XXX_Size() int { - return m.Size() -} -func (m *MsgPauseFeed) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPauseFeed.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPauseFeed proto.InternalMessageInfo - -func (m *MsgPauseFeed) GetFeedName() string { - if m != nil { - return m.FeedName - } - return "" -} - -func (m *MsgPauseFeed) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -// MsgPauseFeedResponse defines the Msg/PauseFeed response type. -type MsgPauseFeedResponse struct { -} - -func (m *MsgPauseFeedResponse) Reset() { *m = MsgPauseFeedResponse{} } -func (m *MsgPauseFeedResponse) String() string { return proto.CompactTextString(m) } -func (*MsgPauseFeedResponse) ProtoMessage() {} -func (*MsgPauseFeedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{5} -} -func (m *MsgPauseFeedResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPauseFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPauseFeedResponse.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 *MsgPauseFeedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPauseFeedResponse.Merge(m, src) -} -func (m *MsgPauseFeedResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgPauseFeedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPauseFeedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPauseFeedResponse proto.InternalMessageInfo - -// MsgEditFeed defines an sdk.Msg type that supports editing a feed -type MsgEditFeed struct { - FeedName string `protobuf:"bytes,1,opt,name=feed_name,json=feedName,proto3" json:"feed_name,omitempty" yaml:"feed_name"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - LatestHistory uint64 `protobuf:"varint,3,opt,name=latest_history,json=latestHistory,proto3" json:"latest_history,omitempty" yaml:"latest_history"` - Providers []string `protobuf:"bytes,4,rep,name=providers,proto3" json:"providers,omitempty"` - Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` - RepeatedFrequency uint64 `protobuf:"varint,7,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` - ResponseThreshold uint32 `protobuf:"varint,8,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` - Creator string `protobuf:"bytes,9,opt,name=creator,proto3" json:"creator,omitempty"` -} - -func (m *MsgEditFeed) Reset() { *m = MsgEditFeed{} } -func (m *MsgEditFeed) String() string { return proto.CompactTextString(m) } -func (*MsgEditFeed) ProtoMessage() {} -func (*MsgEditFeed) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{6} -} -func (m *MsgEditFeed) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEditFeed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEditFeed.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 *MsgEditFeed) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEditFeed.Merge(m, src) -} -func (m *MsgEditFeed) XXX_Size() int { - return m.Size() -} -func (m *MsgEditFeed) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEditFeed.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEditFeed proto.InternalMessageInfo - -func (m *MsgEditFeed) GetFeedName() string { - if m != nil { - return m.FeedName - } - return "" -} - -func (m *MsgEditFeed) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *MsgEditFeed) GetLatestHistory() uint64 { - if m != nil { - return m.LatestHistory - } - return 0 -} - -func (m *MsgEditFeed) GetProviders() []string { - if m != nil { - return m.Providers - } - return nil -} - -func (m *MsgEditFeed) GetTimeout() int64 { - if m != nil { - return m.Timeout - } - return 0 -} - -func (m *MsgEditFeed) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.ServiceFeeCap - } - return nil -} - -func (m *MsgEditFeed) GetRepeatedFrequency() uint64 { - if m != nil { - return m.RepeatedFrequency - } - return 0 -} - -func (m *MsgEditFeed) GetResponseThreshold() uint32 { - if m != nil { - return m.ResponseThreshold - } - return 0 -} - -func (m *MsgEditFeed) GetCreator() string { - if m != nil { - return m.Creator - } - return "" -} - -// MsgEditFeedResponse defines the Msg/EditFeed response type. -type MsgEditFeedResponse struct { -} - -func (m *MsgEditFeedResponse) Reset() { *m = MsgEditFeedResponse{} } -func (m *MsgEditFeedResponse) String() string { return proto.CompactTextString(m) } -func (*MsgEditFeedResponse) ProtoMessage() {} -func (*MsgEditFeedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cb5390096518ffda, []int{7} -} -func (m *MsgEditFeedResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEditFeedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEditFeedResponse.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 *MsgEditFeedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEditFeedResponse.Merge(m, src) -} -func (m *MsgEditFeedResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgEditFeedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEditFeedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEditFeedResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateFeed)(nil), "irismod.oracle.MsgCreateFeed") - proto.RegisterType((*MsgCreateFeedResponse)(nil), "irismod.oracle.MsgCreateFeedResponse") - proto.RegisterType((*MsgStartFeed)(nil), "irismod.oracle.MsgStartFeed") - proto.RegisterType((*MsgStartFeedResponse)(nil), "irismod.oracle.MsgStartFeedResponse") - proto.RegisterType((*MsgPauseFeed)(nil), "irismod.oracle.MsgPauseFeed") - proto.RegisterType((*MsgPauseFeedResponse)(nil), "irismod.oracle.MsgPauseFeedResponse") - proto.RegisterType((*MsgEditFeed)(nil), "irismod.oracle.MsgEditFeed") - proto.RegisterType((*MsgEditFeedResponse)(nil), "irismod.oracle.MsgEditFeedResponse") -} - -func init() { proto.RegisterFile("oracle/tx.proto", fileDescriptor_cb5390096518ffda) } - -var fileDescriptor_cb5390096518ffda = []byte{ - // 764 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x41, 0x6f, 0xda, 0x48, - 0x14, 0xc6, 0x40, 0x08, 0x0c, 0x21, 0xd9, 0x75, 0x48, 0xe2, 0xb0, 0x09, 0x20, 0xef, 0xae, 0xc4, - 0x25, 0xf6, 0x26, 0x7b, 0xcb, 0x69, 0x45, 0xb4, 0x68, 0x15, 0x85, 0x4d, 0xe4, 0xdd, 0x53, 0x7b, - 0xb0, 0x06, 0xfb, 0x61, 0xdc, 0x62, 0x8f, 0xeb, 0x19, 0xa3, 0x72, 0xec, 0x3f, 0xa8, 0xfa, 0x27, - 0x2a, 0xf5, 0x97, 0xa4, 0xb7, 0x1c, 0x7b, 0xa2, 0x55, 0xf2, 0x0f, 0xf8, 0x05, 0x95, 0x6d, 0x6c, - 0x6c, 0x40, 0x89, 0x8a, 0x54, 0xa9, 0x27, 0x7b, 0xde, 0xf7, 0xe6, 0xfb, 0xde, 0xf8, 0xbd, 0xcf, - 0x83, 0x76, 0x88, 0x8b, 0xb5, 0x21, 0xc8, 0xec, 0xb5, 0xe4, 0xb8, 0x84, 0x11, 0x7e, 0xdb, 0x74, - 0x4d, 0x6a, 0x11, 0x5d, 0x0a, 0x81, 0x5a, 0xd5, 0x20, 0x06, 0x09, 0x20, 0xd9, 0x7f, 0x0b, 0xb3, - 0x6a, 0x75, 0x8d, 0x50, 0x8b, 0x50, 0xb9, 0x87, 0x29, 0xc8, 0xa3, 0xd3, 0x1e, 0x30, 0x7c, 0x2a, - 0x6b, 0xc4, 0xb4, 0x43, 0x5c, 0x7c, 0x53, 0x40, 0x95, 0x2e, 0x35, 0x2e, 0x5c, 0xc0, 0x0c, 0x3a, - 0x00, 0x3a, 0x7f, 0x8a, 0x4a, 0x7d, 0x00, 0x5d, 0xb5, 0xb1, 0x05, 0x02, 0xd7, 0xe4, 0x5a, 0xa5, - 0x76, 0x75, 0x3a, 0x69, 0xfc, 0x34, 0xc6, 0xd6, 0xf0, 0x5c, 0x8c, 0x21, 0x51, 0x29, 0xfa, 0xef, - 0xff, 0x62, 0x0b, 0xf8, 0xbf, 0xd0, 0xf6, 0x10, 0x33, 0xa0, 0x4c, 0x1d, 0x98, 0x94, 0x11, 0x77, - 0x2c, 0x64, 0x9b, 0x5c, 0x2b, 0xdf, 0x3e, 0x9c, 0x4e, 0x1a, 0x7b, 0xe1, 0xbe, 0x34, 0x2e, 0x2a, - 0x95, 0x30, 0xf0, 0x4f, 0xb8, 0xe6, 0x9b, 0xa8, 0xac, 0x03, 0xd5, 0x5c, 0xd3, 0x61, 0x26, 0xb1, - 0x85, 0x9c, 0x2f, 0xab, 0x24, 0x43, 0xbc, 0x80, 0x36, 0x35, 0xbf, 0x48, 0xe2, 0x0a, 0xf9, 0x00, - 0x8d, 0x96, 0xfc, 0x39, 0xda, 0xa2, 0xe0, 0x8e, 0x4c, 0x0d, 0xc2, 0x9a, 0x37, 0x82, 0x9a, 0x0f, - 0xa6, 0x93, 0xc6, 0x6e, 0xa8, 0x9d, 0x44, 0x45, 0xa5, 0x3c, 0x5b, 0x06, 0x95, 0x1f, 0xa1, 0x92, - 0xe3, 0x92, 0x91, 0xa9, 0x83, 0x4b, 0x85, 0x42, 0x33, 0xd7, 0x2a, 0x29, 0xf3, 0x00, 0x5f, 0x45, - 0x1b, 0xa6, 0xed, 0x78, 0x4c, 0xd8, 0x0c, 0x14, 0xc3, 0x85, 0x5f, 0x09, 0x33, 0x2d, 0x20, 0x1e, - 0x13, 0x8a, 0x4d, 0xae, 0x95, 0x53, 0xa2, 0x25, 0xff, 0x8e, 0x43, 0x3b, 0x91, 0x58, 0x1f, 0x40, - 0xd5, 0xb0, 0x23, 0x94, 0x9a, 0xb9, 0x56, 0xf9, 0xec, 0x50, 0x0a, 0xfb, 0x20, 0xf9, 0x7d, 0x90, - 0x66, 0x7d, 0x90, 0x2e, 0x88, 0x69, 0xb7, 0xaf, 0x6f, 0x27, 0x8d, 0xcc, 0x74, 0xd2, 0xd8, 0x4f, - 0x17, 0x3b, 0xdb, 0x2f, 0x7e, 0xf8, 0xdc, 0x38, 0x31, 0x4c, 0x36, 0xf0, 0x7a, 0x92, 0x46, 0x2c, - 0xd9, 0x6f, 0xba, 0x0d, 0x2c, 0x78, 0x0e, 0xbc, 0xde, 0x09, 0xd5, 0x5f, 0x9e, 0x18, 0x44, 0x66, - 0x63, 0x07, 0x68, 0xc0, 0x47, 0x95, 0xca, 0x8c, 0xa2, 0x03, 0x70, 0x81, 0x1d, 0xfe, 0x0a, 0xf1, - 0x2e, 0x38, 0x7e, 0x7b, 0x75, 0xb5, 0xef, 0xc2, 0x2b, 0x0f, 0x6c, 0x6d, 0x2c, 0xa0, 0xa0, 0x41, - 0xc7, 0xd3, 0x49, 0xe3, 0x30, 0xd4, 0x5d, 0xce, 0x11, 0x95, 0x9f, 0xa3, 0x60, 0x27, 0x8a, 0xf9, - 0xad, 0xc6, 0x86, 0xe1, 0x82, 0x81, 0x19, 0xa8, 0x7d, 0xcf, 0xd6, 0x84, 0x72, 0xf0, 0xb9, 0x13, - 0xad, 0x4e, 0xe3, 0xa2, 0x52, 0x89, 0x03, 0x1d, 0xcf, 0xd6, 0xf8, 0x36, 0xda, 0x19, 0xe1, 0xa1, - 0x07, 0xea, 0x0b, 0x4a, 0x6c, 0xd5, 0xc1, 0x6c, 0x20, 0x6c, 0x05, 0x14, 0xb5, 0xf9, 0x47, 0x58, - 0x48, 0x10, 0x95, 0x4a, 0x10, 0xb9, 0xa4, 0xc4, 0xbe, 0xc1, 0x6c, 0x10, 0x9e, 0x89, 0x3a, 0xc4, - 0xa6, 0xa0, 0xb2, 0x81, 0x0b, 0x74, 0x40, 0x86, 0xba, 0x50, 0x69, 0x72, 0xad, 0x4a, 0xfa, 0x4c, - 0x8b, 0x39, 0xc1, 0x99, 0xc2, 0xe0, 0xff, 0x71, 0xec, 0x00, 0xed, 0xa5, 0x2c, 0xa0, 0xcc, 0x32, - 0xc4, 0xe7, 0x68, 0xab, 0x4b, 0x8d, 0xff, 0x18, 0x76, 0xd9, 0xba, 0xd6, 0x48, 0x8c, 0x6d, 0x36, - 0x35, 0xb6, 0xe2, 0x3e, 0xaa, 0x26, 0xc9, 0x17, 0x44, 0x6f, 0xb0, 0x47, 0xe1, 0x7b, 0x89, 0xc6, - 0xe4, 0xb1, 0xe8, 0xfb, 0x3c, 0x2a, 0x77, 0xa9, 0xf1, 0xb7, 0x6e, 0xae, 0x7d, 0xd2, 0x05, 0x0b, - 0x67, 0x97, 0x2d, 0xbc, 0xfc, 0x9b, 0xc8, 0x7d, 0xe3, 0x6f, 0x22, 0x65, 0xd7, 0xfc, 0xa2, 0x5d, - 0x13, 0xc6, 0xdc, 0x78, 0xda, 0x98, 0x85, 0x1f, 0xd3, 0x98, 0x9b, 0x6b, 0x1a, 0x73, 0xb5, 0x25, - 0x8a, 0xeb, 0x59, 0x22, 0x39, 0x41, 0xa5, 0xf4, 0x04, 0xed, 0xa1, 0xdd, 0xc4, 0xa0, 0x44, 0x03, - 0x74, 0xf6, 0x31, 0x8b, 0x72, 0x5d, 0x6a, 0xf0, 0x0a, 0x42, 0x89, 0xbb, 0xe4, 0x58, 0x4a, 0x5f, - 0x52, 0x52, 0xca, 0x67, 0xb5, 0xdf, 0x1f, 0x85, 0x23, 0x6e, 0xfe, 0x0a, 0x15, 0xe3, 0xc1, 0xfc, - 0x65, 0xc5, 0x96, 0x08, 0xac, 0xfd, 0xfa, 0x08, 0x18, 0xb3, 0x5d, 0xa3, 0xd2, 0xdc, 0xd1, 0x47, - 0x2b, 0x76, 0xc4, 0x68, 0xed, 0xb7, 0xc7, 0xd0, 0x24, 0xe1, 0xdc, 0xad, 0xab, 0x08, 0x63, 0x74, - 0x25, 0xe1, 0x92, 0x19, 0xdb, 0x97, 0xb7, 0xf7, 0x75, 0xee, 0xee, 0xbe, 0xce, 0x7d, 0xb9, 0xaf, - 0x73, 0x6f, 0x1f, 0xea, 0x99, 0xbb, 0x87, 0x7a, 0xe6, 0xd3, 0x43, 0x3d, 0xf3, 0xec, 0x8f, 0xa7, - 0x07, 0xce, 0x22, 0xba, 0x37, 0x04, 0x2a, 0x87, 0x02, 0xbd, 0x42, 0x70, 0xcd, 0xff, 0xf9, 0x35, - 0x00, 0x00, 0xff, 0xff, 0xdb, 0xb1, 0xa2, 0xd8, 0x3f, 0x08, 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 { - // CreateFeed defines a method for creating a new feed. - CreateFeed(ctx context.Context, in *MsgCreateFeed, opts ...grpc.CallOption) (*MsgCreateFeedResponse, error) - // EditFeed defines a method for editing a feed. - EditFeed(ctx context.Context, in *MsgEditFeed, opts ...grpc.CallOption) (*MsgEditFeedResponse, error) - // StartFeed defines a method for starting a feed - StartFeed(ctx context.Context, in *MsgStartFeed, opts ...grpc.CallOption) (*MsgStartFeedResponse, error) - // PauseFeed defines a method for pausing a feed. - PauseFeed(ctx context.Context, in *MsgPauseFeed, opts ...grpc.CallOption) (*MsgPauseFeedResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateFeed(ctx context.Context, in *MsgCreateFeed, opts ...grpc.CallOption) (*MsgCreateFeedResponse, error) { - out := new(MsgCreateFeedResponse) - err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/CreateFeed", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) EditFeed(ctx context.Context, in *MsgEditFeed, opts ...grpc.CallOption) (*MsgEditFeedResponse, error) { - out := new(MsgEditFeedResponse) - err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/EditFeed", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) StartFeed(ctx context.Context, in *MsgStartFeed, opts ...grpc.CallOption) (*MsgStartFeedResponse, error) { - out := new(MsgStartFeedResponse) - err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/StartFeed", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) PauseFeed(ctx context.Context, in *MsgPauseFeed, opts ...grpc.CallOption) (*MsgPauseFeedResponse, error) { - out := new(MsgPauseFeedResponse) - err := c.cc.Invoke(ctx, "/irismod.oracle.Msg/PauseFeed", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateFeed defines a method for creating a new feed. - CreateFeed(context.Context, *MsgCreateFeed) (*MsgCreateFeedResponse, error) - // EditFeed defines a method for editing a feed. - EditFeed(context.Context, *MsgEditFeed) (*MsgEditFeedResponse, error) - // StartFeed defines a method for starting a feed - StartFeed(context.Context, *MsgStartFeed) (*MsgStartFeedResponse, error) - // PauseFeed defines a method for pausing a feed. - PauseFeed(context.Context, *MsgPauseFeed) (*MsgPauseFeedResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateFeed(ctx context.Context, req *MsgCreateFeed) (*MsgCreateFeedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateFeed not implemented") -} -func (*UnimplementedMsgServer) EditFeed(ctx context.Context, req *MsgEditFeed) (*MsgEditFeedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EditFeed not implemented") -} -func (*UnimplementedMsgServer) StartFeed(ctx context.Context, req *MsgStartFeed) (*MsgStartFeedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method StartFeed not implemented") -} -func (*UnimplementedMsgServer) PauseFeed(ctx context.Context, req *MsgPauseFeed) (*MsgPauseFeedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PauseFeed not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateFeed) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateFeed(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.oracle.Msg/CreateFeed", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateFeed(ctx, req.(*MsgCreateFeed)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_EditFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgEditFeed) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).EditFeed(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.oracle.Msg/EditFeed", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).EditFeed(ctx, req.(*MsgEditFeed)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_StartFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgStartFeed) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).StartFeed(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.oracle.Msg/StartFeed", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).StartFeed(ctx, req.(*MsgStartFeed)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_PauseFeed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgPauseFeed) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).PauseFeed(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.oracle.Msg/PauseFeed", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).PauseFeed(ctx, req.(*MsgPauseFeed)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.oracle.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateFeed", - Handler: _Msg_CreateFeed_Handler, - }, - { - MethodName: "EditFeed", - Handler: _Msg_EditFeed_Handler, - }, - { - MethodName: "StartFeed", - Handler: _Msg_StartFeed_Handler, - }, - { - MethodName: "PauseFeed", - Handler: _Msg_PauseFeed_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "oracle/tx.proto", -} - -func (m *MsgCreateFeed) 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 *MsgCreateFeed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ResponseThreshold != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ResponseThreshold)) - i-- - dAtA[i] = 0x68 - } - if len(m.ValueJsonPath) > 0 { - i -= len(m.ValueJsonPath) - copy(dAtA[i:], m.ValueJsonPath) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValueJsonPath))) - i-- - dAtA[i] = 0x62 - } - if len(m.AggregateFunc) > 0 { - i -= len(m.AggregateFunc) - copy(dAtA[i:], m.AggregateFunc) - i = encodeVarintTx(dAtA, i, uint64(len(m.AggregateFunc))) - i-- - dAtA[i] = 0x5a - } - if m.RepeatedFrequency != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) - i-- - dAtA[i] = 0x50 - } - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - } - if m.Timeout != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) - i-- - dAtA[i] = 0x40 - } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintTx(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x3a - } - if len(m.Providers) > 0 { - for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Providers[iNdEx]) - copy(dAtA[i:], m.Providers[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) - i-- - dAtA[i] = 0x32 - } - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0x2a - } - 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] = 0x22 - } - 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] = 0x1a - } - if m.LatestHistory != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.LatestHistory)) - i-- - dAtA[i] = 0x10 - } - if len(m.FeedName) > 0 { - i -= len(m.FeedName) - copy(dAtA[i:], m.FeedName) - i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateFeedResponse) 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 *MsgCreateFeedResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgStartFeed) 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 *MsgStartFeed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgStartFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x12 - } - if len(m.FeedName) > 0 { - i -= len(m.FeedName) - copy(dAtA[i:], m.FeedName) - i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgStartFeedResponse) 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 *MsgStartFeedResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgStartFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgPauseFeed) 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 *MsgPauseFeed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPauseFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x12 - } - if len(m.FeedName) > 0 { - i -= len(m.FeedName) - copy(dAtA[i:], m.FeedName) - i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgPauseFeedResponse) 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 *MsgPauseFeedResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPauseFeedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgEditFeed) 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 *MsgEditFeed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditFeed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x4a - } - if m.ResponseThreshold != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ResponseThreshold)) - i-- - dAtA[i] = 0x40 - } - if m.RepeatedFrequency != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) - i-- - dAtA[i] = 0x38 - } - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if m.Timeout != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) - i-- - dAtA[i] = 0x28 - } - if len(m.Providers) > 0 { - for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Providers[iNdEx]) - copy(dAtA[i:], m.Providers[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if m.LatestHistory != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.LatestHistory)) - i-- - dAtA[i] = 0x18 - } - 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] = 0x12 - } - if len(m.FeedName) > 0 { - i -= len(m.FeedName) - copy(dAtA[i:], m.FeedName) - i = encodeVarintTx(dAtA, i, uint64(len(m.FeedName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgEditFeedResponse) 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 *MsgEditFeedResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditFeedResponse) 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 *MsgCreateFeed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeedName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.LatestHistory != 0 { - n += 1 + sovTx(uint64(m.LatestHistory)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Providers) > 0 { - for _, s := range m.Providers { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Timeout != 0 { - n += 1 + sovTx(uint64(m.Timeout)) - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.RepeatedFrequency != 0 { - n += 1 + sovTx(uint64(m.RepeatedFrequency)) - } - l = len(m.AggregateFunc) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValueJsonPath) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.ResponseThreshold != 0 { - n += 1 + sovTx(uint64(m.ResponseThreshold)) - } - return n -} - -func (m *MsgCreateFeedResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgStartFeed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeedName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgStartFeedResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgPauseFeed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeedName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgPauseFeedResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgEditFeed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeedName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.LatestHistory != 0 { - n += 1 + sovTx(uint64(m.LatestHistory)) - } - if len(m.Providers) > 0 { - for _, s := range m.Providers { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - if m.Timeout != 0 { - n += 1 + sovTx(uint64(m.Timeout)) - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.RepeatedFrequency != 0 { - n += 1 + sovTx(uint64(m.RepeatedFrequency)) - } - if m.ResponseThreshold != 0 { - n += 1 + sovTx(uint64(m.ResponseThreshold)) - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgEditFeedResponse) 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 *MsgCreateFeed) 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: MsgCreateFeed: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateFeed: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestHistory", wireType) - } - m.LatestHistory = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LatestHistory |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - 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 4: - 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 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - m.Timeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timeout |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) - } - m.RepeatedFrequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedFrequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregateFunc", 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.AggregateFunc = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValueJsonPath", 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.ValueJsonPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) - } - m.ResponseThreshold = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ResponseThreshold |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateFeedResponse) 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: MsgCreateFeedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateFeedResponse: 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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgStartFeed) 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: MsgStartFeed: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStartFeed: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgStartFeedResponse) 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: MsgStartFeedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStartFeedResponse: 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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPauseFeed) 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: MsgPauseFeed: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPauseFeed: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgPauseFeedResponse) 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: MsgPauseFeedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPauseFeedResponse: 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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgEditFeed) 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: MsgEditFeed: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditFeed: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeedName", 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.FeedName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestHistory", wireType) - } - m.LatestHistory = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LatestHistory |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - m.Timeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timeout |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) - } - m.RepeatedFrequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedFrequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) - } - m.ResponseThreshold = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ResponseThreshold |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - 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 - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgEditFeedResponse) 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: MsgEditFeedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditFeedResponse: 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 { - return ErrInvalidLengthTx - } - if (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/modules/oracle/types.go b/modules/oracle/types.go deleted file mode 100644 index a6be7379..00000000 --- a/modules/oracle/types.go +++ /dev/null @@ -1,334 +0,0 @@ -package oracle - -import ( - "bytes" - "fmt" - "regexp" - "strings" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "oracle" -) - -var ( - _ sdk.Msg = &MsgCreateFeed{} - _ sdk.Msg = &MsgStartFeed{} - _ sdk.Msg = &MsgPauseFeed{} - _ sdk.Msg = &MsgEditFeed{} - - // the feed/service name only accepts alphanumeric characters, _ and - - regPlainText = regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_-]*$`) -) - -// Route implements Msg. -func (msg MsgCreateFeed) Route() string { - return ModuleName -} - -// Type implements Msg. -func (msg MsgCreateFeed) Type() string { - return "create_feed" -} - -// ValidateBasic implements Msg. -func (msg MsgCreateFeed) ValidateBasic() error { - feedName := strings.TrimSpace(msg.FeedName) - if len(feedName) == 0 { - return sdk.Wrapf("missing feed name") - } - if !regPlainText.MatchString(feedName) { - return sdk.Wrapf("invalid feed name: %s", feedName) - } - - if len(msg.Description) == 0 { - return sdk.Wrapf("missing description") - } - - if len(msg.ServiceName) == 0 { - return sdk.Wrapf("missing name") - } - if !regPlainText.MatchString(msg.ServiceName) { - return sdk.Wrapf("invalid service name %s", msg.ServiceName) - } - - if msg.LatestHistory == 0 { - return sdk.Wrapf("missing latest history") - } - - if err := validateTimeout(msg.Timeout, msg.RepeatedFrequency); err != nil { - return err - } - if len(msg.Providers) == 0 { - return sdk.Wrapf("providers missing") - } - - if len(msg.AggregateFunc) == 0 { - return sdk.Wrapf("missing aggregateFunc") - } - - if len(msg.ValueJsonPath) == 0 { - return sdk.Wrapf("missing valueJsonPath") - } - - if !msg.ServiceFeeCap.IsValid() { - return sdk.Wrapf(msg.ServiceFeeCap.String()) - } - - if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { - return sdk.Wrapf("invalid creator") - } - - return validateResponseThreshold(msg.ResponseThreshold, len(msg.Providers)) -} - -// GetSignBytes implements Msg. -func (msg MsgCreateFeed) GetSignBytes() []byte { - if len(msg.Providers) == 0 { - msg.Providers = nil - } - if msg.ServiceFeeCap.Empty() { - msg.ServiceFeeCap = nil - } - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners implements Msg. -func (msg MsgCreateFeed) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg MsgStartFeed) Route() string { - return ModuleName -} - -func (msg MsgStartFeed) Type() string { - return "start_feed" -} - -func (msg MsgStartFeed) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { - return sdk.Wrapf("invalid creator") - } - - feedName := strings.TrimSpace(msg.FeedName) - if len(feedName) == 0 { - return sdk.Wrapf("missing feed name") - } - if !regPlainText.MatchString(feedName) { - return sdk.Wrapf("invalid feed name: %s", feedName) - } - return nil -} - -func (msg MsgStartFeed) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgStartFeed) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg MsgPauseFeed) Route() string { - return ModuleName -} - -func (msg MsgPauseFeed) Type() string { - return "pause_feed" -} - -func (msg MsgPauseFeed) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { - return sdk.Wrapf("invalid creator") - } - - feedName := strings.TrimSpace(msg.FeedName) - if len(feedName) == 0 { - return sdk.Wrapf("missing feed name") - } - if !regPlainText.MatchString(feedName) { - return sdk.Wrapf("invalid feed name: %s", feedName) - } - return nil -} - -func (msg MsgPauseFeed) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgPauseFeed) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func (msg MsgEditFeed) Route() string { - return ModuleName -} - -func (msg MsgEditFeed) Type() string { - return "edit_feed" -} - -func (msg MsgEditFeed) ValidateBasic() error { - feedName := strings.TrimSpace(msg.FeedName) - if len(feedName) == 0 { - return sdk.Wrapf("missing feed name") - } - if !regPlainText.MatchString(feedName) { - return sdk.Wrapf("invalid feed name: %s", feedName) - } - - if len(msg.Description) == 0 { - return sdk.Wrapf("missing description") - } - - if msg.ServiceFeeCap != nil && !msg.ServiceFeeCap.IsValid() { - return sdk.Wrapf(msg.ServiceFeeCap.String()) - } - if msg.Timeout != 0 && msg.RepeatedFrequency != 0 { - if err := validateTimeout(msg.Timeout, msg.RepeatedFrequency); err != nil { - return err - } - } - if msg.ResponseThreshold != 0 { - if err := validateResponseThreshold(msg.ResponseThreshold, len(msg.Providers)); err != nil { - return err - } - } - - if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { - return sdk.Wrapf("invalid creator") - } - return nil -} - -func (msg MsgEditFeed) GetSignBytes() []byte { - if len(msg.Providers) == 0 { - msg.Providers = nil - } - if msg.ServiceFeeCap.Empty() { - msg.ServiceFeeCap = nil - } - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -func (msg MsgEditFeed) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Creator) - if err != nil { - panic(err) - } - return []sdk.AccAddress{creator} -} - -func validateResponseThreshold(responseThreshold uint32, maxCnt int) error { - if (maxCnt != 0 && int(responseThreshold) > maxCnt) || responseThreshold < 1 { - return sdk.Wrapf("response threshold should be between 1 and %d", maxCnt) - } - return nil -} - -func validateTimeout(timeout int64, frequency uint64) error { - if frequency < uint64(timeout) { - return sdk.Wrapf("timeout [%d] should be no more than frequency [%d]", timeout, frequency) - } - return nil -} - -// String implements fmt.Stringer -func (f FeedContext) String() string { - var bf bytes.Buffer - for _, addr := range f.Providers { - bf.WriteString(addr) - bf.WriteString(",") - } - return fmt.Sprintf(` FeedContext: - %s - ServiceName: %s - Providers: %s - Input: %s - Timeout: %d - ServiceFeeCap: %s - RepeatedFrequency: %d - ResponseThreshold: %d - State: %s`, - f.Feed.String(), - f.ServiceName, - bf.String(), - f.Input, - f.Timeout, - f.ServiceFeeCap, - f.RepeatedFrequency, - f.ResponseThreshold, - f.State.String(), - ) -} - -func (f FeedContext) Convert() interface{} { - return QueryFeedResp{ - Feed: struct { - FeedName string `json:"feed_name"` - Description string `json:"description"` - AggregateFunc string `json:"aggregate_func"` - ValueJsonPath string `json:"value_json_path"` - LatestHistory uint64 `json:"latest_history"` - RequestContextID string `json:"request_context_id"` - Creator string `json:"creator"` - }{ - f.Feed.FeedName, - f.Feed.Description, - f.Feed.AggregateFunc, - f.Feed.ValueJsonPath, - f.Feed.LatestHistory, - f.Feed.RequestContextID, - f.Feed.Creator, - }, - ServiceName: f.ServiceName, - Providers: f.Providers, - Input: f.Input, - Timeout: f.Timeout, - ServiceFeeCap: f.ServiceFeeCap, - RepeatedFrequency: f.RepeatedFrequency, - ResponseThreshold: f.ResponseThreshold, - State: int32(f.State), - } -} - -type feedContexts []FeedContext - -func (fs feedContexts) Convert() interface{} { - var res []QueryFeedResp - for _, f := range fs { - res = append(res, f.Convert().(QueryFeedResp)) - } - return res -} - -type feedValues []FeedValue - -func (f FeedValue) Convert() interface{} { - return QueryFeedValueResp{ - Data: f.Data, - Timestamp: f.Timestamp, - } -} - -func (fs feedValues) Convert() interface{} { - var res []QueryFeedValueResp - for _, f := range fs { - res = append(res, f.Convert().(QueryFeedValueResp)) - } - return res -} diff --git a/modules/random/codec.go b/modules/random/codec.go deleted file mode 100644 index 4b9d90f4..00000000 --- a/modules/random/codec.go +++ /dev/null @@ -1,24 +0,0 @@ -package random - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgRequestRandom{}, - ) -} diff --git a/modules/random/export.go b/modules/random/export.go deleted file mode 100644 index e6fb55c8..00000000 --- a/modules/random/export.go +++ /dev/null @@ -1,39 +0,0 @@ -package random - -import sdk "github.com/irisnet/irishub-sdk-go/types" - -// expose Random module api for user -type Client interface { - sdk.Module - - RequestRandom(request RequestRandomRequest, basTx sdk.BaseTx) (RequestRandomResp, sdk.ResultTx, sdk.Error) - - QueryRandom(ReqId string) (QueryRandomResp, sdk.Error) - QueryRandomRequestQueue(height int64) ([]QueryRandomRequestQueueResp, sdk.Error) -} - -type RequestRandomRequest struct { - BlockInterval uint64 `json:"block_interval"` - Oracle bool `json:"oracle"` - ServiceFeeCap sdk.Coins `json:"service_fee_cap"` -} - -type RequestRandomResp struct { - Height int64 `json:"height"` - ReqID string `json:"req_id"` -} - -type QueryRandomResp struct { - RequestTxHash string `json:"request_tx_hash" yaml:"request_tx_hash"` - Height int64 `json:"height" yaml:"height"` - Value string `json:"value" yaml:"value"` -} - -type QueryRandomRequestQueueResp struct { - Height int64 `json:"height" yaml:"height"` - Consumer string `json:"consumer" yaml:"consumer"` - TxHash string `json:"tx_hash" yaml:"tx_hash"` - Oracle bool `json:"oracle" yaml:"oracle"` - ServiceFeeCap sdk.Coins `json:"service_fee_cap" yaml:"service_fee_cap"` - ServiceContextId string `json:"service_context_id" yaml:"service_context_id"` -} diff --git a/modules/random/query.pb.go b/modules/random/query.pb.go deleted file mode 100644 index 985a22da..00000000 --- a/modules/random/query.pb.go +++ /dev/null @@ -1,974 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: random/query.proto - -package random - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/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 - -// QueryRandomRequest is request type for the Query/Random RPC method -type QueryRandomRequest struct { - ReqId string `protobuf:"bytes,1,opt,name=req_id,json=reqId,proto3" json:"req_id,omitempty"` -} - -func (m *QueryRandomRequest) Reset() { *m = QueryRandomRequest{} } -func (m *QueryRandomRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRandomRequest) ProtoMessage() {} -func (*QueryRandomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0e7e1fe88061ff84, []int{0} -} -func (m *QueryRandomRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRandomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRandomRequest.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 *QueryRandomRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRandomRequest.Merge(m, src) -} -func (m *QueryRandomRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRandomRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRandomRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRandomRequest proto.InternalMessageInfo - -func (m *QueryRandomRequest) GetReqId() string { - if m != nil { - return m.ReqId - } - return "" -} - -// QueryParametersResponse is response type for the Query/Random RPC method -type QueryRandomResponse struct { - Random *Random `protobuf:"bytes,1,opt,name=random,proto3" json:"random,omitempty"` -} - -func (m *QueryRandomResponse) Reset() { *m = QueryRandomResponse{} } -func (m *QueryRandomResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRandomResponse) ProtoMessage() {} -func (*QueryRandomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0e7e1fe88061ff84, []int{1} -} -func (m *QueryRandomResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRandomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRandomResponse.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 *QueryRandomResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRandomResponse.Merge(m, src) -} -func (m *QueryRandomResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRandomResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRandomResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRandomResponse proto.InternalMessageInfo - -func (m *QueryRandomResponse) GetRandom() *Random { - if m != nil { - return m.Random - } - return nil -} - -// QueryRandomRequestQueueRequest is request type for the Query/RandomRequestQueue RPC method -type QueryRandomRequestQueueRequest struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` -} - -func (m *QueryRandomRequestQueueRequest) Reset() { *m = QueryRandomRequestQueueRequest{} } -func (m *QueryRandomRequestQueueRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRandomRequestQueueRequest) ProtoMessage() {} -func (*QueryRandomRequestQueueRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_0e7e1fe88061ff84, []int{2} -} -func (m *QueryRandomRequestQueueRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRandomRequestQueueRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRandomRequestQueueRequest.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 *QueryRandomRequestQueueRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRandomRequestQueueRequest.Merge(m, src) -} -func (m *QueryRandomRequestQueueRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRandomRequestQueueRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRandomRequestQueueRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRandomRequestQueueRequest proto.InternalMessageInfo - -func (m *QueryRandomRequestQueueRequest) GetHeight() int64 { - if m != nil { - return m.Height - } - return 0 -} - -// QueryRandomRequestQueueResponse is response type for the Query/RandomRequestQueue RPC method -type QueryRandomRequestQueueResponse struct { - Requests []Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests"` -} - -func (m *QueryRandomRequestQueueResponse) Reset() { *m = QueryRandomRequestQueueResponse{} } -func (m *QueryRandomRequestQueueResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRandomRequestQueueResponse) ProtoMessage() {} -func (*QueryRandomRequestQueueResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0e7e1fe88061ff84, []int{3} -} -func (m *QueryRandomRequestQueueResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRandomRequestQueueResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRandomRequestQueueResponse.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 *QueryRandomRequestQueueResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRandomRequestQueueResponse.Merge(m, src) -} -func (m *QueryRandomRequestQueueResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRandomRequestQueueResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRandomRequestQueueResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRandomRequestQueueResponse proto.InternalMessageInfo - -func (m *QueryRandomRequestQueueResponse) GetRequests() []Request { - if m != nil { - return m.Requests - } - return nil -} - -func init() { - proto.RegisterType((*QueryRandomRequest)(nil), "irismod.random.QueryRandomRequest") - proto.RegisterType((*QueryRandomResponse)(nil), "irismod.random.QueryRandomResponse") - proto.RegisterType((*QueryRandomRequestQueueRequest)(nil), "irismod.random.QueryRandomRequestQueueRequest") - proto.RegisterType((*QueryRandomRequestQueueResponse)(nil), "irismod.random.QueryRandomRequestQueueResponse") -} - -func init() { proto.RegisterFile("random/query.proto", fileDescriptor_0e7e1fe88061ff84) } - -var fileDescriptor_0e7e1fe88061ff84 = []byte{ - // 387 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xcd, 0x4a, 0xeb, 0x40, - 0x14, 0xc7, 0x93, 0xf6, 0x36, 0xdc, 0x3b, 0x85, 0xbb, 0x98, 0xde, 0x7e, 0x10, 0xae, 0x69, 0x89, - 0x9b, 0x82, 0x34, 0x23, 0x75, 0xa3, 0xdb, 0x82, 0x0b, 0xdd, 0x35, 0x4b, 0x11, 0x24, 0x35, 0x43, - 0x12, 0x6c, 0x72, 0x9a, 0x4c, 0x66, 0x21, 0xc5, 0x8d, 0x4f, 0x20, 0xe8, 0xce, 0x17, 0xea, 0xb2, - 0xe0, 0xc6, 0x95, 0x48, 0xeb, 0x83, 0x48, 0x67, 0x46, 0xb1, 0x0d, 0x7e, 0xac, 0x66, 0x32, 0xe7, - 0x77, 0xce, 0xff, 0x97, 0x49, 0x10, 0xce, 0xbc, 0xc4, 0x87, 0x98, 0xa4, 0x9c, 0x66, 0x97, 0xce, - 0x24, 0x83, 0x1c, 0xf0, 0xdf, 0x28, 0x8b, 0x58, 0x0c, 0xbe, 0x23, 0x6b, 0x66, 0x4d, 0x31, 0x72, - 0x91, 0x90, 0xf9, 0x2f, 0x80, 0x00, 0xc4, 0x96, 0xac, 0x76, 0xea, 0xf4, 0x7f, 0x00, 0x10, 0x8c, - 0x29, 0xf1, 0x26, 0x11, 0xf1, 0x92, 0x04, 0x72, 0x2f, 0x8f, 0x20, 0x61, 0xb2, 0x6a, 0xef, 0x20, - 0x3c, 0x5c, 0xe5, 0xb8, 0x62, 0x90, 0x4b, 0x53, 0x4e, 0x59, 0x8e, 0xeb, 0xc8, 0xc8, 0x68, 0x7a, - 0x16, 0xf9, 0x2d, 0xbd, 0xa3, 0x77, 0xff, 0xb8, 0x95, 0x8c, 0xa6, 0x47, 0xbe, 0x7d, 0x88, 0x6a, - 0x6b, 0x30, 0x9b, 0x40, 0xc2, 0x28, 0x76, 0x90, 0x21, 0x3d, 0x04, 0x5d, 0xed, 0x37, 0x9c, 0x75, - 0x5b, 0x47, 0xf1, 0x8a, 0xb2, 0xf7, 0x91, 0x55, 0xcc, 0x1c, 0x72, 0xca, 0xe9, 0x5b, 0x7e, 0x03, - 0x19, 0x21, 0x8d, 0x82, 0x30, 0x17, 0x13, 0xcb, 0xae, 0x7a, 0xb2, 0x4f, 0x51, 0xfb, 0xd3, 0x4e, - 0x25, 0x73, 0x80, 0x7e, 0x67, 0xf2, 0x9c, 0xb5, 0xf4, 0x4e, 0xb9, 0x5b, 0xed, 0x37, 0x0b, 0x3a, - 0xb2, 0x3e, 0xf8, 0x35, 0x7b, 0x6a, 0x6b, 0xee, 0x3b, 0xde, 0xbf, 0x2f, 0xa1, 0x8a, 0x18, 0x8f, - 0xa7, 0xc8, 0x90, 0x11, 0xd8, 0xde, 0x6c, 0x2e, 0xe6, 0x9b, 0xdb, 0x5f, 0x32, 0xd2, 0xcb, 0xee, - 0x5e, 0x3f, 0xbc, 0xdc, 0x96, 0x6c, 0xdc, 0x21, 0x0a, 0x26, 0x6b, 0x9f, 0x90, 0x91, 0xa9, 0xbc, - 0xf1, 0x2b, 0x7c, 0xa7, 0x23, 0x5c, 0x7c, 0x41, 0xec, 0x7c, 0x6f, 0xf2, 0xf1, 0x0e, 0x4d, 0xf2, - 0x63, 0x5e, 0x19, 0x6e, 0x09, 0xc3, 0x26, 0xae, 0x6f, 0x1a, 0xa6, 0x2b, 0x6c, 0x70, 0x3c, 0x5b, - 0x58, 0xfa, 0x7c, 0x61, 0xe9, 0xcf, 0x0b, 0x4b, 0xbf, 0x59, 0x5a, 0xda, 0x7c, 0x69, 0x69, 0x8f, - 0x4b, 0x4b, 0x3b, 0xd9, 0x0d, 0xa2, 0x3c, 0xe4, 0x23, 0xe7, 0x1c, 0x62, 0xd1, 0x9a, 0xd0, 0x5c, - 0xac, 0x21, 0x1f, 0xf5, 0x98, 0x7f, 0xd1, 0x0b, 0x80, 0xc4, 0xe0, 0xf3, 0x31, 0x65, 0x6a, 0xe2, - 0xc8, 0x10, 0x3f, 0xdf, 0xde, 0x6b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9f, 0xc9, 0x52, 0x3e, 0xeb, - 0x02, 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 { - // Random queries the random result - Random(ctx context.Context, in *QueryRandomRequest, opts ...grpc.CallOption) (*QueryRandomResponse, error) - // RandomRequestQueue queries the random request queue - RandomRequestQueue(ctx context.Context, in *QueryRandomRequestQueueRequest, opts ...grpc.CallOption) (*QueryRandomRequestQueueResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Random(ctx context.Context, in *QueryRandomRequest, opts ...grpc.CallOption) (*QueryRandomResponse, error) { - out := new(QueryRandomResponse) - err := c.cc.Invoke(ctx, "/irismod.random.Query/Random", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) RandomRequestQueue(ctx context.Context, in *QueryRandomRequestQueueRequest, opts ...grpc.CallOption) (*QueryRandomRequestQueueResponse, error) { - out := new(QueryRandomRequestQueueResponse) - err := c.cc.Invoke(ctx, "/irismod.random.Query/RandomRequestQueue", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Random queries the random result - Random(context.Context, *QueryRandomRequest) (*QueryRandomResponse, error) - // RandomRequestQueue queries the random request queue - RandomRequestQueue(context.Context, *QueryRandomRequestQueueRequest) (*QueryRandomRequestQueueResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Random(ctx context.Context, req *QueryRandomRequest) (*QueryRandomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Random not implemented") -} -func (*UnimplementedQueryServer) RandomRequestQueue(ctx context.Context, req *QueryRandomRequestQueueRequest) (*QueryRandomRequestQueueResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RandomRequestQueue not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Random_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRandomRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Random(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.random.Query/Random", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Random(ctx, req.(*QueryRandomRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_RandomRequestQueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRandomRequestQueueRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RandomRequestQueue(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.random.Query/RandomRequestQueue", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RandomRequestQueue(ctx, req.(*QueryRandomRequestQueueRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.random.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Random", - Handler: _Query_Random_Handler, - }, - { - MethodName: "RandomRequestQueue", - Handler: _Query_RandomRequestQueue_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "random/query.proto", -} - -func (m *QueryRandomRequest) 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 *QueryRandomRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRandomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ReqId) > 0 { - i -= len(m.ReqId) - copy(dAtA[i:], m.ReqId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ReqId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRandomResponse) 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 *QueryRandomResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRandomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Random != nil { - { - size, err := m.Random.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 *QueryRandomRequestQueueRequest) 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 *QueryRandomRequestQueueRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRandomRequestQueueRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Height != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryRandomRequestQueueResponse) 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 *QueryRandomRequestQueueResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRandomRequestQueueResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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 *QueryRandomRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReqId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRandomResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Random != nil { - l = m.Random.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRandomRequestQueueRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovQuery(uint64(m.Height)) - } - return n -} - -func (m *QueryRandomRequestQueueResponse) 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)) - } - } - 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 *QueryRandomRequest) 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: QueryRandomRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRandomRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReqId", 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.ReqId = 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 *QueryRandomResponse) 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: QueryRandomResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRandomResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Random", 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.Random == nil { - m.Random = &Random{} - } - if err := m.Random.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 *QueryRandomRequestQueueRequest) 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: QueryRandomRequestQueueRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRandomRequestQueueRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRandomRequestQueueResponse) 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: QueryRandomRequestQueueResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRandomRequestQueueResponse: 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, Request{}) - if err := m.Requests[len(m.Requests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/random/random.go b/modules/random/random.go deleted file mode 100644 index cc79b29f..00000000 --- a/modules/random/random.go +++ /dev/null @@ -1,108 +0,0 @@ -package random - -import ( - "context" - "strconv" - - "github.com/irisnet/irishub-sdk-go/codec" - cdctypes "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type randomClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) *randomClient { - return &randomClient{ - BaseClient: baseClient, - Marshaler: marshaler, - } -} - -func (rc randomClient) Name() string { - return ModuleName -} - -func (rc randomClient) RegisterInterfaceTypes(registry cdctypes.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (rc randomClient) RequestRandom(request RequestRandomRequest, basTx sdk.BaseTx) (RequestRandomResp, sdk.ResultTx, sdk.Error) { - author, err := rc.QueryAddress(basTx.From, basTx.Password) - if err != nil { - return RequestRandomResp{}, sdk.ResultTx{}, nil - } - - msg := &MsgRequestRandom{ - BlockInterval: request.BlockInterval, - Consumer: author.String(), - Oracle: request.Oracle, - ServiceFeeCap: request.ServiceFeeCap, - } - result, err := rc.BuildAndSend([]sdk.Msg{msg}, basTx) - if err != nil { - return RequestRandomResp{}, sdk.ResultTx{}, err - } - - reqID, e := result.Events.GetValue(eventTypeRequestRequestRandom, attributeKeyRequestID) - if e != nil { - return RequestRandomResp{}, result, sdk.Wrap(e) - } - generateHeight, e := result.Events.GetValue(eventTypeRequestRequestRandom, attributeKeyGenerateHeight) - if e != nil { - return RequestRandomResp{}, result, sdk.Wrap(e) - } - height, e := strconv.Atoi(generateHeight) - if e != nil { - return RequestRandomResp{}, result, sdk.Wrap(e) - } - - res := RequestRandomResp{ - Height: int64(height), - ReqID: reqID, - } - return res, result, nil -} - -func (rc randomClient) QueryRandom(reqID string) (QueryRandomResp, sdk.Error) { - if len(reqID) == 0 { - return QueryRandomResp{}, sdk.Wrapf("reqId is required") - } - - conn, err := rc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryRandomResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Random( - context.Background(), - &QueryRandomRequest{ReqId: reqID}, - ) - if err != nil { - return QueryRandomResp{}, sdk.Wrap(err) - } - return res.Random.Convert().(QueryRandomResp), nil -} - -func (rc randomClient) QueryRandomRequestQueue(height int64) ([]QueryRandomRequestQueueResp, sdk.Error) { - if height == 0 { - return []QueryRandomRequestQueueResp{}, nil - } - - conn, err := rc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return []QueryRandomRequestQueueResp{}, sdk.Wrap(err) - } - res, err := NewQueryClient(conn).RandomRequestQueue( - context.Background(), - &QueryRandomRequestQueueRequest{Height: height}, - ) - if err != nil { - return []QueryRandomRequestQueueResp{}, sdk.Wrap(err) - } - return Requests(res.Requests).Convert().([]QueryRandomRequestQueueResp), nil -} diff --git a/modules/random/random.pb.go b/modules/random/random.pb.go deleted file mode 100644 index fdea752a..00000000 --- a/modules/random/random.pb.go +++ /dev/null @@ -1,831 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: random/random.proto - -package random - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Random defines the feed standard -type Random struct { - RequestTxHash string `protobuf:"bytes,1,opt,name=request_tx_hash,json=requestTxHash,proto3" json:"request_tx_hash,omitempty"` - Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Random) Reset() { *m = Random{} } -func (m *Random) String() string { return proto.CompactTextString(m) } -func (*Random) ProtoMessage() {} -func (*Random) Descriptor() ([]byte, []int) { - return fileDescriptor_e5da2919a686585f, []int{0} -} -func (m *Random) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Random) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Random.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 *Random) XXX_Merge(src proto.Message) { - xxx_messageInfo_Random.Merge(m, src) -} -func (m *Random) XXX_Size() int { - return m.Size() -} -func (m *Random) XXX_DiscardUnknown() { - xxx_messageInfo_Random.DiscardUnknown(m) -} - -var xxx_messageInfo_Random proto.InternalMessageInfo - -func (m *Random) GetRequestTxHash() string { - if m != nil { - return m.RequestTxHash - } - return "" -} - -func (m *Random) GetHeight() int64 { - if m != nil { - return m.Height - } - return 0 -} - -func (m *Random) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -// Request defines the random request standard -type Request struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` - TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"tx_hash"` - Oracle bool `protobuf:"varint,4,opt,name=oracle,proto3" json:"oracle,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` - ServiceContextId string `protobuf:"bytes,6,opt,name=service_context_id,json=serviceContextId,proto3" json:"service_context_id,omitempty"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_e5da2919a686585f, []int{1} -} -func (m *Request) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Request.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 *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(m, src) -} -func (m *Request) XXX_Size() int { - return m.Size() -} -func (m *Request) XXX_DiscardUnknown() { - xxx_messageInfo_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Request proto.InternalMessageInfo - -func (m *Request) GetHeight() int64 { - if m != nil { - return m.Height - } - return 0 -} - -func (m *Request) GetConsumer() string { - if m != nil { - return m.Consumer - } - return "" -} - -func (m *Request) GetTxHash() string { - if m != nil { - return m.TxHash - } - return "" -} - -func (m *Request) GetOracle() bool { - if m != nil { - return m.Oracle - } - return false -} - -func (m *Request) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.ServiceFeeCap - } - return nil -} - -func (m *Request) GetServiceContextId() string { - if m != nil { - return m.ServiceContextId - } - return "" -} - -func init() { - proto.RegisterType((*Random)(nil), "irismod.random.Random") - proto.RegisterType((*Request)(nil), "irismod.random.Request") -} - -func init() { proto.RegisterFile("random/random.proto", fileDescriptor_e5da2919a686585f) } - -var fileDescriptor_e5da2919a686585f = []byte{ - // 414 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xcd, 0x36, 0xd4, 0x6d, 0x17, 0xb5, 0x45, 0x4b, 0x55, 0x99, 0x1c, 0x9c, 0xc8, 0x07, 0x14, - 0x09, 0x62, 0x53, 0xb8, 0x71, 0x4c, 0x24, 0x04, 0x5c, 0x90, 0x2c, 0x4e, 0x1c, 0xb0, 0xd6, 0xeb, - 0xc1, 0x5e, 0x11, 0x7b, 0x8c, 0x77, 0x1d, 0xa5, 0x7f, 0x81, 0xf8, 0x0c, 0xfe, 0x03, 0xa9, 0xc7, - 0x1e, 0x39, 0x05, 0x94, 0xfc, 0x41, 0xbf, 0x00, 0x65, 0x77, 0x1b, 0x01, 0x97, 0x9e, 0xc6, 0x6f, - 0x9e, 0xdf, 0xdb, 0xd9, 0x37, 0x4b, 0x1f, 0xb6, 0xbc, 0xce, 0xb1, 0x8a, 0x6d, 0x89, 0x9a, 0x16, - 0x35, 0xb2, 0x13, 0xd9, 0x4a, 0x55, 0x61, 0x1e, 0xd9, 0xee, 0xe0, 0xac, 0xc0, 0x02, 0x0d, 0x15, - 0x6f, 0xbf, 0xec, 0x5f, 0x83, 0x40, 0xa0, 0xaa, 0x50, 0xc5, 0x19, 0x57, 0x10, 0x2f, 0x2e, 0x32, - 0xd0, 0xfc, 0x22, 0x16, 0x28, 0x6b, 0xcb, 0x87, 0x1f, 0xa9, 0x97, 0x18, 0x3d, 0x7b, 0x4c, 0x4f, - 0x5b, 0xf8, 0xd2, 0x81, 0xd2, 0xa9, 0x5e, 0xa6, 0x25, 0x57, 0xa5, 0x4f, 0x46, 0x64, 0x7c, 0x94, - 0x1c, 0xbb, 0xf6, 0xfb, 0xe5, 0x6b, 0xae, 0x4a, 0x76, 0x4e, 0xbd, 0x12, 0x64, 0x51, 0x6a, 0x7f, - 0x6f, 0x44, 0xc6, 0xfd, 0xc4, 0x21, 0x76, 0x46, 0xf7, 0x17, 0x7c, 0xde, 0x81, 0xdf, 0x37, 0x2a, - 0x0b, 0xc2, 0x1f, 0x7b, 0xf4, 0x20, 0xb1, 0xfa, 0xbf, 0x94, 0xe4, 0x1f, 0xe5, 0x80, 0x1e, 0x0a, - 0xac, 0x55, 0x57, 0x41, 0x6b, 0x3c, 0x8f, 0x92, 0x1d, 0x66, 0x4f, 0xe8, 0xc1, 0xed, 0x34, 0xc6, - 0x77, 0xca, 0x6e, 0x56, 0xc3, 0x93, 0x4b, 0x5e, 0xcd, 0x5f, 0x86, 0x8e, 0x08, 0x13, 0x4f, 0xef, - 0x46, 0xc3, 0x96, 0x8b, 0x39, 0xf8, 0xf7, 0x46, 0x64, 0x7c, 0x98, 0x38, 0xc4, 0xbe, 0x11, 0x7a, - 0xaa, 0xa0, 0x5d, 0x48, 0x01, 0xe9, 0x27, 0x80, 0x54, 0xf0, 0xc6, 0xdf, 0x1f, 0xf5, 0xc7, 0xf7, - 0x9f, 0x3f, 0x8a, 0x6c, 0x3e, 0xd1, 0x36, 0x9f, 0xc8, 0xe5, 0x13, 0xcd, 0x50, 0xd6, 0xd3, 0x77, - 0x57, 0xab, 0x61, 0xef, 0x66, 0x35, 0x3c, 0xb7, 0x87, 0xfd, 0xa7, 0x0f, 0xbf, 0xff, 0x1a, 0x4e, - 0x0a, 0xa9, 0xcb, 0x2e, 0x8b, 0x04, 0x56, 0xf1, 0x76, 0x19, 0x35, 0x68, 0x53, 0xcb, 0x2e, 0x9b, - 0xa8, 0xfc, 0xf3, 0xa4, 0xc0, 0x58, 0x5f, 0x36, 0xa0, 0x8c, 0x9f, 0x4a, 0x8e, 0x9d, 0xc5, 0x2b, - 0x80, 0x19, 0x6f, 0xd8, 0x53, 0xca, 0x6e, 0x3d, 0x05, 0xd6, 0x1a, 0x96, 0x3a, 0x95, 0xb9, 0xef, - 0x99, 0xfb, 0x3f, 0x70, 0xcc, 0xcc, 0x12, 0x6f, 0xf2, 0xe9, 0xdb, 0xab, 0x75, 0x40, 0xae, 0xd7, - 0x01, 0xf9, 0xbd, 0x0e, 0xc8, 0xd7, 0x4d, 0xd0, 0xbb, 0xde, 0x04, 0xbd, 0x9f, 0x9b, 0xa0, 0xf7, - 0xe1, 0xd9, 0xdd, 0x53, 0x54, 0x98, 0x77, 0x73, 0x50, 0xee, 0xfd, 0x64, 0x9e, 0x59, 0xfd, 0x8b, - 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x4a, 0xf9, 0x5b, 0x57, 0x02, 0x00, 0x00, -} - -func (m *Random) 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 *Random) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Random) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintRandom(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x1a - } - if m.Height != 0 { - i = encodeVarintRandom(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x10 - } - if len(m.RequestTxHash) > 0 { - i -= len(m.RequestTxHash) - copy(dAtA[i:], m.RequestTxHash) - i = encodeVarintRandom(dAtA, i, uint64(len(m.RequestTxHash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Request) 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 *Request) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ServiceContextId) > 0 { - i -= len(m.ServiceContextId) - copy(dAtA[i:], m.ServiceContextId) - i = encodeVarintRandom(dAtA, i, uint64(len(m.ServiceContextId))) - i-- - dAtA[i] = 0x32 - } - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRandom(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if m.Oracle { - i-- - if m.Oracle { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintRandom(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0x1a - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintRandom(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x12 - } - if m.Height != 0 { - i = encodeVarintRandom(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintRandom(dAtA []byte, offset int, v uint64) int { - offset -= sovRandom(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Random) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestTxHash) - if l > 0 { - n += 1 + l + sovRandom(uint64(l)) - } - if m.Height != 0 { - n += 1 + sovRandom(uint64(m.Height)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovRandom(uint64(l)) - } - return n -} - -func (m *Request) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovRandom(uint64(m.Height)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovRandom(uint64(l)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovRandom(uint64(l)) - } - if m.Oracle { - n += 2 - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovRandom(uint64(l)) - } - } - l = len(m.ServiceContextId) - if l > 0 { - n += 1 + l + sovRandom(uint64(l)) - } - return n -} - -func sovRandom(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozRandom(x uint64) (n int) { - return sovRandom(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Random) 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 ErrIntOverflowRandom - } - 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: Random: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Random: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestTxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - 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 ErrInvalidLengthRandom - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRandom - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequestTxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - 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 ErrInvalidLengthRandom - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRandom - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRandom(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRandom - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Request) 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 ErrIntOverflowRandom - } - 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: Request: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Request: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - 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 ErrInvalidLengthRandom - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRandom - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - 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 ErrInvalidLengthRandom - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRandom - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Oracle", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Oracle = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRandom - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRandom - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceContextId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRandom - } - 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 ErrInvalidLengthRandom - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRandom - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRandom(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRandom - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRandom(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, ErrIntOverflowRandom - } - 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, ErrIntOverflowRandom - } - 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, ErrIntOverflowRandom - } - 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, ErrInvalidLengthRandom - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupRandom - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthRandom - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthRandom = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRandom = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupRandom = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/random/tx.pb.go b/modules/random/tx.pb.go deleted file mode 100644 index 9b519425..00000000 --- a/modules/random/tx.pb.go +++ /dev/null @@ -1,468 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: random/tx.proto - -package random - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgRequestRandom defines an sdk.Msg type that supports requesting a random number -type MsgRequestRandom struct { - BlockInterval uint64 `protobuf:"varint,1,opt,name=block_interval,json=blockInterval,proto3" json:"block_interval,omitempty" yaml:"block_interval"` - Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` - Oracle bool `protobuf:"varint,3,opt,name=oracle,proto3" json:"oracle,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,4,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` -} - -func (m *MsgRequestRandom) Reset() { *m = MsgRequestRandom{} } -func (m *MsgRequestRandom) String() string { return proto.CompactTextString(m) } -func (*MsgRequestRandom) ProtoMessage() {} -func (*MsgRequestRandom) Descriptor() ([]byte, []int) { - return fileDescriptor_8734007206ce5490, []int{0} -} -func (m *MsgRequestRandom) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRequestRandom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRequestRandom.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 *MsgRequestRandom) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRequestRandom.Merge(m, src) -} -func (m *MsgRequestRandom) XXX_Size() int { - return m.Size() -} -func (m *MsgRequestRandom) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRequestRandom.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRequestRandom proto.InternalMessageInfo - -func (m *MsgRequestRandom) GetBlockInterval() uint64 { - if m != nil { - return m.BlockInterval - } - return 0 -} - -func (m *MsgRequestRandom) GetConsumer() string { - if m != nil { - return m.Consumer - } - return "" -} - -func (m *MsgRequestRandom) GetOracle() bool { - if m != nil { - return m.Oracle - } - return false -} - -func (m *MsgRequestRandom) GetServiceFeeCap() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.ServiceFeeCap - } - return nil -} - -func init() { - proto.RegisterType((*MsgRequestRandom)(nil), "irismod.random.MsgRequestRandom") -} - -func init() { proto.RegisterFile("random/tx.proto", fileDescriptor_8734007206ce5490) } - -var fileDescriptor_8734007206ce5490 = []byte{ - // 351 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xc1, 0x6a, 0xe2, 0x40, - 0x1c, 0xc6, 0x33, 0x2a, 0xe2, 0x66, 0x51, 0x97, 0xb0, 0x2b, 0xd1, 0x43, 0x12, 0x72, 0xca, 0xc5, - 0xcc, 0xba, 0x7b, 0xdb, 0xd3, 0xa2, 0x50, 0x68, 0xa1, 0x14, 0x72, 0xec, 0x45, 0x26, 0x93, 0x7f, - 0x63, 0x30, 0xc9, 0x3f, 0xcd, 0x4c, 0xa4, 0xbe, 0x45, 0xe9, 0xbd, 0x2f, 0xd0, 0x27, 0xf1, 0xe8, - 0xb1, 0x27, 0x5b, 0xf4, 0x0d, 0x7c, 0x82, 0x62, 0x12, 0x0a, 0xed, 0xa5, 0xa7, 0x99, 0x6f, 0xbe, - 0x99, 0x1f, 0xf3, 0x7d, 0x7f, 0xb5, 0x9f, 0xb3, 0x34, 0xc0, 0x84, 0xca, 0x3b, 0x37, 0xcb, 0x51, - 0xa2, 0xd6, 0x8b, 0xf2, 0x48, 0x24, 0x18, 0xb8, 0x95, 0x31, 0xfa, 0x19, 0x62, 0x88, 0xa5, 0x45, - 0x4f, 0xbb, 0xea, 0xd6, 0xc8, 0xe0, 0x28, 0x12, 0x14, 0xd4, 0x67, 0x02, 0xe8, 0x6a, 0xe2, 0x83, - 0x64, 0x13, 0xca, 0x31, 0x4a, 0x2b, 0xdf, 0x7e, 0x6c, 0xa8, 0x3f, 0x2e, 0x45, 0xe8, 0xc1, 0x6d, - 0x01, 0x42, 0x7a, 0x25, 0x4a, 0xfb, 0xaf, 0xf6, 0xfc, 0x18, 0xf9, 0x72, 0x1e, 0xa5, 0x12, 0xf2, - 0x15, 0x8b, 0x75, 0x62, 0x11, 0xa7, 0x35, 0x1d, 0x1e, 0x77, 0xe6, 0xaf, 0x35, 0x4b, 0xe2, 0x7f, - 0xf6, 0x47, 0xdf, 0xf6, 0xba, 0xe5, 0xc1, 0x79, 0xad, 0xb5, 0x91, 0xda, 0xe1, 0x98, 0x8a, 0x22, - 0x81, 0x5c, 0x6f, 0x58, 0xc4, 0xf9, 0xe6, 0xbd, 0x6b, 0x6d, 0xa0, 0xb6, 0x31, 0x67, 0x3c, 0x06, - 0xbd, 0x69, 0x11, 0xa7, 0xe3, 0xd5, 0x4a, 0x7b, 0x20, 0x6a, 0x5f, 0x40, 0xbe, 0x8a, 0x38, 0xcc, - 0x6f, 0x00, 0xe6, 0x9c, 0x65, 0x7a, 0xcb, 0x6a, 0x3a, 0xdf, 0xff, 0x0c, 0xdd, 0x2a, 0x85, 0x7b, - 0x4a, 0xe1, 0xd6, 0x29, 0xdc, 0x19, 0x46, 0xe9, 0xf4, 0x6a, 0xb3, 0x33, 0x95, 0xe3, 0xce, 0x1c, - 0x54, 0xdf, 0xfa, 0xf4, 0xde, 0x7e, 0x7a, 0x31, 0xc7, 0x61, 0x24, 0x17, 0x85, 0xef, 0x72, 0x4c, - 0xe8, 0xa9, 0xb2, 0x14, 0x64, 0xb9, 0x2e, 0x0a, 0x7f, 0x2c, 0x82, 0xe5, 0x38, 0x44, 0x2a, 0xd7, - 0x19, 0x88, 0x92, 0x27, 0xbc, 0x6e, 0x8d, 0x38, 0x03, 0x98, 0xb1, 0x6c, 0x7a, 0xb1, 0xd9, 0x1b, - 0x64, 0xbb, 0x37, 0xc8, 0xeb, 0xde, 0x20, 0xf7, 0x07, 0x43, 0xd9, 0x1e, 0x0c, 0xe5, 0xf9, 0x60, - 0x28, 0xd7, 0xbf, 0xbf, 0xe6, 0x26, 0x18, 0x14, 0x31, 0x08, 0x5a, 0x4d, 0xc8, 0x6f, 0x97, 0x95, - 0xff, 0x7d, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x60, 0xe4, 0x82, 0xe7, 0xcb, 0x01, 0x00, 0x00, -} - -func (m *MsgRequestRandom) 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 *MsgRequestRandom) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRequestRandom) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.Oracle { - i-- - if m.Oracle { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x12 - } - if m.BlockInterval != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.BlockInterval)) - i-- - dAtA[i] = 0x8 - } - 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 *MsgRequestRandom) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BlockInterval != 0 { - n += 1 + sovTx(uint64(m.BlockInterval)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Oracle { - n += 2 - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovTx(uint64(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 *MsgRequestRandom) 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: MsgRequestRandom: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRequestRandom: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockInterval", wireType) - } - m.BlockInterval = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BlockInterval |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Oracle", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Oracle = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].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 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/modules/random/types.go b/modules/random/types.go deleted file mode 100644 index 5e97eb10..00000000 --- a/modules/random/types.go +++ /dev/null @@ -1,76 +0,0 @@ -package random - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "random" - - eventTypeRequestRequestRandom = "request_random" - attributeKeyRequestID = "request_id" - attributeKeyGenerateHeight = "generate_height" -) - -var ( - _ sdk.Msg = &MsgRequestRandom{} -) - -// Route implements Msg. -func (msg MsgRequestRandom) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgRequestRandom) Type() string { return "request_rand" } - -// ValidateBasic implements Msg. -func (msg MsgRequestRandom) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(msg.Consumer); err != nil { - return sdk.Wrapf("invalid consumer address (%s)", err) - } - return nil -} - -// GetSignBytes implements Msg. -func (msg MsgRequestRandom) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - -// GetSigners implements Msg. -func (msg MsgRequestRandom) GetSigners() []sdk.AccAddress { - consumer, err := sdk.AccAddressFromBech32(msg.Consumer) - if err != nil { - panic(err) - } - return []sdk.AccAddress{consumer} -} - -func (m Random) Convert() interface{} { - return QueryRandomResp{ - RequestTxHash: m.RequestTxHash, - Height: m.Height, - Value: m.Value, - } -} - -type Requests []Request - -func (m Requests) Convert() interface{} { - var res []QueryRandomRequestQueueResp - - for _, request := range m { - q := QueryRandomRequestQueueResp{ - Height: request.Height, - Consumer: request.Consumer, - TxHash: request.TxHash, - Oracle: request.Oracle, - ServiceFeeCap: request.ServiceFeeCap, - ServiceContextId: request.ServiceContextId, - } - res = append(res, q) - } - return res -} diff --git a/modules/record/codec.go b/modules/record/codec.go deleted file mode 100644 index 96abc90e..00000000 --- a/modules/record/codec.go +++ /dev/null @@ -1,25 +0,0 @@ -package record - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgCreateRecord{}, - ) -} diff --git a/modules/record/export.go b/modules/record/export.go deleted file mode 100644 index 463ed673..00000000 --- a/modules/record/export.go +++ /dev/null @@ -1,35 +0,0 @@ -package record - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// expose Record module api for user -type Client interface { - sdk.Module - - CreateRecord(request CreateRecordRequest, baseTx sdk.BaseTx) (string, sdk.Error) - QueryRecord(request QueryRecordReq) (QueryRecordResp, sdk.Error) -} - -type CreateRecordRequest struct { - Contents []Content -} - -type QueryRecordReq struct { - RecordID string `json:"record_id"` - Prove bool `json:"prove"` - Height int64 `json:"height"` -} - -type QueryRecordResp struct { - Record Data `json:"record"` - Proof sdk.ProofValue `json:"proof"` - Height int64 `json:"height"` -} - -type Data struct { - TxHash string `json:"tx_hash" yaml:"tx_hash"` - Contents []Content `json:"contents" yaml:"contents"` - Creator string `json:"creator" yaml:"creator"` -} diff --git a/modules/record/query.pb.go b/modules/record/query.pb.go deleted file mode 100644 index 3ade2f2d..00000000 --- a/modules/record/query.pb.go +++ /dev/null @@ -1,593 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: record/query.proto - -package record - -import ( - context "context" - fmt "fmt" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/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 - -// QueryRecordRequest is the request type for the Query/Record RPC method -type QueryRecordRequest struct { - RecordId []byte `protobuf:"bytes,1,opt,name=record_id,json=recordId,proto3" json:"record_id,omitempty"` -} - -func (m *QueryRecordRequest) Reset() { *m = QueryRecordRequest{} } -func (m *QueryRecordRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRecordRequest) ProtoMessage() {} -func (*QueryRecordRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_45fc26642889837f, []int{0} -} -func (m *QueryRecordRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRecordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRecordRequest.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 *QueryRecordRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordRequest.Merge(m, src) -} -func (m *QueryRecordRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRecordRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRecordRequest proto.InternalMessageInfo - -func (m *QueryRecordRequest) GetRecordId() []byte { - if m != nil { - return m.RecordId - } - return nil -} - -// QueryRecordResponse is the response type for the Query/Record RPC method -type QueryRecordResponse struct { - Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` -} - -func (m *QueryRecordResponse) Reset() { *m = QueryRecordResponse{} } -func (m *QueryRecordResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRecordResponse) ProtoMessage() {} -func (*QueryRecordResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_45fc26642889837f, []int{1} -} -func (m *QueryRecordResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRecordResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRecordResponse.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 *QueryRecordResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRecordResponse.Merge(m, src) -} -func (m *QueryRecordResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRecordResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRecordResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRecordResponse proto.InternalMessageInfo - -func (m *QueryRecordResponse) GetRecord() *Record { - if m != nil { - return m.Record - } - return nil -} - -func init() { - proto.RegisterType((*QueryRecordRequest)(nil), "irismod.record.QueryRecordRequest") - proto.RegisterType((*QueryRecordResponse)(nil), "irismod.record.QueryRecordResponse") -} - -func init() { proto.RegisterFile("record/query.proto", fileDescriptor_45fc26642889837f) } - -var fileDescriptor_45fc26642889837f = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2a, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0xd1, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, - 0xcb, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0xc8, 0x49, 0x09, 0x43, 0xd5, 0x40, 0x28, - 0x88, 0x22, 0x29, 0x99, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0xfd, 0xc4, 0x82, 0x4c, 0xfd, 0xc4, - 0xbc, 0xbc, 0xfc, 0x92, 0xc4, 0x92, 0xcc, 0xfc, 0xbc, 0x62, 0x88, 0xac, 0x92, 0x21, 0x97, 0x50, - 0x20, 0xc8, 0xc4, 0x20, 0xb0, 0x96, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x21, 0x69, 0x2e, - 0x4e, 0x88, 0x19, 0xf1, 0x99, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x1c, 0x10, 0x01, - 0xcf, 0x14, 0x25, 0x57, 0x2e, 0x61, 0x14, 0x2d, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x42, 0x7a, - 0x5c, 0x6c, 0x10, 0x25, 0x60, 0x0d, 0xdc, 0x46, 0x62, 0x7a, 0xa8, 0xae, 0xd3, 0x83, 0xaa, 0x87, - 0xaa, 0x32, 0x6a, 0x67, 0xe4, 0x62, 0x05, 0x9b, 0x23, 0x54, 0xc7, 0xc5, 0x06, 0x91, 0x13, 0x52, - 0x42, 0xd7, 0x83, 0xe9, 0x36, 0x29, 0x65, 0xbc, 0x6a, 0x20, 0x8e, 0x51, 0xd2, 0x6e, 0xba, 0xfc, - 0x64, 0x32, 0x93, 0xaa, 0x90, 0xb2, 0x3e, 0x54, 0xb1, 0x3e, 0x4a, 0xd0, 0x14, 0xeb, 0x57, 0xc3, - 0xfd, 0x57, 0xeb, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, - 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, - 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0x60, 0x83, 0xf2, 0x52, 0x4b, 0xc0, - 0x74, 0x46, 0x69, 0x92, 0x6e, 0x71, 0x4a, 0xb6, 0x6e, 0x7a, 0xbe, 0x7e, 0x6e, 0x7e, 0x4a, 0x69, - 0x4e, 0x6a, 0x31, 0xd4, 0xe0, 0x24, 0x36, 0x70, 0xb0, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, - 0x5b, 0x6a, 0xea, 0xc1, 0xaf, 0x01, 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 { - // Record queries the record by the given record ID - Record(ctx context.Context, in *QueryRecordRequest, opts ...grpc.CallOption) (*QueryRecordResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Record(ctx context.Context, in *QueryRecordRequest, opts ...grpc.CallOption) (*QueryRecordResponse, error) { - out := new(QueryRecordResponse) - err := c.cc.Invoke(ctx, "/irismod.record.Query/Record", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Record queries the record by the given record ID - Record(context.Context, *QueryRecordRequest) (*QueryRecordResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Record(ctx context.Context, req *QueryRecordRequest) (*QueryRecordResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Record not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Record_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRecordRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Record(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.record.Query/Record", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Record(ctx, req.(*QueryRecordRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.record.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Record", - Handler: _Query_Record_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "record/query.proto", -} - -func (m *QueryRecordRequest) 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 *QueryRecordRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRecordRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RecordId) > 0 { - i -= len(m.RecordId) - copy(dAtA[i:], m.RecordId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.RecordId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRecordResponse) 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 *QueryRecordResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Record != nil { - { - size, err := m.Record.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 *QueryRecordRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RecordId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRecordResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Record != nil { - l = m.Record.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 *QueryRecordRequest) 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: QueryRecordRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecordId", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RecordId = append(m.RecordId[:0], dAtA[iNdEx:postIndex]...) - if m.RecordId == nil { - m.RecordId = []byte{} - } - 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 *QueryRecordResponse) 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: QueryRecordResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Record", 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.Record == nil { - m.Record = &Record{} - } - if err := m.Record.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/modules/record/record.go b/modules/record/record.go deleted file mode 100644 index da8171bd..00000000 --- a/modules/record/record.go +++ /dev/null @@ -1,87 +0,0 @@ -package record - -import ( - "encoding/hex" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type recordClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { - return recordClient{ - BaseClient: bc, - Marshaler: cdc, - } -} - -func (r recordClient) Name() string { - return ModuleName -} - -func (r recordClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (r recordClient) CreateRecord(request CreateRecordRequest, baseTx sdk.BaseTx) (string, sdk.Error) { - creator, err := r.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return "", sdk.Wrap(err) - } - - msg := &MsgCreateRecord{ - Contents: request.Contents, - Creator: creator.String(), - } - - res, err := r.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return "", err - } - - recordID, er := res.Events.GetValue(eventTypeCreateRecord, attributeKeyRecordID) - if er != nil { - return "", sdk.Wrap(er) - } - - return recordID, nil -} - -func (r recordClient) QueryRecord(request QueryRecordReq) (QueryRecordResp, sdk.Error) { - rID, err := hex.DecodeString(request.RecordID) - if err != nil { - return QueryRecordResp{}, sdk.Wrapf("invalid record id, must be hex encoded string,but got %s", request.RecordID) - } - - recordKey := GetRecordKey(rID) - - res, err := r.QueryStore(recordKey, ModuleName, request.Height, request.Prove) - if err != nil { - return QueryRecordResp{}, sdk.Wrap(err) - } - - var record Record - if err := r.Marshaler.UnmarshalBinaryBare(res.Value, &record); err != nil { - return QueryRecordResp{}, sdk.Wrap(err) - } - - result := record.Convert().(QueryRecordResp) - - var proof []byte - if request.Prove { - proof = r.MustMarshalJSON(res.ProofOps) - } - - result.Proof = sdk.ProofValue{ - Proof: proof, - Path: []string{ModuleName, string(recordKey)}, - Value: res.Value, - } - result.Height = res.Height - return result, nil -} diff --git a/modules/record/record.pb.go b/modules/record/record.pb.go deleted file mode 100644 index f0b0e46f..00000000 --- a/modules/record/record.pb.go +++ /dev/null @@ -1,782 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: record/record.proto - -package record - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// Content defines the detailed information for a record. -type Content struct { - Digest string `protobuf:"bytes,1,opt,name=digest,proto3" json:"digest,omitempty"` - DigestAlgo string `protobuf:"bytes,2,opt,name=digest_algo,json=digestAlgo,proto3" json:"digest_algo,omitempty" yaml:"digest_algo"` - URI string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"` - Meta string `protobuf:"bytes,4,opt,name=meta,proto3" json:"meta,omitempty"` -} - -func (m *Content) Reset() { *m = Content{} } -func (m *Content) String() string { return proto.CompactTextString(m) } -func (*Content) ProtoMessage() {} -func (*Content) Descriptor() ([]byte, []int) { - return fileDescriptor_197cabccbeb2a7b7, []int{0} -} -func (m *Content) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Content.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 *Content) XXX_Merge(src proto.Message) { - xxx_messageInfo_Content.Merge(m, src) -} -func (m *Content) XXX_Size() int { - return m.Size() -} -func (m *Content) XXX_DiscardUnknown() { - xxx_messageInfo_Content.DiscardUnknown(m) -} - -var xxx_messageInfo_Content proto.InternalMessageInfo - -type Record struct { - TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty" yaml:"tx_hash"` - Contents []Content `protobuf:"bytes,2,rep,name=contents,proto3" json:"contents"` - Creator string `protobuf:"bytes,3,opt,name=creator,proto3" json:"creator,omitempty"` -} - -func (m *Record) Reset() { *m = Record{} } -func (m *Record) String() string { return proto.CompactTextString(m) } -func (*Record) ProtoMessage() {} -func (*Record) Descriptor() ([]byte, []int) { - return fileDescriptor_197cabccbeb2a7b7, []int{1} -} -func (m *Record) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Record.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 *Record) XXX_Merge(src proto.Message) { - xxx_messageInfo_Record.Merge(m, src) -} -func (m *Record) XXX_Size() int { - return m.Size() -} -func (m *Record) XXX_DiscardUnknown() { - xxx_messageInfo_Record.DiscardUnknown(m) -} - -var xxx_messageInfo_Record proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Content)(nil), "irismod.record.Content") - proto.RegisterType((*Record)(nil), "irismod.record.Record") -} - -func init() { proto.RegisterFile("record/record.proto", fileDescriptor_197cabccbeb2a7b7) } - -var fileDescriptor_197cabccbeb2a7b7 = []byte{ - // 336 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x51, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x8d, 0x9b, 0x28, 0x01, 0x57, 0xea, 0x60, 0x50, 0x09, 0x0c, 0x49, 0x95, 0xa9, 0x12, 0x6a, - 0x82, 0x60, 0x40, 0x74, 0x23, 0x2c, 0xb0, 0x30, 0x58, 0x62, 0x61, 0xa9, 0xd2, 0x24, 0x72, 0x22, - 0x92, 0x1a, 0xd9, 0x8e, 0x54, 0xbe, 0x82, 0x7e, 0x02, 0x9f, 0xd3, 0xb1, 0x23, 0x53, 0x04, 0xe9, - 0xc2, 0xdc, 0x2f, 0x40, 0xb1, 0x03, 0x82, 0xe9, 0xde, 0xbb, 0x77, 0xd6, 0x7b, 0x77, 0x86, 0x07, - 0x2c, 0x8d, 0x29, 0x4b, 0x02, 0x55, 0xfc, 0x67, 0x46, 0x05, 0x45, 0x83, 0x9c, 0xe5, 0xbc, 0xa4, - 0x89, 0xaf, 0xba, 0x27, 0x87, 0x84, 0x12, 0x2a, 0xa5, 0xa0, 0x45, 0x6a, 0xca, 0x7b, 0x05, 0xd0, - 0xba, 0xa1, 0x0b, 0x91, 0x2e, 0x04, 0x1a, 0x42, 0x33, 0xc9, 0x49, 0xca, 0x85, 0x0d, 0x46, 0x60, - 0xbc, 0x8f, 0x3b, 0x86, 0x2e, 0x61, 0x5f, 0xa1, 0x59, 0x54, 0x10, 0x6a, 0xf7, 0x5a, 0x31, 0x1c, - 0xee, 0x6a, 0x17, 0xbd, 0x44, 0x65, 0x31, 0xf5, 0xfe, 0x88, 0x1e, 0x86, 0x8a, 0x5d, 0x17, 0x84, - 0xa2, 0x63, 0xa8, 0x57, 0x2c, 0xb7, 0x75, 0xf9, 0xc0, 0x6a, 0x6a, 0x57, 0x7f, 0xc0, 0x77, 0xb8, - 0xed, 0x21, 0x04, 0x8d, 0x32, 0x15, 0x91, 0x6d, 0x48, 0x27, 0x89, 0xa7, 0xc6, 0xd7, 0x9b, 0x0b, - 0xbc, 0x15, 0x80, 0x26, 0x96, 0x91, 0xd1, 0x29, 0xb4, 0xc4, 0x72, 0x96, 0x45, 0x3c, 0x53, 0x89, - 0x42, 0xb4, 0xab, 0xdd, 0x81, 0x32, 0xed, 0x04, 0x0f, 0x9b, 0x62, 0x79, 0x1b, 0xf1, 0x0c, 0x5d, - 0xc1, 0xbd, 0x58, 0x2d, 0xc2, 0xed, 0xde, 0x48, 0x1f, 0xf7, 0xcf, 0x8f, 0xfc, 0xff, 0x27, 0xf0, - 0xbb, 0x45, 0x43, 0x63, 0x5d, 0xbb, 0x1a, 0xfe, 0x1d, 0x47, 0x36, 0xb4, 0x62, 0x96, 0x46, 0x82, - 0x32, 0x95, 0x15, 0xff, 0x50, 0x15, 0x29, 0xbc, 0x5f, 0x7f, 0x3a, 0xda, 0xba, 0x71, 0xc0, 0xa6, - 0x71, 0xc0, 0x47, 0xe3, 0x80, 0xd5, 0xd6, 0xd1, 0x36, 0x5b, 0x47, 0x7b, 0xdf, 0x3a, 0xda, 0xe3, - 0x19, 0xc9, 0x45, 0x56, 0xcd, 0xfd, 0x98, 0x96, 0x41, 0x6b, 0xb8, 0x48, 0x85, 0xac, 0x59, 0x35, - 0x9f, 0xf0, 0xe4, 0x69, 0x42, 0x68, 0x50, 0xd2, 0xa4, 0x2a, 0x52, 0xde, 0x7d, 0xd0, 0xdc, 0x94, - 0xb7, 0xbf, 0xf8, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x4e, 0x10, 0xde, 0xb8, 0x01, 0x00, 0x00, -} - -func (this *Content) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Content) - if !ok { - that2, ok := that.(Content) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Digest != that1.Digest { - return false - } - if this.DigestAlgo != that1.DigestAlgo { - return false - } - if this.URI != that1.URI { - return false - } - if this.Meta != that1.Meta { - return false - } - return true -} -func (this *Record) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Record) - if !ok { - that2, ok := that.(Record) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.TxHash != that1.TxHash { - return false - } - if len(this.Contents) != len(that1.Contents) { - return false - } - for i := range this.Contents { - if !this.Contents[i].Equal(&that1.Contents[i]) { - return false - } - } - if this.Creator != that1.Creator { - return false - } - return true -} -func (m *Content) 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 *Content) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Content) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Meta) > 0 { - i -= len(m.Meta) - copy(dAtA[i:], m.Meta) - i = encodeVarintRecord(dAtA, i, uint64(len(m.Meta))) - i-- - dAtA[i] = 0x22 - } - if len(m.URI) > 0 { - i -= len(m.URI) - copy(dAtA[i:], m.URI) - i = encodeVarintRecord(dAtA, i, uint64(len(m.URI))) - i-- - dAtA[i] = 0x1a - } - if len(m.DigestAlgo) > 0 { - i -= len(m.DigestAlgo) - copy(dAtA[i:], m.DigestAlgo) - i = encodeVarintRecord(dAtA, i, uint64(len(m.DigestAlgo))) - i-- - dAtA[i] = 0x12 - } - if len(m.Digest) > 0 { - i -= len(m.Digest) - copy(dAtA[i:], m.Digest) - i = encodeVarintRecord(dAtA, i, uint64(len(m.Digest))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Record) 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 *Record) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Creator) > 0 { - i -= len(m.Creator) - copy(dAtA[i:], m.Creator) - i = encodeVarintRecord(dAtA, i, uint64(len(m.Creator))) - i-- - dAtA[i] = 0x1a - } - if len(m.Contents) > 0 { - for iNdEx := len(m.Contents) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Contents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintRecord(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintRecord(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintRecord(dAtA []byte, offset int, v uint64) int { - offset -= sovRecord(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Content) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Digest) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - l = len(m.DigestAlgo) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - l = len(m.URI) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - l = len(m.Meta) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - return n -} - -func (m *Record) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - if len(m.Contents) > 0 { - for _, e := range m.Contents { - l = e.Size() - n += 1 + l + sovRecord(uint64(l)) - } - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovRecord(uint64(l)) - } - return n -} - -func sovRecord(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozRecord(x uint64) (n int) { - return sovRecord(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Content) 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 ErrIntOverflowRecord - } - 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: Content: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Content: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Digest", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - 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 ErrInvalidLengthRecord - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Digest = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DigestAlgo", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - 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 ErrInvalidLengthRecord - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DigestAlgo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field URI", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - 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 ErrInvalidLengthRecord - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.URI = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - 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 ErrInvalidLengthRecord - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Meta = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRecord(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRecord - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Record) 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 ErrIntOverflowRecord - } - 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: Record: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Record: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - 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 ErrInvalidLengthRecord - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRecord - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contents = append(m.Contents, Content{}) - if err := m.Contents[len(m.Contents)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRecord - } - 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 ErrInvalidLengthRecord - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRecord - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Creator = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRecord(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthRecord - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipRecord(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, ErrIntOverflowRecord - } - 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, ErrIntOverflowRecord - } - 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, ErrIntOverflowRecord - } - 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, ErrInvalidLengthRecord - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupRecord - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthRecord - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthRecord = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowRecord = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupRecord = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/record/tx.pb.go b/modules/record/tx.pb.go deleted file mode 100644 index 578c569e..00000000 --- a/modules/record/tx.pb.go +++ /dev/null @@ -1,401 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: record/tx.proto - -package record - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// MsgCreateValidator defines an SDK message for creating a new validator. -type MsgCreateRecord struct { - Contents []Content `protobuf:"bytes,1,rep,name=contents,proto3" json:"contents"` - Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` -} - -func (m *MsgCreateRecord) Reset() { *m = MsgCreateRecord{} } -func (m *MsgCreateRecord) String() string { return proto.CompactTextString(m) } -func (*MsgCreateRecord) ProtoMessage() {} -func (*MsgCreateRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_81225f4a7a6988bf, []int{0} -} -func (m *MsgCreateRecord) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateRecord.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 *MsgCreateRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateRecord.Merge(m, src) -} -func (m *MsgCreateRecord) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateRecord) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateRecord proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateRecord)(nil), "irismod.record.MsgCreateRecord") -} - -func init() { proto.RegisterFile("record/tx.proto", fileDescriptor_81225f4a7a6988bf) } - -var fileDescriptor_81225f4a7a6988bf = []byte{ - // 226 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x4a, 0x4d, 0xce, - 0x2f, 0x4a, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x2c, 0xca, - 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0x48, 0x48, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xa5, 0xf4, - 0x41, 0x2c, 0x88, 0x2a, 0x29, 0x61, 0xa8, 0x36, 0x08, 0x05, 0x11, 0x54, 0xca, 0xe1, 0xe2, 0xf7, - 0x2d, 0x4e, 0x77, 0x2e, 0x4a, 0x4d, 0x2c, 0x49, 0x0d, 0x02, 0x4b, 0x08, 0x59, 0x72, 0x71, 0x24, - 0xe7, 0xe7, 0x95, 0xa4, 0xe6, 0x95, 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x1b, 0x89, 0xeb, - 0xa1, 0x5a, 0xa0, 0xe7, 0x0c, 0x91, 0x77, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xae, 0x5c, - 0x48, 0x82, 0x8b, 0x3d, 0x19, 0x64, 0x54, 0x7e, 0x91, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x67, 0x10, - 0x8c, 0x6b, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x93, 0xdf, 0x89, 0x87, 0x72, 0x0c, 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, 0x65, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, - 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0xb2, 0x30, 0x2f, 0xb5, 0x04, 0x4c, 0x67, 0x94, 0x26, 0xe9, 0x16, - 0xa7, 0x64, 0xeb, 0xa6, 0xe7, 0xeb, 0xe7, 0xe6, 0xa7, 0x94, 0xe6, 0xa4, 0x16, 0x43, 0xfd, 0x90, - 0xc4, 0x06, 0xf6, 0x84, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x67, 0xaa, 0xf5, 0x96, 0x12, 0x01, - 0x00, 0x00, -} - -func (this *MsgCreateRecord) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*MsgCreateRecord) - if !ok { - that2, ok := that.(MsgCreateRecord) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Contents) != len(that1.Contents) { - return false - } - for i := range this.Contents { - if !this.Contents[i].Equal(&that1.Contents[i]) { - return false - } - } - if this.Creator != that1.Creator { - return false - } - return true -} -func (m *MsgCreateRecord) 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 *MsgCreateRecord) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - 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] = 0x12 - } - if len(m.Contents) > 0 { - for iNdEx := len(m.Contents) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Contents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func 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 *MsgCreateRecord) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Contents) > 0 { - for _, e := range m.Contents { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovTx(uint64(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 *MsgCreateRecord) 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: MsgCreateRecord: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateRecord: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contents", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contents = append(m.Contents, Content{}) - if err := m.Contents[len(m.Contents)-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 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 - 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/modules/record/types.go b/modules/record/types.go deleted file mode 100644 index cb7a6867..00000000 --- a/modules/record/types.go +++ /dev/null @@ -1,79 +0,0 @@ -package record - -import ( - "fmt" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "record" - - attributeKeyRecordID = "record_id" - eventTypeCreateRecord = "create_record" -) - -var ( - _ sdk.Msg = &MsgCreateRecord{} - - recordKey = []byte{0x01} // record key -) - -// Route implements Msg. -func (msg MsgCreateRecord) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgCreateRecord) Type() string { return "create_record" } - -// GetSignBytes implements Msg. -func (msg MsgCreateRecord) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgCreateRecord) ValidateBasic() error { - if len(msg.Contents) == 0 { - return fmt.Errorf("contents missing") - } - if len(msg.Creator) == 0 { - return fmt.Errorf("creator missing") - } - - if err := sdk.ValidateAccAddress(msg.Creator); err != nil { - return sdk.Wrap(err) - } - - for i, content := range msg.Contents { - if len(content.Digest) == 0 { - return fmt.Errorf("content[%d] digest missing", i) - } - if len(content.DigestAlgo) == 0 { - return fmt.Errorf("content[%d] digest algo missing", i) - } - } - return nil -} - -// GetSigners implements Msg. -func (msg MsgCreateRecord) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Creator)} -} - -func (this Record) Convert() interface{} { - return QueryRecordResp{ - Record: Data{ - TxHash: this.TxHash, - Contents: this.Contents, - Creator: this.Creator, - }, - } -} - -// GetRecordKey returns record key bytes -func GetRecordKey(recordID []byte) []byte { - return append(recordKey, recordID...) -} diff --git a/modules/rpc_client.go b/modules/rpc_client.go deleted file mode 100644 index bfc26b5b..00000000 --- a/modules/rpc_client.go +++ /dev/null @@ -1,213 +0,0 @@ -package modules - -import ( - "context" - "fmt" - - "github.com/tendermint/tendermint/crypto/tmhash" - "github.com/tendermint/tendermint/libs/log" - rpc "github.com/tendermint/tendermint/rpc/client" - rpchttp "github.com/tendermint/tendermint/rpc/client/http" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/irisnet/irishub-sdk-go/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/utils/uuid" -) - -type rpcClient struct { - rpc.Client - log.Logger - cdc *codec.LegacyAmino - txDecoder sdk.TxDecoder -} - -func NewRPCClient( - remote string, - cdc *codec.LegacyAmino, - txDecoder sdk.TxDecoder, - logger log.Logger, - timeout uint, -) sdk.TmClient { - client, err := rpchttp.NewWithTimeout(remote, "/websocket", timeout) - if err != nil { - panic(err) - } - - _ = client.Start() - return rpcClient{ - Client: client, - Logger: logger, - cdc: cdc, - txDecoder: txDecoder, - } -} - -// ============================================================================= -// SubscribeNewBlock implement WSClient interface -func (r rpcClient) SubscribeNewBlock(builder *sdk.EventQueryBuilder, handler sdk.EventNewBlockHandler) (sdk.Subscription, sdk.Error) { - if builder == nil { - builder = sdk.NewEventQueryBuilder() - } - - builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(tmtypes.EventNewBlock)) - query := builder.Build() - - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataNewBlock)) - }) -} - -// SubscribeTx implement WSClient interface -func (r rpcClient) SubscribeTx(builder *sdk.EventQueryBuilder, handler sdk.EventTxHandler) (sdk.Subscription, sdk.Error) { - if builder == nil { - builder = sdk.NewEventQueryBuilder() - } - query := builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(sdk.TxValue)).Build() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataTx)) - }) -} - -func (r rpcClient) SubscribeNewBlockHeader(handler sdk.EventNewBlockHeaderHandler) (sdk.Subscription, sdk.Error) { - query := tmtypes.QueryForEvent(tmtypes.EventNewBlockHeader).String() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataNewBlockHeader)) - }) -} - -func (r rpcClient) SubscribeValidatorSetUpdates(handler sdk.EventValidatorSetUpdatesHandler) (sdk.Subscription, sdk.Error) { - query := tmtypes.QueryForEvent(tmtypes.EventValidatorSetUpdates).String() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataValidatorSetUpdates)) - }) -} - -func (r rpcClient) Resubscribe(subscription sdk.Subscription, handler sdk.EventHandler) (err sdk.Error) { - _, err = r.SubscribeAny(subscription.Query, handler) - return -} - -func (r rpcClient) Unsubscribe(subscription sdk.Subscription) sdk.Error { - r.Info("end to subscribe event", "query", subscription.Query, "subscriber", subscription.ID) - err := r.Client.Unsubscribe(subscription.Ctx, subscription.ID, subscription.Query) - if err != nil { - r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) - return sdk.Wrap(err) - } - return nil -} - -func (r rpcClient) SubscribeAny(query string, handler sdk.EventHandler) (subscription sdk.Subscription, err sdk.Error) { - ctx := context.Background() - subscriber := getSubscriber() - ch, e := r.Subscribe(ctx, subscriber, query, 0) - if e != nil { - return subscription, sdk.Wrap(e) - } - - r.Info("subscribe event", "query", query, "subscriber", subscription.ID) - - subscription = sdk.Subscription{ - Ctx: ctx, - Query: query, - ID: subscriber, - } - - go func() { - for { - data := <-ch - go func() { - defer sdk.CatchPanic(func(errMsg string) { - r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) - }) - - switch data := data.Data.(type) { - case tmtypes.EventDataTx: - handler(r.parseTx(data)) - return - case tmtypes.EventDataNewBlock: - handler(r.parseNewBlock(data)) - return - case tmtypes.EventDataNewBlockHeader: - handler(r.parseNewBlockHeader(data)) - return - case tmtypes.EventDataValidatorSetUpdates: - handler(r.parseValidatorSetUpdates(data)) - return - default: - handler(data) - } - }() - } - }() - return -} - -func (r rpcClient) parseTx(data sdk.EventData) sdk.EventDataTx { - dataTx := data.(tmtypes.EventDataTx) - tx, err := r.txDecoder(dataTx.Tx) - if err != nil { - return sdk.EventDataTx{} - } - - hash := sdk.HexBytes(tmhash.Sum(dataTx.Tx)).String() - result := sdk.TxResult{ - Code: dataTx.Result.Code, - Log: dataTx.Result.Log, - GasWanted: dataTx.Result.GasWanted, - GasUsed: dataTx.Result.GasUsed, - Events: sdk.StringifyEvents(dataTx.Result.Events), - } - return sdk.EventDataTx{ - Hash: hash, - Height: dataTx.Height, - Index: dataTx.Index, - Tx: tx, - Result: result, - } -} - -func (r rpcClient) parseNewBlock(data sdk.EventData) sdk.EventDataNewBlock { - block := data.(tmtypes.EventDataNewBlock) - return sdk.EventDataNewBlock{ - Block: sdk.ParseBlock(r.cdc, block.Block), - ResultBeginBlock: sdk.ResultBeginBlock{ - Events: sdk.StringifyEvents(block.ResultBeginBlock.Events), - }, - ResultEndBlock: sdk.ResultEndBlock{ - Events: sdk.StringifyEvents(block.ResultEndBlock.Events), - ValidatorUpdates: sdk.ParseValidatorUpdate(block.ResultEndBlock.ValidatorUpdates), - }, - } -} - -func (r rpcClient) parseNewBlockHeader(data sdk.EventData) sdk.EventDataNewBlockHeader { - blockHeader := data.(tmtypes.EventDataNewBlockHeader) - return sdk.EventDataNewBlockHeader{ - Header: blockHeader.Header, - ResultBeginBlock: sdk.ResultBeginBlock{ - Events: sdk.StringifyEvents(blockHeader.ResultBeginBlock.Events), - }, - ResultEndBlock: sdk.ResultEndBlock{ - Events: sdk.StringifyEvents(blockHeader.ResultEndBlock.Events), - ValidatorUpdates: sdk.ParseValidatorUpdate(blockHeader.ResultEndBlock.ValidatorUpdates), - }, - } -} - -func (r rpcClient) parseValidatorSetUpdates(data sdk.EventData) sdk.EventDataValidatorSetUpdates { - validatorSet := data.(tmtypes.EventDataValidatorSetUpdates) - return sdk.EventDataValidatorSetUpdates{ - ValidatorUpdates: sdk.ParseValidators(r.cdc, validatorSet.ValidatorUpdates), - } -} - -func getSubscriber() string { - subscriber := "irishub-sdk-go" - id, err := uuid.NewV1() - if err == nil { - subscriber = fmt.Sprintf("%s-%s", subscriber, id.String()) - } - return subscriber -} diff --git a/modules/service/codec.go b/modules/service/codec.go deleted file mode 100644 index fd20e71f..00000000 --- a/modules/service/codec.go +++ /dev/null @@ -1,38 +0,0 @@ -package service - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgDefineService{}, - &MsgBindService{}, - &MsgUpdateServiceBinding{}, - &MsgSetWithdrawAddress{}, - &MsgDisableServiceBinding{}, - &MsgEnableServiceBinding{}, - &MsgRefundServiceDeposit{}, - &MsgCallService{}, - &MsgRespondService{}, - &MsgPauseRequestContext{}, - &MsgStartRequestContext{}, - &MsgKillRequestContext{}, - &MsgUpdateRequestContext{}, - &MsgWithdrawEarnedFees{}, - ) -} diff --git a/modules/service/doc.go b/modules/service/doc.go deleted file mode 100644 index 15fe8ffc..00000000 --- a/modules/service/doc.go +++ /dev/null @@ -1,106 +0,0 @@ -// Package service bridge the gap between the blockchain world and the conventional business application world, -// by mediating a complete lifecycle of off-chain services -- from their definition, binding (provider registration), invocation, to their governance (profiling and dispute resolution). -// -// By enhancing the IBC processing logic to support service semantics, the SDK is intended to allow distributed business services to be available across the internet of blockchains. -// The Interface description language (IDL) we introduced is to work with the service standardized definitions to satisfy service invocations across different programming languages. The currently supported IDL language is protobuf -// -// As a quick start: -// -// schemas := `{"input":{"type":"object"},"output":{"type":"object"},"error":{"type":"object"}}` -// pricing := `{"price":"1point"}` -// testResult := `{"code":200,"message":""}` -// -// baseTx := sdk.BaseTx{ -// From: "test1", -// Gas: 20000, -// Memo: "test", -// Mode: sdk.Commit, -// } -// -// definition := rpc.ServiceDefinitionRequest{ -// ServiceName: generateServiceName(), -// Description: "this is a test service", -// Event: nil, -// AuthorDescription: "service provider", -// Schemas: schemas, -// } -// -// result, err := sts.ServiceI.DefineService(definition, baseTx) -// require.NoError(sts.T(), err) -// require.NotEmpty(sts.T(), result.Hash) -// -// defi, err := sts.ServiceI.QueryServiceDefinition(definition.ServiceName) -// require.NoError(sts.T(), err) -// require.Equal(sts.T(), definition.ServiceName, defi.Name) -// require.Equal(sts.T(), definition.Description, defi.Description) -// require.EqualValues(sts.T(), definition.Event, defi.Event) -// require.Equal(sts.T(), definition.AuthorDescription, defi.AuthorDescription) -// require.Equal(sts.T(), definition.Schemas, defi.Schemas) -// require.Equal(sts.T(), sts.Sender(), defi.Author) -// -// deposit, _ := sdk.ParseCoins("20000000000000000000000point") -// binding := rpc.ServiceBindingRequest{ -// ServiceName: definition.ServiceName, -// Deposit: deposit, -// Pricing: pricing, -// } -// result, err = sts.ServiceI.BindService(binding, baseTx) -// require.NoError(sts.T(), err) -// require.NotEmpty(sts.T(), result.Hash) -// -// bindResp, err := sts.ServiceI.QueryServiceBinding(definition.ServiceName, sts.Sender()) -// require.NoError(sts.T(), err) -// require.Equal(sts.T(), binding.ServiceName, bindResp.ServiceName) -// require.Equal(sts.T(), sts.Sender(), bindResp.Provider) -// require.Equal(sts.T(), binding.Deposit.String(), bindResp.Deposit.String()) -// require.Equal(sts.T(), binding.Pricing, bindResp.Pricing) -// -// input := `{"pair":"point-usdt"}` -// output := `{"last":"1:100"}` -// -// err = sts.ServiceI.SubscribeSingleServiceRequest(definition.ServiceName, -// func(reqCtxID, reqID, input string) (string, string) { -// sts.Info(). -// Str("input", input). -// Str("output", output). -// Msg("provider received request") -// return output, testResult -// }, baseTx) -// require.NoError(sts.T(), err) -// -// serviceFeeCap, _ := sdk.ParseCoins("1000000000000000000point") -// invocation := rpc.ServiceInvocationRequest{ -// ServiceName: definition.ServiceName, -// Providers: []string{sts.Sender().String()}, -// Input: input, -// ServiceFeeCap: serviceFeeCap, -// Timeout: 3, -// Repeated: true, -// RepeatedFrequency: 5, -// RepeatedTotal: -1, -// } -// var requestContextID string -// var exit = make(chan int, 0) -// requestContextID, err = sts.ServiceI.InvokeService(invocation, func(reqCtxID, reqID, responses string) { -// require.Equal(sts.T(), reqCtxID, requestContextID) -// require.Equal(sts.T(), output, response) -// sts.Info(). -// Str("requestContextID", requestContextID). -// Str("response", response). -// Msg("consumer received response") -// exit <- 1 -// }, baseTx) -// -// sts.Info(). -// Str("requestContextID", requestContextID). -// Msg("ServiceRequest service success") -// require.NoError(sts.T(), err) -// -// request, err := sts.ServiceI.QueryRequestContext(requestContextID) -// require.NoError(sts.T(), err) -// require.Equal(sts.T(), request.ServiceName, invocation.ServiceName) -// require.Equal(sts.T(), request.Input, invocation.Input) -// -// <-exit -// -package service diff --git a/modules/service/export.go b/modules/service/export.go deleted file mode 100644 index d6c0eb54..00000000 --- a/modules/service/export.go +++ /dev/null @@ -1,199 +0,0 @@ -package service - -import ( - "time" - - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/query" -) - -// Tx defines a set of transaction interfaces in the service module -type Tx interface { - DefineService(request DefineServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - BindService(request BindServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - InvokeService(request InvokeServiceRequest, baseTx sdk.BaseTx) (string, sdk.ResultTx, sdk.Error) - InvokeServiceResponse(request InvokeServiceResponseRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - SetWithdrawAddress(withdrawAddress string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - UpdateServiceBinding(request UpdateServiceBindingRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - DisableServiceBinding(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - EnableServiceBinding(serviceName, provider string, deposit sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - RefundServiceDeposit(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - PauseRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - StartRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - KillRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - UpdateRequestContext(request UpdateRequestContextRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - WithdrawEarnedFees(provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - SubscribeServiceRequest(serviceName string, callback RespondCallback, baseTx sdk.BaseTx) (sdk.Subscription, sdk.Error) - SubscribeServiceResponse(reqCtxID string, callback InvokeCallback) (sdk.Subscription, sdk.Error) -} - -// Query defines a set of query interfaces in the service module -type Query interface { - QueryServiceDefinition(serviceName string) (QueryServiceDefinitionResponse, sdk.Error) - QueryServiceBinding(serviceName string, provider string) (QueryServiceBindingResponse, sdk.Error) - QueryServiceBindings(serviceName string, pageReq *query.PageRequest) ([]QueryServiceBindingResponse, sdk.Error) - QueryServiceRequest(requestID string) (QueryServiceRequestResponse, sdk.Error) - QueryServiceRequests(serviceName string, provider string, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) - QueryRequestsByReqCtx(requestContextID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) - QueryServiceResponse(requestID string) (QueryServiceResponseResponse, sdk.Error) - QueryServiceResponses(requestContextID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceResponseResponse, sdk.Error) - QueryRequestContext(requestContextID string) (QueryRequestContextResp, sdk.Error) - QueryFees(provider string) (sdk.Coins, sdk.Error) - QueryParams() (QueryParamsResp, sdk.Error) -} - -// Client defines a set of interfaces in the service module -type Client interface { - sdk.Module - Tx - Query -} - -// InvokeCallback defines the callback function for service calls -type InvokeCallback func(reqCtxID, reqID, responses string) - -// RespondCallback defines the callback function of the service response -type RespondCallback func(reqCtxID, reqID, input string) (output string, result string) - -// Registry defines a set of service invocation interfaces -type Registry map[string]RespondCallback - -// Request defines a request which contains the detailed request data -type QueryServiceRequestResponse struct { - ID string `json:"id"` - ServiceName string `json:"service_name"` - Provider string `json:"provider"` - Consumer string `json:"consumer"` - Input string `json:"input"` - ServiceFee sdk.Coins `json:"service_fee"` - SuperMode bool `json:"super_mode"` - RequestHeight int64 `json:"request_height"` - ExpirationHeight int64 `json:"expiration_height"` - RequestContextID string `json:"request_context_id"` - RequestContextBatchCounter uint64 `json:"request_context_batch_counter"` -} - -// Response defines a response -type QueryServiceResponseResponse struct { - Provider string `json:"provider"` - Consumer string `json:"consumer"` - Output string `json:"output"` - Result string `json:"error"` - RequestContextID string `json:"request_context_id"` - RequestContextBatchCounter uint64 `json:"request_context_batch_counter"` -} - -// DefineServiceRequest defines the request parameters of the service definition -type DefineServiceRequest struct { - ServiceName string `json:"service_name"` - Description string `json:"description"` - Tags []string `json:"tags"` - AuthorDescription string `json:"author_description"` - Schemas string `json:"schemas"` -} - -// QueryServiceDefinitionResponse represents a service definition -type QueryServiceDefinitionResponse struct { - Name string `json:"name"` - Description string `json:"description"` - Tags []string `json:"tags"` - Author string `json:"author"` - AuthorDescription string `json:"author_description"` - Schemas string `json:"schemas"` -} - -// BindServiceRequest defines the request parameters of the service binding -type BindServiceRequest struct { - ServiceName string `json:"service_name"` - Deposit sdk.DecCoins `json:"deposit"` - Pricing string `json:"pricing"` - QoS uint64 `json:"qos"` - Options string `json:"options"` - Provider string `json:"provider"` -} - -// UpdateServiceBindingRequest defines a message to update a service binding -type UpdateServiceBindingRequest struct { - ServiceName string `json:"service_name"` - Deposit sdk.DecCoins `json:"deposit"` - Pricing string `json:"pricing"` - QoS uint64 `json:"qos"` - Provider string `json:"provider"` -} - -// QueryServiceBindingResponse defines a struct for service binding -type QueryServiceBindingResponse struct { - ServiceName string `json:"service_name"` - Provider string `json:"provider"` - Deposit sdk.Coins `json:"deposit"` - Pricing string `json:"pricing"` - QoS uint64 `json:"qos"` - Options string `json:"options"` - Available bool `json:"available"` - DisabledTime time.Time `json:"disabled_time"` - Owner string `json:"owner"` -} - -// InvokeServiceRequest defines the request parameters of the service call -type InvokeServiceRequest struct { - ServiceName string `json:"service_name"` - Providers []string `json:"providers"` - Input string `json:"input"` - ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` - Timeout int64 `json:"timeout"` - SuperMode bool `json:"super_mode"` - Repeated bool `json:"repeated"` - RepeatedFrequency uint64 `json:"repeated_frequency"` - RepeatedTotal int64 `json:"repeated_total"` - Callback InvokeCallback -} - -// InvokeServiceResponseRequest defines the request parameters of the service response -type InvokeServiceResponseRequest struct { - RequestId string `json:"request_id"` - Output string `json:"output"` - Result string `json:"result"` -} - -// UpdateRequestContextRequest defines a message to update a request context -type UpdateRequestContextRequest struct { - RequestContextID string `json:"request_context_id"` - Providers []string `json:"providers"` - ServiceFeeCap sdk.DecCoins `json:"service_fee_cap"` - Timeout int64 `json:"timeout"` - RepeatedFrequency uint64 `json:"repeated_frequency"` - RepeatedTotal int64 `json:"repeated_total"` -} - -// QueryRequestContextResp defines a context which holds request-related data -type QueryRequestContextResp struct { - ServiceName string `json:"service_name"` - Providers []string `json:"providers"` - Consumer string `json:"consumer"` - Input string `json:"input"` - ServiceFeeCap sdk.Coins `json:"service_fee_cap"` - Timeout int64 `json:"timeout"` - SuperMode bool `json:"super_mode"` - Repeated bool `json:"repeated"` - RepeatedFrequency uint64 `json:"repeated_frequency"` - RepeatedTotal int64 `json:"repeated_total"` - BatchCounter uint64 `json:"batch_counter"` - BatchRequestCount uint32 `json:"batch_request_count"` - BatchResponseCount uint32 `json:"batch_response_count"` - BatchState string `json:"batch_state"` - State string `json:"state"` - ResponseThreshold uint32 `json:"response_threshold"` - ModuleName string `json:"module_name"` -} - -type QueryParamsResp struct { - MaxRequestTimeout int64 `json:"max_request_timeout"` - MinDepositMultiple int64 `json:"min_deposit_multiple"` - MinDeposit string `json:"min_deposit"` - ServiceFeeTax string `json:"service_fee_tax"` - SlashFraction string `json:"slash_fraction"` - ComplaintRetrospect time.Duration `json:"complaint_retrospect"` - ArbitrationTimeLimit time.Duration `json:"arbitration_time_limit"` - TxSizeLimit uint64 `json:"tx_size_limit"` - BaseDenom string `json:"base_denom"` -} diff --git a/modules/service/params.go b/modules/service/params.go deleted file mode 100644 index c973feb3..00000000 --- a/modules/service/params.go +++ /dev/null @@ -1,11 +0,0 @@ -package service - -import ( - yaml "gopkg.in/yaml.v2" -) - -// String implements the stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/modules/service/query.go b/modules/service/query.go deleted file mode 100644 index dad556ca..00000000 --- a/modules/service/query.go +++ /dev/null @@ -1,197 +0,0 @@ -package service - -import ( - "context" - "encoding/binary" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// queryRequestContextByTxQuery will query for a single request context via a direct txs tags query. -func (s serviceClient) queryRequestContextByTxQuery(reqCtxID string) (RequestContext, error) { - txHash, msgIndex, err := splitRequestContextID(reqCtxID) - if err != nil { - return RequestContext{}, err - } - - txInfo, err := s.QueryTx(hex.EncodeToString(txHash)) - if err != nil { - return RequestContext{}, err - } - - if int64(len(txInfo.Tx.GetMsgs())) > msgIndex { - msg := txInfo.Tx.GetMsgs()[msgIndex] - if msg, ok := msg.(*MsgCallService); ok { - return RequestContext{ - ServiceName: msg.ServiceName, - Providers: msg.Providers, - Consumer: msg.Consumer, - Input: msg.Input, - ServiceFeeCap: msg.ServiceFeeCap, - Timeout: msg.Timeout, - Repeated: msg.Repeated, - RepeatedFrequency: msg.RepeatedFrequency, - RepeatedTotal: msg.RepeatedTotal, - BatchCounter: uint64(msg.RepeatedTotal), - BatchRequestCount: 0, - BatchResponseCount: 0, - BatchState: BATCHCOMPLETED, - State: COMPLETED, - ResponseThreshold: 0, - ModuleName: "", - }, nil - } - } - return RequestContext{}, fmt.Errorf("invalid reqCtxID:%s", reqCtxID) -} - -// queryRequestByTxQuery will query for a single request via a direct txs tags query. -func (s serviceClient) queryRequestByTxQuery(requestID string) (Request, error) { - reqCtxID, _, requestHeight, batchRequestIndex, err := splitRequestID(requestID) - if err != nil { - return Request{}, err - } - - // query request context - reqCtx, err := s.QueryRequestContext(hex.EncodeToString(reqCtxID)) - if err != nil { - return Request{}, err - } - - blockResult, err := s.BlockResults(context.Background(), &requestHeight) - if err != nil { - return Request{}, err - } - - for _, event := range blockResult.EndBlockEvents { - if event.Type == eventTypeNewBatchRequest { - var found bool - var requestsBz []byte - for _, attribute := range event.Attributes { - if string(attribute.Key) == attributeKeyRequests { - requestsBz = attribute.GetValue() - } - if string(attribute.Key) == attributeKeyRequestContextID && - string(attribute.GetValue()) == reqCtxID.String() { - found = true - } - } - - if found { - var requests []CompactRequest - if err := json.Unmarshal(requestsBz, &requests); err != nil { - return Request{}, err - } - if len(requests) > int(batchRequestIndex) { - compactRequest := requests[batchRequestIndex] - return Request{ - Id: sdk.MustHexBytesFrom(requestID).String(), - ServiceName: reqCtx.ServiceName, - Provider: compactRequest.Provider, - Consumer: reqCtx.Consumer, - Input: reqCtx.Input, - ServiceFee: compactRequest.ServiceFee, - RequestHeight: compactRequest.RequestHeight, - ExpirationHeight: compactRequest.RequestHeight + reqCtx.Timeout, - RequestContextId: compactRequest.RequestContextId, - RequestContextBatchCounter: compactRequest.RequestContextBatchCounter, - }, nil - } - } - } - } - return Request{}, fmt.Errorf("invalid requestID:%s", requestID) -} - -// queryResponseByTxQuery will query for a single request via a direct txs tags query. -func (s serviceClient) queryResponseByTxQuery(requestID string) (Response, error) { - builder := sdk.NewEventQueryBuilder().AddCondition( - sdk.NewCond( - sdk.EventTypeMessage, - sdk.AttributeKeyAction, - ).EQ("respond_service"), - ).AddCondition( - sdk.NewCond( - sdk.EventTypeMessage, - sdk.AttributeKeyAction, - ).EQ(attributeKeyRequestID), - ) - - result, err := s.QueryTxs(builder, nil, nil) - if err != nil { - return Response{}, err - } - - if len(result.Txs) == 0 { - return Response{}, fmt.Errorf("unknown response: %s", requestID) - } - - reqCtxID, batchCounter, _, _, err := splitRequestID(requestID) - if err != nil { - return Response{}, err - } - - // query request context - reqCtx, err := s.QueryRequestContext(hex.EncodeToString(reqCtxID)) - if err != nil { - return Response{}, err - } - - for _, msg := range result.Txs[0].Tx.GetMsgs() { - if responseMsg, ok := msg.(*MsgRespondService); ok { - if responseMsg.RequestId != requestID { - continue - } - return Response{ - Provider: responseMsg.Provider, - Consumer: reqCtx.Consumer, - Output: responseMsg.Output, - Result: responseMsg.Result, - RequestContextId: sdk.HexStringFrom(reqCtxID), - RequestContextBatchCounter: batchCounter, - }, nil - } - } - - return Response{}, nil -} - -// SplitRequestContextID splits the given contextID to txHash and msgIndex -func splitRequestContextID(reqCtxID string) (sdk.HexBytes, int64, error) { - contextID, err := hex.DecodeString(reqCtxID) - if err != nil { - return nil, 0, errors.New("invalid request context id") - } - - if len(contextID) != contextIDLen { - return nil, 0, fmt.Errorf("invalid request context id:%s", reqCtxID) - } - - txHash := contextID[0:32] - msgIndex := int64(binary.BigEndian.Uint64(contextID[32:40])) - - return txHash, msgIndex, nil -} - -// SplitRequestID splits the given contextID to contextID, batchCounter, requestHeight, batchRequestIndex -func splitRequestID(reqID string) (sdk.HexBytes, uint64, int64, int16, error) { - requestID, err := hex.DecodeString(reqID) - if err != nil { - return nil, 0, 0, 0, errors.New("invalid request id") - } - - if len(requestID) != requestIDLen { - return nil, 0, 0, 0, errors.New("invalid request id") - } - - reqCtxID := requestID[0:40] - batchCounter := binary.BigEndian.Uint64(requestID[40:48]) - requestHeight := int64(binary.BigEndian.Uint64(requestID[48:56])) - batchRequestIndex := int16(binary.BigEndian.Uint16(requestID[56:])) - - return reqCtxID, batchCounter, requestHeight, batchRequestIndex, nil -} diff --git a/modules/service/query.pb.go b/modules/service/query.pb.go deleted file mode 100644 index 38282dcc..00000000 --- a/modules/service/query.pb.go +++ /dev/null @@ -1,6105 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/query.proto - -package service - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - query "github.com/irisnet/irishub-sdk-go/types/query" - _ "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 - -// QueryDefinitionRequest is request type for the Query/Definition RPC method -type QueryDefinitionRequest struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` -} - -func (m *QueryDefinitionRequest) Reset() { *m = QueryDefinitionRequest{} } -func (m *QueryDefinitionRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDefinitionRequest) ProtoMessage() {} -func (*QueryDefinitionRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{0} -} -func (m *QueryDefinitionRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDefinitionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDefinitionRequest.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 *QueryDefinitionRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDefinitionRequest.Merge(m, src) -} -func (m *QueryDefinitionRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDefinitionRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDefinitionRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDefinitionRequest proto.InternalMessageInfo - -func (m *QueryDefinitionRequest) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -// QueryDefinitionResponse is response type for the Query/Definition RPC method -type QueryDefinitionResponse struct { - ServiceDefinition *ServiceDefinition `protobuf:"bytes,1,opt,name=service_definition,json=serviceDefinition,proto3" json:"service_definition,omitempty"` -} - -func (m *QueryDefinitionResponse) Reset() { *m = QueryDefinitionResponse{} } -func (m *QueryDefinitionResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDefinitionResponse) ProtoMessage() {} -func (*QueryDefinitionResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{1} -} -func (m *QueryDefinitionResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDefinitionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDefinitionResponse.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 *QueryDefinitionResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDefinitionResponse.Merge(m, src) -} -func (m *QueryDefinitionResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDefinitionResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDefinitionResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDefinitionResponse proto.InternalMessageInfo - -func (m *QueryDefinitionResponse) GetServiceDefinition() *ServiceDefinition { - if m != nil { - return m.ServiceDefinition - } - return nil -} - -// QueryBindingRequest is request type for the Query/Binding RPC method -type QueryBindingRequest struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` -} - -func (m *QueryBindingRequest) Reset() { *m = QueryBindingRequest{} } -func (m *QueryBindingRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBindingRequest) ProtoMessage() {} -func (*QueryBindingRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{2} -} -func (m *QueryBindingRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBindingRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBindingRequest.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 *QueryBindingRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBindingRequest.Merge(m, src) -} -func (m *QueryBindingRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryBindingRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBindingRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBindingRequest proto.InternalMessageInfo - -func (m *QueryBindingRequest) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *QueryBindingRequest) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -// QueryDefinitionResponse is response type for the Query/Binding RPC method -type QueryBindingResponse struct { - ServiceBinding *ServiceBinding `protobuf:"bytes,1,opt,name=service_binding,json=serviceBinding,proto3" json:"service_binding,omitempty"` -} - -func (m *QueryBindingResponse) Reset() { *m = QueryBindingResponse{} } -func (m *QueryBindingResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBindingResponse) ProtoMessage() {} -func (*QueryBindingResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{3} -} -func (m *QueryBindingResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBindingResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBindingResponse.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 *QueryBindingResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBindingResponse.Merge(m, src) -} -func (m *QueryBindingResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryBindingResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBindingResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBindingResponse proto.InternalMessageInfo - -func (m *QueryBindingResponse) GetServiceBinding() *ServiceBinding { - if m != nil { - return m.ServiceBinding - } - return nil -} - -// QueryBindingsRequest is request type for the Query/Bindings RPC method -type QueryBindingsRequest struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryBindingsRequest) Reset() { *m = QueryBindingsRequest{} } -func (m *QueryBindingsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBindingsRequest) ProtoMessage() {} -func (*QueryBindingsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{4} -} -func (m *QueryBindingsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBindingsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBindingsRequest.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 *QueryBindingsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBindingsRequest.Merge(m, src) -} -func (m *QueryBindingsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryBindingsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBindingsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBindingsRequest proto.InternalMessageInfo - -func (m *QueryBindingsRequest) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *QueryBindingsRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -func (m *QueryBindingsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryDefinitionsResponse is response type for the Query/Bindings RPC method -type QueryBindingsResponse struct { - ServiceBindings []*ServiceBinding `protobuf:"bytes,1,rep,name=service_bindings,json=serviceBindings,proto3" json:"service_bindings,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryBindingsResponse) Reset() { *m = QueryBindingsResponse{} } -func (m *QueryBindingsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBindingsResponse) ProtoMessage() {} -func (*QueryBindingsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{5} -} -func (m *QueryBindingsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBindingsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBindingsResponse.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 *QueryBindingsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBindingsResponse.Merge(m, src) -} -func (m *QueryBindingsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryBindingsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBindingsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBindingsResponse proto.InternalMessageInfo - -func (m *QueryBindingsResponse) GetServiceBindings() []*ServiceBinding { - if m != nil { - return m.ServiceBindings - } - return nil -} - -func (m *QueryBindingsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryWithdrawAddressRequest is request type for the Query/WithdrawAddress RPC method -type QueryWithdrawAddressRequest struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *QueryWithdrawAddressRequest) Reset() { *m = QueryWithdrawAddressRequest{} } -func (m *QueryWithdrawAddressRequest) String() string { return proto.CompactTextString(m) } -func (*QueryWithdrawAddressRequest) ProtoMessage() {} -func (*QueryWithdrawAddressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{6} -} -func (m *QueryWithdrawAddressRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryWithdrawAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryWithdrawAddressRequest.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 *QueryWithdrawAddressRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryWithdrawAddressRequest.Merge(m, src) -} -func (m *QueryWithdrawAddressRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryWithdrawAddressRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryWithdrawAddressRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryWithdrawAddressRequest proto.InternalMessageInfo - -func (m *QueryWithdrawAddressRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -// QueryWithdrawAddressResponse is response type for the Query/WithdrawAddress RPC method -type QueryWithdrawAddressResponse struct { - WithdrawAddress string `protobuf:"bytes,1,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty"` -} - -func (m *QueryWithdrawAddressResponse) Reset() { *m = QueryWithdrawAddressResponse{} } -func (m *QueryWithdrawAddressResponse) String() string { return proto.CompactTextString(m) } -func (*QueryWithdrawAddressResponse) ProtoMessage() {} -func (*QueryWithdrawAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{7} -} -func (m *QueryWithdrawAddressResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryWithdrawAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryWithdrawAddressResponse.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 *QueryWithdrawAddressResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryWithdrawAddressResponse.Merge(m, src) -} -func (m *QueryWithdrawAddressResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryWithdrawAddressResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryWithdrawAddressResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryWithdrawAddressResponse proto.InternalMessageInfo - -func (m *QueryWithdrawAddressResponse) GetWithdrawAddress() string { - if m != nil { - return m.WithdrawAddress - } - return "" -} - -// QueryRequestContextRequest is request type for the Query/RequestContext RPC method -type QueryRequestContextRequest struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty"` -} - -func (m *QueryRequestContextRequest) Reset() { *m = QueryRequestContextRequest{} } -func (m *QueryRequestContextRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRequestContextRequest) ProtoMessage() {} -func (*QueryRequestContextRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{8} -} -func (m *QueryRequestContextRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestContextRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestContextRequest.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 *QueryRequestContextRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestContextRequest.Merge(m, src) -} -func (m *QueryRequestContextRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestContextRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestContextRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestContextRequest proto.InternalMessageInfo - -func (m *QueryRequestContextRequest) GetRequestContextId() string { - if m != nil { - return m.RequestContextId - } - return "" -} - -// QueryRequestContextResponse is response type for the Query/RequestContext RPC method -type QueryRequestContextResponse struct { - RequestContext *RequestContext `protobuf:"bytes,1,opt,name=request_context,json=requestContext,proto3" json:"request_context,omitempty"` -} - -func (m *QueryRequestContextResponse) Reset() { *m = QueryRequestContextResponse{} } -func (m *QueryRequestContextResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRequestContextResponse) ProtoMessage() {} -func (*QueryRequestContextResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{9} -} -func (m *QueryRequestContextResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestContextResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestContextResponse.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 *QueryRequestContextResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestContextResponse.Merge(m, src) -} -func (m *QueryRequestContextResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestContextResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestContextResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestContextResponse proto.InternalMessageInfo - -func (m *QueryRequestContextResponse) GetRequestContext() *RequestContext { - if m != nil { - return m.RequestContext - } - return nil -} - -// QueryRequestRequest is request type for the Query/Request RPC method -type QueryRequestRequest struct { - RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` -} - -func (m *QueryRequestRequest) Reset() { *m = QueryRequestRequest{} } -func (m *QueryRequestRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRequestRequest) ProtoMessage() {} -func (*QueryRequestRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{10} -} -func (m *QueryRequestRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestRequest.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 *QueryRequestRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestRequest.Merge(m, src) -} -func (m *QueryRequestRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestRequest proto.InternalMessageInfo - -func (m *QueryRequestRequest) GetRequestId() string { - if m != nil { - return m.RequestId - } - return "" -} - -// QueryRequestResponse is response type for the Query/Request RPC method -type QueryRequestResponse struct { - Request *Request `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` -} - -func (m *QueryRequestResponse) Reset() { *m = QueryRequestResponse{} } -func (m *QueryRequestResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRequestResponse) ProtoMessage() {} -func (*QueryRequestResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{11} -} -func (m *QueryRequestResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestResponse.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 *QueryRequestResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestResponse.Merge(m, src) -} -func (m *QueryRequestResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestResponse proto.InternalMessageInfo - -func (m *QueryRequestResponse) GetRequest() *Request { - if m != nil { - return m.Request - } - return nil -} - -// QueryRequestsRequest is request type for the Query/Requests RPC method -type QueryRequestsRequest struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryRequestsRequest) Reset() { *m = QueryRequestsRequest{} } -func (m *QueryRequestsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRequestsRequest) ProtoMessage() {} -func (*QueryRequestsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{12} -} -func (m *QueryRequestsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestsRequest.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 *QueryRequestsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestsRequest.Merge(m, src) -} -func (m *QueryRequestsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestsRequest proto.InternalMessageInfo - -func (m *QueryRequestsRequest) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *QueryRequestsRequest) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -func (m *QueryRequestsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryRequestsResponse is response type for the Query/Requests RPC method -type QueryRequestsResponse struct { - Requests []*Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryRequestsResponse) Reset() { *m = QueryRequestsResponse{} } -func (m *QueryRequestsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRequestsResponse) ProtoMessage() {} -func (*QueryRequestsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{13} -} -func (m *QueryRequestsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestsResponse.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 *QueryRequestsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestsResponse.Merge(m, src) -} -func (m *QueryRequestsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestsResponse proto.InternalMessageInfo - -func (m *QueryRequestsResponse) GetRequests() []*Request { - if m != nil { - return m.Requests - } - return nil -} - -func (m *QueryRequestsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryRequestsByReqCtxRequest is request type for the Query/RequestsByReqCtx RPC method -type QueryRequestsByReqCtxRequest struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty"` - BatchCounter uint64 `protobuf:"varint,2,opt,name=batch_counter,json=batchCounter,proto3" json:"batch_counter,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryRequestsByReqCtxRequest) Reset() { *m = QueryRequestsByReqCtxRequest{} } -func (m *QueryRequestsByReqCtxRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRequestsByReqCtxRequest) ProtoMessage() {} -func (*QueryRequestsByReqCtxRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{14} -} -func (m *QueryRequestsByReqCtxRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestsByReqCtxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestsByReqCtxRequest.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 *QueryRequestsByReqCtxRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestsByReqCtxRequest.Merge(m, src) -} -func (m *QueryRequestsByReqCtxRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestsByReqCtxRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestsByReqCtxRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestsByReqCtxRequest proto.InternalMessageInfo - -func (m *QueryRequestsByReqCtxRequest) GetRequestContextId() string { - if m != nil { - return m.RequestContextId - } - return "" -} - -func (m *QueryRequestsByReqCtxRequest) GetBatchCounter() uint64 { - if m != nil { - return m.BatchCounter - } - return 0 -} - -func (m *QueryRequestsByReqCtxRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryRequestsByReqCtxResponse is response type for the Query/RequestsByReqCtx RPC method -type QueryRequestsByReqCtxResponse struct { - Requests []*Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryRequestsByReqCtxResponse) Reset() { *m = QueryRequestsByReqCtxResponse{} } -func (m *QueryRequestsByReqCtxResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRequestsByReqCtxResponse) ProtoMessage() {} -func (*QueryRequestsByReqCtxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{15} -} -func (m *QueryRequestsByReqCtxResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRequestsByReqCtxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRequestsByReqCtxResponse.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 *QueryRequestsByReqCtxResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRequestsByReqCtxResponse.Merge(m, src) -} -func (m *QueryRequestsByReqCtxResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRequestsByReqCtxResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRequestsByReqCtxResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRequestsByReqCtxResponse proto.InternalMessageInfo - -func (m *QueryRequestsByReqCtxResponse) GetRequests() []*Request { - if m != nil { - return m.Requests - } - return nil -} - -func (m *QueryRequestsByReqCtxResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryResponseRequest is request type for the Query/Response RPC method -type QueryResponseRequest struct { - RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` -} - -func (m *QueryResponseRequest) Reset() { *m = QueryResponseRequest{} } -func (m *QueryResponseRequest) String() string { return proto.CompactTextString(m) } -func (*QueryResponseRequest) ProtoMessage() {} -func (*QueryResponseRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{16} -} -func (m *QueryResponseRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryResponseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryResponseRequest.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 *QueryResponseRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryResponseRequest.Merge(m, src) -} -func (m *QueryResponseRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryResponseRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryResponseRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryResponseRequest proto.InternalMessageInfo - -func (m *QueryResponseRequest) GetRequestId() string { - if m != nil { - return m.RequestId - } - return "" -} - -// QueryResponseResponse is response type for the Query/Response RPC method -type QueryResponseResponse struct { - Response *Response `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` -} - -func (m *QueryResponseResponse) Reset() { *m = QueryResponseResponse{} } -func (m *QueryResponseResponse) String() string { return proto.CompactTextString(m) } -func (*QueryResponseResponse) ProtoMessage() {} -func (*QueryResponseResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{17} -} -func (m *QueryResponseResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryResponseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryResponseResponse.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 *QueryResponseResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryResponseResponse.Merge(m, src) -} -func (m *QueryResponseResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryResponseResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryResponseResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryResponseResponse proto.InternalMessageInfo - -func (m *QueryResponseResponse) GetResponse() *Response { - if m != nil { - return m.Response - } - return nil -} - -// QueryResponsesRequest is request type for the Query/Responses RPC method -type QueryResponsesRequest struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty"` - BatchCounter uint64 `protobuf:"varint,2,opt,name=batch_counter,json=batchCounter,proto3" json:"batch_counter,omitempty"` - Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryResponsesRequest) Reset() { *m = QueryResponsesRequest{} } -func (m *QueryResponsesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryResponsesRequest) ProtoMessage() {} -func (*QueryResponsesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{18} -} -func (m *QueryResponsesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryResponsesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryResponsesRequest.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 *QueryResponsesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryResponsesRequest.Merge(m, src) -} -func (m *QueryResponsesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryResponsesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryResponsesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryResponsesRequest proto.InternalMessageInfo - -func (m *QueryResponsesRequest) GetRequestContextId() string { - if m != nil { - return m.RequestContextId - } - return "" -} - -func (m *QueryResponsesRequest) GetBatchCounter() uint64 { - if m != nil { - return m.BatchCounter - } - return 0 -} - -func (m *QueryResponsesRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryResponsesResponse is response type for the Query/Responses RPC method -type QueryResponsesResponse struct { - Responses []*Response `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"` - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryResponsesResponse) Reset() { *m = QueryResponsesResponse{} } -func (m *QueryResponsesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryResponsesResponse) ProtoMessage() {} -func (*QueryResponsesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{19} -} -func (m *QueryResponsesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryResponsesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryResponsesResponse.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 *QueryResponsesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryResponsesResponse.Merge(m, src) -} -func (m *QueryResponsesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryResponsesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryResponsesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryResponsesResponse proto.InternalMessageInfo - -func (m *QueryResponsesResponse) GetResponses() []*Response { - if m != nil { - return m.Responses - } - return nil -} - -func (m *QueryResponsesResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryEarnedFeesRequest is request type for the Query/EarnedFees RPC method -type QueryEarnedFeesRequest struct { - Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` -} - -func (m *QueryEarnedFeesRequest) Reset() { *m = QueryEarnedFeesRequest{} } -func (m *QueryEarnedFeesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryEarnedFeesRequest) ProtoMessage() {} -func (*QueryEarnedFeesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{20} -} -func (m *QueryEarnedFeesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryEarnedFeesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryEarnedFeesRequest.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 *QueryEarnedFeesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEarnedFeesRequest.Merge(m, src) -} -func (m *QueryEarnedFeesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryEarnedFeesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEarnedFeesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryEarnedFeesRequest proto.InternalMessageInfo - -func (m *QueryEarnedFeesRequest) GetProvider() string { - if m != nil { - return m.Provider - } - return "" -} - -// QueryEarnedFeesResponse is response type for the Query/EarnedFees RPC method -type QueryEarnedFeesResponse struct { - Fees github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=fees,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"fees" yaml:"service_fee"` -} - -func (m *QueryEarnedFeesResponse) Reset() { *m = QueryEarnedFeesResponse{} } -func (m *QueryEarnedFeesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryEarnedFeesResponse) ProtoMessage() {} -func (*QueryEarnedFeesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{21} -} -func (m *QueryEarnedFeesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryEarnedFeesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryEarnedFeesResponse.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 *QueryEarnedFeesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEarnedFeesResponse.Merge(m, src) -} -func (m *QueryEarnedFeesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryEarnedFeesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEarnedFeesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryEarnedFeesResponse proto.InternalMessageInfo - -func (m *QueryEarnedFeesResponse) GetFees() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.Fees - } - return nil -} - -// QuerySchemaRequest is request type for the Query/Schema RPC method -type QuerySchemaRequest struct { - SchemaName string `protobuf:"bytes,1,opt,name=schema_name,json=schemaName,proto3" json:"schema_name,omitempty"` -} - -func (m *QuerySchemaRequest) Reset() { *m = QuerySchemaRequest{} } -func (m *QuerySchemaRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySchemaRequest) ProtoMessage() {} -func (*QuerySchemaRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{22} -} -func (m *QuerySchemaRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySchemaRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySchemaRequest.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 *QuerySchemaRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchemaRequest.Merge(m, src) -} -func (m *QuerySchemaRequest) XXX_Size() int { - return m.Size() -} -func (m *QuerySchemaRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchemaRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySchemaRequest proto.InternalMessageInfo - -func (m *QuerySchemaRequest) GetSchemaName() string { - if m != nil { - return m.SchemaName - } - return "" -} - -// QuerySchemaResponse is response type for the Query/Schema RPC method -type QuerySchemaResponse struct { - Schema string `protobuf:"bytes,1,opt,name=schema,proto3" json:"schema,omitempty"` -} - -func (m *QuerySchemaResponse) Reset() { *m = QuerySchemaResponse{} } -func (m *QuerySchemaResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySchemaResponse) ProtoMessage() {} -func (*QuerySchemaResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_d141bb1b35a55f92, []int{23} -} -func (m *QuerySchemaResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySchemaResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySchemaResponse.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 *QuerySchemaResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySchemaResponse.Merge(m, src) -} -func (m *QuerySchemaResponse) XXX_Size() int { - return m.Size() -} -func (m *QuerySchemaResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySchemaResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySchemaResponse proto.InternalMessageInfo - -func (m *QuerySchemaResponse) GetSchema() string { - if m != nil { - return m.Schema - } - return "" -} - -// QueryParametersRequest is request type for the Query/Parameters 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_d141bb1b35a55f92, []int{24} -} -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 - -// QueryParametersResponse is response type for the Query/Parameters RPC method -type QueryParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` -} - -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_d141bb1b35a55f92, []int{25} -} -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{} -} - -func (m *QueryParamsResponse) GetRes() *query.PageResponse { - if m != nil { - return m.Res - } - return nil -} - -func init() { - proto.RegisterType((*QueryDefinitionRequest)(nil), "irismod.service.QueryDefinitionRequest") - proto.RegisterType((*QueryDefinitionResponse)(nil), "irismod.service.QueryDefinitionResponse") - proto.RegisterType((*QueryBindingRequest)(nil), "irismod.service.QueryBindingRequest") - proto.RegisterType((*QueryBindingResponse)(nil), "irismod.service.QueryBindingResponse") - proto.RegisterType((*QueryBindingsRequest)(nil), "irismod.service.QueryBindingsRequest") - proto.RegisterType((*QueryBindingsResponse)(nil), "irismod.service.QueryBindingsResponse") - proto.RegisterType((*QueryWithdrawAddressRequest)(nil), "irismod.service.QueryWithdrawAddressRequest") - proto.RegisterType((*QueryWithdrawAddressResponse)(nil), "irismod.service.QueryWithdrawAddressResponse") - proto.RegisterType((*QueryRequestContextRequest)(nil), "irismod.service.QueryRequestContextRequest") - proto.RegisterType((*QueryRequestContextResponse)(nil), "irismod.service.QueryRequestContextResponse") - proto.RegisterType((*QueryRequestRequest)(nil), "irismod.service.QueryRequestRequest") - proto.RegisterType((*QueryRequestResponse)(nil), "irismod.service.QueryRequestResponse") - proto.RegisterType((*QueryRequestsRequest)(nil), "irismod.service.QueryRequestsRequest") - proto.RegisterType((*QueryRequestsResponse)(nil), "irismod.service.QueryRequestsResponse") - proto.RegisterType((*QueryRequestsByReqCtxRequest)(nil), "irismod.service.QueryRequestsByReqCtxRequest") - proto.RegisterType((*QueryRequestsByReqCtxResponse)(nil), "irismod.service.QueryRequestsByReqCtxResponse") - proto.RegisterType((*QueryResponseRequest)(nil), "irismod.service.QueryResponseRequest") - proto.RegisterType((*QueryResponseResponse)(nil), "irismod.service.QueryResponseResponse") - proto.RegisterType((*QueryResponsesRequest)(nil), "irismod.service.QueryResponsesRequest") - proto.RegisterType((*QueryResponsesResponse)(nil), "irismod.service.QueryResponsesResponse") - proto.RegisterType((*QueryEarnedFeesRequest)(nil), "irismod.service.QueryEarnedFeesRequest") - proto.RegisterType((*QueryEarnedFeesResponse)(nil), "irismod.service.QueryEarnedFeesResponse") - proto.RegisterType((*QuerySchemaRequest)(nil), "irismod.service.QuerySchemaRequest") - proto.RegisterType((*QuerySchemaResponse)(nil), "irismod.service.QuerySchemaResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "irismod.service.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "irismod.service.QueryParamsResponse") -} - -func init() { proto.RegisterFile("service/query.proto", fileDescriptor_d141bb1b35a55f92) } - -var fileDescriptor_d141bb1b35a55f92 = []byte{ - // 1335 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x98, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xc0, 0x33, 0xfd, 0x48, 0x93, 0xd7, 0x52, 0x87, 0x69, 0xda, 0xa6, 0xa6, 0xb5, 0xcb, 0xb4, - 0x34, 0xe9, 0x87, 0x77, 0x9b, 0x2f, 0xbe, 0x2a, 0x01, 0x4d, 0x20, 0x25, 0xa9, 0x54, 0xb5, 0x2e, - 0x12, 0x12, 0x97, 0xb0, 0xf6, 0x4e, 0x9c, 0x85, 0x78, 0xd7, 0xdd, 0x59, 0x27, 0x0d, 0x91, 0x2f, - 0x20, 0x81, 0x80, 0x0b, 0x52, 0xa1, 0x48, 0x48, 0x70, 0x41, 0x48, 0x08, 0x21, 0x0e, 0xdc, 0xfa, - 0x1f, 0xf4, 0x58, 0x89, 0x0b, 0xa7, 0x82, 0x12, 0xfe, 0x02, 0xfe, 0x02, 0xb4, 0xb3, 0x6f, 0xd6, - 0xfb, 0xe1, 0xb5, 0x5d, 0x94, 0x03, 0x9c, 0xbc, 0x3b, 0xf3, 0x3e, 0x7e, 0xef, 0xcd, 0x9b, 0x7d, - 0x4f, 0x86, 0x23, 0x82, 0xbb, 0xeb, 0x56, 0x95, 0xeb, 0x77, 0x9a, 0xdc, 0xdd, 0xd4, 0x1a, 0xae, - 0xe3, 0x39, 0x34, 0x67, 0xb9, 0x96, 0xa8, 0x3b, 0xa6, 0x86, 0x9b, 0xf9, 0x42, 0xd5, 0x11, 0x75, - 0x47, 0xe8, 0x15, 0x43, 0x70, 0x7d, 0x7d, 0xb2, 0xc2, 0x3d, 0x63, 0x52, 0xaf, 0x3a, 0x96, 0x1d, - 0x28, 0xe4, 0x2f, 0x44, 0xf7, 0xa5, 0xa5, 0x50, 0xaa, 0x61, 0xd4, 0x2c, 0xdb, 0xf0, 0x2c, 0x47, - 0xc9, 0x8e, 0xd6, 0x9c, 0x9a, 0x23, 0x1f, 0x75, 0xff, 0x09, 0x57, 0x4f, 0xd6, 0x1c, 0xa7, 0xb6, - 0xc6, 0x75, 0xa3, 0x61, 0xe9, 0x86, 0x6d, 0x3b, 0x9e, 0x54, 0x11, 0xb8, 0x7b, 0x54, 0x51, 0xe2, - 0x6f, 0xb0, 0xcc, 0xae, 0xc0, 0xb1, 0x5b, 0xbe, 0xb3, 0xd7, 0xf9, 0x8a, 0x65, 0x5b, 0xbe, 0x42, - 0x99, 0xdf, 0x69, 0x72, 0xe1, 0xd1, 0x67, 0xe1, 0x10, 0x8a, 0x2e, 0xdb, 0x46, 0x9d, 0x8f, 0x91, - 0xd3, 0x64, 0x62, 0xb8, 0x7c, 0x10, 0xd7, 0x6e, 0x18, 0x75, 0xce, 0xd6, 0xe0, 0x78, 0x4a, 0x59, - 0x34, 0x1c, 0x5b, 0x70, 0x7a, 0x0b, 0xa8, 0xd2, 0x36, 0xc3, 0x5d, 0x69, 0xe3, 0xe0, 0x14, 0xd3, - 0x12, 0xc9, 0xd1, 0x6e, 0x07, 0xbf, 0x11, 0x3b, 0x4f, 0x8b, 0xe4, 0x12, 0x7b, 0x0b, 0x8e, 0x48, - 0x6f, 0x73, 0x96, 0x6d, 0x5a, 0x76, 0xad, 0x7f, 0x4e, 0x9a, 0x87, 0xa1, 0x86, 0xeb, 0xac, 0x5b, - 0x26, 0x77, 0xc7, 0xf6, 0xc8, 0xed, 0xf0, 0x9d, 0xbd, 0x0b, 0xa3, 0x71, 0xab, 0x18, 0xc0, 0x9b, - 0x90, 0x53, 0x66, 0x2b, 0xc1, 0x16, 0xd2, 0x17, 0xb3, 0xe8, 0x95, 0x85, 0xc3, 0x22, 0xf6, 0xce, - 0xbe, 0x26, 0x71, 0x17, 0xe2, 0x09, 0xc8, 0x47, 0x61, 0xbf, 0xb3, 0x61, 0x87, 0xd8, 0xc1, 0x0b, - 0x5d, 0x00, 0x68, 0xd7, 0xc4, 0xd8, 0x5e, 0x89, 0x75, 0x4e, 0x0b, 0x0a, 0x48, 0xf3, 0x0b, 0x48, - 0x0b, 0x4a, 0x11, 0x0b, 0x48, 0xbb, 0x69, 0xd4, 0x38, 0x3a, 0x2d, 0x47, 0x34, 0xd9, 0xcf, 0x04, - 0x8e, 0x26, 0xc8, 0x30, 0xfa, 0x25, 0x18, 0x49, 0x44, 0x2f, 0xc6, 0xc8, 0xe9, 0xbd, 0xfd, 0x84, - 0x9f, 0x8b, 0x87, 0x2f, 0xe8, 0xb5, 0x18, 0xed, 0x1e, 0x49, 0x3b, 0xde, 0x93, 0x36, 0x00, 0x89, - 0xe1, 0x4e, 0xc3, 0x33, 0x92, 0xf6, 0x6d, 0xcb, 0x5b, 0x35, 0x5d, 0x63, 0xe3, 0xaa, 0x69, 0xba, - 0x5c, 0x84, 0xe9, 0x0c, 0x73, 0x45, 0x22, 0xb9, 0x62, 0x8b, 0x70, 0xb2, 0xb3, 0x12, 0x46, 0x7a, - 0x1e, 0x46, 0x36, 0x70, 0x6b, 0xd9, 0x08, 0xf6, 0xd0, 0x40, 0x6e, 0x23, 0xae, 0xc2, 0x96, 0x20, - 0x2f, 0x4d, 0xa1, 0xc3, 0x79, 0xc7, 0xf6, 0xf8, 0x5d, 0x4f, 0xb9, 0xbf, 0x04, 0xd4, 0x0d, 0x1e, - 0x97, 0xab, 0xc1, 0xce, 0xb2, 0x65, 0xa2, 0xa9, 0x11, 0x37, 0xa6, 0xb2, 0x68, 0xb2, 0x1a, 0xc6, - 0x92, 0xb4, 0xd5, 0xae, 0xbe, 0x84, 0xb1, 0xcc, 0xea, 0x4b, 0x58, 0x38, 0x1c, 0x77, 0xc5, 0x66, - 0xf0, 0xd6, 0xa8, 0xf3, 0x47, 0xda, 0x53, 0x00, 0xca, 0x41, 0x48, 0x39, 0x8c, 0x2b, 0x8b, 0x26, - 0x5b, 0xc2, 0x92, 0x0d, 0xb5, 0x90, 0x6b, 0x0a, 0x0e, 0xa0, 0x10, 0xf2, 0x8c, 0x65, 0xf1, 0x94, - 0x95, 0x20, 0xfb, 0x96, 0xc4, 0x8d, 0x89, 0xdd, 0xb9, 0xb9, 0xbb, 0x76, 0x0b, 0xee, 0xab, 0x5b, - 0xd0, 0xe6, 0xc3, 0x68, 0x67, 0x60, 0x08, 0x83, 0x50, 0xd5, 0x9f, 0x1d, 0x6e, 0x28, 0xb9, 0x7b, - 0xf5, 0xfe, 0x80, 0x60, 0xed, 0x2a, 0xb0, 0x39, 0xff, 0x69, 0xde, 0xbb, 0xfb, 0xaf, 0x4a, 0x8e, - 0x9e, 0x81, 0xa7, 0x2a, 0x86, 0x57, 0x5d, 0x5d, 0xae, 0x3a, 0x4d, 0xdb, 0xc3, 0x84, 0xee, 0x2b, - 0x1f, 0x92, 0x8b, 0xf3, 0xc1, 0xda, 0xae, 0x25, 0xf5, 0x3b, 0x02, 0xa7, 0x32, 0xd8, 0xff, 0x1b, - 0xc9, 0x9d, 0x0d, 0x8b, 0x12, 0x37, 0xfb, 0xbb, 0x18, 0x37, 0xc2, 0x5a, 0x51, 0x6a, 0x18, 0xce, - 0xac, 0x1f, 0x4e, 0xf0, 0x8c, 0x57, 0xe3, 0x44, 0x87, 0x70, 0x50, 0x29, 0x14, 0x65, 0xbf, 0x92, - 0x84, 0x41, 0xf1, 0x3f, 0x38, 0xdc, 0x6f, 0x08, 0x4e, 0x0d, 0x11, 0x68, 0x4c, 0xc3, 0x0b, 0x30, - 0xac, 0x62, 0x53, 0xc7, 0xda, 0x25, 0x0f, 0x6d, 0xd9, 0xdd, 0x3b, 0xd8, 0x19, 0x64, 0x7b, 0xc3, - 0x70, 0x6d, 0x6e, 0x2e, 0xf0, 0x76, 0x46, 0xa3, 0x1f, 0x13, 0x92, 0x18, 0x03, 0xbe, 0x22, 0x38, - 0xcb, 0x44, 0xd5, 0x30, 0xa6, 0x0f, 0x60, 0xdf, 0x0a, 0x8f, 0x84, 0x13, 0x85, 0x52, 0x38, 0xf3, - 0x8e, 0x65, 0xcf, 0x5d, 0x7f, 0xf8, 0xb8, 0x38, 0xf0, 0xf7, 0xe3, 0x22, 0xdd, 0x34, 0xea, 0x6b, - 0x2f, 0x33, 0xf5, 0x71, 0x5b, 0xe1, 0x9c, 0xfd, 0xf4, 0x47, 0xb1, 0x54, 0xb3, 0xbc, 0xd5, 0x66, - 0x45, 0xab, 0x3a, 0x75, 0xbd, 0x62, 0x19, 0xf6, 0x7b, 0x16, 0x37, 0x2c, 0xdd, 0x72, 0x2d, 0xcf, - 0x28, 0x09, 0xf3, 0xfd, 0x52, 0xcd, 0xd1, 0xbd, 0xcd, 0x06, 0x17, 0xd2, 0x96, 0x28, 0x4b, 0x9f, - 0x6c, 0x16, 0xa8, 0xc4, 0xba, 0x5d, 0x5d, 0xe5, 0x75, 0x43, 0x45, 0x52, 0x84, 0x83, 0x42, 0x2e, - 0x44, 0x3f, 0x9c, 0x10, 0x2c, 0xc9, 0xc9, 0xac, 0x84, 0x5f, 0x7d, 0xa5, 0x86, 0x91, 0x1c, 0x83, - 0xc1, 0x40, 0x08, 0x55, 0xf0, 0x8d, 0x8d, 0xa2, 0x97, 0x9b, 0x86, 0x6b, 0xd4, 0x55, 0xbe, 0xd8, - 0x27, 0x04, 0xad, 0xa8, 0xe5, 0xb0, 0xd4, 0x07, 0x1b, 0x72, 0x05, 0x0b, 0xfd, 0x78, 0xea, 0x80, - 0x03, 0x85, 0xb9, 0x7d, 0x7e, 0x3e, 0xca, 0x28, 0x4c, 0x5f, 0x82, 0xbd, 0x2e, 0x17, 0x4f, 0x7a, - 0xb4, 0xbe, 0xce, 0xd4, 0x2f, 0x39, 0xd8, 0x2f, 0x49, 0xe8, 0x97, 0x04, 0xa0, 0x3d, 0x13, 0xd2, - 0xf1, 0x94, 0xeb, 0xce, 0xd3, 0x6c, 0x7e, 0xa2, 0xb7, 0x20, 0xde, 0xc8, 0xe9, 0x0f, 0x7f, 0xfb, - 0xeb, 0xde, 0x9e, 0x12, 0xbd, 0xa8, 0xa3, 0x86, 0x9a, 0x98, 0xf5, 0xf6, 0x20, 0x2b, 0xf4, 0xad, - 0x68, 0xe7, 0x6a, 0xd1, 0x7b, 0x04, 0x0e, 0xe0, 0xc0, 0x43, 0xcf, 0x76, 0x76, 0x15, 0x1f, 0x5b, - 0xf3, 0xcf, 0xf5, 0x90, 0x42, 0x9a, 0x2b, 0x92, 0x66, 0x96, 0x4e, 0xa7, 0x68, 0xd4, 0x5c, 0x96, - 0x40, 0xd1, 0xb7, 0x54, 0x4d, 0xb7, 0xe8, 0xe7, 0x04, 0x86, 0xc2, 0x31, 0xac, 0xbb, 0x43, 0x75, - 0xe8, 0xf9, 0x73, 0xbd, 0xc4, 0x10, 0xec, 0xb2, 0x04, 0xbb, 0x40, 0x27, 0xfa, 0x05, 0xa3, 0x3f, - 0x12, 0xc8, 0x25, 0xa6, 0x30, 0x7a, 0xa9, 0xb3, 0xb7, 0xce, 0x13, 0x5e, 0xbe, 0xd4, 0xa7, 0x34, - 0x22, 0xbe, 0x28, 0x11, 0xa7, 0xe8, 0xe5, 0x14, 0xa2, 0x1c, 0x0d, 0x85, 0xbe, 0x25, 0x7f, 0x5b, - 0xba, 0x1a, 0xf4, 0x4a, 0x38, 0x00, 0xd2, 0xef, 0x09, 0x1c, 0x8e, 0xcf, 0x55, 0xf4, 0x62, 0x67, - 0xdf, 0x1d, 0x67, 0xc1, 0xfc, 0xa5, 0xfe, 0x84, 0x91, 0xf3, 0x79, 0xc9, 0x79, 0x99, 0x6a, 0x29, - 0x4e, 0xfc, 0xf0, 0x0b, 0x7d, 0x2b, 0xdd, 0x0a, 0x5a, 0xf4, 0x63, 0x02, 0x07, 0xd4, 0x17, 0xe1, - 0x6c, 0x57, 0x8f, 0x3d, 0x8a, 0x2e, 0x31, 0xe5, 0x31, 0x4d, 0x02, 0x4d, 0xd0, 0x73, 0x29, 0x20, - 0xd5, 0x87, 0xdb, 0x40, 0x3e, 0xc8, 0x7d, 0x02, 0x43, 0xaa, 0xcf, 0xd3, 0xee, 0x3e, 0x7a, 0xd5, - 0x59, 0x72, 0x06, 0xeb, 0x72, 0x01, 0xda, 0x2c, 0x99, 0x17, 0xe0, 0x01, 0x81, 0x91, 0xe4, 0x00, - 0x42, 0x4b, 0xdd, 0x3d, 0x27, 0x86, 0xac, 0xbc, 0xd6, 0xaf, 0x38, 0x02, 0x2f, 0x48, 0xe0, 0xd7, - 0xe8, 0x2b, 0x7d, 0x24, 0x2f, 0x72, 0x9a, 0xfa, 0x56, 0xac, 0x7f, 0xb7, 0xe8, 0x67, 0x32, 0xa9, - 0xf8, 0xc9, 0xcd, 0x4c, 0x6a, 0x6c, 0x78, 0xc9, 0x4e, 0x6a, 0x7c, 0x58, 0x61, 0xba, 0x64, 0x3c, - 0x4f, 0xc7, 0x3b, 0x30, 0x62, 0x43, 0x8e, 0x9f, 0xf0, 0x0f, 0x04, 0x86, 0xc3, 0x66, 0x4f, 0x7b, - 0xb8, 0x09, 0xcf, 0x78, 0xbc, 0xa7, 0x1c, 0xf2, 0x5c, 0x93, 0x3c, 0x57, 0xe9, 0xab, 0xfd, 0xf0, - 0x74, 0x4b, 0xda, 0xa7, 0x04, 0xa0, 0xdd, 0xc1, 0xb3, 0xda, 0x43, 0x6a, 0x34, 0xc8, 0x6a, 0x0f, - 0xe9, 0x61, 0x80, 0x4d, 0x48, 0x54, 0x46, 0x4f, 0xa7, 0x50, 0xfd, 0x7e, 0x1d, 0x2d, 0xbe, 0x8f, - 0x08, 0x0c, 0x06, 0xfd, 0x97, 0x9e, 0xe9, 0x6c, 0x3e, 0xd6, 0xd4, 0xf3, 0x67, 0xbb, 0x0b, 0xf5, - 0xbc, 0x9b, 0x41, 0x2f, 0xf7, 0xaf, 0x43, 0x7b, 0x34, 0x68, 0x51, 0x0f, 0x06, 0x83, 0x6e, 0x9c, - 0x05, 0x11, 0xeb, 0xf9, 0x59, 0x10, 0xf1, 0x09, 0x80, 0x15, 0x25, 0xc4, 0x09, 0x7a, 0x3c, 0x05, - 0x11, 0xf4, 0xfa, 0xb9, 0xeb, 0x0f, 0xb7, 0x0b, 0xe4, 0xd1, 0x76, 0x81, 0xfc, 0xb9, 0x5d, 0x20, - 0x5f, 0xec, 0x14, 0x06, 0x1e, 0xed, 0x14, 0x06, 0x7e, 0xdf, 0x29, 0x0c, 0xbc, 0x33, 0x19, 0x99, - 0x82, 0x7c, 0x65, 0x9b, 0x7b, 0xf2, 0x77, 0xb5, 0x59, 0x51, 0x53, 0x50, 0xdd, 0x31, 0x9b, 0x6b, - 0x5c, 0x28, 0x9b, 0x95, 0x41, 0xf9, 0x57, 0xd5, 0xf4, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd2, - 0xf4, 0x83, 0x94, 0x69, 0x13, 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 { - // Definition returns service definition - Definition(ctx context.Context, in *QueryDefinitionRequest, opts ...grpc.CallOption) (*QueryDefinitionResponse, error) - // Binding returns service Binding with service name and provider - Binding(ctx context.Context, in *QueryBindingRequest, opts ...grpc.CallOption) (*QueryBindingResponse, error) - // Bindings returns all service Bindings with service name and owner - Bindings(ctx context.Context, in *QueryBindingsRequest, opts ...grpc.CallOption) (*QueryBindingsResponse, error) - // WithdrawAddress returns the withdraw address of the binding owner - WithdrawAddress(ctx context.Context, in *QueryWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryWithdrawAddressResponse, error) - // RequestContext returns the request context - RequestContext(ctx context.Context, in *QueryRequestContextRequest, opts ...grpc.CallOption) (*QueryRequestContextResponse, error) - // Request returns the request - Request(ctx context.Context, in *QueryRequestRequest, opts ...grpc.CallOption) (*QueryRequestResponse, error) - // Request returns all requests of one service with provider - Requests(ctx context.Context, in *QueryRequestsRequest, opts ...grpc.CallOption) (*QueryRequestsResponse, error) - // RequestsByReqCtx returns all requests of one service call batch - RequestsByReqCtx(ctx context.Context, in *QueryRequestsByReqCtxRequest, opts ...grpc.CallOption) (*QueryRequestsByReqCtxResponse, error) - // Response returns the response of request - Response(ctx context.Context, in *QueryResponseRequest, opts ...grpc.CallOption) (*QueryResponseResponse, error) - // Responses returns all responses of one service call batch - Responses(ctx context.Context, in *QueryResponsesRequest, opts ...grpc.CallOption) (*QueryResponsesResponse, error) - // EarnedFees returns the earned service fee of one provider - EarnedFees(ctx context.Context, in *QueryEarnedFeesRequest, opts ...grpc.CallOption) (*QueryEarnedFeesResponse, error) - // Schema returns the schema - Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) - // Params queries the service parameters - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Definition(ctx context.Context, in *QueryDefinitionRequest, opts ...grpc.CallOption) (*QueryDefinitionResponse, error) { - out := new(QueryDefinitionResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Definition", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Binding(ctx context.Context, in *QueryBindingRequest, opts ...grpc.CallOption) (*QueryBindingResponse, error) { - out := new(QueryBindingResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Binding", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Bindings(ctx context.Context, in *QueryBindingsRequest, opts ...grpc.CallOption) (*QueryBindingsResponse, error) { - out := new(QueryBindingsResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Bindings", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) WithdrawAddress(ctx context.Context, in *QueryWithdrawAddressRequest, opts ...grpc.CallOption) (*QueryWithdrawAddressResponse, error) { - out := new(QueryWithdrawAddressResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/WithdrawAddress", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) RequestContext(ctx context.Context, in *QueryRequestContextRequest, opts ...grpc.CallOption) (*QueryRequestContextResponse, error) { - out := new(QueryRequestContextResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/RequestContext", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Request(ctx context.Context, in *QueryRequestRequest, opts ...grpc.CallOption) (*QueryRequestResponse, error) { - out := new(QueryRequestResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Request", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Requests(ctx context.Context, in *QueryRequestsRequest, opts ...grpc.CallOption) (*QueryRequestsResponse, error) { - out := new(QueryRequestsResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Requests", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) RequestsByReqCtx(ctx context.Context, in *QueryRequestsByReqCtxRequest, opts ...grpc.CallOption) (*QueryRequestsByReqCtxResponse, error) { - out := new(QueryRequestsByReqCtxResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/RequestsByReqCtx", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Response(ctx context.Context, in *QueryResponseRequest, opts ...grpc.CallOption) (*QueryResponseResponse, error) { - out := new(QueryResponseResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Response", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Responses(ctx context.Context, in *QueryResponsesRequest, opts ...grpc.CallOption) (*QueryResponsesResponse, error) { - out := new(QueryResponsesResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Responses", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) EarnedFees(ctx context.Context, in *QueryEarnedFeesRequest, opts ...grpc.CallOption) (*QueryEarnedFeesResponse, error) { - out := new(QueryEarnedFeesResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/EarnedFees", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) { - out := new(QuerySchemaResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Schema", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/irismod.service.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Definition returns service definition - Definition(context.Context, *QueryDefinitionRequest) (*QueryDefinitionResponse, error) - // Binding returns service Binding with service name and provider - Binding(context.Context, *QueryBindingRequest) (*QueryBindingResponse, error) - // Bindings returns all service Bindings with service name and owner - Bindings(context.Context, *QueryBindingsRequest) (*QueryBindingsResponse, error) - // WithdrawAddress returns the withdraw address of the binding owner - WithdrawAddress(context.Context, *QueryWithdrawAddressRequest) (*QueryWithdrawAddressResponse, error) - // RequestContext returns the request context - RequestContext(context.Context, *QueryRequestContextRequest) (*QueryRequestContextResponse, error) - // Request returns the request - Request(context.Context, *QueryRequestRequest) (*QueryRequestResponse, error) - // Request returns all requests of one service with provider - Requests(context.Context, *QueryRequestsRequest) (*QueryRequestsResponse, error) - // RequestsByReqCtx returns all requests of one service call batch - RequestsByReqCtx(context.Context, *QueryRequestsByReqCtxRequest) (*QueryRequestsByReqCtxResponse, error) - // Response returns the response of request - Response(context.Context, *QueryResponseRequest) (*QueryResponseResponse, error) - // Responses returns all responses of one service call batch - Responses(context.Context, *QueryResponsesRequest) (*QueryResponsesResponse, error) - // EarnedFees returns the earned service fee of one provider - EarnedFees(context.Context, *QueryEarnedFeesRequest) (*QueryEarnedFeesResponse, error) - // Schema returns the schema - Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) - // Params queries the service parameters - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Definition(ctx context.Context, req *QueryDefinitionRequest) (*QueryDefinitionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Definition not implemented") -} -func (*UnimplementedQueryServer) Binding(ctx context.Context, req *QueryBindingRequest) (*QueryBindingResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Binding not implemented") -} -func (*UnimplementedQueryServer) Bindings(ctx context.Context, req *QueryBindingsRequest) (*QueryBindingsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Bindings not implemented") -} -func (*UnimplementedQueryServer) WithdrawAddress(ctx context.Context, req *QueryWithdrawAddressRequest) (*QueryWithdrawAddressResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawAddress not implemented") -} -func (*UnimplementedQueryServer) RequestContext(ctx context.Context, req *QueryRequestContextRequest) (*QueryRequestContextResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RequestContext not implemented") -} -func (*UnimplementedQueryServer) Request(ctx context.Context, req *QueryRequestRequest) (*QueryRequestResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Request not implemented") -} -func (*UnimplementedQueryServer) Requests(ctx context.Context, req *QueryRequestsRequest) (*QueryRequestsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Requests not implemented") -} -func (*UnimplementedQueryServer) RequestsByReqCtx(ctx context.Context, req *QueryRequestsByReqCtxRequest) (*QueryRequestsByReqCtxResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RequestsByReqCtx not implemented") -} -func (*UnimplementedQueryServer) Response(ctx context.Context, req *QueryResponseRequest) (*QueryResponseResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Response not implemented") -} -func (*UnimplementedQueryServer) Responses(ctx context.Context, req *QueryResponsesRequest) (*QueryResponsesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Responses not implemented") -} -func (*UnimplementedQueryServer) EarnedFees(ctx context.Context, req *QueryEarnedFeesRequest) (*QueryEarnedFeesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EarnedFees not implemented") -} -func (*UnimplementedQueryServer) Schema(ctx context.Context, req *QuerySchemaRequest) (*QuerySchemaResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Definition_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDefinitionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Definition(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Definition", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Definition(ctx, req.(*QueryDefinitionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Binding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBindingRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Binding(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Binding", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Binding(ctx, req.(*QueryBindingRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Bindings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBindingsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Bindings(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Bindings", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Bindings(ctx, req.(*QueryBindingsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_WithdrawAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryWithdrawAddressRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).WithdrawAddress(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/WithdrawAddress", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).WithdrawAddress(ctx, req.(*QueryWithdrawAddressRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_RequestContext_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRequestContextRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RequestContext(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/RequestContext", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RequestContext(ctx, req.(*QueryRequestContextRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Request_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRequestRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Request(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Request", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Request(ctx, req.(*QueryRequestRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Requests_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRequestsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Requests(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Requests", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Requests(ctx, req.(*QueryRequestsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_RequestsByReqCtx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRequestsByReqCtxRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RequestsByReqCtx(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/RequestsByReqCtx", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RequestsByReqCtx(ctx, req.(*QueryRequestsByReqCtxRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Response_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryResponseRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Response(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Response", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Response(ctx, req.(*QueryResponseRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Responses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryResponsesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Responses(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Responses", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Responses(ctx, req.(*QueryResponsesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_EarnedFees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryEarnedFeesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).EarnedFees(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/EarnedFees", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).EarnedFees(ctx, req.(*QueryEarnedFeesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Schema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySchemaRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Schema(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.service.Query/Schema", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Schema(ctx, req.(*QuerySchemaRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/irismod.service.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.service.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Definition", - Handler: _Query_Definition_Handler, - }, - { - MethodName: "Binding", - Handler: _Query_Binding_Handler, - }, - { - MethodName: "Bindings", - Handler: _Query_Bindings_Handler, - }, - { - MethodName: "WithdrawAddress", - Handler: _Query_WithdrawAddress_Handler, - }, - { - MethodName: "RequestContext", - Handler: _Query_RequestContext_Handler, - }, - { - MethodName: "Request", - Handler: _Query_Request_Handler, - }, - { - MethodName: "Requests", - Handler: _Query_Requests_Handler, - }, - { - MethodName: "RequestsByReqCtx", - Handler: _Query_RequestsByReqCtx_Handler, - }, - { - MethodName: "Response", - Handler: _Query_Response_Handler, - }, - { - MethodName: "Responses", - Handler: _Query_Responses_Handler, - }, - { - MethodName: "EarnedFees", - Handler: _Query_EarnedFees_Handler, - }, - { - MethodName: "Schema", - Handler: _Query_Schema_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "service/query.proto", -} - -func (m *QueryDefinitionRequest) 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 *QueryDefinitionRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDefinitionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDefinitionResponse) 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 *QueryDefinitionResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDefinitionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ServiceDefinition != nil { - { - size, err := m.ServiceDefinition.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 *QueryBindingRequest) 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 *QueryBindingRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBindingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryBindingResponse) 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 *QueryBindingResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBindingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ServiceBinding != nil { - { - size, err := m.ServiceBinding.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 *QueryBindingsRequest) 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 *QueryBindingsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBindingsRequest) 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] = 0x1a - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryBindingsResponse) 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 *QueryBindingsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBindingsResponse) 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.ServiceBindings) > 0 { - for iNdEx := len(m.ServiceBindings) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceBindings[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 *QueryWithdrawAddressRequest) 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 *QueryWithdrawAddressRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryWithdrawAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryWithdrawAddressResponse) 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 *QueryWithdrawAddressResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryWithdrawAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.WithdrawAddress) > 0 { - i -= len(m.WithdrawAddress) - copy(dAtA[i:], m.WithdrawAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.WithdrawAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRequestContextRequest) 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 *QueryRequestContextRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestContextRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRequestContextResponse) 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 *QueryRequestContextResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestContextResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RequestContext != nil { - { - size, err := m.RequestContext.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 *QueryRequestRequest) 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 *QueryRequestRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestRequest) 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 *QueryRequestResponse) 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 *QueryRequestResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Request != nil { - { - 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 *QueryRequestsRequest) 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 *QueryRequestsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestsRequest) 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] = 0x1a - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRequestsResponse) 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 *QueryRequestsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestsResponse) 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 (m *QueryRequestsByReqCtxRequest) 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 *QueryRequestsByReqCtxRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestsByReqCtxRequest) 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] = 0x1a - } - if m.BatchCounter != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BatchCounter)) - i-- - dAtA[i] = 0x10 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRequestsByReqCtxResponse) 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 *QueryRequestsByReqCtxResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRequestsByReqCtxResponse) 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 (m *QueryResponseRequest) 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 *QueryResponseRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryResponseRequest) 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 *QueryResponseResponse) 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 *QueryResponseResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryResponseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Response != nil { - { - size, err := m.Response.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 *QueryResponsesRequest) 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 *QueryResponsesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryResponsesRequest) 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] = 0x1a - } - if m.BatchCounter != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.BatchCounter)) - i-- - dAtA[i] = 0x10 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryResponsesResponse) 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 *QueryResponsesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryResponsesResponse) 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.Responses) > 0 { - for iNdEx := len(m.Responses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Responses[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 *QueryEarnedFeesRequest) 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 *QueryEarnedFeesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryEarnedFeesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryEarnedFeesResponse) 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 *QueryEarnedFeesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryEarnedFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Fees) > 0 { - for iNdEx := len(m.Fees) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Fees[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 *QuerySchemaRequest) 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 *QuerySchemaRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySchemaRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SchemaName) > 0 { - i -= len(m.SchemaName) - copy(dAtA[i:], m.SchemaName) - i = encodeVarintQuery(dAtA, i, uint64(len(m.SchemaName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QuerySchemaResponse) 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 *QuerySchemaResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySchemaResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Schema) > 0 { - i -= len(m.Schema) - copy(dAtA[i:], m.Schema) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Schema))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -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 - if m.Res != nil { - { - size, err := m.Res.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryDefinitionRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDefinitionResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ServiceDefinition != nil { - l = m.ServiceDefinition.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBindingRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBindingResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ServiceBinding != nil { - l = m.ServiceBinding.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBindingsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBindingsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ServiceBindings) > 0 { - for _, e := range m.ServiceBindings { - 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 *QueryWithdrawAddressRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryWithdrawAddressResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.WithdrawAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRequestContextRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRequestContextResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RequestContext != nil { - l = m.RequestContext.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRequestRequest) 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 *QueryRequestResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Request != nil { - l = m.Request.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRequestsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRequestsResponse) 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 (m *QueryRequestsByReqCtxRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.BatchCounter != 0 { - n += 1 + sovQuery(uint64(m.BatchCounter)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRequestsByReqCtxResponse) 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 (m *QueryResponseRequest) 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 *QueryResponseResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Response != nil { - l = m.Response.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryResponsesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.BatchCounter != 0 { - n += 1 + sovQuery(uint64(m.BatchCounter)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryResponsesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Responses) > 0 { - for _, e := range m.Responses { - 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 *QueryEarnedFeesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryEarnedFeesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Fees) > 0 { - for _, e := range m.Fees { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QuerySchemaRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SchemaName) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QuerySchemaResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Schema) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -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)) - if m.Res != nil { - l = m.Res.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 *QueryDefinitionRequest) 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: QueryDefinitionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDefinitionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDefinitionResponse) 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: QueryDefinitionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDefinitionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceDefinition", 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.ServiceDefinition == nil { - m.ServiceDefinition = &ServiceDefinition{} - } - if err := m.ServiceDefinition.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBindingRequest) 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: QueryBindingRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBindingRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBindingResponse) 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: QueryBindingResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBindingResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceBinding", 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.ServiceBinding == nil { - m.ServiceBinding = &ServiceBinding{} - } - if err := m.ServiceBinding.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBindingsRequest) 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: QueryBindingsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBindingsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = 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 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.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryBindingsResponse) 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: QueryBindingsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBindingsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceBindings", 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.ServiceBindings = append(m.ServiceBindings, &ServiceBinding{}) - if err := m.ServiceBindings[len(m.ServiceBindings)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryWithdrawAddressRequest) 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: QueryWithdrawAddressRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryWithdrawAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 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.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryWithdrawAddressResponse) 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: QueryWithdrawAddressResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryWithdrawAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", 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.WithdrawAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestContextRequest) 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: QueryRequestContextRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestContextRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestContextResponse) 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: QueryRequestContextResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestContextResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContext", 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.RequestContext == nil { - m.RequestContext = &RequestContext{} - } - if err := m.RequestContext.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestRequest) 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: QueryRequestRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestRequest: 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestResponse) 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: QueryRequestResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestResponse: 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 m.Request == nil { - m.Request = &Request{} - } - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestsRequest) 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: QueryRequestsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestsResponse) 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: QueryRequestsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestsResponse: 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, &Request{}) - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestsByReqCtxRequest) 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: QueryRequestsByReqCtxRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestsByReqCtxRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchCounter", wireType) - } - m.BatchCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRequestsByReqCtxResponse) 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: QueryRequestsByReqCtxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRequestsByReqCtxResponse: 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, &Request{}) - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryResponseRequest) 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: QueryResponseRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryResponseRequest: 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryResponseResponse) 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: QueryResponseResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryResponseResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Response", 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.Response == nil { - m.Response = &Response{} - } - if err := m.Response.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryResponsesRequest) 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: QueryResponsesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryResponsesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchCounter", wireType) - } - m.BatchCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryResponsesResponse) 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: QueryResponsesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryResponsesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Responses", 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.Responses = append(m.Responses, &Response{}) - if err := m.Responses[len(m.Responses)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryEarnedFeesRequest) 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: QueryEarnedFeesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEarnedFeesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryEarnedFeesResponse) 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: QueryEarnedFeesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEarnedFeesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fees", 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.Fees = append(m.Fees, types.Coin{}) - if err := m.Fees[len(m.Fees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QuerySchemaRequest) 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: QuerySchemaRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchemaRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchemaName", 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.SchemaName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QuerySchemaResponse) 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: QuerySchemaResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySchemaResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", 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.Schema = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -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 { - return ErrInvalidLengthQuery - } - if (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 - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Res", 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.Res == nil { - m.Res = &query.PageResponse{} - } - if err := m.Res.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 { - return ErrInvalidLengthQuery - } - if (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/modules/service/service.go b/modules/service/service.go deleted file mode 100644 index a0cab6db..00000000 --- a/modules/service/service.go +++ /dev/null @@ -1,748 +0,0 @@ -package service - -import ( - "context" - "encoding/json" - "strings" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - "github.com/irisnet/irishub-sdk-go/types/query" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type serviceClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { - return serviceClient{ - BaseClient: bc, - Marshaler: cdc, - } -} - -func (s serviceClient) Name() string { - return ModuleName -} - -func (s serviceClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -//DefineService is responsible for creating a new service definition -func (s serviceClient) DefineService(request DefineServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - author, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - msg := &MsgDefineService{ - Name: request.ServiceName, - Description: request.Description, - Tags: request.Tags, - Author: author.String(), - AuthorDescription: request.AuthorDescription, - Schemas: request.Schemas, - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -//BindService is responsible for binding a new service definition -func (s serviceClient) BindService(request BindServiceRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - var provider = owner.String() - if len(request.Provider) > 0 { - if err := sdk.ValidateAccAddress(request.Provider); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - provider = request.Provider - } - - amt, err := s.ToMinCoin(request.Deposit...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgBindService{ - ServiceName: request.ServiceName, - Provider: provider, - Deposit: amt, - Pricing: request.Pricing, - QoS: request.QoS, - Options: request.Options, - Owner: owner.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -//UpdateServiceBinding updates the specified service binding -func (s serviceClient) UpdateServiceBinding(request UpdateServiceBindingRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - var provider = owner.String() - if len(request.Provider) > 0 { - if err := sdk.ValidateAccAddress(request.Provider); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - provider = request.Provider - } - - amt, err := s.ToMinCoin(request.Deposit...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgUpdateServiceBinding{ - ServiceName: request.ServiceName, - Provider: provider, - Deposit: amt, - Pricing: request.Pricing, - QoS: request.QoS, - Owner: owner.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// DisableServiceBinding disables the specified service binding -func (s serviceClient) DisableServiceBinding(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - var providerAddr = owner.String() - if len(provider) > 0 { - if err := sdk.ValidateAccAddress(provider); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - providerAddr = provider - } - - msg := &MsgDisableServiceBinding{ - ServiceName: serviceName, - Provider: providerAddr, - Owner: owner.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// EnableServiceBinding enables the specified service binding -func (s serviceClient) EnableServiceBinding(serviceName, provider string, deposit sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - var providerAddr = owner.String() - if len(provider) > 0 { - if err := sdk.ValidateAccAddress(provider); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - providerAddr = provider - } - - amt, err := s.ToMinCoin(deposit...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgEnableServiceBinding{ - ServiceName: serviceName, - Provider: providerAddr, - Deposit: amt, - Owner: owner.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -//InvokeService is responsible for invoke a new service and callback `handler` -func (s serviceClient) InvokeService(request InvokeServiceRequest, baseTx sdk.BaseTx) (string, sdk.ResultTx, sdk.Error) { - consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return "", sdk.ResultTx{}, sdk.Wrap(err) - } - - var providers []string - for _, provider := range request.Providers { - if err := sdk.ValidateAccAddress(provider); err != nil { - return "", sdk.ResultTx{}, sdk.Wrap(err) - } - providers = append(providers, provider) - } - - amt, err := s.ToMinCoin(request.ServiceFeeCap...) - if err != nil { - return "", sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgCallService{ - ServiceName: request.ServiceName, - Providers: providers, - Consumer: consumer.String(), - Input: request.Input, - ServiceFeeCap: amt, - Timeout: request.Timeout, - Repeated: request.Repeated, - RepeatedFrequency: request.RepeatedFrequency, - RepeatedTotal: request.RepeatedTotal, - } - - //mode must be set to commit - baseTx.Mode = sdk.Commit - - result, err := s.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return "", sdk.ResultTx{}, sdk.Wrap(err) - } - - reqCtxID, e := result.Events.GetValue(sdk.EventTypeCreateContext, attributeKeyRequestContextID) - if e != nil { - return reqCtxID, result, sdk.Wrap(e) - } - - if request.Callback == nil { - return reqCtxID, result, nil - } - - _, err = s.SubscribeServiceResponse(reqCtxID, request.Callback) - return reqCtxID, result, sdk.Wrap(err) -} - -func (s serviceClient) InvokeServiceResponse(req InvokeServiceResponseRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - provider, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, err - } - - reqId := req.RequestId - _, err = s.QueryServiceRequest(reqId) - if err != nil { - return sdk.ResultTx{}, err - } - - msg := &MsgRespondService{ - RequestId: reqId, - Provider: provider.String(), - Result: req.Result, - Output: req.Output, - } - - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (s serviceClient) SubscribeServiceResponse(reqCtxID string, - callback InvokeCallback) (subscription sdk.Subscription, err sdk.Error) { - if len(reqCtxID) == 0 { - return subscription, sdk.Wrapf("reqCtxID %s should not be empty", reqCtxID) - } - - builder := sdk.NewEventQueryBuilder().AddCondition( - sdk.NewCond(sdk.EventTypeResponseService, attributeKeyRequestContextID).EQ(sdk.EventValue(reqCtxID)), - ) - - return s.SubscribeTx(builder, func(tx sdk.EventDataTx) { - s.Logger().Debug( - "consumer received response transaction sent by provider", - "tx_hash", tx.Hash, - "height", tx.Height, - "reqCtxID", reqCtxID, - ) - for _, msg := range tx.Tx.GetMsgs() { - msg, ok := msg.(*MsgRespondService) - if ok { - reqCtxID2, _, _, _, err := splitRequestID(msg.RequestId) - if err != nil { - s.Logger().Error( - "invalid requestID", - "requestID", msg.RequestId, - "errMsg", err.Error(), - ) - continue - } - if reqCtxID2.String() == strings.ToUpper(reqCtxID) { - callback(reqCtxID, msg.RequestId, msg.Output) - } - } - } - reqCtx, err := s.QueryRequestContext(reqCtxID) - if err != nil || reqCtx.State == RequestContextStateToStringMap[COMPLETED] { - _ = s.Unsubscribe(subscription) - } - }) -} - -// SetWithdrawAddress sets a new withdrawal address for the specified service binding -func (s serviceClient) SetWithdrawAddress(withdrawAddress string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if err := sdk.ValidateAccAddress(withdrawAddress); err != nil { - return sdk.ResultTx{}, sdk.Wrapf("%s invalid address", withdrawAddress) - } - msg := &MsgSetWithdrawAddress{ - Owner: owner.String(), - WithdrawAddress: withdrawAddress, - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// RefundServiceDeposit refunds the deposit from the specified service binding -func (s serviceClient) RefundServiceDeposit(serviceName, provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if err := sdk.ValidateAccAddress(provider); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgRefundServiceDeposit{ - ServiceName: serviceName, - Provider: provider, - Owner: owner.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// StartRequestContext starts the specified request context -func (s serviceClient) StartRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - msg := &MsgStartRequestContext{ - RequestContextId: requestContextID, - Consumer: consumer.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// PauseRequestContext suspends the specified request context -func (s serviceClient) PauseRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - msg := &MsgPauseRequestContext{ - RequestContextId: requestContextID, - Consumer: consumer.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// KillRequestContext terminates the specified request context -func (s serviceClient) KillRequestContext(requestContextID string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - msg := &MsgKillRequestContext{ - RequestContextId: requestContextID, - Consumer: consumer.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// UpdateRequestContext updates the specified request context -func (s serviceClient) UpdateRequestContext(request UpdateRequestContextRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - consumer, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - for _, provider := range request.Providers { - if err := sdk.ValidateAccAddress(provider); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - } - - amt, err := s.ToMinCoin(request.ServiceFeeCap...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgUpdateRequestContext{ - RequestContextId: request.RequestContextID, - Providers: request.Providers, - ServiceFeeCap: amt, - Timeout: request.Timeout, - RepeatedFrequency: request.RepeatedFrequency, - RepeatedTotal: request.RepeatedTotal, - Consumer: consumer.String(), - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// WithdrawEarnedFees withdraws the earned fees to the specified provider -func (s serviceClient) WithdrawEarnedFees(provider string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := s.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - var providerAddr = owner.String() - if len(provider) > 0 { - if err := sdk.ValidateAccAddress(provider); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - providerAddr = provider - } - - msg := &MsgWithdrawEarnedFees{ - Owner: owner.String(), - Provider: providerAddr, - } - return s.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -//SubscribeServiceRequest is responsible for registering a single service handler -func (s serviceClient) SubscribeServiceRequest(serviceName string, - callback RespondCallback, - baseTx sdk.BaseTx) (subscription sdk.Subscription, err sdk.Error) { - provider, e := s.QueryAddress(baseTx.From, baseTx.Password) - if e != nil { - return sdk.Subscription{}, sdk.Wrap(e) - } - - builder := sdk.NewEventQueryBuilder().AddCondition( - sdk.NewCond(eventTypeNewBatchRequestProvider, attributeKeyServiceName).EQ(sdk.EventValue(serviceName)), - ).AddCondition( - sdk.NewCond(eventTypeNewBatchRequestProvider, attributeKeyProvider).EQ(sdk.EventValue(provider.String())), - ) - - return s.SubscribeNewBlock(builder, func(block sdk.EventDataNewBlock) { - msgs := s.GenServiceResponseMsgs(block.ResultEndBlock.Events, serviceName, provider, callback) - if msgs == nil || len(msgs) == 0 { - s.Logger().Error("no message created", - "serviceName", serviceName, - "provider", provider, - ) - } - if _, err = s.SendBatch(msgs, baseTx); err != nil { - s.Logger().Error("provider respond failed", "errMsg", err.Error()) - } - }) -} - -// QueryServiceDefinition return a service definition of the specified name -func (s serviceClient) QueryServiceDefinition(serviceName string) (QueryServiceDefinitionResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryServiceDefinitionResponse{}, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Definition( - context.Background(), - &QueryDefinitionRequest{ServiceName: serviceName}, - ) - if err != nil { - return QueryServiceDefinitionResponse{}, sdk.Wrap(err) - } - - return resp.ServiceDefinition.Convert().(QueryServiceDefinitionResponse), nil -} - -// QueryServiceBinding return the specified service binding -func (s serviceClient) QueryServiceBinding(serviceName string, provider string) (QueryServiceBindingResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryServiceBindingResponse{}, sdk.Wrap(err) - } - - if err := sdk.ValidateAccAddress(provider); err != nil { - return QueryServiceBindingResponse{}, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Binding( - context.Background(), - &QueryBindingRequest{ - ServiceName: serviceName, - Provider: provider, - }, - ) - if err != nil { - return QueryServiceBindingResponse{}, sdk.Wrap(err) - } - - return resp.ServiceBinding.Convert().(QueryServiceBindingResponse), nil -} - -// QueryServiceBindings returns all bindings of the specified service -func (s serviceClient) QueryServiceBindings(serviceName string, pageReq *query.PageRequest) ([]QueryServiceBindingResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Bindings( - context.Background(), - &QueryBindingsRequest{ - ServiceName: serviceName, - Pagination: pageReq, - }, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - - return serviceBindings(resp.ServiceBindings).Convert().([]QueryServiceBindingResponse), nil -} - -// QueryServiceRequest returns the active request of the specified requestID -func (s serviceClient) QueryServiceRequest(requestID string) (QueryServiceRequestResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryServiceRequestResponse{}, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Request( - context.Background(), - &QueryRequestRequest{RequestId: requestID}, - ) - - if err == nil && !resp.Request.Empty() { - return resp.Request.Convert().(QueryServiceRequestResponse), nil - } - - //query service Request by block - request, err := s.queryRequestByTxQuery(requestID) - if err != nil { - return QueryServiceRequestResponse{}, sdk.Wrap(err) - } - - return request.Convert().(QueryServiceRequestResponse), nil -} - -// QueryServiceRequests returns all the active requests of the specified service binding -func (s serviceClient) QueryServiceRequests(serviceName string, provider string, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - if err := sdk.ValidateAccAddress(provider); err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Requests( - context.Background(), - &QueryRequestsRequest{ - ServiceName: serviceName, - Provider: provider, - Pagination: pageReq, - }, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - - return requests(resp.Requests).Convert().([]QueryServiceRequestResponse), nil -} - -// QueryRequestsByReqCtx returns all requests of the specified request context ID and batch counter -func (s serviceClient) QueryRequestsByReqCtx(reqCtxID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceRequestResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).RequestsByReqCtx( - context.Background(), - &QueryRequestsByReqCtxRequest{ - RequestContextId: reqCtxID, - BatchCounter: batchCounter, - Pagination: pageReq, - }, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - - return requests(resp.Requests).Convert().([]QueryServiceRequestResponse), nil -} - -// QueryServiceResponse returns a response with the speicified request ID -func (s serviceClient) QueryServiceResponse(requestID string) (QueryServiceResponseResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryServiceResponseResponse{}, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Response( - context.Background(), - &QueryResponseRequest{RequestId: requestID}, - ) - - if err == nil { - return resp.Response.Convert().(QueryServiceResponseResponse), nil - } - - response, err := s.queryResponseByTxQuery(requestID) - if err != nil { - return QueryServiceResponseResponse{}, sdk.Wrap(nil) - } - - return response.Convert().(QueryServiceResponseResponse), nil -} - -// QueryServiceResponses returns all responses of the specified request context and batch counter -func (s serviceClient) QueryServiceResponses(reqCtxID string, batchCounter uint64, pageReq *query.PageRequest) ([]QueryServiceResponseResponse, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).Responses( - context.Background(), - &QueryResponsesRequest{ - RequestContextId: reqCtxID, - BatchCounter: batchCounter, - Pagination: pageReq, - }, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - - return responses(resp.Responses).Convert().([]QueryServiceResponseResponse), nil -} - -// QueryRequestContext return the specified request context -func (s serviceClient) QueryRequestContext(reqCtxID string) (QueryRequestContextResp, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryRequestContextResp{}, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).RequestContext( - context.Background(), - &QueryRequestContextRequest{RequestContextId: reqCtxID}, - ) - if err == nil && !resp.RequestContext.Empty() { - return resp.RequestContext.Convert().(QueryRequestContextResp), nil - } - - reqCtx, err := s.queryRequestContextByTxQuery(reqCtxID) - if err != nil { - return QueryRequestContextResp{}, sdk.Wrap(err) - } - - return reqCtx.Convert().(QueryRequestContextResp), nil -} - -//QueryFees return the earned fees for a provider -func (s serviceClient) QueryFees(provider string) (sdk.Coins, sdk.Error) { - if err := sdk.ValidateAccAddress(provider); err != nil { - return nil, sdk.Wrap(err) - } - - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return nil, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).EarnedFees( - context.Background(), - &QueryEarnedFeesRequest{Provider: provider}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return res.Fees, nil -} - -func (s serviceClient) QueryParams() (QueryParamsResp, sdk.Error) { - conn, err := s.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Params( - context.Background(), - &QueryParamsRequest{}, - ) - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - - return res.Params.Convert().(QueryParamsResp), nil -} - -func (s serviceClient) GenServiceResponseMsgs(events sdk.StringEvents, serviceName string, - provider sdk.AccAddress, - handler RespondCallback) (msgs []sdk.Msg) { - - var ids []string - for _, e := range events { - if e.Type != eventTypeNewBatchRequestProvider { - continue - } - attributes := sdk.Attributes(e.Attributes) - svcName := attributes.GetValue(attributeKeyServiceName) - prov := attributes.GetValue(attributeKeyProvider) - if svcName == serviceName && prov == provider.String() { - reqIDsStr := attributes.GetValue(attributeKeyRequests) - var idsTemp []string - if err := json.Unmarshal([]byte(reqIDsStr), &idsTemp); err != nil { - s.Logger().Error( - "service request don't exist", - attributeKeyRequestID, reqIDsStr, - attributeKeyServiceName, serviceName, - attributeKeyProvider, provider.String(), - "errMsg", err.Error(), - ) - return - } - ids = append(ids, idsTemp...) - } - } - - for _, reqID := range ids { - request, err := s.QueryServiceRequest(reqID) - if err != nil { - s.Logger().Error( - "service request don't exist", - attributeKeyRequestID, reqID, - attributeKeyServiceName, serviceName, - attributeKeyProvider, provider.String(), - "errMsg", err.Error(), - ) - continue - } - //check again - providerStr := provider.String() - if providerStr == request.Provider && request.ServiceName == serviceName { - output, result := handler(request.RequestContextID, reqID, request.Input) - msgs = append(msgs, &MsgRespondService{ - RequestId: reqID, - Provider: providerStr, - Output: output, - Result: result, - }) - } - } - return msgs -} diff --git a/modules/service/service.pb.go b/modules/service/service.pb.go deleted file mode 100644 index 8d99a64c..00000000 --- a/modules/service/service.pb.go +++ /dev/null @@ -1,4440 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/service.proto - -package service - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" - _ "github.com/golang/protobuf/ptypes/timestamp" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" - strconv "strconv" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// RequestContextBatchState is a type alias that represents a request batch status as a byte -type RequestContextBatchState int32 - -const ( - // BATCH_RUNNING defines the running batch status. - BATCHRUNNING RequestContextBatchState = 0 - // BATCH_COMPLETED defines the completed batch status. - BATCHCOMPLETED RequestContextBatchState = 1 -) - -var RequestContextBatchState_name = map[int32]string{ - 0: "BATCH_RUNNING", - 1: "BATCH_COMPLETED", -} - -var RequestContextBatchState_value = map[string]int32{ - "BATCH_RUNNING": 0, - "BATCH_COMPLETED": 1, -} - -func (RequestContextBatchState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{0} -} - -// RequestContextState is a type alias that represents a request status as a byte -type RequestContextState int32 - -const ( - // RUNNING defines the running request context status. - RUNNING RequestContextState = 0 - // PAUSED defines the paused request context status. - PAUSED RequestContextState = 1 - // COMPLETED defines the completed request context status. - COMPLETED RequestContextState = 2 -) - -var RequestContextState_name = map[int32]string{ - 0: "RUNNING", - 1: "PAUSED", - 2: "COMPLETED", -} - -var RequestContextState_value = map[string]int32{ - "RUNNING": 0, - "PAUSED": 1, - "COMPLETED": 2, -} - -func (RequestContextState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{1} -} - -// ServiceDefinition defines a standard for service definition. -type ServiceDefinition struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Tags []string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty"` - Author string `protobuf:"bytes,4,opt,name=author,proto3" json:"author,omitempty"` - AuthorDescription string `protobuf:"bytes,5,opt,name=author_description,json=authorDescription,proto3" json:"author_description,omitempty" yaml:"author_description"` - Schemas string `protobuf:"bytes,6,opt,name=schemas,proto3" json:"schemas,omitempty"` -} - -func (m *ServiceDefinition) Reset() { *m = ServiceDefinition{} } -func (m *ServiceDefinition) String() string { return proto.CompactTextString(m) } -func (*ServiceDefinition) ProtoMessage() {} -func (*ServiceDefinition) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{0} -} -func (m *ServiceDefinition) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServiceDefinition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ServiceDefinition.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 *ServiceDefinition) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceDefinition.Merge(m, src) -} -func (m *ServiceDefinition) XXX_Size() int { - return m.Size() -} -func (m *ServiceDefinition) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceDefinition.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceDefinition proto.InternalMessageInfo - -// ServiceBinding defines a standard for service binding. -type ServiceBinding struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` - Pricing string `protobuf:"bytes,4,opt,name=pricing,proto3" json:"pricing,omitempty"` - QoS uint64 `protobuf:"varint,5,opt,name=qos,proto3" json:"qos,omitempty"` - Options string `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` - Available bool `protobuf:"varint,7,opt,name=available,proto3" json:"available,omitempty"` - DisabledTime time.Time `protobuf:"bytes,8,opt,name=disabled_time,json=disabledTime,proto3,stdtime" json:"disabled_time" yaml:"disabled_time"` - Owner string `protobuf:"bytes,9,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *ServiceBinding) Reset() { *m = ServiceBinding{} } -func (m *ServiceBinding) String() string { return proto.CompactTextString(m) } -func (*ServiceBinding) ProtoMessage() {} -func (*ServiceBinding) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{1} -} -func (m *ServiceBinding) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ServiceBinding.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 *ServiceBinding) XXX_Merge(src proto.Message) { - xxx_messageInfo_ServiceBinding.Merge(m, src) -} -func (m *ServiceBinding) XXX_Size() int { - return m.Size() -} -func (m *ServiceBinding) XXX_DiscardUnknown() { - xxx_messageInfo_ServiceBinding.DiscardUnknown(m) -} - -var xxx_messageInfo_ServiceBinding proto.InternalMessageInfo - -// RequestContext defines a standard for request context. -type RequestContext struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Providers []string `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"` - Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` - Input string `protobuf:"bytes,4,opt,name=input,proto3" json:"input,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` - ModuleName string `protobuf:"bytes,6,opt,name=module_name,json=moduleName,proto3" json:"module_name,omitempty" yaml:"module_name"` - Timeout int64 `protobuf:"varint,7,opt,name=timeout,proto3" json:"timeout,omitempty"` - Repeated bool `protobuf:"varint,8,opt,name=repeated,proto3" json:"repeated,omitempty"` - RepeatedFrequency uint64 `protobuf:"varint,9,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` - RepeatedTotal int64 `protobuf:"varint,10,opt,name=repeated_total,json=repeatedTotal,proto3" json:"repeated_total,omitempty" yaml:"repeated_total"` - BatchCounter uint64 `protobuf:"varint,11,opt,name=batch_counter,json=batchCounter,proto3" json:"batch_counter,omitempty" yaml:"batch_counter"` - BatchRequestCount uint32 `protobuf:"varint,12,opt,name=batch_request_count,json=batchRequestCount,proto3" json:"batch_request_count,omitempty" yaml:"batch_request_count"` - BatchResponseCount uint32 `protobuf:"varint,13,opt,name=batch_response_count,json=batchResponseCount,proto3" json:"batch_response_count,omitempty" yaml:"batch_response_count"` - BatchResponseThreshold uint32 `protobuf:"varint,14,opt,name=batch_response_threshold,json=batchResponseThreshold,proto3" json:"batch_response_threshold,omitempty" yaml:"batch_response_threshold"` - ResponseThreshold uint32 `protobuf:"varint,15,opt,name=response_threshold,json=responseThreshold,proto3" json:"response_threshold,omitempty" yaml:"response_threshold"` - BatchState RequestContextBatchState `protobuf:"varint,16,opt,name=batch_state,json=batchState,proto3,enum=irismod.service.RequestContextBatchState" json:"batch_state,omitempty" yaml:"batch_state"` - State RequestContextState `protobuf:"varint,17,opt,name=state,proto3,enum=irismod.service.RequestContextState" json:"state,omitempty"` -} - -func (m *RequestContext) Reset() { *m = RequestContext{} } -func (m *RequestContext) String() string { return proto.CompactTextString(m) } -func (*RequestContext) ProtoMessage() {} -func (*RequestContext) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{2} -} -func (m *RequestContext) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestContext.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 *RequestContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestContext.Merge(m, src) -} -func (m *RequestContext) XXX_Size() int { - return m.Size() -} -func (m *RequestContext) XXX_DiscardUnknown() { - xxx_messageInfo_RequestContext.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestContext proto.InternalMessageInfo - -// Request defines a standard for request. -type Request struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Provider string `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` - Consumer string `protobuf:"bytes,4,opt,name=consumer,proto3" json:"consumer,omitempty"` - Input string `protobuf:"bytes,5,opt,name=input,proto3" json:"input,omitempty"` - ServiceFee github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=service_fee,json=serviceFee,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee" yaml:"service_fee"` - RequestHeight int64 `protobuf:"varint,7,opt,name=request_height,json=requestHeight,proto3" json:"request_height,omitempty" yaml:"request_height"` - ExpirationHeight int64 `protobuf:"varint,8,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height,omitempty" yaml:"expiration_height"` - RequestContextId string `protobuf:"bytes,9,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - RequestContextBatchCounter uint64 `protobuf:"varint,10,opt,name=request_context_batch_counter,json=requestContextBatchCounter,proto3" json:"request_context_batch_counter,omitempty" yaml:"request_context_batch_counter"` -} - -func (m *Request) Reset() { *m = Request{} } -func (m *Request) String() string { return proto.CompactTextString(m) } -func (*Request) ProtoMessage() {} -func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{3} -} -func (m *Request) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Request.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 *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(m, src) -} -func (m *Request) XXX_Size() int { - return m.Size() -} -func (m *Request) XXX_DiscardUnknown() { - xxx_messageInfo_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_Request proto.InternalMessageInfo - -// CompactRequest defines a standard for compact request. -type CompactRequest struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - RequestContextBatchCounter uint64 `protobuf:"varint,2,opt,name=request_context_batch_counter,json=requestContextBatchCounter,proto3" json:"request_context_batch_counter,omitempty" yaml:"request_context_batch_counter"` - Provider string `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` - ServiceFee github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,4,rep,name=service_fee,json=serviceFee,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee" yaml:"service_fee"` - RequestHeight int64 `protobuf:"varint,5,opt,name=request_height,json=requestHeight,proto3" json:"request_height,omitempty" yaml:"request_height"` - ExpirationHeight int64 `protobuf:"varint,6,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height,omitempty" yaml:"expiration_height"` -} - -func (m *CompactRequest) Reset() { *m = CompactRequest{} } -func (m *CompactRequest) String() string { return proto.CompactTextString(m) } -func (*CompactRequest) ProtoMessage() {} -func (*CompactRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{4} -} -func (m *CompactRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompactRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompactRequest.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 *CompactRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompactRequest.Merge(m, src) -} -func (m *CompactRequest) XXX_Size() int { - return m.Size() -} -func (m *CompactRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CompactRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CompactRequest proto.InternalMessageInfo - -// Response defines a standard for response. -type Response struct { - Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` - Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` - Result string `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` - Output string `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` - RequestContextId string `protobuf:"bytes,5,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - RequestContextBatchCounter uint64 `protobuf:"varint,6,opt,name=request_context_batch_counter,json=requestContextBatchCounter,proto3" json:"request_context_batch_counter,omitempty" yaml:"request_context_batch_counter"` -} - -func (m *Response) Reset() { *m = Response{} } -func (m *Response) String() string { return proto.CompactTextString(m) } -func (*Response) ProtoMessage() {} -func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{5} -} -func (m *Response) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Response.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 *Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_Response.Merge(m, src) -} -func (m *Response) XXX_Size() int { - return m.Size() -} -func (m *Response) XXX_DiscardUnknown() { - xxx_messageInfo_Response.DiscardUnknown(m) -} - -var xxx_messageInfo_Response proto.InternalMessageInfo - -// Pricing defines a standard for service pricing. -type Pricing struct { - Price github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,6,rep,name=price,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"price"` - PromotionsByTime []PromotionByTime `protobuf:"bytes,2,rep,name=promotions_by_time,json=promotionsByTime,proto3" json:"promotions_by_time" yaml:"promotions_by_time"` - PromotionsByVolume []PromotionByVolume `protobuf:"bytes,3,rep,name=promotions_by_volume,json=promotionsByVolume,proto3" json:"promotions_by_volume" yaml:"promotions_by_volume"` -} - -func (m *Pricing) Reset() { *m = Pricing{} } -func (m *Pricing) String() string { return proto.CompactTextString(m) } -func (*Pricing) ProtoMessage() {} -func (*Pricing) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{6} -} -func (m *Pricing) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pricing) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pricing.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 *Pricing) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pricing.Merge(m, src) -} -func (m *Pricing) XXX_Size() int { - return m.Size() -} -func (m *Pricing) XXX_DiscardUnknown() { - xxx_messageInfo_Pricing.DiscardUnknown(m) -} - -var xxx_messageInfo_Pricing proto.InternalMessageInfo - -// PromotionByTime defines a standard for service promotion by time. -type PromotionByTime struct { - StartTime time.Time `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"start_time"` - EndTime time.Time `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time" yaml:"end_time"` - Discount github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=discount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"discount"` -} - -func (m *PromotionByTime) Reset() { *m = PromotionByTime{} } -func (m *PromotionByTime) String() string { return proto.CompactTextString(m) } -func (*PromotionByTime) ProtoMessage() {} -func (*PromotionByTime) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{7} -} -func (m *PromotionByTime) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PromotionByTime) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PromotionByTime.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 *PromotionByTime) XXX_Merge(src proto.Message) { - xxx_messageInfo_PromotionByTime.Merge(m, src) -} -func (m *PromotionByTime) XXX_Size() int { - return m.Size() -} -func (m *PromotionByTime) XXX_DiscardUnknown() { - xxx_messageInfo_PromotionByTime.DiscardUnknown(m) -} - -var xxx_messageInfo_PromotionByTime proto.InternalMessageInfo - -// PromotionByVolume defines a standard for service promotion by volume. -type PromotionByVolume struct { - Volume uint64 `protobuf:"varint,1,opt,name=volume,proto3" json:"volume,omitempty"` - Discount github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,2,opt,name=discount,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"discount"` -} - -func (m *PromotionByVolume) Reset() { *m = PromotionByVolume{} } -func (m *PromotionByVolume) String() string { return proto.CompactTextString(m) } -func (*PromotionByVolume) ProtoMessage() {} -func (*PromotionByVolume) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{8} -} -func (m *PromotionByVolume) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PromotionByVolume) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PromotionByVolume.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 *PromotionByVolume) XXX_Merge(src proto.Message) { - xxx_messageInfo_PromotionByVolume.Merge(m, src) -} -func (m *PromotionByVolume) XXX_Size() int { - return m.Size() -} -func (m *PromotionByVolume) XXX_DiscardUnknown() { - xxx_messageInfo_PromotionByVolume.DiscardUnknown(m) -} - -var xxx_messageInfo_PromotionByVolume proto.InternalMessageInfo - -// service parameters -type Params struct { - MaxRequestTimeout int64 `protobuf:"varint,1,opt,name=max_request_timeout,json=maxRequestTimeout,proto3" json:"max_request_timeout,omitempty" yaml:"max_request_timeout"` - MinDepositMultiple int64 `protobuf:"varint,2,opt,name=min_deposit_multiple,json=minDepositMultiple,proto3" json:"min_deposit_multiple,omitempty" yaml:"min_deposit_multiple"` - MinDeposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=min_deposit,json=minDeposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"min_deposit"` - ServiceFeeTax github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,4,opt,name=service_fee_tax,json=serviceFeeTax,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"service_fee_tax" yaml:"service_fee_tax"` - SlashFraction github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,5,opt,name=slash_fraction,json=slashFraction,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"slash_fraction" yaml:"slash_fraction"` - ComplaintRetrospect time.Duration `protobuf:"bytes,6,opt,name=complaint_retrospect,json=complaintRetrospect,proto3,stdduration" json:"complaint_retrospect" yaml:"complaint_retrospect"` - ArbitrationTimeLimit time.Duration `protobuf:"bytes,7,opt,name=arbitration_time_limit,json=arbitrationTimeLimit,proto3,stdduration" json:"arbitration_time_limit" yaml:"arbitration_time_limit"` - TxSizeLimit uint64 `protobuf:"varint,8,opt,name=tx_size_limit,json=txSizeLimit,proto3" json:"tx_size_limit,omitempty" yaml:"tx_size_limit"` - BaseDenom string `protobuf:"bytes,9,opt,name=base_denom,json=baseDenom,proto3" json:"base_denom,omitempty" yaml:"base_denom"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_e51e679f9ae460e2, []int{9} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("irismod.service.RequestContextBatchState", RequestContextBatchState_name, RequestContextBatchState_value) - proto.RegisterEnum("irismod.service.RequestContextState", RequestContextState_name, RequestContextState_value) - proto.RegisterType((*ServiceDefinition)(nil), "irismod.service.ServiceDefinition") - proto.RegisterType((*ServiceBinding)(nil), "irismod.service.ServiceBinding") - proto.RegisterType((*RequestContext)(nil), "irismod.service.RequestContext") - proto.RegisterType((*Request)(nil), "irismod.service.Request") - proto.RegisterType((*CompactRequest)(nil), "irismod.service.CompactRequest") - proto.RegisterType((*Response)(nil), "irismod.service.Response") - proto.RegisterType((*Pricing)(nil), "irismod.service.Pricing") - proto.RegisterType((*PromotionByTime)(nil), "irismod.service.PromotionByTime") - proto.RegisterType((*PromotionByVolume)(nil), "irismod.service.PromotionByVolume") - proto.RegisterType((*Params)(nil), "irismod.service.Params") -} - -func init() { proto.RegisterFile("service/service.proto", fileDescriptor_e51e679f9ae460e2) } - -var fileDescriptor_e51e679f9ae460e2 = []byte{ - // 1802 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x6f, 0xdb, 0xc8, - 0x15, 0x17, 0x25, 0x5b, 0x96, 0x47, 0x96, 0x6c, 0x4d, 0x1c, 0x97, 0x51, 0x12, 0x51, 0x65, 0x16, - 0x58, 0xef, 0x16, 0x91, 0x90, 0x6c, 0x8b, 0x02, 0x41, 0x0b, 0x74, 0x69, 0x6f, 0xba, 0xc1, 0x26, - 0x8e, 0x43, 0x7b, 0x8b, 0xa2, 0x40, 0x21, 0x50, 0xe4, 0x58, 0x9a, 0xae, 0xc8, 0x61, 0x38, 0x43, - 0x57, 0x0e, 0x7a, 0x6f, 0xe1, 0x53, 0xd0, 0xd3, 0x5e, 0x0c, 0x2c, 0xd0, 0x3d, 0x14, 0x45, 0x0f, - 0x3d, 0xf7, 0x2f, 0xc8, 0x71, 0x8f, 0x45, 0x81, 0x2a, 0x6d, 0x72, 0xe9, 0x59, 0xe8, 0xad, 0x28, - 0x50, 0xcc, 0x07, 0x25, 0x52, 0x52, 0xe2, 0xad, 0x9b, 0x00, 0x7b, 0xd2, 0xbc, 0xaf, 0xdf, 0xe3, - 0xbc, 0xf7, 0xe6, 0xcd, 0x1b, 0x81, 0xcb, 0x14, 0x45, 0xc7, 0xd8, 0x45, 0x6d, 0xf5, 0xdb, 0x0a, - 0x23, 0xc2, 0x08, 0x5c, 0xc7, 0x11, 0xa6, 0x3e, 0xf1, 0x5a, 0x8a, 0x5d, 0x6f, 0xb8, 0x84, 0xfa, - 0x84, 0xb6, 0xbb, 0x0e, 0x45, 0xed, 0xe3, 0x5b, 0x5d, 0xc4, 0x9c, 0x5b, 0x6d, 0x97, 0xe0, 0x40, - 0x1a, 0xd4, 0x37, 0x7b, 0xa4, 0x47, 0xc4, 0xb2, 0xcd, 0x57, 0x8a, 0xdb, 0xe8, 0x11, 0xd2, 0x1b, - 0xa0, 0xb6, 0xa0, 0xba, 0xf1, 0x51, 0xdb, 0x8b, 0x23, 0x87, 0x61, 0x92, 0x58, 0x19, 0xb3, 0x72, - 0x86, 0x7d, 0x44, 0x99, 0xe3, 0x87, 0x52, 0xc1, 0xfc, 0x9b, 0x06, 0x6a, 0x07, 0xf2, 0x13, 0x76, - 0xd1, 0x11, 0x0e, 0x30, 0x37, 0x86, 0x10, 0x2c, 0x05, 0x8e, 0x8f, 0x74, 0xad, 0xa9, 0x6d, 0xaf, - 0xda, 0x62, 0x0d, 0x9b, 0xa0, 0xec, 0x21, 0xea, 0x46, 0x38, 0xe4, 0x2a, 0x7a, 0x5e, 0x88, 0xd2, - 0x2c, 0x6e, 0xc5, 0x9c, 0x1e, 0xd5, 0x0b, 0xcd, 0x02, 0xb7, 0xe2, 0x6b, 0xb8, 0x05, 0x8a, 0x4e, - 0xcc, 0xfa, 0x24, 0xd2, 0x97, 0x84, 0x81, 0xa2, 0xe0, 0x7d, 0x00, 0xe5, 0xaa, 0x93, 0x06, 0x5d, - 0xe6, 0x3a, 0xd6, 0xf5, 0xf1, 0xc8, 0xb8, 0x72, 0xe2, 0xf8, 0x83, 0x3b, 0xe6, 0xbc, 0x8e, 0x69, - 0xd7, 0x24, 0x73, 0x37, 0xe5, 0x59, 0x07, 0x2b, 0xd4, 0xed, 0x23, 0xdf, 0xa1, 0x7a, 0x51, 0xb8, - 0x49, 0x48, 0xf3, 0xcf, 0x05, 0x50, 0x55, 0xfb, 0xb3, 0x70, 0xe0, 0xe1, 0xa0, 0x07, 0xef, 0x80, - 0x35, 0x15, 0xf4, 0xce, 0x74, 0x93, 0xd6, 0xb7, 0xc6, 0x23, 0xe3, 0x92, 0x74, 0x9a, 0x96, 0x9a, - 0x76, 0x59, 0x91, 0x7b, 0x3c, 0x08, 0x75, 0x50, 0x0a, 0x23, 0x72, 0x8c, 0x3d, 0x14, 0xa9, 0x08, - 0x4c, 0x68, 0xf8, 0x0b, 0xb0, 0xe2, 0xa1, 0x90, 0x50, 0xcc, 0x44, 0x04, 0xca, 0xb7, 0xaf, 0xb4, - 0x64, 0x4e, 0x5b, 0x3c, 0xa7, 0x2d, 0x95, 0xd3, 0xd6, 0x0e, 0xc1, 0x81, 0xf5, 0xbd, 0x67, 0x23, - 0x23, 0xf7, 0x87, 0xe7, 0xc6, 0xcd, 0x1e, 0x66, 0xfd, 0xb8, 0xdb, 0x72, 0x89, 0xdf, 0xe6, 0x15, - 0x11, 0x20, 0x26, 0x7e, 0xfb, 0x71, 0xf7, 0x26, 0xf5, 0x3e, 0xbb, 0xd9, 0x23, 0x6d, 0x76, 0x12, - 0x22, 0x2a, 0xac, 0xa8, 0x9d, 0x38, 0xe0, 0x1b, 0x0e, 0x23, 0xec, 0xe2, 0xa0, 0xa7, 0xe2, 0x9a, - 0x90, 0xf0, 0x0a, 0x28, 0x3c, 0x26, 0x54, 0x44, 0x72, 0xc9, 0x5a, 0x79, 0x31, 0x32, 0x0a, 0x8f, - 0xc8, 0x81, 0xcd, 0x79, 0xdc, 0x88, 0x88, 0x78, 0x4d, 0xa2, 0xa4, 0x48, 0x78, 0x0d, 0xac, 0x3a, - 0xc7, 0x0e, 0x1e, 0x38, 0xdd, 0x01, 0xd2, 0x57, 0x9a, 0xda, 0x76, 0xc9, 0x9e, 0x32, 0xa0, 0x03, - 0x2a, 0x1e, 0xa6, 0x7c, 0xe9, 0x75, 0x78, 0xfd, 0xe8, 0xa5, 0xa6, 0xb6, 0x5d, 0xbe, 0x5d, 0x6f, - 0xc9, 0xe2, 0x6a, 0x25, 0xc5, 0xd5, 0x3a, 0x4c, 0x8a, 0xcb, 0x6a, 0xf2, 0xfd, 0x8d, 0x47, 0xc6, - 0xa6, 0x8c, 0x68, 0xc6, 0xdc, 0x7c, 0xfa, 0xdc, 0xd0, 0xec, 0xb5, 0x84, 0xc7, 0x8d, 0xe0, 0x26, - 0x58, 0x26, 0xbf, 0x0c, 0x50, 0xa4, 0xaf, 0x8a, 0x0f, 0x93, 0x84, 0xf9, 0xbc, 0x04, 0xaa, 0x36, - 0x7a, 0x1c, 0x23, 0xca, 0x76, 0x48, 0xc0, 0xd0, 0x90, 0xfd, 0x5f, 0xc9, 0xbb, 0x06, 0x56, 0x93, - 0x64, 0x51, 0x3d, 0x2f, 0x8a, 0x74, 0xca, 0xe0, 0xa9, 0x75, 0x49, 0x40, 0x63, 0x1f, 0x45, 0x7a, - 0x41, 0xa6, 0x36, 0xa1, 0xf9, 0xe7, 0xe1, 0x20, 0x8c, 0x99, 0x0a, 0xb6, 0x24, 0xe0, 0x6f, 0x35, - 0xb0, 0x9e, 0xb8, 0x3b, 0x42, 0xa8, 0xe3, 0x3a, 0xa1, 0xbe, 0x7c, 0x5e, 0xe6, 0x1f, 0xaa, 0xc8, - 0x6c, 0x65, 0x3f, 0x57, 0xd9, 0x9b, 0xff, 0x7b, 0x4d, 0x54, 0x14, 0xc4, 0x5d, 0x84, 0x76, 0x9c, - 0x10, 0x7e, 0x1f, 0x94, 0x7d, 0xe2, 0xc5, 0x03, 0x15, 0x1f, 0x91, 0x68, 0x6b, 0x6b, 0x3c, 0x32, - 0xa0, 0x74, 0x98, 0x12, 0x9a, 0x36, 0x90, 0x94, 0x88, 0x8e, 0x0e, 0x56, 0x78, 0x76, 0x48, 0xcc, - 0x44, 0x05, 0x14, 0xec, 0x84, 0xe4, 0x91, 0x89, 0x50, 0x88, 0x1c, 0x86, 0x3c, 0x91, 0xfa, 0x92, - 0x3d, 0xa1, 0xf9, 0x39, 0x4e, 0xd6, 0x9d, 0xa3, 0x88, 0xe7, 0x2a, 0x70, 0x4f, 0x44, 0x16, 0x97, - 0xd2, 0xe7, 0x78, 0x5e, 0xc7, 0xb4, 0x6b, 0x09, 0xf3, 0x6e, 0xc2, 0x83, 0x3f, 0x02, 0xd5, 0x89, - 0x26, 0x23, 0xcc, 0x19, 0xe8, 0x80, 0x7f, 0x8a, 0x75, 0x65, 0x3c, 0x32, 0x2e, 0xcf, 0x20, 0x09, - 0xb9, 0x69, 0x57, 0x12, 0xc6, 0x21, 0xa7, 0xe1, 0x0f, 0x41, 0xa5, 0xeb, 0x30, 0xb7, 0xdf, 0x71, - 0x49, 0x1c, 0x30, 0x14, 0xe9, 0x65, 0xf1, 0x29, 0xfa, 0xb4, 0x16, 0x33, 0x62, 0xd3, 0x5e, 0x13, - 0xf4, 0x8e, 0x24, 0xe1, 0x1e, 0xb8, 0x24, 0xe5, 0x91, 0x2c, 0x3b, 0xa9, 0xa7, 0xaf, 0x35, 0xb5, - 0xed, 0x8a, 0xd5, 0x18, 0x8f, 0x8c, 0x7a, 0x1a, 0x24, 0xa3, 0x64, 0xda, 0x35, 0xc1, 0x9d, 0x14, - 0x6c, 0x1c, 0x30, 0xf8, 0x08, 0x6c, 0x26, 0xaa, 0x34, 0x24, 0x01, 0x45, 0x0a, 0xb0, 0x22, 0x00, - 0x8d, 0xf1, 0xc8, 0xb8, 0x9a, 0x05, 0x4c, 0x6b, 0x99, 0x36, 0x54, 0x88, 0x92, 0x2b, 0x21, 0x7f, - 0x0e, 0xf4, 0x19, 0x65, 0xd6, 0x8f, 0x10, 0xed, 0x93, 0x81, 0xa7, 0x57, 0x05, 0xec, 0x8d, 0xf1, - 0xc8, 0x30, 0x16, 0xc2, 0x4e, 0x34, 0x4d, 0x7b, 0x2b, 0x03, 0x7d, 0x98, 0x08, 0x64, 0x42, 0xe7, - 0x80, 0xd7, 0x05, 0x70, 0x26, 0xa1, 0xf3, 0x90, 0xb5, 0x68, 0x0e, 0xad, 0x0b, 0xca, 0xf2, 0x13, - 0x28, 0x73, 0x18, 0xd2, 0x37, 0x9a, 0xda, 0x76, 0xf5, 0xf6, 0x7b, 0xad, 0x99, 0xcb, 0xaf, 0x95, - 0x3d, 0xe4, 0x16, 0xb7, 0x38, 0xe0, 0x06, 0xe9, 0xc2, 0x4d, 0xe1, 0x98, 0x36, 0xe8, 0x4e, 0x74, - 0xe0, 0x1d, 0xb0, 0x2c, 0xd1, 0x6b, 0x02, 0xfd, 0x9d, 0x73, 0xd0, 0x85, 0x91, 0x2d, 0x4d, 0xcc, - 0x7f, 0x2d, 0x81, 0x15, 0x25, 0x86, 0x55, 0x90, 0xc7, 0x9e, 0xba, 0xf2, 0xf2, 0xd8, 0x9b, 0x6b, - 0x35, 0xf9, 0x0b, 0xde, 0x13, 0x85, 0x99, 0x7b, 0x22, 0xdd, 0x68, 0x96, 0x5e, 0xd5, 0x68, 0x96, - 0xd3, 0x8d, 0xe6, 0xd7, 0x1a, 0x28, 0xa7, 0x1a, 0x85, 0x5e, 0x3c, 0xaf, 0xc9, 0x7c, 0xa2, 0x9a, - 0x0c, 0x9c, 0x6b, 0x32, 0x17, 0x68, 0x30, 0x60, 0xda, 0x60, 0xe4, 0x01, 0x95, 0x45, 0xdf, 0x47, - 0xb8, 0xd7, 0x57, 0xbd, 0x22, 0x7b, 0x40, 0xd3, 0x72, 0x71, 0x40, 0x05, 0xe3, 0x63, 0x41, 0xc3, - 0x7b, 0xa0, 0x86, 0x86, 0x21, 0x96, 0x53, 0x4a, 0x02, 0x52, 0x12, 0x20, 0xd7, 0xc6, 0x23, 0x43, - 0x97, 0x20, 0x73, 0x2a, 0xa6, 0xbd, 0x31, 0xe5, 0x29, 0xa8, 0x4f, 0x78, 0xa9, 0x26, 0x27, 0x50, - 0xe4, 0xb6, 0x83, 0x3d, 0x79, 0x83, 0x64, 0x4b, 0x75, 0x56, 0xc7, 0xb4, 0x37, 0xa2, 0x4c, 0x4d, - 0xdc, 0xf3, 0xe0, 0x67, 0xe0, 0xfa, 0xac, 0x62, 0xb6, 0x91, 0x00, 0xd1, 0x48, 0xb6, 0xc7, 0x23, - 0xe3, 0x9d, 0xc5, 0xb8, 0x33, 0x8d, 0xa5, 0x1e, 0xcd, 0x17, 0xb5, 0x6a, 0x33, 0xe6, 0x7f, 0x0a, - 0xa0, 0xba, 0x43, 0xfc, 0xd0, 0x71, 0x59, 0x52, 0x7d, 0x8b, 0x37, 0xa3, 0xbd, 0xa5, 0xcd, 0xe4, - 0xdf, 0xdc, 0x66, 0x5e, 0x5b, 0xeb, 0xb3, 0x95, 0xbb, 0xf4, 0x0d, 0xaa, 0xdc, 0xe5, 0x37, 0x51, - 0xb9, 0xc5, 0x8b, 0x54, 0xae, 0xf9, 0xc7, 0x3c, 0x28, 0x25, 0xad, 0x37, 0x13, 0x3f, 0xed, 0x35, - 0xbd, 0x22, 0x3f, 0xd3, 0x2b, 0xb6, 0x40, 0x31, 0x42, 0x34, 0x1e, 0x30, 0x15, 0x75, 0x45, 0x71, - 0x3e, 0x89, 0xd9, 0x74, 0x5a, 0x51, 0xd4, 0x2b, 0x2a, 0x6c, 0xf9, 0x2d, 0x55, 0x58, 0xf1, 0x0d, - 0x1e, 0x97, 0xe7, 0x79, 0xb0, 0xb2, 0xaf, 0xe6, 0xdb, 0x23, 0xb0, 0xcc, 0x47, 0xdd, 0xaf, 0xd1, - 0x04, 0x2f, 0x38, 0x63, 0x4b, 0x78, 0xf8, 0x18, 0xc0, 0x30, 0x22, 0x3e, 0x11, 0x03, 0x72, 0xa7, - 0x7b, 0x22, 0x27, 0xdf, 0xbc, 0x70, 0xda, 0x9c, 0xbb, 0x62, 0xf6, 0x13, 0x55, 0xeb, 0x84, 0xcf, - 0xb3, 0xd6, 0xb7, 0x55, 0x19, 0xab, 0x98, 0xce, 0x23, 0x99, 0xf6, 0xc6, 0x94, 0x29, 0x8d, 0xe0, - 0x09, 0xd8, 0xcc, 0x2a, 0x1e, 0x93, 0x41, 0xec, 0x23, 0xf5, 0x9a, 0x30, 0x5f, 0xe7, 0xf4, 0x27, - 0x42, 0xd3, 0xba, 0xa1, 0xdc, 0x5e, 0x5d, 0xe4, 0x56, 0xa2, 0x99, 0x36, 0x4c, 0x3b, 0x96, 0x86, - 0xe6, 0xd3, 0x3c, 0x58, 0x9f, 0xd9, 0x03, 0xfc, 0x29, 0x00, 0x94, 0x39, 0x11, 0x93, 0x3b, 0xd7, - 0xce, 0x9d, 0xf9, 0xaf, 0x2b, 0xe7, 0x35, 0x75, 0x74, 0x27, 0xb6, 0x72, 0xe0, 0x5f, 0x15, 0x0c, - 0x81, 0x6c, 0x83, 0x12, 0x0a, 0xbc, 0x24, 0xa2, 0xe7, 0xe1, 0x5e, 0x55, 0xb8, 0xeb, 0xea, 0x80, - 0x05, 0xe9, 0x67, 0xc4, 0x0a, 0x0a, 0xe4, 0x0b, 0xe2, 0x21, 0x28, 0x79, 0x98, 0xca, 0xe9, 0x4a, - 0x9c, 0x07, 0xeb, 0x03, 0x6e, 0xf7, 0xd7, 0x91, 0xf1, 0x9d, 0xaf, 0x9b, 0xff, 0x5d, 0xe4, 0xda, - 0x13, 0x10, 0xf3, 0x57, 0xa0, 0x36, 0x17, 0x60, 0x7e, 0xb6, 0x54, 0x52, 0x78, 0x3c, 0x96, 0x6c, - 0x45, 0x65, 0xbc, 0xe7, 0xdf, 0x84, 0xf7, 0x7f, 0x17, 0x41, 0x71, 0xdf, 0x89, 0x1c, 0x9f, 0xf2, - 0x99, 0xd4, 0x77, 0x86, 0x93, 0x61, 0x33, 0x19, 0xd2, 0x35, 0xd1, 0x79, 0x52, 0x33, 0xe9, 0x02, - 0x25, 0xd3, 0xae, 0xf9, 0xce, 0x50, 0x5d, 0x31, 0x87, 0x6a, 0x9c, 0x7f, 0x04, 0x36, 0x7d, 0x1c, - 0x74, 0xd4, 0x53, 0xb2, 0xe3, 0xc7, 0x03, 0x86, 0xc3, 0x81, 0xcc, 0x44, 0x21, 0x3d, 0x93, 0x2e, - 0xd2, 0x32, 0x6d, 0xe8, 0xe3, 0x60, 0x57, 0x72, 0x1f, 0x28, 0x26, 0x7c, 0x0c, 0xca, 0x29, 0xe5, - 0xb7, 0xf6, 0xfc, 0x05, 0x53, 0xd7, 0x30, 0xce, 0xbe, 0xbd, 0x98, 0x33, 0x94, 0xed, 0xce, 0x7a, - 0x70, 0x81, 0xc0, 0x2f, 0x7e, 0x8f, 0x31, 0x67, 0x68, 0xa6, 0x9f, 0x57, 0x87, 0xce, 0x10, 0x52, - 0x50, 0xa5, 0x03, 0x87, 0xf6, 0x3b, 0x47, 0x91, 0xe3, 0xa6, 0xfe, 0xb3, 0xb8, 0x7f, 0x31, 0xaf, - 0xea, 0xe6, 0xc9, 0x42, 0x72, 0xa7, 0x9c, 0x71, 0x57, 0xd1, 0x30, 0x06, 0x9b, 0x2e, 0xf1, 0xc3, - 0x81, 0x83, 0x03, 0xd6, 0x89, 0x10, 0x8b, 0x08, 0x0d, 0x91, 0x2b, 0x2f, 0x1f, 0x1e, 0xe7, 0xd9, - 0xb3, 0xb3, 0xab, 0xfe, 0x04, 0xb2, 0xde, 0xcd, 0xf6, 0x83, 0x45, 0x20, 0xe6, 0xe7, 0xfc, 0x18, - 0x5d, 0x9a, 0x88, 0xec, 0x89, 0x04, 0x3e, 0x01, 0x5b, 0x4e, 0xd4, 0xc5, 0x4c, 0x5d, 0x67, 0xbc, - 0xa6, 0x3a, 0x03, 0xec, 0x63, 0x39, 0xf4, 0xbd, 0xd6, 0xf1, 0x7b, 0xca, 0xf1, 0x75, 0xf5, 0x37, - 0xce, 0x42, 0x18, 0xe9, 0x7a, 0x33, 0x25, 0xe4, 0x25, 0x7a, 0x9f, 0x8b, 0xe0, 0x0f, 0x40, 0x85, - 0x0d, 0x3b, 0x14, 0x3f, 0x49, 0x5c, 0x96, 0x66, 0xdf, 0x71, 0x19, 0xb1, 0x69, 0x97, 0xd9, 0xf0, - 0x00, 0x3f, 0x51, 0xd6, 0xdf, 0x05, 0x80, 0x17, 0x5d, 0xc7, 0x43, 0x01, 0xf1, 0xd5, 0x44, 0x78, - 0x79, 0xda, 0x9a, 0xa6, 0x32, 0xd3, 0x5e, 0xe5, 0xc4, 0x2e, 0x5f, 0xdf, 0x29, 0x7d, 0xfe, 0x85, - 0x91, 0xfb, 0xe7, 0x17, 0x86, 0xf6, 0xfe, 0x31, 0xd0, 0x5f, 0xf5, 0x24, 0x81, 0x37, 0x40, 0xc5, - 0xfa, 0xf0, 0x70, 0xe7, 0xe3, 0x8e, 0xfd, 0xe9, 0xde, 0xde, 0xbd, 0xbd, 0x1f, 0x6f, 0xe4, 0xea, - 0x1b, 0xa7, 0x67, 0xcd, 0x35, 0xc1, 0x54, 0x3c, 0xf8, 0x2e, 0x58, 0x97, 0x4a, 0x3b, 0x0f, 0x1f, - 0xec, 0xdf, 0xff, 0xe8, 0xf0, 0xa3, 0xdd, 0x0d, 0xad, 0x0e, 0x4f, 0xcf, 0x9a, 0x55, 0xc1, 0x9e, - 0x70, 0xeb, 0x6b, 0xbf, 0xf9, 0x5d, 0x23, 0xf7, 0xfb, 0x2f, 0x1b, 0xb9, 0x3f, 0x7d, 0xd9, 0xd0, - 0xde, 0xa7, 0xe0, 0xd2, 0x82, 0xc7, 0x0a, 0x7f, 0x9a, 0x4f, 0x9d, 0x95, 0x4f, 0xcf, 0x9a, 0x09, - 0xc9, 0xfb, 0xd1, 0xfe, 0x87, 0x9f, 0x1e, 0x08, 0x78, 0x70, 0x7a, 0xd6, 0x54, 0x14, 0xbc, 0x06, - 0x56, 0xa7, 0x9e, 0xf3, 0xf5, 0xca, 0xe9, 0x59, 0x73, 0xf5, 0x15, 0x4e, 0xad, 0x87, 0xcf, 0xfe, - 0xd1, 0xc8, 0x3d, 0x7b, 0xd1, 0xd0, 0xbe, 0x7a, 0xd1, 0xd0, 0xfe, 0xfe, 0xa2, 0xa1, 0x3d, 0x7d, - 0xd9, 0xc8, 0x7d, 0xf5, 0xb2, 0x91, 0xfb, 0xcb, 0xcb, 0x46, 0xee, 0x67, 0xb7, 0xce, 0x2f, 0x68, - 0xf9, 0x27, 0x02, 0x4d, 0xfe, 0xe1, 0xec, 0x16, 0x45, 0x3d, 0x7c, 0xf0, 0xdf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xde, 0x8c, 0x32, 0x8f, 0xfb, 0x14, 0x00, 0x00, -} - -func (x RequestContextBatchState) String() string { - s, ok := RequestContextBatchState_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x RequestContextState) String() string { - s, ok := RequestContextState_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -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 - } - if this.MaxRequestTimeout != that1.MaxRequestTimeout { - return false - } - if this.MinDepositMultiple != that1.MinDepositMultiple { - return false - } - if len(this.MinDeposit) != len(that1.MinDeposit) { - return false - } - for i := range this.MinDeposit { - if !this.MinDeposit[i].Equal(&that1.MinDeposit[i]) { - return false - } - } - if !this.ServiceFeeTax.Equal(that1.ServiceFeeTax) { - return false - } - if !this.SlashFraction.Equal(that1.SlashFraction) { - return false - } - if this.ComplaintRetrospect != that1.ComplaintRetrospect { - return false - } - if this.ArbitrationTimeLimit != that1.ArbitrationTimeLimit { - return false - } - if this.TxSizeLimit != that1.TxSizeLimit { - return false - } - if this.BaseDenom != that1.BaseDenom { - return false - } - return true -} -func (m *ServiceDefinition) 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 *ServiceDefinition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceDefinition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Schemas) > 0 { - i -= len(m.Schemas) - copy(dAtA[i:], m.Schemas) - i = encodeVarintService(dAtA, i, uint64(len(m.Schemas))) - i-- - dAtA[i] = 0x32 - } - if len(m.AuthorDescription) > 0 { - i -= len(m.AuthorDescription) - copy(dAtA[i:], m.AuthorDescription) - i = encodeVarintService(dAtA, i, uint64(len(m.AuthorDescription))) - i-- - dAtA[i] = 0x2a - } - if len(m.Author) > 0 { - i -= len(m.Author) - copy(dAtA[i:], m.Author) - i = encodeVarintService(dAtA, i, uint64(len(m.Author))) - i-- - dAtA[i] = 0x22 - } - if len(m.Tags) > 0 { - for iNdEx := len(m.Tags) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Tags[iNdEx]) - copy(dAtA[i:], m.Tags[iNdEx]) - i = encodeVarintService(dAtA, i, uint64(len(m.Tags[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintService(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintService(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ServiceBinding) 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 *ServiceBinding) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintService(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x4a - } - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.DisabledTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.DisabledTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintService(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x42 - if m.Available { - i-- - if m.Available { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarintService(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x32 - } - if m.QoS != 0 { - i = encodeVarintService(dAtA, i, uint64(m.QoS)) - i-- - dAtA[i] = 0x28 - } - if len(m.Pricing) > 0 { - i -= len(m.Pricing) - copy(dAtA[i:], m.Pricing) - i = encodeVarintService(dAtA, i, uint64(len(m.Pricing))) - i-- - dAtA[i] = 0x22 - } - if len(m.Deposit) > 0 { - for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintService(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *RequestContext) 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 *RequestContext) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.State != 0 { - i = encodeVarintService(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x88 - } - if m.BatchState != 0 { - i = encodeVarintService(dAtA, i, uint64(m.BatchState)) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x80 - } - if m.ResponseThreshold != 0 { - i = encodeVarintService(dAtA, i, uint64(m.ResponseThreshold)) - i-- - dAtA[i] = 0x78 - } - if m.BatchResponseThreshold != 0 { - i = encodeVarintService(dAtA, i, uint64(m.BatchResponseThreshold)) - i-- - dAtA[i] = 0x70 - } - if m.BatchResponseCount != 0 { - i = encodeVarintService(dAtA, i, uint64(m.BatchResponseCount)) - i-- - dAtA[i] = 0x68 - } - if m.BatchRequestCount != 0 { - i = encodeVarintService(dAtA, i, uint64(m.BatchRequestCount)) - i-- - dAtA[i] = 0x60 - } - if m.BatchCounter != 0 { - i = encodeVarintService(dAtA, i, uint64(m.BatchCounter)) - i-- - dAtA[i] = 0x58 - } - if m.RepeatedTotal != 0 { - i = encodeVarintService(dAtA, i, uint64(m.RepeatedTotal)) - i-- - dAtA[i] = 0x50 - } - if m.RepeatedFrequency != 0 { - i = encodeVarintService(dAtA, i, uint64(m.RepeatedFrequency)) - i-- - dAtA[i] = 0x48 - } - if m.Repeated { - i-- - if m.Repeated { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if m.Timeout != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Timeout)) - i-- - dAtA[i] = 0x38 - } - if len(m.ModuleName) > 0 { - i -= len(m.ModuleName) - copy(dAtA[i:], m.ModuleName) - i = encodeVarintService(dAtA, i, uint64(len(m.ModuleName))) - i-- - dAtA[i] = 0x32 - } - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintService(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x22 - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintService(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x1a - } - if len(m.Providers) > 0 { - for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Providers[iNdEx]) - copy(dAtA[i:], m.Providers[iNdEx]) - i = encodeVarintService(dAtA, i, uint64(len(m.Providers[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintService(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Request) 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 *Request) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RequestContextBatchCounter != 0 { - i = encodeVarintService(dAtA, i, uint64(m.RequestContextBatchCounter)) - i-- - dAtA[i] = 0x50 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintService(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0x4a - } - if m.ExpirationHeight != 0 { - i = encodeVarintService(dAtA, i, uint64(m.ExpirationHeight)) - i-- - dAtA[i] = 0x40 - } - if m.RequestHeight != 0 { - i = encodeVarintService(dAtA, i, uint64(m.RequestHeight)) - i-- - dAtA[i] = 0x38 - } - if len(m.ServiceFee) > 0 { - for iNdEx := len(m.ServiceFee) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintService(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x2a - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintService(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x22 - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x1a - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintService(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0x12 - } - if len(m.Id) > 0 { - i -= len(m.Id) - copy(dAtA[i:], m.Id) - i = encodeVarintService(dAtA, i, uint64(len(m.Id))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompactRequest) 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 *CompactRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompactRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpirationHeight != 0 { - i = encodeVarintService(dAtA, i, uint64(m.ExpirationHeight)) - i-- - dAtA[i] = 0x30 - } - if m.RequestHeight != 0 { - i = encodeVarintService(dAtA, i, uint64(m.RequestHeight)) - i-- - dAtA[i] = 0x28 - } - if len(m.ServiceFee) > 0 { - for iNdEx := len(m.ServiceFee) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x1a - } - if m.RequestContextBatchCounter != 0 { - i = encodeVarintService(dAtA, i, uint64(m.RequestContextBatchCounter)) - i-- - dAtA[i] = 0x10 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintService(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Response) 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 *Response) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RequestContextBatchCounter != 0 { - i = encodeVarintService(dAtA, i, uint64(m.RequestContextBatchCounter)) - i-- - dAtA[i] = 0x30 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintService(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0x2a - } - if len(m.Output) > 0 { - i -= len(m.Output) - copy(dAtA[i:], m.Output) - i = encodeVarintService(dAtA, i, uint64(len(m.Output))) - i-- - dAtA[i] = 0x22 - } - if len(m.Result) > 0 { - i -= len(m.Result) - copy(dAtA[i:], m.Result) - i = encodeVarintService(dAtA, i, uint64(len(m.Result))) - i-- - dAtA[i] = 0x1a - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintService(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x12 - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintService(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Pricing) 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 *Pricing) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pricing) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Price) > 0 { - for iNdEx := len(m.Price) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Price[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.PromotionsByVolume) > 0 { - for iNdEx := len(m.PromotionsByVolume) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PromotionsByVolume[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.PromotionsByTime) > 0 { - for iNdEx := len(m.PromotionsByTime) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PromotionsByTime[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - return len(dAtA) - i, nil -} - -func (m *PromotionByTime) 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 *PromotionByTime) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PromotionByTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Discount.Size() - i -= size - if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintService(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x12 - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintService(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PromotionByVolume) 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 *PromotionByVolume) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PromotionByVolume) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Discount.Size() - i -= size - if _, err := m.Discount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Volume != 0 { - i = encodeVarintService(dAtA, i, uint64(m.Volume)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BaseDenom) > 0 { - i -= len(m.BaseDenom) - copy(dAtA[i:], m.BaseDenom) - i = encodeVarintService(dAtA, i, uint64(len(m.BaseDenom))) - i-- - dAtA[i] = 0x4a - } - if m.TxSizeLimit != 0 { - i = encodeVarintService(dAtA, i, uint64(m.TxSizeLimit)) - i-- - dAtA[i] = 0x40 - } - n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.ArbitrationTimeLimit, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.ArbitrationTimeLimit):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintService(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x3a - n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.ComplaintRetrospect, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.ComplaintRetrospect):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintService(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x32 - { - size := m.SlashFraction.Size() - i -= size - if _, err := m.SlashFraction.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size := m.ServiceFeeTax.Size() - i -= size - if _, err := m.ServiceFeeTax.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.MinDeposit) > 0 { - for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if m.MinDepositMultiple != 0 { - i = encodeVarintService(dAtA, i, uint64(m.MinDepositMultiple)) - i-- - dAtA[i] = 0x10 - } - if m.MaxRequestTimeout != 0 { - i = encodeVarintService(dAtA, i, uint64(m.MaxRequestTimeout)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintService(dAtA []byte, offset int, v uint64) int { - offset -= sovService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ServiceDefinition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if len(m.Tags) > 0 { - for _, s := range m.Tags { - l = len(s) - n += 1 + l + sovService(uint64(l)) - } - } - l = len(m.Author) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.AuthorDescription) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Schemas) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - return n -} - -func (m *ServiceBinding) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if len(m.Deposit) > 0 { - for _, e := range m.Deposit { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - l = len(m.Pricing) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.QoS != 0 { - n += 1 + sovService(uint64(m.QoS)) - } - l = len(m.Options) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.Available { - n += 2 - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.DisabledTime) - n += 1 + l + sovService(uint64(l)) - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - return n -} - -func (m *RequestContext) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if len(m.Providers) > 0 { - for _, s := range m.Providers { - l = len(s) - n += 1 + l + sovService(uint64(l)) - } - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - l = len(m.ModuleName) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.Timeout != 0 { - n += 1 + sovService(uint64(m.Timeout)) - } - if m.Repeated { - n += 2 - } - if m.RepeatedFrequency != 0 { - n += 1 + sovService(uint64(m.RepeatedFrequency)) - } - if m.RepeatedTotal != 0 { - n += 1 + sovService(uint64(m.RepeatedTotal)) - } - if m.BatchCounter != 0 { - n += 1 + sovService(uint64(m.BatchCounter)) - } - if m.BatchRequestCount != 0 { - n += 1 + sovService(uint64(m.BatchRequestCount)) - } - if m.BatchResponseCount != 0 { - n += 1 + sovService(uint64(m.BatchResponseCount)) - } - if m.BatchResponseThreshold != 0 { - n += 1 + sovService(uint64(m.BatchResponseThreshold)) - } - if m.ResponseThreshold != 0 { - n += 1 + sovService(uint64(m.ResponseThreshold)) - } - if m.BatchState != 0 { - n += 2 + sovService(uint64(m.BatchState)) - } - if m.State != 0 { - n += 2 + sovService(uint64(m.State)) - } - return n -} - -func (m *Request) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if len(m.ServiceFee) > 0 { - for _, e := range m.ServiceFee { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.RequestHeight != 0 { - n += 1 + sovService(uint64(m.RequestHeight)) - } - if m.ExpirationHeight != 0 { - n += 1 + sovService(uint64(m.ExpirationHeight)) - } - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.RequestContextBatchCounter != 0 { - n += 1 + sovService(uint64(m.RequestContextBatchCounter)) - } - return n -} - -func (m *CompactRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.RequestContextBatchCounter != 0 { - n += 1 + sovService(uint64(m.RequestContextBatchCounter)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if len(m.ServiceFee) > 0 { - for _, e := range m.ServiceFee { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if m.RequestHeight != 0 { - n += 1 + sovService(uint64(m.RequestHeight)) - } - if m.ExpirationHeight != 0 { - n += 1 + sovService(uint64(m.ExpirationHeight)) - } - return n -} - -func (m *Response) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Result) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.Output) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - if m.RequestContextBatchCounter != 0 { - n += 1 + sovService(uint64(m.RequestContextBatchCounter)) - } - return n -} - -func (m *Pricing) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PromotionsByTime) > 0 { - for _, e := range m.PromotionsByTime { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if len(m.PromotionsByVolume) > 0 { - for _, e := range m.PromotionsByVolume { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - if len(m.Price) > 0 { - for _, e := range m.Price { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - return n -} - -func (m *PromotionByTime) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime) - n += 1 + l + sovService(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime) - n += 1 + l + sovService(uint64(l)) - l = m.Discount.Size() - n += 1 + l + sovService(uint64(l)) - return n -} - -func (m *PromotionByVolume) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Volume != 0 { - n += 1 + sovService(uint64(m.Volume)) - } - l = m.Discount.Size() - n += 1 + l + sovService(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MaxRequestTimeout != 0 { - n += 1 + sovService(uint64(m.MaxRequestTimeout)) - } - if m.MinDepositMultiple != 0 { - n += 1 + sovService(uint64(m.MinDepositMultiple)) - } - if len(m.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } - l = m.ServiceFeeTax.Size() - n += 1 + l + sovService(uint64(l)) - l = m.SlashFraction.Size() - n += 1 + l + sovService(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.ComplaintRetrospect) - n += 1 + l + sovService(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.ArbitrationTimeLimit) - n += 1 + l + sovService(uint64(l)) - if m.TxSizeLimit != 0 { - n += 1 + sovService(uint64(m.TxSizeLimit)) - } - l = len(m.BaseDenom) - if l > 0 { - n += 1 + l + sovService(uint64(l)) - } - return n -} - -func sovService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozService(x uint64) (n int) { - return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ServiceDefinition) 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 ErrIntOverflowService - } - 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: ServiceDefinition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServiceDefinition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Tags = append(m.Tags, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Author", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Author = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorDescription", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AuthorDescription = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schemas", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schemas = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ServiceBinding) 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 ErrIntOverflowService - } - 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: ServiceBinding: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Deposit = append(m.Deposit, types.Coin{}) - if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pricing", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pricing = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field QoS", wireType) - } - m.QoS = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.QoS |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Options = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Available", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Available = bool(v != 0) - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DisabledTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.DisabledTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - 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 ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestContext) 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 ErrIntOverflowService - } - 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: RequestContext: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestContext: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModuleName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ModuleName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - m.Timeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timeout |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Repeated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Repeated = bool(v != 0) - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) - } - m.RepeatedFrequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedFrequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedTotal", wireType) - } - m.RepeatedTotal = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedTotal |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchCounter", wireType) - } - m.BatchCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchRequestCount", wireType) - } - m.BatchRequestCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchRequestCount |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchResponseCount", wireType) - } - m.BatchResponseCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchResponseCount |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchResponseThreshold", wireType) - } - m.BatchResponseThreshold = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchResponseThreshold |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ResponseThreshold", wireType) - } - m.ResponseThreshold = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ResponseThreshold |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchState", wireType) - } - m.BatchState = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchState |= RequestContextBatchState(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 17: - 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 ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= RequestContextState(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Request) 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 ErrIntOverflowService - } - 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: Request: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Request: 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 ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - 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 ServiceName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFee = append(m.ServiceFee, types.Coin{}) - if err := m.ServiceFee[len(m.ServiceFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestHeight", wireType) - } - m.RequestHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpirationHeight", wireType) - } - m.ExpirationHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExpirationHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextBatchCounter", wireType) - } - m.RequestContextBatchCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestContextBatchCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompactRequest) 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 ErrIntOverflowService - } - 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: CompactRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompactRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextBatchCounter", wireType) - } - m.RequestContextBatchCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestContextBatchCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFee = append(m.ServiceFee, types.Coin{}) - if err := m.ServiceFee[len(m.ServiceFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestHeight", wireType) - } - m.RequestHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpirationHeight", wireType) - } - m.ExpirationHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExpirationHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Response) 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 ErrIntOverflowService - } - 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: Response: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Response: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Result = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Output = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextBatchCounter", wireType) - } - m.RequestContextBatchCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RequestContextBatchCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Pricing) 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 ErrIntOverflowService - } - 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: Pricing: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pricing: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PromotionsByTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PromotionsByTime = append(m.PromotionsByTime, PromotionByTime{}) - if err := m.PromotionsByTime[len(m.PromotionsByTime)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PromotionsByVolume", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PromotionsByVolume = append(m.PromotionsByVolume, PromotionByVolume{}) - if err := m.PromotionsByVolume[len(m.PromotionsByVolume)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Price = append(m.Price, types.Coin{}) - if err := m.Price[len(m.Price)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PromotionByTime) 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 ErrIntOverflowService - } - 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: PromotionByTime: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PromotionByTime: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PromotionByVolume) 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 ErrIntOverflowService - } - 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: PromotionByVolume: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PromotionByVolume: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Volume", wireType) - } - m.Volume = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Volume |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Discount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Discount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxRequestTimeout", wireType) - } - m.MaxRequestTimeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxRequestTimeout |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepositMultiple", wireType) - } - m.MinDepositMultiple = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinDepositMultiple |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinDeposit = append(m.MinDeposit, types.Coin{}) - if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeTax", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ServiceFeeTax.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SlashFraction", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SlashFraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ComplaintRetrospect", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.ComplaintRetrospect, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ArbitrationTimeLimit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.ArbitrationTimeLimit, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxSizeLimit", wireType) - } - m.TxSizeLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxSizeLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowService - } - 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 ErrInvalidLengthService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BaseDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipService(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, ErrIntOverflowService - } - 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, ErrIntOverflowService - } - 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, ErrIntOverflowService - } - 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, ErrInvalidLengthService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/service/tx.pb.go b/modules/service/tx.pb.go deleted file mode 100644 index 3006b868..00000000 --- a/modules/service/tx.pb.go +++ /dev/null @@ -1,4609 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: service/tx.proto - -package service - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgDefineService defines an SDK message for defining a new service. -type MsgDefineService struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Tags []string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty"` - Author string `protobuf:"bytes,4,opt,name=author,proto3" json:"author,omitempty"` - AuthorDescription string `protobuf:"bytes,5,opt,name=author_description,json=authorDescription,proto3" json:"author_description,omitempty" yaml:"author_description"` - Schemas string `protobuf:"bytes,6,opt,name=schemas,proto3" json:"schemas,omitempty"` -} - -func (m *MsgDefineService) Reset() { *m = MsgDefineService{} } -func (m *MsgDefineService) String() string { return proto.CompactTextString(m) } -func (*MsgDefineService) ProtoMessage() {} -func (*MsgDefineService) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{0} -} -func (m *MsgDefineService) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDefineService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDefineService.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 *MsgDefineService) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDefineService.Merge(m, src) -} -func (m *MsgDefineService) XXX_Size() int { - return m.Size() -} -func (m *MsgDefineService) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDefineService.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDefineService proto.InternalMessageInfo - -// MsgBindService defines an SDK message for binding to an existing service. -type MsgBindService struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` - Pricing string `protobuf:"bytes,4,opt,name=pricing,proto3" json:"pricing,omitempty"` - QoS uint64 `protobuf:"varint,5,opt,name=qos,proto3" json:"qos,omitempty"` - Options string `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` - Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgBindService) Reset() { *m = MsgBindService{} } -func (m *MsgBindService) String() string { return proto.CompactTextString(m) } -func (*MsgBindService) ProtoMessage() {} -func (*MsgBindService) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{1} -} -func (m *MsgBindService) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBindService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBindService.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 *MsgBindService) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBindService.Merge(m, src) -} -func (m *MsgBindService) XXX_Size() int { - return m.Size() -} -func (m *MsgBindService) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBindService.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBindService proto.InternalMessageInfo - -// MsgUpdateServiceBinding defines an SDK message for updating an existing service binding. -type MsgUpdateServiceBinding struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` - Pricing string `protobuf:"bytes,4,opt,name=pricing,proto3" json:"pricing,omitempty"` - QoS uint64 `protobuf:"varint,5,opt,name=qos,proto3" json:"qos,omitempty"` - Options string `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` - Owner string `protobuf:"bytes,7,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgUpdateServiceBinding) Reset() { *m = MsgUpdateServiceBinding{} } -func (m *MsgUpdateServiceBinding) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateServiceBinding) ProtoMessage() {} -func (*MsgUpdateServiceBinding) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{2} -} -func (m *MsgUpdateServiceBinding) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateServiceBinding.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 *MsgUpdateServiceBinding) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateServiceBinding.Merge(m, src) -} -func (m *MsgUpdateServiceBinding) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateServiceBinding) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateServiceBinding.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateServiceBinding proto.InternalMessageInfo - -// MsgSetWithdrawAddress defines an SDK message to set the withdrawal address for a provider. -type MsgSetWithdrawAddress struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - WithdrawAddress string `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3" json:"withdraw_address,omitempty" yaml:"withdraw_address"` -} - -func (m *MsgSetWithdrawAddress) Reset() { *m = MsgSetWithdrawAddress{} } -func (m *MsgSetWithdrawAddress) String() string { return proto.CompactTextString(m) } -func (*MsgSetWithdrawAddress) ProtoMessage() {} -func (*MsgSetWithdrawAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{3} -} -func (m *MsgSetWithdrawAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetWithdrawAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetWithdrawAddress.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 *MsgSetWithdrawAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetWithdrawAddress.Merge(m, src) -} -func (m *MsgSetWithdrawAddress) XXX_Size() int { - return m.Size() -} -func (m *MsgSetWithdrawAddress) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetWithdrawAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetWithdrawAddress proto.InternalMessageInfo - -// MsgDisableServiceBinding defines an SDK message to disable a service binding. -type MsgDisableServiceBinding struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgDisableServiceBinding) Reset() { *m = MsgDisableServiceBinding{} } -func (m *MsgDisableServiceBinding) String() string { return proto.CompactTextString(m) } -func (*MsgDisableServiceBinding) ProtoMessage() {} -func (*MsgDisableServiceBinding) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{4} -} -func (m *MsgDisableServiceBinding) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDisableServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDisableServiceBinding.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 *MsgDisableServiceBinding) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDisableServiceBinding.Merge(m, src) -} -func (m *MsgDisableServiceBinding) XXX_Size() int { - return m.Size() -} -func (m *MsgDisableServiceBinding) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDisableServiceBinding.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDisableServiceBinding proto.InternalMessageInfo - -// MsgEnableServiceBinding defines an SDK message to enable a service binding. -type MsgEnableServiceBinding struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Deposit github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=deposit,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"deposit"` - Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgEnableServiceBinding) Reset() { *m = MsgEnableServiceBinding{} } -func (m *MsgEnableServiceBinding) String() string { return proto.CompactTextString(m) } -func (*MsgEnableServiceBinding) ProtoMessage() {} -func (*MsgEnableServiceBinding) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{5} -} -func (m *MsgEnableServiceBinding) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEnableServiceBinding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEnableServiceBinding.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 *MsgEnableServiceBinding) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEnableServiceBinding.Merge(m, src) -} -func (m *MsgEnableServiceBinding) XXX_Size() int { - return m.Size() -} -func (m *MsgEnableServiceBinding) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEnableServiceBinding.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEnableServiceBinding proto.InternalMessageInfo - -// MsgRefundServiceDeposit defines an SDK message to refund deposit from a service binding. -type MsgRefundServiceDeposit struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Owner string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgRefundServiceDeposit) Reset() { *m = MsgRefundServiceDeposit{} } -func (m *MsgRefundServiceDeposit) String() string { return proto.CompactTextString(m) } -func (*MsgRefundServiceDeposit) ProtoMessage() {} -func (*MsgRefundServiceDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{6} -} -func (m *MsgRefundServiceDeposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRefundServiceDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRefundServiceDeposit.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 *MsgRefundServiceDeposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRefundServiceDeposit.Merge(m, src) -} -func (m *MsgRefundServiceDeposit) XXX_Size() int { - return m.Size() -} -func (m *MsgRefundServiceDeposit) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRefundServiceDeposit.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRefundServiceDeposit proto.InternalMessageInfo - -// MsgCallService defines an SDK message to initiate a service request context. -type MsgCallService struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty" yaml:"service_name"` - Providers []string `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"` - Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` - Input string `protobuf:"bytes,4,opt,name=input,proto3" json:"input,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,5,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` - Timeout int64 `protobuf:"varint,6,opt,name=timeout,proto3" json:"timeout,omitempty"` - Repeated bool `protobuf:"varint,7,opt,name=repeated,proto3" json:"repeated,omitempty"` - RepeatedFrequency uint64 `protobuf:"varint,8,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` - RepeatedTotal int64 `protobuf:"varint,9,opt,name=repeated_total,json=repeatedTotal,proto3" json:"repeated_total,omitempty" yaml:"repeated_total"` -} - -func (m *MsgCallService) Reset() { *m = MsgCallService{} } -func (m *MsgCallService) String() string { return proto.CompactTextString(m) } -func (*MsgCallService) ProtoMessage() {} -func (*MsgCallService) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{7} -} -func (m *MsgCallService) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCallService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCallService.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 *MsgCallService) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCallService.Merge(m, src) -} -func (m *MsgCallService) XXX_Size() int { - return m.Size() -} -func (m *MsgCallService) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCallService.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCallService proto.InternalMessageInfo - -// MsgCallServiceResponse defines the Msg/CallService response type. -type MsgCallServiceResponse struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` -} - -func (m *MsgCallServiceResponse) Reset() { *m = MsgCallServiceResponse{} } -func (m *MsgCallServiceResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCallServiceResponse) ProtoMessage() {} -func (*MsgCallServiceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{8} -} -func (m *MsgCallServiceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCallServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCallServiceResponse.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 *MsgCallServiceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCallServiceResponse.Merge(m, src) -} -func (m *MsgCallServiceResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCallServiceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCallServiceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCallServiceResponse proto.InternalMessageInfo - -// MsgRespondService defines an SDK message to respond a service request. -type MsgRespondService struct { - RequestId string `protobuf:"bytes,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty" yaml:"request_id"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` - Result string `protobuf:"bytes,3,opt,name=result,proto3" json:"result,omitempty"` - Output string `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` -} - -func (m *MsgRespondService) Reset() { *m = MsgRespondService{} } -func (m *MsgRespondService) String() string { return proto.CompactTextString(m) } -func (*MsgRespondService) ProtoMessage() {} -func (*MsgRespondService) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{9} -} -func (m *MsgRespondService) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRespondService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRespondService.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 *MsgRespondService) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRespondService.Merge(m, src) -} -func (m *MsgRespondService) XXX_Size() int { - return m.Size() -} -func (m *MsgRespondService) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRespondService.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRespondService proto.InternalMessageInfo - -// MsgPauseRequestContext defines an SDK message to pause a service request. -type MsgPauseRequestContext struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` -} - -func (m *MsgPauseRequestContext) Reset() { *m = MsgPauseRequestContext{} } -func (m *MsgPauseRequestContext) String() string { return proto.CompactTextString(m) } -func (*MsgPauseRequestContext) ProtoMessage() {} -func (*MsgPauseRequestContext) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{10} -} -func (m *MsgPauseRequestContext) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgPauseRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgPauseRequestContext.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 *MsgPauseRequestContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPauseRequestContext.Merge(m, src) -} -func (m *MsgPauseRequestContext) XXX_Size() int { - return m.Size() -} -func (m *MsgPauseRequestContext) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPauseRequestContext.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgPauseRequestContext proto.InternalMessageInfo - -// MsgStartRequestContext defines an SDK message to resume a service request. -type MsgStartRequestContext struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` -} - -func (m *MsgStartRequestContext) Reset() { *m = MsgStartRequestContext{} } -func (m *MsgStartRequestContext) String() string { return proto.CompactTextString(m) } -func (*MsgStartRequestContext) ProtoMessage() {} -func (*MsgStartRequestContext) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{11} -} -func (m *MsgStartRequestContext) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgStartRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgStartRequestContext.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 *MsgStartRequestContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgStartRequestContext.Merge(m, src) -} -func (m *MsgStartRequestContext) XXX_Size() int { - return m.Size() -} -func (m *MsgStartRequestContext) XXX_DiscardUnknown() { - xxx_messageInfo_MsgStartRequestContext.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgStartRequestContext proto.InternalMessageInfo - -// MsgKillRequestContext defines an SDK message to terminate a service request. -type MsgKillRequestContext struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` -} - -func (m *MsgKillRequestContext) Reset() { *m = MsgKillRequestContext{} } -func (m *MsgKillRequestContext) String() string { return proto.CompactTextString(m) } -func (*MsgKillRequestContext) ProtoMessage() {} -func (*MsgKillRequestContext) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{12} -} -func (m *MsgKillRequestContext) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgKillRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgKillRequestContext.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 *MsgKillRequestContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgKillRequestContext.Merge(m, src) -} -func (m *MsgKillRequestContext) XXX_Size() int { - return m.Size() -} -func (m *MsgKillRequestContext) XXX_DiscardUnknown() { - xxx_messageInfo_MsgKillRequestContext.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgKillRequestContext proto.InternalMessageInfo - -// MsgUpdateRequestContext defines an SDK message to update a service request context. -type MsgUpdateRequestContext struct { - RequestContextId string `protobuf:"bytes,1,opt,name=request_context_id,json=requestContextId,proto3" json:"request_context_id,omitempty" yaml:"request_context_id"` - Providers []string `protobuf:"bytes,2,rep,name=providers,proto3" json:"providers,omitempty"` - Consumer string `protobuf:"bytes,3,opt,name=consumer,proto3" json:"consumer,omitempty"` - ServiceFeeCap github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,4,rep,name=service_fee_cap,json=serviceFeeCap,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"service_fee_cap" yaml:"service_fee_cap"` - Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"` - RepeatedFrequency uint64 `protobuf:"varint,6,opt,name=repeated_frequency,json=repeatedFrequency,proto3" json:"repeated_frequency,omitempty" yaml:"repeated_frequency"` - RepeatedTotal int64 `protobuf:"varint,7,opt,name=repeated_total,json=repeatedTotal,proto3" json:"repeated_total,omitempty" yaml:"repeated_total"` -} - -func (m *MsgUpdateRequestContext) Reset() { *m = MsgUpdateRequestContext{} } -func (m *MsgUpdateRequestContext) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateRequestContext) ProtoMessage() {} -func (*MsgUpdateRequestContext) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{13} -} -func (m *MsgUpdateRequestContext) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateRequestContext) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateRequestContext.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 *MsgUpdateRequestContext) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateRequestContext.Merge(m, src) -} -func (m *MsgUpdateRequestContext) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateRequestContext) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateRequestContext.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateRequestContext proto.InternalMessageInfo - -// MsgWithdrawEarnedFees defines an SDK message to withdraw the fees earned by the provider or owner. -type MsgWithdrawEarnedFees struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider,omitempty"` -} - -func (m *MsgWithdrawEarnedFees) Reset() { *m = MsgWithdrawEarnedFees{} } -func (m *MsgWithdrawEarnedFees) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawEarnedFees) ProtoMessage() {} -func (*MsgWithdrawEarnedFees) Descriptor() ([]byte, []int) { - return fileDescriptor_0564fcd82d845f97, []int{14} -} -func (m *MsgWithdrawEarnedFees) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgWithdrawEarnedFees) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgWithdrawEarnedFees.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 *MsgWithdrawEarnedFees) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawEarnedFees.Merge(m, src) -} -func (m *MsgWithdrawEarnedFees) XXX_Size() int { - return m.Size() -} -func (m *MsgWithdrawEarnedFees) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawEarnedFees.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgWithdrawEarnedFees proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgDefineService)(nil), "irismod.service.MsgDefineService") - proto.RegisterType((*MsgBindService)(nil), "irismod.service.MsgBindService") - proto.RegisterType((*MsgUpdateServiceBinding)(nil), "irismod.service.MsgUpdateServiceBinding") - proto.RegisterType((*MsgSetWithdrawAddress)(nil), "irismod.service.MsgSetWithdrawAddress") - proto.RegisterType((*MsgDisableServiceBinding)(nil), "irismod.service.MsgDisableServiceBinding") - proto.RegisterType((*MsgEnableServiceBinding)(nil), "irismod.service.MsgEnableServiceBinding") - proto.RegisterType((*MsgRefundServiceDeposit)(nil), "irismod.service.MsgRefundServiceDeposit") - proto.RegisterType((*MsgCallService)(nil), "irismod.service.MsgCallService") - proto.RegisterType((*MsgCallServiceResponse)(nil), "irismod.service.MsgCallServiceResponse") - proto.RegisterType((*MsgRespondService)(nil), "irismod.service.MsgRespondService") - proto.RegisterType((*MsgPauseRequestContext)(nil), "irismod.service.MsgPauseRequestContext") - proto.RegisterType((*MsgStartRequestContext)(nil), "irismod.service.MsgStartRequestContext") - proto.RegisterType((*MsgKillRequestContext)(nil), "irismod.service.MsgKillRequestContext") - proto.RegisterType((*MsgUpdateRequestContext)(nil), "irismod.service.MsgUpdateRequestContext") - proto.RegisterType((*MsgWithdrawEarnedFees)(nil), "irismod.service.MsgWithdrawEarnedFees") -} - -func init() { proto.RegisterFile("service/tx.proto", fileDescriptor_0564fcd82d845f97) } - -var fileDescriptor_0564fcd82d845f97 = []byte{ - // 944 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x57, 0x4f, 0x53, 0xe4, 0x44, - 0x14, 0x9f, 0x30, 0xc3, 0x0c, 0x34, 0xee, 0x02, 0x71, 0x81, 0x80, 0x3a, 0xa1, 0x72, 0xf2, 0xc2, - 0x4c, 0xe1, 0x9f, 0xcb, 0x9e, 0x74, 0x60, 0xa9, 0xa2, 0x56, 0x5c, 0x0d, 0x5a, 0x56, 0x79, 0x99, - 0xea, 0x49, 0x1e, 0x99, 0xd6, 0x24, 0x1d, 0xd2, 0x1d, 0x58, 0x6e, 0x7a, 0xd2, 0xa3, 0x65, 0x95, - 0x5f, 0xc2, 0x6f, 0xe0, 0xd5, 0x13, 0xc7, 0x3d, 0x7a, 0xb0, 0xb2, 0x0a, 0xdf, 0x60, 0x3c, 0x78, - 0xb5, 0xba, 0xd3, 0x1d, 0x12, 0x76, 0xdd, 0x75, 0x2d, 0x04, 0x0f, 0x7b, 0x9a, 0xfe, 0xbd, 0x7e, - 0xef, 0xf5, 0x7b, 0xbf, 0xf7, 0xfa, 0x75, 0x06, 0x2d, 0x30, 0x48, 0x8f, 0x88, 0x07, 0x7d, 0xfe, - 0xb0, 0x97, 0xa4, 0x94, 0x53, 0x73, 0x9e, 0xa4, 0x84, 0x45, 0xd4, 0xef, 0xa9, 0x9d, 0xb5, 0xae, - 0x47, 0x59, 0x44, 0x59, 0x7f, 0x84, 0x19, 0xf4, 0x8f, 0x36, 0x47, 0xc0, 0xf1, 0x66, 0xdf, 0xa3, - 0x24, 0x2e, 0x0c, 0xd6, 0xee, 0x04, 0x34, 0xa0, 0x72, 0xd9, 0x17, 0xab, 0x42, 0xea, 0xfc, 0x6a, - 0xa0, 0x85, 0x3d, 0x16, 0x6c, 0xc3, 0x01, 0x89, 0x61, 0xbf, 0x70, 0x65, 0x9a, 0xa8, 0x15, 0xe3, - 0x08, 0x2c, 0x63, 0xdd, 0x78, 0x73, 0xd6, 0x95, 0x6b, 0x73, 0x1d, 0xcd, 0xf9, 0xc0, 0xbc, 0x94, - 0x24, 0x9c, 0xd0, 0xd8, 0x9a, 0x92, 0x5b, 0x55, 0x91, 0xb0, 0xe2, 0x38, 0x60, 0x56, 0x73, 0xbd, - 0x29, 0xac, 0xc4, 0xda, 0x5c, 0x46, 0x6d, 0x9c, 0xf1, 0x31, 0x4d, 0xad, 0x96, 0x34, 0x50, 0xc8, - 0xfc, 0x00, 0x99, 0xc5, 0x6a, 0x58, 0x75, 0x3a, 0x2d, 0x74, 0x06, 0x6f, 0x4c, 0x72, 0x7b, 0xf5, - 0x04, 0x47, 0xe1, 0x5d, 0xe7, 0x49, 0x1d, 0xc7, 0x5d, 0x2c, 0x84, 0xdb, 0x95, 0x93, 0x2d, 0xd4, - 0x61, 0xde, 0x18, 0x22, 0xcc, 0xac, 0xb6, 0x3c, 0x46, 0x43, 0xe7, 0xa7, 0x29, 0x74, 0x7b, 0x8f, - 0x05, 0x03, 0x12, 0xfb, 0x3a, 0xb9, 0xbb, 0xe8, 0x15, 0x45, 0xd9, 0xf0, 0x22, 0xc9, 0xc1, 0xca, - 0x24, 0xb7, 0x5f, 0x2d, 0x0e, 0xad, 0xee, 0x3a, 0xee, 0x9c, 0x82, 0x1f, 0x0a, 0x12, 0xd6, 0xd0, - 0x4c, 0x92, 0xd2, 0x23, 0xe2, 0x43, 0xaa, 0x18, 0x28, 0xb1, 0xf9, 0x05, 0xea, 0xf8, 0x90, 0x50, - 0x46, 0xb8, 0x64, 0x60, 0xee, 0xad, 0xd5, 0x5e, 0x51, 0x91, 0x9e, 0xa8, 0x48, 0x4f, 0x55, 0xa4, - 0xb7, 0x45, 0x49, 0x3c, 0x78, 0xf7, 0x34, 0xb7, 0x1b, 0x3f, 0x3e, 0xb6, 0x37, 0x02, 0xc2, 0xc7, - 0xd9, 0xa8, 0xe7, 0xd1, 0xa8, 0x2f, 0xea, 0x19, 0x03, 0x97, 0xbf, 0xe3, 0x6c, 0xb4, 0xc1, 0xfc, - 0x2f, 0x37, 0x02, 0xda, 0xe7, 0x27, 0x09, 0x30, 0x69, 0xc5, 0x5c, 0x7d, 0x80, 0x48, 0x38, 0x49, - 0x89, 0x47, 0xe2, 0x40, 0xf1, 0xaa, 0xa1, 0xb9, 0x8a, 0x9a, 0x87, 0x94, 0x49, 0x26, 0x5b, 0x83, - 0xce, 0x59, 0x6e, 0x37, 0x3f, 0xa6, 0xfb, 0xae, 0x90, 0x09, 0x23, 0x2a, 0xf9, 0x2a, 0x59, 0x52, - 0xd0, 0xbc, 0x83, 0xa6, 0xe9, 0x71, 0x0c, 0xa9, 0xd5, 0x91, 0xf2, 0x02, 0x38, 0x3f, 0x4f, 0xa1, - 0x95, 0x3d, 0x16, 0x7c, 0x9a, 0xf8, 0x98, 0xeb, 0xd6, 0x10, 0x44, 0x8a, 0x63, 0x5e, 0x92, 0xf8, - 0x0f, 0x49, 0xcc, 0xd0, 0xd2, 0x1e, 0x0b, 0xf6, 0x81, 0x7f, 0x46, 0xf8, 0xd8, 0x4f, 0xf1, 0xf1, - 0xfb, 0xbe, 0x9f, 0x02, 0xab, 0xa8, 0x1b, 0x15, 0x75, 0x73, 0x07, 0x2d, 0x1c, 0x2b, 0xc5, 0x21, - 0x2e, 0x34, 0x0b, 0x8e, 0x06, 0xaf, 0x4d, 0x72, 0x7b, 0xa5, 0xe0, 0xf6, 0xb2, 0x86, 0xe3, 0xce, - 0x1f, 0xd7, 0xbd, 0x3b, 0xdf, 0x1a, 0xc8, 0x12, 0xd7, 0x9a, 0x30, 0x3c, 0x0a, 0xaf, 0xab, 0x78, - 0x65, 0x4a, 0xcd, 0x2a, 0x03, 0x7f, 0x18, 0xb2, 0x8d, 0xee, 0xc5, 0xd7, 0x18, 0xc9, 0x75, 0xb6, - 0x51, 0x99, 0x75, 0xab, 0x9a, 0xf5, 0x37, 0x45, 0xd6, 0x2e, 0x1c, 0x64, 0xe5, 0xe8, 0xd9, 0x56, - 0x16, 0xd7, 0xcb, 0xff, 0x9f, 0x4d, 0x39, 0x02, 0xb7, 0x70, 0x18, 0x5e, 0xc5, 0x08, 0x7c, 0x1d, - 0xcd, 0xea, 0x03, 0x45, 0x6b, 0x8a, 0x51, 0x7f, 0x21, 0x10, 0xe1, 0x79, 0x34, 0x66, 0x59, 0x54, - 0x46, 0x51, 0x62, 0x11, 0x1e, 0x89, 0x93, 0x8c, 0x6b, 0xa2, 0x24, 0x30, 0xbf, 0x37, 0xd0, 0xbc, - 0x3e, 0xee, 0x00, 0x60, 0xe8, 0xe1, 0xc4, 0x9a, 0x7e, 0x5e, 0xcd, 0x1e, 0x88, 0x9a, 0x4d, 0x72, - 0x7b, 0xb9, 0x1e, 0xae, 0xb2, 0x77, 0x5e, 0xbc, 0x9a, 0xb7, 0x94, 0x8b, 0x1d, 0x80, 0x2d, 0x9c, - 0x88, 0x5b, 0xce, 0x49, 0x04, 0x34, 0xe3, 0xf2, 0x96, 0x37, 0x5d, 0x0d, 0x45, 0x82, 0x29, 0x24, - 0x80, 0x39, 0xf8, 0xf2, 0xa2, 0xcf, 0xb8, 0x25, 0x16, 0x8f, 0x9a, 0x5e, 0x0f, 0x0f, 0x52, 0x38, - 0xcc, 0x20, 0xf6, 0x4e, 0xac, 0x19, 0x39, 0x45, 0x2a, 0x8f, 0xda, 0x93, 0x3a, 0x8e, 0xbb, 0xa8, - 0x85, 0x3b, 0x5a, 0x66, 0xbe, 0x87, 0x6e, 0x97, 0x9a, 0x9c, 0x72, 0x1c, 0x5a, 0xb3, 0x22, 0x94, - 0xc1, 0xea, 0x24, 0xb7, 0x97, 0x2e, 0x79, 0x92, 0xfb, 0x8e, 0x7b, 0x4b, 0x0b, 0x3e, 0x91, 0x18, - 0xd0, 0x72, 0xbd, 0xf0, 0x2e, 0xb0, 0x84, 0xc6, 0x0c, 0xcc, 0xfb, 0x22, 0xd2, 0xc3, 0x0c, 0x18, - 0x1f, 0x7a, 0x34, 0xe6, 0xf0, 0x90, 0x0f, 0x89, 0xaf, 0xda, 0xa0, 0x16, 0xe9, 0x65, 0x1d, 0xc7, - 0x5d, 0x50, 0xc2, 0xad, 0x42, 0xb6, 0xeb, 0x3b, 0x3f, 0x18, 0x68, 0x51, 0xb6, 0xba, 0x70, 0x5e, - 0x3e, 0xb3, 0xef, 0x20, 0xa4, 0xcd, 0x4b, 0xd7, 0x4b, 0x93, 0xdc, 0x5e, 0xac, 0xbb, 0x16, 0x2e, - 0x67, 0x15, 0xd8, 0xf5, 0x9f, 0xd9, 0xde, 0xcb, 0xa8, 0x9d, 0x02, 0xcb, 0x42, 0xae, 0x3a, 0x4b, - 0x21, 0x21, 0xa7, 0x19, 0xbf, 0x68, 0x2c, 0x85, 0x9c, 0xaf, 0x0d, 0x99, 0xff, 0x47, 0x38, 0x63, - 0xe0, 0xd6, 0x82, 0xbe, 0xd2, 0xfc, 0x6b, 0x3d, 0x3f, 0x55, 0xef, 0x79, 0x1d, 0xc3, 0x3e, 0xc7, - 0x29, 0xbf, 0xa9, 0x18, 0xbe, 0x32, 0xe4, 0x1b, 0x74, 0x9f, 0x84, 0xe1, 0x4d, 0x85, 0xf0, 0xb8, - 0x59, 0xf9, 0x94, 0xf8, 0x2f, 0x83, 0xf8, 0xf7, 0xd3, 0xe9, 0x69, 0x73, 0xa8, 0xf5, 0x3f, 0x9a, - 0x43, 0xd3, 0xf5, 0x39, 0xf4, 0xf4, 0x59, 0xd3, 0xbe, 0xb2, 0x59, 0xd3, 0x79, 0xc1, 0x59, 0xb3, - 0x2b, 0x7b, 0x4c, 0x7f, 0xe4, 0xdc, 0xc3, 0x69, 0x0c, 0xfe, 0x0e, 0xc0, 0xdf, 0x7d, 0xe7, 0x3c, - 0xe3, 0x9e, 0x0f, 0x1e, 0x9c, 0xfe, 0xde, 0x6d, 0x9c, 0x9e, 0x75, 0x8d, 0x47, 0x67, 0x5d, 0xe3, - 0xb7, 0xb3, 0xae, 0xf1, 0xdd, 0x79, 0xb7, 0xf1, 0xe8, 0xbc, 0xdb, 0xf8, 0xe5, 0xbc, 0xdb, 0xf8, - 0x7c, 0xf3, 0xf9, 0x84, 0x46, 0xd4, 0xcf, 0x42, 0x60, 0x7d, 0xc5, 0xe5, 0xa8, 0x2d, 0xff, 0xea, - 0xbc, 0xfd, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x08, 0x83, 0xbc, 0x45, 0x0d, 0x00, 0x00, -} - -func (m *MsgDefineService) 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 *MsgDefineService) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDefineService) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Schemas) > 0 { - i -= len(m.Schemas) - copy(dAtA[i:], m.Schemas) - i = encodeVarintTx(dAtA, i, uint64(len(m.Schemas))) - i-- - dAtA[i] = 0x32 - } - if len(m.AuthorDescription) > 0 { - i -= len(m.AuthorDescription) - copy(dAtA[i:], m.AuthorDescription) - i = encodeVarintTx(dAtA, i, uint64(len(m.AuthorDescription))) - i-- - dAtA[i] = 0x2a - } - if len(m.Author) > 0 { - i -= len(m.Author) - copy(dAtA[i:], m.Author) - i = encodeVarintTx(dAtA, i, uint64(len(m.Author))) - i-- - dAtA[i] = 0x22 - } - if len(m.Tags) > 0 { - for iNdEx := len(m.Tags) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Tags[iNdEx]) - copy(dAtA[i:], m.Tags[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Tags[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - 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] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgBindService) 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 *MsgBindService) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBindService) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x3a - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarintTx(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x32 - } - if m.QoS != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.QoS)) - i-- - dAtA[i] = 0x28 - } - if len(m.Pricing) > 0 { - i -= len(m.Pricing) - copy(dAtA[i:], m.Pricing) - i = encodeVarintTx(dAtA, i, uint64(len(m.Pricing))) - i-- - dAtA[i] = 0x22 - } - if len(m.Deposit) > 0 { - for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateServiceBinding) 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 *MsgUpdateServiceBinding) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x3a - } - if len(m.Options) > 0 { - i -= len(m.Options) - copy(dAtA[i:], m.Options) - i = encodeVarintTx(dAtA, i, uint64(len(m.Options))) - i-- - dAtA[i] = 0x32 - } - if m.QoS != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.QoS)) - i-- - dAtA[i] = 0x28 - } - if len(m.Pricing) > 0 { - i -= len(m.Pricing) - copy(dAtA[i:], m.Pricing) - i = encodeVarintTx(dAtA, i, uint64(len(m.Pricing))) - i-- - dAtA[i] = 0x22 - } - if len(m.Deposit) > 0 { - for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSetWithdrawAddress) 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 *MsgSetWithdrawAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.WithdrawAddress) > 0 { - i -= len(m.WithdrawAddress) - copy(dAtA[i:], m.WithdrawAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.WithdrawAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDisableServiceBinding) 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 *MsgDisableServiceBinding) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDisableServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x1a - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgEnableServiceBinding) 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 *MsgEnableServiceBinding) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEnableServiceBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x22 - } - if len(m.Deposit) > 0 { - for iNdEx := len(m.Deposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Deposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgRefundServiceDeposit) 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 *MsgRefundServiceDeposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRefundServiceDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x1a - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCallService) 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 *MsgCallService) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCallService) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RepeatedTotal != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RepeatedTotal)) - i-- - dAtA[i] = 0x48 - } - if m.RepeatedFrequency != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) - i-- - dAtA[i] = 0x40 - } - if m.Repeated { - i-- - if m.Repeated { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Timeout != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) - i-- - dAtA[i] = 0x30 - } - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Input) > 0 { - i -= len(m.Input) - copy(dAtA[i:], m.Input) - i = encodeVarintTx(dAtA, i, uint64(len(m.Input))) - i-- - dAtA[i] = 0x22 - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x1a - } - if len(m.Providers) > 0 { - for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Providers[iNdEx]) - copy(dAtA[i:], m.Providers[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.ServiceName) > 0 { - i -= len(m.ServiceName) - copy(dAtA[i:], m.ServiceName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ServiceName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCallServiceResponse) 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 *MsgCallServiceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCallServiceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgRespondService) 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 *MsgRespondService) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRespondService) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Output) > 0 { - i -= len(m.Output) - copy(dAtA[i:], m.Output) - i = encodeVarintTx(dAtA, i, uint64(len(m.Output))) - i-- - dAtA[i] = 0x22 - } - if len(m.Result) > 0 { - i -= len(m.Result) - copy(dAtA[i:], m.Result) - i = encodeVarintTx(dAtA, i, uint64(len(m.Result))) - i-- - dAtA[i] = 0x1a - } - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - 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 *MsgPauseRequestContext) 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 *MsgPauseRequestContext) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPauseRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x12 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgStartRequestContext) 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 *MsgStartRequestContext) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgStartRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x12 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgKillRequestContext) 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 *MsgKillRequestContext) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgKillRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x12 - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateRequestContext) 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 *MsgUpdateRequestContext) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateRequestContext) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RepeatedTotal != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RepeatedTotal)) - i-- - dAtA[i] = 0x38 - } - if m.RepeatedFrequency != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RepeatedFrequency)) - i-- - dAtA[i] = 0x30 - } - if m.Timeout != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Timeout)) - i-- - dAtA[i] = 0x28 - } - if len(m.ServiceFeeCap) > 0 { - for iNdEx := len(m.ServiceFeeCap) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ServiceFeeCap[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Consumer) > 0 { - i -= len(m.Consumer) - copy(dAtA[i:], m.Consumer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Consumer))) - i-- - dAtA[i] = 0x1a - } - if len(m.Providers) > 0 { - for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Providers[iNdEx]) - copy(dAtA[i:], m.Providers[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Providers[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.RequestContextId) > 0 { - i -= len(m.RequestContextId) - copy(dAtA[i:], m.RequestContextId) - i = encodeVarintTx(dAtA, i, uint64(len(m.RequestContextId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgWithdrawEarnedFees) 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 *MsgWithdrawEarnedFees) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgWithdrawEarnedFees) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintTx(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x12 - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - 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 *MsgDefineService) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Tags) > 0 { - for _, s := range m.Tags { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Author) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.AuthorDescription) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Schemas) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgBindService) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Deposit) > 0 { - for _, e := range m.Deposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Pricing) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.QoS != 0 { - n += 1 + sovTx(uint64(m.QoS)) - } - l = len(m.Options) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgUpdateServiceBinding) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Deposit) > 0 { - for _, e := range m.Deposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Pricing) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.QoS != 0 { - n += 1 + sovTx(uint64(m.QoS)) - } - l = len(m.Options) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgSetWithdrawAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.WithdrawAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgDisableServiceBinding) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgEnableServiceBinding) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Deposit) > 0 { - for _, e := range m.Deposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRefundServiceDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgCallService) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Providers) > 0 { - for _, s := range m.Providers { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Input) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.Timeout != 0 { - n += 1 + sovTx(uint64(m.Timeout)) - } - if m.Repeated { - n += 2 - } - if m.RepeatedFrequency != 0 { - n += 1 + sovTx(uint64(m.RepeatedFrequency)) - } - if m.RepeatedTotal != 0 { - n += 1 + sovTx(uint64(m.RepeatedTotal)) - } - return n -} - -func (m *MsgCallServiceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRespondService) 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)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Result) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Output) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgPauseRequestContext) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgStartRequestContext) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgKillRequestContext) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgUpdateRequestContext) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.RequestContextId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Providers) > 0 { - for _, s := range m.Providers { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Consumer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.ServiceFeeCap) > 0 { - for _, e := range m.ServiceFeeCap { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.Timeout != 0 { - n += 1 + sovTx(uint64(m.Timeout)) - } - if m.RepeatedFrequency != 0 { - n += 1 + sovTx(uint64(m.RepeatedFrequency)) - } - if m.RepeatedTotal != 0 { - n += 1 + sovTx(uint64(m.RepeatedTotal)) - } - return n -} - -func (m *MsgWithdrawEarnedFees) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Provider) - if l > 0 { - n += 1 + l + sovTx(uint64(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 *MsgDefineService) 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: MsgDefineService: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDefineService: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tags", 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.Tags = append(m.Tags, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Author", 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.Author = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorDescription", 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.AuthorDescription = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schemas", 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.Schemas = 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 *MsgBindService) 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: MsgBindService: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBindService: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Deposit = append(m.Deposit, types.Coin{}) - if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pricing", 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.Pricing = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field QoS", wireType) - } - m.QoS = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.QoS |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", 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.Options = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - 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 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.Owner = 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 *MsgUpdateServiceBinding) 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: MsgUpdateServiceBinding: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Deposit = append(m.Deposit, types.Coin{}) - if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pricing", 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.Pricing = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field QoS", wireType) - } - m.QoS = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.QoS |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", 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.Options = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - 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 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.Owner = 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 *MsgSetWithdrawAddress) 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: MsgSetWithdrawAddress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetWithdrawAddress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 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.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", 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.WithdrawAddress = 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 *MsgDisableServiceBinding) 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: MsgDisableServiceBinding: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDisableServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 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.Owner = 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 *MsgEnableServiceBinding) 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: MsgEnableServiceBinding: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEnableServiceBinding: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Deposit = append(m.Deposit, types.Coin{}) - if err := m.Deposit[len(m.Deposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = 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 *MsgRefundServiceDeposit) 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: MsgRefundServiceDeposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRefundServiceDeposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 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.Owner = 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 *MsgCallService) 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: MsgCallService: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCallService: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", 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.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Input", 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.Input = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - m.Timeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timeout |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Repeated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Repeated = bool(v != 0) - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) - } - m.RepeatedFrequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedFrequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedTotal", wireType) - } - m.RepeatedTotal = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedTotal |= 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 *MsgCallServiceResponse) 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: MsgCallServiceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCallServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = 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 *MsgRespondService) 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: MsgRespondService: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRespondService: 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 - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", 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.Result = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Output", 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.Output = 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 *MsgPauseRequestContext) 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: MsgPauseRequestContext: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPauseRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = 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 *MsgStartRequestContext) 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: MsgStartRequestContext: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStartRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = 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 *MsgKillRequestContext) 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: MsgKillRequestContext: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgKillRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = 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 *MsgUpdateRequestContext) 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: MsgUpdateRequestContext: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateRequestContext: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestContextId", 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.RequestContextId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers = append(m.Providers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Consumer", 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.Consumer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceFeeCap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceFeeCap = append(m.ServiceFeeCap, types.Coin{}) - if err := m.ServiceFeeCap[len(m.ServiceFeeCap)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - m.Timeout = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timeout |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedFrequency", wireType) - } - m.RepeatedFrequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedFrequency |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RepeatedTotal", wireType) - } - m.RepeatedTotal = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RepeatedTotal |= 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 *MsgWithdrawEarnedFees) 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: MsgWithdrawEarnedFees: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawEarnedFees: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 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.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = 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 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/modules/service/types.go b/modules/service/types.go deleted file mode 100644 index 60221c60..00000000 --- a/modules/service/types.go +++ /dev/null @@ -1,822 +0,0 @@ -package service - -import ( - json2 "encoding/json" - "errors" - "fmt" - "strings" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "service" - - eventTypeNewBatchRequest = "new_batch_request" - eventTypeNewBatchRequestProvider = "new_batch_request_provider" - attributeKeyRequests = "requests" - attributeKeyRequestID = "request_id" - attributeKeyRequestContextID = "request_context_id" - attributeKeyServiceName = "service_name" - attributeKeyProvider = "provider" - - requestIDLen = 58 - contextIDLen = 40 -) - -var ( - _ sdk.Msg = &MsgDefineService{} - _ sdk.Msg = &MsgBindService{} - _ sdk.Msg = &MsgUpdateServiceBinding{} - _ sdk.Msg = &MsgSetWithdrawAddress{} - _ sdk.Msg = &MsgDisableServiceBinding{} - _ sdk.Msg = &MsgEnableServiceBinding{} - _ sdk.Msg = &MsgRefundServiceDeposit{} - _ sdk.Msg = &MsgCallService{} - _ sdk.Msg = &MsgRespondService{} - _ sdk.Msg = &MsgPauseRequestContext{} - _ sdk.Msg = &MsgStartRequestContext{} - _ sdk.Msg = &MsgKillRequestContext{} - _ sdk.Msg = &MsgUpdateRequestContext{} - _ sdk.Msg = &MsgWithdrawEarnedFees{} - - RequestContextStateToStringMap = map[RequestContextState]string{ - RUNNING: "running", - PAUSED: "paused", - COMPLETED: "completed", - } - StringToRequestContextStateMap = map[string]RequestContextState{ - "running": RUNNING, - "paused": PAUSED, - "completed": COMPLETED, - } - - RequestContextBatchStateToStringMap = map[RequestContextBatchState]string{ - BATCHRUNNING: "running", - BATCHCOMPLETED: "completed", - } - StringToRequestContextBatchStateMap = map[string]RequestContextBatchState{ - "running": BATCHRUNNING, - "completed": BATCHCOMPLETED, - } -) - -func (msg MsgDefineService) Route() string { return ModuleName } - -func (msg MsgDefineService) Type() string { - return "define_service" -} - -func (msg MsgDefineService) ValidateBasic() error { - if len(msg.Author) == 0 { - return errors.New("author missing") - } - if err := sdk.ValidateAccAddress(msg.Author); err != nil { - return err - } - - if len(msg.Name) == 0 { - return errors.New("author missing") - } - - if len(msg.Schemas) == 0 { - return errors.New("schemas missing") - } - - return nil -} - -func (msg MsgDefineService) GetSignBytes() []byte { - if len(msg.Tags) == 0 { - msg.Tags = nil - } - - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -func (msg MsgDefineService) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Author)} -} - -func (msg MsgBindService) Type() string { - return "bind_service" -} - -func (msg MsgBindService) Route() string { return ModuleName } - -func (msg MsgBindService) ValidateBasic() error { - if len(msg.Owner) == 0 { - return errors.New("owner missing") - } - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return err - } - - if len(msg.Provider) == 0 { - return errors.New("provider missing") - } - if err := sdk.ValidateAccAddress(msg.Provider); err != nil { - return err - } - - if len(msg.ServiceName) == 0 { - return errors.New("serviceName missing") - } - - if len(msg.Pricing) == 0 { - return errors.New("pricing missing") - } - return nil -} - -func (msg MsgBindService) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -func (msg MsgBindService) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -func (msg MsgCallService) Route() string { return ModuleName } - -func (msg MsgCallService) Type() string { - return "request_service" -} - -func (msg MsgCallService) ValidateBasic() error { - if len(msg.Consumer) == 0 { - return errors.New("consumer missing") - } - if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { - return err - } - - if len(msg.Providers) == 0 { - return errors.New("providers missing") - } - for _, provider := range msg.Providers { - if err := sdk.ValidateAccAddress(provider); err != nil { - return err - } - } - - if len(msg.ServiceName) == 0 { - return errors.New("serviceName missing") - } - - if len(msg.Input) == 0 { - return errors.New("input missing") - } - return nil -} - -func (msg MsgCallService) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -func (msg MsgCallService) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} -} - -func (msg MsgRespondService) Route() string { return ModuleName } - -func (msg MsgRespondService) Type() string { - return "respond_service" -} - -func (msg MsgRespondService) ValidateBasic() error { - if len(msg.Provider) == 0 { - return errors.New("provider missing") - } - if err := sdk.ValidateAccAddress(msg.Provider); err != nil { - return err - } - - if len(msg.Result) == 0 { - return errors.New("result missing") - } - - if len(msg.Output) > 0 { - if !json2.Valid([]byte(msg.Output)) { - return errors.New("output is not valid JSON") - } - } - - return nil -} - -func (msg MsgRespondService) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -func (msg MsgRespondService) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Provider)} -} - -// ______________________________________________________________________ - -func (msg MsgUpdateServiceBinding) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgUpdateServiceBinding) Type() string { return "update_service_binding" } - -// GetSignBytes implements Msg. -func (msg MsgUpdateServiceBinding) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgUpdateServiceBinding) ValidateBasic() error { - if len(msg.Provider) == 0 { - return errors.New("provider missing") - } - if err := sdk.ValidateAccAddress(msg.Provider); err != nil { - return err - } - - if len(msg.Owner) == 0 { - return errors.New("owner missing") - } - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return err - } - - if len(msg.ServiceName) == 0 { - return errors.New("service name missing") - } - - if !msg.Deposit.Empty() { - return fmt.Errorf("invalid deposit: %s", msg.Deposit) - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgUpdateServiceBinding) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// ______________________________________________________________________ - -func (msg MsgSetWithdrawAddress) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgSetWithdrawAddress) Type() string { return "set_withdraw_address" } - -// GetSignBytes implements Msg. -func (msg MsgSetWithdrawAddress) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgSetWithdrawAddress) ValidateBasic() error { - if len(msg.Owner) == 0 { - return errors.New("owner missing") - } - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return err - } - - if len(msg.WithdrawAddress) == 0 { - return errors.New("withdrawal address missing") - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgSetWithdrawAddress) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// ______________________________________________________________________ - -func (msg MsgDisableServiceBinding) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgDisableServiceBinding) Type() string { return "disable_service_binding" } - -// GetSignBytes implements Msg. -func (msg MsgDisableServiceBinding) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgDisableServiceBinding) ValidateBasic() error { - if len(msg.Provider) == 0 { - return errors.New("provider missing") - } - if err := sdk.ValidateAccAddress(msg.Provider); err != nil { - return err - } - - if len(msg.Owner) == 0 { - return errors.New("owner missing") - } - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return err - } - - if len(msg.ServiceName) == 0 { - return errors.New("service name missing") - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgDisableServiceBinding) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// ______________________________________________________________________ - -func (msg MsgEnableServiceBinding) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgEnableServiceBinding) Type() string { return "enable_service_binding" } - -// GetSignBytes implements Msg. -func (msg MsgEnableServiceBinding) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgEnableServiceBinding) ValidateBasic() error { - if len(msg.Provider) == 0 { - return errors.New("provider missing") - } - if err := sdk.ValidateAccAddress(msg.Provider); err != nil { - return err - } - - if len(msg.Owner) == 0 { - return errors.New("owner missing") - } - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return err - } - - if len(msg.ServiceName) == 0 { - return errors.New("service name missing") - } - - if !msg.Deposit.Empty() { - return fmt.Errorf("invalid deposit: %s", msg.Deposit) - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgEnableServiceBinding) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// ______________________________________________________________________ - -func (msg MsgRefundServiceDeposit) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgRefundServiceDeposit) Type() string { return "refund_service_deposit" } - -// GetSignBytes implements Msg. -func (msg MsgRefundServiceDeposit) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgRefundServiceDeposit) ValidateBasic() error { - if len(msg.Provider) == 0 { - return errors.New("provider missing") - } - if err := sdk.ValidateAccAddress(msg.Provider); err != nil { - return err - } - - if len(msg.Owner) == 0 { - return errors.New("owner missing") - } - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return err - } - - if len(msg.ServiceName) == 0 { - return errors.New("service name missing") - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgRefundServiceDeposit) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// ______________________________________________________________________ - -func (msg MsgPauseRequestContext) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgPauseRequestContext) Type() string { return "pause_request_context" } - -// GetSignBytes implements Msg. -func (msg MsgPauseRequestContext) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgPauseRequestContext) ValidateBasic() error { - if len(msg.Consumer) == 0 { - return errors.New("consumer missing") - } - if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { - return err - } - return nil -} - -// GetSigners implements Msg. -func (msg MsgPauseRequestContext) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} -} - -// ______________________________________________________________________ - -func (msg MsgStartRequestContext) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgStartRequestContext) Type() string { return "start_request_context" } - -// GetSignBytes implements Msg. -func (msg MsgStartRequestContext) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgStartRequestContext) ValidateBasic() error { - if len(msg.Consumer) == 0 { - return errors.New("consumer missing") - } - if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { - return err - } - return nil -} - -// GetSigners implements Msg. -func (msg MsgStartRequestContext) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} -} - -// ______________________________________________________________________ - -func (msg MsgKillRequestContext) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgKillRequestContext) Type() string { return "kill_request_context" } - -// GetSignBytes implements Msg. -func (msg MsgKillRequestContext) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgKillRequestContext) ValidateBasic() error { - if len(msg.Consumer) == 0 { - return errors.New("consumer missing") - } - if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { - return err - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgKillRequestContext) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} -} - -// ______________________________________________________________________ - -func (msg MsgUpdateRequestContext) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgUpdateRequestContext) Type() string { return "update_request_context" } - -// GetSignBytes implements Msg. -func (msg MsgUpdateRequestContext) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgUpdateRequestContext) ValidateBasic() error { - if len(msg.Consumer) == 0 { - return errors.New("consumer missing") - } - if err := sdk.ValidateAccAddress(msg.Consumer); err != nil { - return err - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgUpdateRequestContext) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Consumer)} -} - -// ______________________________________________________________________ - -func (msg MsgWithdrawEarnedFees) Route() string { return ModuleName } - -// Type implements Msg. -func (msg MsgWithdrawEarnedFees) Type() string { return "withdraw_earned_fees" } - -// GetSignBytes implements Msg. -func (msg MsgWithdrawEarnedFees) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// ValidateBasic implements Msg. -func (msg MsgWithdrawEarnedFees) ValidateBasic() error { - if len(msg.Provider) == 0 { - return errors.New("provider missing") - } - if err := sdk.ValidateAccAddress(msg.Provider); err != nil { - return err - } - - if len(msg.Owner) == 0 { - return errors.New("owner missing") - } - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return err - } - - return nil -} - -// GetSigners implements Msg. -func (msg MsgWithdrawEarnedFees) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// ==========================================for QueryWithResponse========================================== - -func (r ServiceDefinition) Convert() interface{} { - return QueryServiceDefinitionResponse{ - Name: r.Name, - Description: r.Description, - Tags: r.Tags, - Author: r.Author, - AuthorDescription: r.AuthorDescription, - Schemas: r.Schemas, - } -} - -func (b ServiceBinding) Convert() interface{} { - return QueryServiceBindingResponse{ - ServiceName: b.ServiceName, - Provider: b.Provider, - Deposit: b.Deposit, - Pricing: b.Pricing, - QoS: b.QoS, - Options: b.Options, - Available: b.Available, - DisabledTime: b.DisabledTime, - Owner: b.Owner, - } -} - -type serviceBindings []*ServiceBinding - -func (bs serviceBindings) Convert() interface{} { - bindings := make([]QueryServiceBindingResponse, len(bs)) - for i, binding := range bs { - bindings[i] = binding.Convert().(QueryServiceBindingResponse) - } - return bindings -} - -func (r Request) Empty() bool { - return len(r.ServiceName) == 0 -} - -func (r Request) Convert() interface{} { - return QueryServiceRequestResponse{ - ID: r.Id, - ServiceName: r.ServiceName, - Provider: r.Provider, - Consumer: r.Consumer, - Input: r.Input, - ServiceFee: r.ServiceFee, - RequestHeight: r.RequestHeight, - ExpirationHeight: r.ExpirationHeight, - RequestContextID: r.RequestContextId, - RequestContextBatchCounter: r.RequestContextBatchCounter, - } -} - -type requests []*Request - -func (rs requests) Convert() interface{} { - reqs := make([]QueryServiceRequestResponse, len(rs)) - for i, request := range rs { - reqs[i] = request.Convert().(QueryServiceRequestResponse) - } - return reqs -} - -func (r Response) Empty() bool { - return len(r.Provider) == 0 -} - -func (r Response) Convert() interface{} { - return QueryServiceResponseResponse{ - Provider: r.Provider, - Consumer: r.Consumer, - Output: r.Output, - Result: r.Result, - RequestContextID: r.RequestContextId, - RequestContextBatchCounter: r.RequestContextBatchCounter, - } -} - -type responses []*Response - -func (rs responses) Convert() interface{} { - resps := make([]QueryServiceResponseResponse, len(rs)) - for i, response := range rs { - resps[i] = response.Convert().(QueryServiceResponseResponse) - } - return resps -} - -func RequestContextStateFromString(str string) (RequestContextState, error) { - if state, ok := StringToRequestContextStateMap[strings.ToLower(str)]; ok { - return state, nil - } - return RequestContextState(0xff), fmt.Errorf("'%s' is not a valid request context state", str) -} - -// MarshalJSON returns the JSON representation -func (state RequestContextState) MarshalJSON() ([]byte, error) { - return json2.Marshal(state.String()) -} - -func RequestContextBatchStateFromString(str string) (RequestContextBatchState, error) { - if state, ok := StringToRequestContextBatchStateMap[strings.ToLower(str)]; ok { - return state, nil - } - return RequestContextBatchState(0xff), fmt.Errorf("'%s' is not a valid request context batch state", str) -} - -// MarshalJSON returns the JSON representation -func (state RequestContextBatchState) MarshalJSON() ([]byte, error) { - return json2.Marshal(state.String()) -} - -// UnmarshalJSON unmarshals raw JSON bytes into a RequestContextBatchState -func (state *RequestContextBatchState) UnmarshalJSON(data []byte) error { - var s string - if err := json2.Unmarshal(data, &s); err != nil { - return nil - } - - bz, err := RequestContextBatchStateFromString(s) - if err != nil { - return err - } - - *state = bz - return nil -} - -// UnmarshalJSON unmarshals raw JSON bytes into a RequestContextState. -func (state *RequestContextState) UnmarshalJSON(data []byte) error { - var s string - if err := json2.Unmarshal(data, &s); err != nil { - return nil - } - - bz, err := RequestContextStateFromString(s) - if err != nil { - return err - } - - *state = bz - return nil -} - -// Empty returns true if empty -func (r RequestContext) Empty() bool { - return len(r.ServiceName) == 0 -} - -func (r RequestContext) Convert() interface{} { - return QueryRequestContextResp{ - ServiceName: r.ServiceName, - Providers: r.Providers, - Consumer: r.Consumer, - Input: r.Input, - ServiceFeeCap: r.ServiceFeeCap, - Timeout: r.Timeout, - Repeated: r.Repeated, - RepeatedFrequency: r.RepeatedFrequency, - RepeatedTotal: r.RepeatedTotal, - BatchCounter: r.BatchCounter, - BatchRequestCount: r.BatchRequestCount, - BatchResponseCount: r.BatchResponseCount, - BatchState: r.BatchState.String(), - State: r.State.String(), - ResponseThreshold: r.ResponseThreshold, - ModuleName: r.ModuleName, - } -} - -func (p Params) Convert() interface{} { - return QueryParamsResp{ - MaxRequestTimeout: p.MaxRequestTimeout, - MinDepositMultiple: p.MinDepositMultiple, - MinDeposit: p.MinDeposit.String(), - ServiceFeeTax: p.ServiceFeeTax.String(), - SlashFraction: p.SlashFraction.String(), - ComplaintRetrospect: p.ComplaintRetrospect, - ArbitrationTimeLimit: p.ArbitrationTimeLimit, - TxSizeLimit: p.TxSizeLimit, - BaseDenom: p.BaseDenom, - } -} diff --git a/modules/staking/codec.go b/modules/staking/codec.go deleted file mode 100644 index e324dec4..00000000 --- a/modules/staking/codec.go +++ /dev/null @@ -1,27 +0,0 @@ -package staking - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateValidator{}, - &MsgEditValidator{}, - &MsgDelegate{}, - &MsgUndelegate{}, - &MsgBeginRedelegate{}, - ) -} diff --git a/modules/staking/delegation.go b/modules/staking/delegation.go deleted file mode 100644 index 2eefe772..00000000 --- a/modules/staking/delegation.go +++ /dev/null @@ -1,383 +0,0 @@ -package staking - -import ( - "encoding/json" - "fmt" - "strings" - "time" - - yaml "gopkg.in/yaml.v2" - - "github.com/irisnet/irishub-sdk-go/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// Implements Delegation interface -var _ DelegationI = Delegation{} - -// String implements the Stringer interface for a DVPair object. -func (dv DVPair) String() string { - out, _ := yaml.Marshal(dv) - return string(out) -} - -// String implements the Stringer interface for a DVVTriplet object. -func (dvv DVVTriplet) String() string { - out, _ := yaml.Marshal(dvv) - return string(out) -} - -// NewDelegation creates a new delegation object -//nolint:interfacer -func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) Delegation { - return Delegation{ - DelegatorAddress: delegatorAddr.String(), - ValidatorAddress: validatorAddr.String(), - Shares: shares, - } -} - -// MustMarshalDelegation returns the delegation bytes. Panics if fails -func MustMarshalDelegation(cdc codec.BinaryMarshaler, delegation Delegation) []byte { - return cdc.MustMarshalBinaryBare(&delegation) -} - -// MustUnmarshalDelegation return the unmarshaled delegation from bytes. -// Panics if fails. -func MustUnmarshalDelegation(cdc codec.BinaryMarshaler, value []byte) Delegation { - delegation, err := UnmarshalDelegation(cdc, value) - if err != nil { - panic(err) - } - - return delegation -} - -// return the delegation -func UnmarshalDelegation(cdc codec.BinaryMarshaler, value []byte) (delegation Delegation, err error) { - err = cdc.UnmarshalBinaryBare(value, &delegation) - return delegation, err -} - -func (d Delegation) GetDelegatorAddr() sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(d.DelegatorAddress) - if err != nil { - panic(err) - } - return delAddr -} -func (d Delegation) GetValidatorAddr() sdk.ValAddress { - addr, err := sdk.ValAddressFromBech32(d.ValidatorAddress) - if err != nil { - panic(err) - } - return addr -} -func (d Delegation) GetShares() sdk.Dec { return d.Shares } - -// String returns a human readable string representation of a Delegation. -func (d Delegation) String() string { - out, _ := yaml.Marshal(d) - return string(out) -} - -// Delegations is a collection of delegations -type Delegations []Delegation - -func (d Delegations) String() (out string) { - for _, del := range d { - out += del.String() + "\n" - } - - return strings.TrimSpace(out) -} - -func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int) UnbondingDelegationEntry { - return UnbondingDelegationEntry{ - CreationHeight: creationHeight, - CompletionTime: completionTime, - InitialBalance: balance, - Balance: balance, - } -} - -// String implements the stringer interface for a UnbondingDelegationEntry. -func (e UnbondingDelegationEntry) String() string { - out, _ := yaml.Marshal(e) - return string(out) -} - -// IsMature - is the current entry mature -func (e UnbondingDelegationEntry) IsMature(currentTime time.Time) bool { - return !e.CompletionTime.After(currentTime) -} - -// NewUnbondingDelegation - create a new unbonding delegation object -//nolint:interfacer -func NewUnbondingDelegation( - delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, - creationHeight int64, minTime time.Time, balance sdk.Int, -) UnbondingDelegation { - return UnbondingDelegation{ - DelegatorAddress: delegatorAddr.String(), - ValidatorAddress: validatorAddr.String(), - Entries: []UnbondingDelegationEntry{ - NewUnbondingDelegationEntry(creationHeight, minTime, balance), - }, - } -} - -// AddEntry - append entry to the unbonding delegation -func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int) { - entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) - ubd.Entries = append(ubd.Entries, entry) -} - -// RemoveEntry - remove entry at index i to the unbonding delegation -func (ubd *UnbondingDelegation) RemoveEntry(i int64) { - ubd.Entries = append(ubd.Entries[:i], ubd.Entries[i+1:]...) -} - -// return the unbonding delegation -func MustMarshalUBD(cdc codec.BinaryMarshaler, ubd UnbondingDelegation) []byte { - return cdc.MustMarshalBinaryBare(&ubd) -} - -// unmarshal a unbonding delegation from a store value -func MustUnmarshalUBD(cdc codec.BinaryMarshaler, value []byte) UnbondingDelegation { - ubd, err := UnmarshalUBD(cdc, value) - if err != nil { - panic(err) - } - - return ubd -} - -// unmarshal a unbonding delegation from a store value -func UnmarshalUBD(cdc codec.BinaryMarshaler, value []byte) (ubd UnbondingDelegation, err error) { - err = cdc.UnmarshalBinaryBare(value, &ubd) - return ubd, err -} - -// String returns a human readable string representation of an UnbondingDelegation. -func (ubd UnbondingDelegation) String() string { - out := fmt.Sprintf(`Unbonding Delegations between: - Delegator: %s - Validator: %s - Entries:`, ubd.DelegatorAddress, ubd.ValidatorAddress) - for i, entry := range ubd.Entries { - out += fmt.Sprintf(` Unbonding Delegation %d: - Creation Height: %v - Min time to unbond (unix): %v - Expected balance: %s`, i, entry.CreationHeight, - entry.CompletionTime, entry.Balance) - } - - return out -} - -// UnbondingDelegations is a collection of UnbondingDelegation -type UnbondingDelegations []UnbondingDelegation - -func (ubds UnbondingDelegations) String() (out string) { - for _, u := range ubds { - out += u.String() + "\n" - } - - return strings.TrimSpace(out) -} - -func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int, sharesDst sdk.Dec) RedelegationEntry { - return RedelegationEntry{ - CreationHeight: creationHeight, - CompletionTime: completionTime, - InitialBalance: balance, - SharesDst: sharesDst, - } -} - -// String implements the Stringer interface for a RedelegationEntry object. -func (e RedelegationEntry) String() string { - out, _ := yaml.Marshal(e) - return string(out) -} - -// IsMature - is the current entry mature -func (e RedelegationEntry) IsMature(currentTime time.Time) bool { - return !e.CompletionTime.After(currentTime) -} - -//nolint:interfacer -func NewRedelegation( - delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, - creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec, -) Redelegation { - return Redelegation{ - DelegatorAddress: delegatorAddr.String(), - ValidatorSrcAddress: validatorSrcAddr.String(), - ValidatorDstAddress: validatorDstAddr.String(), - Entries: []RedelegationEntry{ - NewRedelegationEntry(creationHeight, minTime, balance, sharesDst), - }, - } -} - -// AddEntry - append entry to the unbonding delegation -func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec) { - entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst) - red.Entries = append(red.Entries, entry) -} - -// RemoveEntry - remove entry at index i to the unbonding delegation -func (red *Redelegation) RemoveEntry(i int64) { - red.Entries = append(red.Entries[:i], red.Entries[i+1:]...) -} - -// MustMarshalRED returns the Redelegation bytes. Panics if fails. -func MustMarshalRED(cdc codec.BinaryMarshaler, red Redelegation) []byte { - return cdc.MustMarshalBinaryBare(&red) -} - -// MustUnmarshalRED unmarshals a redelegation from a store value. Panics if fails. -func MustUnmarshalRED(cdc codec.BinaryMarshaler, value []byte) Redelegation { - red, err := UnmarshalRED(cdc, value) - if err != nil { - panic(err) - } - - return red -} - -// UnmarshalRED unmarshals a redelegation from a store value -func UnmarshalRED(cdc codec.BinaryMarshaler, value []byte) (red Redelegation, err error) { - err = cdc.UnmarshalBinaryBare(value, &red) - return red, err -} - -// String returns a human readable string representation of a Redelegation. -func (red Redelegation) String() string { - out := fmt.Sprintf(`Redelegations between: - Delegator: %s - Source Validator: %s - Destination Validator: %s - Entries: -`, - red.DelegatorAddress, red.ValidatorSrcAddress, red.ValidatorDstAddress, - ) - - for i, entry := range red.Entries { - out += fmt.Sprintf(` Redelegation Entry #%d: - Creation height: %v - Min time to unbond (unix): %v - Dest Shares: %s -`, - i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, - ) - } - - return strings.TrimRight(out, "\n") -} - -// Redelegations are a collection of Redelegation -type Redelegations []Redelegation - -func (d Redelegations) String() (out string) { - for _, red := range d { - out += red.String() + "\n" - } - - return strings.TrimSpace(out) -} - -// ---------------------------------------------------------------------------- -// Client Types - -// NewDelegationResp creates a new DelegationResponse instance -func NewDelegationResp( - delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec, balance sdk.Coin, -) DelegationResponse { - return DelegationResponse{ - Delegation: NewDelegation(delegatorAddr, validatorAddr, shares), - Balance: balance, - } -} - -// String implements the Stringer interface for DelegationResponse. -func (d DelegationResponse) String() string { - return fmt.Sprintf("%s\n Balance: %s", d.Delegation.String(), d.Balance) -} - -type delegationRespAlias DelegationResponse - -// MarshalJSON implements the json.Marshaler interface. This is so we can -// achieve a flattened structure while embedding other types. -func (d DelegationResponse) MarshalJSON() ([]byte, error) { - return json.Marshal((delegationRespAlias)(d)) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. This is so we can -// achieve a flattened structure while embedding other types. -func (d *DelegationResponse) UnmarshalJSON(bz []byte) error { - return json.Unmarshal(bz, (*delegationRespAlias)(d)) -} - -// DelegationResponses is a collection of DelegationResp -type DelegationResponses []DelegationResponse - -// String implements the Stringer interface for DelegationResponses. -func (d DelegationResponses) String() (out string) { - for _, del := range d { - out += del.String() + "\n" - } - - return strings.TrimSpace(out) -} - -// NewRedelegationResponse crates a new RedelegationEntryResponse instance. -//nolint:interfacer -func NewRedelegationResponse( - delegatorAddr sdk.AccAddress, validatorSrc, validatorDst sdk.ValAddress, entries []RedelegationEntryResponse, -) RedelegationResponse { - return RedelegationResponse{ - Redelegation: Redelegation{ - DelegatorAddress: delegatorAddr.String(), - ValidatorSrcAddress: validatorSrc.String(), - ValidatorDstAddress: validatorDst.String(), - }, - Entries: entries, - } -} - -// NewRedelegationEntryResponse creates a new RedelegationEntryResponse instance. -func NewRedelegationEntryResponse( - creationHeight int64, completionTime time.Time, sharesDst sdk.Dec, initialBalance, balance sdk.Int) RedelegationEntryResponse { - return RedelegationEntryResponse{ - RedelegationEntry: NewRedelegationEntry(creationHeight, completionTime, initialBalance, sharesDst), - Balance: balance, - } -} - -type redelegationRespAlias RedelegationResponse - -// MarshalJSON implements the json.Marshaler interface. This is so we can -// achieve a flattened structure while embedding other types. -func (r RedelegationResponse) MarshalJSON() ([]byte, error) { - return json.Marshal((redelegationRespAlias)(r)) -} - -// UnmarshalJSON implements the json.Unmarshaler interface. This is so we can -// achieve a flattened structure while embedding other types. -func (r *RedelegationResponse) UnmarshalJSON(bz []byte) error { - return json.Unmarshal(bz, (*redelegationRespAlias)(r)) -} - -// RedelegationResponses are a collection of RedelegationResp -type RedelegationResponses []RedelegationResponse - -func (r RedelegationResponses) String() (out string) { - for _, red := range r { - out += red.String() + "\n" - } - - return strings.TrimSpace(out) -} diff --git a/modules/staking/export.go b/modules/staking/export.go deleted file mode 100644 index a822dee4..00000000 --- a/modules/staking/export.go +++ /dev/null @@ -1,215 +0,0 @@ -package staking - -import ( - "time" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// expose Staking module api for user -type Client interface { - sdk.Module - - CreateValidator(request CreateValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - EditValidator(request EditValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - Delegate(request DelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - Undelegate(request UndelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - BeginRedelegate(request BeginRedelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - - QueryValidators(status string, page, size uint64) (QueryValidatorsResp, sdk.Error) - QueryValidator(validatorAddr string) (QueryValidatorResp, sdk.Error) - QueryValidatorDelegations(validatorAddr string, page, size uint64) (QueryValidatorDelegationsResp, sdk.Error) - QueryValidatorUnbondingDelegations(validatorAddr string, page, size uint64) (QueryValidatorUnbondingDelegationsResp, sdk.Error) - QueryDelegation(delegatorAddr string, validatorAddr string) (QueryDelegationResp, sdk.Error) - QueryUnbondingDelegation(delegatorAddr string, validatorAddr string) (QueryUnbondingDelegationResp, sdk.Error) - QueryDelegatorDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorDelegationsResp, sdk.Error) - QueryDelegatorUnbondingDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorUnbondingDelegationsResp, sdk.Error) - QueryRedelegations(request QueryRedelegationsReq) (QueryRedelegationsResp, sdk.Error) - QueryDelegatorValidators(delegatorAddr string, page, size uint64) (QueryDelegatorValidatorsResp, sdk.Error) - QueryDelegatorValidator(delegatorAddr string, validatorAddr string) (QueryValidatorResp, sdk.Error) - QueryHistoricalInfo(height int64) (QueryHistoricalInfoResp, sdk.Error) - QueryPool() (QueryPoolResp, sdk.Error) - QueryParams() (QueryParamsResp, sdk.Error) -} - -type CreateValidatorRequest struct { - Moniker string `json:"moniker"` - Rate sdk.Dec `json:"rate"` - MaxRate sdk.Dec `json:"max_rate"` - MaxChangeRate sdk.Dec `json:"max_change_rate"` - MinSelfDelegation sdk.Int `json:"min_self_delegation"` - Pubkey string `json:"pubkey"` - Value sdk.DecCoin `json:"value"` -} - -type EditValidatorRequest struct { - Moniker string `json:"moniker"` - Identity string `json:"identity"` - Website string `json:"website"` - SecurityContact string `json:"security_contact"` - Details string `json:"details"` - CommissionRate sdk.Dec `json:"commission_rate"` - MinSelfDelegation sdk.Int `json:"min_self_delegation"` -} - -type DelegateRequest struct { - ValidatorAddr string `json:"validator_address"` - Amount sdk.DecCoin `json:"amount"` -} - -type UndelegateRequest struct { - ValidatorAddr string `json:"validator_address"` - Amount sdk.DecCoin `json:"amount"` -} - -type BeginRedelegateRequest struct { - ValidatorSrcAddress string - ValidatorDstAddress string - Amount sdk.DecCoin -} - -type ( - description struct { - Moniker string `json:"moniker"` - Identity string `json:"identity"` - Website string `json:"website"` - SecurityContact string `json:"security_contact"` - Details string `json:"details"` - } - commission struct { - commissionRates - UpdateTime time.Time `json:"update_time"` - } - commissionRates struct { - Rate sdk.Dec `json:"rate"` - MaxRate sdk.Dec `json:"max_rate"` - MaxChangeRate sdk.Dec `json:"max_change_rate"` - } - - QueryValidatorsResp struct { - Validators []QueryValidatorResp `json:"validators"` - Total uint64 `json:"total"` - } - - QueryValidatorResp struct { - OperatorAddress string `json:"operator_address"` - ConsensusPubkey string `json:"consensus_pubkey"` - Jailed bool `json:"jailed"` - Status string `json:"status"` - Tokens sdk.Int `json:"tokens"` - DelegatorShares sdk.Dec `json:"delegator_shares"` - Description description `json:"description"` - UnbondingHeight int64 `json:"unbonding_height"` - UnbondingTime time.Time `json:"unbonding_time"` - Commission commission `json:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation"` - } -) - -type ( - delegation struct { - DelegatorAddress string `json:"delegator_address"` - Shares sdk.Dec `json:"shares"` - ValidatorAddress string `json:"validator_address"` - } - - QueryDelegationResp struct { - Delegation delegation `json:"delegation"` - Balance sdk.Coin `json:"balance"` - } - - QueryValidatorDelegationsResp struct { - DelegationResponses []QueryDelegationResp `json:"delegation_responses"` - Total uint64 `json:"total"` - } -) - -type ( - unbondingDelegationEntry struct { - CreationHeight int64 `json:"creation_height"` - CompletionTime time.Time `json:"completion_time"` - InitialBalance sdk.Int `json:"initial_balance"` - Balance sdk.Int `json:"balance"` - } - - QueryUnbondingDelegationResp struct { - DelegatorAddress string `json:"delegator_address"` - ValidatorAddress string `json:"validator_address"` - Entries []unbondingDelegationEntry `json:"entries"` - } - - QueryValidatorUnbondingDelegationsResp struct { - UnbondingResponses []QueryUnbondingDelegationResp `json:"unbonding_responses"` - Total uint64 `json:"total"` - } -) - -type QueryDelegatorDelegationsResp struct { - DelegationResponses []QueryDelegationResp `json:"delegation_responses"` - Total uint64 `json:"total"` -} - -type QueryDelegatorUnbondingDelegationsResp struct { - UnbondingDelegations []QueryUnbondingDelegationResp `json:"unbonding_delegations"` - Total uint64 `json:"total"` -} - -type ( - QueryRedelegationsReq struct { - DelegatorAddr string `json:"delegator_addr"` - SrcValidatorAddr string `json:"src_validator_addr"` - DstValidatorAddr string `json:"dst_validator_addr"` - Page uint64 `json:"page"` - Size uint64 `json:"size"` - } - - QueryRedelegationsResp struct { - RedelegationResponses []RedelegationResp `json:"redelegation_responses"` - Total uint64 `json:"total"` - } - - redelegationEntry struct { - CreationHeight int64 `json:"creation_height"` - CompletionTime time.Time `json:"completion_time"` - InitialBalance sdk.Int `json:"initial_balance"` - SharesDst sdk.Dec `json:"shares_dst"` - } - redelegationEntryResponse struct { - RedelegationEntry redelegationEntry `json:"redelegation_entry"` - Balance sdk.Int `json:"balance"` - } - redelegation struct { - DelegatorAddress string `json:"delegator_address"` - ValidatorSrcAddress string `json:"validator_src_address"` - ValidatorDstAddress string `json:"validator_dst_address"` - Entries []redelegationEntry `json:"entries"` - } - - RedelegationResp struct { - Redelegation redelegation `json:"redelegation"` - Entries []redelegationEntryResponse `json:"entries"` - } -) - -type QueryDelegatorValidatorsResp struct { - Validator []QueryValidatorResp `json:"validator"` - Total uint64 `json:"total"` -} - -type QueryHistoricalInfoResp struct { - Header sdk.Header `json:"header"` - Valset []QueryValidatorResp `json:"valset"` -} - -type QueryPoolResp struct { - NotBondedTokens sdk.Int `json:"not_bonded_tokens"` - BondedTokens sdk.Int `json:"bonded_tokens"` -} - -type QueryParamsResp struct { - UnbondingTime time.Duration `json:"unbonding_time"` - MaxValidators uint32 `json:"max_validators"` - MaxEntries uint32 `json:"max_entries"` - HistoricalEntries uint32 `json:"historical_entries"` - BondDenom string `json:"bond_denom"` -} diff --git a/modules/staking/params.go b/modules/staking/params.go deleted file mode 100644 index ea812eb5..00000000 --- a/modules/staking/params.go +++ /dev/null @@ -1,35 +0,0 @@ -package staking - -import ( - yaml "gopkg.in/yaml.v2" -) - -// String implements the stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// String implements the Stringer interface for a Commission object. -func (c Commission) String() string { - out, _ := yaml.Marshal(c) - return string(out) -} - -// String implements the Stringer interface for a CommissionRates object. -func (cr CommissionRates) String() string { - out, _ := yaml.Marshal(cr) - return string(out) -} - -// String implements the Stringer interface for a Description object. -func (d Description) String() string { - out, _ := yaml.Marshal(d) - return string(out) -} - -// String implements the Stringer interface for a Validator object. -func (v Validator) String() string { - out, _ := yaml.Marshal(v) - return string(out) -} diff --git a/modules/staking/query.pb.go b/modules/staking/query.pb.go deleted file mode 100644 index 177ad135..00000000 --- a/modules/staking/query.pb.go +++ /dev/null @@ -1,6728 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/query.proto - -package staking - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - query "github.com/irisnet/irishub-sdk-go/types/query" - _ "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 - -// QueryValidatorsRequest is request type for Query/Validators RPC method. -type QueryValidatorsRequest struct { - // status enables to query for validators matching a given status. - Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryValidatorsRequest) Reset() { *m = QueryValidatorsRequest{} } -func (m *QueryValidatorsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorsRequest) ProtoMessage() {} -func (*QueryValidatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{0} -} -func (m *QueryValidatorsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorsRequest.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 *QueryValidatorsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorsRequest.Merge(m, src) -} -func (m *QueryValidatorsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorsRequest proto.InternalMessageInfo - -func (m *QueryValidatorsRequest) GetStatus() string { - if m != nil { - return m.Status - } - return "" -} - -func (m *QueryValidatorsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryValidatorsResponse is response type for the Query/Validators RPC method -type QueryValidatorsResponse struct { - // validators contains all the queried validators. - Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryValidatorsResponse) Reset() { *m = QueryValidatorsResponse{} } -func (m *QueryValidatorsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorsResponse) ProtoMessage() {} -func (*QueryValidatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{1} -} -func (m *QueryValidatorsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorsResponse.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 *QueryValidatorsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorsResponse.Merge(m, src) -} -func (m *QueryValidatorsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorsResponse proto.InternalMessageInfo - -func (m *QueryValidatorsResponse) GetValidators() []Validator { - if m != nil { - return m.Validators - } - return nil -} - -func (m *QueryValidatorsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryValidatorRequest is response type for the Query/Validator RPC method -type QueryValidatorRequest struct { - // validator_addr defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` -} - -func (m *QueryValidatorRequest) Reset() { *m = QueryValidatorRequest{} } -func (m *QueryValidatorRequest) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorRequest) ProtoMessage() {} -func (*QueryValidatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{2} -} -func (m *QueryValidatorRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorRequest.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 *QueryValidatorRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorRequest.Merge(m, src) -} -func (m *QueryValidatorRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorRequest proto.InternalMessageInfo - -func (m *QueryValidatorRequest) GetValidatorAddr() string { - if m != nil { - return m.ValidatorAddr - } - return "" -} - -// QueryValidatorResponse is response type for the Query/Validator RPC method -type QueryValidatorResponse struct { - // validator defines the the validator info. - Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` -} - -func (m *QueryValidatorResponse) Reset() { *m = QueryValidatorResponse{} } -func (m *QueryValidatorResponse) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorResponse) ProtoMessage() {} -func (*QueryValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{3} -} -func (m *QueryValidatorResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorResponse.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 *QueryValidatorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorResponse.Merge(m, src) -} -func (m *QueryValidatorResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorResponse proto.InternalMessageInfo - -func (m *QueryValidatorResponse) GetValidator() Validator { - if m != nil { - return m.Validator - } - return Validator{} -} - -// QueryValidatorDelegationsRequest is request type for the -// Query/ValidatorDelegations RPC method -type QueryValidatorDelegationsRequest struct { - // validator_addr defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryValidatorDelegationsRequest) Reset() { *m = QueryValidatorDelegationsRequest{} } -func (m *QueryValidatorDelegationsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorDelegationsRequest) ProtoMessage() {} -func (*QueryValidatorDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{4} -} -func (m *QueryValidatorDelegationsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorDelegationsRequest.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 *QueryValidatorDelegationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorDelegationsRequest.Merge(m, src) -} -func (m *QueryValidatorDelegationsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorDelegationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorDelegationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorDelegationsRequest proto.InternalMessageInfo - -func (m *QueryValidatorDelegationsRequest) GetValidatorAddr() string { - if m != nil { - return m.ValidatorAddr - } - return "" -} - -func (m *QueryValidatorDelegationsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryValidatorDelegationsResponse is response type for the -// Query/ValidatorDelegations RPC method -type QueryValidatorDelegationsResponse struct { - DelegationResponses DelegationResponses `protobuf:"bytes,1,rep,name=delegation_responses,json=delegationResponses,proto3,castrepeated=DelegationResponses" json:"delegation_responses"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryValidatorDelegationsResponse) Reset() { *m = QueryValidatorDelegationsResponse{} } -func (m *QueryValidatorDelegationsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryValidatorDelegationsResponse) ProtoMessage() {} -func (*QueryValidatorDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{5} -} -func (m *QueryValidatorDelegationsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorDelegationsResponse.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 *QueryValidatorDelegationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorDelegationsResponse.Merge(m, src) -} -func (m *QueryValidatorDelegationsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorDelegationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorDelegationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorDelegationsResponse proto.InternalMessageInfo - -func (m *QueryValidatorDelegationsResponse) GetDelegationResponses() DelegationResponses { - if m != nil { - return m.DelegationResponses - } - return nil -} - -func (m *QueryValidatorDelegationsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryValidatorUnbondingDelegationsRequest is required type for the -// Query/ValidatorUnbondingDelegations RPC method -type QueryValidatorUnbondingDelegationsRequest struct { - // validator_addr defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryValidatorUnbondingDelegationsRequest) Reset() { - *m = QueryValidatorUnbondingDelegationsRequest{} -} -func (m *QueryValidatorUnbondingDelegationsRequest) String() string { - return proto.CompactTextString(m) -} -func (*QueryValidatorUnbondingDelegationsRequest) ProtoMessage() {} -func (*QueryValidatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{6} -} -func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.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 *QueryValidatorUnbondingDelegationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.Merge(m, src) -} -func (m *QueryValidatorUnbondingDelegationsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorUnbondingDelegationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorUnbondingDelegationsRequest proto.InternalMessageInfo - -func (m *QueryValidatorUnbondingDelegationsRequest) GetValidatorAddr() string { - if m != nil { - return m.ValidatorAddr - } - return "" -} - -func (m *QueryValidatorUnbondingDelegationsRequest) GetPagination() *query.PageRequest { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryValidatorUnbondingDelegationsResponse is response type for the -// Query/ValidatorUnbondingDelegations RPC method. -type QueryValidatorUnbondingDelegationsResponse struct { - UnbondingResponses []UnbondingDelegation `protobuf:"bytes,1,rep,name=unbonding_responses,json=unbondingResponses,proto3" json:"unbonding_responses"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryValidatorUnbondingDelegationsResponse) Reset() { - *m = QueryValidatorUnbondingDelegationsResponse{} -} -func (m *QueryValidatorUnbondingDelegationsResponse) String() string { - return proto.CompactTextString(m) -} -func (*QueryValidatorUnbondingDelegationsResponse) ProtoMessage() {} -func (*QueryValidatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{7} -} -func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.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 *QueryValidatorUnbondingDelegationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.Merge(m, src) -} -func (m *QueryValidatorUnbondingDelegationsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryValidatorUnbondingDelegationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidatorUnbondingDelegationsResponse proto.InternalMessageInfo - -func (m *QueryValidatorUnbondingDelegationsResponse) GetUnbondingResponses() []UnbondingDelegation { - if m != nil { - return m.UnbondingResponses - } - return nil -} - -func (m *QueryValidatorUnbondingDelegationsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryDelegationRequest is request type for the Query/Delegation RPC method. -type QueryDelegationRequest struct { - // delegator_addr defines the delegator address to query for. - DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` - // validator_addr defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` -} - -func (m *QueryDelegationRequest) Reset() { *m = QueryDelegationRequest{} } -func (m *QueryDelegationRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDelegationRequest) ProtoMessage() {} -func (*QueryDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{8} -} -func (m *QueryDelegationRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegationRequest.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 *QueryDelegationRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegationRequest.Merge(m, src) -} -func (m *QueryDelegationRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegationRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegationRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegationRequest proto.InternalMessageInfo - -// QueryDelegationResponse is response type for the Query/Delegation RPC method. -type QueryDelegationResponse struct { - // delegation_responses defines the delegation info of a delegation. - DelegationResponse *DelegationResponse `protobuf:"bytes,1,opt,name=delegation_response,json=delegationResponse,proto3" json:"delegation_response,omitempty"` -} - -func (m *QueryDelegationResponse) Reset() { *m = QueryDelegationResponse{} } -func (m *QueryDelegationResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDelegationResponse) ProtoMessage() {} -func (*QueryDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{9} -} -func (m *QueryDelegationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegationResponse.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 *QueryDelegationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegationResponse.Merge(m, src) -} -func (m *QueryDelegationResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegationResponse proto.InternalMessageInfo - -func (m *QueryDelegationResponse) GetDelegationResponse() *DelegationResponse { - if m != nil { - return m.DelegationResponse - } - return nil -} - -// QueryUnbondingDelegationRequest is request type for the -// Query/UnbondingDelegation RPC method. -type QueryUnbondingDelegationRequest struct { - // delegator_addr defines the delegator address to query for. - DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` - // validator_addr defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` -} - -func (m *QueryUnbondingDelegationRequest) Reset() { *m = QueryUnbondingDelegationRequest{} } -func (m *QueryUnbondingDelegationRequest) String() string { return proto.CompactTextString(m) } -func (*QueryUnbondingDelegationRequest) ProtoMessage() {} -func (*QueryUnbondingDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{10} -} -func (m *QueryUnbondingDelegationRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUnbondingDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUnbondingDelegationRequest.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 *QueryUnbondingDelegationRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUnbondingDelegationRequest.Merge(m, src) -} -func (m *QueryUnbondingDelegationRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryUnbondingDelegationRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUnbondingDelegationRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUnbondingDelegationRequest proto.InternalMessageInfo - -// QueryDelegationResponse is response type for the Query/UnbondingDelegation -// RPC method. -type QueryUnbondingDelegationResponse struct { - // unbond defines the unbonding information of a delegation. - Unbond UnbondingDelegation `protobuf:"bytes,1,opt,name=unbond,proto3" json:"unbond"` -} - -func (m *QueryUnbondingDelegationResponse) Reset() { *m = QueryUnbondingDelegationResponse{} } -func (m *QueryUnbondingDelegationResponse) String() string { return proto.CompactTextString(m) } -func (*QueryUnbondingDelegationResponse) ProtoMessage() {} -func (*QueryUnbondingDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{11} -} -func (m *QueryUnbondingDelegationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUnbondingDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUnbondingDelegationResponse.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 *QueryUnbondingDelegationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUnbondingDelegationResponse.Merge(m, src) -} -func (m *QueryUnbondingDelegationResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryUnbondingDelegationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUnbondingDelegationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUnbondingDelegationResponse proto.InternalMessageInfo - -func (m *QueryUnbondingDelegationResponse) GetUnbond() UnbondingDelegation { - if m != nil { - return m.Unbond - } - return UnbondingDelegation{} -} - -// QueryDelegatorDelegationsRequest is request type for the -// Query/DelegatorDelegations RPC method. -type QueryDelegatorDelegationsRequest struct { - // delegator_addr defines the delegator address to query for. - DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDelegatorDelegationsRequest) Reset() { *m = QueryDelegatorDelegationsRequest{} } -func (m *QueryDelegatorDelegationsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDelegatorDelegationsRequest) ProtoMessage() {} -func (*QueryDelegatorDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{12} -} -func (m *QueryDelegatorDelegationsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorDelegationsRequest.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 *QueryDelegatorDelegationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorDelegationsRequest.Merge(m, src) -} -func (m *QueryDelegatorDelegationsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorDelegationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorDelegationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorDelegationsRequest proto.InternalMessageInfo - -// QueryDelegatorDelegationsResponse is response type for the -// Query/DelegatorDelegations RPC method. -type QueryDelegatorDelegationsResponse struct { - // delegation_responses defines all the delegations' info of a delegator. - DelegationResponses []DelegationResponse `protobuf:"bytes,1,rep,name=delegation_responses,json=delegationResponses,proto3" json:"delegation_responses"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDelegatorDelegationsResponse) Reset() { *m = QueryDelegatorDelegationsResponse{} } -func (m *QueryDelegatorDelegationsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDelegatorDelegationsResponse) ProtoMessage() {} -func (*QueryDelegatorDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{13} -} -func (m *QueryDelegatorDelegationsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorDelegationsResponse.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 *QueryDelegatorDelegationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorDelegationsResponse.Merge(m, src) -} -func (m *QueryDelegatorDelegationsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorDelegationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorDelegationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorDelegationsResponse proto.InternalMessageInfo - -func (m *QueryDelegatorDelegationsResponse) GetDelegationResponses() []DelegationResponse { - if m != nil { - return m.DelegationResponses - } - return nil -} - -func (m *QueryDelegatorDelegationsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryDelegatorUnbondingDelegationsRequest is request type for the -// Query/DelegatorUnbondingDelegations RPC method. -type QueryDelegatorUnbondingDelegationsRequest struct { - // delegator_addr defines the delegator address to query for. - DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDelegatorUnbondingDelegationsRequest) Reset() { - *m = QueryDelegatorUnbondingDelegationsRequest{} -} -func (m *QueryDelegatorUnbondingDelegationsRequest) String() string { - return proto.CompactTextString(m) -} -func (*QueryDelegatorUnbondingDelegationsRequest) ProtoMessage() {} -func (*QueryDelegatorUnbondingDelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{14} -} -func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.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 *QueryDelegatorUnbondingDelegationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.Merge(m, src) -} -func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorUnbondingDelegationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorUnbondingDelegationsRequest proto.InternalMessageInfo - -// QueryUnbondingDelegatorDelegationsResponse is response type for the -// Query/UnbondingDelegatorDelegations RPC method. -type QueryDelegatorUnbondingDelegationsResponse struct { - UnbondingResponses []UnbondingDelegation `protobuf:"bytes,1,rep,name=unbonding_responses,json=unbondingResponses,proto3" json:"unbonding_responses"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDelegatorUnbondingDelegationsResponse) Reset() { - *m = QueryDelegatorUnbondingDelegationsResponse{} -} -func (m *QueryDelegatorUnbondingDelegationsResponse) String() string { - return proto.CompactTextString(m) -} -func (*QueryDelegatorUnbondingDelegationsResponse) ProtoMessage() {} -func (*QueryDelegatorUnbondingDelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{15} -} -func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.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 *QueryDelegatorUnbondingDelegationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.Merge(m, src) -} -func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorUnbondingDelegationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorUnbondingDelegationsResponse proto.InternalMessageInfo - -func (m *QueryDelegatorUnbondingDelegationsResponse) GetUnbondingResponses() []UnbondingDelegation { - if m != nil { - return m.UnbondingResponses - } - return nil -} - -func (m *QueryDelegatorUnbondingDelegationsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryRedelegationsRequest is request type for the Query/Redelegations RPC -// method. -type QueryRedelegationsRequest struct { - // delegator_addr defines the delegator address to query for. - DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` - // src_validator_addr defines the validator address to redelegate from. - SrcValidatorAddr string `protobuf:"bytes,2,opt,name=src_validator_addr,json=srcValidatorAddr,proto3" json:"src_validator_addr,omitempty"` - // dst_validator_addr defines the validator address to redelegate to. - DstValidatorAddr string `protobuf:"bytes,3,opt,name=dst_validator_addr,json=dstValidatorAddr,proto3" json:"dst_validator_addr,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,4,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryRedelegationsRequest) Reset() { *m = QueryRedelegationsRequest{} } -func (m *QueryRedelegationsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRedelegationsRequest) ProtoMessage() {} -func (*QueryRedelegationsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{16} -} -func (m *QueryRedelegationsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRedelegationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRedelegationsRequest.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 *QueryRedelegationsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRedelegationsRequest.Merge(m, src) -} -func (m *QueryRedelegationsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRedelegationsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRedelegationsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRedelegationsRequest proto.InternalMessageInfo - -// QueryRedelegationsResponse is response type for the Query/Redelegations RPC -// method. -type QueryRedelegationsResponse struct { - RedelegationResponses []RedelegationResponse `protobuf:"bytes,1,rep,name=redelegation_responses,json=redelegationResponses,proto3" json:"redelegation_responses"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryRedelegationsResponse) Reset() { *m = QueryRedelegationsResponse{} } -func (m *QueryRedelegationsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRedelegationsResponse) ProtoMessage() {} -func (*QueryRedelegationsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{17} -} -func (m *QueryRedelegationsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRedelegationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRedelegationsResponse.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 *QueryRedelegationsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRedelegationsResponse.Merge(m, src) -} -func (m *QueryRedelegationsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRedelegationsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRedelegationsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRedelegationsResponse proto.InternalMessageInfo - -func (m *QueryRedelegationsResponse) GetRedelegationResponses() []RedelegationResponse { - if m != nil { - return m.RedelegationResponses - } - return nil -} - -func (m *QueryRedelegationsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryDelegatorValidatorsRequest is request type for the -// Query/DelegatorValidators RPC method. -type QueryDelegatorValidatorsRequest struct { - // delegator_addr defines the delegator address to query for. - DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDelegatorValidatorsRequest) Reset() { *m = QueryDelegatorValidatorsRequest{} } -func (m *QueryDelegatorValidatorsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDelegatorValidatorsRequest) ProtoMessage() {} -func (*QueryDelegatorValidatorsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{18} -} -func (m *QueryDelegatorValidatorsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorValidatorsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorValidatorsRequest.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 *QueryDelegatorValidatorsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorValidatorsRequest.Merge(m, src) -} -func (m *QueryDelegatorValidatorsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorValidatorsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorValidatorsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorValidatorsRequest proto.InternalMessageInfo - -// QueryDelegatorValidatorsResponse is response type for the -// Query/DelegatorValidators RPC method. -type QueryDelegatorValidatorsResponse struct { - // validators defines the the validators' info of a delegator. - Validators []Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryDelegatorValidatorsResponse) Reset() { *m = QueryDelegatorValidatorsResponse{} } -func (m *QueryDelegatorValidatorsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDelegatorValidatorsResponse) ProtoMessage() {} -func (*QueryDelegatorValidatorsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{19} -} -func (m *QueryDelegatorValidatorsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorValidatorsResponse.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 *QueryDelegatorValidatorsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorValidatorsResponse.Merge(m, src) -} -func (m *QueryDelegatorValidatorsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorValidatorsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorValidatorsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorValidatorsResponse proto.InternalMessageInfo - -func (m *QueryDelegatorValidatorsResponse) GetValidators() []Validator { - if m != nil { - return m.Validators - } - return nil -} - -func (m *QueryDelegatorValidatorsResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryDelegatorValidatorRequest is request type for the -// Query/DelegatorValidator RPC method. -type QueryDelegatorValidatorRequest struct { - // delegator_addr defines the delegator address to query for. - DelegatorAddr string `protobuf:"bytes,1,opt,name=delegator_addr,json=delegatorAddr,proto3" json:"delegator_addr,omitempty"` - // validator_addr defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,2,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` -} - -func (m *QueryDelegatorValidatorRequest) Reset() { *m = QueryDelegatorValidatorRequest{} } -func (m *QueryDelegatorValidatorRequest) String() string { return proto.CompactTextString(m) } -func (*QueryDelegatorValidatorRequest) ProtoMessage() {} -func (*QueryDelegatorValidatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{20} -} -func (m *QueryDelegatorValidatorRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorValidatorRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorValidatorRequest.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 *QueryDelegatorValidatorRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorValidatorRequest.Merge(m, src) -} -func (m *QueryDelegatorValidatorRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorValidatorRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorValidatorRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorValidatorRequest proto.InternalMessageInfo - -// QueryDelegatorValidatorResponse response type for the -// Query/DelegatorValidator RPC method. -type QueryDelegatorValidatorResponse struct { - // validator defines the the validator info. - Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` -} - -func (m *QueryDelegatorValidatorResponse) Reset() { *m = QueryDelegatorValidatorResponse{} } -func (m *QueryDelegatorValidatorResponse) String() string { return proto.CompactTextString(m) } -func (*QueryDelegatorValidatorResponse) ProtoMessage() {} -func (*QueryDelegatorValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{21} -} -func (m *QueryDelegatorValidatorResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryDelegatorValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryDelegatorValidatorResponse.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 *QueryDelegatorValidatorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryDelegatorValidatorResponse.Merge(m, src) -} -func (m *QueryDelegatorValidatorResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryDelegatorValidatorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryDelegatorValidatorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryDelegatorValidatorResponse proto.InternalMessageInfo - -func (m *QueryDelegatorValidatorResponse) GetValidator() Validator { - if m != nil { - return m.Validator - } - return Validator{} -} - -// QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC -// method. -type QueryHistoricalInfoRequest struct { - // height defines at which height to query the historical info. - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` -} - -func (m *QueryHistoricalInfoRequest) Reset() { *m = QueryHistoricalInfoRequest{} } -func (m *QueryHistoricalInfoRequest) String() string { return proto.CompactTextString(m) } -func (*QueryHistoricalInfoRequest) ProtoMessage() {} -func (*QueryHistoricalInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{22} -} -func (m *QueryHistoricalInfoRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryHistoricalInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryHistoricalInfoRequest.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 *QueryHistoricalInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryHistoricalInfoRequest.Merge(m, src) -} -func (m *QueryHistoricalInfoRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryHistoricalInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryHistoricalInfoRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryHistoricalInfoRequest proto.InternalMessageInfo - -func (m *QueryHistoricalInfoRequest) GetHeight() int64 { - if m != nil { - return m.Height - } - return 0 -} - -// QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC -// method. -type QueryHistoricalInfoResponse struct { - // hist defines the historical info at the given height. - Hist *HistoricalInfo `protobuf:"bytes,1,opt,name=hist,proto3" json:"hist,omitempty"` -} - -func (m *QueryHistoricalInfoResponse) Reset() { *m = QueryHistoricalInfoResponse{} } -func (m *QueryHistoricalInfoResponse) String() string { return proto.CompactTextString(m) } -func (*QueryHistoricalInfoResponse) ProtoMessage() {} -func (*QueryHistoricalInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{23} -} -func (m *QueryHistoricalInfoResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryHistoricalInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryHistoricalInfoResponse.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 *QueryHistoricalInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryHistoricalInfoResponse.Merge(m, src) -} -func (m *QueryHistoricalInfoResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryHistoricalInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryHistoricalInfoResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryHistoricalInfoResponse proto.InternalMessageInfo - -func (m *QueryHistoricalInfoResponse) GetHist() *HistoricalInfo { - if m != nil { - return m.Hist - } - return nil -} - -// QueryPoolRequest is request type for the Query/Pool RPC method. -type QueryPoolRequest struct { -} - -func (m *QueryPoolRequest) Reset() { *m = QueryPoolRequest{} } -func (m *QueryPoolRequest) String() string { return proto.CompactTextString(m) } -func (*QueryPoolRequest) ProtoMessage() {} -func (*QueryPoolRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{24} -} -func (m *QueryPoolRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPoolRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPoolRequest.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 *QueryPoolRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPoolRequest.Merge(m, src) -} -func (m *QueryPoolRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryPoolRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPoolRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPoolRequest proto.InternalMessageInfo - -// QueryPoolResponse is response type for the Query/Pool RPC method. -type QueryPoolResponse struct { - // pool defines the pool info. - Pool Pool `protobuf:"bytes,1,opt,name=pool,proto3" json:"pool"` -} - -func (m *QueryPoolResponse) Reset() { *m = QueryPoolResponse{} } -func (m *QueryPoolResponse) String() string { return proto.CompactTextString(m) } -func (*QueryPoolResponse) ProtoMessage() {} -func (*QueryPoolResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_f270127f442bbcd8, []int{25} -} -func (m *QueryPoolResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPoolResponse.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 *QueryPoolResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPoolResponse.Merge(m, src) -} -func (m *QueryPoolResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryPoolResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPoolResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPoolResponse proto.InternalMessageInfo - -func (m *QueryPoolResponse) GetPool() Pool { - if m != nil { - return m.Pool - } - return Pool{} -} - -// QueryParamsRequest is 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_f270127f442bbcd8, []int{26} -} -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 response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - 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_f270127f442bbcd8, []int{27} -} -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{} -} - -func init() { - proto.RegisterType((*QueryValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorsRequest") - proto.RegisterType((*QueryValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorsResponse") - proto.RegisterType((*QueryValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorRequest") - proto.RegisterType((*QueryValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorResponse") - proto.RegisterType((*QueryValidatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsRequest") - proto.RegisterType((*QueryValidatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorDelegationsResponse") - proto.RegisterType((*QueryValidatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest") - proto.RegisterType((*QueryValidatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse") - proto.RegisterType((*QueryDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryDelegationRequest") - proto.RegisterType((*QueryDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryDelegationResponse") - proto.RegisterType((*QueryUnbondingDelegationRequest)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationRequest") - proto.RegisterType((*QueryUnbondingDelegationResponse)(nil), "cosmos.staking.v1beta1.QueryUnbondingDelegationResponse") - proto.RegisterType((*QueryDelegatorDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest") - proto.RegisterType((*QueryDelegatorDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse") - proto.RegisterType((*QueryDelegatorUnbondingDelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest") - proto.RegisterType((*QueryDelegatorUnbondingDelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse") - proto.RegisterType((*QueryRedelegationsRequest)(nil), "cosmos.staking.v1beta1.QueryRedelegationsRequest") - proto.RegisterType((*QueryRedelegationsResponse)(nil), "cosmos.staking.v1beta1.QueryRedelegationsResponse") - proto.RegisterType((*QueryDelegatorValidatorsRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest") - proto.RegisterType((*QueryDelegatorValidatorsResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse") - proto.RegisterType((*QueryDelegatorValidatorRequest)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorRequest") - proto.RegisterType((*QueryDelegatorValidatorResponse)(nil), "cosmos.staking.v1beta1.QueryDelegatorValidatorResponse") - proto.RegisterType((*QueryHistoricalInfoRequest)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoRequest") - proto.RegisterType((*QueryHistoricalInfoResponse)(nil), "cosmos.staking.v1beta1.QueryHistoricalInfoResponse") - proto.RegisterType((*QueryPoolRequest)(nil), "cosmos.staking.v1beta1.QueryPoolRequest") - proto.RegisterType((*QueryPoolResponse)(nil), "cosmos.staking.v1beta1.QueryPoolResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.staking.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.staking.v1beta1.QueryParamsResponse") -} - -func init() { - proto.RegisterFile("cosmos/staking/v1beta1/query.proto", fileDescriptor_f270127f442bbcd8) -} - -var fileDescriptor_f270127f442bbcd8 = []byte{ - // 1313 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0xcd, 0x6f, 0x1b, 0x55, - 0x10, 0xf7, 0x6b, 0x43, 0x44, 0xa7, 0x6a, 0x55, 0x9e, 0xd3, 0x50, 0xb6, 0xc5, 0x4e, 0x57, 0x25, - 0xa4, 0x69, 0xe2, 0x25, 0x49, 0x49, 0x43, 0xa9, 0x0a, 0x09, 0xa5, 0x25, 0xca, 0x81, 0xc4, 0x88, - 0xf0, 0x75, 0x88, 0xd6, 0xde, 0xed, 0x7a, 0x55, 0x7b, 0x9f, 0xbb, 0xbb, 0x8e, 0x5a, 0xa2, 0x1c, - 0xe0, 0x04, 0x37, 0x10, 0x27, 0xe0, 0xd2, 0x03, 0x12, 0x12, 0x1c, 0xe1, 0x1f, 0xe0, 0x44, 0xb9, - 0x05, 0xc1, 0x01, 0x2e, 0x05, 0x25, 0x1c, 0x2a, 0x4e, 0xdc, 0x10, 0x37, 0xe4, 0xb7, 0xb3, 0xeb, - 0xdd, 0xec, 0xa7, 0x1d, 0x47, 0x51, 0x4f, 0xb1, 0x9f, 0xe7, 0xe3, 0xf7, 0x9b, 0x79, 0x33, 0x6f, - 0x46, 0x01, 0xb1, 0xca, 0xac, 0x06, 0xb3, 0x24, 0xcb, 0x96, 0x6f, 0xe9, 0x86, 0x26, 0xad, 0x4f, - 0x55, 0x54, 0x5b, 0x9e, 0x92, 0x6e, 0xb7, 0x54, 0xf3, 0x6e, 0xa9, 0x69, 0x32, 0x9b, 0xd1, 0x61, - 0x47, 0xa6, 0x84, 0x32, 0x25, 0x94, 0x11, 0xc6, 0x51, 0xb7, 0x22, 0x5b, 0xaa, 0xa3, 0xe0, 0xa9, - 0x37, 0x65, 0x4d, 0x37, 0x64, 0x5b, 0x67, 0x86, 0x63, 0x43, 0x18, 0xd2, 0x98, 0xc6, 0xf8, 0x47, - 0xa9, 0xfd, 0x09, 0x4f, 0xcf, 0x68, 0x8c, 0x69, 0x75, 0x55, 0x92, 0x9b, 0xba, 0x24, 0x1b, 0x06, - 0xb3, 0xb9, 0x8a, 0x85, 0xbf, 0x9e, 0x8b, 0xc1, 0xe6, 0xe2, 0xe0, 0x52, 0xe2, 0x1d, 0x18, 0x5e, - 0x69, 0xfb, 0x5e, 0x95, 0xeb, 0xba, 0x22, 0xdb, 0xcc, 0xb4, 0xca, 0xea, 0xed, 0x96, 0x6a, 0xd9, - 0x74, 0x18, 0x06, 0x2d, 0x5b, 0xb6, 0x5b, 0xd6, 0x29, 0x32, 0x42, 0xc6, 0x8e, 0x94, 0xf1, 0x1b, - 0xbd, 0x0e, 0xd0, 0xc1, 0x77, 0xea, 0xd0, 0x08, 0x19, 0x3b, 0x3a, 0x3d, 0x5a, 0x42, 0x92, 0x6d, - 0x32, 0x25, 0x87, 0x3d, 0xfa, 0x2b, 0x2d, 0xcb, 0x9a, 0x8a, 0x36, 0xcb, 0x3e, 0x4d, 0xf1, 0x5b, - 0x02, 0x4f, 0x86, 0x5c, 0x5b, 0x4d, 0x66, 0x58, 0x2a, 0xbd, 0x01, 0xb0, 0xee, 0x9d, 0x9e, 0x22, - 0x23, 0x87, 0xc7, 0x8e, 0x4e, 0x9f, 0x2d, 0x45, 0x07, 0xb2, 0xe4, 0xe9, 0x2f, 0x0c, 0xdc, 0x7f, - 0x50, 0xcc, 0x95, 0x7d, 0xaa, 0x6d, 0x43, 0x21, 0xb0, 0xcf, 0xa6, 0x82, 0x75, 0x50, 0x04, 0xd0, - 0x5e, 0x85, 0x93, 0x41, 0xb0, 0x6e, 0x98, 0x9e, 0x81, 0xe3, 0x9e, 0xbf, 0x35, 0x59, 0x51, 0x4c, - 0x0c, 0xd7, 0x31, 0xef, 0x74, 0x5e, 0x51, 0x4c, 0x71, 0x6d, 0x77, 0x9c, 0x3d, 0xae, 0xaf, 0xc2, - 0x11, 0x4f, 0x94, 0xeb, 0x76, 0x41, 0xb5, 0xa3, 0x29, 0x7e, 0x4a, 0x60, 0x24, 0xe8, 0xe1, 0x9a, - 0x5a, 0x57, 0x35, 0xe7, 0x4a, 0x74, 0x07, 0xb6, 0x6f, 0x29, 0x7e, 0x48, 0xe0, 0x6c, 0x02, 0x26, - 0x0c, 0xc0, 0xfb, 0x30, 0xa4, 0x78, 0xc7, 0x6b, 0x26, 0x1e, 0xbb, 0x69, 0x1f, 0x8f, 0x8b, 0x45, - 0xc7, 0x94, 0x6b, 0x69, 0xe1, 0x74, 0x3b, 0x28, 0xdf, 0xfc, 0x51, 0xcc, 0x87, 0x7f, 0xb3, 0xca, - 0x79, 0x25, 0x7c, 0xd8, 0xbf, 0xfb, 0xf1, 0x05, 0x81, 0xf3, 0x41, 0xaa, 0x6f, 0x1a, 0x15, 0x66, - 0x28, 0xba, 0xa1, 0x1d, 0x7c, 0x1e, 0x7e, 0x27, 0x30, 0x9e, 0x05, 0x1c, 0x26, 0xa4, 0x02, 0xf9, - 0x96, 0xfb, 0x7b, 0x28, 0x1f, 0x17, 0xe2, 0xf2, 0x11, 0x61, 0x12, 0x6f, 0x29, 0xf5, 0xac, 0xed, - 0x43, 0xe0, 0x9b, 0x58, 0x58, 0xfe, 0x94, 0x7b, 0x41, 0xc6, 0x94, 0xef, 0x0a, 0xb2, 0x77, 0xca, - 0x83, 0x1c, 0xce, 0xc5, 0xa1, 0x88, 0x5c, 0x5c, 0x7e, 0xfc, 0xa3, 0x7b, 0xc5, 0xdc, 0xc3, 0x7b, - 0xc5, 0x9c, 0xb8, 0x8e, 0x7d, 0x2b, 0x7c, 0xc9, 0xe8, 0x7b, 0x90, 0x8f, 0xb8, 0xca, 0x58, 0xd5, - 0x5d, 0xdc, 0xe4, 0x32, 0x0d, 0x5f, 0x56, 0xf1, 0x2e, 0x14, 0xb9, 0xdf, 0x88, 0x40, 0xef, 0x37, - 0xe5, 0x06, 0xf6, 0x96, 0x48, 0xd7, 0xc8, 0x7d, 0x11, 0x06, 0x9d, 0x3c, 0x23, 0xdd, 0x1e, 0x2e, - 0x0a, 0x1a, 0x10, 0xbf, 0x74, 0x7b, 0xd9, 0x35, 0x17, 0x76, 0x74, 0x0d, 0x65, 0xe1, 0xda, 0xa7, - 0x1a, 0xf2, 0x05, 0xe3, 0x67, 0xb7, 0xab, 0x45, 0xa3, 0xc3, 0x70, 0x54, 0xfb, 0xd6, 0xd5, 0x9c, - 0xd8, 0xec, 0x6f, 0xfb, 0xfa, 0xca, 0x6d, 0x5f, 0x1e, 0xa7, 0x94, 0xf6, 0x75, 0x30, 0xa1, 0xf7, - 0x1a, 0x59, 0x0a, 0xcc, 0x47, 0xb1, 0x91, 0xfd, 0x43, 0xe0, 0x29, 0xce, 0xad, 0xac, 0x2a, 0x3d, - 0x87, 0x7c, 0x02, 0xa8, 0x65, 0x56, 0xd7, 0x22, 0xab, 0xfb, 0x84, 0x65, 0x56, 0x57, 0x03, 0xef, - 0xcb, 0x04, 0x50, 0xc5, 0xb2, 0x77, 0x4b, 0x1f, 0x76, 0xa4, 0x15, 0xcb, 0x5e, 0x4d, 0x78, 0x8d, - 0x06, 0xfa, 0x90, 0xce, 0x2d, 0x02, 0x42, 0x14, 0x65, 0x4c, 0x9f, 0x0e, 0xc3, 0xa6, 0x9a, 0x50, - 0x44, 0x13, 0x71, 0x19, 0xf4, 0x9b, 0xdb, 0x55, 0x46, 0x27, 0x4d, 0x75, 0xbf, 0xe7, 0x80, 0x62, - 0xf0, 0x86, 0x86, 0x27, 0xeb, 0x03, 0x2b, 0x9f, 0xef, 0x43, 0x7d, 0xf5, 0x91, 0x98, 0xbd, 0xef, - 0x40, 0x21, 0x06, 0xf5, 0x7e, 0xbf, 0x7b, 0xb5, 0xd8, 0x64, 0xf6, 0x7b, 0x7c, 0xbf, 0x88, 0x95, - 0xf0, 0x9a, 0x6e, 0xd9, 0xcc, 0xd4, 0xab, 0x72, 0x7d, 0xd1, 0xb8, 0xc9, 0x7c, 0xbb, 0x58, 0x4d, - 0xd5, 0xb5, 0x9a, 0xcd, 0x3d, 0x1c, 0x2e, 0xe3, 0x37, 0xf1, 0x1d, 0x38, 0x1d, 0xa9, 0x85, 0xd8, - 0x2e, 0xc3, 0x40, 0x4d, 0xb7, 0x6c, 0x84, 0x35, 0x1a, 0x07, 0x6b, 0x97, 0x36, 0xd7, 0x11, 0x29, - 0x9c, 0xe0, 0xa6, 0x97, 0x19, 0xab, 0x23, 0x0c, 0x71, 0x09, 0x9e, 0xf0, 0x9d, 0xa1, 0x93, 0x59, - 0x18, 0x68, 0x32, 0x56, 0x47, 0x27, 0x67, 0xe2, 0x9c, 0xb4, 0x75, 0x90, 0x36, 0x97, 0x17, 0x87, - 0x80, 0x3a, 0xc6, 0x64, 0x53, 0x6e, 0xb8, 0xb5, 0x21, 0xbe, 0x01, 0xf9, 0xc0, 0x29, 0x3a, 0xb9, - 0x02, 0x83, 0x4d, 0x7e, 0x82, 0x6e, 0x0a, 0xb1, 0x6e, 0xb8, 0x94, 0x3b, 0x4f, 0x38, 0x3a, 0xd3, - 0x7f, 0x9f, 0x84, 0xc7, 0xb8, 0x55, 0xfa, 0x39, 0x01, 0xe8, 0xdc, 0x79, 0x5a, 0x8a, 0x33, 0x13, - 0xbd, 0x13, 0x0b, 0x52, 0x66, 0x79, 0x9c, 0xd9, 0xc6, 0x3f, 0xfc, 0xe5, 0xaf, 0xcf, 0x0e, 0x9d, - 0xa3, 0xa2, 0x14, 0xb3, 0x8d, 0xfb, 0xea, 0xe5, 0x6b, 0x02, 0x47, 0x3c, 0x13, 0x74, 0x32, 0x9b, - 0x2b, 0x17, 0x59, 0x29, 0xab, 0x38, 0x02, 0x7b, 0x91, 0x03, 0x7b, 0x9e, 0xce, 0xa4, 0x03, 0x93, - 0x36, 0x82, 0x45, 0xb3, 0x49, 0x7f, 0x25, 0x30, 0x14, 0xb5, 0xd2, 0xd1, 0xb9, 0x6c, 0x28, 0xc2, - 0x23, 0x85, 0xf0, 0x42, 0x0f, 0x9a, 0x48, 0xe5, 0x06, 0xa7, 0x32, 0x4f, 0x5f, 0xea, 0x81, 0x8a, - 0xe4, 0x7b, 0x77, 0xe8, 0x7f, 0x04, 0x9e, 0x4e, 0xdc, 0x90, 0xe8, 0x7c, 0x36, 0x94, 0x09, 0xb3, - 0x93, 0xb0, 0xb0, 0x17, 0x13, 0xc8, 0x78, 0x85, 0x33, 0x5e, 0xa2, 0x8b, 0xbd, 0x30, 0xee, 0x4c, - 0x44, 0x7e, 0xee, 0x3f, 0x12, 0x80, 0x8e, 0xab, 0x94, 0xc2, 0x08, 0x2d, 0x1e, 0x29, 0x85, 0x11, - 0x1e, 0x6a, 0xc5, 0xb7, 0x39, 0x85, 0x32, 0x5d, 0xde, 0x63, 0xd2, 0xa4, 0x8d, 0x60, 0xe3, 0xdf, - 0xa4, 0xff, 0x12, 0xc8, 0x47, 0x44, 0x8f, 0x5e, 0x4a, 0x84, 0x18, 0xbf, 0x54, 0x09, 0x73, 0xdd, - 0x2b, 0x22, 0xc9, 0x06, 0x27, 0xa9, 0x51, 0xb5, 0xdf, 0x24, 0x23, 0x93, 0x48, 0x7f, 0x22, 0x30, - 0x14, 0xb5, 0x93, 0xa4, 0x94, 0x65, 0xc2, 0x92, 0x95, 0x52, 0x96, 0x49, 0x0b, 0x90, 0x78, 0x85, - 0x93, 0x9f, 0xa5, 0x17, 0xe3, 0xc8, 0x27, 0x66, 0xb1, 0x5d, 0x8b, 0x89, 0x43, 0x7e, 0x4a, 0x2d, - 0x66, 0xd9, 0x63, 0x52, 0x6a, 0x31, 0xd3, 0x8e, 0x91, 0x5e, 0x8b, 0x1e, 0xb3, 0x8c, 0x69, 0xb4, - 0xe8, 0x0f, 0x04, 0x8e, 0x05, 0x26, 0x62, 0x3a, 0x95, 0x08, 0x34, 0x6a, 0x61, 0x10, 0xa6, 0xbb, - 0x51, 0x41, 0x2e, 0x8b, 0x9c, 0xcb, 0x2b, 0x74, 0xbe, 0x17, 0x2e, 0x66, 0x00, 0xf1, 0x16, 0x81, - 0x7c, 0xc4, 0x94, 0x99, 0x52, 0x85, 0xf1, 0x43, 0xb3, 0x30, 0xd7, 0xbd, 0x22, 0xb2, 0xba, 0xce, - 0x59, 0xbd, 0x4c, 0xaf, 0xf6, 0xc2, 0xca, 0xf7, 0x3e, 0x3f, 0x20, 0x40, 0xc3, 0x7e, 0xe8, 0x6c, - 0x97, 0xc0, 0x5c, 0x42, 0x97, 0xba, 0xd6, 0x43, 0x3e, 0x6f, 0x71, 0x3e, 0x2b, 0xf4, 0xf5, 0xbd, - 0xf1, 0x09, 0x3f, 0xeb, 0xdf, 0x11, 0x38, 0x1e, 0x9c, 0x05, 0x69, 0xf2, 0x2d, 0x8a, 0x1c, 0x56, - 0x85, 0x99, 0xae, 0x74, 0x90, 0xd4, 0x1c, 0x27, 0x35, 0x4d, 0x9f, 0x8b, 0x23, 0x55, 0xf3, 0xf4, - 0xd6, 0x74, 0xe3, 0x26, 0x93, 0x36, 0x9c, 0x11, 0x78, 0x93, 0x7e, 0x40, 0x60, 0xa0, 0x3d, 0x5c, - 0xd2, 0xb1, 0x44, 0xbf, 0xbe, 0x39, 0x56, 0x38, 0x9f, 0x41, 0x12, 0x71, 0x9d, 0xe3, 0xb8, 0x0a, - 0xf4, 0x4c, 0x1c, 0xae, 0xf6, 0x2c, 0x4b, 0x3f, 0x26, 0x30, 0xe8, 0x4c, 0x9e, 0x74, 0x3c, 0xd9, - 0xb6, 0x7f, 0xd8, 0x15, 0x2e, 0x64, 0x92, 0x45, 0x24, 0xa3, 0x1c, 0xc9, 0x08, 0x2d, 0xc4, 0x22, - 0x71, 0x46, 0xdf, 0xa5, 0xfb, 0xdb, 0x05, 0xb2, 0xb5, 0x5d, 0x20, 0x7f, 0x6e, 0x17, 0xc8, 0x27, - 0x3b, 0x85, 0xdc, 0xd6, 0x4e, 0x21, 0xf7, 0xdb, 0x4e, 0x21, 0xf7, 0xee, 0x94, 0xa6, 0xdb, 0xb5, - 0x56, 0xa5, 0x54, 0x65, 0x0d, 0x49, 0x37, 0x75, 0xcb, 0x50, 0x6d, 0xfe, 0xb7, 0xd6, 0xaa, 0x4c, - 0x5a, 0xca, 0xad, 0x49, 0x8d, 0x49, 0x0d, 0xa6, 0xb4, 0xea, 0xaa, 0x67, 0xbb, 0x32, 0xc8, 0xff, - 0x4b, 0x34, 0xf3, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7a, 0x48, 0xc1, 0x5d, 0xe9, 0x1a, 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 { - // Validators queries all validators that match the given status. - Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) - // Validator queries validator info for given validator address. - Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) - // ValidatorDelegations queries delegate info for given validator. - ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) - // ValidatorUnbondingDelegations queries unbonding delegations of a validator. - ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) - // Delegation queries delegate info for given validator delegator pair. - Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) - // UnbondingDelegation queries unbonding info for given validator delegator - // pair. - UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) - // DelegatorDelegations queries all delegations of a given delegator address. - DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) - // DelegatorUnbondingDelegations queries all unbonding delegations of a given - // delegator address. - DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) - // Redelegations queries redelegations of given address. - Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) - // DelegatorValidators queries all validators info for given delegator - // address. - DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) - // DelegatorValidator queries validator info for given delegator validator - // pair. - DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) - // HistoricalInfo queries the historical info for given height. - HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) - // Pool queries the pool info. - Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) - // Parameters queries the staking parameters. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Validators(ctx context.Context, in *QueryValidatorsRequest, opts ...grpc.CallOption) (*QueryValidatorsResponse, error) { - out := new(QueryValidatorsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validators", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Validator(ctx context.Context, in *QueryValidatorRequest, opts ...grpc.CallOption) (*QueryValidatorResponse, error) { - out := new(QueryValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Validator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ValidatorDelegations(ctx context.Context, in *QueryValidatorDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorDelegationsResponse, error) { - out := new(QueryValidatorDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorDelegations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ValidatorUnbondingDelegations(ctx context.Context, in *QueryValidatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryValidatorUnbondingDelegationsResponse, error) { - out := new(QueryValidatorUnbondingDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Delegation(ctx context.Context, in *QueryDelegationRequest, opts ...grpc.CallOption) (*QueryDelegationResponse, error) { - out := new(QueryDelegationResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Delegation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) UnbondingDelegation(ctx context.Context, in *QueryUnbondingDelegationRequest, opts ...grpc.CallOption) (*QueryUnbondingDelegationResponse, error) { - out := new(QueryUnbondingDelegationResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/UnbondingDelegation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DelegatorDelegations(ctx context.Context, in *QueryDelegatorDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorDelegationsResponse, error) { - out := new(QueryDelegatorDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorDelegations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DelegatorUnbondingDelegations(ctx context.Context, in *QueryDelegatorUnbondingDelegationsRequest, opts ...grpc.CallOption) (*QueryDelegatorUnbondingDelegationsResponse, error) { - out := new(QueryDelegatorUnbondingDelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Redelegations(ctx context.Context, in *QueryRedelegationsRequest, opts ...grpc.CallOption) (*QueryRedelegationsResponse, error) { - out := new(QueryRedelegationsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Redelegations", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DelegatorValidators(ctx context.Context, in *QueryDelegatorValidatorsRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorsResponse, error) { - out := new(QueryDelegatorValidatorsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidators", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) DelegatorValidator(ctx context.Context, in *QueryDelegatorValidatorRequest, opts ...grpc.CallOption) (*QueryDelegatorValidatorResponse, error) { - out := new(QueryDelegatorValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/DelegatorValidator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) HistoricalInfo(ctx context.Context, in *QueryHistoricalInfoRequest, opts ...grpc.CallOption) (*QueryHistoricalInfoResponse, error) { - out := new(QueryHistoricalInfoResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/HistoricalInfo", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) { - out := new(QueryPoolResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Pool", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Validators queries all validators that match the given status. - Validators(context.Context, *QueryValidatorsRequest) (*QueryValidatorsResponse, error) - // Validator queries validator info for given validator address. - Validator(context.Context, *QueryValidatorRequest) (*QueryValidatorResponse, error) - // ValidatorDelegations queries delegate info for given validator. - ValidatorDelegations(context.Context, *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) - // ValidatorUnbondingDelegations queries unbonding delegations of a validator. - ValidatorUnbondingDelegations(context.Context, *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) - // Delegation queries delegate info for given validator delegator pair. - Delegation(context.Context, *QueryDelegationRequest) (*QueryDelegationResponse, error) - // UnbondingDelegation queries unbonding info for given validator delegator - // pair. - UnbondingDelegation(context.Context, *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) - // DelegatorDelegations queries all delegations of a given delegator address. - DelegatorDelegations(context.Context, *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) - // DelegatorUnbondingDelegations queries all unbonding delegations of a given - // delegator address. - DelegatorUnbondingDelegations(context.Context, *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) - // Redelegations queries redelegations of given address. - Redelegations(context.Context, *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) - // DelegatorValidators queries all validators info for given delegator - // address. - DelegatorValidators(context.Context, *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) - // DelegatorValidator queries validator info for given delegator validator - // pair. - DelegatorValidator(context.Context, *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) - // HistoricalInfo queries the historical info for given height. - HistoricalInfo(context.Context, *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) - // Pool queries the pool info. - Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error) - // Parameters queries the staking parameters. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Validators(ctx context.Context, req *QueryValidatorsRequest) (*QueryValidatorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Validators not implemented") -} -func (*UnimplementedQueryServer) Validator(ctx context.Context, req *QueryValidatorRequest) (*QueryValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Validator not implemented") -} -func (*UnimplementedQueryServer) ValidatorDelegations(ctx context.Context, req *QueryValidatorDelegationsRequest) (*QueryValidatorDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidatorDelegations not implemented") -} -func (*UnimplementedQueryServer) ValidatorUnbondingDelegations(ctx context.Context, req *QueryValidatorUnbondingDelegationsRequest) (*QueryValidatorUnbondingDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidatorUnbondingDelegations not implemented") -} -func (*UnimplementedQueryServer) Delegation(ctx context.Context, req *QueryDelegationRequest) (*QueryDelegationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delegation not implemented") -} -func (*UnimplementedQueryServer) UnbondingDelegation(ctx context.Context, req *QueryUnbondingDelegationRequest) (*QueryUnbondingDelegationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UnbondingDelegation not implemented") -} -func (*UnimplementedQueryServer) DelegatorDelegations(ctx context.Context, req *QueryDelegatorDelegationsRequest) (*QueryDelegatorDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorDelegations not implemented") -} -func (*UnimplementedQueryServer) DelegatorUnbondingDelegations(ctx context.Context, req *QueryDelegatorUnbondingDelegationsRequest) (*QueryDelegatorUnbondingDelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorUnbondingDelegations not implemented") -} -func (*UnimplementedQueryServer) Redelegations(ctx context.Context, req *QueryRedelegationsRequest) (*QueryRedelegationsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Redelegations not implemented") -} -func (*UnimplementedQueryServer) DelegatorValidators(ctx context.Context, req *QueryDelegatorValidatorsRequest) (*QueryDelegatorValidatorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidators not implemented") -} -func (*UnimplementedQueryServer) DelegatorValidator(ctx context.Context, req *QueryDelegatorValidatorRequest) (*QueryDelegatorValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegatorValidator not implemented") -} -func (*UnimplementedQueryServer) HistoricalInfo(ctx context.Context, req *QueryHistoricalInfoRequest) (*QueryHistoricalInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HistoricalInfo not implemented") -} -func (*UnimplementedQueryServer) Pool(ctx context.Context, req *QueryPoolRequest) (*QueryPoolResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Pool not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Validators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Validators(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Validators", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Validators(ctx, req.(*QueryValidatorsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Validator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Validator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Validator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Validator(ctx, req.(*QueryValidatorRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ValidatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ValidatorDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ValidatorDelegations(ctx, req.(*QueryValidatorDelegationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ValidatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidatorUnbondingDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ValidatorUnbondingDelegations(ctx, req.(*QueryValidatorUnbondingDelegationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Delegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Delegation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Delegation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Delegation(ctx, req.(*QueryDelegationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_UnbondingDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUnbondingDelegationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).UnbondingDelegation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/UnbondingDelegation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UnbondingDelegation(ctx, req.(*QueryUnbondingDelegationRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DelegatorDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorDelegations(ctx, req.(*QueryDelegatorDelegationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DelegatorUnbondingDelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorUnbondingDelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorUnbondingDelegations(ctx, req.(*QueryDelegatorUnbondingDelegationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Redelegations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRedelegationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Redelegations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Redelegations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Redelegations(ctx, req.(*QueryRedelegationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DelegatorValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorValidatorsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorValidators(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidators", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorValidators(ctx, req.(*QueryDelegatorValidatorsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_DelegatorValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDelegatorValidatorRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).DelegatorValidator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/DelegatorValidator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DelegatorValidator(ctx, req.(*QueryDelegatorValidatorRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_HistoricalInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryHistoricalInfoRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).HistoricalInfo(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/HistoricalInfo", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).HistoricalInfo(ctx, req.(*QueryHistoricalInfoRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Pool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryPoolRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Pool(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Query/Pool", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Pool(ctx, req.(*QueryPoolRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/cosmos.staking.v1beta1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.staking.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Validators", - Handler: _Query_Validators_Handler, - }, - { - MethodName: "Validator", - Handler: _Query_Validator_Handler, - }, - { - MethodName: "ValidatorDelegations", - Handler: _Query_ValidatorDelegations_Handler, - }, - { - MethodName: "ValidatorUnbondingDelegations", - Handler: _Query_ValidatorUnbondingDelegations_Handler, - }, - { - MethodName: "Delegation", - Handler: _Query_Delegation_Handler, - }, - { - MethodName: "UnbondingDelegation", - Handler: _Query_UnbondingDelegation_Handler, - }, - { - MethodName: "DelegatorDelegations", - Handler: _Query_DelegatorDelegations_Handler, - }, - { - MethodName: "DelegatorUnbondingDelegations", - Handler: _Query_DelegatorUnbondingDelegations_Handler, - }, - { - MethodName: "Redelegations", - Handler: _Query_Redelegations_Handler, - }, - { - MethodName: "DelegatorValidators", - Handler: _Query_DelegatorValidators_Handler, - }, - { - MethodName: "DelegatorValidator", - Handler: _Query_DelegatorValidator_Handler, - }, - { - MethodName: "HistoricalInfo", - Handler: _Query_HistoricalInfo_Handler, - }, - { - MethodName: "Pool", - Handler: _Query_Pool_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/staking/v1beta1/query.proto", -} - -func (m *QueryValidatorsRequest) 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 *QueryValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorsRequest) 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.Status) > 0 { - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryValidatorsResponse) 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 *QueryValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorsResponse) 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.Validators) > 0 { - for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Validators[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 *QueryValidatorRequest) 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 *QueryValidatorRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryValidatorResponse) 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 *QueryValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Validator.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 *QueryValidatorDelegationsRequest) 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 *QueryValidatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorDelegationsRequest) 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.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryValidatorDelegationsResponse) 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 *QueryValidatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorDelegationsResponse) 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.DelegationResponses) > 0 { - for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DelegationResponses[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 *QueryValidatorUnbondingDelegationsRequest) 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 *QueryValidatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorUnbondingDelegationsRequest) 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.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryValidatorUnbondingDelegationsResponse) 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 *QueryValidatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidatorUnbondingDelegationsResponse) 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.UnbondingResponses) > 0 { - for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingResponses[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 *QueryDelegationRequest) 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 *QueryDelegationRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDelegationResponse) 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 *QueryDelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.DelegationResponse != nil { - { - size, err := m.DelegationResponse.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 *QueryUnbondingDelegationRequest) 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 *QueryUnbondingDelegationRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUnbondingDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryUnbondingDelegationResponse) 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 *QueryUnbondingDelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUnbondingDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Unbond.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 *QueryDelegatorDelegationsRequest) 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 *QueryDelegatorDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorDelegationsRequest) 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.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDelegatorDelegationsResponse) 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 *QueryDelegatorDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorDelegationsResponse) 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.DelegationResponses) > 0 { - for iNdEx := len(m.DelegationResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DelegationResponses[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 *QueryDelegatorUnbondingDelegationsRequest) 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 *QueryDelegatorUnbondingDelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorUnbondingDelegationsRequest) 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.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDelegatorUnbondingDelegationsResponse) 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 *QueryDelegatorUnbondingDelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorUnbondingDelegationsResponse) 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.UnbondingResponses) > 0 { - for iNdEx := len(m.UnbondingResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingResponses[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 *QueryRedelegationsRequest) 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 *QueryRedelegationsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRedelegationsRequest) 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] = 0x22 - } - if len(m.DstValidatorAddr) > 0 { - i -= len(m.DstValidatorAddr) - copy(dAtA[i:], m.DstValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DstValidatorAddr))) - i-- - dAtA[i] = 0x1a - } - if len(m.SrcValidatorAddr) > 0 { - i -= len(m.SrcValidatorAddr) - copy(dAtA[i:], m.SrcValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.SrcValidatorAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRedelegationsResponse) 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 *QueryRedelegationsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRedelegationsResponse) 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.RedelegationResponses) > 0 { - for iNdEx := len(m.RedelegationResponses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RedelegationResponses[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 *QueryDelegatorValidatorsRequest) 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 *QueryDelegatorValidatorsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorValidatorsRequest) 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.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDelegatorValidatorsResponse) 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 *QueryDelegatorValidatorsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorValidatorsResponse) 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.Validators) > 0 { - for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Validators[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 *QueryDelegatorValidatorRequest) 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 *QueryDelegatorValidatorRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorValidatorRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddr) > 0 { - i -= len(m.DelegatorAddr) - copy(dAtA[i:], m.DelegatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.DelegatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryDelegatorValidatorResponse) 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 *QueryDelegatorValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryDelegatorValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Validator.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 *QueryHistoricalInfoRequest) 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 *QueryHistoricalInfoRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryHistoricalInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Height != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryHistoricalInfoResponse) 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 *QueryHistoricalInfoResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryHistoricalInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Hist != nil { - { - size, err := m.Hist.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 *QueryPoolRequest) 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 *QueryPoolRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPoolRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryPoolResponse) 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 *QueryPoolResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Pool.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 *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 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 *QueryValidatorsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Status) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryValidatorsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Validators) > 0 { - for _, e := range m.Validators { - 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 *QueryValidatorRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryValidatorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Validator.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryValidatorDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryValidatorDelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.DelegationResponses) > 0 { - for _, e := range m.DelegationResponses { - 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 *QueryValidatorUnbondingDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryValidatorUnbondingDelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.UnbondingResponses) > 0 { - for _, e := range m.UnbondingResponses { - 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 *QueryDelegationRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DelegationResponse != nil { - l = m.DelegationResponse.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryUnbondingDelegationRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryUnbondingDelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Unbond.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryDelegatorDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegatorDelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.DelegationResponses) > 0 { - for _, e := range m.DelegationResponses { - 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 *QueryDelegatorUnbondingDelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegatorUnbondingDelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.UnbondingResponses) > 0 { - for _, e := range m.UnbondingResponses { - 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 *QueryRedelegationsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.SrcValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.DstValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRedelegationsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.RedelegationResponses) > 0 { - for _, e := range m.RedelegationResponses { - 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 *QueryDelegatorValidatorsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegatorValidatorsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Validators) > 0 { - for _, e := range m.Validators { - 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 *QueryDelegatorValidatorRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryDelegatorValidatorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Validator.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryHistoricalInfoRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovQuery(uint64(m.Height)) - } - return n -} - -func (m *QueryHistoricalInfoResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Hist != nil { - l = m.Hist.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryPoolRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryPoolResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Pool.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -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 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 *QueryValidatorsRequest) 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: QueryValidatorsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", 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.Status = string(dAtA[iNdEx:postIndex]) - 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.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryValidatorsResponse) 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: QueryValidatorsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", 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.Validators = append(m.Validators, Validator{}) - if err := m.Validators[len(m.Validators)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryValidatorRequest) 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: QueryValidatorRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryValidatorResponse) 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: QueryValidatorResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Validator.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryValidatorDelegationsRequest) 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: QueryValidatorDelegationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - 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.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryValidatorDelegationsResponse) 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: QueryValidatorDelegationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) - if err := m.DelegationResponses[len(m.DelegationResponses)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryValidatorUnbondingDelegationsRequest) 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: QueryValidatorUnbondingDelegationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - 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.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryValidatorUnbondingDelegationsResponse) 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: QueryValidatorUnbondingDelegationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) - if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegationRequest) 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: QueryDelegationRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegationResponse) 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: QueryDelegationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponse", 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.DelegationResponse == nil { - m.DelegationResponse = &DelegationResponse{} - } - if err := m.DelegationResponse.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryUnbondingDelegationRequest) 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: QueryUnbondingDelegationRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUnbondingDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryUnbondingDelegationResponse) 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: QueryUnbondingDelegationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUnbondingDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Unbond", 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.Unbond.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorDelegationsRequest) 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: QueryDelegatorDelegationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - 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.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorDelegationsResponse) 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: QueryDelegatorDelegationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegationResponses", 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.DelegationResponses = append(m.DelegationResponses, DelegationResponse{}) - if err := m.DelegationResponses[len(m.DelegationResponses)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorUnbondingDelegationsRequest) 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: QueryDelegatorUnbondingDelegationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - 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.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorUnbondingDelegationsResponse) 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: QueryDelegatorUnbondingDelegationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorUnbondingDelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingResponses", 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.UnbondingResponses = append(m.UnbondingResponses, UnbondingDelegation{}) - if err := m.UnbondingResponses[len(m.UnbondingResponses)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRedelegationsRequest) 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: QueryRedelegationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRedelegationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcValidatorAddr", 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.SrcValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DstValidatorAddr", 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.DstValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryRedelegationsResponse) 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: QueryRedelegationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRedelegationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RedelegationResponses", 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.RedelegationResponses = append(m.RedelegationResponses, RedelegationResponse{}) - if err := m.RedelegationResponses[len(m.RedelegationResponses)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorValidatorsRequest) 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: QueryDelegatorValidatorsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - 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.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorValidatorsResponse) 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: QueryDelegatorValidatorsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validators", 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.Validators = append(m.Validators, Validator{}) - if err := m.Validators[len(m.Validators)-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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorValidatorRequest) 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: QueryDelegatorValidatorRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddr", 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.DelegatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", 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.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryDelegatorValidatorResponse) 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: QueryDelegatorValidatorResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDelegatorValidatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Validator.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryHistoricalInfoRequest) 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: QueryHistoricalInfoRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHistoricalInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryHistoricalInfoResponse) 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: QueryHistoricalInfoResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHistoricalInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hist", 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.Hist == nil { - m.Hist = &HistoricalInfo{} - } - if err := m.Hist.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryPoolRequest) 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: QueryPoolRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPoolRequest: 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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryPoolResponse) 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: QueryPoolResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pool", 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.Pool.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 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -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 { - return ErrInvalidLengthQuery - } - if (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 { - return ErrInvalidLengthQuery - } - if (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/modules/staking/staking.go b/modules/staking/staking.go deleted file mode 100644 index ca7e5b90..00000000 --- a/modules/staking/staking.go +++ /dev/null @@ -1,470 +0,0 @@ -package staking - -import ( - "context" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/query" - "github.com/irisnet/irishub-sdk-go/utils" -) - -type stakingClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(baseClient sdk.BaseClient, marshaler codec.Marshaler) Client { - return &stakingClient{ - BaseClient: baseClient, - Marshaler: marshaler, - } -} - -func (sc stakingClient) Name() string { - return ModuleName -} - -func (sc stakingClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (sc stakingClient) CreateValidator(request CreateValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - valAddr, err := sdk.ValAddressFromBech32(delegatorAddr.String()) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - values, err := sc.ToMinCoin(request.Value) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - pk, e := sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeConsPub, request.Pubkey) - if e != nil { - return sdk.ResultTx{}, sdk.Wrap(e) - } - pkAny, e := types.PackAny(pk) - if e != nil { - return sdk.ResultTx{}, sdk.Wrap(e) - } - - msg := &MsgCreateValidator{ - Description: Description{ - Moniker: request.Moniker, - }, - Commission: CommissionRates{ - Rate: request.Rate, - MaxRate: request.MaxRate, - MaxChangeRate: request.MaxChangeRate, - }, - MinSelfDelegation: request.MinSelfDelegation, - DelegatorAddress: delegatorAddr.String(), - ValidatorAddress: valAddr.String(), - Pubkey: pkAny, - Value: values[0], - } - return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (sc stakingClient) EditValidator(request EditValidatorRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - valAddr, err := sdk.ValAddressFromBech32(delegatorAddr.String()) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgEditValidator{ - Description: Description{ - Moniker: request.Moniker, - Identity: request.Identity, - Website: request.Website, - SecurityContact: request.SecurityContact, - Details: request.Details, - }, - ValidatorAddress: valAddr.String(), - CommissionRate: &request.CommissionRate, - MinSelfDelegation: &request.MinSelfDelegation, - } - return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (sc stakingClient) Delegate(request DelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - coins, err := sc.ToMinCoin(request.Amount) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgDelegate{ - DelegatorAddress: delegatorAddr.String(), - ValidatorAddress: request.ValidatorAddr, - Amount: coins[0], - } - return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (sc stakingClient) Undelegate(request UndelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - coins, err := sc.ToMinCoin(request.Amount) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - msg := &MsgUndelegate{ - DelegatorAddress: delegatorAddr.String(), - ValidatorAddress: request.ValidatorAddr, - Amount: coins[0], - } - return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (sc stakingClient) BeginRedelegate(request BeginRedelegateRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - delegatorAddr, err := sc.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - coins, err := sc.ToMinCoin(request.Amount) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - msg := &MsgBeginRedelegate{ - DelegatorAddress: delegatorAddr.String(), - ValidatorSrcAddress: request.ValidatorSrcAddress, - ValidatorDstAddress: request.ValidatorDstAddress, - Amount: coins[0], - } - return sc.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -// QueryValidators when status is "" will return all status' validator -// about status, you can see BondStatus_value -func (sc stakingClient) QueryValidators(status string, page, size uint64) (QueryValidatorsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryValidatorsResp{}, sdk.Wrap(err) - } - - offset, limit := utils.ParsePage(page, size) - res, err := NewQueryClient(conn).Validators( - context.Background(), - &QueryValidatorsRequest{ - Status: status, - Pagination: &query.PageRequest{ - Offset: offset, - Limit: limit, - CountTotal: true, - }, - }, - ) - if err != nil { - return QueryValidatorsResp{}, sdk.Wrap(err) - } - return res.Convert(sc.Marshaler).(QueryValidatorsResp), nil -} - -func (sc stakingClient) QueryValidator(validatorAddr string) (QueryValidatorResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryValidatorResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Validator( - context.Background(), - &QueryValidatorRequest{ - ValidatorAddr: validatorAddr, - }, - ) - if err != nil { - return QueryValidatorResp{}, sdk.Wrap(err) - } - return res.Validator.Convert(sc.Marshaler).(QueryValidatorResp), nil -} - -func (sc stakingClient) QueryValidatorDelegations(validatorAddr string, page, size uint64) (QueryValidatorDelegationsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryValidatorDelegationsResp{}, sdk.Wrap(err) - } - - offset, limit := utils.ParsePage(page, size) - res, err := NewQueryClient(conn).ValidatorDelegations( - context.Background(), - &QueryValidatorDelegationsRequest{ - ValidatorAddr: validatorAddr, - Pagination: &query.PageRequest{ - Offset: offset, - Limit: limit, - CountTotal: true, - }, - }, - ) - if err != nil { - return QueryValidatorDelegationsResp{}, sdk.Wrap(err) - } - return res.Convert().(QueryValidatorDelegationsResp), nil -} - -func (sc stakingClient) QueryValidatorUnbondingDelegations(validatorAddr string, page, size uint64) (QueryValidatorUnbondingDelegationsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryValidatorUnbondingDelegationsResp{}, sdk.Wrap(err) - } - - offset, limit := utils.ParsePage(page, size) - res, err := NewQueryClient(conn).ValidatorUnbondingDelegations( - context.Background(), - &QueryValidatorUnbondingDelegationsRequest{ - ValidatorAddr: validatorAddr, - Pagination: &query.PageRequest{ - Offset: offset, - Limit: limit, - CountTotal: true, - }, - }, - ) - if err != nil { - return QueryValidatorUnbondingDelegationsResp{}, sdk.Wrap(err) - } - return res.Convert().(QueryValidatorUnbondingDelegationsResp), nil -} - -func (sc stakingClient) QueryDelegation(delegatorAddr string, validatorAddr string) (QueryDelegationResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryDelegationResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Delegation( - context.Background(), - &QueryDelegationRequest{ - DelegatorAddr: delegatorAddr, - ValidatorAddr: validatorAddr, - }, - ) - if err != nil { - return QueryDelegationResp{}, sdk.Wrap(err) - } - return res.DelegationResponse.Convert().(QueryDelegationResp), nil -} - -func (sc stakingClient) QueryUnbondingDelegation(delegatorAddr string, validatorAddr string) (QueryUnbondingDelegationResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryUnbondingDelegationResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).UnbondingDelegation( - context.Background(), - &QueryUnbondingDelegationRequest{ - DelegatorAddr: delegatorAddr, - ValidatorAddr: validatorAddr, - }, - ) - if err != nil { - return QueryUnbondingDelegationResp{}, sdk.Wrap(err) - } - return res.Unbond.Convert().(QueryUnbondingDelegationResp), nil -} - -func (sc stakingClient) QueryDelegatorDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorDelegationsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryDelegatorDelegationsResp{}, sdk.Wrap(err) - } - - offset, limit := utils.ParsePage(page, size) - res, err := NewQueryClient(conn).DelegatorDelegations( - context.Background(), - &QueryDelegatorDelegationsRequest{ - DelegatorAddr: delegatorAddr, - Pagination: &query.PageRequest{ - Offset: offset, - Limit: limit, - CountTotal: true, - }, - }, - ) - if err != nil { - return QueryDelegatorDelegationsResp{}, sdk.Wrap(err) - } - return res.Convert().(QueryDelegatorDelegationsResp), nil -} - -func (sc stakingClient) QueryDelegatorUnbondingDelegations(delegatorAddr string, page, size uint64) (QueryDelegatorUnbondingDelegationsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryDelegatorUnbondingDelegationsResp{}, sdk.Wrap(err) - } - - offset, limit := utils.ParsePage(page, size) - res, err := NewQueryClient(conn).DelegatorUnbondingDelegations( - context.Background(), - &QueryDelegatorUnbondingDelegationsRequest{ - DelegatorAddr: delegatorAddr, - Pagination: &query.PageRequest{ - Offset: offset, - Limit: limit, - CountTotal: true, - }, - }, - ) - if err != nil { - return QueryDelegatorUnbondingDelegationsResp{}, sdk.Wrap(err) - } - return res.Convert().(QueryDelegatorUnbondingDelegationsResp), nil -} - -func (sc stakingClient) QueryRedelegations(request QueryRedelegationsReq) (QueryRedelegationsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryRedelegationsResp{}, sdk.Wrap(err) - } - - offset, limit := utils.ParsePage(request.Page, request.Size) - res, err := NewQueryClient(conn).Redelegations( - context.Background(), - &QueryRedelegationsRequest{ - DelegatorAddr: request.DelegatorAddr, - SrcValidatorAddr: request.SrcValidatorAddr, - DstValidatorAddr: request.DstValidatorAddr, - Pagination: &query.PageRequest{ - Offset: offset, - Limit: limit, - CountTotal: true, - }, - }, - ) - if err != nil { - return QueryRedelegationsResp{}, sdk.Wrap(err) - } - return res.Convert().(QueryRedelegationsResp), nil -} - -func (sc stakingClient) QueryDelegatorValidators(delegatorAddr string, page, size uint64) (QueryDelegatorValidatorsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryDelegatorValidatorsResp{}, sdk.Wrap(err) - } - - offset, limit := utils.ParsePage(page, size) - res, err := NewQueryClient(conn).DelegatorValidators( - context.Background(), - &QueryDelegatorValidatorsRequest{ - DelegatorAddr: delegatorAddr, - Pagination: &query.PageRequest{ - Offset: offset, - Limit: limit, - CountTotal: true, - }, - }, - ) - if err != nil { - return QueryDelegatorValidatorsResp{}, sdk.Wrap(err) - } - return res.Convert(sc.Marshaler).(QueryDelegatorValidatorsResp), nil -} - -func (sc stakingClient) QueryDelegatorValidator(delegatorAddr string, validatorAddr string) (QueryValidatorResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryValidatorResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).DelegatorValidator( - context.Background(), - &QueryDelegatorValidatorRequest{ - DelegatorAddr: delegatorAddr, - ValidatorAddr: validatorAddr, - }, - ) - if err != nil { - return QueryValidatorResp{}, sdk.Wrap(err) - } - return res.Validator.Convert(sc.Marshaler).(QueryValidatorResp), nil -} - -// QueryHistoricalInfo tendermint only save latest 100 block, previous block is aborted -func (sc stakingClient) QueryHistoricalInfo(height int64) (QueryHistoricalInfoResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryHistoricalInfoResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).HistoricalInfo( - context.Background(), - &QueryHistoricalInfoRequest{ - Height: height, - }, - ) - if err != nil { - return QueryHistoricalInfoResp{}, sdk.Wrap(err) - } - return res.Convert(sc.Marshaler).(QueryHistoricalInfoResp), nil -} - -func (sc stakingClient) QueryPool() (QueryPoolResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryPoolResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Pool( - context.Background(), - &QueryPoolRequest{}, - ) - if err != nil { - return QueryPoolResp{}, sdk.Wrap(err) - } - - return QueryPoolResp{ - NotBondedTokens: res.Pool.NotBondedTokens, - BondedTokens: res.Pool.BondedTokens, - }, nil -} - -func (sc stakingClient) QueryParams() (QueryParamsResp, sdk.Error) { - conn, err := sc.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Params( - context.Background(), - &QueryParamsRequest{}, - ) - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - return res.Convert().(QueryParamsResp), nil -} diff --git a/modules/staking/staking.pb.go b/modules/staking/staking.pb.go deleted file mode 100644 index 45d8a497..00000000 --- a/modules/staking/staking.pb.go +++ /dev/null @@ -1,6577 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/staking.proto - -package staking - -import ( - bytes "bytes" - compress_gzip "compress/gzip" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_protoc_gen_gogo_descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/duration" - _ "github.com/golang/protobuf/ptypes/timestamp" - types1 "github.com/irisnet/irishub-sdk-go/codec/types" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types2 "github.com/irisnet/irishub-sdk-go/types" - _ "github.com/regen-network/cosmos-proto" - types "github.com/tendermint/tendermint/proto/tendermint/types" - io "io" - io_ioutil "io/ioutil" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// BondStatus is the status of a validator. -type BondStatus int32 - -const ( - // UNSPECIFIED defines an invalid validator status. - Unspecified BondStatus = 0 - // UNBONDED defines a validator that is not bonded. - Unbonded BondStatus = 1 - // UNBONDING defines a validator that is unbonding. - Unbonding BondStatus = 2 - // BONDED defines a validator that is bonded. - Bonded BondStatus = 3 -) - -var BondStatus_name = map[int32]string{ - 0: "BOND_STATUS_UNSPECIFIED", - 1: "BOND_STATUS_UNBONDED", - 2: "BOND_STATUS_UNBONDING", - 3: "BOND_STATUS_BONDED", -} - -var BondStatus_value = map[string]int32{ - "BOND_STATUS_UNSPECIFIED": 0, - "BOND_STATUS_UNBONDED": 1, - "BOND_STATUS_UNBONDING": 2, - "BOND_STATUS_BONDED": 3, -} - -func (x BondStatus) String() string { - return proto.EnumName(BondStatus_name, int32(x)) -} - -func (BondStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{0} -} - -// HistoricalInfo contains header and validator information for a given block. -// It is stored as part of staking module's state, which persists the `n` most -// recent HistoricalInfo -// (`n` is set by the staking module's `historical_entries` parameter). -type HistoricalInfo struct { - Header types.Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header"` - Valset []Validator `protobuf:"bytes,2,rep,name=valset,proto3" json:"valset"` -} - -func (m *HistoricalInfo) Reset() { *m = HistoricalInfo{} } -func (m *HistoricalInfo) String() string { return proto.CompactTextString(m) } -func (*HistoricalInfo) ProtoMessage() {} -func (*HistoricalInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{0} -} -func (m *HistoricalInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HistoricalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HistoricalInfo.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 *HistoricalInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistoricalInfo.Merge(m, src) -} -func (m *HistoricalInfo) XXX_Size() int { - return m.Size() -} -func (m *HistoricalInfo) XXX_DiscardUnknown() { - xxx_messageInfo_HistoricalInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_HistoricalInfo proto.InternalMessageInfo - -func (m *HistoricalInfo) GetHeader() types.Header { - if m != nil { - return m.Header - } - return types.Header{} -} - -func (m *HistoricalInfo) GetValset() []Validator { - if m != nil { - return m.Valset - } - return nil -} - -// CommissionRates defines the initial commission rates to be used for creating -// a validator. -type CommissionRates struct { - Rate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"rate"` - MaxRate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,2,opt,name=max_rate,json=maxRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"max_rate" yaml:"max_rate"` - MaxChangeRate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=max_change_rate,json=maxChangeRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"max_change_rate" yaml:"max_change_rate"` -} - -func (m *CommissionRates) Reset() { *m = CommissionRates{} } -func (*CommissionRates) ProtoMessage() {} -func (*CommissionRates) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{1} -} -func (m *CommissionRates) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CommissionRates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CommissionRates.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 *CommissionRates) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommissionRates.Merge(m, src) -} -func (m *CommissionRates) XXX_Size() int { - return m.Size() -} -func (m *CommissionRates) XXX_DiscardUnknown() { - xxx_messageInfo_CommissionRates.DiscardUnknown(m) -} - -var xxx_messageInfo_CommissionRates proto.InternalMessageInfo - -// Commission defines commission parameters for a given validator. -type Commission struct { - CommissionRates `protobuf:"bytes,1,opt,name=commission_rates,json=commissionRates,proto3,embedded=commission_rates" json:"commission_rates"` - UpdateTime time.Time `protobuf:"bytes,2,opt,name=update_time,json=updateTime,proto3,stdtime" json:"update_time" yaml:"update_time"` -} - -func (m *Commission) Reset() { *m = Commission{} } -func (*Commission) ProtoMessage() {} -func (*Commission) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{2} -} -func (m *Commission) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Commission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Commission.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 *Commission) XXX_Merge(src proto.Message) { - xxx_messageInfo_Commission.Merge(m, src) -} -func (m *Commission) XXX_Size() int { - return m.Size() -} -func (m *Commission) XXX_DiscardUnknown() { - xxx_messageInfo_Commission.DiscardUnknown(m) -} - -var xxx_messageInfo_Commission proto.InternalMessageInfo - -func (m *Commission) GetUpdateTime() time.Time { - if m != nil { - return m.UpdateTime - } - return time.Time{} -} - -// Description defines a validator description. -type Description struct { - Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` - Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` - Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` - SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty" yaml:"security_contact"` - Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` -} - -func (m *Description) Reset() { *m = Description{} } -func (*Description) ProtoMessage() {} -func (*Description) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{3} -} -func (m *Description) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Description) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Description.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 *Description) XXX_Merge(src proto.Message) { - xxx_messageInfo_Description.Merge(m, src) -} -func (m *Description) XXX_Size() int { - return m.Size() -} -func (m *Description) XXX_DiscardUnknown() { - xxx_messageInfo_Description.DiscardUnknown(m) -} - -var xxx_messageInfo_Description proto.InternalMessageInfo - -func (m *Description) GetMoniker() string { - if m != nil { - return m.Moniker - } - return "" -} - -func (m *Description) GetIdentity() string { - if m != nil { - return m.Identity - } - return "" -} - -func (m *Description) GetWebsite() string { - if m != nil { - return m.Website - } - return "" -} - -func (m *Description) GetSecurityContact() string { - if m != nil { - return m.SecurityContact - } - return "" -} - -func (m *Description) GetDetails() string { - if m != nil { - return m.Details - } - return "" -} - -// Validator defines a validator, together with the total amount of the -// Validator's bond shares and their exchange rate to coins. Slashing results in -// a decrease in the exchange rate, allowing correct calculation of future -// undelegations without iterating over delegators. When coins are delegated to -// this validator, the validator is credited with a delegation whose number of -// bond shares is based on the amount of coins delegated divided by the current -// exchange rate. Voting power can be calculated as total bonded shares -// multiplied by exchange rate. -type Validator struct { - OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty" yaml:"operator_address"` - ConsensusPubkey *types1.Any `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"` - Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` - Status BondStatus `protobuf:"varint,4,opt,name=status,proto3,enum=cosmos.staking.v1beta1.BondStatus" json:"status,omitempty"` - Tokens github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"tokens"` - DelegatorShares github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` - Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` - UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` - UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` - Commission Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` - MinSelfDelegation github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` -} - -func (m *Validator) Reset() { *m = Validator{} } -func (*Validator) ProtoMessage() {} -func (*Validator) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{4} -} -func (m *Validator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Validator.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 *Validator) XXX_Merge(src proto.Message) { - xxx_messageInfo_Validator.Merge(m, src) -} -func (m *Validator) XXX_Size() int { - return m.Size() -} -func (m *Validator) XXX_DiscardUnknown() { - xxx_messageInfo_Validator.DiscardUnknown(m) -} - -var xxx_messageInfo_Validator proto.InternalMessageInfo - -// ValAddresses defines a repeated set of validator addresses. -type ValAddresses struct { - Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` -} - -func (m *ValAddresses) Reset() { *m = ValAddresses{} } -func (*ValAddresses) ProtoMessage() {} -func (*ValAddresses) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{5} -} -func (m *ValAddresses) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValAddresses.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 *ValAddresses) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValAddresses.Merge(m, src) -} -func (m *ValAddresses) XXX_Size() int { - return m.Size() -} -func (m *ValAddresses) XXX_DiscardUnknown() { - xxx_messageInfo_ValAddresses.DiscardUnknown(m) -} - -var xxx_messageInfo_ValAddresses proto.InternalMessageInfo - -func (m *ValAddresses) GetAddresses() []string { - if m != nil { - return m.Addresses - } - return nil -} - -// DVPair is struct that just has a delegator-validator pair with no other data. -// It is intended to be used as a marshalable pointer. For example, a DVPair can -// be used to construct the key to getting an UnbondingDelegation from state. -type DVPair struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` -} - -func (m *DVPair) Reset() { *m = DVPair{} } -func (*DVPair) ProtoMessage() {} -func (*DVPair) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{6} -} -func (m *DVPair) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVPair.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 *DVPair) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVPair.Merge(m, src) -} -func (m *DVPair) XXX_Size() int { - return m.Size() -} -func (m *DVPair) XXX_DiscardUnknown() { - xxx_messageInfo_DVPair.DiscardUnknown(m) -} - -var xxx_messageInfo_DVPair proto.InternalMessageInfo - -// DVPairs defines an array of DVPair objects. -type DVPairs struct { - Pairs []DVPair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"` -} - -func (m *DVPairs) Reset() { *m = DVPairs{} } -func (m *DVPairs) String() string { return proto.CompactTextString(m) } -func (*DVPairs) ProtoMessage() {} -func (*DVPairs) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{7} -} -func (m *DVPairs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DVPairs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVPairs.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 *DVPairs) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVPairs.Merge(m, src) -} -func (m *DVPairs) XXX_Size() int { - return m.Size() -} -func (m *DVPairs) XXX_DiscardUnknown() { - xxx_messageInfo_DVPairs.DiscardUnknown(m) -} - -var xxx_messageInfo_DVPairs proto.InternalMessageInfo - -func (m *DVPairs) GetPairs() []DVPair { - if m != nil { - return m.Pairs - } - return nil -} - -// DVVTriplet is struct that just has a delegator-validator-validator triplet -// with no other data. It is intended to be used as a marshalable pointer. For -// example, a DVVTriplet can be used to construct the key to getting a -// Redelegation from state. -type DVVTriplet struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` -} - -func (m *DVVTriplet) Reset() { *m = DVVTriplet{} } -func (*DVVTriplet) ProtoMessage() {} -func (*DVVTriplet) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{8} -} -func (m *DVVTriplet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DVVTriplet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVVTriplet.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 *DVVTriplet) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVVTriplet.Merge(m, src) -} -func (m *DVVTriplet) XXX_Size() int { - return m.Size() -} -func (m *DVVTriplet) XXX_DiscardUnknown() { - xxx_messageInfo_DVVTriplet.DiscardUnknown(m) -} - -var xxx_messageInfo_DVVTriplet proto.InternalMessageInfo - -// DVVTriplets defines an array of DVVTriplet objects. -type DVVTriplets struct { - Triplets []DVVTriplet `protobuf:"bytes,1,rep,name=triplets,proto3" json:"triplets"` -} - -func (m *DVVTriplets) Reset() { *m = DVVTriplets{} } -func (m *DVVTriplets) String() string { return proto.CompactTextString(m) } -func (*DVVTriplets) ProtoMessage() {} -func (*DVVTriplets) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{9} -} -func (m *DVVTriplets) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DVVTriplets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVVTriplets.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 *DVVTriplets) XXX_Merge(src proto.Message) { - xxx_messageInfo_DVVTriplets.Merge(m, src) -} -func (m *DVVTriplets) XXX_Size() int { - return m.Size() -} -func (m *DVVTriplets) XXX_DiscardUnknown() { - xxx_messageInfo_DVVTriplets.DiscardUnknown(m) -} - -var xxx_messageInfo_DVVTriplets proto.InternalMessageInfo - -func (m *DVVTriplets) GetTriplets() []DVVTriplet { - if m != nil { - return m.Triplets - } - return nil -} - -// Delegation represents the bond with tokens held by an account. It is -// owned by one delegator, and is associated with the voting power of one -// validator. -type Delegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` - Shares github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"shares"` -} - -func (m *Delegation) Reset() { *m = Delegation{} } -func (*Delegation) ProtoMessage() {} -func (*Delegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{10} -} -func (m *Delegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Delegation.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 *Delegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Delegation.Merge(m, src) -} -func (m *Delegation) XXX_Size() int { - return m.Size() -} -func (m *Delegation) XXX_DiscardUnknown() { - xxx_messageInfo_Delegation.DiscardUnknown(m) -} - -var xxx_messageInfo_Delegation proto.InternalMessageInfo - -// UnbondingDelegation stores all of a single delegator's unbonding bonds -// for a single validator in an time-ordered list. -type UnbondingDelegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` - Entries []UnbondingDelegationEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries"` -} - -func (m *UnbondingDelegation) Reset() { *m = UnbondingDelegation{} } -func (*UnbondingDelegation) ProtoMessage() {} -func (*UnbondingDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{11} -} -func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnbondingDelegation.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 *UnbondingDelegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnbondingDelegation.Merge(m, src) -} -func (m *UnbondingDelegation) XXX_Size() int { - return m.Size() -} -func (m *UnbondingDelegation) XXX_DiscardUnknown() { - xxx_messageInfo_UnbondingDelegation.DiscardUnknown(m) -} - -var xxx_messageInfo_UnbondingDelegation proto.InternalMessageInfo - -// UnbondingDelegationEntry defines an unbonding object with relevant metadata. -type UnbondingDelegationEntry struct { - CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` - CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` - InitialBalance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"initial_balance" yaml:"initial_balance"` - Balance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"balance"` -} - -func (m *UnbondingDelegationEntry) Reset() { *m = UnbondingDelegationEntry{} } -func (*UnbondingDelegationEntry) ProtoMessage() {} -func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{12} -} -func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UnbondingDelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnbondingDelegationEntry.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 *UnbondingDelegationEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnbondingDelegationEntry.Merge(m, src) -} -func (m *UnbondingDelegationEntry) XXX_Size() int { - return m.Size() -} -func (m *UnbondingDelegationEntry) XXX_DiscardUnknown() { - xxx_messageInfo_UnbondingDelegationEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_UnbondingDelegationEntry proto.InternalMessageInfo - -func (m *UnbondingDelegationEntry) GetCreationHeight() int64 { - if m != nil { - return m.CreationHeight - } - return 0 -} - -func (m *UnbondingDelegationEntry) GetCompletionTime() time.Time { - if m != nil { - return m.CompletionTime - } - return time.Time{} -} - -// RedelegationEntry defines a redelegation object with relevant metadata. -type RedelegationEntry struct { - CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` - CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` - InitialBalance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"initial_balance" yaml:"initial_balance"` - SharesDst github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,4,opt,name=shares_dst,json=sharesDst,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"shares_dst"` -} - -func (m *RedelegationEntry) Reset() { *m = RedelegationEntry{} } -func (*RedelegationEntry) ProtoMessage() {} -func (*RedelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{13} -} -func (m *RedelegationEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RedelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RedelegationEntry.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 *RedelegationEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedelegationEntry.Merge(m, src) -} -func (m *RedelegationEntry) XXX_Size() int { - return m.Size() -} -func (m *RedelegationEntry) XXX_DiscardUnknown() { - xxx_messageInfo_RedelegationEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_RedelegationEntry proto.InternalMessageInfo - -func (m *RedelegationEntry) GetCreationHeight() int64 { - if m != nil { - return m.CreationHeight - } - return 0 -} - -func (m *RedelegationEntry) GetCompletionTime() time.Time { - if m != nil { - return m.CompletionTime - } - return time.Time{} -} - -// Redelegation contains the list of a particular delegator's redelegating bonds -// from a particular source validator to a particular destination validator. -type Redelegation struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` - Entries []RedelegationEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"` -} - -func (m *Redelegation) Reset() { *m = Redelegation{} } -func (*Redelegation) ProtoMessage() {} -func (*Redelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{14} -} -func (m *Redelegation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Redelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Redelegation.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 *Redelegation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Redelegation.Merge(m, src) -} -func (m *Redelegation) XXX_Size() int { - return m.Size() -} -func (m *Redelegation) XXX_DiscardUnknown() { - xxx_messageInfo_Redelegation.DiscardUnknown(m) -} - -var xxx_messageInfo_Redelegation proto.InternalMessageInfo - -// Params defines the parameters for the staking module. -type Params struct { - UnbondingTime time.Duration `protobuf:"bytes,1,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time" yaml:"unbonding_time"` - MaxValidators uint32 `protobuf:"varint,2,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty" yaml:"max_validators"` - MaxEntries uint32 `protobuf:"varint,3,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty" yaml:"max_entries"` - HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty" yaml:"historical_entries"` - BondDenom string `protobuf:"bytes,5,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{15} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetUnbondingTime() time.Duration { - if m != nil { - return m.UnbondingTime - } - return 0 -} - -func (m *Params) GetMaxValidators() uint32 { - if m != nil { - return m.MaxValidators - } - return 0 -} - -func (m *Params) GetMaxEntries() uint32 { - if m != nil { - return m.MaxEntries - } - return 0 -} - -func (m *Params) GetHistoricalEntries() uint32 { - if m != nil { - return m.HistoricalEntries - } - return 0 -} - -func (m *Params) GetBondDenom() string { - if m != nil { - return m.BondDenom - } - return "" -} - -// DelegationResponse is equivalent to Delegation except that it contains a -// balance in addition to shares which is more suitable for client responses. -type DelegationResponse struct { - Delegation Delegation `protobuf:"bytes,1,opt,name=delegation,proto3" json:"delegation"` - Balance types2.Coin `protobuf:"bytes,2,opt,name=balance,proto3" json:"balance"` -} - -func (m *DelegationResponse) Reset() { *m = DelegationResponse{} } -func (*DelegationResponse) ProtoMessage() {} -func (*DelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{16} -} -func (m *DelegationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DelegationResponse.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 *DelegationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_DelegationResponse.Merge(m, src) -} -func (m *DelegationResponse) XXX_Size() int { - return m.Size() -} -func (m *DelegationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_DelegationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_DelegationResponse proto.InternalMessageInfo - -func (m *DelegationResponse) GetDelegation() Delegation { - if m != nil { - return m.Delegation - } - return Delegation{} -} - -func (m *DelegationResponse) GetBalance() types2.Coin { - if m != nil { - return m.Balance - } - return types2.Coin{} -} - -// RedelegationEntryResponse is equivalent to a RedelegationEntry except that it -// contains a balance in addition to shares which is more suitable for client -// responses. -type RedelegationEntryResponse struct { - RedelegationEntry RedelegationEntry `protobuf:"bytes,1,opt,name=redelegation_entry,json=redelegationEntry,proto3" json:"redelegation_entry"` - Balance github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"balance"` -} - -func (m *RedelegationEntryResponse) Reset() { *m = RedelegationEntryResponse{} } -func (m *RedelegationEntryResponse) String() string { return proto.CompactTextString(m) } -func (*RedelegationEntryResponse) ProtoMessage() {} -func (*RedelegationEntryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{17} -} -func (m *RedelegationEntryResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RedelegationEntryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RedelegationEntryResponse.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 *RedelegationEntryResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedelegationEntryResponse.Merge(m, src) -} -func (m *RedelegationEntryResponse) XXX_Size() int { - return m.Size() -} -func (m *RedelegationEntryResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RedelegationEntryResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RedelegationEntryResponse proto.InternalMessageInfo - -func (m *RedelegationEntryResponse) GetRedelegationEntry() RedelegationEntry { - if m != nil { - return m.RedelegationEntry - } - return RedelegationEntry{} -} - -// RedelegationResponse is equivalent to a Redelegation except that its entries -// contain a balance in addition to shares which is more suitable for client -// responses. -type RedelegationResponse struct { - Redelegation Redelegation `protobuf:"bytes,1,opt,name=redelegation,proto3" json:"redelegation"` - Entries []RedelegationEntryResponse `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries"` -} - -func (m *RedelegationResponse) Reset() { *m = RedelegationResponse{} } -func (m *RedelegationResponse) String() string { return proto.CompactTextString(m) } -func (*RedelegationResponse) ProtoMessage() {} -func (*RedelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{18} -} -func (m *RedelegationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RedelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RedelegationResponse.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 *RedelegationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedelegationResponse.Merge(m, src) -} -func (m *RedelegationResponse) XXX_Size() int { - return m.Size() -} -func (m *RedelegationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_RedelegationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_RedelegationResponse proto.InternalMessageInfo - -func (m *RedelegationResponse) GetRedelegation() Redelegation { - if m != nil { - return m.Redelegation - } - return Redelegation{} -} - -func (m *RedelegationResponse) GetEntries() []RedelegationEntryResponse { - if m != nil { - return m.Entries - } - return nil -} - -// Pool is used for tracking bonded and not-bonded token supply of the bond -// denomination. -type Pool struct { - NotBondedTokens github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,1,opt,name=not_bonded_tokens,json=notBondedTokens,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"not_bonded_tokens"` - BondedTokens github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=bonded_tokens,json=bondedTokens,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"bonded_tokens" yaml:"bonded_tokens"` -} - -func (m *Pool) Reset() { *m = Pool{} } -func (m *Pool) String() string { return proto.CompactTextString(m) } -func (*Pool) ProtoMessage() {} -func (*Pool) Descriptor() ([]byte, []int) { - return fileDescriptor_64c30c6cf92913c9, []int{19} -} -func (m *Pool) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pool.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 *Pool) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pool.Merge(m, src) -} -func (m *Pool) XXX_Size() int { - return m.Size() -} -func (m *Pool) XXX_DiscardUnknown() { - xxx_messageInfo_Pool.DiscardUnknown(m) -} - -var xxx_messageInfo_Pool proto.InternalMessageInfo - -func init() { - proto.RegisterEnum("cosmos.staking.v1beta1.BondStatus", BondStatus_name, BondStatus_value) - proto.RegisterType((*HistoricalInfo)(nil), "cosmos.staking.v1beta1.HistoricalInfo") - proto.RegisterType((*CommissionRates)(nil), "cosmos.staking.v1beta1.CommissionRates") - proto.RegisterType((*Commission)(nil), "cosmos.staking.v1beta1.Commission") - proto.RegisterType((*Description)(nil), "cosmos.staking.v1beta1.Description") - proto.RegisterType((*Validator)(nil), "cosmos.staking.v1beta1.Validator") - proto.RegisterType((*ValAddresses)(nil), "cosmos.staking.v1beta1.ValAddresses") - proto.RegisterType((*DVPair)(nil), "cosmos.staking.v1beta1.DVPair") - proto.RegisterType((*DVPairs)(nil), "cosmos.staking.v1beta1.DVPairs") - proto.RegisterType((*DVVTriplet)(nil), "cosmos.staking.v1beta1.DVVTriplet") - proto.RegisterType((*DVVTriplets)(nil), "cosmos.staking.v1beta1.DVVTriplets") - proto.RegisterType((*Delegation)(nil), "cosmos.staking.v1beta1.Delegation") - proto.RegisterType((*UnbondingDelegation)(nil), "cosmos.staking.v1beta1.UnbondingDelegation") - proto.RegisterType((*UnbondingDelegationEntry)(nil), "cosmos.staking.v1beta1.UnbondingDelegationEntry") - proto.RegisterType((*RedelegationEntry)(nil), "cosmos.staking.v1beta1.RedelegationEntry") - proto.RegisterType((*Redelegation)(nil), "cosmos.staking.v1beta1.Redelegation") - proto.RegisterType((*Params)(nil), "cosmos.staking.v1beta1.Params") - proto.RegisterType((*DelegationResponse)(nil), "cosmos.staking.v1beta1.DelegationResponse") - proto.RegisterType((*RedelegationEntryResponse)(nil), "cosmos.staking.v1beta1.RedelegationEntryResponse") - proto.RegisterType((*RedelegationResponse)(nil), "cosmos.staking.v1beta1.RedelegationResponse") - proto.RegisterType((*Pool)(nil), "cosmos.staking.v1beta1.Pool") -} - -func init() { - proto.RegisterFile("cosmos/staking/v1beta1/staking.proto", fileDescriptor_64c30c6cf92913c9) -} - -var fileDescriptor_64c30c6cf92913c9 = []byte{ - // 1808 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4d, 0x6c, 0x23, 0x49, - 0x15, 0x76, 0xdb, 0x5e, 0xc7, 0x7e, 0x4e, 0xe2, 0xa4, 0x26, 0x33, 0xeb, 0x98, 0xc1, 0xed, 0x6d, - 0x56, 0x10, 0x7e, 0xc6, 0x61, 0x32, 0x68, 0x11, 0xb9, 0xc0, 0x38, 0xce, 0x6c, 0xa2, 0x61, 0x43, - 0xb6, 0x93, 0xc9, 0x01, 0x56, 0x58, 0xe5, 0xee, 0x8a, 0xd3, 0xc4, 0xdd, 0x6d, 0x75, 0x95, 0x87, - 0xf1, 0x8d, 0xbd, 0x2d, 0xe1, 0xb2, 0x9c, 0x58, 0x0e, 0x23, 0x8d, 0xb4, 0x57, 0x8e, 0x88, 0x13, - 0x82, 0xeb, 0xc2, 0x69, 0xb8, 0x21, 0x84, 0x0c, 0x9a, 0xb9, 0x20, 0x4e, 0xc8, 0x07, 0x6e, 0x48, - 0xa8, 0x7e, 0xfa, 0x27, 0xed, 0x78, 0x67, 0xd6, 0xda, 0xc3, 0x4a, 0x70, 0x49, 0x5c, 0xaf, 0xde, - 0xfb, 0x5e, 0xbd, 0xdf, 0x7a, 0xd5, 0xf0, 0xba, 0xe5, 0x53, 0xd7, 0xa7, 0x9b, 0x94, 0xe1, 0x73, - 0xc7, 0xeb, 0x6d, 0x3e, 0xbc, 0xdd, 0x25, 0x0c, 0xdf, 0x0e, 0xd7, 0xcd, 0x41, 0xe0, 0x33, 0x1f, - 0xdd, 0x90, 0x5c, 0xcd, 0x90, 0xaa, 0xb8, 0x6a, 0x6b, 0x3d, 0xbf, 0xe7, 0x0b, 0x96, 0x4d, 0xfe, - 0x4b, 0x72, 0xd7, 0xd6, 0x7b, 0xbe, 0xdf, 0xeb, 0x93, 0x4d, 0xb1, 0xea, 0x0e, 0x4f, 0x37, 0xb1, - 0x37, 0x52, 0x5b, 0xf5, 0xf4, 0x96, 0x3d, 0x0c, 0x30, 0x73, 0x7c, 0x4f, 0xed, 0xeb, 0xe9, 0x7d, - 0xe6, 0xb8, 0x84, 0x32, 0xec, 0x0e, 0x42, 0x6c, 0x79, 0x92, 0x8e, 0x54, 0xaa, 0x8e, 0xa5, 0xb0, - 0x95, 0x29, 0x5d, 0x4c, 0x49, 0x64, 0x87, 0xe5, 0x3b, 0x21, 0xf6, 0x4d, 0x46, 0x3c, 0x9b, 0x04, - 0xae, 0xe3, 0xb1, 0x4d, 0x36, 0x1a, 0x10, 0x2a, 0xff, 0xca, 0x5d, 0xe3, 0xa7, 0x1a, 0x2c, 0xef, - 0x39, 0x94, 0xf9, 0x81, 0x63, 0xe1, 0xfe, 0xbe, 0x77, 0xea, 0xa3, 0x37, 0xa0, 0x70, 0x46, 0xb0, - 0x4d, 0x82, 0xaa, 0xd6, 0xd0, 0x36, 0xca, 0x5b, 0xd5, 0x66, 0x8c, 0xd0, 0x94, 0xb2, 0x7b, 0x62, - 0xbf, 0x95, 0xff, 0x68, 0xac, 0x67, 0x4c, 0xc5, 0x8d, 0xbe, 0x0d, 0x85, 0x87, 0xb8, 0x4f, 0x09, - 0xab, 0x66, 0x1b, 0xb9, 0x8d, 0xf2, 0xd6, 0x6b, 0xcd, 0xab, 0xdd, 0xd7, 0x3c, 0xc1, 0x7d, 0xc7, - 0xc6, 0xcc, 0x8f, 0x00, 0xa4, 0x98, 0xf1, 0xbb, 0x2c, 0x54, 0x76, 0x7c, 0xd7, 0x75, 0x28, 0x75, - 0x7c, 0xcf, 0xc4, 0x8c, 0x50, 0xf4, 0x26, 0xe4, 0x03, 0xcc, 0x88, 0x38, 0x4a, 0xa9, 0x75, 0x87, - 0xf3, 0xff, 0x65, 0xac, 0x7f, 0xb5, 0xe7, 0xb0, 0xb3, 0x61, 0xb7, 0x69, 0xf9, 0xee, 0xa6, 0x13, - 0x38, 0xd4, 0x23, 0x4c, 0xfc, 0x3f, 0x1b, 0x76, 0x6f, 0x51, 0xfb, 0xfc, 0x56, 0xcf, 0x57, 0x46, - 0xb6, 0x89, 0x65, 0x0a, 0x00, 0x84, 0xa1, 0xe8, 0xe2, 0x47, 0x1d, 0x01, 0x96, 0x15, 0x60, 0xf7, - 0xe6, 0x00, 0x9b, 0x8c, 0xf5, 0xca, 0x08, 0xbb, 0xfd, 0x6d, 0x23, 0x04, 0x33, 0xcc, 0x05, 0x17, - 0x3f, 0xe2, 0x87, 0x45, 0x43, 0xa8, 0x70, 0xaa, 0x75, 0x86, 0xbd, 0x1e, 0x91, 0x9a, 0x72, 0x42, - 0xd3, 0x5b, 0xf3, 0x69, 0xba, 0x11, 0x6b, 0x4a, 0x60, 0x1a, 0xe6, 0x92, 0x8b, 0x1f, 0xed, 0x08, - 0x02, 0x57, 0xbb, 0x5d, 0xfc, 0xe0, 0x89, 0x9e, 0xf9, 0xc7, 0x13, 0x5d, 0x33, 0xfe, 0xa4, 0x01, - 0xc4, 0x0e, 0x44, 0xef, 0xc0, 0x8a, 0x15, 0xad, 0x84, 0x2c, 0x55, 0x21, 0xfd, 0xd2, 0xac, 0xd0, - 0xa4, 0xdc, 0xdf, 0x2a, 0xf2, 0x93, 0x3f, 0x1d, 0xeb, 0x9a, 0x59, 0xb1, 0x52, 0x91, 0xf9, 0x01, - 0x94, 0x87, 0x03, 0x1b, 0x33, 0xd2, 0xe1, 0xc9, 0x2a, 0x7c, 0x5a, 0xde, 0xaa, 0x35, 0x65, 0x26, - 0x37, 0xc3, 0x4c, 0x6e, 0x1e, 0x87, 0x99, 0xdc, 0xaa, 0x73, 0xac, 0xc9, 0x58, 0x47, 0xd2, 0xac, - 0x84, 0xb0, 0xf1, 0xfe, 0xdf, 0x74, 0xcd, 0x04, 0x49, 0xe1, 0x02, 0x09, 0x9b, 0xfe, 0xa0, 0x41, - 0xb9, 0x4d, 0xa8, 0x15, 0x38, 0x03, 0x5e, 0x30, 0xa8, 0x0a, 0x0b, 0xae, 0xef, 0x39, 0xe7, 0x2a, - 0x3d, 0x4b, 0x66, 0xb8, 0x44, 0x35, 0x28, 0x3a, 0x36, 0xf1, 0x98, 0xc3, 0x46, 0x32, 0xc2, 0x66, - 0xb4, 0xe6, 0x52, 0x3f, 0x26, 0x5d, 0xea, 0x84, 0x21, 0x31, 0xc3, 0x25, 0xba, 0x07, 0x2b, 0x94, - 0x58, 0xc3, 0xc0, 0x61, 0xa3, 0x8e, 0xe5, 0x7b, 0x0c, 0x5b, 0xac, 0x9a, 0x17, 0x51, 0xfb, 0xdc, - 0x64, 0xac, 0xbf, 0x2a, 0xcf, 0x9a, 0xe6, 0x30, 0xcc, 0x4a, 0x48, 0xda, 0x91, 0x14, 0xae, 0xc1, - 0x26, 0x0c, 0x3b, 0x7d, 0x5a, 0x7d, 0x45, 0x6a, 0x50, 0xcb, 0x84, 0x2d, 0xbf, 0x5d, 0x80, 0x52, - 0x94, 0xfc, 0x5c, 0xb3, 0x3f, 0x20, 0x01, 0xff, 0xdd, 0xc1, 0xb6, 0x1d, 0x10, 0x4a, 0x55, 0x9a, - 0x27, 0x34, 0xa7, 0x39, 0x0c, 0xb3, 0x12, 0x92, 0xee, 0x4a, 0x0a, 0x62, 0x3c, 0xcc, 0x1e, 0x25, - 0x1e, 0x1d, 0xd2, 0xce, 0x60, 0xd8, 0x3d, 0x27, 0x23, 0x15, 0x8d, 0xb5, 0xa9, 0x68, 0xdc, 0xf5, - 0x46, 0xad, 0x3b, 0x31, 0x7a, 0x5a, 0xce, 0xf8, 0xe3, 0xaf, 0x6f, 0xad, 0xa9, 0xd4, 0xb0, 0x82, - 0xd1, 0x80, 0xf9, 0xcd, 0xc3, 0x61, 0xf7, 0x3e, 0x19, 0xf1, 0xf0, 0x2b, 0xd6, 0x43, 0xc1, 0x89, - 0x6e, 0x40, 0xe1, 0x47, 0xd8, 0xe9, 0x13, 0x5b, 0x38, 0xb4, 0x68, 0xaa, 0x15, 0xda, 0x86, 0x02, - 0x65, 0x98, 0x0d, 0xa9, 0xf0, 0xe2, 0xf2, 0x96, 0x31, 0x2b, 0xd5, 0x5a, 0xbe, 0x67, 0x1f, 0x09, - 0x4e, 0x53, 0x49, 0xa0, 0xfb, 0x50, 0x60, 0xfe, 0x39, 0xf1, 0x94, 0x0b, 0x3f, 0x79, 0xb9, 0xef, - 0x7b, 0xcc, 0x54, 0x10, 0x68, 0x04, 0x2b, 0x36, 0xe9, 0x93, 0x9e, 0xf0, 0x1e, 0x3d, 0xc3, 0x01, - 0xa1, 0xd5, 0x82, 0x80, 0x3d, 0x98, 0xaf, 0x1c, 0x95, 0xcf, 0xd2, 0xa0, 0x86, 0x59, 0x89, 0x48, - 0x47, 0x82, 0x82, 0xee, 0x43, 0xd9, 0x8e, 0x53, 0xb6, 0xba, 0x20, 0x82, 0xf1, 0x85, 0x59, 0x8e, - 0x48, 0x64, 0xb7, 0x6a, 0x88, 0x49, 0x69, 0x9e, 0x26, 0x43, 0xaf, 0xeb, 0x7b, 0xb6, 0xe3, 0xf5, - 0x3a, 0x67, 0xc4, 0xe9, 0x9d, 0xb1, 0x6a, 0xb1, 0xa1, 0x6d, 0xe4, 0x92, 0x69, 0x92, 0xe6, 0x30, - 0xcc, 0x4a, 0x44, 0xda, 0x13, 0x14, 0x64, 0xc3, 0x72, 0xcc, 0x25, 0x4a, 0xb6, 0xf4, 0xc2, 0x92, - 0x7d, 0x4d, 0x95, 0xec, 0xf5, 0xb4, 0x96, 0xb8, 0x6a, 0x97, 0x22, 0x22, 0x17, 0x43, 0x7b, 0x00, - 0x71, 0xa3, 0xa8, 0x82, 0xd0, 0x60, 0xbc, 0xb8, 0xdb, 0x28, 0xc3, 0x13, 0xb2, 0xe8, 0x5d, 0x0d, - 0xae, 0xb9, 0x8e, 0xd7, 0xa1, 0xa4, 0x7f, 0xda, 0x51, 0x1e, 0xe6, 0x98, 0x65, 0x11, 0xc3, 0xb7, - 0xe7, 0x48, 0x8d, 0xc9, 0x58, 0xaf, 0xa9, 0x96, 0x3a, 0x8d, 0x6b, 0x98, 0xab, 0xae, 0xe3, 0x1d, - 0x91, 0xfe, 0x69, 0x3b, 0xa2, 0x6d, 0x2f, 0xbe, 0xf7, 0x44, 0xcf, 0xa8, 0xf2, 0xcd, 0x18, 0x6f, - 0xc0, 0xe2, 0x09, 0xee, 0xab, 0xb2, 0x23, 0x14, 0xdd, 0x84, 0x12, 0x0e, 0x17, 0x55, 0xad, 0x91, - 0xdb, 0x28, 0x99, 0x31, 0x41, 0x96, 0xfd, 0x4f, 0xfe, 0xda, 0xd0, 0x8c, 0x5f, 0x69, 0x50, 0x68, - 0x9f, 0x1c, 0x62, 0x27, 0x40, 0xfb, 0xb0, 0x1a, 0xe7, 0xcf, 0xe5, 0xa2, 0xbf, 0x39, 0x19, 0xeb, - 0xd5, 0x74, 0x8a, 0x45, 0x55, 0x1f, 0xe7, 0x72, 0x58, 0xf6, 0xfb, 0xb0, 0xfa, 0x30, 0xec, 0x25, - 0x11, 0x54, 0x36, 0x0d, 0x35, 0xc5, 0x62, 0x98, 0x2b, 0x11, 0x4d, 0x41, 0xa5, 0xcc, 0xdc, 0x85, - 0x05, 0x79, 0x5a, 0x8a, 0xb6, 0xe1, 0x95, 0x01, 0xff, 0x21, 0xac, 0x2b, 0x6f, 0xd5, 0x67, 0xa6, - 0xb0, 0xe0, 0x57, 0x41, 0x94, 0x22, 0xc6, 0xcf, 0xb3, 0x00, 0xed, 0x93, 0x93, 0xe3, 0xc0, 0x19, - 0xf4, 0x09, 0xfb, 0x34, 0x2d, 0x3f, 0x86, 0xeb, 0xb1, 0x59, 0x34, 0xb0, 0x52, 0xd6, 0x37, 0x26, - 0x63, 0xfd, 0x66, 0xda, 0xfa, 0x04, 0x9b, 0x61, 0x5e, 0x8b, 0xe8, 0x47, 0x81, 0x75, 0x25, 0xaa, - 0x4d, 0x59, 0x84, 0x9a, 0x9b, 0x8d, 0x9a, 0x60, 0x4b, 0xa2, 0xb6, 0x29, 0xbb, 0xda, 0xb5, 0x47, - 0x50, 0x8e, 0x5d, 0x42, 0x51, 0x1b, 0x8a, 0x4c, 0xfd, 0x56, 0x1e, 0x36, 0x66, 0x7b, 0x38, 0x14, - 0x53, 0x5e, 0x8e, 0x24, 0x8d, 0xff, 0x68, 0x00, 0x71, 0xce, 0x7e, 0x36, 0x53, 0x8c, 0xb7, 0x76, - 0xd5, 0x83, 0x73, 0xf3, 0x4f, 0x72, 0x0a, 0x22, 0xe5, 0xd4, 0x9f, 0x65, 0xe1, 0xda, 0x83, 0xb0, - 0x09, 0x7d, 0xe6, 0x1d, 0x71, 0x08, 0x0b, 0xc4, 0x63, 0x81, 0x23, 0x3c, 0xc1, 0x43, 0xfe, 0xf5, - 0x59, 0x21, 0xbf, 0xc2, 0xa6, 0x5d, 0x8f, 0x05, 0x23, 0x95, 0x00, 0x21, 0x4c, 0xca, 0x1b, 0xbf, - 0xcc, 0x41, 0x75, 0x96, 0x24, 0xda, 0x81, 0x8a, 0x15, 0x10, 0x41, 0x08, 0xaf, 0x12, 0x4d, 0x5c, - 0x25, 0xb5, 0x78, 0xdc, 0x4c, 0x31, 0x18, 0xe6, 0x72, 0x48, 0x51, 0x17, 0x49, 0x0f, 0xf8, 0x2c, - 0xc8, 0x73, 0x8f, 0x73, 0xbd, 0xe4, 0xf0, 0x67, 0xa8, 0x9b, 0x24, 0x54, 0x72, 0x19, 0x40, 0x5e, - 0x25, 0xcb, 0x31, 0x55, 0xdc, 0x25, 0x0f, 0xa1, 0xe2, 0x78, 0x0e, 0x73, 0x70, 0xbf, 0xd3, 0xc5, - 0x7d, 0xec, 0x59, 0x73, 0xcf, 0xd3, 0xb2, 0xf9, 0x2b, 0xdd, 0x29, 0x4c, 0xc3, 0x5c, 0x56, 0x94, - 0x96, 0x24, 0xa0, 0xb7, 0x60, 0x21, 0xd4, 0x97, 0x9f, 0x7f, 0x0e, 0x09, 0x31, 0x12, 0xf3, 0xdf, - 0x2f, 0x72, 0xb0, 0x6a, 0x12, 0xfb, 0xff, 0x41, 0x99, 0x23, 0x28, 0x26, 0x80, 0xac, 0x7e, 0xde, - 0x74, 0xe7, 0x8d, 0x0b, 0x6f, 0x22, 0x25, 0x09, 0xd3, 0xa6, 0x2c, 0x11, 0x99, 0x71, 0x16, 0x16, - 0x93, 0x91, 0xf9, 0x1f, 0xbd, 0xae, 0xd0, 0x7e, 0xdc, 0x9d, 0xf2, 0xa2, 0x3b, 0x7d, 0x79, 0x56, - 0x77, 0x9a, 0xca, 0xe3, 0x8f, 0x6f, 0x4b, 0xff, 0xce, 0x42, 0xe1, 0x10, 0x07, 0xd8, 0xa5, 0xc8, - 0x9a, 0x1a, 0x44, 0xe5, 0xa3, 0x74, 0x7d, 0x2a, 0x53, 0xdb, 0xea, 0x2b, 0xc9, 0x0b, 0xe6, 0xd0, - 0x0f, 0xae, 0x98, 0x43, 0xbf, 0x03, 0xcb, 0xfc, 0xdd, 0x1c, 0xd9, 0x28, 0xbd, 0xbd, 0xd4, 0x5a, - 0x8f, 0x51, 0x2e, 0xef, 0xcb, 0x67, 0x75, 0xf4, 0x3a, 0xa3, 0xe8, 0x9b, 0x50, 0xe6, 0x1c, 0x71, - 0xb3, 0xe6, 0xe2, 0x37, 0xe2, 0xf7, 0x6b, 0x62, 0xd3, 0x30, 0xc1, 0xc5, 0x8f, 0x76, 0xe5, 0x02, - 0x7d, 0x17, 0xd0, 0x59, 0xf4, 0x45, 0xa5, 0x13, 0xbb, 0x93, 0xcb, 0x7f, 0x7e, 0x32, 0xd6, 0xd7, - 0xa5, 0xfc, 0x34, 0x8f, 0x61, 0xae, 0xc6, 0xc4, 0x10, 0xed, 0x1b, 0x00, 0xdc, 0xae, 0x8e, 0x4d, - 0x3c, 0xdf, 0x55, 0xef, 0xa2, 0xeb, 0x93, 0xb1, 0xbe, 0x2a, 0x51, 0xe2, 0x3d, 0xc3, 0x2c, 0xf1, - 0x45, 0x9b, 0xff, 0x4e, 0x64, 0xf6, 0x87, 0x1a, 0xa0, 0xf8, 0x1a, 0x30, 0x09, 0x1d, 0xf0, 0x87, - 0x1c, 0x9f, 0xd3, 0x13, 0x33, 0xb5, 0xf6, 0xf1, 0x73, 0x7a, 0x2c, 0x1f, 0xce, 0xe9, 0x89, 0x4a, - 0xf9, 0x56, 0xdc, 0x2d, 0xb3, 0x2a, 0x8e, 0x0a, 0xa6, 0x8b, 0x29, 0x49, 0xcc, 0xfa, 0x4e, 0x28, - 0x3d, 0xd5, 0x19, 0x33, 0xc6, 0x53, 0x0d, 0xd6, 0xa7, 0x32, 0x2a, 0x3a, 0xec, 0x0f, 0x01, 0x05, - 0x89, 0x4d, 0xe1, 0xaf, 0x91, 0x3a, 0xf4, 0x27, 0x4e, 0xd0, 0xd5, 0x60, 0xaa, 0x03, 0x7f, 0xca, - 0x0d, 0x3f, 0x2f, 0x1c, 0xff, 0x7b, 0x0d, 0xd6, 0x92, 0x67, 0x88, 0xac, 0x39, 0x80, 0xc5, 0xe4, - 0x11, 0x94, 0x1d, 0xaf, 0xbf, 0x8c, 0x1d, 0xca, 0x84, 0x4b, 0xf2, 0xe8, 0xed, 0xb8, 0x66, 0xe5, - 0x87, 0xb7, 0xdb, 0x2f, 0xed, 0x92, 0xf0, 0x4c, 0xe9, 0xda, 0xcd, 0x8b, 0xa0, 0x5c, 0x64, 0x21, - 0x7f, 0xe8, 0xfb, 0x7d, 0xc4, 0x60, 0xd5, 0xf3, 0x59, 0x87, 0xa7, 0x17, 0xb1, 0x3b, 0xea, 0x89, - 0x2e, 0x9b, 0xe1, 0xde, 0x1c, 0x9e, 0xfa, 0xe7, 0x58, 0x9f, 0xc6, 0x33, 0x2b, 0x9e, 0xcf, 0x5a, - 0x82, 0x72, 0x2c, 0x1f, 0xf0, 0xef, 0x6a, 0xb0, 0x74, 0x59, 0xa5, 0x6c, 0x98, 0xef, 0xcc, 0xa7, - 0xf2, 0x32, 0xd6, 0x64, 0xac, 0xaf, 0xc5, 0x15, 0x14, 0x91, 0x0d, 0x73, 0xb1, 0x9b, 0x38, 0xc3, - 0x76, 0x91, 0x87, 0xf2, 0x5f, 0x4f, 0x74, 0xed, 0x2b, 0xbf, 0xd1, 0x00, 0xe2, 0x4f, 0x16, 0xe8, - 0x6b, 0xf0, 0x6a, 0xeb, 0x7b, 0x07, 0xed, 0xce, 0xd1, 0xf1, 0xdd, 0xe3, 0x07, 0x47, 0x9d, 0x07, - 0x07, 0x47, 0x87, 0xbb, 0x3b, 0xfb, 0xf7, 0xf6, 0x77, 0xdb, 0x2b, 0x99, 0x5a, 0xe5, 0xe2, 0x71, - 0xa3, 0xfc, 0xc0, 0xa3, 0x03, 0x62, 0x39, 0xa7, 0x0e, 0xb1, 0xd1, 0x17, 0x61, 0xed, 0x32, 0x37, - 0x5f, 0xed, 0xb6, 0x57, 0xb4, 0xda, 0xe2, 0xc5, 0xe3, 0x46, 0x51, 0xce, 0x6b, 0xc4, 0x46, 0x1b, - 0x70, 0x7d, 0x9a, 0x6f, 0xff, 0xe0, 0xcd, 0x95, 0x6c, 0x6d, 0xe9, 0xe2, 0x71, 0xa3, 0x14, 0x0d, - 0x76, 0xc8, 0x00, 0x94, 0xe4, 0x54, 0x78, 0xb9, 0x1a, 0x5c, 0x3c, 0x6e, 0x14, 0xa4, 0x1b, 0x6b, - 0xf9, 0xf7, 0x3e, 0xac, 0x67, 0x5a, 0xf7, 0x3f, 0x7a, 0x56, 0xd7, 0x9e, 0x3e, 0xab, 0x6b, 0x7f, - 0x7f, 0x56, 0xd7, 0xde, 0x7f, 0x5e, 0xcf, 0x3c, 0x7d, 0x5e, 0xcf, 0xfc, 0xf9, 0x79, 0x3d, 0xf3, - 0xfd, 0xdb, 0x2f, 0x76, 0xa0, 0xeb, 0xdb, 0xc3, 0x3e, 0x89, 0xbe, 0x93, 0x77, 0x0b, 0xa2, 0x37, - 0xdf, 0xf9, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xe1, 0xfb, 0x79, 0x40, 0x17, 0x00, 0x00, -} - -func (this *Pool) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { - return StakingDescription() -} -func StakingDescription() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) { - d := &github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet{} - var gzipped = []byte{ - // 9503 bytes of a gzipped FileDescriptorSet - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x7d, 0x6d, 0x70, 0x24, 0xd7, - 0x71, 0xd8, 0xcd, 0xee, 0x02, 0xd8, 0x6d, 0x7c, 0x2d, 0x1e, 0x70, 0x77, 0x7b, 0xcb, 0x23, 0x00, - 0x0e, 0xbf, 0x8e, 0x47, 0x1e, 0x40, 0x1e, 0x79, 0xc7, 0xe3, 0x9e, 0x44, 0x0a, 0x0b, 0xec, 0xe1, - 0xc0, 0xc3, 0x17, 0x07, 0xc0, 0xe9, 0xd3, 0x99, 0x1a, 0xcc, 0x3e, 0x2c, 0x86, 0xd8, 0x9d, 0x19, - 0xce, 0xcc, 0xde, 0x1d, 0xa8, 0xa8, 0x8a, 0x92, 0x12, 0x47, 0xa2, 0x93, 0x58, 0x8a, 0x5d, 0xb6, - 0x44, 0xeb, 0x64, 0xc9, 0x72, 0x22, 0x47, 0x76, 0x12, 0xdb, 0x52, 0x94, 0x38, 0x71, 0x25, 0x52, - 0x52, 0x8e, 0x25, 0x55, 0xc5, 0x45, 0x95, 0x53, 0x89, 0xe3, 0x8a, 0xcf, 0x0e, 0xa5, 0x72, 0x68, - 0x45, 0x49, 0x94, 0x8b, 0xec, 0x24, 0xa5, 0x4a, 0x55, 0xea, 0x7d, 0xcd, 0xd7, 0x7e, 0xcc, 0x02, - 0xba, 0x93, 0xe4, 0x38, 0xbf, 0xb0, 0xaf, 0x5f, 0x77, 0xbf, 0xee, 0x7e, 0xdd, 0xfd, 0xfa, 0xbd, - 0x99, 0x37, 0x80, 0x7f, 0x79, 0x11, 0xa6, 0x6b, 0x96, 0x55, 0xab, 0xe3, 0x59, 0xdb, 0xb1, 0x3c, - 0x6b, 0xbb, 0xb9, 0x33, 0x5b, 0xc5, 0xae, 0xee, 0x18, 0xb6, 0x67, 0x39, 0x33, 0x14, 0x86, 0x46, - 0x19, 0xc6, 0x8c, 0xc0, 0x90, 0x57, 0x60, 0xec, 0x92, 0x51, 0xc7, 0x0b, 0x3e, 0xe2, 0x06, 0xf6, - 0xd0, 0x05, 0xc8, 0xec, 0x18, 0x75, 0x5c, 0x90, 0xa6, 0xd3, 0xa7, 0x06, 0xcf, 0x3e, 0x30, 0x13, - 0x23, 0x9a, 0x89, 0x52, 0xac, 0x13, 0xb0, 0x42, 0x29, 0xe4, 0x6f, 0x66, 0x60, 0xbc, 0x4d, 0x2f, - 0x42, 0x90, 0x31, 0xb5, 0x06, 0xe1, 0x28, 0x9d, 0xca, 0x29, 0xf4, 0x37, 0x2a, 0xc0, 0x80, 0xad, - 0xe9, 0x7b, 0x5a, 0x0d, 0x17, 0x52, 0x14, 0x2c, 0x9a, 0x68, 0x12, 0xa0, 0x8a, 0x6d, 0x6c, 0x56, - 0xb1, 0xa9, 0xef, 0x17, 0xd2, 0xd3, 0xe9, 0x53, 0x39, 0x25, 0x04, 0x41, 0x8f, 0xc2, 0x98, 0xdd, - 0xdc, 0xae, 0x1b, 0xba, 0x1a, 0x42, 0x83, 0xe9, 0xf4, 0xa9, 0x3e, 0x25, 0xcf, 0x3a, 0x16, 0x02, - 0xe4, 0x87, 0x61, 0xf4, 0x3a, 0xd6, 0xf6, 0xc2, 0xa8, 0x83, 0x14, 0x75, 0x84, 0x80, 0x43, 0x88, - 0xf3, 0x30, 0xd4, 0xc0, 0xae, 0xab, 0xd5, 0xb0, 0xea, 0xed, 0xdb, 0xb8, 0x90, 0xa1, 0xda, 0x4f, - 0xb7, 0x68, 0x1f, 0xd7, 0x7c, 0x90, 0x53, 0x6d, 0xee, 0xdb, 0x18, 0xcd, 0x41, 0x0e, 0x9b, 0xcd, - 0x06, 0xe3, 0xd0, 0xd7, 0xc1, 0x7e, 0x15, 0xb3, 0xd9, 0x88, 0x73, 0xc9, 0x12, 0x32, 0xce, 0x62, - 0xc0, 0xc5, 0xce, 0x35, 0x43, 0xc7, 0x85, 0x7e, 0xca, 0xe0, 0xe1, 0x16, 0x06, 0x1b, 0xac, 0x3f, - 0xce, 0x43, 0xd0, 0xa1, 0x79, 0xc8, 0xe1, 0x1b, 0x1e, 0x36, 0x5d, 0xc3, 0x32, 0x0b, 0x03, 0x94, - 0xc9, 0x83, 0x6d, 0x66, 0x11, 0xd7, 0xab, 0x71, 0x16, 0x01, 0x1d, 0x3a, 0x0f, 0x03, 0x96, 0xed, - 0x19, 0x96, 0xe9, 0x16, 0xb2, 0xd3, 0xd2, 0xa9, 0xc1, 0xb3, 0x27, 0xdb, 0x3a, 0xc2, 0x1a, 0xc3, - 0x51, 0x04, 0x32, 0x5a, 0x82, 0xbc, 0x6b, 0x35, 0x1d, 0x1d, 0xab, 0xba, 0x55, 0xc5, 0xaa, 0x61, - 0xee, 0x58, 0x85, 0x1c, 0x65, 0x30, 0xd5, 0xaa, 0x08, 0x45, 0x9c, 0xb7, 0xaa, 0x78, 0xc9, 0xdc, - 0xb1, 0x94, 0x11, 0x37, 0xd2, 0x46, 0xc7, 0xa0, 0xdf, 0xdd, 0x37, 0x3d, 0xed, 0x46, 0x61, 0x88, - 0x7a, 0x08, 0x6f, 0xc9, 0xbf, 0xd1, 0x0f, 0xa3, 0xbd, 0xb8, 0xd8, 0x45, 0xe8, 0xdb, 0x21, 0x5a, - 0x16, 0x52, 0x07, 0xb1, 0x01, 0xa3, 0x89, 0x1a, 0xb1, 0xff, 0x90, 0x46, 0x9c, 0x83, 0x41, 0x13, - 0xbb, 0x1e, 0xae, 0x32, 0x8f, 0x48, 0xf7, 0xe8, 0x53, 0xc0, 0x88, 0x5a, 0x5d, 0x2a, 0x73, 0x28, - 0x97, 0x7a, 0x07, 0x8c, 0xfa, 0x22, 0xa9, 0x8e, 0x66, 0xd6, 0x84, 0x6f, 0xce, 0x26, 0x49, 0x32, - 0x53, 0x11, 0x74, 0x0a, 0x21, 0x53, 0x46, 0x70, 0xa4, 0x8d, 0x16, 0x00, 0x2c, 0x13, 0x5b, 0x3b, - 0x6a, 0x15, 0xeb, 0xf5, 0x42, 0xb6, 0x83, 0x95, 0xd6, 0x08, 0x4a, 0x8b, 0x95, 0x2c, 0x06, 0xd5, - 0xeb, 0xe8, 0x99, 0xc0, 0xd5, 0x06, 0x3a, 0x78, 0xca, 0x0a, 0x0b, 0xb2, 0x16, 0x6f, 0xdb, 0x82, - 0x11, 0x07, 0x13, 0xbf, 0xc7, 0x55, 0xae, 0x59, 0x8e, 0x0a, 0x31, 0x93, 0xa8, 0x99, 0xc2, 0xc9, - 0x98, 0x62, 0xc3, 0x4e, 0xb8, 0x89, 0xee, 0x07, 0x1f, 0xa0, 0x52, 0xb7, 0x02, 0x9a, 0x85, 0x86, - 0x04, 0x70, 0x55, 0x6b, 0xe0, 0xe2, 0xcb, 0x30, 0x12, 0x35, 0x0f, 0x9a, 0x80, 0x3e, 0xd7, 0xd3, - 0x1c, 0x8f, 0x7a, 0x61, 0x9f, 0xc2, 0x1a, 0x28, 0x0f, 0x69, 0x6c, 0x56, 0x69, 0x96, 0xeb, 0x53, - 0xc8, 0x4f, 0xf4, 0xb6, 0x40, 0xe1, 0x34, 0x55, 0xf8, 0xa1, 0xd6, 0x19, 0x8d, 0x70, 0x8e, 0xeb, - 0x5d, 0x7c, 0x1a, 0x86, 0x23, 0x0a, 0xf4, 0x3a, 0xb4, 0xfc, 0x97, 0xe1, 0x68, 0x5b, 0xd6, 0xe8, - 0x1d, 0x30, 0xd1, 0x34, 0x0d, 0xd3, 0xc3, 0x8e, 0xed, 0x60, 0xe2, 0xb1, 0x6c, 0xa8, 0xc2, 0x7f, - 0x1a, 0xe8, 0xe0, 0x73, 0x5b, 0x61, 0x6c, 0xc6, 0x45, 0x19, 0x6f, 0xb6, 0x02, 0x4f, 0xe7, 0xb2, - 0x6f, 0x0e, 0xe4, 0x5f, 0x79, 0xe5, 0x95, 0x57, 0x52, 0xf2, 0x97, 0xfb, 0x61, 0xa2, 0x5d, 0xcc, - 0xb4, 0x0d, 0xdf, 0x63, 0xd0, 0x6f, 0x36, 0x1b, 0xdb, 0xd8, 0xa1, 0x46, 0xea, 0x53, 0x78, 0x0b, - 0xcd, 0x41, 0x5f, 0x5d, 0xdb, 0xc6, 0xf5, 0x42, 0x66, 0x5a, 0x3a, 0x35, 0x72, 0xf6, 0xd1, 0x9e, - 0xa2, 0x72, 0x66, 0x99, 0x90, 0x28, 0x8c, 0x12, 0x3d, 0x0b, 0x19, 0x9e, 0xa2, 0x09, 0x87, 0xd3, - 0xbd, 0x71, 0x20, 0xb1, 0xa4, 0x50, 0x3a, 0x74, 0x0f, 0xe4, 0xc8, 0x5f, 0xe6, 0x1b, 0xfd, 0x54, - 0xe6, 0x2c, 0x01, 0x10, 0xbf, 0x40, 0x45, 0xc8, 0xd2, 0x30, 0xa9, 0x62, 0xb1, 0xb4, 0xf9, 0x6d, - 0xe2, 0x58, 0x55, 0xbc, 0xa3, 0x35, 0xeb, 0x9e, 0x7a, 0x4d, 0xab, 0x37, 0x31, 0x75, 0xf8, 0x9c, - 0x32, 0xc4, 0x81, 0x57, 0x09, 0x0c, 0x4d, 0xc1, 0x20, 0x8b, 0x2a, 0xc3, 0xac, 0xe2, 0x1b, 0x34, - 0x7b, 0xf6, 0x29, 0x2c, 0xd0, 0x96, 0x08, 0x84, 0x0c, 0xff, 0xa2, 0x6b, 0x99, 0xc2, 0x35, 0xe9, - 0x10, 0x04, 0x40, 0x87, 0x7f, 0x3a, 0x9e, 0xb8, 0xef, 0x6d, 0xaf, 0x5e, 0x4b, 0x2c, 0x3d, 0x0c, - 0xa3, 0x14, 0xe3, 0x49, 0x3e, 0xf5, 0x5a, 0xbd, 0x30, 0x36, 0x2d, 0x9d, 0xca, 0x2a, 0x23, 0x0c, - 0xbc, 0xc6, 0xa1, 0xf2, 0x17, 0x53, 0x90, 0xa1, 0x89, 0x65, 0x14, 0x06, 0x37, 0xdf, 0xb9, 0x5e, - 0x51, 0x17, 0xd6, 0xb6, 0xca, 0xcb, 0x95, 0xbc, 0x84, 0x46, 0x00, 0x28, 0xe0, 0xd2, 0xf2, 0xda, - 0xdc, 0x66, 0x3e, 0xe5, 0xb7, 0x97, 0x56, 0x37, 0xcf, 0x3f, 0x95, 0x4f, 0xfb, 0x04, 0x5b, 0x0c, - 0x90, 0x09, 0x23, 0x3c, 0x79, 0x36, 0xdf, 0x87, 0xf2, 0x30, 0xc4, 0x18, 0x2c, 0xbd, 0xa3, 0xb2, - 0x70, 0xfe, 0xa9, 0x7c, 0x7f, 0x14, 0xf2, 0xe4, 0xd9, 0xfc, 0x00, 0x1a, 0x86, 0x1c, 0x85, 0x94, - 0xd7, 0xd6, 0x96, 0xf3, 0x59, 0x9f, 0xe7, 0xc6, 0xa6, 0xb2, 0xb4, 0xba, 0x98, 0xcf, 0xf9, 0x3c, - 0x17, 0x95, 0xb5, 0xad, 0xf5, 0x3c, 0xf8, 0x1c, 0x56, 0x2a, 0x1b, 0x1b, 0x73, 0x8b, 0x95, 0xfc, - 0xa0, 0x8f, 0x51, 0x7e, 0xe7, 0x66, 0x65, 0x23, 0x3f, 0x14, 0x11, 0xeb, 0xc9, 0xb3, 0xf9, 0x61, - 0x7f, 0x88, 0xca, 0xea, 0xd6, 0x4a, 0x7e, 0x04, 0x8d, 0xc1, 0x30, 0x1b, 0x42, 0x08, 0x31, 0x1a, - 0x03, 0x9d, 0x7f, 0x2a, 0x9f, 0x0f, 0x04, 0x61, 0x5c, 0xc6, 0x22, 0x80, 0xf3, 0x4f, 0xe5, 0x91, - 0x3c, 0x0f, 0x7d, 0xd4, 0x0d, 0x11, 0x82, 0x91, 0xe5, 0xb9, 0x72, 0x65, 0x59, 0x5d, 0x5b, 0xdf, - 0x5c, 0x5a, 0x5b, 0x9d, 0x5b, 0xce, 0x4b, 0x01, 0x4c, 0xa9, 0xbc, 0xb0, 0xb5, 0xa4, 0x54, 0x16, - 0xf2, 0xa9, 0x30, 0x6c, 0xbd, 0x32, 0xb7, 0x59, 0x59, 0xc8, 0xa7, 0x65, 0x1d, 0x26, 0xda, 0x25, - 0xd4, 0xb6, 0x21, 0x14, 0xf2, 0x85, 0x54, 0x07, 0x5f, 0xa0, 0xbc, 0xe2, 0xbe, 0x20, 0x7f, 0x23, - 0x05, 0xe3, 0x6d, 0x16, 0x95, 0xb6, 0x83, 0x3c, 0x07, 0x7d, 0xcc, 0x97, 0xd9, 0x32, 0xfb, 0x48, - 0xdb, 0xd5, 0x89, 0x7a, 0x76, 0xcb, 0x52, 0x4b, 0xe9, 0xc2, 0xa5, 0x46, 0xba, 0x43, 0xa9, 0x41, - 0x58, 0xb4, 0x38, 0xec, 0x8f, 0xb5, 0x24, 0x7f, 0xb6, 0x3e, 0x9e, 0xef, 0x65, 0x7d, 0xa4, 0xb0, - 0x83, 0x2d, 0x02, 0x7d, 0x6d, 0x16, 0x81, 0x8b, 0x30, 0xd6, 0xc2, 0xa8, 0xe7, 0x64, 0xfc, 0x41, - 0x09, 0x0a, 0x9d, 0x8c, 0x93, 0x90, 0x12, 0x53, 0x91, 0x94, 0x78, 0x31, 0x6e, 0xc1, 0xfb, 0x3a, - 0x4f, 0x42, 0xcb, 0x5c, 0x7f, 0x56, 0x82, 0x63, 0xed, 0x4b, 0xca, 0xb6, 0x32, 0x3c, 0x0b, 0xfd, - 0x0d, 0xec, 0xed, 0x5a, 0xa2, 0xac, 0x7a, 0xa8, 0xcd, 0x62, 0x4d, 0xba, 0xe3, 0x93, 0xcd, 0xa9, - 0xc2, 0xab, 0x7d, 0xba, 0x53, 0x5d, 0xc8, 0xa4, 0x69, 0x91, 0xf4, 0xc3, 0x29, 0x38, 0xda, 0x96, - 0x79, 0x5b, 0x41, 0xef, 0x05, 0x30, 0x4c, 0xbb, 0xe9, 0xb1, 0xd2, 0x89, 0x65, 0xe2, 0x1c, 0x85, - 0xd0, 0xe4, 0x45, 0xb2, 0x6c, 0xd3, 0xf3, 0xfb, 0xd3, 0xb4, 0x1f, 0x18, 0x88, 0x22, 0x5c, 0x08, - 0x04, 0xcd, 0x50, 0x41, 0x27, 0x3b, 0x68, 0xda, 0xe2, 0x98, 0x8f, 0x43, 0x5e, 0xaf, 0x1b, 0xd8, - 0xf4, 0x54, 0xd7, 0x73, 0xb0, 0xd6, 0x30, 0xcc, 0x1a, 0x5d, 0x6a, 0xb2, 0xa5, 0xbe, 0x1d, 0xad, - 0xee, 0x62, 0x65, 0x94, 0x75, 0x6f, 0x88, 0x5e, 0x42, 0x41, 0x1d, 0xc8, 0x09, 0x51, 0xf4, 0x47, - 0x28, 0x58, 0xb7, 0x4f, 0x21, 0x7f, 0x34, 0x07, 0x83, 0xa1, 0x02, 0x1c, 0xdd, 0x07, 0x43, 0x2f, - 0x6a, 0xd7, 0x34, 0x55, 0x6c, 0xaa, 0x98, 0x25, 0x06, 0x09, 0x6c, 0x9d, 0x6f, 0xac, 0x1e, 0x87, - 0x09, 0x8a, 0x62, 0x35, 0x3d, 0xec, 0xa8, 0x7a, 0x5d, 0x73, 0x5d, 0x6a, 0xb4, 0x2c, 0x45, 0x45, - 0xa4, 0x6f, 0x8d, 0x74, 0xcd, 0x8b, 0x1e, 0x74, 0x0e, 0xc6, 0x29, 0x45, 0xa3, 0x59, 0xf7, 0x0c, - 0xbb, 0x8e, 0x55, 0xb2, 0xcd, 0x73, 0xe9, 0x92, 0xe3, 0x4b, 0x36, 0x46, 0x30, 0x56, 0x38, 0x02, - 0x91, 0xc8, 0x45, 0x0b, 0x70, 0x2f, 0x25, 0xab, 0x61, 0x13, 0x3b, 0x9a, 0x87, 0x55, 0xfc, 0x52, - 0x53, 0xab, 0xbb, 0xaa, 0x66, 0x56, 0xd5, 0x5d, 0xcd, 0xdd, 0x2d, 0x4c, 0x10, 0x06, 0xe5, 0x54, - 0x41, 0x52, 0x4e, 0x10, 0xc4, 0x45, 0x8e, 0x57, 0xa1, 0x68, 0x73, 0x66, 0xf5, 0xb2, 0xe6, 0xee, - 0xa2, 0x12, 0x1c, 0xa3, 0x5c, 0x5c, 0xcf, 0x31, 0xcc, 0x9a, 0xaa, 0xef, 0x62, 0x7d, 0x4f, 0x6d, - 0x7a, 0x3b, 0x17, 0x0a, 0xf7, 0x84, 0xc7, 0xa7, 0x12, 0x6e, 0x50, 0x9c, 0x79, 0x82, 0xb2, 0xe5, - 0xed, 0x5c, 0x40, 0x1b, 0x30, 0x44, 0x26, 0xa3, 0x61, 0xbc, 0x8c, 0xd5, 0x1d, 0xcb, 0xa1, 0x6b, - 0xe8, 0x48, 0x9b, 0xd4, 0x14, 0xb2, 0xe0, 0xcc, 0x1a, 0x27, 0x58, 0xb1, 0xaa, 0xb8, 0xd4, 0xb7, - 0xb1, 0x5e, 0xa9, 0x2c, 0x28, 0x83, 0x82, 0xcb, 0x25, 0xcb, 0x21, 0x0e, 0x55, 0xb3, 0x7c, 0x03, - 0x0f, 0x32, 0x87, 0xaa, 0x59, 0xc2, 0xbc, 0xe7, 0x60, 0x5c, 0xd7, 0x99, 0xce, 0x86, 0xae, 0xf2, - 0xcd, 0x98, 0x5b, 0xc8, 0x47, 0x8c, 0xa5, 0xeb, 0x8b, 0x0c, 0x81, 0xfb, 0xb8, 0x8b, 0x9e, 0x81, - 0xa3, 0x81, 0xb1, 0xc2, 0x84, 0x63, 0x2d, 0x5a, 0xc6, 0x49, 0xcf, 0xc1, 0xb8, 0xbd, 0xdf, 0x4a, - 0x88, 0x22, 0x23, 0xda, 0xfb, 0x71, 0xb2, 0xa7, 0x61, 0xc2, 0xde, 0xb5, 0x5b, 0xe9, 0x4e, 0x87, - 0xe9, 0x90, 0xbd, 0x6b, 0xc7, 0x09, 0x1f, 0xa4, 0x3b, 0x73, 0x07, 0xeb, 0x9a, 0x87, 0xab, 0x85, - 0xe3, 0x61, 0xf4, 0x50, 0x07, 0x9a, 0x81, 0xbc, 0xae, 0xab, 0xd8, 0xd4, 0xb6, 0xeb, 0x58, 0xd5, - 0x1c, 0x6c, 0x6a, 0x6e, 0x61, 0x8a, 0x22, 0x67, 0x3c, 0xa7, 0x89, 0x95, 0x11, 0x5d, 0xaf, 0xd0, - 0xce, 0x39, 0xda, 0x87, 0x4e, 0xc3, 0x98, 0xb5, 0xfd, 0xa2, 0xce, 0x3c, 0x52, 0xb5, 0x1d, 0xbc, - 0x63, 0xdc, 0x28, 0x3c, 0x40, 0xcd, 0x3b, 0x4a, 0x3a, 0xa8, 0x3f, 0xae, 0x53, 0x30, 0x7a, 0x04, - 0xf2, 0xba, 0xbb, 0xab, 0x39, 0x36, 0x4d, 0xc9, 0xae, 0xad, 0xe9, 0xb8, 0xf0, 0x20, 0x43, 0x65, - 0xf0, 0x55, 0x01, 0x26, 0x11, 0xe1, 0x5e, 0x37, 0x76, 0x3c, 0xc1, 0xf1, 0x61, 0x16, 0x11, 0x14, - 0xc6, 0xb9, 0x9d, 0x82, 0x3c, 0xb1, 0x44, 0x64, 0xe0, 0x53, 0x14, 0x6d, 0xc4, 0xde, 0xb5, 0xc3, - 0xe3, 0xde, 0x0f, 0xc3, 0x04, 0x33, 0x18, 0xf4, 0x11, 0x56, 0xb8, 0xd9, 0xbb, 0xa1, 0x11, 0x9f, - 0x82, 0x63, 0x04, 0xa9, 0x81, 0x3d, 0xad, 0xaa, 0x79, 0x5a, 0x08, 0xfb, 0x31, 0x8a, 0x4d, 0xcc, - 0xbe, 0xc2, 0x3b, 0x23, 0x72, 0x3a, 0xcd, 0xed, 0x7d, 0xdf, 0xb1, 0xce, 0x30, 0x39, 0x09, 0x4c, - 0xb8, 0xd6, 0x5d, 0x2b, 0xce, 0xe5, 0x12, 0x0c, 0x85, 0xfd, 0x1e, 0xe5, 0x80, 0x79, 0x7e, 0x5e, - 0x22, 0x45, 0xd0, 0xfc, 0xda, 0x02, 0x29, 0x5f, 0xde, 0x55, 0xc9, 0xa7, 0x48, 0x19, 0xb5, 0xbc, - 0xb4, 0x59, 0x51, 0x95, 0xad, 0xd5, 0xcd, 0xa5, 0x95, 0x4a, 0x3e, 0x1d, 0x2a, 0xec, 0x9f, 0xcf, - 0x64, 0x1f, 0xca, 0x3f, 0x2c, 0x7f, 0x3d, 0x05, 0x23, 0xd1, 0x9d, 0x1a, 0x7a, 0x0b, 0x1c, 0x17, - 0xc7, 0x2a, 0x2e, 0xf6, 0xd4, 0xeb, 0x86, 0x43, 0x03, 0xb2, 0xa1, 0xb1, 0xc5, 0xd1, 0xf7, 0x9f, - 0x09, 0x8e, 0xb5, 0x81, 0xbd, 0xb7, 0x1b, 0x0e, 0x09, 0xb7, 0x86, 0xe6, 0xa1, 0x65, 0x98, 0x32, - 0x2d, 0xd5, 0xf5, 0x34, 0xb3, 0xaa, 0x39, 0x55, 0x35, 0x38, 0xd0, 0x52, 0x35, 0x5d, 0xc7, 0xae, - 0x6b, 0xb1, 0x85, 0xd0, 0xe7, 0x72, 0xd2, 0xb4, 0x36, 0x38, 0x72, 0xb0, 0x42, 0xcc, 0x71, 0xd4, - 0x98, 0xfb, 0xa6, 0x3b, 0xb9, 0xef, 0x3d, 0x90, 0x6b, 0x68, 0xb6, 0x8a, 0x4d, 0xcf, 0xd9, 0xa7, - 0xf5, 0x79, 0x56, 0xc9, 0x36, 0x34, 0xbb, 0x42, 0xda, 0x3f, 0x90, 0x6d, 0xd2, 0xf3, 0x99, 0x6c, - 0x36, 0x9f, 0x7b, 0x3e, 0x93, 0xcd, 0xe5, 0x41, 0x7e, 0x23, 0x0d, 0x43, 0xe1, 0x7a, 0x9d, 0x6c, - 0x7f, 0x74, 0xba, 0x62, 0x49, 0x34, 0xa7, 0xdd, 0xdf, 0xb5, 0xba, 0x9f, 0x99, 0x27, 0x4b, 0x59, - 0xa9, 0x9f, 0x15, 0xc7, 0x0a, 0xa3, 0x24, 0x65, 0x04, 0x71, 0x36, 0xcc, 0x8a, 0x91, 0xac, 0xc2, - 0x5b, 0x68, 0x11, 0xfa, 0x5f, 0x74, 0x29, 0xef, 0x7e, 0xca, 0xfb, 0x81, 0xee, 0xbc, 0x9f, 0xdf, - 0xa0, 0xcc, 0x73, 0xcf, 0x6f, 0xa8, 0xab, 0x6b, 0xca, 0xca, 0xdc, 0xb2, 0xc2, 0xc9, 0xd1, 0x09, - 0xc8, 0xd4, 0xb5, 0x97, 0xf7, 0xa3, 0x8b, 0x1e, 0x05, 0xf5, 0x3a, 0x09, 0x27, 0x20, 0x73, 0x1d, - 0x6b, 0x7b, 0xd1, 0xa5, 0x86, 0x82, 0xee, 0x62, 0x30, 0xcc, 0x42, 0x1f, 0xb5, 0x17, 0x02, 0xe0, - 0x16, 0xcb, 0x1f, 0x41, 0x59, 0xc8, 0xcc, 0xaf, 0x29, 0x24, 0x20, 0xf2, 0x30, 0xc4, 0xa0, 0xea, - 0xfa, 0x52, 0x65, 0xbe, 0x92, 0x4f, 0xc9, 0xe7, 0xa0, 0x9f, 0x19, 0x81, 0x04, 0x8b, 0x6f, 0x86, - 0xfc, 0x11, 0xde, 0xe4, 0x3c, 0x24, 0xd1, 0xbb, 0xb5, 0x52, 0xae, 0x28, 0xf9, 0x54, 0x74, 0xaa, - 0x33, 0xf9, 0x3e, 0xd9, 0x85, 0xa1, 0x70, 0x1d, 0xfe, 0x83, 0xd9, 0x8c, 0x7f, 0x49, 0x82, 0xc1, - 0x50, 0x5d, 0x4d, 0x0a, 0x22, 0xad, 0x5e, 0xb7, 0xae, 0xab, 0x5a, 0xdd, 0xd0, 0x5c, 0xee, 0x1a, - 0x40, 0x41, 0x73, 0x04, 0xd2, 0xeb, 0xd4, 0xfd, 0x80, 0x42, 0xa4, 0x2f, 0xdf, 0x2f, 0x7f, 0x52, - 0x82, 0x7c, 0xbc, 0xb0, 0x8d, 0x89, 0x29, 0xfd, 0x30, 0xc5, 0x94, 0x3f, 0x21, 0xc1, 0x48, 0xb4, - 0x9a, 0x8d, 0x89, 0x77, 0xdf, 0x0f, 0x55, 0xbc, 0x3f, 0x4a, 0xc1, 0x70, 0xa4, 0x86, 0xed, 0x55, - 0xba, 0x97, 0x60, 0xcc, 0xa8, 0xe2, 0x86, 0x6d, 0x79, 0xd8, 0xd4, 0xf7, 0xd5, 0x3a, 0xbe, 0x86, - 0xeb, 0x05, 0x99, 0x26, 0x8d, 0xd9, 0xee, 0x55, 0xf2, 0xcc, 0x52, 0x40, 0xb7, 0x4c, 0xc8, 0x4a, - 0xe3, 0x4b, 0x0b, 0x95, 0x95, 0xf5, 0xb5, 0xcd, 0xca, 0xea, 0xfc, 0x3b, 0xd5, 0xad, 0xd5, 0x2b, - 0xab, 0x6b, 0x6f, 0x5f, 0x55, 0xf2, 0x46, 0x0c, 0xed, 0x2e, 0x86, 0xfd, 0x3a, 0xe4, 0xe3, 0x42, - 0xa1, 0xe3, 0xd0, 0x4e, 0xac, 0xfc, 0x11, 0x34, 0x0e, 0xa3, 0xab, 0x6b, 0xea, 0xc6, 0xd2, 0x42, - 0x45, 0xad, 0x5c, 0xba, 0x54, 0x99, 0xdf, 0xdc, 0x60, 0xe7, 0x1e, 0x3e, 0xf6, 0x66, 0x24, 0xc0, - 0xe5, 0xd7, 0xd2, 0x30, 0xde, 0x46, 0x12, 0x34, 0xc7, 0x77, 0x2c, 0x6c, 0x13, 0x75, 0xa6, 0x17, - 0xe9, 0x67, 0x48, 0xcd, 0xb0, 0xae, 0x39, 0x1e, 0xdf, 0xe0, 0x3c, 0x02, 0xc4, 0x4a, 0xa6, 0x67, - 0xec, 0x18, 0xd8, 0xe1, 0xe7, 0x49, 0x6c, 0x1b, 0x33, 0x1a, 0xc0, 0xd9, 0x91, 0xd2, 0x63, 0x80, - 0x6c, 0xcb, 0x35, 0x3c, 0xe3, 0x1a, 0x56, 0x0d, 0x53, 0x1c, 0x3e, 0x91, 0x6d, 0x4d, 0x46, 0xc9, - 0x8b, 0x9e, 0x25, 0xd3, 0xf3, 0xb1, 0x4d, 0x5c, 0xd3, 0x62, 0xd8, 0x24, 0x99, 0xa7, 0x95, 0xbc, - 0xe8, 0xf1, 0xb1, 0xef, 0x83, 0xa1, 0xaa, 0xd5, 0x24, 0xb5, 0x1e, 0xc3, 0x23, 0x6b, 0x87, 0xa4, - 0x0c, 0x32, 0x98, 0x8f, 0xc2, 0xab, 0xf8, 0xe0, 0xd4, 0x6b, 0x48, 0x19, 0x64, 0x30, 0x86, 0xf2, - 0x30, 0x8c, 0x6a, 0xb5, 0x9a, 0x43, 0x98, 0x0b, 0x46, 0x6c, 0x5f, 0x32, 0xe2, 0x83, 0x29, 0x62, - 0xf1, 0x79, 0xc8, 0x0a, 0x3b, 0x90, 0xa5, 0x9a, 0x58, 0x42, 0xb5, 0xd9, 0x66, 0x3b, 0x75, 0x2a, - 0xa7, 0x64, 0x4d, 0xd1, 0x79, 0x1f, 0x0c, 0x19, 0xae, 0x1a, 0x1c, 0xe2, 0xa7, 0xa6, 0x53, 0xa7, - 0xb2, 0xca, 0xa0, 0xe1, 0xfa, 0x07, 0xa0, 0xf2, 0x67, 0x53, 0x30, 0x12, 0x7d, 0x08, 0x81, 0x16, - 0x20, 0x5b, 0xb7, 0x74, 0x8d, 0xba, 0x16, 0x7b, 0x02, 0x76, 0x2a, 0xe1, 0xb9, 0xc5, 0xcc, 0x32, - 0xc7, 0x57, 0x7c, 0xca, 0xe2, 0xef, 0x48, 0x90, 0x15, 0x60, 0x74, 0x0c, 0x32, 0xb6, 0xe6, 0xed, - 0x52, 0x76, 0x7d, 0xe5, 0x54, 0x5e, 0x52, 0x68, 0x9b, 0xc0, 0x5d, 0x5b, 0x33, 0xa9, 0x0b, 0x70, - 0x38, 0x69, 0x93, 0x79, 0xad, 0x63, 0xad, 0x4a, 0x37, 0x3d, 0x56, 0xa3, 0x81, 0x4d, 0xcf, 0x15, - 0xf3, 0xca, 0xe1, 0xf3, 0x1c, 0x8c, 0x1e, 0x85, 0x31, 0xcf, 0xd1, 0x8c, 0x7a, 0x04, 0x37, 0x43, - 0x71, 0xf3, 0xa2, 0xc3, 0x47, 0x2e, 0xc1, 0x09, 0xc1, 0xb7, 0x8a, 0x3d, 0x4d, 0xdf, 0xc5, 0xd5, - 0x80, 0xa8, 0x9f, 0x1e, 0x6e, 0x1c, 0xe7, 0x08, 0x0b, 0xbc, 0x5f, 0xd0, 0xca, 0x5f, 0x97, 0x60, - 0x4c, 0x6c, 0xd3, 0xaa, 0xbe, 0xb1, 0x56, 0x00, 0x34, 0xd3, 0xb4, 0xbc, 0xb0, 0xb9, 0x5a, 0x5d, - 0xb9, 0x85, 0x6e, 0x66, 0xce, 0x27, 0x52, 0x42, 0x0c, 0x8a, 0x0d, 0x80, 0xa0, 0xa7, 0xa3, 0xd9, - 0xa6, 0x60, 0x90, 0x3f, 0x61, 0xa2, 0x8f, 0x29, 0xd9, 0xc6, 0x1e, 0x18, 0x88, 0xec, 0xe7, 0xd0, - 0x04, 0xf4, 0x6d, 0xe3, 0x9a, 0x61, 0xf2, 0x73, 0x63, 0xd6, 0x10, 0xc7, 0x2f, 0x19, 0xff, 0xf8, - 0xa5, 0xfc, 0x93, 0x12, 0x8c, 0xeb, 0x56, 0x23, 0x2e, 0x6f, 0x39, 0x1f, 0x3b, 0x5d, 0x70, 0x2f, - 0x4b, 0xef, 0x7a, 0xb6, 0x66, 0x78, 0xbb, 0xcd, 0xed, 0x19, 0xdd, 0x6a, 0xcc, 0xd6, 0xac, 0xba, - 0x66, 0xd6, 0x82, 0xe7, 0xac, 0xf4, 0x87, 0x7e, 0xa6, 0x86, 0xcd, 0x33, 0x35, 0x2b, 0xf4, 0xd4, - 0xf5, 0x62, 0xf0, 0xf3, 0x7f, 0x49, 0xd2, 0x2f, 0xa4, 0xd2, 0x8b, 0xeb, 0xe5, 0xcf, 0xa5, 0x8a, - 0x8b, 0x6c, 0xb8, 0x75, 0x61, 0x1e, 0x05, 0xef, 0xd4, 0xb1, 0x4e, 0x54, 0x86, 0x6f, 0x3d, 0x0a, - 0x13, 0x35, 0xab, 0x66, 0x51, 0x8e, 0xb3, 0xe4, 0x17, 0x7f, 0x72, 0x9b, 0xf3, 0xa1, 0xc5, 0xc4, - 0xc7, 0xbc, 0xa5, 0x55, 0x18, 0xe7, 0xc8, 0x2a, 0x7d, 0x74, 0xc4, 0x36, 0x36, 0xa8, 0xeb, 0xa9, - 0x5a, 0xe1, 0xd7, 0xbe, 0x49, 0x17, 0x74, 0x65, 0x8c, 0x93, 0x92, 0x3e, 0xb6, 0xf7, 0x29, 0x29, - 0x70, 0x34, 0xc2, 0x8f, 0x85, 0x2d, 0x76, 0x12, 0x38, 0xfe, 0x16, 0xe7, 0x38, 0x1e, 0xe2, 0xb8, - 0xc1, 0x49, 0x4b, 0xf3, 0x30, 0x7c, 0x10, 0x5e, 0xff, 0x8a, 0xf3, 0x1a, 0xc2, 0x61, 0x26, 0x8b, - 0x30, 0x4a, 0x99, 0xe8, 0x4d, 0xd7, 0xb3, 0x1a, 0x34, 0x27, 0x76, 0x67, 0xf3, 0xdb, 0xdf, 0x64, - 0x71, 0x34, 0x42, 0xc8, 0xe6, 0x7d, 0xaa, 0x52, 0x09, 0xe8, 0xd3, 0xb2, 0x2a, 0xd6, 0xeb, 0x09, - 0x1c, 0xbe, 0xc2, 0x05, 0xf1, 0xf1, 0x4b, 0x57, 0x61, 0x82, 0xfc, 0xa6, 0x29, 0x2b, 0x2c, 0x49, - 0xf2, 0x11, 0x5c, 0xe1, 0xeb, 0x1f, 0x64, 0xa1, 0x3a, 0xee, 0x33, 0x08, 0xc9, 0x14, 0x9a, 0xc5, - 0x1a, 0xf6, 0x3c, 0xec, 0xb8, 0xaa, 0x56, 0x6f, 0x27, 0x5e, 0xe8, 0x0c, 0xa3, 0xf0, 0xf1, 0x6f, - 0x47, 0x67, 0x71, 0x91, 0x51, 0xce, 0xd5, 0xeb, 0xa5, 0x2d, 0x38, 0xde, 0xc6, 0x2b, 0x7a, 0xe0, - 0xf9, 0x1a, 0xe7, 0x39, 0xd1, 0xe2, 0x19, 0x84, 0xed, 0x3a, 0x08, 0xb8, 0x3f, 0x97, 0x3d, 0xf0, - 0xfc, 0x39, 0xce, 0x13, 0x71, 0x5a, 0x31, 0xa5, 0x84, 0xe3, 0xf3, 0x30, 0x76, 0x0d, 0x3b, 0xdb, - 0x96, 0xcb, 0xcf, 0x8d, 0x7a, 0x60, 0xf7, 0x09, 0xce, 0x6e, 0x94, 0x13, 0xd2, 0x83, 0x24, 0xc2, - 0xeb, 0x19, 0xc8, 0xee, 0x68, 0x3a, 0xee, 0x81, 0xc5, 0x4d, 0xce, 0x62, 0x80, 0xe0, 0x13, 0xd2, - 0x39, 0x18, 0xaa, 0x59, 0x7c, 0xd5, 0x4a, 0x26, 0xff, 0x24, 0x27, 0x1f, 0x14, 0x34, 0x9c, 0x85, - 0x6d, 0xd9, 0xcd, 0x3a, 0x59, 0xd2, 0x92, 0x59, 0xfc, 0xbc, 0x60, 0x21, 0x68, 0x38, 0x8b, 0x03, - 0x98, 0xf5, 0x53, 0x82, 0x85, 0x1b, 0xb2, 0xe7, 0x73, 0x30, 0x68, 0x99, 0xf5, 0x7d, 0xcb, 0xec, - 0x45, 0x88, 0x4f, 0x73, 0x0e, 0xc0, 0x49, 0x08, 0x83, 0x8b, 0x90, 0xeb, 0x75, 0x22, 0xfe, 0xf6, - 0xb7, 0x45, 0x78, 0x88, 0x19, 0x58, 0x84, 0x51, 0x91, 0xa0, 0x0c, 0xcb, 0xec, 0x81, 0xc5, 0xdf, - 0xe1, 0x2c, 0x46, 0x42, 0x64, 0x5c, 0x0d, 0x0f, 0xbb, 0x5e, 0x0d, 0xf7, 0xc2, 0xe4, 0xb3, 0x42, - 0x0d, 0x4e, 0xc2, 0x4d, 0xb9, 0x8d, 0x4d, 0x7d, 0xb7, 0x37, 0x0e, 0xbf, 0x24, 0x4c, 0x29, 0x68, - 0x08, 0x8b, 0x79, 0x18, 0x6e, 0x68, 0x8e, 0xbb, 0xab, 0xd5, 0x7b, 0x9a, 0x8e, 0xbf, 0xcb, 0x79, - 0x0c, 0xf9, 0x44, 0xdc, 0x22, 0x4d, 0xf3, 0x20, 0x6c, 0x3e, 0x27, 0x2c, 0x12, 0x22, 0xe3, 0xa1, - 0xe7, 0x7a, 0xf4, 0x90, 0xed, 0x20, 0xdc, 0x7e, 0x59, 0x84, 0x1e, 0xa3, 0x5d, 0x09, 0x73, 0xbc, - 0x08, 0x39, 0xd7, 0x78, 0xb9, 0x27, 0x36, 0xbf, 0x22, 0x66, 0x9a, 0x12, 0x10, 0xe2, 0x77, 0xc2, - 0x89, 0xb6, 0xcb, 0x44, 0x0f, 0xcc, 0xfe, 0x1e, 0x67, 0x76, 0xac, 0xcd, 0x52, 0xc1, 0x53, 0xc2, - 0x41, 0x59, 0xfe, 0x7d, 0x91, 0x12, 0x70, 0x8c, 0xd7, 0x3a, 0xd9, 0x47, 0xb8, 0xda, 0xce, 0xc1, - 0xac, 0xf6, 0x0f, 0x84, 0xd5, 0x18, 0x6d, 0xc4, 0x6a, 0x9b, 0x70, 0x8c, 0x73, 0x3c, 0xd8, 0xbc, - 0xfe, 0xaa, 0x48, 0xac, 0x8c, 0x7a, 0x2b, 0x3a, 0xbb, 0xef, 0x86, 0xa2, 0x6f, 0x4e, 0x51, 0xb0, - 0xba, 0x6a, 0x43, 0xb3, 0x7b, 0xe0, 0xfc, 0x6b, 0x9c, 0xb3, 0xc8, 0xf8, 0x7e, 0xc5, 0xeb, 0xae, - 0x68, 0x36, 0x61, 0xfe, 0x0e, 0x28, 0x08, 0xe6, 0x4d, 0xd3, 0xc1, 0xba, 0x55, 0x33, 0x8d, 0x97, - 0x71, 0xb5, 0x07, 0xd6, 0xbf, 0x1e, 0x9b, 0xaa, 0xad, 0x10, 0x39, 0xe1, 0xbc, 0x04, 0x79, 0xbf, - 0x56, 0x51, 0x8d, 0x86, 0x6d, 0x39, 0x5e, 0x02, 0xc7, 0xcf, 0x8b, 0x99, 0xf2, 0xe9, 0x96, 0x28, - 0x59, 0xa9, 0x02, 0xec, 0xc9, 0x73, 0xaf, 0x2e, 0xf9, 0x05, 0xce, 0x68, 0x38, 0xa0, 0xe2, 0x89, - 0x43, 0xb7, 0x1a, 0xb6, 0xe6, 0xf4, 0x92, 0xff, 0xfe, 0xa1, 0x48, 0x1c, 0x9c, 0x84, 0x27, 0x0e, - 0x6f, 0xdf, 0xc6, 0x64, 0xb5, 0xef, 0x81, 0xc3, 0x17, 0x45, 0xe2, 0x10, 0x34, 0x9c, 0x85, 0x28, - 0x18, 0x7a, 0x60, 0xf1, 0x8f, 0x04, 0x0b, 0x41, 0x43, 0x58, 0xbc, 0x10, 0x2c, 0xb4, 0x0e, 0xae, - 0x19, 0xae, 0xe7, 0xb0, 0x32, 0xb9, 0x3b, 0xab, 0x7f, 0xfc, 0xed, 0x68, 0x11, 0xa6, 0x84, 0x48, - 0x49, 0x26, 0xe2, 0xc7, 0xae, 0x74, 0x17, 0x95, 0x2c, 0xd8, 0x6f, 0x88, 0x4c, 0x14, 0x22, 0x23, - 0xb2, 0x85, 0x2a, 0x44, 0x62, 0x76, 0x9d, 0xec, 0x1d, 0x7a, 0x60, 0xf7, 0x4f, 0x62, 0xc2, 0x6d, - 0x08, 0x5a, 0xc2, 0x33, 0x54, 0xff, 0x34, 0xcd, 0x3d, 0xbc, 0xdf, 0x93, 0x77, 0xfe, 0xd3, 0x58, - 0xfd, 0xb3, 0xc5, 0x28, 0x59, 0x0e, 0x19, 0x8d, 0xd5, 0x53, 0x28, 0xe9, 0x3d, 0xa3, 0xc2, 0xfb, - 0xbf, 0xcb, 0xf5, 0x8d, 0x96, 0x53, 0xa5, 0x65, 0xe2, 0xe4, 0xd1, 0xa2, 0x27, 0x99, 0xd9, 0x07, - 0xbf, 0xeb, 0xfb, 0x79, 0xa4, 0xe6, 0x29, 0x5d, 0x82, 0xe1, 0x48, 0xc1, 0x93, 0xcc, 0xea, 0xaf, - 0x70, 0x56, 0x43, 0xe1, 0x7a, 0xa7, 0x74, 0x0e, 0x32, 0xa4, 0x78, 0x49, 0x26, 0xff, 0xab, 0x9c, - 0x9c, 0xa2, 0x97, 0xde, 0x0a, 0x59, 0x51, 0xb4, 0x24, 0x93, 0xfe, 0x38, 0x27, 0xf5, 0x49, 0x08, - 0xb9, 0x28, 0x58, 0x92, 0xc9, 0xff, 0x9a, 0x20, 0x17, 0x24, 0x84, 0xbc, 0x77, 0x13, 0x7e, 0xe9, - 0x27, 0x32, 0x7c, 0xd1, 0x11, 0xb6, 0xbb, 0x08, 0x03, 0xbc, 0x52, 0x49, 0xa6, 0xfe, 0x30, 0x1f, - 0x5c, 0x50, 0x94, 0x9e, 0x86, 0xbe, 0x1e, 0x0d, 0xfe, 0x37, 0x38, 0x29, 0xc3, 0x2f, 0xcd, 0xc3, - 0x60, 0xa8, 0x3a, 0x49, 0x26, 0xff, 0x9b, 0x9c, 0x3c, 0x4c, 0x45, 0x44, 0xe7, 0xd5, 0x49, 0x32, - 0x83, 0x9f, 0x14, 0xa2, 0x73, 0x0a, 0x62, 0x36, 0x51, 0x98, 0x24, 0x53, 0x7f, 0x44, 0x58, 0x5d, - 0x90, 0x94, 0x9e, 0x83, 0x9c, 0xbf, 0xd8, 0x24, 0xd3, 0x7f, 0x94, 0xd3, 0x07, 0x34, 0xc4, 0x02, - 0xa1, 0xc5, 0x2e, 0x99, 0xc5, 0xdf, 0x12, 0x16, 0x08, 0x51, 0x91, 0x30, 0x8a, 0x17, 0x30, 0xc9, - 0x9c, 0x7e, 0x4a, 0x84, 0x51, 0xac, 0x7e, 0x21, 0xb3, 0x49, 0x73, 0x7e, 0x32, 0x8b, 0x9f, 0x16, - 0xb3, 0x49, 0xf1, 0x89, 0x18, 0xf1, 0x8a, 0x20, 0x99, 0xc7, 0xcf, 0x0a, 0x31, 0x62, 0x05, 0x41, - 0x69, 0x1d, 0x50, 0x6b, 0x35, 0x90, 0xcc, 0xef, 0x63, 0x9c, 0xdf, 0x58, 0x4b, 0x31, 0x50, 0x7a, - 0x3b, 0x1c, 0x6b, 0x5f, 0x09, 0x24, 0x73, 0xfd, 0xf8, 0x77, 0x63, 0x7b, 0xb7, 0x70, 0x21, 0x50, - 0xda, 0x0c, 0x96, 0x94, 0x70, 0x15, 0x90, 0xcc, 0xf6, 0xb5, 0xef, 0x46, 0x13, 0x77, 0xb8, 0x08, - 0x28, 0xcd, 0x01, 0x04, 0x0b, 0x70, 0x32, 0xaf, 0x4f, 0x70, 0x5e, 0x21, 0x22, 0x12, 0x1a, 0x7c, - 0xfd, 0x4d, 0xa6, 0xbf, 0x29, 0x42, 0x83, 0x53, 0x90, 0xd0, 0x10, 0x4b, 0x6f, 0x32, 0xf5, 0x27, - 0x45, 0x68, 0x08, 0x12, 0xe2, 0xd9, 0xa1, 0xd5, 0x2d, 0x99, 0xc3, 0xa7, 0x85, 0x67, 0x87, 0xa8, - 0x4a, 0xab, 0x30, 0xd6, 0xb2, 0x20, 0x26, 0xb3, 0xfa, 0x05, 0xce, 0x2a, 0x1f, 0x5f, 0x0f, 0xc3, - 0x8b, 0x17, 0x5f, 0x0c, 0x93, 0xb9, 0x7d, 0x26, 0xb6, 0x78, 0xf1, 0xb5, 0xb0, 0x74, 0x11, 0xb2, - 0x66, 0xb3, 0x5e, 0x27, 0xc1, 0x83, 0xba, 0xbf, 0x1b, 0x58, 0xf8, 0x93, 0xef, 0x71, 0xeb, 0x08, - 0x82, 0xd2, 0x39, 0xe8, 0xc3, 0x8d, 0x6d, 0x5c, 0x4d, 0xa2, 0xfc, 0xd6, 0xf7, 0x44, 0xc2, 0x24, - 0xd8, 0xa5, 0xe7, 0x00, 0xd8, 0xd1, 0x08, 0x7d, 0x3c, 0x98, 0x40, 0xfb, 0x9f, 0xbf, 0xc7, 0x5f, - 0xc6, 0x09, 0x48, 0x02, 0x06, 0xec, 0xd5, 0x9e, 0xee, 0x0c, 0xbe, 0x1d, 0x65, 0x40, 0x67, 0xe4, - 0x19, 0x18, 0x78, 0xd1, 0xb5, 0x4c, 0x4f, 0xab, 0x25, 0x51, 0xff, 0x17, 0x4e, 0x2d, 0xf0, 0x89, - 0xc1, 0x1a, 0x96, 0x83, 0x3d, 0xad, 0xe6, 0x26, 0xd1, 0xfe, 0x57, 0x4e, 0xeb, 0x13, 0x10, 0x62, - 0x5d, 0x73, 0xbd, 0x5e, 0xf4, 0xfe, 0x6f, 0x82, 0x58, 0x10, 0x10, 0xa1, 0xc9, 0xef, 0x3d, 0xbc, - 0x9f, 0x44, 0xfb, 0x1d, 0x21, 0x34, 0xc7, 0x2f, 0xbd, 0x15, 0x72, 0xe4, 0x27, 0x7b, 0xc3, 0x2e, - 0x81, 0xf8, 0xbf, 0x73, 0xe2, 0x80, 0x82, 0x8c, 0xec, 0x7a, 0x55, 0xcf, 0x48, 0x36, 0xf6, 0x6d, - 0x3e, 0xd3, 0x02, 0xbf, 0x34, 0x07, 0x83, 0xae, 0x57, 0xad, 0x36, 0x79, 0x7d, 0x9a, 0x40, 0xfe, - 0x3f, 0xbe, 0xe7, 0x1f, 0x59, 0xf8, 0x34, 0x64, 0xb6, 0xaf, 0xef, 0x79, 0xb6, 0x45, 0x1f, 0x81, - 0x24, 0x71, 0xf8, 0x2e, 0xe7, 0x10, 0x22, 0x29, 0xcd, 0xc3, 0x10, 0xd1, 0xc5, 0xc1, 0x36, 0xa6, - 0xcf, 0xab, 0x12, 0x58, 0xfc, 0x29, 0x37, 0x40, 0x84, 0xa8, 0xfc, 0x63, 0x5f, 0x79, 0x63, 0x52, - 0x7a, 0xfd, 0x8d, 0x49, 0xe9, 0x8f, 0xde, 0x98, 0x94, 0x3e, 0xf2, 0x8d, 0xc9, 0x23, 0xaf, 0x7f, - 0x63, 0xf2, 0xc8, 0xef, 0x7d, 0x63, 0xf2, 0x48, 0xfb, 0x63, 0x63, 0x58, 0xb4, 0x16, 0x2d, 0x76, - 0x60, 0xfc, 0x2e, 0x39, 0x72, 0x5c, 0x5c, 0xb3, 0x82, 0xd3, 0x5a, 0x7f, 0x93, 0x03, 0x7f, 0x2a, - 0x91, 0x0d, 0x73, 0xf4, 0x2c, 0x57, 0x33, 0xf7, 0x3b, 0xdc, 0xd5, 0x29, 0xb6, 0x3d, 0x18, 0x96, - 0xdf, 0x02, 0xe9, 0x39, 0x73, 0x1f, 0x9d, 0x60, 0x39, 0x4f, 0x6d, 0x3a, 0x75, 0xfe, 0xe6, 0xd7, - 0x00, 0x69, 0x6f, 0x39, 0x75, 0x34, 0x11, 0xbc, 0x9e, 0x29, 0x9d, 0x1a, 0xe2, 0xef, 0x5c, 0x96, - 0x32, 0xdf, 0xf9, 0xf4, 0xd4, 0x91, 0xf2, 0x5e, 0x5c, 0xc3, 0x2f, 0x25, 0x6a, 0x99, 0x9d, 0x33, - 0xf7, 0xa9, 0x92, 0xeb, 0xd2, 0xbb, 0xfa, 0xc8, 0x18, 0xae, 0x38, 0xd8, 0x9e, 0x8c, 0x1f, 0x6c, - 0xbf, 0x1d, 0xd7, 0xeb, 0x57, 0x4c, 0xeb, 0xba, 0xb9, 0x49, 0xd0, 0xb6, 0xfb, 0xd9, 0x6b, 0xc4, - 0xf0, 0x91, 0x14, 0x4c, 0xc5, 0xf5, 0x26, 0x8e, 0xe3, 0x7a, 0x5a, 0xc3, 0xee, 0x74, 0x53, 0xe9, - 0x22, 0xe4, 0x36, 0x05, 0x0e, 0x2a, 0xc0, 0x80, 0x8b, 0x75, 0xcb, 0xac, 0xba, 0x54, 0xd9, 0xb4, - 0x22, 0x9a, 0x44, 0x59, 0x53, 0x33, 0x2d, 0x97, 0xbf, 0x1f, 0xc9, 0x1a, 0xe5, 0x9f, 0x91, 0x0e, - 0x36, 0x93, 0x23, 0xfe, 0x50, 0x42, 0xd3, 0x47, 0xbb, 0x1d, 0xff, 0x53, 0x2b, 0x04, 0x2a, 0x84, - 0xce, 0xfa, 0x7b, 0x35, 0xc9, 0x07, 0xd2, 0x70, 0x42, 0xb7, 0xdc, 0x86, 0xe5, 0xaa, 0x6c, 0x86, - 0x59, 0x83, 0x1b, 0x63, 0x28, 0xdc, 0xd5, 0xc3, 0xf9, 0xff, 0x65, 0x18, 0xa1, 0x51, 0x40, 0x4f, - 0x3e, 0x69, 0xe2, 0x49, 0x5c, 0x2b, 0xbe, 0xfa, 0x6f, 0xfb, 0xa8, 0xd7, 0x0c, 0xfb, 0x84, 0xf4, - 0xd5, 0x8e, 0x4d, 0x98, 0x30, 0x1a, 0x76, 0x1d, 0xd3, 0x67, 0x40, 0xaa, 0xdf, 0x97, 0xcc, 0xef, - 0x6b, 0x9c, 0xdf, 0x78, 0x40, 0xbe, 0x24, 0xa8, 0x4b, 0xcb, 0x30, 0xa6, 0xe9, 0x3a, 0xb6, 0x23, - 0x2c, 0x13, 0x22, 0x54, 0x08, 0x98, 0xe7, 0x94, 0x3e, 0xb7, 0xf2, 0x73, 0x9d, 0xe6, 0xf6, 0x5d, - 0x0f, 0x86, 0x26, 0xcd, 0xc1, 0x35, 0x6c, 0x9e, 0x31, 0xb1, 0x77, 0xdd, 0x72, 0xf6, 0xb8, 0x79, - 0xcf, 0xb0, 0xa1, 0xc4, 0x24, 0x7c, 0x38, 0x0d, 0x93, 0xac, 0x63, 0x76, 0x5b, 0x73, 0xf1, 0xec, - 0xb5, 0x27, 0xb6, 0xb1, 0xa7, 0x3d, 0x31, 0xab, 0x5b, 0x86, 0xc9, 0x67, 0x62, 0x9c, 0xcf, 0x0b, - 0xe9, 0x9f, 0xe1, 0xfd, 0x1d, 0x02, 0x73, 0x11, 0x32, 0xf3, 0x96, 0x61, 0x12, 0x8f, 0xac, 0x62, - 0xd3, 0x6a, 0xf0, 0xb0, 0x64, 0x0d, 0x74, 0x3f, 0xf4, 0x6b, 0x0d, 0xab, 0x69, 0x7a, 0xec, 0xf1, - 0x55, 0x79, 0xf0, 0x2b, 0xb7, 0xa6, 0x8e, 0xfc, 0xfe, 0xad, 0xa9, 0xf4, 0x92, 0xe9, 0x29, 0xbc, - 0xab, 0x94, 0x79, 0xf3, 0x53, 0x53, 0x92, 0xfc, 0x3c, 0x0c, 0x2c, 0x60, 0xfd, 0x30, 0xbc, 0x16, - 0xb0, 0x1e, 0xe3, 0xf5, 0x08, 0x64, 0x97, 0x4c, 0x8f, 0xbd, 0x32, 0x7b, 0x2f, 0xa4, 0x0d, 0x93, - 0xbd, 0x85, 0x15, 0x1b, 0x9f, 0xc0, 0x09, 0xea, 0x02, 0xd6, 0x7d, 0xd4, 0x2a, 0xd6, 0xe3, 0xa8, - 0x84, 0x3d, 0x81, 0x97, 0x97, 0x7e, 0xef, 0x3f, 0x4e, 0x1e, 0x79, 0xe5, 0x8d, 0xc9, 0x23, 0x1d, - 0x67, 0xe2, 0xe1, 0xd0, 0x4c, 0x18, 0x8e, 0xe1, 0x9a, 0xd8, 0xa3, 0x7f, 0x77, 0x9b, 0xdb, 0x67, - 0xdc, 0xea, 0xde, 0x99, 0x9a, 0x35, 0xeb, 0x45, 0x02, 0xe2, 0xaf, 0xa7, 0x60, 0xb2, 0xc5, 0xcf, - 0xf9, 0xea, 0xd0, 0x29, 0x45, 0x94, 0x20, 0xbb, 0x20, 0x16, 0x9d, 0x83, 0x66, 0x88, 0x9f, 0x3e, - 0x60, 0x86, 0x18, 0x16, 0x23, 0x89, 0x04, 0x71, 0x3a, 0x39, 0x41, 0x08, 0xf9, 0x0f, 0x91, 0x1f, - 0xfe, 0xb5, 0x04, 0xd3, 0xf4, 0x06, 0x89, 0xd3, 0x30, 0x4c, 0x6f, 0xb6, 0x6e, 0x6c, 0xbb, 0xb3, - 0xdb, 0x86, 0xe7, 0x32, 0xab, 0x71, 0x83, 0x4c, 0x04, 0x18, 0x33, 0x04, 0x63, 0x86, 0x60, 0xc8, - 0x4f, 0x41, 0xb6, 0x6c, 0x78, 0x73, 0x8e, 0xa3, 0xed, 0x23, 0x04, 0x19, 0x02, 0xe3, 0x26, 0xa1, - 0xbf, 0x89, 0x3d, 0x70, 0x1d, 0x37, 0x5c, 0xfa, 0x14, 0x3a, 0xa3, 0xb0, 0x46, 0x79, 0xab, 0xe3, - 0x54, 0x5e, 0x0c, 0x29, 0x1a, 0x12, 0x29, 0xf4, 0x93, 0x85, 0x42, 0x3b, 0x71, 0x7d, 0x7d, 0x3e, - 0x97, 0x81, 0x7b, 0x43, 0x08, 0xba, 0xb3, 0x6f, 0x7b, 0x74, 0x8d, 0xb4, 0x76, 0xb8, 0x32, 0x63, - 0x21, 0x65, 0x58, 0x77, 0x87, 0x38, 0xdb, 0x81, 0xbe, 0x75, 0x42, 0x47, 0x14, 0xf1, 0x2c, 0x4f, - 0xab, 0x73, 0xed, 0x58, 0x83, 0x40, 0xd9, 0x2d, 0x9a, 0x14, 0x83, 0x1a, 0xe2, 0x02, 0x4d, 0x1d, - 0x6b, 0x3b, 0xec, 0x65, 0xe4, 0x34, 0x5d, 0x17, 0xb3, 0x04, 0x40, 0xdf, 0x3b, 0x9e, 0x80, 0x3e, - 0xad, 0xc9, 0x9e, 0xa3, 0xa7, 0xc9, 0x82, 0x49, 0x1b, 0xf2, 0x15, 0x18, 0xe0, 0xcf, 0xee, 0x50, - 0x1e, 0xd2, 0x7b, 0x78, 0x9f, 0x8e, 0x33, 0xa4, 0x90, 0x9f, 0x68, 0x06, 0xfa, 0xa8, 0xf0, 0xfc, - 0x96, 0x45, 0x61, 0xa6, 0x45, 0xfa, 0x19, 0x2a, 0xa4, 0xc2, 0xd0, 0xe4, 0xe7, 0x21, 0xbb, 0x60, - 0x35, 0x0c, 0xd3, 0x8a, 0x72, 0xcb, 0x31, 0x6e, 0x54, 0x66, 0xbb, 0xc9, 0xe3, 0x59, 0x61, 0x0d, - 0x74, 0x0c, 0xfa, 0xd9, 0xcb, 0xe9, 0xfc, 0x5d, 0x00, 0xde, 0x92, 0xe7, 0x61, 0x80, 0xf2, 0x5e, - 0xb3, 0xc9, 0xfc, 0xfa, 0x6f, 0x06, 0xe6, 0xf8, 0x55, 0x25, 0xce, 0x3e, 0x15, 0x08, 0x8b, 0x20, - 0x53, 0xd5, 0x3c, 0x8d, 0xeb, 0x4d, 0x7f, 0xcb, 0xcf, 0x42, 0x96, 0x33, 0x71, 0xd1, 0x59, 0x48, - 0x5b, 0xb6, 0xcb, 0x9f, 0xe6, 0x17, 0x3b, 0xa9, 0xb2, 0x66, 0x97, 0x33, 0x24, 0x13, 0x28, 0x04, - 0xb9, 0xac, 0x74, 0xf4, 0x97, 0x0b, 0x07, 0xf7, 0x17, 0x36, 0x8c, 0xef, 0x2c, 0x9f, 0x4e, 0xc1, - 0x64, 0xa8, 0xf7, 0x1a, 0x76, 0xc8, 0x06, 0x36, 0xe2, 0xfa, 0x28, 0x24, 0x24, 0xef, 0xef, 0xe0, - 0x2e, 0x6f, 0x85, 0xf4, 0x9c, 0x6d, 0xa3, 0x22, 0x64, 0xd9, 0x53, 0x7b, 0x8b, 0xf9, 0x4b, 0x46, - 0xf1, 0xdb, 0xa4, 0xcf, 0xb5, 0x76, 0xbc, 0xeb, 0x9a, 0xe3, 0xdf, 0xdf, 0x12, 0x6d, 0xf9, 0x19, - 0xc8, 0xcd, 0x5b, 0xa6, 0x8b, 0x4d, 0xb7, 0x49, 0x43, 0x67, 0xbb, 0x6e, 0xe9, 0x7b, 0x9c, 0x03, - 0x6b, 0x10, 0x83, 0x6b, 0xb6, 0x4d, 0x29, 0x33, 0x0a, 0xf9, 0xc9, 0x72, 0x6f, 0x79, 0xa3, 0xa3, - 0x89, 0x9e, 0x39, 0xb8, 0x89, 0xb8, 0x92, 0xbe, 0x8d, 0xfe, 0x40, 0x82, 0x93, 0xad, 0x01, 0xb5, - 0x87, 0xf7, 0xdd, 0x83, 0xc6, 0xd3, 0x05, 0xc8, 0xad, 0xd3, 0x4b, 0xd4, 0x57, 0xf0, 0x3e, 0x2a, - 0xc2, 0x00, 0xae, 0x9e, 0x3d, 0x77, 0xee, 0x89, 0x67, 0x98, 0xb7, 0x5f, 0x3e, 0xa2, 0x08, 0x40, - 0x29, 0x4b, 0xb4, 0x7a, 0xf3, 0xd3, 0x53, 0x52, 0xb9, 0x0f, 0xd2, 0x6e, 0xb3, 0x71, 0x57, 0x7d, - 0xe0, 0xb5, 0xbe, 0x48, 0x02, 0x64, 0x09, 0xf5, 0x9a, 0x56, 0x37, 0xaa, 0x5a, 0x70, 0xbd, 0x3d, - 0x1f, 0xd2, 0x91, 0x62, 0xb4, 0x57, 0xb1, 0xd8, 0xd5, 0x52, 0xf2, 0xaf, 0x4b, 0x30, 0x74, 0x55, - 0x70, 0xde, 0xc0, 0x1e, 0xba, 0x08, 0xe0, 0x8f, 0x24, 0xc2, 0xe2, 0x9e, 0x99, 0xf8, 0x58, 0x33, - 0x3e, 0x8d, 0x12, 0x42, 0x47, 0x4f, 0x53, 0x47, 0xb3, 0x2d, 0x97, 0xdf, 0xd9, 0x49, 0x20, 0xf5, - 0x91, 0xd1, 0x63, 0x80, 0x68, 0x06, 0x53, 0xaf, 0x59, 0x9e, 0x61, 0xd6, 0x54, 0xdb, 0xba, 0xce, - 0x6f, 0x42, 0xa6, 0x95, 0x3c, 0xed, 0xb9, 0x4a, 0x3b, 0xd6, 0x09, 0x9c, 0x08, 0x9d, 0xf3, 0xb9, - 0x90, 0xd5, 0x4f, 0xab, 0x56, 0x1d, 0xec, 0xba, 0x3c, 0x49, 0x89, 0x26, 0xba, 0x08, 0x03, 0x76, - 0x73, 0x5b, 0x15, 0x19, 0x61, 0xf0, 0xec, 0xc9, 0x76, 0xf1, 0x2d, 0xe6, 0x9f, 0x47, 0x78, 0xbf, - 0xdd, 0xdc, 0x26, 0xde, 0x70, 0x1f, 0x0c, 0xb5, 0x11, 0x66, 0xf0, 0x5a, 0x20, 0x07, 0xbd, 0x9b, - 0xcf, 0x35, 0x50, 0x6d, 0xc7, 0xb0, 0x1c, 0xc3, 0xdb, 0xa7, 0xaf, 0xdc, 0xa4, 0x95, 0xbc, 0xe8, - 0x58, 0xe7, 0x70, 0x79, 0x0f, 0x46, 0x37, 0x68, 0x7d, 0x18, 0x48, 0x7e, 0x2e, 0x90, 0x4f, 0x4a, - 0x96, 0xaf, 0xa3, 0x64, 0xa9, 0x16, 0xc9, 0xca, 0x2f, 0x74, 0xf4, 0xce, 0xa7, 0x0f, 0xee, 0x9d, - 0xd1, 0x62, 0xe5, 0xcf, 0x8a, 0x91, 0xe0, 0xe3, 0xdb, 0x81, 0x50, 0x7a, 0xea, 0xd5, 0x31, 0x93, - 0xb6, 0x45, 0xc5, 0xc4, 0x22, 0xa0, 0xd8, 0x7d, 0x59, 0x2d, 0x26, 0x24, 0xd2, 0x62, 0x62, 0x90, - 0xc9, 0xcf, 0xc0, 0xf0, 0xba, 0xe6, 0x78, 0x1b, 0xd8, 0xbb, 0x8c, 0xb5, 0x2a, 0x76, 0xa2, 0xeb, - 0xee, 0xb0, 0x58, 0x77, 0x11, 0x64, 0xe8, 0xe2, 0xca, 0xd6, 0x1d, 0xfa, 0x5b, 0xde, 0x85, 0x0c, - 0x7d, 0x31, 0xcf, 0x5f, 0x93, 0x39, 0x05, 0x5b, 0x93, 0x49, 0x36, 0xdd, 0xf7, 0xb0, 0x2b, 0xf6, - 0xa9, 0xb4, 0x81, 0x9e, 0x12, 0x2b, 0x6b, 0xba, 0xfb, 0xca, 0xca, 0x5d, 0x95, 0xaf, 0xaf, 0x75, - 0x18, 0x28, 0x93, 0x64, 0xbc, 0xb4, 0xe0, 0x0b, 0x22, 0x05, 0x82, 0xa0, 0x15, 0x18, 0xb5, 0x35, - 0xc7, 0xa3, 0x37, 0x12, 0x76, 0xa9, 0x16, 0x3c, 0x1a, 0xa6, 0x5a, 0x63, 0x33, 0xa2, 0x2c, 0x1f, - 0x65, 0xd8, 0x0e, 0x03, 0xe5, 0x3f, 0xce, 0x40, 0x3f, 0x37, 0xc6, 0x5b, 0x61, 0x80, 0x9b, 0x95, - 0xfb, 0xef, 0xbd, 0x33, 0xad, 0x4b, 0xd3, 0x8c, 0xbf, 0x84, 0x70, 0x7e, 0x82, 0x06, 0x3d, 0x04, - 0x59, 0x7d, 0x57, 0x33, 0x4c, 0xd5, 0xa8, 0x8a, 0x62, 0xfe, 0x8d, 0x5b, 0x53, 0x03, 0xf3, 0x04, - 0xb6, 0xb4, 0xa0, 0x0c, 0xd0, 0xce, 0xa5, 0x2a, 0xa9, 0x05, 0x76, 0xb1, 0x51, 0xdb, 0xf5, 0x78, - 0x0c, 0xf2, 0x16, 0xba, 0x00, 0x19, 0xe2, 0x32, 0xfc, 0xbe, 0x5a, 0xb1, 0x65, 0x4b, 0xe5, 0xef, - 0x6b, 0xcb, 0x59, 0x32, 0xf0, 0x47, 0xfe, 0x70, 0x4a, 0x52, 0x28, 0x05, 0x9a, 0x87, 0xe1, 0xba, - 0xe6, 0x7a, 0x2a, 0x5d, 0xc3, 0xc8, 0xf0, 0x7d, 0x94, 0xc5, 0x89, 0x56, 0x83, 0x70, 0xc3, 0x72, - 0xd1, 0x07, 0x09, 0x15, 0x03, 0x55, 0xd1, 0x29, 0xc8, 0x53, 0x26, 0xba, 0xd5, 0x68, 0x18, 0x1e, - 0xab, 0xae, 0xfa, 0xa9, 0xdd, 0x47, 0x08, 0x7c, 0x9e, 0x82, 0x69, 0x8d, 0x75, 0x0f, 0xe4, 0xe8, - 0x0d, 0x19, 0x8a, 0xc2, 0xde, 0x06, 0xcd, 0x12, 0x00, 0xed, 0x7c, 0x18, 0x46, 0x83, 0x0c, 0xca, - 0x50, 0xb2, 0x8c, 0x4b, 0x00, 0xa6, 0x88, 0x8f, 0xc3, 0x84, 0x89, 0x6f, 0xd0, 0xf7, 0x53, 0x23, - 0xd8, 0x39, 0x8a, 0x8d, 0x48, 0xdf, 0xd5, 0x28, 0xc5, 0x83, 0x30, 0xa2, 0x0b, 0xe3, 0x33, 0x5c, - 0xa0, 0xb8, 0xc3, 0x3e, 0x94, 0xa2, 0x9d, 0x80, 0xac, 0x66, 0xdb, 0x0c, 0x61, 0x90, 0x67, 0x50, - 0xdb, 0xa6, 0x5d, 0xa7, 0x61, 0x8c, 0xea, 0xe8, 0x60, 0xb7, 0x59, 0xf7, 0x38, 0x93, 0x21, 0x8a, - 0x33, 0x4a, 0x3a, 0x14, 0x06, 0xa7, 0xb8, 0xf7, 0xc3, 0x30, 0xbe, 0x66, 0x54, 0xb1, 0xa9, 0x63, - 0x86, 0x37, 0x4c, 0xf1, 0x86, 0x04, 0x90, 0x22, 0x3d, 0x02, 0x7e, 0x66, 0x54, 0x45, 0xd6, 0x1e, - 0x61, 0xfc, 0x04, 0x7c, 0x8e, 0x81, 0xe5, 0xc7, 0x20, 0xb3, 0xa0, 0x79, 0x1a, 0x29, 0x31, 0xbc, - 0x1b, 0x6c, 0x29, 0x1a, 0x52, 0xc8, 0xcf, 0xb6, 0xe1, 0xf6, 0x66, 0x0a, 0x32, 0x57, 0x2d, 0x0f, - 0xa3, 0x27, 0x43, 0x65, 0xe1, 0x48, 0x3b, 0x1f, 0xdf, 0x30, 0x6a, 0x26, 0xae, 0xae, 0xb8, 0xb5, - 0xd0, 0x15, 0xf7, 0xc0, 0xc5, 0x52, 0x11, 0x17, 0x9b, 0x80, 0x3e, 0xc7, 0x6a, 0x9a, 0x55, 0xf1, - 0x72, 0x25, 0x6d, 0xa0, 0x0a, 0x64, 0x7d, 0xcf, 0xc9, 0x24, 0x79, 0xce, 0x28, 0xf1, 0x1c, 0xe2, - 0xd7, 0x1c, 0xa0, 0x0c, 0x6c, 0x73, 0x07, 0x2a, 0x43, 0xce, 0x4f, 0x79, 0xdc, 0x03, 0x7b, 0x73, - 0xe2, 0x80, 0x8c, 0x2c, 0x41, 0xbe, 0x3f, 0xf8, 0x06, 0x65, 0x5e, 0x98, 0xf7, 0x3b, 0xb8, 0x45, - 0x23, 0xae, 0xc6, 0xaf, 0xdb, 0x0f, 0x50, 0xbd, 0x02, 0x57, 0x63, 0x57, 0xee, 0x4f, 0x42, 0xce, - 0x35, 0x6a, 0xa6, 0xe6, 0x35, 0x1d, 0xcc, 0xbd, 0x31, 0x00, 0xc8, 0x1f, 0x4d, 0x41, 0x3f, 0xf3, - 0xee, 0x90, 0xdd, 0xa4, 0xf6, 0x76, 0x4b, 0x75, 0xb2, 0x5b, 0xfa, 0xf0, 0x76, 0x9b, 0x03, 0xf0, - 0x85, 0x71, 0xf9, 0x2d, 0xe8, 0x36, 0x75, 0x06, 0x13, 0x71, 0xc3, 0xa8, 0xf1, 0xe0, 0x0d, 0x11, - 0xf9, 0x1e, 0xd4, 0x17, 0xca, 0x93, 0x17, 0x21, 0xb7, 0x6d, 0x78, 0xaa, 0x46, 0x36, 0x8f, 0xd4, - 0x84, 0x83, 0x67, 0x27, 0x67, 0xda, 0xed, 0x32, 0x67, 0xc4, 0x16, 0x53, 0xc9, 0x6e, 0xf3, 0x5f, - 0xf2, 0x1f, 0x48, 0xa4, 0x56, 0xe6, 0x03, 0xa2, 0x39, 0x18, 0x16, 0x8a, 0xaa, 0x3b, 0x75, 0xad, - 0xc6, 0x9d, 0xf1, 0xde, 0x8e, 0xda, 0x5e, 0xaa, 0x6b, 0x35, 0x65, 0x90, 0x2b, 0x48, 0x1a, 0xed, - 0x27, 0x36, 0xd5, 0x61, 0x62, 0x23, 0x9e, 0x94, 0x3e, 0x9c, 0x27, 0x45, 0xe6, 0x3c, 0x13, 0x9f, - 0xf3, 0xcf, 0xa7, 0xe8, 0x9e, 0xc9, 0xb6, 0x5c, 0xad, 0xfe, 0x83, 0x08, 0xb1, 0x7b, 0x20, 0x67, - 0x5b, 0x75, 0x95, 0xf5, 0xb0, 0xb7, 0x98, 0xb3, 0xb6, 0x55, 0x57, 0x5a, 0xfc, 0xa8, 0xef, 0x0e, - 0xc5, 0x5f, 0xff, 0x1d, 0xb0, 0xda, 0x40, 0xdc, 0x6a, 0x0e, 0x0c, 0x31, 0x53, 0xf0, 0x05, 0xf3, - 0x71, 0x62, 0x03, 0xba, 0x02, 0x4b, 0xad, 0x0b, 0x3c, 0x13, 0x9b, 0x61, 0x2a, 0x1c, 0x8f, 0x50, - 0xb0, 0xf5, 0xa5, 0xdd, 0x66, 0x3b, 0xec, 0xe7, 0x0a, 0xc7, 0x93, 0x7f, 0x46, 0x02, 0x58, 0x26, - 0x96, 0xa5, 0xfa, 0x92, 0xa5, 0xce, 0xa5, 0x22, 0xa8, 0x91, 0x91, 0x27, 0x3b, 0x4d, 0x1a, 0x1f, - 0x7f, 0xc8, 0x0d, 0xcb, 0x3d, 0x0f, 0xc3, 0x81, 0x33, 0xba, 0x58, 0x08, 0x33, 0xd9, 0xa5, 0xb8, - 0xdf, 0xc0, 0x9e, 0x32, 0x74, 0x2d, 0xd4, 0x92, 0xff, 0x85, 0x04, 0x39, 0x2a, 0xd3, 0x0a, 0xf6, - 0xb4, 0xc8, 0x1c, 0x4a, 0x87, 0x9f, 0xc3, 0x7b, 0x01, 0x18, 0x1b, 0xd7, 0x78, 0x19, 0x73, 0xcf, - 0xca, 0x51, 0xc8, 0x86, 0xf1, 0x32, 0x46, 0xe7, 0x7d, 0x83, 0xa7, 0xbb, 0x1b, 0x5c, 0x14, 0xff, - 0xdc, 0xec, 0xc7, 0x61, 0x80, 0x7e, 0x86, 0xe8, 0x86, 0xcb, 0xeb, 0xf9, 0x7e, 0xb3, 0xd9, 0xd8, - 0xbc, 0xe1, 0xca, 0x2f, 0xc2, 0xc0, 0xe6, 0x0d, 0x76, 0x04, 0x73, 0x0f, 0xe4, 0x1c, 0xcb, 0xe2, - 0x0b, 0x3f, 0x2b, 0xb8, 0xb2, 0x04, 0x40, 0xd7, 0x39, 0x71, 0xec, 0x90, 0x0a, 0x8e, 0x1d, 0x82, - 0x73, 0x93, 0x74, 0x4f, 0xe7, 0x26, 0xa7, 0xff, 0x9d, 0x04, 0x83, 0xa1, 0xfc, 0x80, 0x9e, 0x80, - 0xa3, 0xe5, 0xe5, 0xb5, 0xf9, 0x2b, 0xea, 0xd2, 0x82, 0x7a, 0x69, 0x79, 0x6e, 0x31, 0xb8, 0xa7, - 0x53, 0x3c, 0xf6, 0xea, 0xcd, 0x69, 0x14, 0xc2, 0xdd, 0x32, 0xf7, 0x4c, 0xeb, 0xba, 0x89, 0x66, - 0x61, 0x22, 0x4a, 0x32, 0x57, 0xde, 0xa8, 0xac, 0x6e, 0xe6, 0xa5, 0xe2, 0xd1, 0x57, 0x6f, 0x4e, - 0x8f, 0x85, 0x28, 0xe6, 0xb6, 0x5d, 0x6c, 0x7a, 0xad, 0x04, 0xf3, 0x6b, 0x2b, 0x2b, 0x4b, 0x9b, - 0xf9, 0x54, 0x0b, 0x01, 0x5f, 0x01, 0x1e, 0x81, 0xb1, 0x28, 0xc1, 0xea, 0xd2, 0x72, 0x3e, 0x5d, - 0x44, 0xaf, 0xde, 0x9c, 0x1e, 0x09, 0x61, 0xaf, 0x1a, 0xf5, 0x62, 0xf6, 0x43, 0x9f, 0x99, 0x3c, - 0xf2, 0x4b, 0xbf, 0x38, 0x29, 0x11, 0xcd, 0x86, 0x23, 0x39, 0x02, 0x3d, 0x06, 0xc7, 0x37, 0x96, - 0x16, 0x57, 0x2b, 0x0b, 0xea, 0xca, 0xc6, 0xa2, 0xca, 0xbe, 0x4f, 0xe2, 0x6b, 0x37, 0xfa, 0xea, - 0xcd, 0xe9, 0x41, 0xae, 0x52, 0x27, 0xec, 0x75, 0xa5, 0x72, 0x75, 0x6d, 0xb3, 0x92, 0x97, 0x18, - 0xf6, 0xba, 0x83, 0xaf, 0x59, 0x1e, 0xfb, 0x4e, 0xd9, 0xe3, 0x70, 0xa2, 0x0d, 0xb6, 0xaf, 0xd8, - 0xd8, 0xab, 0x37, 0xa7, 0x87, 0xd7, 0x1d, 0xcc, 0xe2, 0x87, 0x52, 0xcc, 0x40, 0xa1, 0x95, 0x62, - 0x6d, 0x7d, 0x6d, 0x63, 0x6e, 0x39, 0x3f, 0x5d, 0xcc, 0xbf, 0x7a, 0x73, 0x7a, 0x48, 0x24, 0x43, - 0x82, 0x1f, 0x68, 0x76, 0x37, 0x37, 0x5e, 0x5f, 0x9a, 0x81, 0x07, 0xf8, 0x89, 0xbd, 0xeb, 0x69, - 0x7b, 0x86, 0x59, 0xf3, 0x0f, 0xed, 0x79, 0x9b, 0x6f, 0xc0, 0x8e, 0xf1, 0x73, 0x7b, 0x01, 0xed, - 0x7a, 0x74, 0x5f, 0xec, 0xfc, 0x54, 0xae, 0x98, 0x70, 0x28, 0x9d, 0xbc, 0x83, 0xeb, 0xfc, 0x98, - 0xa7, 0x98, 0xf0, 0xf0, 0xa1, 0xd8, 0x75, 0x8f, 0x29, 0x7f, 0x58, 0x82, 0x91, 0xcb, 0x86, 0xeb, - 0x59, 0x8e, 0xa1, 0x6b, 0x75, 0x7a, 0x3b, 0xe7, 0x7c, 0xaf, 0xb9, 0x35, 0x16, 0xea, 0xcf, 0x41, - 0xff, 0x35, 0xad, 0xce, 0x92, 0x5a, 0x9a, 0x7e, 0x4c, 0xa4, 0xbd, 0xf9, 0x82, 0xd4, 0x26, 0x18, - 0x30, 0x32, 0xf9, 0x9f, 0xa5, 0x60, 0x94, 0x06, 0x83, 0xcb, 0x3e, 0x33, 0x45, 0x36, 0x72, 0x8b, - 0x90, 0x71, 0x34, 0x8f, 0x9f, 0x4d, 0x96, 0x9f, 0xe4, 0x0f, 0x11, 0x1e, 0xed, 0xf1, 0xc1, 0xc0, - 0xcc, 0x02, 0xd6, 0x15, 0xca, 0x00, 0x69, 0x90, 0x6d, 0x68, 0x37, 0x54, 0xca, 0x8c, 0xed, 0x91, - 0x2e, 0x1d, 0x82, 0xd9, 0xed, 0x5b, 0x53, 0xa3, 0xfb, 0x5a, 0xa3, 0x5e, 0x92, 0x05, 0x33, 0x59, - 0x19, 0x68, 0x68, 0x37, 0x88, 0xb0, 0xa8, 0x09, 0xa3, 0x04, 0xaa, 0xef, 0x6a, 0x66, 0x0d, 0xb3, - 0x91, 0xe8, 0x99, 0x6b, 0x79, 0xe5, 0x70, 0x23, 0x1d, 0x0b, 0x46, 0x0a, 0xf1, 0x94, 0x95, 0xe1, - 0x86, 0x76, 0x63, 0x9e, 0x02, 0xc8, 0xb0, 0xa5, 0xec, 0xc7, 0x3e, 0x35, 0x75, 0x84, 0x3e, 0xa7, - 0xf9, 0xba, 0x04, 0x10, 0x18, 0x10, 0xbd, 0x07, 0xf2, 0xba, 0xdf, 0xa2, 0xb4, 0x2e, 0x9f, 0xd2, - 0x87, 0x3b, 0x4d, 0x4d, 0xcc, 0xfc, 0x6c, 0xa9, 0x7e, 0xfd, 0xd6, 0x94, 0xa4, 0x8c, 0xea, 0xb1, - 0x99, 0x79, 0x37, 0x0c, 0x36, 0xed, 0xaa, 0xe6, 0x61, 0x95, 0xee, 0x1d, 0x53, 0x89, 0xcb, 0xfe, - 0x24, 0xe1, 0x75, 0xfb, 0xd6, 0x14, 0x62, 0x6a, 0x85, 0x88, 0x65, 0x5a, 0x0c, 0x00, 0x83, 0x10, - 0x82, 0x90, 0x4e, 0x5f, 0x95, 0x60, 0x70, 0x21, 0xf4, 0xd2, 0x5c, 0x01, 0x06, 0x1a, 0x96, 0x69, - 0xec, 0x71, 0xf7, 0xcc, 0x29, 0xa2, 0x89, 0x8a, 0x90, 0x65, 0xf7, 0x17, 0xbd, 0x7d, 0x71, 0x00, - 0x2b, 0xda, 0x84, 0xea, 0x3a, 0xde, 0x76, 0x0d, 0x31, 0x25, 0x8a, 0x68, 0xa2, 0x4b, 0x90, 0x77, - 0xb1, 0xde, 0x74, 0x0c, 0x6f, 0x5f, 0xd5, 0x2d, 0xd3, 0xd3, 0x74, 0x8f, 0xdd, 0x84, 0x2b, 0xdf, - 0x73, 0xfb, 0xd6, 0xd4, 0x71, 0x26, 0x6b, 0x1c, 0x43, 0x56, 0x46, 0x05, 0x68, 0x9e, 0x41, 0xc8, - 0x08, 0x55, 0xec, 0x69, 0x46, 0xdd, 0x2d, 0xb0, 0x47, 0x8e, 0xa2, 0x19, 0xd2, 0xe5, 0x37, 0x07, - 0xc2, 0xc7, 0x6d, 0x97, 0x20, 0x6f, 0xd9, 0xd8, 0x89, 0xd4, 0xa5, 0x52, 0x7c, 0xe4, 0x38, 0x86, - 0xac, 0x8c, 0x0a, 0x90, 0xa8, 0x59, 0x3d, 0x32, 0xcd, 0x62, 0x73, 0x6a, 0x37, 0xb7, 0x83, 0x53, - 0xba, 0x89, 0x96, 0xd9, 0x98, 0x33, 0xf7, 0xcb, 0x4f, 0x06, 0xdc, 0xe3, 0x74, 0xf2, 0xd7, 0xbe, - 0x70, 0x66, 0x82, 0xbb, 0x46, 0x70, 0x6a, 0x76, 0x05, 0xef, 0x93, 0xe9, 0xe7, 0xa8, 0xeb, 0x14, - 0x93, 0x54, 0xa1, 0x2f, 0x6a, 0x46, 0x5d, 0xdc, 0xe8, 0x56, 0x78, 0x0b, 0x95, 0xa0, 0xdf, 0xf5, - 0x34, 0xaf, 0xe9, 0xf2, 0xef, 0xac, 0xc9, 0x9d, 0x5c, 0xad, 0x6c, 0x99, 0xd5, 0x0d, 0x8a, 0xa9, - 0x70, 0x0a, 0x74, 0x05, 0xfa, 0x3d, 0x6b, 0x0f, 0x9b, 0xdc, 0x84, 0x07, 0x0f, 0x77, 0xfa, 0x18, - 0x94, 0xb1, 0x40, 0xfb, 0x90, 0xaf, 0xe2, 0x3a, 0xae, 0xb1, 0x52, 0x6b, 0x57, 0x23, 0x5b, 0x1c, - 0xfa, 0xcd, 0xb5, 0xf2, 0xea, 0xe1, 0xc2, 0x91, 0xdb, 0x2c, 0xce, 0x54, 0x56, 0x46, 0x7d, 0xd0, - 0x06, 0x85, 0xa0, 0x2b, 0x91, 0xf7, 0x3c, 0xf9, 0xd7, 0x09, 0xef, 0xef, 0x64, 0x88, 0x90, 0x77, - 0x8b, 0xd3, 0x91, 0xf0, 0x5b, 0xa2, 0x97, 0x20, 0xdf, 0x34, 0xb7, 0x2d, 0x93, 0x5e, 0xc0, 0xe4, - 0x85, 0x3f, 0xd9, 0x49, 0xa6, 0xc3, 0x6e, 0x12, 0xc7, 0x90, 0x95, 0x51, 0x1f, 0x74, 0x99, 0x6d, - 0x0f, 0xaa, 0x30, 0x12, 0x60, 0xd1, 0x90, 0xcd, 0x25, 0x86, 0xec, 0x7d, 0x3c, 0x64, 0x8f, 0xc6, - 0x47, 0x09, 0xa2, 0x76, 0xd8, 0x07, 0x12, 0x32, 0x74, 0x19, 0x20, 0x48, 0x14, 0xf4, 0x94, 0x64, - 0xb0, 0xb3, 0x0b, 0x04, 0xd9, 0x46, 0xec, 0x2c, 0x03, 0x5a, 0xf4, 0x7e, 0x09, 0xc6, 0x1b, 0x86, - 0xa9, 0xba, 0xb8, 0xbe, 0xa3, 0x72, 0x0b, 0x13, 0x9e, 0xf4, 0x03, 0x3a, 0xe5, 0x17, 0x0e, 0xe1, - 0x1a, 0xb7, 0x6f, 0x4d, 0x15, 0x79, 0x4a, 0x6d, 0xe5, 0x2b, 0x2b, 0x63, 0x0d, 0xc3, 0xdc, 0xc0, - 0xf5, 0x9d, 0x05, 0x1f, 0x56, 0x1a, 0xfa, 0xd0, 0xa7, 0xa6, 0x8e, 0xf0, 0xf0, 0x3d, 0x22, 0x9f, - 0xa7, 0x27, 0xfc, 0x3c, 0xec, 0xb0, 0x4b, 0xb6, 0x2c, 0x9a, 0x68, 0xd0, 0x53, 0x95, 0x9c, 0x12, - 0x00, 0x58, 0xd8, 0xbf, 0xf2, 0x1f, 0xa6, 0x25, 0xf9, 0x57, 0x24, 0xe8, 0x5f, 0xb8, 0xba, 0xae, - 0x19, 0x0e, 0x5a, 0x82, 0xb1, 0xc0, 0x7f, 0xa2, 0x41, 0x7f, 0xf2, 0xf6, 0xad, 0xa9, 0x42, 0xdc, - 0xc5, 0xfc, 0xa8, 0x0f, 0x7c, 0x59, 0x84, 0xfd, 0x52, 0xa7, 0x7d, 0x6d, 0x84, 0x55, 0x0b, 0x8a, - 0xdc, 0xba, 0xeb, 0x8d, 0xa9, 0x59, 0x81, 0x01, 0x26, 0xad, 0x8b, 0x4a, 0xd0, 0x67, 0x93, 0x1f, - 0xfc, 0xf1, 0xc5, 0x64, 0x47, 0x17, 0xa6, 0xf8, 0xfe, 0x61, 0x2a, 0x21, 0x91, 0x3f, 0x9a, 0x02, - 0x58, 0xb8, 0x7a, 0x75, 0xd3, 0x31, 0xec, 0x3a, 0xf6, 0xee, 0xa4, 0xe6, 0x9b, 0x70, 0x34, 0xb4, - 0x89, 0x72, 0xf4, 0x98, 0xf6, 0xd3, 0xb7, 0x6f, 0x4d, 0x9d, 0x8c, 0x6b, 0x1f, 0x42, 0x93, 0x95, - 0xf1, 0x60, 0x3b, 0xe5, 0xe8, 0x6d, 0xb9, 0x56, 0x5d, 0xcf, 0xe7, 0x9a, 0xee, 0xcc, 0x35, 0x84, - 0x16, 0xe6, 0xba, 0xe0, 0x7a, 0xed, 0x4d, 0xbb, 0x01, 0x83, 0x81, 0x49, 0x5c, 0xb4, 0x00, 0x59, - 0x8f, 0xff, 0xe6, 0x16, 0x96, 0x3b, 0x5b, 0x58, 0x90, 0x71, 0x2b, 0xfb, 0x94, 0xf2, 0xff, 0x91, - 0x00, 0x02, 0x9f, 0xfd, 0xd1, 0x74, 0x31, 0x92, 0xda, 0x79, 0x0e, 0x4e, 0x1f, 0xbe, 0x92, 0xe3, - 0x2c, 0x62, 0x46, 0xfd, 0x89, 0x14, 0x8c, 0x6f, 0x89, 0x24, 0xf4, 0x23, 0x6f, 0x88, 0x75, 0x18, - 0xc0, 0xa6, 0xe7, 0x18, 0xd4, 0x12, 0x64, 0xca, 0x1f, 0xef, 0x34, 0xe5, 0x6d, 0x74, 0xa2, 0x1f, - 0x13, 0x12, 0xa7, 0xff, 0x9c, 0x4d, 0xcc, 0x1a, 0x1f, 0x4f, 0x43, 0xa1, 0x13, 0x25, 0x9a, 0x87, - 0x51, 0xdd, 0xc1, 0x14, 0xa0, 0x86, 0x8f, 0x1b, 0xcb, 0xc5, 0xa0, 0xdc, 0x8c, 0x21, 0xc8, 0xca, - 0x88, 0x80, 0xf0, 0x85, 0xa4, 0x06, 0xa4, 0x16, 0x24, 0xbe, 0x47, 0xb0, 0x7a, 0x2c, 0xfe, 0x64, - 0xbe, 0x92, 0x88, 0x41, 0xa2, 0x0c, 0xd8, 0x52, 0x32, 0x12, 0x40, 0xe9, 0x5a, 0x72, 0x0d, 0x46, - 0x0d, 0xd3, 0xf0, 0x0c, 0xad, 0xae, 0x6e, 0x6b, 0x75, 0xcd, 0xd4, 0x0f, 0x5d, 0x4f, 0xb3, 0xe4, - 0xcf, 0xc7, 0x8e, 0xf1, 0x94, 0x95, 0x11, 0x0e, 0x29, 0x33, 0x00, 0x5a, 0x81, 0x01, 0x31, 0x5e, - 0xe6, 0xf0, 0x75, 0x88, 0xe0, 0x11, 0xaa, 0xff, 0x7e, 0x36, 0x0d, 0x63, 0x0a, 0xae, 0xfe, 0xff, - 0x49, 0x39, 0xc4, 0xa4, 0x28, 0x00, 0x2c, 0xfa, 0x49, 0xd2, 0x3d, 0xec, 0xbc, 0x90, 0x24, 0x92, - 0x63, 0x6c, 0x16, 0x5c, 0x2f, 0x34, 0x33, 0xb7, 0x52, 0x30, 0x14, 0x9e, 0x99, 0xbf, 0xa0, 0xcb, - 0x15, 0x5a, 0x0a, 0xb2, 0x53, 0x86, 0x7f, 0x96, 0xb5, 0x43, 0x76, 0x6a, 0xf1, 0xe3, 0xee, 0x69, - 0xe9, 0xcf, 0x52, 0xd0, 0xbf, 0xae, 0x39, 0x5a, 0xc3, 0x45, 0x7a, 0x4b, 0x21, 0x2a, 0x8e, 0x2d, - 0x5b, 0x3e, 0xbe, 0xcd, 0x4f, 0x49, 0x12, 0xea, 0xd0, 0x8f, 0xb5, 0xa9, 0x43, 0xdf, 0x06, 0x23, - 0x64, 0xdf, 0x1c, 0x7a, 0x03, 0x83, 0x58, 0x7b, 0xb8, 0x7c, 0x22, 0xe0, 0x12, 0xed, 0x67, 0xdb, - 0xea, 0xab, 0xe1, 0x57, 0x30, 0x06, 0x09, 0x46, 0x90, 0xac, 0x09, 0xf9, 0xb1, 0x60, 0xff, 0x1a, - 0xea, 0x94, 0x15, 0x68, 0x68, 0x37, 0x2a, 0xac, 0x81, 0x96, 0x01, 0xed, 0xfa, 0x27, 0x2a, 0x6a, - 0x60, 0x4e, 0x42, 0x7f, 0xef, 0xed, 0x5b, 0x53, 0x27, 0x18, 0x7d, 0x2b, 0x8e, 0xac, 0x8c, 0x05, - 0x40, 0xc1, 0xed, 0x29, 0x00, 0xa2, 0x97, 0xca, 0xde, 0xe0, 0x64, 0xfb, 0xa2, 0xa3, 0xb7, 0x6f, - 0x4d, 0x8d, 0x31, 0x2e, 0x41, 0x9f, 0xac, 0xe4, 0x48, 0x63, 0x81, 0xfc, 0x0e, 0x79, 0xf6, 0x67, - 0x24, 0x40, 0xc1, 0x32, 0xa0, 0x60, 0xd7, 0x26, 0x1b, 0x39, 0x52, 0xa7, 0x87, 0x6a, 0x6a, 0xa9, - 0x7b, 0x9d, 0x1e, 0xd0, 0x8b, 0x3a, 0x3d, 0x14, 0x29, 0xcf, 0x04, 0xd9, 0x32, 0xc5, 0xe7, 0xb1, - 0xcd, 0xeb, 0xae, 0x33, 0xf3, 0x96, 0x21, 0xa8, 0x5b, 0x32, 0xe3, 0x11, 0xf9, 0x75, 0x09, 0x4e, - 0xb4, 0x78, 0x94, 0x2f, 0xec, 0x5f, 0x02, 0xe4, 0x84, 0x3a, 0xf9, 0x37, 0xf6, 0x98, 0xd0, 0x07, - 0x76, 0xd0, 0x31, 0xa7, 0x25, 0x03, 0xdf, 0xe1, 0x84, 0xcf, 0x5e, 0x9a, 0xfd, 0xe7, 0x12, 0x4c, - 0x84, 0x65, 0xf0, 0xb5, 0x59, 0x85, 0xa1, 0xb0, 0x08, 0x5c, 0x8f, 0x07, 0x7a, 0xd1, 0x83, 0xab, - 0x10, 0xa1, 0x47, 0x2f, 0x04, 0x31, 0xcb, 0x0e, 0xde, 0x9e, 0xe8, 0xd9, 0x24, 0x42, 0xa6, 0x78, - 0xec, 0x66, 0xe8, 0xa4, 0xbc, 0x9a, 0x82, 0xcc, 0xba, 0x65, 0xd5, 0x91, 0x07, 0x63, 0xa6, 0xe5, - 0xa9, 0xc4, 0xbd, 0x70, 0x55, 0xe5, 0x5b, 0x74, 0x96, 0x0c, 0x2f, 0x1f, 0xc2, 0x52, 0xdf, 0xba, - 0x35, 0xd5, 0xca, 0x4f, 0x19, 0x35, 0x2d, 0xaf, 0x4c, 0x21, 0x9b, 0x6c, 0x03, 0xff, 0x7e, 0x09, - 0x86, 0xa3, 0x43, 0xb2, 0x84, 0xf9, 0x9e, 0xc3, 0x0d, 0x19, 0xe5, 0x75, 0xfb, 0xd6, 0xd4, 0x44, - 0x10, 0x41, 0x3e, 0x58, 0x56, 0x86, 0xb6, 0x43, 0x32, 0xb0, 0xb7, 0xd5, 0xbe, 0xf3, 0xa9, 0x29, - 0xe9, 0xf4, 0x17, 0x25, 0x80, 0xe0, 0xc8, 0x02, 0x3d, 0x06, 0xc7, 0xcb, 0x6b, 0xab, 0x0b, 0xea, - 0xc6, 0xe6, 0xdc, 0xe6, 0xd6, 0x86, 0xba, 0xb5, 0xba, 0xb1, 0x5e, 0x99, 0x5f, 0xba, 0xb4, 0x54, - 0x59, 0x08, 0x8e, 0xd9, 0x5d, 0x1b, 0xeb, 0xc6, 0x8e, 0x81, 0xab, 0xe8, 0x21, 0x98, 0x88, 0x62, - 0x93, 0x56, 0x65, 0x21, 0x2f, 0x15, 0x87, 0x5e, 0xbd, 0x39, 0x9d, 0x65, 0xf5, 0x1a, 0xae, 0xa2, - 0x53, 0x70, 0xb4, 0x15, 0x6f, 0x69, 0x75, 0x31, 0x9f, 0x2a, 0x0e, 0xbf, 0x7a, 0x73, 0x3a, 0xe7, - 0x17, 0x76, 0x48, 0x06, 0x14, 0xc6, 0xe4, 0xfc, 0xd2, 0x45, 0x78, 0xf5, 0xe6, 0x74, 0x3f, 0x33, - 0x63, 0x31, 0xf3, 0xa1, 0xcf, 0x4c, 0x1e, 0x29, 0x5f, 0xe9, 0x78, 0x90, 0xfe, 0x44, 0xb2, 0x01, - 0x1b, 0x56, 0xb5, 0x59, 0xc7, 0xfe, 0x39, 0xb9, 0x7f, 0x84, 0xfe, 0xf3, 0xc7, 0x61, 0xaa, 0xc3, - 0x11, 0xba, 0x77, 0x23, 0xe1, 0xf4, 0xbc, 0xcb, 0x39, 0x79, 0xe2, 0x39, 0x78, 0x87, 0x93, 0xf7, - 0xc3, 0x9f, 0x8e, 0xf7, 0xf4, 0x20, 0x40, 0xfe, 0xdd, 0x0c, 0xa0, 0x15, 0xb7, 0x36, 0x4f, 0x6a, - 0xae, 0xd0, 0x6b, 0x67, 0xb1, 0x73, 0x1e, 0xe9, 0xfb, 0x3a, 0xe7, 0x59, 0x89, 0x9c, 0x9c, 0xa4, - 0x0e, 0x76, 0x4e, 0xdb, 0xfb, 0xf1, 0x49, 0xfa, 0x07, 0x77, 0x7c, 0xd2, 0xbe, 0x88, 0xca, 0xdc, - 0xb9, 0x1d, 0x58, 0xdf, 0xa1, 0x76, 0x60, 0x97, 0xa0, 0x9f, 0x9f, 0x92, 0xf6, 0x77, 0x39, 0x25, - 0x2d, 0x74, 0x3c, 0x0a, 0xe5, 0xd4, 0xe8, 0x9c, 0xb8, 0x21, 0x35, 0xd0, 0xdb, 0xb2, 0xc7, 0xaf, - 0x50, 0x65, 0x3f, 0x24, 0x16, 0xbd, 0x93, 0x50, 0x6c, 0x75, 0x2a, 0x91, 0x92, 0xe5, 0x9b, 0x69, - 0xc8, 0xaf, 0xb8, 0xb5, 0x4a, 0xd5, 0xf0, 0xee, 0x92, 0xc7, 0x3d, 0xd7, 0x79, 0x57, 0x8b, 0x6e, - 0xdf, 0x9a, 0x1a, 0x61, 0x36, 0xed, 0x62, 0x49, 0x07, 0x46, 0x63, 0x0f, 0x18, 0xb8, 0x7b, 0x2d, - 0x1d, 0xfa, 0x61, 0x47, 0x8c, 0x9f, 0x4c, 0xf7, 0x1f, 0x21, 0x57, 0x47, 0xef, 0x6b, 0xef, 0xd6, - 0xcc, 0xab, 0x56, 0xee, 0xfa, 0x89, 0x60, 0x30, 0x7b, 0x45, 0x28, 0xc4, 0xa7, 0xc7, 0x9f, 0xbb, - 0x3f, 0x96, 0x60, 0x70, 0xc5, 0x15, 0xdb, 0x6f, 0xfc, 0x23, 0x7a, 0x14, 0xf1, 0xb4, 0x7f, 0x03, - 0x28, 0xdd, 0x9b, 0x07, 0x8b, 0x5b, 0x41, 0x81, 0x11, 0x8e, 0xc2, 0x78, 0x48, 0x4f, 0x5f, 0xff, - 0xdf, 0x49, 0xd1, 0x7c, 0x59, 0xc6, 0x35, 0xc3, 0xf4, 0x8b, 0x0e, 0xfc, 0x17, 0x75, 0x53, 0x15, - 0xd8, 0x39, 0x73, 0x58, 0x3b, 0xef, 0xd1, 0x54, 0x11, 0xb3, 0xa7, 0x5f, 0x51, 0xae, 0xb4, 0x6e, - 0xfe, 0xa5, 0x03, 0xbc, 0x85, 0x13, 0xdb, 0xe2, 0xcb, 0x6f, 0x4a, 0x30, 0xbc, 0xe2, 0xd6, 0xb6, - 0xcc, 0xea, 0xff, 0xf3, 0xfe, 0xbb, 0x03, 0x47, 0x23, 0x9a, 0xde, 0x25, 0x93, 0x9e, 0x7d, 0x2d, - 0x03, 0xe9, 0x15, 0xb7, 0x86, 0x5e, 0x82, 0xd1, 0x78, 0x11, 0x71, 0xba, 0x53, 0xf6, 0x6e, 0x5d, - 0x1b, 0x8a, 0x67, 0x7b, 0xc7, 0xf5, 0x35, 0xd9, 0x83, 0xe1, 0xe8, 0x1a, 0x72, 0xaa, 0x0b, 0x93, - 0x08, 0x66, 0xf1, 0xf1, 0x5e, 0x31, 0xfd, 0xc1, 0xde, 0x03, 0x59, 0x3f, 0xe9, 0xdd, 0xdf, 0x85, - 0x5a, 0x20, 0x15, 0x1f, 0xed, 0x01, 0xc9, 0xe7, 0xfe, 0x12, 0x8c, 0xc6, 0x53, 0x4a, 0x37, 0xeb, - 0xc5, 0x70, 0xbb, 0x5a, 0xaf, 0x53, 0x68, 0x6d, 0x03, 0x84, 0xe2, 0xe0, 0xc1, 0x2e, 0x1c, 0x02, - 0xb4, 0xe2, 0x99, 0x9e, 0xd0, 0xfc, 0xcd, 0xd7, 0x5d, 0xa9, 0xd0, 0xbf, 0x9a, 0x82, 0xd3, 0xe1, - 0xda, 0xf7, 0xa5, 0x26, 0x76, 0xf6, 0xfd, 0xf2, 0xd6, 0xd6, 0x6a, 0x86, 0x19, 0xbe, 0x16, 0x79, - 0x22, 0x1c, 0x3a, 0x14, 0x57, 0x08, 0x2d, 0x9b, 0x30, 0xb8, 0xae, 0xd5, 0xb0, 0x82, 0x5f, 0x6a, - 0x62, 0xd7, 0x6b, 0x73, 0x8d, 0xed, 0x18, 0xf4, 0x5b, 0x3b, 0x3b, 0xe2, 0x6d, 0xb6, 0x8c, 0xc2, - 0x5b, 0x68, 0x02, 0xfa, 0xea, 0x46, 0xc3, 0x60, 0xe1, 0x99, 0x51, 0x58, 0x03, 0x4d, 0xc1, 0xa0, - 0x4e, 0xa2, 0x50, 0x65, 0xaf, 0xff, 0x67, 0xc4, 0x77, 0xb3, 0x9a, 0xa6, 0xb7, 0x49, 0x20, 0xf2, - 0x73, 0x30, 0xc4, 0xc6, 0xe3, 0x53, 0x70, 0x02, 0xb2, 0xf4, 0x75, 0xed, 0x60, 0xd4, 0x01, 0xd2, - 0xbe, 0xc2, 0xae, 0xbc, 0x31, 0x2e, 0x6c, 0x60, 0xd6, 0x28, 0x2f, 0x76, 0xb4, 0xe7, 0x99, 0x1e, - 0x6b, 0x03, 0x66, 0x2d, 0xdf, 0x96, 0xbf, 0xd5, 0x07, 0x47, 0xf9, 0xce, 0x44, 0xb3, 0x8d, 0xd9, - 0x5d, 0xcf, 0x13, 0x17, 0xce, 0x81, 0x27, 0x03, 0xcd, 0x36, 0xe4, 0x7d, 0xc8, 0x5c, 0xf6, 0x3c, - 0x1b, 0x9d, 0x86, 0x3e, 0x87, 0x4c, 0x09, 0x7f, 0xa4, 0xe3, 0x97, 0x97, 0x9a, 0x6d, 0xcc, 0x10, - 0x04, 0xa5, 0x59, 0xc7, 0x0a, 0x43, 0x41, 0x15, 0x98, 0xda, 0x69, 0xd6, 0xeb, 0xfb, 0x6a, 0x15, - 0xd3, 0xff, 0x7b, 0xe8, 0xff, 0xe7, 0x20, 0x7c, 0xc3, 0xd6, 0x4c, 0x7f, 0x27, 0x90, 0x55, 0x4e, - 0x52, 0xb4, 0x05, 0x8a, 0x25, 0xfe, 0x6b, 0x50, 0x45, 0xe0, 0xc8, 0xbf, 0x9f, 0x82, 0xac, 0x60, - 0x4d, 0x2f, 0xa2, 0xe1, 0x3a, 0xd6, 0x3d, 0x4b, 0xbc, 0x22, 0xe1, 0xb7, 0x11, 0x82, 0x74, 0x8d, - 0xcf, 0x53, 0xee, 0xf2, 0x11, 0x85, 0x34, 0x08, 0xcc, 0xbf, 0x1e, 0x48, 0x60, 0x76, 0x93, 0x4c, - 0x5d, 0xc6, 0xb6, 0xc4, 0x39, 0xeb, 0xe5, 0x23, 0x0a, 0x6d, 0xa1, 0x02, 0xf4, 0x13, 0xe7, 0xf5, - 0xd8, 0x47, 0x9d, 0x09, 0x9c, 0xb7, 0xd1, 0x31, 0xe8, 0xb3, 0x35, 0x4f, 0x67, 0xef, 0xed, 0x93, - 0x0e, 0xd6, 0x24, 0x29, 0x9a, 0x7d, 0x4c, 0x23, 0xfe, 0x4f, 0xc5, 0x88, 0x31, 0xd8, 0x57, 0x4b, - 0x89, 0xdc, 0xeb, 0x9a, 0xe7, 0x61, 0xc7, 0x24, 0x0c, 0x19, 0x3a, 0xbd, 0x73, 0x6a, 0x55, 0xf7, - 0xf9, 0x3f, 0x3a, 0xa3, 0xbf, 0xf9, 0x7f, 0x56, 0xa2, 0x4e, 0xa1, 0xd2, 0x4e, 0xf6, 0xff, 0x1d, - 0x87, 0x04, 0xb0, 0x4c, 0x90, 0x2a, 0x30, 0xae, 0x55, 0xab, 0x06, 0xfb, 0x9f, 0x63, 0xea, 0xb6, - 0x41, 0xb7, 0xcb, 0x2e, 0xfd, 0xef, 0x9d, 0x9d, 0xe6, 0x02, 0x05, 0x04, 0x65, 0x8e, 0x5f, 0xce, - 0xc1, 0x80, 0xcd, 0x84, 0x92, 0x2f, 0xc2, 0x58, 0x8b, 0xa4, 0x44, 0xbe, 0x3d, 0xc3, 0xac, 0x8a, - 0x3b, 0x93, 0xe4, 0x37, 0x81, 0xd1, 0x2f, 0x0f, 0xb3, 0x97, 0x4f, 0xe8, 0xef, 0xf2, 0x07, 0x3a, - 0xdf, 0x10, 0x1e, 0x09, 0xdd, 0x10, 0xd6, 0x6c, 0xa3, 0x9c, 0xa3, 0xfc, 0xf9, 0xc5, 0xe0, 0x39, - 0xde, 0xc1, 0x2e, 0x05, 0xcf, 0x58, 0x4e, 0x6d, 0xb6, 0x86, 0x4d, 0xb1, 0xf3, 0x25, 0x5d, 0x9a, - 0x6d, 0xb8, 0xd4, 0x1d, 0x83, 0x2f, 0x21, 0xbb, 0x17, 0x43, 0xbf, 0xe9, 0x7d, 0xe1, 0xcc, 0xe2, - 0xdc, 0xfa, 0x92, 0xef, 0xc7, 0x5f, 0x4e, 0xc1, 0xc9, 0x90, 0x1f, 0x87, 0x90, 0x5b, 0xdd, 0xb9, - 0xd8, 0xde, 0xe3, 0x7b, 0xf8, 0x8e, 0xc0, 0x15, 0xc8, 0x10, 0x7c, 0x94, 0xf0, 0x7f, 0x8f, 0x0a, - 0xbf, 0xfa, 0xb5, 0xdf, 0x94, 0xa3, 0x1b, 0xb0, 0xc8, 0xac, 0x50, 0x26, 0xe5, 0x1f, 0xef, 0xdd, - 0x7e, 0xf9, 0xe0, 0x23, 0xd0, 0xee, 0x9d, 0x33, 0x63, 0xdc, 0x86, 0x7f, 0x72, 0x0e, 0xe4, 0x0e, - 0x67, 0x06, 0x2c, 0x6d, 0x76, 0x3f, 0xfc, 0x38, 0x40, 0x4e, 0xee, 0x74, 0x0d, 0xb1, 0xdb, 0x0c, - 0xf6, 0x78, 0x9e, 0x71, 0x03, 0x8e, 0xbd, 0x40, 0xc6, 0x0e, 0x8e, 0xbb, 0x45, 0x76, 0x3f, 0xe6, - 0xbf, 0xbe, 0x23, 0xf1, 0x7f, 0x9e, 0xca, 0xce, 0xbb, 0x2e, 0x01, 0x04, 0xf2, 0xf1, 0xd3, 0x89, - 0x87, 0x66, 0x3a, 0x2e, 0x1a, 0x33, 0xa1, 0x15, 0x43, 0x09, 0x51, 0xca, 0xbf, 0x2c, 0xc1, 0xf1, - 0x96, 0xa1, 0x79, 0xa2, 0x5f, 0x6c, 0x73, 0x63, 0xb2, 0xe7, 0x97, 0x08, 0xc3, 0xb7, 0x27, 0x17, - 0xdb, 0x08, 0xfb, 0x70, 0xa2, 0xb0, 0x4c, 0x8a, 0x88, 0xb4, 0xcf, 0xc2, 0xd1, 0xa8, 0xb0, 0xc2, - 0x4c, 0x0f, 0xc2, 0x48, 0xb4, 0x44, 0xe5, 0xe6, 0x1a, 0x8e, 0x14, 0xa9, 0xb2, 0x1a, 0xb7, 0xb3, - 0xaf, 0x6b, 0x05, 0x72, 0x3e, 0x2a, 0xaf, 0x2c, 0x7b, 0x56, 0x35, 0xa0, 0x94, 0x3f, 0x2a, 0xc1, - 0x74, 0x74, 0x84, 0x60, 0xaf, 0xea, 0x1e, 0x4c, 0xd8, 0x3b, 0x36, 0xc5, 0x6f, 0x4a, 0x70, 0x5f, - 0x17, 0x99, 0xb8, 0x01, 0x5e, 0x86, 0x89, 0xd0, 0x89, 0xbe, 0x48, 0xe1, 0x62, 0xda, 0x4f, 0x27, - 0x3f, 0x8a, 0xf0, 0xcb, 0xa7, 0x7b, 0x88, 0x51, 0x3e, 0xf7, 0x87, 0x53, 0xe3, 0xad, 0x7d, 0xae, - 0x32, 0xde, 0x7a, 0x00, 0x7f, 0x07, 0xfd, 0xe3, 0x35, 0x09, 0x1e, 0x89, 0xaa, 0xda, 0xe6, 0xd1, - 0xfb, 0x0f, 0x6b, 0x1e, 0xfe, 0xbd, 0x04, 0xa7, 0x7b, 0x11, 0xce, 0xaf, 0x74, 0xc7, 0x83, 0xe7, - 0x6a, 0xf1, 0xf9, 0x78, 0xf4, 0x00, 0x2f, 0x29, 0x70, 0x2f, 0x45, 0x3e, 0xb7, 0xbb, 0x60, 0x78, - 0x9b, 0x07, 0x56, 0x78, 0xca, 0x7d, 0x23, 0x47, 0xf7, 0xa1, 0xc2, 0xc8, 0x91, 0x9d, 0x68, 0x9b, - 0xb9, 0x48, 0xb5, 0x99, 0x8b, 0xd0, 0x4e, 0xf1, 0x1a, 0xcf, 0x5b, 0x6d, 0x9e, 0xa5, 0xbd, 0x1b, - 0xc6, 0xdb, 0xb8, 0x32, 0x8f, 0xea, 0x03, 0x78, 0xb2, 0x82, 0x5a, 0x9d, 0x55, 0xde, 0x87, 0x29, - 0x3a, 0x6e, 0x1b, 0x43, 0xdf, 0x6d, 0x95, 0x1b, 0x3c, 0xb7, 0xb4, 0x1d, 0x9a, 0xeb, 0xbe, 0x04, - 0xfd, 0x6c, 0x9e, 0xb9, 0xba, 0x87, 0x70, 0x14, 0xce, 0x40, 0xfe, 0x39, 0x91, 0xcb, 0x16, 0x84, - 0xd8, 0xed, 0x63, 0xa8, 0x17, 0x5d, 0xef, 0x50, 0x0c, 0x85, 0x8c, 0xf1, 0x75, 0x91, 0xd5, 0xda, - 0x4b, 0xc7, 0xcd, 0xa1, 0xdf, 0xb1, 0xac, 0xc6, 0x6c, 0x73, 0x77, 0xd3, 0xd7, 0x2f, 0x8a, 0xf4, - 0xe5, 0xeb, 0x94, 0x90, 0xbe, 0x7e, 0x38, 0xa6, 0xf7, 0x13, 0x59, 0x82, 0x98, 0x7f, 0x1e, 0x13, - 0xd9, 0x77, 0x24, 0x38, 0x41, 0x75, 0x0b, 0x3f, 0x9b, 0x3d, 0xa8, 0xc9, 0x1f, 0x03, 0xe4, 0x3a, - 0xba, 0xda, 0x36, 0xba, 0xf3, 0xae, 0xa3, 0x5f, 0x8d, 0xac, 0x2f, 0x8f, 0x01, 0xaa, 0xba, 0x5e, - 0x1c, 0x9b, 0xbd, 0x16, 0x9f, 0xaf, 0xba, 0xde, 0xd5, 0x2e, 0xab, 0x51, 0xe6, 0x0e, 0x4c, 0xe7, - 0xeb, 0x12, 0x14, 0xdb, 0xa9, 0xcc, 0xa7, 0xcf, 0x80, 0x63, 0x91, 0x87, 0xfd, 0xf1, 0x19, 0x7c, - 0xac, 0x97, 0xa7, 0xdb, 0xb1, 0x30, 0x3a, 0xea, 0xe0, 0xbb, 0x5d, 0x07, 0x4c, 0x45, 0x3d, 0xb4, - 0xb5, 0xb2, 0xfe, 0xa1, 0x85, 0xcf, 0x17, 0x5a, 0xf2, 0xea, 0x9f, 0x8b, 0xda, 0xfb, 0x06, 0x4c, - 0x76, 0x90, 0xfa, 0x6e, 0xaf, 0x7b, 0xbb, 0x1d, 0x27, 0xf3, 0x4e, 0x97, 0xef, 0x4f, 0xf1, 0x48, - 0x88, 0xde, 0xc0, 0x0a, 0xed, 0xc5, 0xda, 0xdd, 0x09, 0x97, 0xdf, 0x09, 0xf7, 0xb4, 0xa5, 0xe2, - 0xb2, 0x95, 0x20, 0xb3, 0x6b, 0xb8, 0x1e, 0x17, 0xeb, 0xa1, 0x4e, 0x62, 0xc5, 0xa8, 0x29, 0x8d, - 0x8c, 0x20, 0x4f, 0x59, 0xaf, 0x5b, 0x56, 0x9d, 0x8b, 0x21, 0x5f, 0x81, 0xb1, 0x10, 0x8c, 0x0f, - 0x72, 0x1e, 0x32, 0xb6, 0xc5, 0xbf, 0x82, 0x34, 0x78, 0xf6, 0x64, 0xa7, 0x41, 0x08, 0x0d, 0x57, - 0x9b, 0xe2, 0xcb, 0x13, 0x80, 0x18, 0x33, 0xfa, 0x2e, 0x98, 0x18, 0x62, 0x03, 0xc6, 0x23, 0x50, - 0x3e, 0xc8, 0x5b, 0xa0, 0xdf, 0xa6, 0x10, 0xff, 0xae, 0x6d, 0xa7, 0x61, 0x28, 0x96, 0xff, 0xdd, - 0x19, 0xda, 0x3a, 0xfb, 0xad, 0xa3, 0xd0, 0x47, 0xb9, 0xa2, 0x8f, 0x4b, 0x00, 0xa1, 0x37, 0xbb, - 0x66, 0x3a, 0xb1, 0x69, 0xbf, 0x27, 0x2e, 0xce, 0xf6, 0x8c, 0xcf, 0x6b, 0xb6, 0xd3, 0x1f, 0xf8, - 0xdd, 0x6f, 0xfe, 0x54, 0xea, 0x01, 0x24, 0xcf, 0x76, 0xd8, 0x8d, 0x87, 0xe2, 0xe5, 0xb3, 0x91, - 0x4f, 0xf0, 0x9c, 0xe9, 0x6d, 0x28, 0x21, 0xd9, 0x4c, 0xaf, 0xe8, 0x5c, 0xb0, 0x8b, 0x54, 0xb0, - 0x73, 0xe8, 0xc9, 0x64, 0xc1, 0x66, 0xdf, 0x1b, 0x0d, 0x9a, 0xf7, 0xa1, 0x7f, 0x23, 0xc1, 0x44, - 0xbb, 0x2d, 0x1d, 0xba, 0xd0, 0x9b, 0x14, 0xad, 0x25, 0x45, 0xf1, 0x99, 0x43, 0x50, 0x72, 0x55, - 0x16, 0xa9, 0x2a, 0x73, 0xe8, 0xb9, 0x43, 0xa8, 0x32, 0x1b, 0x5a, 0x77, 0xd0, 0xff, 0x96, 0xe0, - 0xde, 0xae, 0x3b, 0x24, 0x34, 0xd7, 0x9b, 0x94, 0x5d, 0x6a, 0xa7, 0x62, 0xf9, 0xfb, 0x61, 0xc1, - 0x35, 0x7e, 0x81, 0x6a, 0x7c, 0x05, 0x2d, 0x1d, 0x46, 0xe3, 0xa0, 0x22, 0x0a, 0xeb, 0xfe, 0xdb, - 0xd1, 0xab, 0x03, 0xdd, 0xdd, 0xa9, 0x65, 0xe3, 0x91, 0x10, 0x18, 0xad, 0x45, 0xad, 0xfc, 0x0e, - 0xaa, 0x82, 0x82, 0xd6, 0xbf, 0xcf, 0x49, 0x9b, 0x7d, 0x6f, 0x34, 0xf1, 0xbf, 0x0f, 0xfd, 0x4f, - 0xa9, 0xfd, 0x25, 0x80, 0xa7, 0xbb, 0x8a, 0xd8, 0x79, 0x53, 0x55, 0xbc, 0x70, 0x70, 0x42, 0xae, - 0x64, 0x83, 0x2a, 0x59, 0x43, 0xf8, 0x4e, 0x2b, 0xd9, 0x76, 0x12, 0xd1, 0x57, 0x25, 0x98, 0x68, - 0xb7, 0x27, 0x49, 0x08, 0xcb, 0x2e, 0x9b, 0xac, 0x84, 0xb0, 0xec, 0xb6, 0x01, 0x92, 0xdf, 0x42, - 0x95, 0x3f, 0x8f, 0x9e, 0xea, 0xa4, 0x7c, 0xd7, 0x59, 0x24, 0xb1, 0xd8, 0xb5, 0xc8, 0x4f, 0x88, - 0xc5, 0x5e, 0xf6, 0x31, 0x09, 0xb1, 0xd8, 0xd3, 0x1e, 0x23, 0x39, 0x16, 0x7d, 0xcd, 0x7a, 0x9c, - 0x46, 0x17, 0x7d, 0x59, 0x82, 0xe1, 0x48, 0x45, 0x8c, 0x9e, 0xe8, 0x2a, 0x68, 0xbb, 0x0d, 0x43, - 0xe7, 0x47, 0x9c, 0x9d, 0x0b, 0x6e, 0x79, 0x89, 0xea, 0x32, 0x8f, 0xe6, 0x0e, 0xa3, 0x8b, 0x13, - 0x91, 0xf8, 0x75, 0x09, 0xc6, 0xdb, 0x54, 0x99, 0x09, 0x51, 0xd8, 0xb9, 0x68, 0x2e, 0x5e, 0x38, - 0x38, 0x21, 0xd7, 0xea, 0x12, 0xd5, 0xea, 0x6d, 0xe8, 0xd9, 0xc3, 0x68, 0x15, 0x5a, 0x9f, 0x6f, - 0x05, 0xef, 0x4f, 0x87, 0xc6, 0x41, 0xe7, 0x0f, 0x28, 0x98, 0x50, 0xe8, 0xe9, 0x03, 0xd3, 0x71, - 0x7d, 0xde, 0x4e, 0xf5, 0x79, 0x01, 0xad, 0x7d, 0x7f, 0xfa, 0xb4, 0x2e, 0xeb, 0x9f, 0x6f, 0xfd, - 0x02, 0x40, 0x77, 0x2f, 0x6a, 0x5b, 0xac, 0x16, 0x9f, 0x3c, 0x10, 0x0d, 0x57, 0xea, 0x02, 0x55, - 0xea, 0x2c, 0x7a, 0xbc, 0x93, 0x52, 0xa1, 0x97, 0xe4, 0x0d, 0x73, 0xc7, 0x9a, 0x7d, 0x2f, 0x2b, - 0x81, 0xdf, 0x87, 0xde, 0x2f, 0xf1, 0x77, 0x93, 0x4f, 0x75, 0x1d, 0x37, 0x54, 0xc7, 0x16, 0x1f, - 0xe9, 0x01, 0x93, 0xcb, 0xf5, 0x00, 0x95, 0x6b, 0x12, 0x9d, 0xec, 0x24, 0x17, 0xa9, 0x65, 0xd1, - 0x87, 0x25, 0xff, 0x4e, 0xc3, 0xe9, 0xee, 0xbc, 0xc3, 0xc5, 0x6e, 0xe7, 0x57, 0x1e, 0xda, 0x94, - 0xc0, 0xf2, 0x43, 0x54, 0x92, 0x69, 0x34, 0xd9, 0x51, 0x12, 0x56, 0xfa, 0xde, 0x8d, 0x77, 0x08, - 0xfe, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x82, 0xbc, 0x57, 0x12, 0x1e, 0x92, 0x00, 0x00, - } - r := bytes.NewReader(gzipped) - gzipr, err := compress_gzip.NewReader(r) - if err != nil { - panic(err) - } - ungzipped, err := io_ioutil.ReadAll(gzipr) - if err != nil { - panic(err) - } - if err := github_com_gogo_protobuf_proto.Unmarshal(ungzipped, d); err != nil { - panic(err) - } - return d -} -func (this *CommissionRates) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*CommissionRates) - if !ok { - that2, ok := that.(CommissionRates) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Rate.Equal(that1.Rate) { - return false - } - if !this.MaxRate.Equal(that1.MaxRate) { - return false - } - if !this.MaxChangeRate.Equal(that1.MaxChangeRate) { - return false - } - return true -} -func (this *Commission) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Commission) - if !ok { - that2, ok := that.(Commission) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.CommissionRates.Equal(&that1.CommissionRates) { - return false - } - if !this.UpdateTime.Equal(that1.UpdateTime) { - return false - } - return true -} -func (this *Description) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Description) - if !ok { - that2, ok := that.(Description) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Moniker != that1.Moniker { - return false - } - if this.Identity != that1.Identity { - return false - } - if this.Website != that1.Website { - return false - } - if this.SecurityContact != that1.SecurityContact { - return false - } - if this.Details != that1.Details { - return false - } - return true -} -func (this *UnbondingDelegationEntry) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*UnbondingDelegationEntry) - if !ok { - that2, ok := that.(UnbondingDelegationEntry) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CreationHeight != that1.CreationHeight { - return false - } - if !this.CompletionTime.Equal(that1.CompletionTime) { - return false - } - if !this.InitialBalance.Equal(that1.InitialBalance) { - return false - } - if !this.Balance.Equal(that1.Balance) { - return false - } - return true -} -func (this *RedelegationEntry) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RedelegationEntry) - if !ok { - that2, ok := that.(RedelegationEntry) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.CreationHeight != that1.CreationHeight { - return false - } - if !this.CompletionTime.Equal(that1.CompletionTime) { - return false - } - if !this.InitialBalance.Equal(that1.InitialBalance) { - return false - } - if !this.SharesDst.Equal(that1.SharesDst) { - return false - } - return true -} -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 - } - if this.UnbondingTime != that1.UnbondingTime { - return false - } - if this.MaxValidators != that1.MaxValidators { - return false - } - if this.MaxEntries != that1.MaxEntries { - return false - } - if this.HistoricalEntries != that1.HistoricalEntries { - return false - } - if this.BondDenom != that1.BondDenom { - return false - } - return true -} -func (this *RedelegationEntryResponse) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RedelegationEntryResponse) - if !ok { - that2, ok := that.(RedelegationEntryResponse) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.RedelegationEntry.Equal(&that1.RedelegationEntry) { - return false - } - if !this.Balance.Equal(that1.Balance) { - return false - } - return true -} -func (this *Pool) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Pool) - if !ok { - that2, ok := that.(Pool) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.NotBondedTokens.Equal(that1.NotBondedTokens) { - return false - } - if !this.BondedTokens.Equal(that1.BondedTokens) { - return false - } - return true -} -func (m *HistoricalInfo) 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 *HistoricalInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HistoricalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Valset) > 0 { - for iNdEx := len(m.Valset) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Valset[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CommissionRates) 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 *CommissionRates) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommissionRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.MaxChangeRate.Size() - i -= size - if _, err := m.MaxChangeRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size := m.MaxRate.Size() - i -= size - if _, err := m.MaxRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.Rate.Size() - i -= size - if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Commission) 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 *Commission) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Commission) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintStaking(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x12 - { - size, err := m.CommissionRates.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Description) 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 *Description) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Description) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintStaking(dAtA, i, uint64(len(m.Details))) - i-- - dAtA[i] = 0x2a - } - if len(m.SecurityContact) > 0 { - i -= len(m.SecurityContact) - copy(dAtA[i:], m.SecurityContact) - i = encodeVarintStaking(dAtA, i, uint64(len(m.SecurityContact))) - i-- - dAtA[i] = 0x22 - } - if len(m.Website) > 0 { - i -= len(m.Website) - copy(dAtA[i:], m.Website) - i = encodeVarintStaking(dAtA, i, uint64(len(m.Website))) - i-- - dAtA[i] = 0x1a - } - if len(m.Identity) > 0 { - i -= len(m.Identity) - copy(dAtA[i:], m.Identity) - i = encodeVarintStaking(dAtA, i, uint64(len(m.Identity))) - i-- - dAtA[i] = 0x12 - } - if len(m.Moniker) > 0 { - i -= len(m.Moniker) - copy(dAtA[i:], m.Moniker) - i = encodeVarintStaking(dAtA, i, uint64(len(m.Moniker))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Validator) 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 *Validator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - { - size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintStaking(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x4a - if m.UnbondingHeight != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.UnbondingHeight)) - i-- - dAtA[i] = 0x40 - } - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - { - size := m.DelegatorShares.Size() - i -= size - if _, err := m.DelegatorShares.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - { - size := m.Tokens.Size() - i -= size - if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - if m.Status != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x20 - } - if m.Jailed { - i-- - if m.Jailed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.ConsensusPubkey != nil { - { - size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.OperatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValAddresses) 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 *ValAddresses) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = encodeVarintStaking(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DVPair) 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 *DVPair) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DVPairs) 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 *DVPairs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVPairs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Pairs) > 0 { - for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DVVTriplet) 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 *DVVTriplet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVVTriplet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorDstAddress) > 0 { - i -= len(m.ValidatorDstAddress) - copy(dAtA[i:], m.ValidatorDstAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorDstAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorSrcAddress) > 0 { - i -= len(m.ValidatorSrcAddress) - copy(dAtA[i:], m.ValidatorSrcAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorSrcAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DVVTriplets) 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 *DVVTriplets) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DVVTriplets) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Triplets) > 0 { - for iNdEx := len(m.Triplets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Triplets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Delegation) 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 *Delegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Shares.Size() - i -= size - if _, err := m.Shares.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UnbondingDelegation) 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 *UnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UnbondingDelegationEntry) 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 *UnbondingDelegationEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Balance.Size() - i -= size - if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.InitialBalance.Size() - i -= size - if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintStaking(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0x12 - if m.CreationHeight != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.CreationHeight)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *RedelegationEntry) 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 *RedelegationEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RedelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.SharesDst.Size() - i -= size - if _, err := m.SharesDst.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size := m.InitialBalance.Size() - i -= size - if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err9 != nil { - return 0, err9 - } - i -= n9 - i = encodeVarintStaking(dAtA, i, uint64(n9)) - i-- - dAtA[i] = 0x12 - if m.CreationHeight != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.CreationHeight)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Redelegation) 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 *Redelegation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Redelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.ValidatorDstAddress) > 0 { - i -= len(m.ValidatorDstAddress) - copy(dAtA[i:], m.ValidatorDstAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorDstAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorSrcAddress) > 0 { - i -= len(m.ValidatorSrcAddress) - copy(dAtA[i:], m.ValidatorSrcAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.ValidatorSrcAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintStaking(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.BondDenom) > 0 { - i -= len(m.BondDenom) - copy(dAtA[i:], m.BondDenom) - i = encodeVarintStaking(dAtA, i, uint64(len(m.BondDenom))) - i-- - dAtA[i] = 0x2a - } - if m.HistoricalEntries != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.HistoricalEntries)) - i-- - dAtA[i] = 0x20 - } - if m.MaxEntries != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.MaxEntries)) - i-- - dAtA[i] = 0x18 - } - if m.MaxValidators != 0 { - i = encodeVarintStaking(dAtA, i, uint64(m.MaxValidators)) - i-- - dAtA[i] = 0x10 - } - n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) - if err10 != nil { - return 0, err10 - } - i -= n10 - i = encodeVarintStaking(dAtA, i, uint64(n10)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DelegationResponse) 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 *DelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Balance.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Delegation.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RedelegationEntryResponse) 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 *RedelegationEntryResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RedelegationEntryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Balance.Size() - i -= size - if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - { - size, err := m.RedelegationEntry.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *RedelegationResponse) 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 *RedelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *RedelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Redelegation.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Pool) 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 *Pool) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.BondedTokens.Size() - i -= size - if _, err := m.BondedTokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.NotBondedTokens.Size() - i -= size - if _, err := m.NotBondedTokens.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintStaking(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintStaking(dAtA []byte, offset int, v uint64) int { - offset -= sovStaking(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *HistoricalInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Header.Size() - n += 1 + l + sovStaking(uint64(l)) - if len(m.Valset) > 0 { - for _, e := range m.Valset { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *CommissionRates) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Rate.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.MaxRate.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.MaxChangeRate.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *Commission) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CommissionRates.Size() - n += 1 + l + sovStaking(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime) - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *Description) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Moniker) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.Identity) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.Website) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.SecurityContact) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.Details) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *Validator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.OperatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - if m.ConsensusPubkey != nil { - l = m.ConsensusPubkey.Size() - n += 1 + l + sovStaking(uint64(l)) - } - if m.Jailed { - n += 2 - } - if m.Status != 0 { - n += 1 + sovStaking(uint64(m.Status)) - } - l = m.Tokens.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.DelegatorShares.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Description.Size() - n += 1 + l + sovStaking(uint64(l)) - if m.UnbondingHeight != 0 { - n += 1 + sovStaking(uint64(m.UnbondingHeight)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime) - n += 1 + l + sovStaking(uint64(l)) - l = m.Commission.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.MinSelfDelegation.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *ValAddresses) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, s := range m.Addresses { - l = len(s) - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *DVPair) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *DVPairs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Pairs) > 0 { - for _, e := range m.Pairs { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *DVVTriplet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorDstAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *DVVTriplets) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Triplets) > 0 { - for _, e := range m.Triplets { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *Delegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = m.Shares.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *UnbondingDelegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *UnbondingDelegationEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CreationHeight != 0 { - n += 1 + sovStaking(uint64(m.CreationHeight)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovStaking(uint64(l)) - l = m.InitialBalance.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Balance.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *RedelegationEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CreationHeight != 0 { - n += 1 + sovStaking(uint64(m.CreationHeight)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovStaking(uint64(l)) - l = m.InitialBalance.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.SharesDst.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *Redelegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - l = len(m.ValidatorDstAddress) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) - n += 1 + l + sovStaking(uint64(l)) - if m.MaxValidators != 0 { - n += 1 + sovStaking(uint64(m.MaxValidators)) - } - if m.MaxEntries != 0 { - n += 1 + sovStaking(uint64(m.MaxEntries)) - } - if m.HistoricalEntries != 0 { - n += 1 + sovStaking(uint64(m.HistoricalEntries)) - } - l = len(m.BondDenom) - if l > 0 { - n += 1 + l + sovStaking(uint64(l)) - } - return n -} - -func (m *DelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Delegation.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Balance.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *RedelegationEntryResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.RedelegationEntry.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.Balance.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func (m *RedelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Redelegation.Size() - n += 1 + l + sovStaking(uint64(l)) - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovStaking(uint64(l)) - } - } - return n -} - -func (m *Pool) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.NotBondedTokens.Size() - n += 1 + l + sovStaking(uint64(l)) - l = m.BondedTokens.Size() - n += 1 + l + sovStaking(uint64(l)) - return n -} - -func sovStaking(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozStaking(x uint64) (n int) { - return sovStaking(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ValAddresses) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ValAddresses{`, - `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, - `}`, - }, "") - return s -} -func valueToStringStaking(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *HistoricalInfo) 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 ErrIntOverflowStaking - } - 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: HistoricalInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HistoricalInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Valset", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Valset = append(m.Valset, Validator{}) - if err := m.Valset[len(m.Valset)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommissionRates) 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 ErrIntOverflowStaking - } - 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: CommissionRates: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommissionRates: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxChangeRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MaxChangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Commission) 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 ErrIntOverflowStaking - } - 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: Commission: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Commission: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommissionRates", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CommissionRates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdateTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UpdateTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Description) 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 ErrIntOverflowStaking - } - 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: Description: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Description: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Moniker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Identity = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Website = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SecurityContact = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Details = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Validator) 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 ErrIntOverflowStaking - } - 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: Validator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Validator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsensusPubkey == nil { - m.ConsensusPubkey = &types1.Any{} - } - if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Jailed = bool(v != 0) - case 4: - 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 ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= BondStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorShares", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DelegatorShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingHeight", wireType) - } - m.UnbondingHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.UnbondingHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ValAddresses) 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 ErrIntOverflowStaking - } - 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: ValAddresses: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValAddresses: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DVPair) 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 ErrIntOverflowStaking - } - 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: DVPair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVPair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DVPairs) 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 ErrIntOverflowStaking - } - 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: DVPairs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVPairs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pairs = append(m.Pairs, DVPair{}) - if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DVVTriplet) 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 ErrIntOverflowStaking - } - 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: DVVTriplet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVVTriplet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DVVTriplets) 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 ErrIntOverflowStaking - } - 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: DVVTriplets: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DVVTriplets: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Triplets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Triplets = append(m.Triplets, DVVTriplet{}) - if err := m.Triplets[len(m.Triplets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Delegation) 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 ErrIntOverflowStaking - } - 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: Delegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Delegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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 Shares", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UnbondingDelegation) 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 ErrIntOverflowStaking - } - 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: UnbondingDelegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - 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 Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, UnbondingDelegationEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UnbondingDelegationEntry) 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 ErrIntOverflowStaking - } - 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: UnbondingDelegationEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnbondingDelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) - } - m.CreationHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RedelegationEntry) 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 ErrIntOverflowStaking - } - 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: RedelegationEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RedelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) - } - m.CreationHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CreationHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SharesDst", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.SharesDst.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Redelegation) 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 ErrIntOverflowStaking - } - 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: Redelegation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Redelegation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, RedelegationEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxValidators", wireType) - } - m.MaxValidators = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxValidators |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxEntries", wireType) - } - m.MaxEntries = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxEntries |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) - } - m.HistoricalEntries = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HistoricalEntries |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BondDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DelegationResponse) 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 ErrIntOverflowStaking - } - 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: DelegationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegation", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Delegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RedelegationEntryResponse) 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 ErrIntOverflowStaking - } - 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: RedelegationEntryResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RedelegationEntryResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RedelegationEntry", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RedelegationEntry.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RedelegationResponse) 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 ErrIntOverflowStaking - } - 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: RedelegationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RedelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Redelegation", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Redelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStaking - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, RedelegationEntryResponse{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Pool) 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 ErrIntOverflowStaking - } - 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: Pool: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NotBondedTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.NotBondedTokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BondedTokens", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStaking - } - 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 ErrInvalidLengthStaking - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthStaking - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.BondedTokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStaking(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStaking - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipStaking(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, ErrIntOverflowStaking - } - 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, ErrIntOverflowStaking - } - 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, ErrIntOverflowStaking - } - 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, ErrInvalidLengthStaking - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupStaking - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthStaking - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthStaking = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStaking = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupStaking = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/staking/tx.pb.go b/modules/staking/tx.pb.go deleted file mode 100644 index cd5aa38d..00000000 --- a/modules/staking/tx.pb.go +++ /dev/null @@ -1,2751 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/staking/v1beta1/tx.proto - -package staking - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - _ "github.com/golang/protobuf/ptypes/timestamp" - types "github.com/irisnet/irishub-sdk-go/codec/types" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types1 "github.com/irisnet/irishub-sdk-go/types" - _ "github.com/regen-network/cosmos-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" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgCreateValidator defines a SDK message for creating a new validator. -type MsgCreateValidator struct { - Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` - Commission CommissionRates `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission"` - MinSelfDelegation github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` - DelegatorAddress string `protobuf:"bytes,4,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,5,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` - Pubkey *types.Any `protobuf:"bytes,6,opt,name=pubkey,proto3" json:"pubkey,omitempty"` - Value types1.Coin `protobuf:"bytes,7,opt,name=value,proto3" json:"value"` -} - -func (m *MsgCreateValidator) Reset() { *m = MsgCreateValidator{} } -func (m *MsgCreateValidator) String() string { return proto.CompactTextString(m) } -func (*MsgCreateValidator) ProtoMessage() {} -func (*MsgCreateValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{0} -} -func (m *MsgCreateValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateValidator.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 *MsgCreateValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateValidator.Merge(m, src) -} -func (m *MsgCreateValidator) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateValidator) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateValidator proto.InternalMessageInfo - -// MsgCreateValidatorResponse defines the Msg/CreateValidator response type. -type MsgCreateValidatorResponse struct { -} - -func (m *MsgCreateValidatorResponse) Reset() { *m = MsgCreateValidatorResponse{} } -func (m *MsgCreateValidatorResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateValidatorResponse) ProtoMessage() {} -func (*MsgCreateValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{1} -} -func (m *MsgCreateValidatorResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateValidatorResponse.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 *MsgCreateValidatorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateValidatorResponse.Merge(m, src) -} -func (m *MsgCreateValidatorResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateValidatorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateValidatorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateValidatorResponse proto.InternalMessageInfo - -// MsgEditValidator defines a SDK message for editing an existing validator. -type MsgEditValidator struct { - Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"address"` - // We pass a reference to the new commission rate and min self delegation as - // it's not mandatory to update. If not updated, the deserialized rate will be - // zero with no way to distinguish if an update was intended. - // - // REF: #2373 - CommissionRate *github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=commission_rate,json=commissionRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"commission_rate,omitempty" yaml:"commission_rate"` - MinSelfDelegation *github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,4,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_self_delegation,omitempty" yaml:"min_self_delegation"` -} - -func (m *MsgEditValidator) Reset() { *m = MsgEditValidator{} } -func (m *MsgEditValidator) String() string { return proto.CompactTextString(m) } -func (*MsgEditValidator) ProtoMessage() {} -func (*MsgEditValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{2} -} -func (m *MsgEditValidator) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEditValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEditValidator.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 *MsgEditValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEditValidator.Merge(m, src) -} -func (m *MsgEditValidator) XXX_Size() int { - return m.Size() -} -func (m *MsgEditValidator) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEditValidator.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEditValidator proto.InternalMessageInfo - -// MsgEditValidatorResponse defines the Msg/EditValidator response type. -type MsgEditValidatorResponse struct { -} - -func (m *MsgEditValidatorResponse) Reset() { *m = MsgEditValidatorResponse{} } -func (m *MsgEditValidatorResponse) String() string { return proto.CompactTextString(m) } -func (*MsgEditValidatorResponse) ProtoMessage() {} -func (*MsgEditValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{3} -} -func (m *MsgEditValidatorResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEditValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEditValidatorResponse.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 *MsgEditValidatorResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEditValidatorResponse.Merge(m, src) -} -func (m *MsgEditValidatorResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgEditValidatorResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEditValidatorResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEditValidatorResponse proto.InternalMessageInfo - -// MsgDelegate defines a SDK message for performing a delegation of coins -// from a delegator to a validator. -type MsgDelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` - Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` -} - -func (m *MsgDelegate) Reset() { *m = MsgDelegate{} } -func (m *MsgDelegate) String() string { return proto.CompactTextString(m) } -func (*MsgDelegate) ProtoMessage() {} -func (*MsgDelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{4} -} -func (m *MsgDelegate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDelegate.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 *MsgDelegate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegate.Merge(m, src) -} -func (m *MsgDelegate) XXX_Size() int { - return m.Size() -} -func (m *MsgDelegate) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegate.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDelegate proto.InternalMessageInfo - -// MsgDelegateResponse defines the Msg/Delegate response type. -type MsgDelegateResponse struct { -} - -func (m *MsgDelegateResponse) Reset() { *m = MsgDelegateResponse{} } -func (m *MsgDelegateResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateResponse) ProtoMessage() {} -func (*MsgDelegateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{5} -} -func (m *MsgDelegateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDelegateResponse.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 *MsgDelegateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateResponse.Merge(m, src) -} -func (m *MsgDelegateResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgDelegateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDelegateResponse proto.InternalMessageInfo - -// MsgBeginRedelegate defines a SDK message for performing a redelegation -// of coins from a delegator and source validator to a destination validator. -type MsgBeginRedelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorSrcAddress string `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3" json:"validator_src_address,omitempty" yaml:"validator_src_address"` - ValidatorDstAddress string `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` - Amount types1.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` -} - -func (m *MsgBeginRedelegate) Reset() { *m = MsgBeginRedelegate{} } -func (m *MsgBeginRedelegate) String() string { return proto.CompactTextString(m) } -func (*MsgBeginRedelegate) ProtoMessage() {} -func (*MsgBeginRedelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{6} -} -func (m *MsgBeginRedelegate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBeginRedelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBeginRedelegate.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 *MsgBeginRedelegate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBeginRedelegate.Merge(m, src) -} -func (m *MsgBeginRedelegate) XXX_Size() int { - return m.Size() -} -func (m *MsgBeginRedelegate) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBeginRedelegate.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBeginRedelegate proto.InternalMessageInfo - -// MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. -type MsgBeginRedelegateResponse struct { - CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` -} - -func (m *MsgBeginRedelegateResponse) Reset() { *m = MsgBeginRedelegateResponse{} } -func (m *MsgBeginRedelegateResponse) String() string { return proto.CompactTextString(m) } -func (*MsgBeginRedelegateResponse) ProtoMessage() {} -func (*MsgBeginRedelegateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{7} -} -func (m *MsgBeginRedelegateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgBeginRedelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgBeginRedelegateResponse.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 *MsgBeginRedelegateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgBeginRedelegateResponse.Merge(m, src) -} -func (m *MsgBeginRedelegateResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgBeginRedelegateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgBeginRedelegateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgBeginRedelegateResponse proto.InternalMessageInfo - -func (m *MsgBeginRedelegateResponse) GetCompletionTime() time.Time { - if m != nil { - return m.CompletionTime - } - return time.Time{} -} - -// MsgUndelegate defines a SDK message for performing an undelegation from a -// delegate and a validator. -type MsgUndelegate struct { - DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty" yaml:"validator_address"` - Amount types1.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` -} - -func (m *MsgUndelegate) Reset() { *m = MsgUndelegate{} } -func (m *MsgUndelegate) String() string { return proto.CompactTextString(m) } -func (*MsgUndelegate) ProtoMessage() {} -func (*MsgUndelegate) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{8} -} -func (m *MsgUndelegate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUndelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUndelegate.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 *MsgUndelegate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUndelegate.Merge(m, src) -} -func (m *MsgUndelegate) XXX_Size() int { - return m.Size() -} -func (m *MsgUndelegate) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUndelegate.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUndelegate proto.InternalMessageInfo - -// MsgUndelegateResponse defines the Msg/Undelegate response type. -type MsgUndelegateResponse struct { - CompletionTime time.Time `protobuf:"bytes,1,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time"` -} - -func (m *MsgUndelegateResponse) Reset() { *m = MsgUndelegateResponse{} } -func (m *MsgUndelegateResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUndelegateResponse) ProtoMessage() {} -func (*MsgUndelegateResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_0926ef28816b35ab, []int{9} -} -func (m *MsgUndelegateResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUndelegateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUndelegateResponse.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 *MsgUndelegateResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUndelegateResponse.Merge(m, src) -} -func (m *MsgUndelegateResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUndelegateResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUndelegateResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUndelegateResponse proto.InternalMessageInfo - -func (m *MsgUndelegateResponse) GetCompletionTime() time.Time { - if m != nil { - return m.CompletionTime - } - return time.Time{} -} - -func init() { - proto.RegisterType((*MsgCreateValidator)(nil), "cosmos.staking.v1beta1.MsgCreateValidator") - proto.RegisterType((*MsgCreateValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgCreateValidatorResponse") - proto.RegisterType((*MsgEditValidator)(nil), "cosmos.staking.v1beta1.MsgEditValidator") - proto.RegisterType((*MsgEditValidatorResponse)(nil), "cosmos.staking.v1beta1.MsgEditValidatorResponse") - proto.RegisterType((*MsgDelegate)(nil), "cosmos.staking.v1beta1.MsgDelegate") - proto.RegisterType((*MsgDelegateResponse)(nil), "cosmos.staking.v1beta1.MsgDelegateResponse") - proto.RegisterType((*MsgBeginRedelegate)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegate") - proto.RegisterType((*MsgBeginRedelegateResponse)(nil), "cosmos.staking.v1beta1.MsgBeginRedelegateResponse") - proto.RegisterType((*MsgUndelegate)(nil), "cosmos.staking.v1beta1.MsgUndelegate") - proto.RegisterType((*MsgUndelegateResponse)(nil), "cosmos.staking.v1beta1.MsgUndelegateResponse") -} - -func init() { proto.RegisterFile("cosmos/staking/v1beta1/tx.proto", fileDescriptor_0926ef28816b35ab) } - -var fileDescriptor_0926ef28816b35ab = []byte{ - // 873 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcf, 0x6b, 0xe3, 0x46, - 0x14, 0xb6, 0x6c, 0xaf, 0x9b, 0x4e, 0xd8, 0x4d, 0x56, 0x49, 0x16, 0x47, 0x04, 0x2b, 0x68, 0x5b, - 0x1a, 0xba, 0x58, 0x6a, 0x52, 0x4a, 0x61, 0x2f, 0x25, 0x8e, 0x5b, 0x08, 0x41, 0xd0, 0x2a, 0x69, - 0x0f, 0xa5, 0x60, 0xf4, 0x63, 0xac, 0x08, 0x4b, 0x1a, 0x45, 0x33, 0x0a, 0xf5, 0xa1, 0x87, 0xde, - 0x7a, 0xcc, 0xb9, 0x50, 0xc8, 0x1f, 0xd1, 0x3f, 0x22, 0xf4, 0x50, 0x02, 0xbd, 0x94, 0x1e, 0xdc, - 0x92, 0x40, 0xc9, 0xd9, 0x7f, 0x41, 0xd1, 0x68, 0x24, 0xcb, 0xf2, 0x8f, 0xba, 0xa1, 0xbe, 0xec, - 0xc9, 0x66, 0xe6, 0x9b, 0xef, 0xcd, 0xfb, 0xde, 0xf7, 0xde, 0x08, 0x88, 0x26, 0xc2, 0x1e, 0xc2, - 0x0a, 0x26, 0x7a, 0xcf, 0xf1, 0x6d, 0xe5, 0x72, 0xdf, 0x80, 0x44, 0xdf, 0x57, 0xc8, 0xb7, 0x72, - 0x10, 0x22, 0x82, 0xf8, 0x17, 0x09, 0x40, 0x66, 0x00, 0x99, 0x01, 0x84, 0x6d, 0x1b, 0x21, 0xdb, - 0x85, 0x0a, 0x45, 0x19, 0x51, 0x57, 0xd1, 0xfd, 0x7e, 0x72, 0x44, 0x10, 0x8b, 0x5b, 0xc4, 0xf1, - 0x20, 0x26, 0xba, 0x17, 0x30, 0xc0, 0xa6, 0x8d, 0x6c, 0x44, 0xff, 0x2a, 0xf1, 0x3f, 0xb6, 0xba, - 0x9d, 0x44, 0xea, 0x24, 0x1b, 0x2c, 0x6c, 0xb2, 0xd5, 0x60, 0xb7, 0x34, 0x74, 0x0c, 0xb3, 0x2b, - 0x9a, 0xc8, 0xf1, 0xd9, 0xfe, 0x3b, 0x33, 0xb2, 0x48, 0x2f, 0x4d, 0x51, 0xd2, 0x6f, 0x55, 0xc0, - 0xab, 0xd8, 0x3e, 0x0a, 0xa1, 0x4e, 0xe0, 0x57, 0xba, 0xeb, 0x58, 0x3a, 0x41, 0x21, 0x7f, 0x02, - 0x56, 0x2d, 0x88, 0xcd, 0xd0, 0x09, 0x88, 0x83, 0xfc, 0x3a, 0xb7, 0xcb, 0xed, 0xad, 0x1e, 0xbc, - 0x94, 0xa7, 0xe7, 0x2d, 0xb7, 0x47, 0xd0, 0x56, 0xf5, 0x66, 0x20, 0x96, 0xb4, 0xfc, 0x69, 0x5e, - 0x05, 0xc0, 0x44, 0x9e, 0xe7, 0x60, 0x1c, 0x73, 0x95, 0x29, 0xd7, 0x7b, 0xb3, 0xb8, 0x8e, 0x32, - 0xa4, 0xa6, 0x13, 0x88, 0x19, 0x5f, 0x8e, 0x80, 0xff, 0x9e, 0x03, 0x1b, 0x9e, 0xe3, 0x77, 0x30, - 0x74, 0xbb, 0x1d, 0x0b, 0xba, 0xd0, 0xd6, 0xe9, 0x25, 0x2b, 0xbb, 0xdc, 0xde, 0xdb, 0xad, 0x2f, - 0x62, 0xfc, 0x1f, 0x03, 0xf1, 0x95, 0xed, 0x90, 0xf3, 0xc8, 0x90, 0x4d, 0xe4, 0x29, 0x4e, 0xe8, - 0x60, 0x1f, 0x12, 0xfa, 0x7b, 0x1e, 0x19, 0x4d, 0x6c, 0xf5, 0x9a, 0x36, 0x52, 0x48, 0x3f, 0x80, - 0x58, 0x3e, 0xf6, 0xc9, 0x70, 0x20, 0x0a, 0x7d, 0xdd, 0x73, 0x5f, 0x4b, 0x53, 0x78, 0x25, 0xed, - 0xb9, 0xe7, 0xf8, 0xa7, 0xd0, 0xed, 0xb6, 0xb3, 0x35, 0xfe, 0x18, 0x3c, 0x67, 0x08, 0x14, 0x76, - 0x74, 0xcb, 0x0a, 0x21, 0xc6, 0xf5, 0x2a, 0xbd, 0xc0, 0xce, 0x70, 0x20, 0xd6, 0x13, 0xb6, 0x09, - 0x88, 0xa4, 0xad, 0x67, 0x6b, 0x87, 0xc9, 0x52, 0x4c, 0x75, 0x99, 0xea, 0x9e, 0x51, 0x3d, 0x29, - 0x52, 0x4d, 0x40, 0x24, 0x6d, 0x3d, 0x5b, 0x4b, 0xa9, 0x3e, 0x03, 0xb5, 0x20, 0x32, 0x7a, 0xb0, - 0x5f, 0xaf, 0x51, 0x91, 0x37, 0xe5, 0xc4, 0x75, 0x72, 0xea, 0x3a, 0xf9, 0xd0, 0xef, 0xb7, 0xea, - 0xbf, 0xfc, 0xdc, 0xdc, 0x64, 0xea, 0x9b, 0x61, 0x3f, 0x20, 0x48, 0xfe, 0x3c, 0x32, 0x4e, 0x60, - 0x5f, 0x63, 0xa7, 0xf9, 0x8f, 0xc0, 0x93, 0x4b, 0xdd, 0x8d, 0x60, 0xfd, 0x2d, 0x4a, 0xb3, 0x9d, - 0xd6, 0x2a, 0xb6, 0x5a, 0xae, 0x50, 0x4e, 0x5a, 0xed, 0x04, 0xfd, 0x7a, 0xe5, 0x87, 0x6b, 0xb1, - 0xf4, 0x70, 0x2d, 0x96, 0xa4, 0x1d, 0x20, 0x4c, 0x9a, 0x4a, 0x83, 0x38, 0x40, 0x3e, 0x86, 0xd2, - 0x4f, 0x15, 0xb0, 0xae, 0x62, 0xfb, 0x53, 0xcb, 0x21, 0x4b, 0x72, 0xdc, 0x27, 0xd3, 0x34, 0x2d, - 0x53, 0x4d, 0xf9, 0xe1, 0x40, 0x7c, 0x96, 0x68, 0x3a, 0x47, 0xc9, 0x10, 0xac, 0x8d, 0x1c, 0xd7, - 0x09, 0x75, 0x02, 0x99, 0xbd, 0x8e, 0xff, 0x8b, 0xb5, 0xda, 0xd0, 0x1c, 0x0e, 0xc4, 0x17, 0x49, - 0xb4, 0x02, 0x9f, 0xa4, 0x3d, 0x33, 0xc7, 0xac, 0xce, 0x7f, 0x37, 0xdd, 0xd6, 0x89, 0xab, 0xd4, - 0x65, 0x5b, 0x3a, 0x57, 0x3d, 0x01, 0xd4, 0x8b, 0xe5, 0xc9, 0x6a, 0xf7, 0x37, 0x07, 0x56, 0x55, - 0x6c, 0xb3, 0x73, 0x70, 0x7a, 0x23, 0x70, 0xff, 0x5f, 0x23, 0x94, 0x1f, 0xd5, 0x08, 0x1f, 0x83, - 0x9a, 0xee, 0xa1, 0xc8, 0x27, 0xb4, 0x6a, 0x0b, 0x38, 0x98, 0xc1, 0x73, 0x22, 0x6c, 0x81, 0x8d, - 0x5c, 0x9e, 0x59, 0xfe, 0xbf, 0x96, 0xe9, 0xbc, 0x6c, 0x41, 0xdb, 0xf1, 0x35, 0x68, 0x2d, 0x41, - 0x86, 0x33, 0xb0, 0x35, 0xca, 0x11, 0x87, 0x66, 0x41, 0x8a, 0xdd, 0xe1, 0x40, 0xdc, 0x29, 0x4a, - 0x91, 0x83, 0x49, 0xda, 0x46, 0xb6, 0x7e, 0x1a, 0x9a, 0x53, 0x59, 0x2d, 0x4c, 0x32, 0xd6, 0xca, - 0x6c, 0xd6, 0x1c, 0x2c, 0xcf, 0xda, 0xc6, 0x64, 0x52, 0xe7, 0xea, 0x63, 0x75, 0xee, 0xd1, 0x51, - 0x51, 0xd0, 0x33, 0x95, 0x9b, 0x57, 0x69, 0x1f, 0x06, 0x2e, 0x8c, 0x2d, 0xda, 0x89, 0xdf, 0x4c, - 0x36, 0x19, 0x84, 0x89, 0xd1, 0x76, 0x96, 0x3e, 0xa8, 0xad, 0x95, 0x38, 0xd4, 0xd5, 0x9f, 0x22, - 0x47, 0x5b, 0x8c, 0x1d, 0x8e, 0xb7, 0xa5, 0x07, 0x0e, 0x3c, 0x55, 0xb1, 0xfd, 0xa5, 0x6f, 0xbd, - 0xf1, 0xfe, 0xed, 0x82, 0xad, 0xb1, 0x4c, 0x97, 0x24, 0xe9, 0xc1, 0x8f, 0x55, 0x50, 0x51, 0xb1, - 0xcd, 0x5f, 0x80, 0xb5, 0xe2, 0x47, 0xc4, 0xfb, 0xb3, 0xa6, 0xf7, 0xe4, 0xdb, 0x20, 0x1c, 0x2c, - 0x8e, 0xcd, 0x32, 0xe9, 0x81, 0xa7, 0xe3, 0x6f, 0xc8, 0xde, 0x1c, 0x92, 0x31, 0xa4, 0xf0, 0xc1, - 0xa2, 0xc8, 0x2c, 0xd8, 0x37, 0x60, 0x25, 0x1b, 0x7a, 0x2f, 0xe7, 0x9c, 0x4e, 0x41, 0xc2, 0xab, - 0x05, 0x40, 0x19, 0xfb, 0x05, 0x58, 0x2b, 0x8e, 0x94, 0x79, 0xea, 0x15, 0xb0, 0x73, 0xd5, 0x9b, - 0xd5, 0x5a, 0x06, 0x00, 0xb9, 0x3e, 0x78, 0x77, 0x0e, 0xc3, 0x08, 0x26, 0x34, 0x17, 0x82, 0xa5, - 0x31, 0x5a, 0x27, 0x37, 0x77, 0x0d, 0xee, 0xf6, 0xae, 0xc1, 0xfd, 0x75, 0xd7, 0xe0, 0xae, 0xee, - 0x1b, 0xa5, 0xdb, 0xfb, 0x46, 0xe9, 0xf7, 0xfb, 0x46, 0xe9, 0xeb, 0xfd, 0x7f, 0x7f, 0xcb, 0x3c, - 0x64, 0x45, 0x2e, 0xcc, 0x3e, 0x60, 0x8d, 0x1a, 0xf5, 0xe5, 0x87, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0xcc, 0xe2, 0x49, 0x82, 0x9f, 0x0b, 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 { - // CreateValidator defines a method for creating a new validator. - CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) - // EditValidator defines a method for editing an existing validator. - EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) - // BeginRedelegate defines a method for performing a redelegation - // of coins from a delegator and source validator to a destination validator. - BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) - // Undelegate defines a method for performing an undelegation from a - // delegate and a validator. - Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateValidator(ctx context.Context, in *MsgCreateValidator, opts ...grpc.CallOption) (*MsgCreateValidatorResponse, error) { - out := new(MsgCreateValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/CreateValidator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) EditValidator(ctx context.Context, in *MsgEditValidator, opts ...grpc.CallOption) (*MsgEditValidatorResponse, error) { - out := new(MsgEditValidatorResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/EditValidator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Delegate(ctx context.Context, in *MsgDelegate, opts ...grpc.CallOption) (*MsgDelegateResponse, error) { - out := new(MsgDelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Delegate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) BeginRedelegate(ctx context.Context, in *MsgBeginRedelegate, opts ...grpc.CallOption) (*MsgBeginRedelegateResponse, error) { - out := new(MsgBeginRedelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/BeginRedelegate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Undelegate(ctx context.Context, in *MsgUndelegate, opts ...grpc.CallOption) (*MsgUndelegateResponse, error) { - out := new(MsgUndelegateResponse) - err := c.cc.Invoke(ctx, "/cosmos.staking.v1beta1.Msg/Undelegate", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateValidator defines a method for creating a new validator. - CreateValidator(context.Context, *MsgCreateValidator) (*MsgCreateValidatorResponse, error) - // EditValidator defines a method for editing an existing validator. - EditValidator(context.Context, *MsgEditValidator) (*MsgEditValidatorResponse, error) - // Delegate defines a method for performing a delegation of coins - // from a delegator to a validator. - Delegate(context.Context, *MsgDelegate) (*MsgDelegateResponse, error) - // BeginRedelegate defines a method for performing a redelegation - // of coins from a delegator and source validator to a destination validator. - BeginRedelegate(context.Context, *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) - // Undelegate defines a method for performing an undelegation from a - // delegate and a validator. - Undelegate(context.Context, *MsgUndelegate) (*MsgUndelegateResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateValidator(ctx context.Context, req *MsgCreateValidator) (*MsgCreateValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateValidator not implemented") -} -func (*UnimplementedMsgServer) EditValidator(ctx context.Context, req *MsgEditValidator) (*MsgEditValidatorResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EditValidator not implemented") -} -func (*UnimplementedMsgServer) Delegate(ctx context.Context, req *MsgDelegate) (*MsgDelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delegate not implemented") -} -func (*UnimplementedMsgServer) BeginRedelegate(ctx context.Context, req *MsgBeginRedelegate) (*MsgBeginRedelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method BeginRedelegate not implemented") -} -func (*UnimplementedMsgServer) Undelegate(ctx context.Context, req *MsgUndelegate) (*MsgUndelegateResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Undelegate not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateValidator) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateValidator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/CreateValidator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateValidator(ctx, req.(*MsgCreateValidator)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_EditValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgEditValidator) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).EditValidator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/EditValidator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).EditValidator(ctx, req.(*MsgEditValidator)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Delegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Delegate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/Delegate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Delegate(ctx, req.(*MsgDelegate)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_BeginRedelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgBeginRedelegate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).BeginRedelegate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/BeginRedelegate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).BeginRedelegate(ctx, req.(*MsgBeginRedelegate)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Undelegate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUndelegate) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Undelegate(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.staking.v1beta1.Msg/Undelegate", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Undelegate(ctx, req.(*MsgUndelegate)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.staking.v1beta1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateValidator", - Handler: _Msg_CreateValidator_Handler, - }, - { - MethodName: "EditValidator", - Handler: _Msg_EditValidator_Handler, - }, - { - MethodName: "Delegate", - Handler: _Msg_Delegate_Handler, - }, - { - MethodName: "BeginRedelegate", - Handler: _Msg_BeginRedelegate_Handler, - }, - { - MethodName: "Undelegate", - Handler: _Msg_Undelegate_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/staking/v1beta1/tx.proto", -} - -func (m *MsgCreateValidator) 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 *MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - if m.Pubkey != nil { - { - size, err := m.Pubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x2a - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0x22 - } - { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgCreateValidatorResponse) 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 *MsgCreateValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgEditValidator) 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 *MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MinSelfDelegation != nil { - { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.CommissionRate != nil { - { - size := m.CommissionRate.Size() - i -= size - if _, err := m.CommissionRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgEditValidatorResponse) 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 *MsgEditValidatorResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditValidatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgDelegate) 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 *MsgDelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgDelegateResponse) 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 *MsgDelegateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgDelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgBeginRedelegate) 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 *MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - if len(m.ValidatorDstAddress) > 0 { - i -= len(m.ValidatorDstAddress) - copy(dAtA[i:], m.ValidatorDstAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorDstAddress))) - i-- - dAtA[i] = 0x1a - } - if len(m.ValidatorSrcAddress) > 0 { - i -= len(m.ValidatorSrcAddress) - copy(dAtA[i:], m.ValidatorSrcAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorSrcAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgBeginRedelegateResponse) 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 *MsgBeginRedelegateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgBeginRedelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err8 != nil { - return 0, err8 - } - i -= n8 - i = encodeVarintTx(dAtA, i, uint64(n8)) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgUndelegate) 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 *MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if len(m.ValidatorAddress) > 0 { - i -= len(m.ValidatorAddress) - copy(dAtA[i:], m.ValidatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.DelegatorAddress) > 0 { - i -= len(m.DelegatorAddress) - copy(dAtA[i:], m.DelegatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DelegatorAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUndelegateResponse) 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 *MsgUndelegateResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUndelegateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err10 != nil { - return 0, err10 - } - i -= n10 - i = encodeVarintTx(dAtA, i, uint64(n10)) - i-- - dAtA[i] = 0xa - 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 *MsgCreateValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Description.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Commission.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.MinSelfDelegation.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Pubkey != nil { - l = m.Pubkey.Size() - n += 1 + l + sovTx(uint64(l)) - } - l = m.Value.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgCreateValidatorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgEditValidator) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Description.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.CommissionRate != nil { - l = m.CommissionRate.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.MinSelfDelegation != nil { - l = m.MinSelfDelegation.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgEditValidatorResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgDelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgDelegateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgBeginRedelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorDstAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgBeginRedelegateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUndelegate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUndelegateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovTx(uint64(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 *MsgCreateValidator) 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: MsgCreateValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Commission", 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.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", 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 - } - if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pubkey == nil { - m.Pubkey = &types.Any{} - } - if err := m.Pubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", 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.Value.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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateValidatorResponse) 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: MsgCreateValidatorResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateValidatorResponse: 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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgEditValidator) 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: MsgEditValidator: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditValidator: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", 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.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", 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 - } - var v github_com_irisnet_irishub_sdk_go_types.Dec - m.CommissionRate = &v - if err := m.CommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", 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 - } - var v github_com_irisnet_irishub_sdk_go_types.Int - m.MinSelfDelegation = &v - if err := m.MinSelfDelegation.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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgEditValidatorResponse) 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: MsgEditValidatorResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditValidatorResponse: 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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDelegate) 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: MsgDelegate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDelegateResponse) 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: MsgDelegateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateResponse: 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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBeginRedelegate) 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: MsgBeginRedelegate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", 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.ValidatorSrcAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", 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.ValidatorDstAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgBeginRedelegateResponse) 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: MsgBeginRedelegateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBeginRedelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, 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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUndelegate) 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: MsgUndelegate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.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 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUndelegateResponse) 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: MsgUndelegateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUndelegateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", 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 := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, 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 { - return ErrInvalidLengthTx - } - if (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/modules/staking/types.go b/modules/staking/types.go deleted file mode 100644 index e1590047..00000000 --- a/modules/staking/types.go +++ /dev/null @@ -1,517 +0,0 @@ -package staking - -import ( - "bytes" - - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/irisnet/irishub-sdk-go/codec" - codectypes "github.com/irisnet/irishub-sdk-go/codec/types" - crypto "github.com/irisnet/irishub-sdk-go/crypto/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "staking" -) - -var ( - _ sdk.Msg = &MsgCreateValidator{} - _ codectypes.UnpackInterfacesMessage = (*MsgCreateValidator)(nil) - _ sdk.Msg = &MsgCreateValidator{} - _ sdk.Msg = &MsgEditValidator{} - _ sdk.Msg = &MsgDelegate{} - _ sdk.Msg = &MsgUndelegate{} - _ sdk.Msg = &MsgBeginRedelegate{} -) - -// DelegationI delegation bond for a delegated proof of stake system -type DelegationI interface { - GetDelegatorAddr() sdk.AccAddress // delegator sdk.AccAddress for the bond - GetValidatorAddr() sdk.ValAddress // validator operator address - GetShares() sdk.Dec // amount of validator's shares held in this delegation -} - -// ValidatorI expected validator functions -type ValidatorI interface { - IsJailed() bool // whether the validator is jailed - GetMoniker() string // moniker of the validator - GetStatus() BondStatus // status of the validator - IsBonded() bool // check if has a bonded status - IsUnbonded() bool // check if has status unbonded - IsUnbonding() bool // check if has status unbonding - GetOperator() sdk.ValAddress // operator address to receive/return validators coins - TmConsPubKey() (crypto.PubKey, error) // validation consensus pubkey - GetConsAddr() (sdk.ConsAddress, error) // validation consensus address - GetTokens() sdk.Int // validation tokens - GetBondedTokens() sdk.Int // validator bonded tokens - GetConsensusPower() int64 // validation power in tendermint - GetCommission() sdk.Dec // validator commission rate - GetMinSelfDelegation() sdk.Int // validator minimum self delegation - GetDelegatorShares() sdk.Dec // total outstanding delegator shares - TokensFromShares(sdk.Dec) sdk.Dec // token worth of provided delegator shares - TokensFromSharesTruncated(sdk.Dec) sdk.Dec // token worth of provided delegator shares, truncated - TokensFromSharesRoundUp(sdk.Dec) sdk.Dec // token worth of provided delegator shares, rounded up - SharesFromTokens(amt sdk.Int) (sdk.Dec, error) // shares worth of delegator's bond - SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, error) // truncated shares worth of delegator's bond -} - -func (msg MsgCreateValidator) Route() string { return ModuleName } - -func (msg MsgCreateValidator) Type() string { return "create_validator" } - -func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress { - // delegator is first signer so delegator pays fees - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) - if err != nil { - panic(err) - } - addrs := []sdk.AccAddress{delAddr} - addr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) - if err != nil { - panic(err) - } - if !bytes.Equal(delAddr.Bytes(), addr.Bytes()) { - addrs = append(addrs, sdk.AccAddress(addr)) - } - - return addrs -} - -func (msg MsgCreateValidator) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgCreateValidator) ValidateBasic() error { - // note that unmarshaling from bech32 ensures either empty or valid - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) - if err != nil { - return err - } - if delAddr.Empty() { - return sdk.Wrapf("missing delegatorAddr") - } - - if msg.ValidatorAddress == "" { - return sdk.Wrapf("missing validatorAddr") - } - - valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) - if err != nil { - return sdk.Wrap(err) - } - if !sdk.AccAddress(valAddr).Equals(delAddr) { - return sdk.Wrapf("validatorAddr must equal delegatorAddr, validatorAddr:[%s], delegatorAddr:[%s]", valAddr, delAddr) - } - - if msg.Pubkey == nil { - return sdk.Wrapf("missing validatorPubKey") - } - - if msg.Description == (Description{}) { - return sdk.Wrapf("missing description") - } - - if msg.Commission == (CommissionRates{}) { - return sdk.Wrapf("missing commission") - } - - if !msg.MinSelfDelegation.IsPositive() { - return sdk.Wrapf("minSelfDelegation isn't positive") - } - - return nil -} - -func (msg MsgCreateValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - var pubKey crypto.PubKey - return unpacker.UnpackAny(msg.Pubkey, &pubKey) -} - -func (msg MsgEditValidator) Route() string { return ModuleName } - -func (msg MsgEditValidator) Type() string { return "edit_validator" } - -func (msg MsgEditValidator) GetSigners() []sdk.AccAddress { - valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{valAddr.Bytes()} -} - -func (msg MsgEditValidator) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgEditValidator) ValidateBasic() error { - if msg.ValidatorAddress == "" { - return sdk.Wrapf("missing validatorAddress") - } - - if msg.Description == (Description{}) { - return sdk.Wrapf("missing description") - } - - if msg.MinSelfDelegation != nil && !msg.MinSelfDelegation.IsPositive() { - return sdk.Wrapf("minSelfDelegation isn't positive") - } - - return nil -} - -func (msg MsgDelegate) Route() string { return ModuleName } - -func (msg MsgDelegate) Type() string { return "delegate" } - -func (msg MsgDelegate) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{delAddr} -} - -func (msg MsgDelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgDelegate) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return sdk.Wrapf("missing delegatorAddress") - } - - if msg.ValidatorAddress == "" { - return sdk.Wrapf("missing errEmptyValidatorAddr") - } - - if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { - return sdk.Wrapf("amount isn't positive or valid") - } - - return nil -} - -func (msg MsgBeginRedelegate) Route() string { return ModuleName } - -func (msg MsgBeginRedelegate) Type() string { return "begin_redelegate" } - -func (msg MsgBeginRedelegate) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{delAddr} -} - -func (msg MsgBeginRedelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgBeginRedelegate) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return sdk.Wrapf("missing delegatorAddress") - } - - if msg.ValidatorSrcAddress == "" { - return sdk.Wrapf("missing validatorSrcAddress") - } - - if msg.ValidatorDstAddress == "" { - return sdk.Wrapf("missing validatorDstAddress") - } - - if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { - return sdk.Wrapf("amount isn't positive or valid") - } - - return nil -} - -func (msg MsgUndelegate) Route() string { return ModuleName } - -func (msg MsgUndelegate) Type() string { return "begin_unbonding" } - -func (msg MsgUndelegate) GetSigners() []sdk.AccAddress { - delAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{delAddr} -} - -func (msg MsgUndelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&msg) - return sdk.MustSortJSON(bz) -} - -func (msg MsgUndelegate) ValidateBasic() error { - if msg.DelegatorAddress == "" { - return sdk.Wrapf("missing delegatorAddr") - } - - if msg.ValidatorAddress == "" { - return sdk.Wrapf("missing validatorAddress") - } - - if !msg.Amount.IsValid() || !msg.Amount.Amount.IsPositive() { - return sdk.Wrapf("amount isn't positive or valid") - } - - return nil -} - -func (q QueryValidatorsResponse) Convert(cdc codec.Marshaler) interface{} { - var validatorResps []QueryValidatorResp - for _, v := range q.Validators { - validatorResps = append(validatorResps, v.Convert(cdc).(QueryValidatorResp)) - } - - return QueryValidatorsResp{ - Validators: validatorResps, - Total: q.Pagination.Total, - } -} - -func (v Validator) Convert(cdc codec.Marshaler) interface{} { - pubKey, _ := v.GetPubKey(cdc) - return QueryValidatorResp{ - OperatorAddress: v.OperatorAddress, - ConsensusPubkey: pubKey.String(), - Jailed: v.Jailed, - Status: BondStatus_name[int32(v.Status)], - Tokens: v.Tokens, - DelegatorShares: v.DelegatorShares, - Description: description{ - Moniker: v.Description.Moniker, - Identity: v.Description.Identity, - Website: v.Description.Website, - SecurityContact: v.Description.SecurityContact, - Details: v.Description.Details, - }, - UnbondingHeight: v.UnbondingHeight, - UnbondingTime: v.UnbondingTime, - Commission: commission{ - commissionRates: commissionRates{ - Rate: v.Commission.Rate, - MaxRate: v.Commission.MaxRate, - MaxChangeRate: v.Commission.MaxChangeRate, - }, - UpdateTime: v.Commission.UpdateTime, - }, - MinSelfDelegation: v.MinSelfDelegation, - } -} - -// GetPubKey - Implements Validator. -func (v Validator) GetPubKey(unpacker codectypes.AnyUnpacker) (pk crypto.PubKey, err error) { - if v.ConsensusPubkey == nil { - return nil, nil - } - - var pubKey crypto.PubKey - if err = unpacker.UnpackAny(v.ConsensusPubkey, &pubKey); err != nil { - return nil, err - } - return pubKey, nil -} - -func (q QueryValidatorDelegationsResponse) Convert() interface{} { - var delegationResps []QueryDelegationResp - for _, v := range q.DelegationResponses { - delegationResps = append(delegationResps, v.Convert().(QueryDelegationResp)) - } - - return QueryValidatorDelegationsResp{ - DelegationResponses: delegationResps, - Total: q.Pagination.Total, - } -} - -func (d DelegationResponse) Convert() interface{} { - return QueryDelegationResp{ - Delegation: delegation{ - DelegatorAddress: d.Delegation.DelegatorAddress, - ValidatorAddress: d.Delegation.ValidatorAddress, - Shares: d.Delegation.Shares, - }, - Balance: sdk.Coin{ - Denom: d.Balance.Denom, - Amount: d.Balance.Amount, - }, - } -} - -func (q QueryValidatorUnbondingDelegationsResponse) Convert() interface{} { - var unbondingDelegations []QueryUnbondingDelegationResp - for _, v := range q.UnbondingResponses { - unbondingDelegations = append(unbondingDelegations, v.Convert().(QueryUnbondingDelegationResp)) - } - - return QueryValidatorUnbondingDelegationsResp{ - UnbondingResponses: unbondingDelegations, - Total: q.Pagination.Total, - } -} - -func (u UnbondingDelegation) Convert() interface{} { - var entries []unbondingDelegationEntry - for _, v := range u.Entries { - entries = append(entries, v.Convert().(unbondingDelegationEntry)) - } - - return QueryUnbondingDelegationResp{ - DelegatorAddress: u.DelegatorAddress, - ValidatorAddress: u.ValidatorAddress, - Entries: entries, - } -} - -func (u UnbondingDelegationEntry) Convert() interface{} { - return unbondingDelegationEntry{ - CreationHeight: u.CreationHeight, - CompletionTime: u.CompletionTime, - InitialBalance: u.InitialBalance, - Balance: u.Balance, - } -} - -func (q QueryDelegatorDelegationsResponse) Convert() interface{} { - var delegationResps []QueryDelegationResp - for _, v := range q.DelegationResponses { - delegationResps = append(delegationResps, v.Convert().(QueryDelegationResp)) - } - - return QueryDelegatorDelegationsResp{ - DelegationResponses: delegationResps, - Total: 0, - } -} - -func (q QueryDelegatorUnbondingDelegationsResponse) Convert() interface{} { - var unbondingDelegations []QueryUnbondingDelegationResp - for _, v := range q.UnbondingResponses { - unbondingDelegations = append(unbondingDelegations, v.Convert().(QueryUnbondingDelegationResp)) - } - return QueryDelegatorUnbondingDelegationsResp{ - UnbondingDelegations: unbondingDelegations, - Total: q.Pagination.Total, - } -} - -func (q QueryRedelegationsResponse) Convert() interface{} { - var redelegationResps []RedelegationResp - for _, v := range q.RedelegationResponses { - redelegationResps = append(redelegationResps, v.Convert().(RedelegationResp)) - } - - return QueryRedelegationsResp{ - RedelegationResponses: redelegationResps, - Total: q.Pagination.Total, - } -} - -func (r RedelegationResponse) Convert() interface{} { - var outerEntries []redelegationEntryResponse - for _, v := range r.Entries { - outerEntries = append(outerEntries, v.Convert().(redelegationEntryResponse)) - } - - var innerEntries []redelegationEntry - for _, v := range r.Redelegation.Entries { - innerEntries = append(innerEntries, v.Convert().(redelegationEntry)) - } - - return RedelegationResp{ - Redelegation: redelegation{ - DelegatorAddress: r.Redelegation.DelegatorAddress, - ValidatorSrcAddress: r.Redelegation.ValidatorSrcAddress, - ValidatorDstAddress: r.Redelegation.ValidatorDstAddress, - Entries: innerEntries, - }, - Entries: outerEntries, - } -} - -func (r RedelegationEntry) Convert() interface{} { - return redelegationEntry{ - CreationHeight: r.CreationHeight, - CompletionTime: r.CompletionTime, - InitialBalance: r.InitialBalance, - SharesDst: r.SharesDst, - } -} - -func (r RedelegationEntryResponse) Convert() interface{} { - return redelegationEntryResponse{ - RedelegationEntry: redelegationEntry{ - CreationHeight: r.RedelegationEntry.CreationHeight, - CompletionTime: r.RedelegationEntry.CompletionTime, - InitialBalance: r.RedelegationEntry.InitialBalance, - SharesDst: r.RedelegationEntry.SharesDst, - }, - Balance: r.Balance, - } -} - -func (q QueryDelegatorValidatorsResponse) Convert(cdc codec.Marshaler) interface{} { - var validators []QueryValidatorResp - for _, v := range q.Validators { - validators = append(validators, v.Convert(cdc).(QueryValidatorResp)) - } - - return QueryDelegatorValidatorsResp{ - Validator: validators, - Total: q.Pagination.Total, - } -} - -func (q QueryHistoricalInfoResponse) Convert(cdc codec.Marshaler) interface{} { - var valset []QueryValidatorResp - for _, v := range q.Hist.Valset { - valset = append(valset, v.Convert(cdc).(QueryValidatorResp)) - } - - header := q.Hist.Header - lastBlockId := q.Hist.Header.LastBlockId.PartSetHeader - partSetHeader := q.Hist.Header.LastBlockId.PartSetHeader - return QueryHistoricalInfoResp{ - Header: sdk.Header{ - Version: header.Version, - ChainID: header.ChainID, - Height: header.Height, - Time: header.Time, - LastBlockID: tmtypes.BlockID{ - Hash: lastBlockId.Hash, - PartSetHeader: tmtypes.PartSetHeader{ - Total: partSetHeader.Total, - Hash: partSetHeader.Hash, - }, - }, - LastCommitHash: header.LastCommitHash, - DataHash: header.DataHash, - ValidatorsHash: header.ValidatorsHash, - NextValidatorsHash: header.NextValidatorsHash, - ConsensusHash: header.ConsensusHash, - AppHash: header.AppHash, - LastResultsHash: header.LastResultsHash, - EvidenceHash: header.EvidenceHash, - ProposerAddress: header.ProposerAddress, - }, - Valset: valset, - } -} - -func (q QueryParamsResponse) Convert() interface{} { - return QueryParamsResp{ - UnbondingTime: q.Params.UnbondingTime, - MaxValidators: q.Params.MaxValidators, - MaxEntries: q.Params.MaxEntries, - HistoricalEntries: q.Params.HistoricalEntries, - BondDenom: q.Params.BondDenom, - } -} diff --git a/modules/token.go b/modules/token.go deleted file mode 100644 index 77f12366..00000000 --- a/modules/token.go +++ /dev/null @@ -1,100 +0,0 @@ -package modules - -import ( - "context" - "fmt" - "strings" - - "github.com/tendermint/tendermint/libs/log" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/modules/token" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/utils/cache" -) - -type tokenQuery struct { - q sdk.Queries - sdk.GRPCClient - cdc codec.Marshaler - log.Logger - cache.Cache -} - -func (l tokenQuery) QueryToken(denom string) (sdk.Token, error) { - denom = strings.ToLower(denom) - if t, err := l.Get(l.prefixKey(denom)); err == nil { - return t.(sdk.Token), nil - } - - conn, err := l.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return sdk.Token{}, sdk.Wrap(err) - } - - response, err := token.NewQueryClient(conn).Token( - context.Background(), - &token.QueryTokenRequest{Denom: denom}, - ) - if err != nil { - l.Debug("client query token failed", - " denom ", denom, - " err ", err.Error()) - return sdk.Token{}, nil - } - - var srcToken token.TokenInterface - if err = l.cdc.UnpackAny(response.Token, &srcToken); err != nil { - return sdk.Token{}, sdk.Wrap(err) - } - token := srcToken.(*token.Token).Convert().(sdk.Token) - l.SaveTokens(token) - return token, nil -} - -func (l tokenQuery) SaveTokens(tokens ...sdk.Token) { - for _, t := range tokens { - err1 := l.Set(l.prefixKey(t.Symbol), t) - err2 := l.Set(l.prefixKey(t.MinUnit), t) - if err1 != nil || err2 != nil { - l.Debug("cache token failed", "symbol", t.Symbol) - } - } -} - -func (l tokenQuery) ToMinCoin(coins ...sdk.DecCoin) (dstCoins sdk.Coins, err sdk.Error) { - for _, coin := range coins { - token, err := l.QueryToken(coin.Denom) - if err != nil { - return nil, sdk.Wrap(err) - } - - minCoin, err := token.GetCoinType().ConvertToMinCoin(coin) - if err != nil { - return nil, sdk.Wrap(err) - } - dstCoins = append(dstCoins, minCoin) - } - return dstCoins.Sort(), nil -} - -func (l tokenQuery) ToMainCoin(coins ...sdk.Coin) (dstCoins sdk.DecCoins, err sdk.Error) { - for _, coin := range coins { - token, err := l.QueryToken(coin.Denom) - if err != nil { - return dstCoins, sdk.Wrap(err) - } - - mainCoin, err := token.GetCoinType().ConvertToMainCoin(coin) - if err != nil { - return dstCoins, sdk.Wrap(err) - } - dstCoins = append(dstCoins, mainCoin) - } - return dstCoins.Sort(), nil -} - -func (l tokenQuery) prefixKey(symbol string) string { - return fmt.Sprintf("token:%s", symbol) -} diff --git a/modules/token/codec.go b/modules/token/codec.go deleted file mode 100644 index ab4c9280..00000000 --- a/modules/token/codec.go +++ /dev/null @@ -1,29 +0,0 @@ -package token - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - cryptocodec "github.com/irisnet/irishub-sdk-go/crypto/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgIssueToken{}, - &MsgEditToken{}, - &MsgMintToken{}, - &MsgTransferTokenOwner{}, - ) - registry.RegisterInterface("irismod.token.TokenI", (*TokenInterface)(nil), &Token{}) -} diff --git a/modules/token/export.go b/modules/token/export.go deleted file mode 100644 index 4129de87..00000000 --- a/modules/token/export.go +++ /dev/null @@ -1,50 +0,0 @@ -package token - -import ( - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type Client interface { - sdk.Module - - IssueToken(req IssueTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - EditToken(req EditTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - TransferToken(to string, symbol string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - MintToken(symbol string, amount uint64, to string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - - QueryToken(symbol string) (sdk.Token, error) - QueryTokens(owner string) (sdk.Tokens, error) - QueryFees(symbol string) (QueryFeesResp, error) - QueryParams() (QueryParamsResp, error) -} - -type IssueTokenRequest struct { - Symbol string `json:"symbol"` - Name string `json:"name"` - Scale uint32 `json:"scale"` - MinUnit string `json:"min_unit"` - InitialSupply uint64 `json:"initial_supply"` - MaxSupply uint64 `json:"max_supply"` - Mintable bool `json:"mintable"` -} - -type EditTokenRequest struct { - Symbol string `json:"symbol"` - Name string `json:"name"` - MaxSupply uint64 `json:"max_supply"` - Mintable bool `json:"mintable"` -} - -// QueryFeesResp is for the token fees query output -type QueryFeesResp struct { - Exist bool `json:"exist"` // indicate if the token has existed - IssueFee sdk.Coin `json:"issue_fee"` // issue fee - MintFee sdk.Coin `json:"mint_fee"` // mint fee -} - -// token params -type QueryParamsResp struct { - TokenTaxRate string `json:"token_tax_rate"` // e.g., 40% - IssueTokenBaseFee string `json:"issue_token_base_fee"` // e.g., 300000*10^18iris-atto - MintTokenFeeRatio string `json:"mint_token_fee_ratio"` // e.g., 10% -} diff --git a/modules/token/params.go b/modules/token/params.go deleted file mode 100644 index a2d2eef5..00000000 --- a/modules/token/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package token - -import ( - yaml "gopkg.in/yaml.v2" -) - -// String implements the stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -func (t Token) String() string { - bz, _ := yaml.Marshal(t) - return string(bz) -} diff --git a/modules/token/query.pb.go b/modules/token/query.pb.go deleted file mode 100644 index 3de341fb..00000000 --- a/modules/token/query.pb.go +++ /dev/null @@ -1,1880 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: token/query.proto - -package token - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - _ "github.com/irisnet/irishub-sdk-go/types" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - query "github.com/irisnet/irishub-sdk-go/types/query" - _ "github.com/regen-network/cosmos-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 - -// QueryTokenRequest is request type for the Query/Token RPC method -type QueryTokenRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QueryTokenRequest) Reset() { *m = QueryTokenRequest{} } -func (m *QueryTokenRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTokenRequest) ProtoMessage() {} -func (*QueryTokenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ec043bcd18c4056e, []int{0} -} -func (m *QueryTokenRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTokenRequest.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 *QueryTokenRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTokenRequest.Merge(m, src) -} -func (m *QueryTokenRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryTokenRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTokenRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTokenRequest proto.InternalMessageInfo - -func (m *QueryTokenRequest) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// QueryTokenResponse is response type for the Query/Token RPC method -type QueryTokenResponse struct { - Token *types.Any `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"` -} - -func (m *QueryTokenResponse) Reset() { *m = QueryTokenResponse{} } -func (m *QueryTokenResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTokenResponse) ProtoMessage() {} -func (*QueryTokenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ec043bcd18c4056e, []int{1} -} -func (m *QueryTokenResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTokenResponse.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 *QueryTokenResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTokenResponse.Merge(m, src) -} -func (m *QueryTokenResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTokenResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTokenResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTokenResponse proto.InternalMessageInfo - -func (m *QueryTokenResponse) GetToken() *types.Any { - if m != nil { - return m.Token - } - return nil -} - -// QueryTokensRequest is request type for the Query/Tokens RPC method -type QueryTokensRequest struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *QueryTokensRequest) Reset() { *m = QueryTokensRequest{} } -func (m *QueryTokensRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTokensRequest) ProtoMessage() {} -func (*QueryTokensRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ec043bcd18c4056e, []int{2} -} -func (m *QueryTokensRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTokensRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTokensRequest.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 *QueryTokensRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTokensRequest.Merge(m, src) -} -func (m *QueryTokensRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryTokensRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTokensRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTokensRequest proto.InternalMessageInfo - -func (m *QueryTokensRequest) GetOwner() string { - if m != nil { - return m.Owner - } - return "" -} - -// QueryTokensResponse is response type for the Query/Tokens RPC method -type QueryTokensResponse struct { - Tokens []*types.Any `protobuf:"bytes,1,rep,name=Tokens,proto3" json:"Tokens,omitempty"` -} - -func (m *QueryTokensResponse) Reset() { *m = QueryTokensResponse{} } -func (m *QueryTokensResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTokensResponse) ProtoMessage() {} -func (*QueryTokensResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ec043bcd18c4056e, []int{3} -} -func (m *QueryTokensResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTokensResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTokensResponse.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 *QueryTokensResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTokensResponse.Merge(m, src) -} -func (m *QueryTokensResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTokensResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTokensResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTokensResponse proto.InternalMessageInfo - -func (m *QueryTokensResponse) GetTokens() []*types.Any { - if m != nil { - return m.Tokens - } - return nil -} - -// QueryFeesRequest is request type for the Query/Fees RPC method -type QueryFeesRequest struct { - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` -} - -func (m *QueryFeesRequest) Reset() { *m = QueryFeesRequest{} } -func (m *QueryFeesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFeesRequest) ProtoMessage() {} -func (*QueryFeesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ec043bcd18c4056e, []int{4} -} -func (m *QueryFeesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeesRequest.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 *QueryFeesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeesRequest.Merge(m, src) -} -func (m *QueryFeesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryFeesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeesRequest proto.InternalMessageInfo - -func (m *QueryFeesRequest) GetSymbol() string { - if m != nil { - return m.Symbol - } - return "" -} - -// QueryFeesResponse is response type for the Query/Fees RPC method -type QueryFeesResponse struct { - Exist bool `protobuf:"varint,1,opt,name=exist,proto3" json:"exist,omitempty"` - IssueFee github_com_irisnet_irishub_sdk_go_types.Coin `protobuf:"bytes,2,opt,name=issue_fee,json=issueFee,proto3,casttype=github.com/irisnet/irishub-sdk-go/types.Coin" json:"issue_fee" yaml:"issue_fee"` - MintFee github_com_irisnet_irishub_sdk_go_types.Coin `protobuf:"bytes,3,opt,name=mint_fee,json=mintFee,proto3,casttype=github.com/irisnet/irishub-sdk-go/types.Coin" json:"mint_fee" yaml:"mint_fee"` -} - -func (m *QueryFeesResponse) Reset() { *m = QueryFeesResponse{} } -func (m *QueryFeesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFeesResponse) ProtoMessage() {} -func (*QueryFeesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ec043bcd18c4056e, []int{5} -} -func (m *QueryFeesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeesResponse.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 *QueryFeesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeesResponse.Merge(m, src) -} -func (m *QueryFeesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryFeesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeesResponse proto.InternalMessageInfo - -func (m *QueryFeesResponse) GetExist() bool { - if m != nil { - return m.Exist - } - return false -} - -func (m *QueryFeesResponse) GetIssueFee() github_com_irisnet_irishub_sdk_go_types.Coin { - if m != nil { - return m.IssueFee - } - return github_com_irisnet_irishub_sdk_go_types.Coin{} -} - -func (m *QueryFeesResponse) GetMintFee() github_com_irisnet_irishub_sdk_go_types.Coin { - if m != nil { - return m.MintFee - } - return github_com_irisnet_irishub_sdk_go_types.Coin{} -} - -// QueryParametersRequest is request type for the Query/Parameters 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_ec043bcd18c4056e, []int{6} -} -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 - -// QueryParametersResponse is response type for the Query/Parameters RPC method -type QueryParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - Res *query.PageResponse `protobuf:"bytes,2,opt,name=res,proto3" json:"res,omitempty"` -} - -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_ec043bcd18c4056e, []int{7} -} -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{} -} - -func (m *QueryParamsResponse) GetRes() *query.PageResponse { - if m != nil { - return m.Res - } - return nil -} - -func init() { - proto.RegisterType((*QueryTokenRequest)(nil), "irismod.token.QueryTokenRequest") - proto.RegisterType((*QueryTokenResponse)(nil), "irismod.token.QueryTokenResponse") - proto.RegisterType((*QueryTokensRequest)(nil), "irismod.token.QueryTokensRequest") - proto.RegisterType((*QueryTokensResponse)(nil), "irismod.token.QueryTokensResponse") - proto.RegisterType((*QueryFeesRequest)(nil), "irismod.token.QueryFeesRequest") - proto.RegisterType((*QueryFeesResponse)(nil), "irismod.token.QueryFeesResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "irismod.token.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "irismod.token.QueryParamsResponse") -} - -func init() { proto.RegisterFile("token/query.proto", fileDescriptor_ec043bcd18c4056e) } - -var fileDescriptor_ec043bcd18c4056e = []byte{ - // 675 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xc1, 0x4f, 0x13, 0x4f, - 0x14, 0xee, 0x52, 0xda, 0x5f, 0x99, 0x9f, 0x46, 0x18, 0x8b, 0x42, 0x03, 0xdb, 0xba, 0xd1, 0xa8, - 0x44, 0x76, 0x02, 0x5c, 0x94, 0x9b, 0x25, 0x41, 0xb9, 0x18, 0xd8, 0x78, 0xf2, 0x42, 0x76, 0xe9, - 0x63, 0xd9, 0xd0, 0x9d, 0x29, 0x9d, 0x59, 0xb5, 0x21, 0x24, 0xc6, 0xc4, 0xbb, 0x89, 0x7f, 0x86, - 0x57, 0xff, 0x08, 0x62, 0x62, 0x42, 0xe2, 0xc5, 0x13, 0x31, 0xe0, 0x5f, 0xe0, 0xd1, 0x93, 0xd9, - 0x99, 0xb7, 0x64, 0x8b, 0x2d, 0xe8, 0xa5, 0xed, 0x7b, 0xf3, 0xbd, 0xef, 0x7b, 0x6f, 0xe6, 0x7b, - 0x25, 0x13, 0x4a, 0xec, 0x02, 0x67, 0x7b, 0x09, 0x74, 0x7b, 0x6e, 0xa7, 0x2b, 0x94, 0xa0, 0x57, - 0xa3, 0x6e, 0x24, 0x63, 0xd1, 0x72, 0xf5, 0x51, 0xcd, 0xde, 0x12, 0x32, 0x16, 0x92, 0x05, 0xbe, - 0x04, 0xf6, 0x72, 0x21, 0x00, 0xe5, 0x2f, 0xb0, 0x2d, 0x11, 0x71, 0x03, 0xaf, 0x4d, 0x9b, 0xf3, - 0x4d, 0x1d, 0x31, 0x13, 0xe0, 0xd1, 0x5c, 0xbe, 0x54, 0x4b, 0x9c, 0x11, 0x74, 0xfc, 0x30, 0xe2, - 0xbe, 0x8a, 0x44, 0x46, 0x53, 0x0d, 0x45, 0x28, 0x0c, 0x47, 0xfa, 0x0b, 0xb3, 0x33, 0xa1, 0x10, - 0x61, 0x1b, 0x98, 0xdf, 0x89, 0x98, 0xcf, 0xb9, 0x50, 0xba, 0x24, 0xe3, 0x9f, 0xc6, 0x53, 0x1d, - 0x05, 0xc9, 0x36, 0xf3, 0x39, 0x0e, 0x51, 0xc3, 0xb9, 0xf4, 0xa7, 0x49, 0x39, 0xf7, 0xc9, 0xc4, - 0x46, 0xda, 0xc3, 0xf3, 0x34, 0xe7, 0xc1, 0x5e, 0x02, 0x52, 0xd1, 0x2a, 0x29, 0xb5, 0x80, 0x8b, - 0x78, 0xca, 0x6a, 0x58, 0xf7, 0xc6, 0x3c, 0x13, 0x38, 0xcf, 0x08, 0xcd, 0x43, 0x65, 0x47, 0x70, - 0x09, 0xf4, 0x21, 0x29, 0xe9, 0x84, 0xc6, 0xfe, 0xbf, 0x58, 0x75, 0x8d, 0xbc, 0x9b, 0xc9, 0xbb, - 0x8f, 0x79, 0xaf, 0x79, 0xe5, 0xf3, 0xa7, 0xf9, 0xca, 0x8a, 0xe0, 0x0a, 0xb8, 0x5a, 0xf3, 0x4c, - 0x81, 0x33, 0x97, 0xe7, 0x93, 0x39, 0x6d, 0xf1, 0x8a, 0x43, 0x37, 0xd3, 0xd6, 0x81, 0xb3, 0x41, - 0xae, 0xf7, 0x61, 0x51, 0x7c, 0x99, 0x94, 0x4d, 0x66, 0xca, 0x6a, 0x14, 0xff, 0x52, 0x1d, 0x2b, - 0x9c, 0x39, 0x32, 0xae, 0x29, 0x57, 0x01, 0xce, 0xc4, 0x6f, 0x90, 0xb2, 0xec, 0xc5, 0x81, 0x68, - 0xa3, 0x3a, 0x46, 0xce, 0xc7, 0x11, 0xbc, 0x26, 0x03, 0x46, 0xf5, 0x2a, 0x29, 0xc1, 0xeb, 0x48, - 0x2a, 0x0d, 0xae, 0x78, 0x26, 0xa0, 0x6f, 0x2c, 0x32, 0x16, 0x49, 0x99, 0xc0, 0xe6, 0x36, 0xc0, - 0xd4, 0x88, 0xbe, 0x95, 0x69, 0x17, 0x2d, 0x90, 0x3e, 0xba, 0x8b, 0xcf, 0xed, 0xae, 0x88, 0x88, - 0x37, 0x9f, 0x1e, 0x1e, 0xd7, 0x0b, 0x3f, 0x8f, 0xeb, 0xe3, 0x3d, 0x3f, 0x6e, 0x2f, 0x3b, 0x67, - 0x95, 0xce, 0xaf, 0xe3, 0xfa, 0x83, 0x30, 0x52, 0x3b, 0x49, 0xe0, 0x6e, 0x89, 0x98, 0xa5, 0xfe, - 0xe3, 0xa0, 0xf4, 0xf7, 0x4e, 0x12, 0xcc, 0xcb, 0xd6, 0xee, 0x7c, 0x28, 0x98, 0xea, 0x75, 0x40, - 0x6a, 0x26, 0xaf, 0xa2, 0x6b, 0x57, 0x01, 0xe8, 0x01, 0xa9, 0xc4, 0x11, 0x57, 0xba, 0x81, 0xe2, - 0x65, 0x0d, 0x3c, 0xc1, 0x06, 0xae, 0x99, 0x06, 0xb2, 0xc2, 0x7f, 0xd7, 0xff, 0x2f, 0x2d, 0x5d, - 0x05, 0x70, 0xaa, 0xf8, 0xb0, 0xeb, 0x7e, 0xd7, 0x8f, 0xb3, 0xbb, 0x75, 0xde, 0x59, 0xf8, 0x86, - 0x59, 0x1a, 0x6f, 0x71, 0x89, 0x94, 0x3b, 0x3a, 0x83, 0x0e, 0x9a, 0x74, 0xfb, 0x56, 0xcd, 0x35, - 0xf0, 0xe6, 0x68, 0xda, 0xa6, 0x87, 0x50, 0xfa, 0x88, 0x14, 0xbb, 0x20, 0xf1, 0x76, 0xef, 0xf6, - 0x0d, 0x67, 0xb6, 0x36, 0x1b, 0x71, 0xdd, 0x0f, 0x21, 0x93, 0xf2, 0xd2, 0x9a, 0xc5, 0x2f, 0x45, - 0x52, 0xd2, 0x7d, 0x50, 0x89, 0xd6, 0xa5, 0x8d, 0x73, 0x92, 0x7f, 0x6c, 0x44, 0xed, 0xd6, 0x05, - 0x08, 0x43, 0xee, 0xdc, 0x79, 0xfb, 0xf5, 0xc7, 0x87, 0x91, 0x3a, 0x9d, 0x65, 0x08, 0x65, 0xb9, - 0x6d, 0x93, 0x6c, 0x5f, 0x2f, 0xd1, 0x01, 0xe5, 0x99, 0x65, 0xe9, 0x70, 0xce, 0xec, 0xce, 0x6a, - 0xce, 0x45, 0x10, 0xd4, 0x9d, 0xd5, 0xba, 0x37, 0xe9, 0xe4, 0x40, 0x5d, 0x2a, 0xc8, 0x68, 0x6a, - 0x5a, 0x5a, 0x1f, 0x44, 0x95, 0xf3, 0x7e, 0xad, 0x31, 0x1c, 0x80, 0x4a, 0xb7, 0xb5, 0x92, 0x4d, - 0x67, 0xce, 0x29, 0xed, 0x9b, 0x2d, 0x39, 0x60, 0xdb, 0xa9, 0x10, 0x27, 0x65, 0xf3, 0x64, 0x83, - 0x07, 0xec, 0x33, 0xc5, 0xe0, 0x01, 0xfb, 0x0d, 0x32, 0x74, 0x40, 0x63, 0x85, 0xe6, 0xda, 0xe1, - 0x89, 0x6d, 0x1d, 0x9d, 0xd8, 0xd6, 0xf7, 0x13, 0xdb, 0x7a, 0x7f, 0x6a, 0x17, 0x8e, 0x4e, 0xed, - 0xc2, 0xb7, 0x53, 0xbb, 0xf0, 0x82, 0x5d, 0x6e, 0xdf, 0x58, 0xb4, 0x92, 0x36, 0x48, 0xc3, 0x18, - 0x94, 0xf5, 0xdf, 0xc6, 0xd2, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x2a, 0x10, 0x9d, 0x00, - 0x06, 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 { - // Token returns token with token name - Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) - // Tokens returns the token list - Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) - // Fees returns the fees to issue or mint a token - Fees(ctx context.Context, in *QueryFeesRequest, opts ...grpc.CallOption) (*QueryFeesResponse, error) - // Params queries the token parameters - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Token(ctx context.Context, in *QueryTokenRequest, opts ...grpc.CallOption) (*QueryTokenResponse, error) { - out := new(QueryTokenResponse) - err := c.cc.Invoke(ctx, "/irismod.token.Query/Token", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Tokens(ctx context.Context, in *QueryTokensRequest, opts ...grpc.CallOption) (*QueryTokensResponse, error) { - out := new(QueryTokensResponse) - err := c.cc.Invoke(ctx, "/irismod.token.Query/Tokens", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Fees(ctx context.Context, in *QueryFeesRequest, opts ...grpc.CallOption) (*QueryFeesResponse, error) { - out := new(QueryFeesResponse) - err := c.cc.Invoke(ctx, "/irismod.token.Query/Fees", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/irismod.token.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Token returns token with token name - Token(context.Context, *QueryTokenRequest) (*QueryTokenResponse, error) - // Tokens returns the token list - Tokens(context.Context, *QueryTokensRequest) (*QueryTokensResponse, error) - // Fees returns the fees to issue or mint a token - Fees(context.Context, *QueryFeesRequest) (*QueryFeesResponse, error) - // Params queries the token parameters - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Token(ctx context.Context, req *QueryTokenRequest) (*QueryTokenResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Token not implemented") -} -func (*UnimplementedQueryServer) Tokens(ctx context.Context, req *QueryTokensRequest) (*QueryTokensResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Tokens not implemented") -} -func (*UnimplementedQueryServer) Fees(ctx context.Context, req *QueryFeesRequest) (*QueryFeesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Fees not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Token_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTokenRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Token(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.token.Query/Token", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Token(ctx, req.(*QueryTokenRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTokensRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Tokens(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.token.Query/Tokens", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Tokens(ctx, req.(*QueryTokensRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Fees_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFeesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Fees(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.token.Query/Fees", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Fees(ctx, req.(*QueryFeesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/irismod.token.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.token.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Token", - Handler: _Query_Token_Handler, - }, - { - MethodName: "Tokens", - Handler: _Query_Tokens_Handler, - }, - { - MethodName: "Fees", - Handler: _Query_Fees_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "token/query.proto", -} - -func (m *QueryTokenRequest) 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 *QueryTokenRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTokenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryTokenResponse) 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 *QueryTokenResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Token != nil { - { - size, err := m.Token.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 *QueryTokensRequest) 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 *QueryTokensRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTokensRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryTokensResponse) 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 *QueryTokensResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTokensResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Tokens) > 0 { - for iNdEx := len(m.Tokens) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Tokens[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 *QueryFeesRequest) 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 *QueryFeesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryFeesResponse) 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 *QueryFeesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.MintFee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.IssueFee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if m.Exist { - i-- - if m.Exist { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -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 - if m.Res != nil { - { - size, err := m.Res.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryTokenRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryTokenResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Token != nil { - l = m.Token.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryTokensRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryTokensResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Tokens) > 0 { - for _, e := range m.Tokens { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryFeesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryFeesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exist { - n += 2 - } - l = m.IssueFee.Size() - n += 1 + l + sovQuery(uint64(l)) - l = m.MintFee.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -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)) - if m.Res != nil { - l = m.Res.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 *QueryTokenRequest) 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: QueryTokenRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTokenRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryTokenResponse) 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: QueryTokenResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token == nil { - m.Token = &types.Any{} - } - if err := m.Token.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 *QueryTokensRequest) 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: QueryTokensRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTokensRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 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.Owner = 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 *QueryTokensResponse) 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: QueryTokensResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTokensResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tokens", 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.Tokens = append(m.Tokens, &types.Any{}) - if err := m.Tokens[len(m.Tokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryFeesRequest) 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: QueryFeesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = 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 *QueryFeesResponse) 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: QueryFeesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Exist = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IssueFee", 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.IssueFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MintFee", 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.MintFee.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 *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 - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Res", 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.Res == nil { - m.Res = &query.PageResponse{} - } - if err := m.Res.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/modules/token/token.go b/modules/token/token.go deleted file mode 100644 index 0ca93744..00000000 --- a/modules/token/token.go +++ /dev/null @@ -1,192 +0,0 @@ -// Package token allows individuals and companies to create and issue their own tokens. -// - -package token - -import ( - "context" - "strconv" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -type tokenClient struct { - sdk.BaseClient - codec.Marshaler -} - -func NewClient(bc sdk.BaseClient, cdc codec.Marshaler) Client { - return tokenClient{ - BaseClient: bc, - Marshaler: cdc, - } -} - -func (t tokenClient) Name() string { - return ModuleName -} - -func (t tokenClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -func (t tokenClient) IssueToken(req IssueTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := t.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgIssueToken{ - Symbol: req.Symbol, - Name: req.Name, - Scale: req.Scale, - MinUnit: req.MinUnit, - InitialSupply: req.InitialSupply, - MaxSupply: req.MaxSupply, - Mintable: req.Mintable, - Owner: owner.String(), - } - - return t.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (t tokenClient) EditToken(req EditTokenRequest, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := t.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgEditToken{ - Symbol: req.Symbol, - Name: req.Name, - MaxSupply: req.MaxSupply, - Mintable: Bool(strconv.FormatBool(req.Mintable)), - Owner: owner.String(), - } - - return t.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (t tokenClient) TransferToken(to string, symbol string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := t.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if err := sdk.ValidateAccAddress(to); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - msg := &MsgTransferTokenOwner{ - SrcOwner: owner.String(), - DstOwner: to, - Symbol: symbol, - } - return t.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (t tokenClient) MintToken(symbol string, amount uint64, to string, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - owner, err := t.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - receipt := owner.String() - if len(to) != 0 { - if err := sdk.ValidateAccAddress(to); err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } else { - receipt = to - } - } - - msg := &MsgMintToken{ - Symbol: symbol, - Amount: amount, - To: receipt, - Owner: owner.String(), - } - return t.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (t tokenClient) QueryToken(denom string) (sdk.Token, error) { - return t.BaseClient.QueryToken(denom) -} - -func (t tokenClient) QueryTokens(owner string) (sdk.Tokens, error) { - var ownerAddr string - if len(owner) > 0 { - if err := sdk.ValidateAccAddress(owner); err != nil { - return nil, sdk.Wrap(err) - } - ownerAddr = owner - } - - conn, err := t.GenConn() - defer func() { _ = conn.Close() }() - - if err != nil { - return sdk.Tokens{}, sdk.Wrap(err) - } - - request := &QueryTokensRequest{ - Owner: ownerAddr, - } - - res, err := NewQueryClient(conn).Tokens(context.Background(), request) - if err != nil { - return sdk.Tokens{}, err - } - - tokens := make(Tokens, 0, len(res.Tokens)) - for _, eviAny := range res.Tokens { - var evi TokenInterface - if err = t.UnpackAny(eviAny, &evi); err != nil { - return sdk.Tokens{}, err - } - tokens = append(tokens, evi.(*Token)) - } - - ts := tokens.Convert().(sdk.Tokens) - t.SaveTokens(ts...) - return ts, nil -} - -func (t tokenClient) QueryFees(symbol string) (QueryFeesResp, error) { - conn, err := t.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryFeesResp{}, sdk.Wrap(err) - } - - request := &QueryFeesRequest{ - Symbol: symbol, - } - - res, err := NewQueryClient(conn).Fees(context.Background(), request) - if err != nil { - return QueryFeesResp{}, err - } - - return res.Convert().(QueryFeesResp), nil -} - -func (t tokenClient) QueryParams() (QueryParamsResp, error) { - conn, err := t.GenConn() - defer func() { _ = conn.Close() }() - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - - res, err := NewQueryClient(conn).Params( - context.Background(), - &QueryParamsRequest{}, - ) - if err != nil { - return QueryParamsResp{}, sdk.Wrap(err) - } - - return res.Params.Convert().(QueryParamsResp), nil -} diff --git a/modules/token/token.pb.go b/modules/token/token.pb.go deleted file mode 100644 index d40ef873..00000000 --- a/modules/token/token.pb.go +++ /dev/null @@ -1,873 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: token/token.proto - -package token - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types "github.com/irisnet/irishub-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Token defines a standard for the fungible token -type Token struct { - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` - MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty" yaml:"min_unit"` - InitialSupply uint64 `protobuf:"varint,5,opt,name=initial_supply,json=initialSupply,proto3" json:"initial_supply,omitempty" yaml:"initial_supply"` - MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty" yaml:"max_supply"` - Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` - Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *Token) Reset() { *m = Token{} } -func (*Token) ProtoMessage() {} -func (*Token) Descriptor() ([]byte, []int) { - return fileDescriptor_6e2ef433bb3fdc80, []int{0} -} -func (m *Token) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Token) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Token.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 *Token) XXX_Merge(src proto.Message) { - xxx_messageInfo_Token.Merge(m, src) -} -func (m *Token) XXX_Size() int { - return m.Size() -} -func (m *Token) XXX_DiscardUnknown() { - xxx_messageInfo_Token.DiscardUnknown(m) -} - -var xxx_messageInfo_Token proto.InternalMessageInfo - -// token parameters -type Params struct { - TokenTaxRate github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=token_tax_rate,json=tokenTaxRate,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"token_tax_rate" yaml:"token_tax_rate"` - IssueTokenBaseFee types.Coin `protobuf:"bytes,2,opt,name=issue_token_base_fee,json=issueTokenBaseFee,proto3" json:"issue_token_base_fee" yaml:"issue_token_base_fee"` - MintTokenFeeRatio github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,3,opt,name=mint_token_fee_ratio,json=mintTokenFeeRatio,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"mint_token_fee_ratio" yaml:"mint_token_fee_ratio"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_6e2ef433bb3fdc80, []int{1} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Token)(nil), "irismod.token.Token") - proto.RegisterType((*Params)(nil), "irismod.token.Params") -} - -func init() { proto.RegisterFile("token/token.proto", fileDescriptor_6e2ef433bb3fdc80) } - -var fileDescriptor_6e2ef433bb3fdc80 = []byte{ - // 533 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0xbf, 0x6f, 0xd3, 0x4e, - 0x14, 0xb7, 0xf3, 0x4d, 0xd2, 0xe4, 0xbe, 0xa4, 0x28, 0x26, 0x45, 0x6e, 0x2a, 0xd9, 0x91, 0x59, - 0x22, 0xa1, 0xda, 0x2a, 0x30, 0x65, 0x42, 0x06, 0x75, 0x02, 0x09, 0x1d, 0x65, 0x61, 0xb1, 0xce, - 0xc9, 0x6b, 0x7a, 0xaa, 0xcf, 0x17, 0xf9, 0xce, 0x90, 0xcc, 0x2c, 0x8c, 0x8c, 0x8c, 0xf9, 0x07, - 0xf8, 0x3f, 0x32, 0x76, 0x44, 0x0c, 0x16, 0x24, 0x0b, 0x73, 0x76, 0x24, 0x74, 0x67, 0x37, 0xa8, - 0x02, 0x09, 0x89, 0x25, 0x79, 0xef, 0xf3, 0x7e, 0xf8, 0xf3, 0x3e, 0xef, 0x1d, 0xea, 0x4a, 0x7e, - 0x09, 0x69, 0xa0, 0x7f, 0xfd, 0x59, 0xc6, 0x25, 0xb7, 0x3a, 0x34, 0xa3, 0x82, 0xf1, 0x89, 0xaf, - 0xc1, 0xbe, 0x33, 0xe6, 0x82, 0x71, 0x11, 0xc4, 0x44, 0x40, 0xf0, 0xe6, 0x24, 0x06, 0x49, 0x4e, - 0x82, 0x31, 0xa7, 0x55, 0x7a, 0xbf, 0x37, 0xe5, 0x53, 0xae, 0xcd, 0x40, 0x59, 0x25, 0xea, 0x7d, - 0xaa, 0xa1, 0xc6, 0x99, 0xaa, 0xb7, 0xee, 0xa2, 0xa6, 0x58, 0xb0, 0x98, 0x27, 0xb6, 0x39, 0x30, - 0x87, 0x6d, 0x5c, 0x79, 0x96, 0x85, 0xea, 0x29, 0x61, 0x60, 0xd7, 0x34, 0xaa, 0x6d, 0xab, 0x87, - 0x1a, 0x62, 0x4c, 0x12, 0xb0, 0xff, 0x1b, 0x98, 0xc3, 0x0e, 0x2e, 0x1d, 0xcb, 0x47, 0x2d, 0x46, - 0xd3, 0x28, 0x4f, 0xa9, 0xb4, 0xeb, 0x2a, 0x3b, 0xbc, 0xb3, 0x2d, 0xdc, 0xdb, 0x0b, 0xc2, 0x92, - 0x91, 0x77, 0x1d, 0xf1, 0xf0, 0x1e, 0xa3, 0xe9, 0xab, 0x94, 0x4a, 0xeb, 0x31, 0xda, 0xa7, 0x29, - 0x95, 0x94, 0x24, 0x91, 0xc8, 0x67, 0xb3, 0x64, 0x61, 0x37, 0x06, 0xe6, 0xb0, 0x1e, 0x1e, 0x6e, - 0x0b, 0xf7, 0xa0, 0xac, 0xba, 0x19, 0xf7, 0x70, 0xa7, 0x02, 0x5e, 0x6a, 0xdf, 0x7a, 0x84, 0x10, - 0x23, 0xf3, 0xeb, 0xea, 0xa6, 0xae, 0x3e, 0xd8, 0x16, 0x6e, 0xb7, 0xfa, 0xe6, 0x2e, 0xe6, 0xe1, - 0x36, 0x23, 0xf3, 0xaa, 0xaa, 0xaf, 0x79, 0x4a, 0x12, 0x27, 0x60, 0xef, 0x0d, 0xcc, 0x61, 0x0b, - 0xef, 0x7c, 0x35, 0x19, 0x7f, 0x9b, 0x42, 0x66, 0xb7, 0xf4, 0xb8, 0xa5, 0x33, 0x6a, 0xbd, 0x5f, - 0xba, 0xc6, 0xc7, 0xa5, 0x6b, 0x78, 0x3f, 0x6a, 0xa8, 0xf9, 0x82, 0x64, 0x84, 0x09, 0x2b, 0x43, - 0xfb, 0x5a, 0xf9, 0x48, 0x92, 0x79, 0x94, 0x11, 0x09, 0xa5, 0x70, 0xe1, 0xb3, 0x55, 0xe1, 0x1a, - 0x5f, 0x0a, 0xf7, 0xfe, 0x94, 0xca, 0x8b, 0x3c, 0xf6, 0xc7, 0x9c, 0x05, 0x6a, 0x55, 0x29, 0x48, - 0xfd, 0x7f, 0x91, 0xc7, 0xc7, 0x62, 0x72, 0x79, 0x3c, 0xe5, 0x81, 0x5c, 0xcc, 0x40, 0xf8, 0x4f, - 0x61, 0xfc, 0x6b, 0xe2, 0x9b, 0x2d, 0x3d, 0x7c, 0x4b, 0x03, 0x67, 0x64, 0x8e, 0x89, 0x04, 0x8b, - 0xa3, 0x1e, 0x15, 0x22, 0x87, 0xa8, 0x4c, 0x53, 0xbb, 0x8e, 0xce, 0xa1, 0x5c, 0xce, 0xff, 0x0f, - 0x0e, 0xfd, 0xf2, 0x06, 0x7c, 0x85, 0xfb, 0xd5, 0x0d, 0xf8, 0x4f, 0x38, 0x4d, 0xc3, 0x7b, 0x8a, - 0xd4, 0xb6, 0x70, 0x8f, 0x2a, 0x5d, 0xff, 0xd0, 0xc4, 0xc3, 0x5d, 0x0d, 0xeb, 0x73, 0x08, 0x89, - 0x80, 0x53, 0x00, 0xeb, 0x9d, 0x89, 0x7a, 0x4a, 0x9c, 0x2a, 0xf7, 0x1c, 0x40, 0xf1, 0xa2, 0x5c, - 0x6f, 0xbe, 0x1d, 0xe2, 0x7f, 0x9b, 0xf5, 0x68, 0x77, 0x13, 0xbf, 0x35, 0xf6, 0x70, 0x57, 0xc1, - 0x9a, 0xc4, 0x29, 0x00, 0x56, 0xd8, 0xa8, 0xa5, 0xb4, 0xff, 0xbe, 0x74, 0xcd, 0xf0, 0xf9, 0xea, - 0x9b, 0x63, 0xac, 0xd6, 0x8e, 0x79, 0xb5, 0x76, 0xcc, 0xaf, 0x6b, 0xc7, 0xfc, 0xb0, 0x71, 0x8c, - 0xab, 0x8d, 0x63, 0x7c, 0xde, 0x38, 0xc6, 0xeb, 0xe0, 0xef, 0x34, 0x18, 0x9f, 0xe4, 0x09, 0x88, - 0xf2, 0x25, 0xc5, 0x4d, 0xfd, 0x0a, 0x1e, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xc0, 0x8a, - 0x9b, 0x5f, 0x03, 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 - } - if !this.TokenTaxRate.Equal(that1.TokenTaxRate) { - return false - } - if !this.IssueTokenBaseFee.Equal(&that1.IssueTokenBaseFee) { - return false - } - if !this.MintTokenFeeRatio.Equal(that1.MintTokenFeeRatio) { - return false - } - return true -} -func (m *Token) 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 *Token) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Token) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintToken(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x42 - } - if m.Mintable { - i-- - if m.Mintable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.MaxSupply != 0 { - i = encodeVarintToken(dAtA, i, uint64(m.MaxSupply)) - i-- - dAtA[i] = 0x30 - } - if m.InitialSupply != 0 { - i = encodeVarintToken(dAtA, i, uint64(m.InitialSupply)) - i-- - dAtA[i] = 0x28 - } - if len(m.MinUnit) > 0 { - i -= len(m.MinUnit) - copy(dAtA[i:], m.MinUnit) - i = encodeVarintToken(dAtA, i, uint64(len(m.MinUnit))) - i-- - dAtA[i] = 0x22 - } - if m.Scale != 0 { - i = encodeVarintToken(dAtA, i, uint64(m.Scale)) - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintToken(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintToken(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.MintTokenFeeRatio.Size() - i -= size - if _, err := m.MintTokenFeeRatio.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintToken(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.IssueTokenBaseFee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintToken(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size := m.TokenTaxRate.Size() - i -= size - if _, err := m.TokenTaxRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintToken(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintToken(dAtA []byte, offset int, v uint64) int { - offset -= sovToken(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Token) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovToken(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovToken(uint64(l)) - } - if m.Scale != 0 { - n += 1 + sovToken(uint64(m.Scale)) - } - l = len(m.MinUnit) - if l > 0 { - n += 1 + l + sovToken(uint64(l)) - } - if m.InitialSupply != 0 { - n += 1 + sovToken(uint64(m.InitialSupply)) - } - if m.MaxSupply != 0 { - n += 1 + sovToken(uint64(m.MaxSupply)) - } - if m.Mintable { - n += 2 - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovToken(uint64(l)) - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.TokenTaxRate.Size() - n += 1 + l + sovToken(uint64(l)) - l = m.IssueTokenBaseFee.Size() - n += 1 + l + sovToken(uint64(l)) - l = m.MintTokenFeeRatio.Size() - n += 1 + l + sovToken(uint64(l)) - return n -} - -func sovToken(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozToken(x uint64) (n int) { - return sovToken(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Token) 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 ErrIntOverflowToken - } - 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: Token: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Token: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - 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 ErrInvalidLengthToken - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthToken - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Symbol = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - 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 ErrInvalidLengthToken - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthToken - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) - } - m.Scale = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Scale |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinUnit", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - 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 ErrInvalidLengthToken - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthToken - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinUnit = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialSupply", wireType) - } - m.InitialSupply = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.InitialSupply |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) - } - m.MaxSupply = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxSupply |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mintable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Mintable = bool(v != 0) - case 8: - 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 ErrIntOverflowToken - } - 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 ErrInvalidLengthToken - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthToken - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipToken(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthToken - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TokenTaxRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - 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 ErrInvalidLengthToken - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthToken - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TokenTaxRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IssueTokenBaseFee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthToken - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthToken - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.IssueTokenBaseFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MintTokenFeeRatio", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowToken - } - 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 ErrInvalidLengthToken - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthToken - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MintTokenFeeRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipToken(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthToken - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipToken(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, ErrIntOverflowToken - } - 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, ErrIntOverflowToken - } - 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, ErrIntOverflowToken - } - 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, ErrInvalidLengthToken - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupToken - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthToken - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthToken = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowToken = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupToken = fmt.Errorf("proto: unexpected end of group") -) diff --git a/modules/token/tx.pb.go b/modules/token/tx.pb.go deleted file mode 100644 index cbec6241..00000000 --- a/modules/token/tx.pb.go +++ /dev/null @@ -1,1436 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: token/tx.proto - -package token - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// MsgIssueToken defines an SDK message for issuing a new token. -type MsgIssueToken struct { - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Scale uint32 `protobuf:"varint,3,opt,name=scale,proto3" json:"scale,omitempty"` - MinUnit string `protobuf:"bytes,4,opt,name=min_unit,json=minUnit,proto3" json:"min_unit,omitempty" yaml:"min_unit"` - InitialSupply uint64 `protobuf:"varint,5,opt,name=initial_supply,json=initialSupply,proto3" json:"initial_supply,omitempty" yaml:"initial_supply"` - MaxSupply uint64 `protobuf:"varint,6,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty" yaml:"max_supply"` - Mintable bool `protobuf:"varint,7,opt,name=mintable,proto3" json:"mintable,omitempty"` - Owner string `protobuf:"bytes,8,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgIssueToken) Reset() { *m = MsgIssueToken{} } -func (m *MsgIssueToken) String() string { return proto.CompactTextString(m) } -func (*MsgIssueToken) ProtoMessage() {} -func (*MsgIssueToken) Descriptor() ([]byte, []int) { - return fileDescriptor_ef78f47708126356, []int{0} -} -func (m *MsgIssueToken) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgIssueToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgIssueToken.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 *MsgIssueToken) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgIssueToken.Merge(m, src) -} -func (m *MsgIssueToken) XXX_Size() int { - return m.Size() -} -func (m *MsgIssueToken) XXX_DiscardUnknown() { - xxx_messageInfo_MsgIssueToken.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgIssueToken proto.InternalMessageInfo - -// MsgMintToken defines an SDK message for transferring the token owner. -type MsgTransferTokenOwner struct { - SrcOwner string `protobuf:"bytes,1,opt,name=src_owner,json=srcOwner,proto3" json:"src_owner,omitempty" yaml:"src_owner"` - DstOwner string `protobuf:"bytes,2,opt,name=dst_owner,json=dstOwner,proto3" json:"dst_owner,omitempty" yaml:"dst_owner"` - Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"` -} - -func (m *MsgTransferTokenOwner) Reset() { *m = MsgTransferTokenOwner{} } -func (m *MsgTransferTokenOwner) String() string { return proto.CompactTextString(m) } -func (*MsgTransferTokenOwner) ProtoMessage() {} -func (*MsgTransferTokenOwner) Descriptor() ([]byte, []int) { - return fileDescriptor_ef78f47708126356, []int{1} -} -func (m *MsgTransferTokenOwner) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgTransferTokenOwner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgTransferTokenOwner.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 *MsgTransferTokenOwner) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgTransferTokenOwner.Merge(m, src) -} -func (m *MsgTransferTokenOwner) XXX_Size() int { - return m.Size() -} -func (m *MsgTransferTokenOwner) XXX_DiscardUnknown() { - xxx_messageInfo_MsgTransferTokenOwner.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgTransferTokenOwner proto.InternalMessageInfo - -// MsgEditToken defines an SDK message for editing a new token. -type MsgEditToken struct { - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - MaxSupply uint64 `protobuf:"varint,3,opt,name=max_supply,json=maxSupply,proto3" json:"max_supply,omitempty" yaml:"max_supply"` - Mintable Bool `protobuf:"bytes,4,opt,name=mintable,proto3,casttype=Bool" json:"mintable,omitempty"` - Owner string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgEditToken) Reset() { *m = MsgEditToken{} } -func (m *MsgEditToken) String() string { return proto.CompactTextString(m) } -func (*MsgEditToken) ProtoMessage() {} -func (*MsgEditToken) Descriptor() ([]byte, []int) { - return fileDescriptor_ef78f47708126356, []int{2} -} -func (m *MsgEditToken) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgEditToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgEditToken.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 *MsgEditToken) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgEditToken.Merge(m, src) -} -func (m *MsgEditToken) XXX_Size() int { - return m.Size() -} -func (m *MsgEditToken) XXX_DiscardUnknown() { - xxx_messageInfo_MsgEditToken.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgEditToken proto.InternalMessageInfo - -// MsgMintToken defines an SDK message for minting a new token. -type MsgMintToken struct { - Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` - Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` - To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` - Owner string `protobuf:"bytes,4,opt,name=owner,proto3" json:"owner,omitempty"` -} - -func (m *MsgMintToken) Reset() { *m = MsgMintToken{} } -func (m *MsgMintToken) String() string { return proto.CompactTextString(m) } -func (*MsgMintToken) ProtoMessage() {} -func (*MsgMintToken) Descriptor() ([]byte, []int) { - return fileDescriptor_ef78f47708126356, []int{3} -} -func (m *MsgMintToken) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMintToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMintToken.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 *MsgMintToken) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMintToken.Merge(m, src) -} -func (m *MsgMintToken) XXX_Size() int { - return m.Size() -} -func (m *MsgMintToken) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMintToken.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMintToken proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgIssueToken)(nil), "irismod.token.MsgIssueToken") - proto.RegisterType((*MsgTransferTokenOwner)(nil), "irismod.token.MsgTransferTokenOwner") - proto.RegisterType((*MsgEditToken)(nil), "irismod.token.MsgEditToken") - proto.RegisterType((*MsgMintToken)(nil), "irismod.token.MsgMintToken") -} - -func init() { proto.RegisterFile("token/tx.proto", fileDescriptor_ef78f47708126356) } - -var fileDescriptor_ef78f47708126356 = []byte{ - // 484 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xb1, 0x8e, 0xd3, 0x40, - 0x10, 0xcd, 0x3a, 0x4e, 0xce, 0x59, 0x91, 0x00, 0x4b, 0x72, 0x32, 0x57, 0xd8, 0x91, 0x45, 0x91, - 0xe6, 0x62, 0x21, 0xa8, 0xa8, 0x90, 0x25, 0x0a, 0x0a, 0x0b, 0xc9, 0x1c, 0x0d, 0x4d, 0xb4, 0x8e, - 0x17, 0xdf, 0xea, 0xbc, 0xbb, 0x91, 0x77, 0x2d, 0x92, 0xbf, 0xa0, 0xe1, 0x2b, 0xe0, 0x43, 0xae, - 0xbc, 0x92, 0xca, 0x82, 0xe4, 0x0f, 0x52, 0x52, 0x21, 0xaf, 0x7d, 0xbe, 0x04, 0x21, 0x01, 0x95, - 0xfd, 0xe6, 0xcd, 0xd3, 0xbc, 0x7d, 0xa3, 0x81, 0x23, 0x25, 0xae, 0x08, 0xf7, 0xd5, 0x7a, 0xbe, - 0xca, 0x85, 0x12, 0x68, 0x48, 0x73, 0x2a, 0x99, 0x48, 0xe6, 0xba, 0x7e, 0x36, 0x4e, 0x45, 0x2a, - 0x34, 0xe3, 0x57, 0x7f, 0x75, 0x93, 0xf7, 0xc5, 0x80, 0xc3, 0x50, 0xa6, 0xaf, 0xa5, 0x2c, 0xc8, - 0x45, 0xd5, 0x87, 0x4e, 0x61, 0x5f, 0x6e, 0x58, 0x2c, 0x32, 0x1b, 0x4c, 0xc1, 0x6c, 0x10, 0x35, - 0x08, 0x21, 0x68, 0x72, 0xcc, 0x88, 0x6d, 0xe8, 0xaa, 0xfe, 0x47, 0x63, 0xd8, 0x93, 0x4b, 0x9c, - 0x11, 0xbb, 0x3b, 0x05, 0xb3, 0x61, 0x54, 0x03, 0x34, 0x87, 0x16, 0xa3, 0x7c, 0x51, 0x70, 0xaa, - 0x6c, 0xb3, 0xea, 0x0e, 0x1e, 0xed, 0x4b, 0xf7, 0xfe, 0x06, 0xb3, 0xec, 0x85, 0x77, 0xcb, 0x78, - 0xd1, 0x09, 0xa3, 0xfc, 0x1d, 0xa7, 0x0a, 0xbd, 0x84, 0x23, 0xca, 0xa9, 0xa2, 0x38, 0x5b, 0xc8, - 0x62, 0xb5, 0xca, 0x36, 0x76, 0x6f, 0x0a, 0x66, 0x66, 0xf0, 0x78, 0x5f, 0xba, 0x93, 0x5a, 0x75, - 0xcc, 0x7b, 0xd1, 0xb0, 0x29, 0xbc, 0xd5, 0x18, 0x3d, 0x87, 0x90, 0xe1, 0xf5, 0xad, 0xba, 0xaf, - 0xd5, 0x93, 0x7d, 0xe9, 0x3e, 0x6c, 0x66, 0xb6, 0x9c, 0x17, 0x0d, 0x18, 0x5e, 0x37, 0xaa, 0x33, - 0xed, 0x53, 0xe1, 0x38, 0x23, 0xf6, 0xc9, 0x14, 0xcc, 0xac, 0xa8, 0xc5, 0xd5, 0xcb, 0xc4, 0x47, - 0x4e, 0x72, 0xdb, 0xd2, 0xcf, 0xad, 0x81, 0xf7, 0x19, 0xc0, 0x49, 0x28, 0xd3, 0x8b, 0x1c, 0x73, - 0xf9, 0x81, 0xe4, 0x3a, 0xb0, 0x37, 0x15, 0x83, 0x9e, 0xc2, 0x81, 0xcc, 0x97, 0x8b, 0x5a, 0xa3, - 0x83, 0x0b, 0xc6, 0xfb, 0xd2, 0x7d, 0x50, 0x1b, 0x68, 0x29, 0x2f, 0xb2, 0x64, 0xbe, 0x6c, 0x25, - 0x89, 0x54, 0x8d, 0xc4, 0xf8, 0x5d, 0xd2, 0x52, 0x5e, 0x64, 0x25, 0x52, 0xd5, 0x92, 0xbb, 0xdd, - 0x74, 0x0f, 0x77, 0xe3, 0x7d, 0x05, 0xf0, 0x5e, 0x28, 0xd3, 0x57, 0x09, 0x55, 0xff, 0xbf, 0xc4, - 0xe3, 0xf0, 0xba, 0xff, 0x18, 0xde, 0x93, 0x83, 0xf0, 0xea, 0x25, 0x5b, 0x3f, 0x4b, 0xd7, 0x0c, - 0x84, 0xc8, 0xfe, 0x14, 0x63, 0xef, 0x30, 0xc6, 0x44, 0xbb, 0x0d, 0x29, 0xff, 0x8b, 0xdb, 0x53, - 0xd8, 0xc7, 0x4c, 0x14, 0x5c, 0x69, 0xbf, 0x66, 0xd4, 0x20, 0x34, 0x82, 0x86, 0x12, 0x4d, 0x04, - 0x86, 0x12, 0x77, 0x53, 0xcc, 0x83, 0x29, 0x41, 0x78, 0xfd, 0xc3, 0xe9, 0x5c, 0x6f, 0x1d, 0x70, - 0xb3, 0x75, 0xc0, 0xf7, 0xad, 0x03, 0x3e, 0xed, 0x9c, 0xce, 0xcd, 0xce, 0xe9, 0x7c, 0xdb, 0x39, - 0x9d, 0xf7, 0x7e, 0x4a, 0xd5, 0x65, 0x11, 0xcf, 0x97, 0x82, 0xf9, 0xd5, 0xa1, 0x70, 0xa2, 0xf4, - 0xf7, 0xb2, 0x88, 0xcf, 0x65, 0x72, 0x75, 0x9e, 0x0a, 0x9f, 0x89, 0xa4, 0xc8, 0x88, 0xf4, 0xf5, - 0xfd, 0xc4, 0x7d, 0x7d, 0x30, 0xcf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x19, 0x30, 0xc7, - 0x67, 0x03, 0x00, 0x00, -} - -func (m *MsgIssueToken) 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 *MsgIssueToken) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgIssueToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x42 - } - if m.Mintable { - i-- - if m.Mintable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.MaxSupply != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.MaxSupply)) - i-- - dAtA[i] = 0x30 - } - if m.InitialSupply != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.InitialSupply)) - i-- - dAtA[i] = 0x28 - } - if len(m.MinUnit) > 0 { - i -= len(m.MinUnit) - copy(dAtA[i:], m.MinUnit) - i = encodeVarintTx(dAtA, i, uint64(len(m.MinUnit))) - i-- - dAtA[i] = 0x22 - } - if m.Scale != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Scale)) - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgTransferTokenOwner) 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 *MsgTransferTokenOwner) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgTransferTokenOwner) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0x1a - } - if len(m.DstOwner) > 0 { - i -= len(m.DstOwner) - copy(dAtA[i:], m.DstOwner) - i = encodeVarintTx(dAtA, i, uint64(len(m.DstOwner))) - i-- - dAtA[i] = 0x12 - } - if len(m.SrcOwner) > 0 { - i -= len(m.SrcOwner) - copy(dAtA[i:], m.SrcOwner) - i = encodeVarintTx(dAtA, i, uint64(len(m.SrcOwner))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgEditToken) 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 *MsgEditToken) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgEditToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x2a - } - if len(m.Mintable) > 0 { - i -= len(m.Mintable) - copy(dAtA[i:], m.Mintable) - i = encodeVarintTx(dAtA, i, uint64(len(m.Mintable))) - i-- - dAtA[i] = 0x22 - } - if m.MaxSupply != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.MaxSupply)) - i-- - dAtA[i] = 0x18 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgMintToken) 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 *MsgMintToken) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMintToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) - i-- - dAtA[i] = 0x22 - } - if len(m.To) > 0 { - i -= len(m.To) - copy(dAtA[i:], m.To) - i = encodeVarintTx(dAtA, i, uint64(len(m.To))) - i-- - dAtA[i] = 0x1a - } - if m.Amount != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Amount)) - i-- - dAtA[i] = 0x10 - } - if len(m.Symbol) > 0 { - i -= len(m.Symbol) - copy(dAtA[i:], m.Symbol) - i = encodeVarintTx(dAtA, i, uint64(len(m.Symbol))) - i-- - dAtA[i] = 0xa - } - 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 *MsgIssueToken) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Scale != 0 { - n += 1 + sovTx(uint64(m.Scale)) - } - l = len(m.MinUnit) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.InitialSupply != 0 { - n += 1 + sovTx(uint64(m.InitialSupply)) - } - if m.MaxSupply != 0 { - n += 1 + sovTx(uint64(m.MaxSupply)) - } - if m.Mintable { - n += 2 - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgTransferTokenOwner) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SrcOwner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.DstOwner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgEditToken) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.MaxSupply != 0 { - n += 1 + sovTx(uint64(m.MaxSupply)) - } - l = len(m.Mintable) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgMintToken) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Amount != 0 { - n += 1 + sovTx(uint64(m.Amount)) - } - l = len(m.To) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Owner) - if l > 0 { - n += 1 + l + sovTx(uint64(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 *MsgIssueToken) 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: MsgIssueToken: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIssueToken: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Scale", wireType) - } - m.Scale = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Scale |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinUnit", 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.MinUnit = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialSupply", wireType) - } - m.InitialSupply = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.InitialSupply |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) - } - m.MaxSupply = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxSupply |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mintable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Mintable = bool(v != 0) - case 8: - 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 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.Owner = 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 *MsgTransferTokenOwner) 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: MsgTransferTokenOwner: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgTransferTokenOwner: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcOwner", 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.SrcOwner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DstOwner", 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.DstOwner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = 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 *MsgEditToken) 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: MsgEditToken: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgEditToken: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxSupply", wireType) - } - m.MaxSupply = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxSupply |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Mintable", 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.Mintable = Bool(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - 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 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.Owner = 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 *MsgMintToken) 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: MsgMintToken: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintToken: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", 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.Symbol = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field To", 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.To = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - 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 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.Owner = 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 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/modules/token/types.go b/modules/token/types.go deleted file mode 100644 index 196e7866..00000000 --- a/modules/token/types.go +++ /dev/null @@ -1,317 +0,0 @@ -package token - -import ( - json2 "encoding/json" - "errors" - "strconv" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -const ( - ModuleName = "token" -) - -var ( - _ sdk.Msg = &MsgIssueToken{} - _ sdk.Msg = &MsgEditToken{} - _ sdk.Msg = &MsgMintToken{} - _ sdk.Msg = &MsgTransferTokenOwner{} -) - -func (msg MsgIssueToken) Route() string { return ModuleName } - -// Implements Msg. -func (msg MsgIssueToken) Type() string { return "issue_token" } - -// Implements Msg. -func (msg MsgIssueToken) ValidateBasic() error { - if len(msg.Owner) == 0 { - return errors.New("owner must be not empty") - } - - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return sdk.Wrap(err) - } - - if len(msg.Symbol) == 0 { - return errors.New("symbol must be not empty") - } - - if len(msg.Name) == 0 { - return errors.New("name must be not empty") - } - - if len(msg.MinUnit) == 0 { - return errors.New("minUnit must be not empty") - } - - return nil -} - -// Implements Msg. -func (msg MsgIssueToken) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// Implements Msg. -func (msg MsgIssueToken) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// GetSignBytes implements Msg -func (msg MsgTransferTokenOwner) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// GetSigners implements Msg -func (msg MsgTransferTokenOwner) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.SrcOwner)} -} - -func (msg MsgTransferTokenOwner) ValidateBasic() error { - if len(msg.SrcOwner) == 0 { - return errors.New("srcOwner must be not empty") - } - - if err := sdk.ValidateAccAddress(msg.SrcOwner); err != nil { - return sdk.Wrap(err) - } - - if len(msg.DstOwner) == 0 { - return errors.New("dstOwner must be not empty") - } - - if err := sdk.ValidateAccAddress(msg.DstOwner); err != nil { - return sdk.Wrap(err) - } - - if len(msg.Symbol) == 0 { - return errors.New("symbol must be not empty") - } - - return nil -} - -func (msg MsgTransferTokenOwner) Route() string { return ModuleName } - -// Type implements Msg -func (msg MsgTransferTokenOwner) Type() string { return "transfer_token_owner" } - -func (msg MsgEditToken) Route() string { return ModuleName } - -// Type implements Msg -func (msg MsgEditToken) Type() string { return "edit_token" } - -// ValidateBasic implements Msg -func (msg MsgEditToken) ValidateBasic() error { - if len(msg.Owner) == 0 { - return errors.New("owner must be not empty") - } - - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return sdk.Wrap(err) - } - - if len(msg.Symbol) == 0 { - return errors.New("symbol must be not empty") - } - return nil -} - -// GetSignBytes implements Msg -func (msg MsgEditToken) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - - return sdk.MustSortJSON(b) -} - -// GetSigners implements Msg -func (msg MsgEditToken) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -func (msg MsgMintToken) Route() string { return ModuleName } - -// Type implements Msg -func (msg MsgMintToken) Type() string { return "mint_token" } - -// GetSignBytes implements Msg -func (msg MsgMintToken) GetSignBytes() []byte { - b, err := ModuleCdc.MarshalJSON(&msg) - if err != nil { - panic(err) - } - return sdk.MustSortJSON(b) -} - -// GetSigners implements Msg -func (msg MsgMintToken) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{sdk.MustAccAddressFromBech32(msg.Owner)} -} - -// ValidateBasic implements Msg -func (msg MsgMintToken) ValidateBasic() error { - if len(msg.Owner) == 0 { - return errors.New("owner must be not empty") - } - - if err := sdk.ValidateAccAddress(msg.Owner); err != nil { - return sdk.Wrap(err) - } - - if len(msg.Symbol) == 0 { - return errors.New("symbol must be not empty") - } - return nil -} - -type Bool string - -func (b Bool) ToBool() bool { - v := string(b) - if len(v) == 0 { - return false - } - result, _ := strconv.ParseBool(v) - return result -} - -func (b Bool) String() string { - return string(b) -} - -// Marshal needed for protobuf compatibility -func (b Bool) Marshal() ([]byte, error) { - return []byte(b), nil -} - -// Unmarshal needed for protobuf compatibility -func (b *Bool) Unmarshal(data []byte) error { - *b = Bool(data[:]) - return nil -} - -// Marshals to JSON using string -func (b Bool) MarshalJSON() ([]byte, error) { - return json2.Marshal(b.String()) -} - -// Unmarshals from JSON assuming Bech32 encoding -func (b *Bool) UnmarshalJSON(data []byte) error { - var s string - err := json2.Unmarshal(data, &s) - if err != nil { - return nil - } - *b = Bool(s) - return nil -} - -// GetSymbol implements exported.TokenI -func (t Token) GetSymbol() string { - return t.Symbol -} - -// GetName implements exported.TokenI -func (t Token) GetName() string { - return t.Name -} - -// GetScale implements exported.TokenI -func (t Token) GetScale() uint32 { - return t.Scale -} - -// GetMinUnit implements exported.TokenI -func (t Token) GetMinUnit() string { - return t.MinUnit -} - -// GetInitialSupply implements exported.TokenI -func (t Token) GetInitialSupply() uint64 { - return t.InitialSupply -} - -// GetMaxSupply implements exported.TokenI -func (t Token) GetMaxSupply() uint64 { - return t.MaxSupply -} - -// GetMintable implements exported.TokenI -func (t Token) GetMintable() bool { - return t.Mintable -} - -// GetOwner implements exported.TokenI -func (t Token) GetOwner() sdk.AccAddress { - return sdk.MustAccAddressFromBech32(t.Owner) -} - -func (t Token) Convert() interface{} { - return sdk.Token{ - Symbol: t.Symbol, - Name: t.Name, - Scale: t.Scale, - MinUnit: t.MinUnit, - InitialSupply: t.InitialSupply, - MaxSupply: t.MaxSupply, - Mintable: t.Mintable, - Owner: t.Owner, - } -} - -type Tokens []TokenInterface - -func (ts Tokens) Convert() interface{} { - var tokens sdk.Tokens - for _, t := range ts { - tokens = append(tokens, sdk.Token{ - Symbol: t.GetSymbol(), - Name: t.GetName(), - Scale: t.GetScale(), - MinUnit: t.GetMinUnit(), - InitialSupply: t.GetInitialSupply(), - MaxSupply: t.GetMaxSupply(), - Mintable: t.GetMintable(), - Owner: t.GetOwner().String(), - }) - } - return tokens -} - -type TokenInterface interface { - GetSymbol() string - GetName() string - GetScale() uint32 - GetMinUnit() string - GetInitialSupply() uint64 - GetMaxSupply() uint64 - GetMintable() bool - GetOwner() sdk.AccAddress -} - -func (p Params) Convert() interface{} { - return QueryParamsResp{ - TokenTaxRate: p.TokenTaxRate.String(), - IssueTokenBaseFee: p.IssueTokenBaseFee.String(), - MintTokenFeeRatio: p.MintTokenFeeRatio.String(), - } -} - -func (t QueryFeesResponse) Convert() interface{} { - return QueryFeesResp(t) -} diff --git a/modules/tx.go b/modules/tx.go deleted file mode 100644 index 7b0fa7dc..00000000 --- a/modules/tx.go +++ /dev/null @@ -1,253 +0,0 @@ -package modules - -import ( - "context" - "encoding/hex" - "errors" - "strings" - "time" - - "github.com/gogo/protobuf/jsonpb" - - ctypes "github.com/tendermint/tendermint/rpc/core/types" - - clienttx "github.com/irisnet/irishub-sdk-go/client/tx" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// QueryTx returns the tx info -func (base baseClient) QueryTx(hash string) (sdk.ResultQueryTx, error) { - tx, err := hex.DecodeString(hash) - if err != nil { - return sdk.ResultQueryTx{}, err - } - - res, err := base.Tx(context.Background(), tx, true) - if err != nil { - return sdk.ResultQueryTx{}, err - } - - resBlocks, err := base.getResultBlocks([]*ctypes.ResultTx{res}) - if err != nil { - return sdk.ResultQueryTx{}, err - } - return base.parseTxResult(res, resBlocks[res.Height]) -} - -func (base baseClient) QueryTxs(builder *sdk.EventQueryBuilder, page, size *int) (sdk.ResultSearchTxs, error) { - query := builder.Build() - if len(query) == 0 { - return sdk.ResultSearchTxs{}, errors.New("must declare at least one tag to search") - } - - res, err := base.TxSearch(context.Background(), query, true, page, size, "asc") - if err != nil { - return sdk.ResultSearchTxs{}, err - } - - resBlocks, err := base.getResultBlocks(res.Txs) - if err != nil { - return sdk.ResultSearchTxs{}, err - } - - var txs []sdk.ResultQueryTx - for i, tx := range res.Txs { - txInfo, err := base.parseTxResult(tx, resBlocks[res.Txs[i].Height]) - if err != nil { - return sdk.ResultSearchTxs{}, err - } - txs = append(txs, txInfo) - } - - return sdk.ResultSearchTxs{ - Total: res.TotalCount, - Txs: txs, - }, nil -} - -func (base baseClient) QueryBlock(height int64) (sdk.BlockDetail, error) { - block, err := base.Block(context.Background(), &height) - if err != nil { - return sdk.BlockDetail{}, err - } - - blockResult, err := base.BlockResults(context.Background(), &height) - if err != nil { - return sdk.BlockDetail{}, err - } - - return sdk.BlockDetail{ - BlockID: block.BlockID, - Block: sdk.ParseBlock(base.encodingConfig.Amino, block.Block), - BlockResult: sdk.ParseBlockResult(blockResult), - }, nil -} - -func (base baseClient) EstimateTxGas(txBytes []byte) (uint64, error) { - res, err := base.ABCIQuery(context.Background(), "/app/simulate", txBytes) - if err != nil { - return 0, err - } - - simRes, err := parseQueryResponse(res.Response.Value) - if err != nil { - return 0, err - } - - adjusted := adjustGasEstimate(simRes.GasUsed, base.cfg.GasAdjustment) - return adjusted, nil -} - -func (base *baseClient) buildTx(msgs []sdk.Msg, baseTx sdk.BaseTx) ([]byte, *clienttx.Factory, sdk.Error) { - builder, err := base.prepare(baseTx) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - txByte, err := builder.BuildAndSign(baseTx.From, msgs, false) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - base.Logger().Debug("sign transaction success") - return txByte, builder, nil -} - -func (base *baseClient) buildTxWithAccount(addr string, accountNumber, sequence uint64, msgs []sdk.Msg, baseTx sdk.BaseTx) ([]byte, *clienttx.Factory, sdk.Error) { - builder, err := base.prepareTemp(addr, accountNumber, sequence, baseTx) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - txByte, err := builder.BuildAndSign(baseTx.From, msgs, false) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - base.Logger().Debug("sign transaction success") - return txByte, builder, nil -} - -func (base baseClient) broadcastTx(txBytes []byte, mode sdk.BroadcastMode, simulate bool) (res sdk.ResultTx, err sdk.Error) { - if simulate { - estimateGas, err := base.EstimateTxGas(txBytes) - if err != nil { - return res, sdk.Wrap(err) - } - res.GasWanted = int64(estimateGas) - return res, nil - } - - switch mode { - case sdk.Commit: - res, err = base.broadcastTxCommit(txBytes) - case sdk.Async: - res, err = base.broadcastTxAsync(txBytes) - case sdk.Sync: - res, err = base.broadcastTxSync(txBytes) - default: - err = sdk.Wrapf("commit mode(%s) not supported", mode) - } - return -} - -// broadcastTxCommit broadcasts transaction bytes to a Tendermint node -// and waits for a commit. -func (base baseClient) broadcastTxCommit(tx []byte) (sdk.ResultTx, sdk.Error) { - res, err := base.BroadcastTxCommit(context.Background(), tx) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if !res.CheckTx.IsOK() { - return sdk.ResultTx{}, sdk.GetError(res.CheckTx.Codespace, res.CheckTx.Code, res.CheckTx.Log) - } - - if !res.DeliverTx.IsOK() { - return sdk.ResultTx{}, sdk.GetError(res.DeliverTx.Codespace, res.DeliverTx.Code, res.DeliverTx.Log) - } - - return sdk.ResultTx{ - GasWanted: res.DeliverTx.GasWanted, - GasUsed: res.DeliverTx.GasUsed, - Events: sdk.StringifyEvents(res.DeliverTx.Events), - Hash: res.Hash.String(), - Height: res.Height, - }, nil -} - -// BroadcastTxSync broadcasts transaction bytes to a Tendermint node -// synchronously. -func (base baseClient) broadcastTxSync(tx []byte) (sdk.ResultTx, sdk.Error) { - res, err := base.BroadcastTxSync(context.Background(), tx) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if res.Code != 0 { - return sdk.ResultTx{}, sdk.GetError(sdk.RootCodespace, res.Code, res.Log) - } - - return sdk.ResultTx{Hash: res.Hash.String()}, nil -} - -// BroadcastTxAsync broadcasts transaction bytes to a Tendermint node -// asynchronously. -func (base baseClient) broadcastTxAsync(tx []byte) (sdk.ResultTx, sdk.Error) { - res, err := base.BroadcastTxAsync(context.Background(), tx) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - return sdk.ResultTx{Hash: res.Hash.String()}, nil -} - -func (base baseClient) getResultBlocks(resTxs []*ctypes.ResultTx) (map[int64]*ctypes.ResultBlock, error) { - resBlocks := make(map[int64]*ctypes.ResultBlock) - for _, resTx := range resTxs { - if _, ok := resBlocks[resTx.Height]; !ok { - resBlock, err := base.Block(context.Background(), &resTx.Height) - if err != nil { - return nil, err - } - - resBlocks[resTx.Height] = resBlock - } - } - return resBlocks, nil -} - -func (base baseClient) parseTxResult(res *ctypes.ResultTx, resBlock *ctypes.ResultBlock) (sdk.ResultQueryTx, error) { - var tx sdk.Tx - var err error - - if tx, err = base.encodingConfig.TxConfig.TxDecoder()(res.Tx); err != nil { - return sdk.ResultQueryTx{}, err - } - - return sdk.ResultQueryTx{ - Hash: res.Hash.String(), - Height: res.Height, - Tx: tx, - Result: sdk.TxResult{ - Code: res.TxResult.Code, - Log: res.TxResult.Log, - GasWanted: res.TxResult.GasWanted, - GasUsed: res.TxResult.GasUsed, - Events: sdk.StringifyEvents(res.TxResult.Events), - }, - Timestamp: resBlock.Block.Time.Format(time.RFC3339), - }, nil -} - -func adjustGasEstimate(estimate uint64, adjustment float64) uint64 { - return uint64(adjustment * float64(estimate)) -} - -func parseQueryResponse(bz []byte) (sdk.SimulationResponse, error) { - var simRes sdk.SimulationResponse - if err := jsonpb.Unmarshal(strings.NewReader(string(bz)), &simRes); err != nil { - return sdk.SimulationResponse{}, err - } - return simRes, nil -} diff --git a/types/abci.pb.go b/types/abci.pb.go deleted file mode 100644 index 0eefee9a..00000000 --- a/types/abci.pb.go +++ /dev/null @@ -1,3084 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/abci/v1beta1/abci.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - types1 "github.com/tendermint/tendermint/abci/types" - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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 - -// TxResponse defines a structure containing relevant tx data and metadata. The -// tags are stringified and the log is JSON decoded. -type TxResponse struct { - // The block height - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - // The transaction hash. - TxHash string `protobuf:"bytes,2,opt,name=txhash,proto3" json:"txhash,omitempty"` - // Namespace for the Code - Codespace string `protobuf:"bytes,3,opt,name=codespace,proto3" json:"codespace,omitempty"` - // Response code. - Code uint32 `protobuf:"varint,4,opt,name=code,proto3" json:"code,omitempty"` - // Result bytes, if any. - Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` - // The output of the application's logger (raw string). May be - // non-deterministic. - RawLog string `protobuf:"bytes,6,opt,name=raw_log,json=rawLog,proto3" json:"raw_log,omitempty"` - // The output of the application's logger (typed). May be non-deterministic. - Logs ABCIMessageLogs `protobuf:"bytes,7,rep,name=logs,proto3,castrepeated=ABCIMessageLogs" json:"logs"` - // Additional information. May be non-deterministic. - Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` - // Amount of gas requested for transaction. - GasWanted int64 `protobuf:"varint,9,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` - // Amount of gas consumed by transaction. - GasUsed int64 `protobuf:"varint,10,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - // The request transaction bytes. - Tx *types.Any `protobuf:"bytes,11,opt,name=tx,proto3" json:"tx,omitempty"` - // Time of the previous block. For heights > 1, it's the weighted median of - // the timestamps of the valid votes in the block.LastCommit. For height == 1, - // it's genesis time. - Timestamp string `protobuf:"bytes,12,opt,name=timestamp,proto3" json:"timestamp,omitempty"` -} - -func (m *TxResponse) Reset() { *m = TxResponse{} } -func (*TxResponse) ProtoMessage() {} -func (*TxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{0} -} -func (m *TxResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxResponse.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 *TxResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxResponse.Merge(m, src) -} -func (m *TxResponse) XXX_Size() int { - return m.Size() -} -func (m *TxResponse) XXX_DiscardUnknown() { - xxx_messageInfo_TxResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_TxResponse proto.InternalMessageInfo - -// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. -type ABCIMessageLog struct { - MsgIndex uint32 `protobuf:"varint,1,opt,name=msg_index,json=msgIndex,proto3" json:"msg_index,omitempty"` - Log string `protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"` - // Events contains a slice of Event objects that were emitted during some - // execution. - Events StringEvents `protobuf:"bytes,3,rep,name=events,proto3,castrepeated=StringEvents" json:"events"` -} - -func (m *ABCIMessageLog) Reset() { *m = ABCIMessageLog{} } -func (*ABCIMessageLog) ProtoMessage() {} -func (*ABCIMessageLog) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{1} -} -func (m *ABCIMessageLog) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ABCIMessageLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ABCIMessageLog.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 *ABCIMessageLog) XXX_Merge(src proto.Message) { - xxx_messageInfo_ABCIMessageLog.Merge(m, src) -} -func (m *ABCIMessageLog) XXX_Size() int { - return m.Size() -} -func (m *ABCIMessageLog) XXX_DiscardUnknown() { - xxx_messageInfo_ABCIMessageLog.DiscardUnknown(m) -} - -var xxx_messageInfo_ABCIMessageLog proto.InternalMessageInfo - -func (m *ABCIMessageLog) GetMsgIndex() uint32 { - if m != nil { - return m.MsgIndex - } - return 0 -} - -func (m *ABCIMessageLog) GetLog() string { - if m != nil { - return m.Log - } - return "" -} - -func (m *ABCIMessageLog) GetEvents() StringEvents { - if m != nil { - return m.Events - } - return nil -} - -// StringEvent defines en Event object wrapper where all the attributes -// contain key/value pairs that are strings instead of raw bytes. -type StringEvent struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Attributes []Attribute `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes"` -} - -func (m *StringEvent) Reset() { *m = StringEvent{} } -func (*StringEvent) ProtoMessage() {} -func (*StringEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{2} -} -func (m *StringEvent) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StringEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StringEvent.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 *StringEvent) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringEvent.Merge(m, src) -} -func (m *StringEvent) XXX_Size() int { - return m.Size() -} -func (m *StringEvent) XXX_DiscardUnknown() { - xxx_messageInfo_StringEvent.DiscardUnknown(m) -} - -var xxx_messageInfo_StringEvent proto.InternalMessageInfo - -func (m *StringEvent) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *StringEvent) GetAttributes() []Attribute { - if m != nil { - return m.Attributes - } - return nil -} - -// Attribute defines an attribute wrapper where the key and value are -// strings instead of raw bytes. -type Attribute struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Attribute) Reset() { *m = Attribute{} } -func (*Attribute) ProtoMessage() {} -func (*Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{3} -} -func (m *Attribute) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Attribute.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 *Attribute) XXX_Merge(src proto.Message) { - xxx_messageInfo_Attribute.Merge(m, src) -} -func (m *Attribute) XXX_Size() int { - return m.Size() -} -func (m *Attribute) XXX_DiscardUnknown() { - xxx_messageInfo_Attribute.DiscardUnknown(m) -} - -var xxx_messageInfo_Attribute proto.InternalMessageInfo - -func (m *Attribute) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *Attribute) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -// GasInfo defines tx execution gas context. -type GasInfo struct { - // GasWanted is the maximum units of work we allow this tx to perform. - GasWanted uint64 `protobuf:"varint,1,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty" yaml:"gas_wanted"` - // GasUsed is the amount of gas actually consumed. - GasUsed uint64 `protobuf:"varint,2,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty" yaml:"gas_used"` -} - -func (m *GasInfo) Reset() { *m = GasInfo{} } -func (*GasInfo) ProtoMessage() {} -func (*GasInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{4} -} -func (m *GasInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GasInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GasInfo.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 *GasInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GasInfo.Merge(m, src) -} -func (m *GasInfo) XXX_Size() int { - return m.Size() -} -func (m *GasInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GasInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GasInfo proto.InternalMessageInfo - -func (m *GasInfo) GetGasWanted() uint64 { - if m != nil { - return m.GasWanted - } - return 0 -} - -func (m *GasInfo) GetGasUsed() uint64 { - if m != nil { - return m.GasUsed - } - return 0 -} - -// Result is the union of ResponseFormat and ResponseCheckTx. -type Result struct { - // Data is any data returned from message or handler execution. It MUST be - // length prefixed in order to separate data from multiple message executions. - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - // Log contains the log information from message or handler execution. - Log string `protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"` - // Events contains a slice of Event objects that were emitted during message - // or handler execution. - Events []types1.Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events"` -} - -func (m *Result) Reset() { *m = Result{} } -func (*Result) ProtoMessage() {} -func (*Result) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{5} -} -func (m *Result) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Result.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 *Result) XXX_Merge(src proto.Message) { - xxx_messageInfo_Result.Merge(m, src) -} -func (m *Result) XXX_Size() int { - return m.Size() -} -func (m *Result) XXX_DiscardUnknown() { - xxx_messageInfo_Result.DiscardUnknown(m) -} - -var xxx_messageInfo_Result proto.InternalMessageInfo - -// SimulationResponse defines the response generated when a transaction is -// successfully simulated. -type SimulationResponse struct { - GasInfo `protobuf:"bytes,1,opt,name=gas_info,json=gasInfo,proto3,embedded=gas_info" json:"gas_info"` - Result *Result `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` -} - -func (m *SimulationResponse) Reset() { *m = SimulationResponse{} } -func (*SimulationResponse) ProtoMessage() {} -func (*SimulationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{6} -} -func (m *SimulationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SimulationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SimulationResponse.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 *SimulationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimulationResponse.Merge(m, src) -} -func (m *SimulationResponse) XXX_Size() int { - return m.Size() -} -func (m *SimulationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SimulationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SimulationResponse proto.InternalMessageInfo - -func (m *SimulationResponse) GetResult() *Result { - if m != nil { - return m.Result - } - return nil -} - -// MsgData defines the data returned in a Result object during message -// execution. -type MsgData struct { - MsgType string `protobuf:"bytes,1,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (m *MsgData) Reset() { *m = MsgData{} } -func (*MsgData) ProtoMessage() {} -func (*MsgData) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{7} -} -func (m *MsgData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgData.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 *MsgData) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgData.Merge(m, src) -} -func (m *MsgData) XXX_Size() int { - return m.Size() -} -func (m *MsgData) XXX_DiscardUnknown() { - xxx_messageInfo_MsgData.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgData proto.InternalMessageInfo - -func (m *MsgData) GetMsgType() string { - if m != nil { - return m.MsgType - } - return "" -} - -func (m *MsgData) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -// TxMsgData defines a list of MsgData. A transaction will have a MsgData object -// for each message. -type TxMsgData struct { - Data []*MsgData `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` -} - -func (m *TxMsgData) Reset() { *m = TxMsgData{} } -func (*TxMsgData) ProtoMessage() {} -func (*TxMsgData) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{8} -} -func (m *TxMsgData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxMsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxMsgData.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 *TxMsgData) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxMsgData.Merge(m, src) -} -func (m *TxMsgData) XXX_Size() int { - return m.Size() -} -func (m *TxMsgData) XXX_DiscardUnknown() { - xxx_messageInfo_TxMsgData.DiscardUnknown(m) -} - -var xxx_messageInfo_TxMsgData proto.InternalMessageInfo - -func (m *TxMsgData) GetData() []*MsgData { - if m != nil { - return m.Data - } - return nil -} - -// SearchTxsResult defines a structure for querying txs pageable -type SearchTxsResult struct { - // Count of all txs - TotalCount uint64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count" yaml:"total_count"` - // Count of txs in current page - Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` - // Index of current page, start from 1 - PageNumber uint64 `protobuf:"varint,3,opt,name=page_number,json=pageNumber,proto3" json:"page_number" yaml:"page_number"` - // Count of total pages - PageTotal uint64 `protobuf:"varint,4,opt,name=page_total,json=pageTotal,proto3" json:"page_total" yaml:"page_total"` - // Max count txs per page - Limit uint64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"` - // List of txs in current page - Txs []*TxResponse `protobuf:"bytes,6,rep,name=txs,proto3" json:"txs,omitempty"` -} - -func (m *SearchTxsResult) Reset() { *m = SearchTxsResult{} } -func (*SearchTxsResult) ProtoMessage() {} -func (*SearchTxsResult) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{9} -} -func (m *SearchTxsResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchTxsResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchTxsResult.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 *SearchTxsResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchTxsResult.Merge(m, src) -} -func (m *SearchTxsResult) XXX_Size() int { - return m.Size() -} -func (m *SearchTxsResult) XXX_DiscardUnknown() { - xxx_messageInfo_SearchTxsResult.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchTxsResult proto.InternalMessageInfo - -func (m *SearchTxsResult) GetTotalCount() uint64 { - if m != nil { - return m.TotalCount - } - return 0 -} - -func (m *SearchTxsResult) GetCount() uint64 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *SearchTxsResult) GetPageNumber() uint64 { - if m != nil { - return m.PageNumber - } - return 0 -} - -func (m *SearchTxsResult) GetPageTotal() uint64 { - if m != nil { - return m.PageTotal - } - return 0 -} - -func (m *SearchTxsResult) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *SearchTxsResult) GetTxs() []*TxResponse { - if m != nil { - return m.Txs - } - return nil -} - -func init() { - proto.RegisterType((*TxResponse)(nil), "cosmos.base.abci.v1beta1.TxResponse") - proto.RegisterType((*ABCIMessageLog)(nil), "cosmos.base.abci.v1beta1.ABCIMessageLog") - proto.RegisterType((*StringEvent)(nil), "cosmos.base.abci.v1beta1.StringEvent") - proto.RegisterType((*Attribute)(nil), "cosmos.base.abci.v1beta1.Attribute") - proto.RegisterType((*GasInfo)(nil), "cosmos.base.abci.v1beta1.GasInfo") - proto.RegisterType((*Result)(nil), "cosmos.base.abci.v1beta1.Result") - proto.RegisterType((*SimulationResponse)(nil), "cosmos.base.abci.v1beta1.SimulationResponse") - proto.RegisterType((*MsgData)(nil), "cosmos.base.abci.v1beta1.MsgData") - proto.RegisterType((*TxMsgData)(nil), "cosmos.base.abci.v1beta1.TxMsgData") - proto.RegisterType((*SearchTxsResult)(nil), "cosmos.base.abci.v1beta1.SearchTxsResult") -} - -func init() { - proto.RegisterFile("cosmos/base/abci/v1beta1/abci.proto", fileDescriptor_4e37629bc7eb0df8) -} - -var fileDescriptor_4e37629bc7eb0df8 = []byte{ - // 930 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0x31, 0x73, 0x1b, 0x45, - 0x14, 0xd6, 0x49, 0xca, 0xc9, 0x7a, 0x72, 0x30, 0x2c, 0x26, 0x39, 0x27, 0xa0, 0x13, 0xe7, 0x64, - 0x50, 0x93, 0xd3, 0xc4, 0x09, 0x0c, 0xe3, 0x82, 0x99, 0x5c, 0x48, 0x88, 0x67, 0x12, 0x8a, 0xb5, - 0x32, 0xcc, 0xd0, 0x68, 0x56, 0xd2, 0x66, 0x75, 0x44, 0x77, 0xab, 0xb9, 0xdd, 0xb3, 0xe5, 0x8e, - 0x92, 0x92, 0x2a, 0x05, 0x15, 0x35, 0xbf, 0x24, 0x1d, 0x2e, 0x53, 0x30, 0x02, 0xec, 0x2e, 0xa5, - 0x7f, 0x01, 0xb3, 0x6f, 0xcf, 0xd2, 0x99, 0x8c, 0x53, 0x69, 0xdf, 0xf7, 0xde, 0xbe, 0x7d, 0xfb, - 0x7d, 0x9f, 0xf6, 0x60, 0x7b, 0x24, 0x55, 0x22, 0x55, 0x6f, 0xc8, 0x14, 0xef, 0xb1, 0xe1, 0x28, - 0xee, 0x1d, 0xdc, 0x1d, 0x72, 0xcd, 0xee, 0x62, 0x10, 0xce, 0x32, 0xa9, 0x25, 0xf1, 0x6c, 0x51, - 0x68, 0x8a, 0x42, 0xc4, 0x8b, 0xa2, 0x1b, 0x9b, 0x42, 0x0a, 0x89, 0x45, 0x3d, 0xb3, 0xb2, 0xf5, - 0x37, 0x6e, 0x6a, 0x9e, 0x8e, 0x79, 0x96, 0xc4, 0xa9, 0xb6, 0x3d, 0xf5, 0xd1, 0x8c, 0xab, 0x22, - 0xb9, 0x25, 0xa4, 0x14, 0x53, 0xde, 0xc3, 0x68, 0x98, 0xbf, 0xe8, 0xb1, 0xf4, 0xc8, 0xa6, 0x82, - 0x57, 0x35, 0x80, 0xfe, 0x9c, 0x72, 0x35, 0x93, 0xa9, 0xe2, 0xe4, 0x1a, 0xb8, 0x13, 0x1e, 0x8b, - 0x89, 0xf6, 0x9c, 0x8e, 0xd3, 0xad, 0xd1, 0x22, 0x22, 0x01, 0xb8, 0x7a, 0x3e, 0x61, 0x6a, 0xe2, - 0x55, 0x3b, 0x4e, 0xb7, 0x19, 0xc1, 0xc9, 0xc2, 0x77, 0xfb, 0xf3, 0x27, 0x4c, 0x4d, 0x68, 0x91, - 0x21, 0x9f, 0x42, 0x73, 0x24, 0xc7, 0x5c, 0xcd, 0xd8, 0x88, 0x7b, 0x35, 0x53, 0x46, 0x57, 0x00, - 0x21, 0x50, 0x37, 0x81, 0x57, 0xef, 0x38, 0xdd, 0xab, 0x14, 0xd7, 0x06, 0x1b, 0x33, 0xcd, 0xbc, - 0x2b, 0x58, 0x8c, 0x6b, 0x72, 0x1d, 0x1a, 0x19, 0x3b, 0x1c, 0x4c, 0xa5, 0xf0, 0x5c, 0x84, 0xdd, - 0x8c, 0x1d, 0x3e, 0x95, 0x82, 0x3c, 0x87, 0xfa, 0x54, 0x0a, 0xe5, 0x35, 0x3a, 0xb5, 0x6e, 0x6b, - 0xa7, 0x1b, 0x5e, 0x46, 0x50, 0xf8, 0x20, 0x7a, 0xb8, 0xf7, 0x8c, 0x2b, 0xc5, 0x04, 0x7f, 0x2a, - 0x45, 0x74, 0xfd, 0xf5, 0xc2, 0xaf, 0xfc, 0xf1, 0xb7, 0xbf, 0x71, 0x11, 0x57, 0x14, 0xdb, 0x99, - 0x19, 0xe2, 0xf4, 0x85, 0xf4, 0xd6, 0xec, 0x0c, 0x66, 0x4d, 0x3e, 0x03, 0x10, 0x4c, 0x0d, 0x0e, - 0x59, 0xaa, 0xf9, 0xd8, 0x6b, 0x22, 0x13, 0x4d, 0xc1, 0xd4, 0x0f, 0x08, 0x90, 0x2d, 0x58, 0x33, - 0xe9, 0x5c, 0xf1, 0xb1, 0x07, 0x98, 0x6c, 0x08, 0xa6, 0x9e, 0x2b, 0x3e, 0x26, 0xb7, 0xa0, 0xaa, - 0xe7, 0x5e, 0xab, 0xe3, 0x74, 0x5b, 0x3b, 0x9b, 0xa1, 0xa5, 0x3d, 0x3c, 0xa7, 0x3d, 0x7c, 0x90, - 0x1e, 0xd1, 0xaa, 0x9e, 0x1b, 0xa6, 0x74, 0x9c, 0x70, 0xa5, 0x59, 0x32, 0xf3, 0xd6, 0x2d, 0x53, - 0x4b, 0x60, 0xb7, 0xfe, 0xcb, 0xef, 0x7e, 0x25, 0xf8, 0xcd, 0x81, 0x0f, 0x2e, 0x4e, 0x4c, 0x6e, - 0x42, 0x33, 0x51, 0x62, 0x10, 0xa7, 0x63, 0x3e, 0x47, 0x7d, 0xae, 0xd2, 0xb5, 0x44, 0x89, 0x3d, - 0x13, 0x93, 0x0f, 0xa1, 0x66, 0x38, 0x43, 0x79, 0xa8, 0x59, 0x92, 0x7d, 0x70, 0xf9, 0x01, 0x4f, - 0xb5, 0xf2, 0x6a, 0x48, 0xd9, 0xed, 0xcb, 0x29, 0xdb, 0xd7, 0x59, 0x9c, 0x8a, 0x47, 0xa6, 0x3a, - 0xda, 0x2c, 0xf8, 0x5a, 0x2f, 0x81, 0x8a, 0x16, 0xad, 0x76, 0xeb, 0x3f, 0xff, 0xd5, 0x71, 0x82, - 0x0c, 0x5a, 0xa5, 0xac, 0xe1, 0xd0, 0xd8, 0x0d, 0x67, 0x6a, 0x52, 0x5c, 0x93, 0x3d, 0x00, 0xa6, - 0x75, 0x16, 0x0f, 0x73, 0xcd, 0x95, 0x57, 0xc5, 0x09, 0xb6, 0xdf, 0x23, 0xda, 0x79, 0x6d, 0x54, - 0x37, 0xe7, 0xd3, 0xd2, 0xe6, 0xe2, 0xcc, 0x7b, 0xd0, 0x5c, 0x16, 0x99, 0xdb, 0xbe, 0xe4, 0x47, - 0xc5, 0x81, 0x66, 0x49, 0x36, 0xe1, 0xca, 0x01, 0x9b, 0xe6, 0xbc, 0x60, 0xc0, 0x06, 0x81, 0x84, - 0xc6, 0x77, 0x4c, 0xed, 0x19, 0x51, 0xef, 0x5f, 0x10, 0xd5, 0xec, 0xac, 0x47, 0x9f, 0x9c, 0x2d, - 0xfc, 0x8f, 0x8e, 0x58, 0x32, 0xdd, 0x0d, 0x56, 0xb9, 0xa0, 0xac, 0x75, 0x58, 0xd2, 0xba, 0x8a, - 0x7b, 0x3e, 0x3e, 0x5b, 0xf8, 0x1b, 0xab, 0x3d, 0x26, 0x13, 0x2c, 0x0d, 0x10, 0xfc, 0x04, 0x2e, - 0xe5, 0x2a, 0x9f, 0xea, 0xa5, 0xb9, 0xcd, 0x49, 0xeb, 0x85, 0xb9, 0xdf, 0x15, 0xe9, 0xfe, 0xff, - 0x44, 0xba, 0x16, 0xae, 0xfe, 0xc8, 0x96, 0x21, 0xab, 0x8a, 0x65, 0x65, 0xa9, 0x02, 0x5a, 0xe4, - 0x95, 0x03, 0x64, 0x3f, 0x4e, 0xf2, 0x29, 0xd3, 0xb1, 0x4c, 0x97, 0xff, 0xe1, 0xc7, 0x76, 0x64, - 0x74, 0xb5, 0x83, 0x4e, 0xfc, 0xfc, 0x72, 0xde, 0x0b, 0x76, 0xa2, 0x35, 0xd3, 0xff, 0x78, 0xe1, - 0x3b, 0x78, 0x15, 0x24, 0xec, 0x6b, 0x70, 0x33, 0xbc, 0x0a, 0xce, 0xdb, 0xda, 0xe9, 0x5c, 0xde, - 0xc5, 0x5e, 0x99, 0x16, 0xf5, 0xc1, 0x37, 0xd0, 0x78, 0xa6, 0xc4, 0xb7, 0xe6, 0xc6, 0x5b, 0x60, - 0x2c, 0x3a, 0x28, 0xd9, 0xa3, 0x91, 0x28, 0xd1, 0x37, 0x0e, 0x39, 0x27, 0xa8, 0xba, 0x22, 0xa8, - 0x90, 0xfa, 0x09, 0x34, 0xfb, 0xf3, 0xf3, 0x0e, 0x5f, 0x2e, 0x79, 0xac, 0xbd, 0xff, 0x2a, 0xc5, - 0x86, 0x0b, 0x9d, 0xfe, 0xac, 0xc2, 0xc6, 0x3e, 0x67, 0xd9, 0x68, 0xd2, 0x9f, 0xab, 0x42, 0x98, - 0xc7, 0xd0, 0xd2, 0x52, 0xb3, 0xe9, 0x60, 0x24, 0xf3, 0x54, 0x17, 0x4e, 0xb8, 0xfd, 0x76, 0xe1, - 0x97, 0xe1, 0xb3, 0x85, 0x4f, 0xac, 0xc8, 0x25, 0x30, 0xa0, 0x80, 0xd1, 0x43, 0x13, 0x18, 0xc7, - 0xd9, 0x0e, 0xe8, 0x0b, 0x6a, 0x03, 0xd3, 0x7d, 0xc6, 0x04, 0x1f, 0xa4, 0x79, 0x32, 0xe4, 0x19, - 0xbe, 0x83, 0x45, 0xf7, 0x12, 0xbc, 0xea, 0x5e, 0x02, 0x03, 0x0a, 0x26, 0xfa, 0x1e, 0x03, 0x12, - 0x01, 0x46, 0x03, 0x3c, 0x10, 0x5f, 0xcd, 0x7a, 0xb4, 0xfd, 0x76, 0xe1, 0x97, 0xd0, 0x95, 0x79, - 0x57, 0x58, 0x40, 0x9b, 0x26, 0xe8, 0x9b, 0xb5, 0x99, 0x70, 0x1a, 0x27, 0xb1, 0xc6, 0x07, 0xb6, - 0x4e, 0x6d, 0x40, 0xbe, 0x82, 0x9a, 0x9e, 0x2b, 0xcf, 0x45, 0x3e, 0x6f, 0x5d, 0xce, 0xe7, 0xea, - 0xb3, 0x40, 0xcd, 0x06, 0xcb, 0x68, 0xf4, 0xe8, 0xcd, 0xbf, 0xed, 0xca, 0xeb, 0x93, 0xb6, 0x73, - 0x7c, 0xd2, 0x76, 0xfe, 0x39, 0x69, 0x3b, 0xbf, 0x9e, 0xb6, 0x2b, 0xc7, 0xa7, 0xed, 0xca, 0x9b, - 0xd3, 0x76, 0xe5, 0xc7, 0x2f, 0x44, 0xac, 0x27, 0xf9, 0x30, 0x1c, 0xc9, 0xa4, 0x17, 0x67, 0xb1, - 0x4a, 0xb9, 0xc6, 0xdf, 0x49, 0x3e, 0xbc, 0xa3, 0xc6, 0x2f, 0xef, 0x08, 0x69, 0x3f, 0x4c, 0x43, - 0x17, 0x1f, 0xc5, 0x7b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x88, 0xd0, 0x11, 0x0d, 0x07, - 0x00, 0x00, -} - -func (m *TxResponse) 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 *TxResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Timestamp) > 0 { - i -= len(m.Timestamp) - copy(dAtA[i:], m.Timestamp) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Timestamp))) - i-- - dAtA[i] = 0x62 - } - if m.Tx != nil { - { - size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - if m.GasUsed != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasUsed)) - i-- - dAtA[i] = 0x50 - } - if m.GasWanted != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasWanted)) - i-- - dAtA[i] = 0x48 - } - if len(m.Info) > 0 { - i -= len(m.Info) - copy(dAtA[i:], m.Info) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Info))) - i-- - dAtA[i] = 0x42 - } - if len(m.Logs) > 0 { - for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.RawLog) > 0 { - i -= len(m.RawLog) - copy(dAtA[i:], m.RawLog) - i = encodeVarintAbci(dAtA, i, uint64(len(m.RawLog))) - i-- - dAtA[i] = 0x32 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x2a - } - if m.Code != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Code)) - i-- - dAtA[i] = 0x20 - } - if len(m.Codespace) > 0 { - i -= len(m.Codespace) - copy(dAtA[i:], m.Codespace) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Codespace))) - i-- - dAtA[i] = 0x1a - } - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintAbci(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0x12 - } - if m.Height != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ABCIMessageLog) 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 *ABCIMessageLog) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ABCIMessageLog) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Events) > 0 { - for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Log) > 0 { - i -= len(m.Log) - copy(dAtA[i:], m.Log) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Log))) - i-- - dAtA[i] = 0x12 - } - if m.MsgIndex != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.MsgIndex)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *StringEvent) 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 *StringEvent) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StringEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Attributes) > 0 { - for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Attribute) 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 *Attribute) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GasInfo) 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 *GasInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GasInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GasUsed != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasUsed)) - i-- - dAtA[i] = 0x10 - } - if m.GasWanted != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasWanted)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Result) 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 *Result) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Events) > 0 { - for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Log) > 0 { - i -= len(m.Log) - copy(dAtA[i:], m.Log) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Log))) - i-- - dAtA[i] = 0x12 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SimulationResponse) 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 *SimulationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SimulationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Result != nil { - { - size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.GasInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgData) 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 *MsgData) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgData) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x12 - } - if len(m.MsgType) > 0 { - i -= len(m.MsgType) - copy(dAtA[i:], m.MsgType) - i = encodeVarintAbci(dAtA, i, uint64(len(m.MsgType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TxMsgData) 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 *TxMsgData) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxMsgData) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - for iNdEx := len(m.Data) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Data[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SearchTxsResult) 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 *SearchTxsResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchTxsResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Txs) > 0 { - for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Txs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if m.Limit != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x28 - } - if m.PageTotal != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.PageTotal)) - i-- - dAtA[i] = 0x20 - } - if m.PageNumber != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.PageNumber)) - i-- - dAtA[i] = 0x18 - } - if m.Count != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x10 - } - if m.TotalCount != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.TotalCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintAbci(dAtA []byte, offset int, v uint64) int { - offset -= sovAbci(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *TxResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovAbci(uint64(m.Height)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Codespace) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if m.Code != 0 { - n += 1 + sovAbci(uint64(m.Code)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.RawLog) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Logs) > 0 { - for _, e := range m.Logs { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - l = len(m.Info) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if m.GasWanted != 0 { - n += 1 + sovAbci(uint64(m.GasWanted)) - } - if m.GasUsed != 0 { - n += 1 + sovAbci(uint64(m.GasUsed)) - } - if m.Tx != nil { - l = m.Tx.Size() - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Timestamp) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *ABCIMessageLog) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgIndex != 0 { - n += 1 + sovAbci(uint64(m.MsgIndex)) - } - l = len(m.Log) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Events) > 0 { - for _, e := range m.Events { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *StringEvent) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Attributes) > 0 { - for _, e := range m.Attributes { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *Attribute) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *GasInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasWanted != 0 { - n += 1 + sovAbci(uint64(m.GasWanted)) - } - if m.GasUsed != 0 { - n += 1 + sovAbci(uint64(m.GasUsed)) - } - return n -} - -func (m *Result) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Log) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Events) > 0 { - for _, e := range m.Events { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *SimulationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.GasInfo.Size() - n += 1 + l + sovAbci(uint64(l)) - if m.Result != nil { - l = m.Result.Size() - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *MsgData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MsgType) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *TxMsgData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Data) > 0 { - for _, e := range m.Data { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *SearchTxsResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TotalCount != 0 { - n += 1 + sovAbci(uint64(m.TotalCount)) - } - if m.Count != 0 { - n += 1 + sovAbci(uint64(m.Count)) - } - if m.PageNumber != 0 { - n += 1 + sovAbci(uint64(m.PageNumber)) - } - if m.PageTotal != 0 { - n += 1 + sovAbci(uint64(m.PageTotal)) - } - if m.Limit != 0 { - n += 1 + sovAbci(uint64(m.Limit)) - } - if len(m.Txs) > 0 { - for _, e := range m.Txs { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func sovAbci(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAbci(x uint64) (n int) { - return sovAbci(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ABCIMessageLog) String() string { - if this == nil { - return "nil" - } - repeatedStringForEvents := "[]StringEvent{" - for _, f := range this.Events { - repeatedStringForEvents += strings.Replace(strings.Replace(f.String(), "StringEvent", "StringEvent", 1), `&`, ``, 1) + "," - } - repeatedStringForEvents += "}" - s := strings.Join([]string{`&ABCIMessageLog{`, - `MsgIndex:` + fmt.Sprintf("%v", this.MsgIndex) + `,`, - `Log:` + fmt.Sprintf("%v", this.Log) + `,`, - `Events:` + repeatedStringForEvents + `,`, - `}`, - }, "") - return s -} -func (this *StringEvent) String() string { - if this == nil { - return "nil" - } - repeatedStringForAttributes := "[]Attribute{" - for _, f := range this.Attributes { - repeatedStringForAttributes += fmt.Sprintf("%v", f) + "," - } - repeatedStringForAttributes += "}" - s := strings.Join([]string{`&StringEvent{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Attributes:` + repeatedStringForAttributes + `,`, - `}`, - }, "") - return s -} -func (this *MsgData) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MsgData{`, - `MsgType:` + fmt.Sprintf("%v", this.MsgType) + `,`, - `Data:` + fmt.Sprintf("%v", this.Data) + `,`, - `}`, - }, "") - return s -} -func (this *TxMsgData) String() string { - if this == nil { - return "nil" - } - repeatedStringForData := "[]*MsgData{" - for _, f := range this.Data { - repeatedStringForData += strings.Replace(f.String(), "MsgData", "MsgData", 1) + "," - } - repeatedStringForData += "}" - s := strings.Join([]string{`&TxMsgData{`, - `Data:` + repeatedStringForData + `,`, - `}`, - }, "") - return s -} -func (this *SearchTxsResult) String() string { - if this == nil { - return "nil" - } - repeatedStringForTxs := "[]*TxResponse{" - for _, f := range this.Txs { - repeatedStringForTxs += strings.Replace(fmt.Sprintf("%v", f), "TxResponse", "TxResponse", 1) + "," - } - repeatedStringForTxs += "}" - s := strings.Join([]string{`&SearchTxsResult{`, - `TotalCount:` + fmt.Sprintf("%v", this.TotalCount) + `,`, - `Count:` + fmt.Sprintf("%v", this.Count) + `,`, - `PageNumber:` + fmt.Sprintf("%v", this.PageNumber) + `,`, - `PageTotal:` + fmt.Sprintf("%v", this.PageTotal) + `,`, - `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, - `Txs:` + repeatedStringForTxs + `,`, - `}`, - }, "") - return s -} -func valueToStringAbci(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *TxResponse) 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 ErrIntOverflowAbci - } - 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: TxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Codespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Codespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - m.Code = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Code |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawLog", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RawLog = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logs = append(m.Logs, ABCIMessageLog{}) - if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Info = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasWanted", wireType) - } - m.GasWanted = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasWanted |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) - } - m.GasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasUsed |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tx == nil { - m.Tx = &types.Any{} - } - if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Timestamp = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ABCIMessageLog) 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 ErrIntOverflowAbci - } - 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: ABCIMessageLog: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ABCIMessageLog: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgIndex", wireType) - } - m.MsgIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgIndex |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Log", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Log = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Events = append(m.Events, StringEvent{}) - if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StringEvent) 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 ErrIntOverflowAbci - } - 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: StringEvent: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StringEvent: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attributes = append(m.Attributes, Attribute{}) - if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Attribute) 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 ErrIntOverflowAbci - } - 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: Attribute: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GasInfo) 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 ErrIntOverflowAbci - } - 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: GasInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GasInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasWanted", wireType) - } - m.GasWanted = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasWanted |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) - } - m.GasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasUsed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Result) 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 ErrIntOverflowAbci - } - 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: Result: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Result: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Log", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Log = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Events = append(m.Events, types1.Event{}) - if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SimulationResponse) 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 ErrIntOverflowAbci - } - 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: SimulationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SimulationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.GasInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Result == nil { - m.Result = &Result{} - } - if err := m.Result.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgData) 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 ErrIntOverflowAbci - } - 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: MsgData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MsgType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TxMsgData) 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 ErrIntOverflowAbci - } - 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: TxMsgData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxMsgData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data, &MsgData{}) - if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchTxsResult) 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 ErrIntOverflowAbci - } - 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: SearchTxsResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SearchTxsResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalCount", wireType) - } - m.TotalCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PageNumber", wireType) - } - m.PageNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PageNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PageTotal", wireType) - } - m.PageTotal = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PageTotal |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Txs = append(m.Txs, &TxResponse{}) - if err := m.Txs[len(m.Txs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAbci(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, ErrIntOverflowAbci - } - 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, ErrIntOverflowAbci - } - 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, ErrIntOverflowAbci - } - 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, ErrInvalidLengthAbci - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAbci - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAbci - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAbci = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAbci = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAbci = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/account.go b/types/account.go deleted file mode 100644 index 448613aa..00000000 --- a/types/account.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -// BaseAccount defines the basic structure of the account -type BaseAccount struct { - Address string `json:"address"` - Coins Coins `json:"coins"` - PubKey string `json:"public_key"` - AccountNumber uint64 `json:"account_number"` - Sequence uint64 `json:"sequence"` -} diff --git a/types/address.go b/types/address.go deleted file mode 100644 index 60ab4879..00000000 --- a/types/address.go +++ /dev/null @@ -1,352 +0,0 @@ -package types - -import ( - "bytes" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - - "github.com/irisnet/irishub-sdk-go/utils/bech32" -) - -const ( - // AddrLen defines a valid address length - AddrLen = 20 -) - -// AccAddress a wrapper around bytes meant to represent an account address. -// When marshaled to a string or JSON, it uses Bech32. -type AccAddress []byte - -// AccAddressFromBech32 creates an AccAddress from a Bech32 string. -func AccAddressFromBech32(address string) (AccAddress, Error) { - bech32PrefixAccAddr := GetAddrPrefixCfg().GetBech32AccountAddrPrefix() - bz, err := bech32.GetFromBech32(address, bech32PrefixAccAddr) - if err != nil { - return nil, Wrap(err) - } - - return AccAddress(bz), nil -} - -func ValidateAccAddress(address string) Error { - bech32PrefixAccAddr := GetAddrPrefixCfg().GetBech32AccountAddrPrefix() - _, err := bech32.GetFromBech32(address, bech32PrefixAccAddr) - if err != nil { - return Wrap(err) - } - return nil -} - -func MustAccAddressFromBech32(address string) AccAddress { - addr, err := AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return addr -} - -// String implements the Stringer interface. -func (aa AccAddress) String() string { - if aa.Empty() { - return "" - } - - bech32PrefixAccAddr := GetAddrPrefixCfg().GetBech32AccountAddrPrefix() - bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixAccAddr, aa.Bytes()) - if err != nil { - panic(err) - } - - return bech32Addr -} - -// Returns boolean for whether two AccAddresses are equal -func (aa AccAddress) Equals(aa2 AccAddress) bool { - if aa.Empty() && aa2.Empty() { - return true - } - - return bytes.Equal(aa.Bytes(), aa2.Bytes()) -} - -// Returns boolean for whether an AccAddress is empty -func (aa AccAddress) Empty() bool { - if aa == nil { - return true - } - - aa2 := AccAddress{} - return bytes.Equal(aa.Bytes(), aa2.Bytes()) -} - -// Marshal returns the raw address bytes. It is needed for protobuf -// compatibility. -func (aa AccAddress) Marshal() ([]byte, error) { - return aa, nil -} - -// Unmarshal sets the address to the given data. It is needed for protobuf -// compatibility. -func (aa *AccAddress) Unmarshal(data []byte) error { - *aa = data - return nil -} - -// MarshalJSON marshals to JSON using Bech32. -func (aa AccAddress) MarshalJSON() ([]byte, error) { - return json.Marshal(aa.String()) -} - -// UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (aa *AccAddress) UnmarshalJSON(data []byte) error { - var s string - err := json.Unmarshal(data, &s) - if err != nil { - return err - } - - aa2, err := AccAddressFromBech32(s) - if err != nil { - return err - } - - *aa = aa2 - return nil -} - -// Bytes returns the raw address bytes. -func (aa AccAddress) Bytes() []byte { - return aa -} - -// ---------------------------------------------------------------------------- -// validator operator -// ---------------------------------------------------------------------------- - -// ValAddress defines a wrapper around bytes meant to present a validator's -// operator. When marshaled to a string or JSON, it uses Bech32. -type ValAddress []byte - -// ValAddressFromBech32 creates a ValAddress from a Bech32 string. -func ValAddressFromBech32(address string) (ValAddress, Error) { - bech32PrefixValAddr := GetAddrPrefixCfg().GetBech32ValidatorAddrPrefix() - bz, err := bech32.GetFromBech32(address, bech32PrefixValAddr) - if err != nil { - return nil, Wrap(err) - } - - return ValAddress(bz), nil -} - -// Returns boolean for whether two ValAddresses are equal -func (va ValAddress) Equals(va2 ValAddress) bool { - if va.Empty() && va2.Empty() { - return true - } - - return bytes.Equal(va.Bytes(), va2.Bytes()) -} - -// Returns boolean for whether an AccAddress is empty -func (va ValAddress) Empty() bool { - if va == nil { - return true - } - - va2 := ValAddress{} - return bytes.Equal(va.Bytes(), va2.Bytes()) -} - -// Marshal returns the raw address bytes. It is needed for protobuf -// compatibility. -func (va ValAddress) Marshal() ([]byte, error) { - return va, nil -} - -// Unmarshal sets the address to the given data. It is needed for protobuf -// compatibility. -func (va *ValAddress) Unmarshal(data []byte) error { - *va = data - return nil -} - -// MarshalJSON marshals to JSON using Bech32. -func (va ValAddress) MarshalJSON() ([]byte, error) { - return json.Marshal(va.String()) -} - -// UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (va *ValAddress) UnmarshalJSON(data []byte) error { - var s string - - err := json.Unmarshal(data, &s) - if err != nil { - return nil - } - - va2, err := ValAddressFromBech32(s) - if err != nil { - return err - } - - *va = va2 - return nil -} - -// Bytes returns the raw address bytes. -func (va ValAddress) Bytes() []byte { - return va -} - -// String implements the Stringer interface. -func (va ValAddress) String() string { - bech32PrefixValAddr := GetAddrPrefixCfg().GetBech32ValidatorAddrPrefix() - bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixValAddr, va.Bytes()) - if err != nil { - panic(err) - } - - return bech32Addr -} - -// Format implements the fmt.Formatter interface. -// nolint: errcheck -func (va ValAddress) Format(s fmt.State, verb rune) { - switch verb { - case 's': - _, _ = s.Write([]byte(va.String())) - case 'p': - _, _ = s.Write([]byte(fmt.Sprintf("%p", va))) - default: - _, _ = s.Write([]byte(fmt.Sprintf("%X", []byte(va)))) - } -} - -// ConsAddress defines a wrapper around bytes meant to present a consensus node. -// When marshaled to a string or JSON, it uses Bech32. -type ConsAddress []byte - -// String implements the Stringer interface. -func (ca ConsAddress) String() string { - bech32PrefixConsAddr := GetAddrPrefixCfg().GetBech32ConsensusAddrPrefix() - bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixConsAddr, ca.Bytes()) - if err != nil { - panic(err) - } - - return bech32Addr -} - -// Bytes returns the raw address bytes. -func (ca ConsAddress) Bytes() []byte { - return ca -} - -// ConsAddressFromHex creates a ConsAddress from a hex string. -func ConsAddressFromHex(address string) (addr ConsAddress, err error) { - if len(address) == 0 { - return addr, errors.New("decoding Bech32 address failed: must provide an address") - } - - bz, err := hex.DecodeString(address) - if err != nil { - return nil, err - } - - return ConsAddress(bz), nil -} - -// GetFromBech32 decodes a bytestring from a Bech32 encoded string. -func GetFromBech32(bech32str, prefix string) ([]byte, error) { - if len(bech32str) == 0 { - return nil, errors.New("decoding Bech32 address failed: must provide an address") - } - - hrp, bz, err := bech32.DecodeAndConvert(bech32str) - if err != nil { - return nil, err - } - - if hrp != prefix { - return nil, fmt.Errorf("invalid Bech32 prefix; expected %s, got %s", prefix, hrp) - } - - return bz, nil -} - -// ConsPubKey defines a wrapper around bytes meant to present a consensus node. -// When marshaled to a string or JSON, it uses Bech32. -type ConsPubKey []byte - -// String implements the Stringer interface. -func (cp ConsPubKey) String() string { - bech32PrefixConsPub := GetAddrPrefixCfg().GetBech32ConsensusPubPrefix() - bech32Pub, err := bech32.ConvertAndEncode(bech32PrefixConsPub, cp.Bytes()) - if err != nil { - panic(err) - } - - return bech32Pub -} - -// Bytes returns the raw address bytes. -func (cp ConsPubKey) Bytes() []byte { - return cp -} - -// Bech32PubKeyType defines a string type alias for a Bech32 public key type. -type Bech32PubKeyType string - -// Bech32 conversion constants -const ( - Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" - Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" - Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" -) - -// Bech32ifyPubKey returns a Bech32 encoded string containing the appropriate -// prefix based on the key type provided for a given PublicKey. -func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey TmPubKey) (string, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ValidatorPubPrefix() - - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ConsensusPubPrefix() - - } - - return bech32.ConvertAndEncode(bech32Prefix, pubkey.Bytes()) -} - -// GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with -// a given key type. -func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (TmPubKey, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ValidatorPubPrefix() - - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ConsensusPubPrefix() - - } - - bz, err := GetFromBech32(pubkeyStr, bech32Prefix) - if err != nil { - return nil, err - } - - return PubKeyFromBytes(bz) -} diff --git a/types/address_test.go b/types/address_test.go deleted file mode 100644 index 99bd6c28..00000000 --- a/types/address_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package types - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/irishub-sdk-go/utils/bech32" -) - -func TestGetFromBech32(t *testing.T) { - addBz, err := bech32.GetFromBech32("caa1rgnu8grzt6mwnjg7jss7w0sfyjn67g4em9njf5", "caa") - require.NoError(t, err) - addr, err := bech32.ConvertAndEncode("iaa", addBz) - require.NoError(t, err) - fmt.Println(addr) - - addBz, err = bech32.GetFromBech32("ccp1ulx45dfpqdnyust0a8ezcdhjjn3cekla9wx9lnpqmer9httzvstx64mns5njqzr4fdd", "ccp") - require.NoError(t, err) - - addr, err = bech32.ConvertAndEncode("icp", addBz) - require.NoError(t, err) - fmt.Println(addr) -} diff --git a/types/block.go b/types/block.go deleted file mode 100644 index 230482da..00000000 --- a/types/block.go +++ /dev/null @@ -1,131 +0,0 @@ -package types - -import ( - "encoding/base64" - - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/encoding" - ctypes "github.com/tendermint/tendermint/rpc/core/types" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/irisnet/irishub-sdk-go/codec" -) - -type Block struct { - tmtypes.Header `json:"header"` - Data `json:"data"` - Evidence tmtypes.EvidenceData `json:"evidence"` - LastCommit *tmtypes.Commit `json:"last_commit"` -} - -type Data struct { - Txs []StdTx `json:"txs"` -} - -func ParseBlock(cdc *codec.LegacyAmino, block *tmtypes.Block) Block { - var txs []StdTx - for _, tx := range block.Txs { - var stdTx StdTx - if err := cdc.UnmarshalBinaryBare(tx, &stdTx); err == nil { - txs = append(txs, stdTx) - } - } - return Block{ - Header: block.Header, - Data: Data{Txs: txs}, - Evidence: block.Evidence, - LastCommit: block.LastCommit, - } -} - -type BlockResult struct { - Height int64 `json:"height"` - Results ABCIResponses `json:"results"` -} - -type BlockDetail struct { - BlockID tmtypes.BlockID `json:"block_id"` - Block Block `json:"block"` - BlockResult BlockResult `json:"block_result"` -} - -type ABCIResponses struct { - DeliverTx []TxResult - EndBlock ResultEndBlock - BeginBlock ResultBeginBlock -} - -type ResultBeginBlock struct { - Events StringEvents `json:"events"` -} - -type ResultEndBlock struct { - Events StringEvents `json:"events"` - ValidatorUpdates []ValidatorUpdate `json:"validator_updates"` -} - -func ParseValidatorUpdate(updates []abci.ValidatorUpdate) []ValidatorUpdate { - var vUpdates []ValidatorUpdate - for _, v := range updates { - pubkey, _ := encoding.PubKeyFromProto(v.PubKey) - vUpdates = append( - vUpdates, - ValidatorUpdate{ - PubKey: PubKey{ - Type: pubkey.Type(), - Value: base64.StdEncoding.EncodeToString(pubkey.Bytes()), - }, - Power: v.Power, - }, - ) - } - return vUpdates -} - -func ParseBlockResult(res *ctypes.ResultBlockResults) BlockResult { - var txResults = make([]TxResult, len(res.TxsResults)) - for i, r := range res.TxsResults { - txResults[i] = TxResult{ - Code: r.Code, - Log: r.Log, - GasWanted: r.GasWanted, - GasUsed: r.GasUsed, - Events: StringifyEvents(r.Events), - } - } - return BlockResult{ - Height: res.Height, - Results: ABCIResponses{ - DeliverTx: txResults, - EndBlock: ResultEndBlock{ - Events: StringifyEvents(res.EndBlockEvents), - ValidatorUpdates: ParseValidatorUpdate(res.ValidatorUpdates), - }, - BeginBlock: ResultBeginBlock{ - Events: StringifyEvents(res.BeginBlockEvents), - }, - }, - } -} - -func ParseValidators(cdc *codec.LegacyAmino, vs []*tmtypes.Validator) []Validator { - var validators = make([]Validator, len(vs)) - for i, v := range vs { - bech32Addr, _ := ConsAddressFromHex(v.Address.String()) - bech32PubKey, _ := Bech32ifyPubKey(Bech32PubKeyTypeConsPub, v.PubKey) - - var pubKey PubKey - if bz, err := cdc.MarshalJSON(v.PubKey); err == nil { - _ = cdc.UnmarshalJSON(bz, &pubKey) - } - validators[i] = Validator{ - Bech32Address: bech32Addr.String(), - Bech32PubKey: bech32PubKey, - Address: v.Address.String(), - PubKey: pubKey, - VotingPower: v.VotingPower, - ProposerPriority: v.ProposerPriority, - } - } - return validators -} diff --git a/types/client.go b/types/client.go deleted file mode 100644 index 71b1fa2c..00000000 --- a/types/client.go +++ /dev/null @@ -1,74 +0,0 @@ -package types - -import ( - "google.golang.org/grpc" - - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" -) - -type TxManager interface { - TmQuery - BuildTxHash(msg []Msg, baseTx BaseTx) (string, Error) - BuildAndSend(msg []Msg, baseTx BaseTx) (ResultTx, Error) - BuildAndSign(msg []Msg, baseTx BaseTx) ([]byte, Error) - SendBatch(msgs Msgs, baseTx BaseTx) ([]ResultTx, Error) - BuildAndSendWithAccount(addr string, accountNumber, sequence uint64, msg []Msg, baseTx BaseTx) (ResultTx, Error) -} - -type Queries interface { - StoreQuery - AccountQuery - TmQuery -} - -type GRPCClient interface { - GenConn() (*grpc.ClientConn, error) -} - -type ParamQuery interface { - QueryParams(module string, res Response) Error -} - -type StoreQuery interface { - QueryWithResponse(path string, data interface{}, result Response) error - Query(path string, data interface{}) ([]byte, error) - QueryStore(key HexBytes, storeName string, height int64, prove bool) (abci.ResponseQuery, error) -} - -type AccountQuery interface { - QueryAccount(address string) (BaseAccount, Error) - QueryAddress(name, password string) (AccAddress, Error) -} - -type TmQuery interface { - QueryTx(hash string) (ResultQueryTx, error) - QueryTxs(builder *EventQueryBuilder, page, size *int) (ResultSearchTxs, error) - QueryBlock(height int64) (BlockDetail, error) -} - -type TokenManager interface { - QueryToken(denom string) (Token, error) - SaveTokens(tokens ...Token) -} - -type TokenConvert interface { - ToMinCoin(coin ...DecCoin) (Coins, Error) - ToMainCoin(coin ...Coin) (DecCoins, Error) -} - -type Logger interface { - Logger() log.Logger - SetLogger(log.Logger) -} - -type BaseClient interface { - TxManager - TokenManager - KeyManager - Queries - TokenConvert - TmClient - Logger - GRPCClient -} diff --git a/types/codec.go b/types/codec.go deleted file mode 100644 index c7678b41..00000000 --- a/types/codec.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/types" -) - -// EncodingConfig specifies the concrete encoding types to use for a given app. -// This is provided for compatibility between protobuf and amino implementations. -type EncodingConfig struct { - InterfaceRegistry types.InterfaceRegistry - Marshaler codec.Marshaler - TxConfig TxConfig - Amino *codec.LegacyAmino -} diff --git a/types/coin.go b/types/coin.go deleted file mode 100644 index 89acbdbc..00000000 --- a/types/coin.go +++ /dev/null @@ -1,681 +0,0 @@ -package types - -import ( - "encoding/json" - "fmt" - "regexp" - "sort" - "strings" -) - -const ( - BaseDenom = "uiris" -) - -// NewCoin returns a new coin with a denomination and amount. It will panic if -// the amount is negative. -func NewCoin(denom string, amount Int) Coin { - if err := validate(denom, amount); err != nil { - panic(err) - } - - return Coin{ - Denom: denom, - Amount: amount, - } -} - -// NewInt64Coin returns a new coin with a denomination and amount. It will panic -// if the amount is negative. -func NewInt64Coin(denom string, amount int64) Coin { - return NewCoin(denom, NewInt(amount)) -} - -// String provides a human-readable representation of a coin -func (coin Coin) String() string { - return fmt.Sprintf("%v%v", coin.Amount, coin.Denom) -} - -// validate returns an error if the Coin has a negative amount or if -// the denom is invalid. -func validate(denom string, amount Int) error { - if err := ValidateDenom(denom); err != nil { - return err - } - - if amount.IsNegative() { - return fmt.Errorf("negative coin amount: %v", amount) - } - - return nil -} - -// IsValid returns true if the Coin has a non-negative amount and the denom is vaild. -func (coin Coin) IsValid() bool { - return validate(coin.Denom, coin.Amount) == nil -} - -// IsZero returns if this represents no money -func (coin Coin) IsZero() bool { - return coin.Amount.IsZero() -} - -// IsGTE returns true if they are the same type and the receiver is -// an equal or greater value -func (coin Coin) IsGTE(other Coin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return !coin.Amount.LT(other.Amount) -} - -// IsLT returns true if they are the same type and the receiver is -// a smaller value -func (coin Coin) IsLT(other Coin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.LT(other.Amount) -} - -// IsEqual returns true if the two sets of Coins have the same value -func (coin Coin) IsEqual(other Coin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.Equal(other.Amount) -} - -// Adds amounts of two coins with same denom. If the coins differ in denom then -// it panics. -func (coin Coin) Add(coinB Coin) Coin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, coinB.Denom)) - } - - return Coin{coin.Denom, coin.Amount.Add(coinB.Amount)} -} - -// Subtracts amounts of two coins with same denom. If the coins differ in denom -// then it panics. -func (coin Coin) Sub(coinB Coin) Coin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, coinB.Denom)) - } - - res := Coin{coin.Denom, coin.Amount.Sub(coinB.Amount)} - if res.IsNegative() { - panic("negative coin amount") - } - - return res -} - -// IsPositive returns true if coin amount is positive. -// -// TODO: Remove once unsigned integers are used. -func (coin Coin) IsPositive() bool { - return coin.Amount.Sign() == 1 -} - -// IsNegative returns true if the coin amount is negative and false otherwise. -// -// TODO: Remove once unsigned integers are used. -func (coin Coin) IsNegative() bool { - return coin.Amount.Sign() == -1 -} - -// ----------------------------------------------------------------------------- -// Coins - -// Coins is a set of Coin, one per currency -type Coins []Coin - -// NewCoins constructs a new coin set. -func NewCoins(coins ...Coin) Coins { - // remove zeroes - newCoins := removeZeroCoins(Coins(coins)) - if len(newCoins) == 0 { - return Coins{} - } - - newCoins.Sort() - - // detect duplicate Denoms - if dupIndex := findDup(newCoins); dupIndex != -1 { - panic(fmt.Errorf("find duplicate denom: %s", newCoins[dupIndex])) - } - - if !newCoins.IsValid() { - panic(fmt.Errorf("invalid coin set: %s", newCoins)) - } - - return newCoins -} - -type coinsJSON Coins - -// MarshalJSON implements a custom JSON marshaller for the Coins type to allow -// nil Coins to be encoded as an empty array. -func (coins Coins) MarshalJSON() ([]byte, error) { - if coins == nil { - return json.Marshal(coinsJSON(Coins{})) - } - - return json.Marshal(coinsJSON(coins)) -} - -func (coins Coins) String() string { - if len(coins) == 0 { - return "" - } - - out := "" - for _, coin := range coins { - out += fmt.Sprintf("%v,", coin.String()) - } - return out[:len(out)-1] -} - -// IsValid asserts the Coins are sorted, have positive amount, -// and Denom does not contain upper case characters. -func (coins Coins) IsValid() bool { - switch len(coins) { - case 0: - return true - case 1: - if err := ValidateDenom(coins[0].Denom); err != nil { - return false - } - return coins[0].IsPositive() - default: - // check single coin case - if !(Coins{coins[0]}).IsValid() { - return false - } - - lowDenom := coins[0].Denom - for _, coin := range coins[1:] { - if strings.ToLower(coin.Denom) != coin.Denom { - return false - } - if coin.Denom <= lowDenom { - return false - } - if !coin.IsPositive() { - return false - } - - // we compare each coin against the last denom - lowDenom = coin.Denom - } - - return true - } -} - -// Add adds two sets of coins. -// -// e.g. -// {2A} + {A, 2B} = {3A, 2B} -// {2A} + {0B} = {2A} -// -// NOTE: Add operates under the invariant that coins are sorted by -// denominations. -// -// CONTRACT: Add will never return Coins where one Coin has a non-positive -// amount. In otherwords, IsValid will always return true. -func (coins Coins) Add(coinsB ...Coin) Coins { - return coins.safeAdd(coinsB) -} - -// safeAdd will perform addition of two coins sets. If both coin sets are -// empty, then an empty set is returned. If only a single set is empty, the -// other set is returned. Otherwise, the coins are compared in order of their -// denomination and addition only occurs when the denominations match, otherwise -// the coin is simply added to the sum assuming it's not zero. -func (coins Coins) safeAdd(coinsB Coins) Coins { - sum := ([]Coin)(nil) - indexA, indexB := 0, 0 - lenA, lenB := len(coins), len(coinsB) - - for { - if indexA == lenA { - if indexB == lenB { - // return nil coins if both sets are empty - return sum - } - - // return set B (excluding zero coins) if set A is empty - return append(sum, removeZeroCoins(coinsB[indexB:])...) - } else if indexB == lenB { - // return set A (excluding zero coins) if set B is empty - return append(sum, removeZeroCoins(coins[indexA:])...) - } - - coinA, coinB := coins[indexA], coinsB[indexB] - - switch strings.Compare(coinA.Denom, coinB.Denom) { - case -1: // coin A denom < coin B denom - if !coinA.IsZero() { - sum = append(sum, coinA) - } - - indexA++ - - case 0: // coin A denom == coin B denom - res := coinA.Add(coinB) - if !res.IsZero() { - sum = append(sum, res) - } - - indexA++ - indexB++ - - case 1: // coin A denom > coin B denom - if !coinB.IsZero() { - sum = append(sum, coinB) - } - - indexB++ - } - } -} - -// DenomsSubsetOf returns true if receiver's denom set -// is subset of coinsB's denoms. -func (coins Coins) DenomsSubsetOf(coinsB Coins) bool { - // more denoms in B than in receiver - if len(coins) > len(coinsB) { - return false - } - - for _, coin := range coins { - if coinsB.AmountOf(coin.Denom).IsZero() { - return false - } - } - - return true -} - -// Sub subtracts a set of coins from another. -// -// e.g. -// {2A, 3B} - {A} = {A, 3B} -// {2A} - {0B} = {2A} -// {A, B} - {A} = {B} -// -// CONTRACT: Sub will never return Coins where one Coin has a non-positive -// amount. In otherwords, IsValid will always return true. -func (coins Coins) Sub(coinsB Coins) Coins { - diff, hasNeg := coins.SafeSub(coinsB) - if hasNeg { - panic("negative coin amount") - } - - return diff -} - -// SafeSub performs the same arithmetic as Sub but returns a boolean if any -// negative coin amount was returned. -func (coins Coins) SafeSub(coinsB Coins) (Coins, bool) { - diff := coins.safeAdd(coinsB.negative()) - return diff, diff.IsAnyNegative() -} - -// IsAllGT returns true if for every denom in coinsB, -// the denom is present at a greater amount in coins. -func (coins Coins) IsAllGT(coinsB Coins) bool { - if len(coins) == 0 { - return false - } - - if len(coinsB) == 0 { - return true - } - - if !coinsB.DenomsSubsetOf(coins) { - return false - } - - for _, coinB := range coinsB { - amountA, amountB := coins.AmountOf(coinB.Denom), coinB.Amount - if !amountA.GT(amountB) { - return false - } - } - - return true -} - -// IsAllGTE returns false if for any denom in coinsB, -// the denom is present at a smaller amount in coins; -// else returns true. -func (coins Coins) IsAllGTE(coinsB Coins) bool { - if len(coinsB) == 0 { - return true - } - - if len(coins) == 0 { - return false - } - - for _, coinB := range coinsB { - if coinB.Amount.GT(coins.AmountOf(coinB.Denom)) { - return false - } - } - - return true -} - -// IsAllLT returns True iff for every denom in coins, the denom is present at -// a smaller amount in coinsB. -func (coins Coins) IsAllLT(coinsB Coins) bool { - return coinsB.IsAllGT(coins) -} - -// IsAllLTE returns true iff for every denom in coins, the denom is present at -// a smaller or equal amount in coinsB. -func (coins Coins) IsAllLTE(coinsB Coins) bool { - return coinsB.IsAllGTE(coins) -} - -// IsAnyGT returns true iff for any denom in coins, the denom is present at a -// greater amount in coinsB. -// -// e.g. -// {2A, 3B}.IsAnyGT{A} = true -// {2A, 3B}.IsAnyGT{5C} = false -// {}.IsAnyGT{5C} = false -// {2A, 3B}.IsAnyGT{} = false -func (coins Coins) IsAnyGT(coinsB Coins) bool { - if len(coinsB) == 0 { - return false - } - - for _, coin := range coins { - amt := coinsB.AmountOf(coin.Denom) - if coin.Amount.GT(amt) && !amt.IsZero() { - return true - } - } - - return false -} - -// IsAnyGTE returns true iff coins contains at least one denom that is present -// at a greater or equal amount in coinsB; it returns false otherwise. -// -// NOTE: IsAnyGTE operates under the invariant that both coin sets are sorted -// by denominations and there exists no zero coins. -func (coins Coins) IsAnyGTE(coinsB Coins) bool { - if len(coinsB) == 0 { - return false - } - - for _, coin := range coins { - amt := coinsB.AmountOf(coin.Denom) - if coin.Amount.GTE(amt) && !amt.IsZero() { - return true - } - } - - return false -} - -// IsZero returns true if there are no coins or all coins are zero. -func (coins Coins) IsZero() bool { - for _, coin := range coins { - if !coin.IsZero() { - return false - } - } - return true -} - -// IsEqual returns true if the two sets of Coins have the same value -func (coins Coins) IsEqual(coinsB Coins) bool { - if len(coins) != len(coinsB) { - return false - } - - coins = coins.Sort() - coinsB = coinsB.Sort() - - for i := 0; i < len(coins); i++ { - if !coins[i].IsEqual(coinsB[i]) { - return false - } - } - - return true -} - -// Empty returns true if there are no coins and false otherwise. -func (coins Coins) Empty() bool { - return len(coins) == 0 -} - -// Returns the amount of a denom from coins -func (coins Coins) AmountOf(denom string) Int { - mustValidateDenom(denom) - - switch len(coins) { - case 0: - return ZeroInt() - - case 1: - coin := coins[0] - if coin.Denom == denom { - return coin.Amount - } - return ZeroInt() - - default: - midIdx := len(coins) / 2 // 2:1, 3:1, 4:2 - coin := coins[midIdx] - switch { - case denom < coin.Denom: - return coins[:midIdx].AmountOf(denom) - case denom == coin.Denom: - return coin.Amount - default: - return coins[midIdx+1:].AmountOf(denom) - } - } -} - -// GetDenomByIndex returns the Denom of the certain coin to make the findDup generic -func (coins Coins) GetDenomByIndex(i int) string { - return coins[i].Denom -} - -// IsAllPositive returns true if there is at least one coin and all currencies -// have a positive value. -func (coins Coins) IsAllPositive() bool { - if len(coins) == 0 { - return false - } - - for _, coin := range coins { - if !coin.IsPositive() { - return false - } - } - - return true -} - -// IsAnyNegative returns true if there is at least one coin whose amount -// is negative; returns false otherwise. It returns false if the coin set -// is empty too. -// -// TODO: Remove once unsigned integers are used. -func (coins Coins) IsAnyNegative() bool { - for _, coin := range coins { - if coin.IsNegative() { - return true - } - } - - return false -} - -// negative returns a set of coins with all amount negative. -// -// TODO: Remove once unsigned integers are used. -func (coins Coins) negative() Coins { - res := make([]Coin, 0, len(coins)) - - for _, coin := range coins { - res = append(res, Coin{ - Denom: coin.Denom, - Amount: coin.Amount.Neg(), - }) - } - - return res -} - -// removeZeroCoins removes all zero coins from the given coin set in-place. -func removeZeroCoins(coins Coins) Coins { - i, l := 0, len(coins) - for i < l { - if coins[i].IsZero() { - // remove coin - coins = append(coins[:i], coins[i+1:]...) - l-- - } else { - i++ - } - } - - return coins[:i] -} - -// ----------------------------------------------------------------------------- -// Sort interface - -//nolint -func (coins Coins) Len() int { return len(coins) } -func (coins Coins) Less(i, j int) bool { return coins[i].Denom < coins[j].Denom } -func (coins Coins) Swap(i, j int) { coins[i], coins[j] = coins[j], coins[i] } - -var _ sort.Interface = Coins{} - -// Sort is a helper function to sort the set of coins inplace -func (coins Coins) Sort() Coins { - sort.Sort(coins) - return coins -} - -// ----------------------------------------------------------------------------- -// Parsing - -var ( - // Denominations can be 3 ~ 64 characters long. - reDnmString = `[a-zA-Z][a-zA-Z0-9/:]{2,127}` - reAmt = `[[:digit:]]+` - reDecAmt = `[[:digit:]]*[.]*[[:digit:]]+` - reSpc = `[[:space:]]*` - reDnm = regexp.MustCompile(fmt.Sprintf(`^%s$`, reDnmString)) - reCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reAmt, reSpc, reDnmString)) - reDecCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reDecAmt, reSpc, reDnmString)) -) - -// ValidateDenom validates a denomination string returning an error if it is -// invalid. -func ValidateDenom(denom string) error { - if !reDnm.MatchString(denom) { - return fmt.Errorf("invalid denom: %s", denom) - } - return nil -} - -func mustValidateDenom(denom string) { - if err := ValidateDenom(denom); err != nil { - panic(err) - } -} - -// ParseCoin parses a cli input for one coin type, returning errors if invalid. -// This returns an error on an empty string as well. -func ParseCoin(coinStr string) (coin Coin, err error) { - coinStr = strings.TrimSpace(coinStr) - - matches := reCoin.FindStringSubmatch(coinStr) - if matches == nil { - return Coin{}, fmt.Errorf("invalid coin expression: %s", coinStr) - } - - denomStr, amountStr := matches[2], matches[1] - - amount, ok := NewIntFromString(amountStr) - if !ok { - return Coin{}, fmt.Errorf("failed to parse coin amount: %s", amountStr) - } - - if err := ValidateDenom(denomStr); err != nil { - return Coin{}, fmt.Errorf("invalid denom cannot contain upper case characters or spaces: %s", err) - } - - return NewCoin(denomStr, amount), nil -} - -// ParseCoins will parse out a list of coins separated by commas. -// If nothing is provided, it returns nil Coins. -// Returned coins are sorted. -func ParseCoins(coinsStr string) (Coins, error) { - coinsStr = strings.TrimSpace(coinsStr) - if len(coinsStr) == 0 { - return nil, nil - } - - coinStrs := strings.Split(coinsStr, ",") - coins := make(Coins, len(coinStrs)) - for i, coinStr := range coinStrs { - coin, err := ParseCoin(coinStr) - if err != nil { - return nil, err - } - - coins[i] = coin - } - - // sort coins for determinism - coins.Sort() - - // validate coins before returning - if !coins.IsValid() { - return nil, fmt.Errorf("parseCoins invalid: %#v", coins) - } - - return coins, nil -} - -type findDupDescriptor interface { - GetDenomByIndex(int) string - Len() int -} - -// findDup works on the assumption that coins is sorted -func findDup(coins findDupDescriptor) int { - if coins.Len() <= 1 { - return -1 - } - - prevDenom := coins.GetDenomByIndex(0) - for i := 1; i < coins.Len(); i++ { - if coins.GetDenomByIndex(i) == prevDenom { - return i - } - prevDenom = coins.GetDenomByIndex(i) - } - - return -1 -} diff --git a/types/coin.pb.go b/types/coin.pb.go deleted file mode 100644 index c736c7ea..00000000 --- a/types/coin.pb.go +++ /dev/null @@ -1,978 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/v1beta1/coin.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// Coin defines a token with a denomination and an amount. -// -// NOTE: The amount field is an Int which implements the custom method -// signatures required by gogoproto. -type Coin struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Amount Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` -} - -func (m *Coin) Reset() { *m = Coin{} } -func (*Coin) ProtoMessage() {} -func (*Coin) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{0} -} -func (m *Coin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Coin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Coin.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 *Coin) XXX_Merge(src proto.Message) { - xxx_messageInfo_Coin.Merge(m, src) -} -func (m *Coin) XXX_Size() int { - return m.Size() -} -func (m *Coin) XXX_DiscardUnknown() { - xxx_messageInfo_Coin.DiscardUnknown(m) -} - -var xxx_messageInfo_Coin proto.InternalMessageInfo - -func (m *Coin) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// DecCoin defines a token with a denomination and a decimal amount. -// -// NOTE: The amount field is an Dec which implements the custom method -// signatures required by gogoproto. -type DecCoin struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Amount Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Dec" json:"amount"` -} - -func (m *DecCoin) Reset() { *m = DecCoin{} } -func (*DecCoin) ProtoMessage() {} -func (*DecCoin) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{1} -} -func (m *DecCoin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DecCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DecCoin.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 *DecCoin) XXX_Merge(src proto.Message) { - xxx_messageInfo_DecCoin.Merge(m, src) -} -func (m *DecCoin) XXX_Size() int { - return m.Size() -} -func (m *DecCoin) XXX_DiscardUnknown() { - xxx_messageInfo_DecCoin.DiscardUnknown(m) -} - -var xxx_messageInfo_DecCoin proto.InternalMessageInfo - -func (m *DecCoin) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// IntProto defines a Protobuf wrapper around an Int object. -type IntProto struct { - Int Int `protobuf:"bytes,1,opt,name=int,proto3,customtype=Int" json:"int"` -} - -func (m *IntProto) Reset() { *m = IntProto{} } -func (*IntProto) ProtoMessage() {} -func (*IntProto) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{2} -} -func (m *IntProto) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IntProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IntProto.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 *IntProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_IntProto.Merge(m, src) -} -func (m *IntProto) XXX_Size() int { - return m.Size() -} -func (m *IntProto) XXX_DiscardUnknown() { - xxx_messageInfo_IntProto.DiscardUnknown(m) -} - -var xxx_messageInfo_IntProto proto.InternalMessageInfo - -// DecProto defines a Protobuf wrapper around a Dec object. -type DecProto struct { - Dec Dec `protobuf:"bytes,1,opt,name=dec,proto3,customtype=Dec" json:"dec"` -} - -func (m *DecProto) Reset() { *m = DecProto{} } -func (*DecProto) ProtoMessage() {} -func (*DecProto) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{3} -} -func (m *DecProto) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DecProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DecProto.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 *DecProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_DecProto.Merge(m, src) -} -func (m *DecProto) XXX_Size() int { - return m.Size() -} -func (m *DecProto) XXX_DiscardUnknown() { - xxx_messageInfo_DecProto.DiscardUnknown(m) -} - -var xxx_messageInfo_DecProto proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Coin)(nil), "cosmos.base.v1beta1.Coin") - proto.RegisterType((*DecCoin)(nil), "cosmos.base.v1beta1.DecCoin") - proto.RegisterType((*IntProto)(nil), "cosmos.base.v1beta1.IntProto") - proto.RegisterType((*DecProto)(nil), "cosmos.base.v1beta1.DecProto") -} - -func init() { proto.RegisterFile("cosmos/base/v1beta1/coin.proto", fileDescriptor_189a96714eafc2df) } - -var fileDescriptor_189a96714eafc2df = []byte{ - // 272 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, - 0x4f, 0xce, 0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xeb, 0x81, - 0xe4, 0xf5, 0xa0, 0xf2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x79, 0x7d, 0x10, 0x0b, 0xa2, - 0x54, 0xc9, 0x9d, 0x8b, 0xc5, 0x39, 0x3f, 0x33, 0x4f, 0x48, 0x84, 0x8b, 0x35, 0x25, 0x35, 0x2f, - 0x3f, 0x57, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc2, 0x11, 0x52, 0xe6, 0x62, 0x4b, 0xcc, - 0xcd, 0x2f, 0xcd, 0x2b, 0x91, 0x60, 0x02, 0x09, 0x3b, 0x71, 0x9f, 0xb8, 0x27, 0xcf, 0x70, 0xeb, - 0x9e, 0x3c, 0xb3, 0x67, 0x5e, 0x49, 0x10, 0x54, 0xca, 0x8a, 0xe5, 0xc5, 0x02, 0x79, 0x46, 0x25, - 0x2f, 0x2e, 0x76, 0x97, 0xd4, 0x64, 0x72, 0xcc, 0x72, 0x49, 0x4d, 0x46, 0x33, 0x4b, 0x93, 0x8b, - 0xc3, 0x33, 0xaf, 0x24, 0x00, 0xec, 0x17, 0x59, 0x2e, 0xe6, 0xcc, 0xbc, 0x12, 0x88, 0x51, 0xa8, - 0xf6, 0x83, 0xc4, 0x41, 0x4a, 0x5d, 0x52, 0x93, 0xe1, 0x4a, 0x53, 0x52, 0x93, 0xd1, 0x95, 0x82, - 0x8c, 0x07, 0x89, 0x3b, 0x79, 0xde, 0x78, 0x28, 0xc7, 0xd0, 0xf0, 0x48, 0x8e, 0xe1, 0xc4, 0x23, - 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, - 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xd4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, - 0x92, 0xf3, 0x73, 0xf5, 0x33, 0x8b, 0x32, 0x8b, 0xf3, 0x52, 0x4b, 0xc0, 0x74, 0x46, 0x69, 0x92, - 0x6e, 0x71, 0x4a, 0xb6, 0x6e, 0x7a, 0xbe, 0x7e, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, - 0xf0, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x07, 0xb0, 0x96, 0x89, 0x01, 0x00, 0x00, -} - -func (this *Coin) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Coin) - if !ok { - that2, ok := that.(Coin) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if !this.Amount.Equal(that1.Amount) { - return false - } - return true -} -func (this *DecCoin) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*DecCoin) - if !ok { - that2, ok := that.(DecCoin) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if !this.Amount.Equal(that1.Amount) { - return false - } - return true -} -func (m *Coin) 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 *Coin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Coin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintCoin(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DecCoin) 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 *DecCoin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DecCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintCoin(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *IntProto) 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 *IntProto) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IntProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Int.Size() - i -= size - if _, err := m.Int.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DecProto) 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 *DecProto) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DecProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Dec.Size() - i -= size - if _, err := m.Dec.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintCoin(dAtA []byte, offset int, v uint64) int { - offset -= sovCoin(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Coin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovCoin(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func (m *DecCoin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovCoin(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func (m *IntProto) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Int.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func (m *DecProto) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Dec.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func sovCoin(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCoin(x uint64) (n int) { - return sovCoin(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Coin) 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 ErrIntOverflowCoin - } - 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: Coin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Coin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DecCoin) 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 ErrIntOverflowCoin - } - 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: DecCoin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DecCoin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IntProto) 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 ErrIntOverflowCoin - } - 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: IntProto: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IntProto: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Int.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DecProto) 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 ErrIntOverflowCoin - } - 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: DecProto: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DecProto: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dec", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Dec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCoin(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, ErrIntOverflowCoin - } - 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, ErrIntOverflowCoin - } - 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, ErrIntOverflowCoin - } - 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, ErrInvalidLengthCoin - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCoin - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCoin - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCoin = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCoin = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCoin = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/coin_type.go b/types/coin_type.go deleted file mode 100644 index fa869239..00000000 --- a/types/coin_type.go +++ /dev/null @@ -1,88 +0,0 @@ -package types - -import ( - "strings" -) - -type Unit struct { - Denom string `json:"denom"` //denom of unit - Scale uint8 `json:"scale"` //scale of unit -} - -func NewUnit(denom string, scale uint8) Unit { - return Unit{ - Denom: denom, - Scale: scale, - } -} - -//GetScaleFactor return 1 * 10^scale -func (u Unit) GetScaleFactor() Int { - return NewIntWithDecimal(1, int(u.Scale)) -} - -type CoinType struct { - Name string `json:"name"` //description name of CoinType - MinUnit Unit `json:"min_unit"` //the min unit of CoinType - MainUnit Unit `json:"main_unit"` //the max unit of CoinType - Desc string `json:"desc"` //the description of CoinType -} - -//ToMainCoin return the main denom coin from args -func (ct CoinType) ConvertToMainCoin(coin Coin) (DecCoin, error) { - if !ct.hasUnit(coin.Denom) { - return DecCoin{ - Amount: NewDecFromInt(coin.Amount), - Denom: coin.Denom, - }, nil - //return DecCoin{}, errors.New("coinType unit (%s) not defined" + coin.Denom) - } - - if ct.isMainUnit(coin.Denom) { - return DecCoin{}, nil - } - - // dest amount = src amount * (10^(dest scale) / 10^(src scale)) - dstScale := NewDecFromInt(ct.MainUnit.GetScaleFactor()) - srcScale := NewDecFromInt(ct.MinUnit.GetScaleFactor()) - amount := NewDecFromInt(coin.Amount) - - amt := amount.Mul(dstScale).Quo(srcScale) - return NewDecCoinFromDec(ct.MainUnit.Denom, amt), nil -} - -//ToMinCoin return the min denom coin from args -func (ct CoinType) ConvertToMinCoin(coin DecCoin) (newCoin Coin, err error) { - if !ct.hasUnit(coin.Denom) { - return Coin{ - Amount: coin.Amount.TruncateInt(), - Denom: coin.Denom, - }, nil - //return newCoin, errors.New("coinType unit (%s) not defined" + coin.Denom) - } - - if ct.isMinUnit(coin.Denom) { - newCoin, _ := coin.TruncateDecimal() - return newCoin, nil - } - - // dest amount = src amount * (10^(dest scale) / 10^(src scale)) - srcScale := NewDecFromInt(ct.MainUnit.GetScaleFactor()) - dstScale := NewDecFromInt(ct.MinUnit.GetScaleFactor()) - amount := coin.Amount - - amt := amount.Mul(dstScale).Quo(srcScale) - return NewCoin(ct.MinUnit.Denom, amt.RoundInt()), nil -} - -func (ct CoinType) isMainUnit(name string) bool { - return ct.MainUnit.Denom == strings.TrimSpace(name) -} - -func (ct CoinType) isMinUnit(name string) bool { - return ct.MinUnit.Denom == strings.TrimSpace(name) -} - -func (ct CoinType) hasUnit(name string) bool { - return ct.isMainUnit(name) || ct.isMinUnit(name) -} diff --git a/types/config.go b/types/config.go deleted file mode 100644 index c9a6a349..00000000 --- a/types/config.go +++ /dev/null @@ -1,228 +0,0 @@ -package types - -import ( - "fmt" - "os" - - "github.com/irisnet/irishub-sdk-go/types/store" -) - -const ( - defaultGas = 200000 - defaultFees = "4iris" - defaultTimeout = 5 - defaultLevel = "info" - defaultMaxTxsBytes = 1073741824 - defaultAlgo = "secp256k1" - defaultMode = Sync - defaultPath = "$HOME/irishub-sdk-go/leveldb" - defaultGasAdjustment = 1.0 -) - -type ClientConfig struct { - // irishub node rpc address - NodeURI string - - // irishub grpc address - GRPCAddr string - - // irishub chain-id - ChainID string - - // max gas limit - Gas uint64 - - // Fee amount of point - Fee DecCoins - - // PrivKeyArmor DAO Implements - KeyDAO store.KeyDAO - - // Private key generation algorithm(sm2,secp256k1) - Algo string - - // Transaction broadcast Mode - Mode BroadcastMode - - //Transaction broadcast timeout(seconds) - Timeout uint - - //log level(trace|debug|info|warn|error|fatal|panic) - Level string - - //maximum bytes of a transaction - MaxTxBytes uint64 - - //adjustment factor to be multiplied against the estimate returned by the tx simulation; - GasAdjustment float64 - - //whether to enable caching - Cached bool -} - -func NewClientConfig(uri, grpcAddr, chainID string, options ...Option) (ClientConfig, error) { - cfg := ClientConfig{ - NodeURI: uri, - ChainID: chainID, - GRPCAddr: grpcAddr, - } - for _, optionFn := range options { - if err := optionFn(&cfg); err != nil { - return ClientConfig{}, err - } - } - - if err := cfg.checkAndSetDefault(); err != nil { - return ClientConfig{}, err - } - return cfg, nil -} - -func (cfg *ClientConfig) checkAndSetDefault() error { - if len(cfg.NodeURI) == 0 { - return fmt.Errorf("nodeURI is required") - } - - if len(cfg.ChainID) == 0 { - return fmt.Errorf("chainID is required") - } - - if err := GasOption(cfg.Gas)(cfg); err != nil { - return err - } - - if err := FeeOption(cfg.Fee)(cfg); err != nil { - return err - } - - if err := AlgoOption(cfg.Algo)(cfg); err != nil { - return err - } - - if err := KeyDAOOption(cfg.KeyDAO)(cfg); err != nil { - return err - } - - if err := ModeOption(cfg.Mode)(cfg); err != nil { - return err - } - - if err := TimeoutOption(cfg.Timeout)(cfg); err != nil { - return err - } - - if err := LevelOption(cfg.Level)(cfg); err != nil { - return err - } - - if err := MaxTxBytesOption(cfg.MaxTxBytes)(cfg); err != nil { - return err - } - - return GasAdjustmentOption(cfg.GasAdjustment)(cfg) -} - -type Option func(cfg *ClientConfig) error - -func FeeOption(fee DecCoins) Option { - return func(cfg *ClientConfig) error { - if fee == nil || fee.Empty() || !fee.IsValid() { - fees, _ := ParseDecCoins(defaultFees) - fee = fees - } - cfg.Fee = fee - return nil - } -} - -func KeyDAOOption(dao store.KeyDAO) Option { - return func(cfg *ClientConfig) error { - if dao == nil { - defaultPath := os.ExpandEnv(defaultPath) - levelDB, err := store.NewLevelDB(defaultPath, nil) - if err != nil { - return err - } - dao = levelDB - } - cfg.KeyDAO = dao - return nil - } -} - -func GasOption(gas uint64) Option { - return func(cfg *ClientConfig) error { - if gas <= 0 { - gas = defaultGas - } - cfg.Gas = gas - return nil - } -} - -func AlgoOption(algo string) Option { - return func(cfg *ClientConfig) error { - if algo == "" { - algo = defaultAlgo - } - cfg.Algo = algo - return nil - } -} - -func ModeOption(mode BroadcastMode) Option { - return func(cfg *ClientConfig) error { - if mode == "" { - mode = defaultMode - } - cfg.Mode = mode - return nil - } -} - -func TimeoutOption(timeout uint) Option { - return func(cfg *ClientConfig) error { - if timeout <= 0 { - timeout = defaultTimeout - } - cfg.Timeout = timeout - return nil - } -} - -func LevelOption(level string) Option { - return func(cfg *ClientConfig) error { - if level == "" { - level = defaultLevel - } - cfg.Level = level - return nil - } -} - -func MaxTxBytesOption(maxTxBytes uint64) Option { - return func(cfg *ClientConfig) error { - if maxTxBytes <= 0 { - maxTxBytes = defaultMaxTxsBytes - } - cfg.MaxTxBytes = maxTxBytes - return nil - } -} - -func GasAdjustmentOption(gasAdjustment float64) Option { - return func(cfg *ClientConfig) error { - if gasAdjustment <= 0 { - gasAdjustment = defaultGasAdjustment - } - cfg.GasAdjustment = gasAdjustment - return nil - } -} - -func CachedOption(enabled bool) Option { - return func(cfg *ClientConfig) error { - cfg.Cached = enabled - return nil - } -} diff --git a/types/dec.go b/types/dec.go deleted file mode 100644 index 947ed328..00000000 --- a/types/dec.go +++ /dev/null @@ -1,797 +0,0 @@ -package types - -import ( - "encoding/json" - "errors" - "fmt" - "math/big" - "strconv" - "strings" - "testing" -) - -// NOTE: never use new(Dec) or else we will panic unmarshalling into the -// nil embedded big.Int -type Dec struct { - i *big.Int -} - -const ( - // number of decimal places - Precision = 18 - - // bytes required to represent the above precision - // Ceiling[Log2[999 999 999 999 999 999]] - DecimalPrecisionBits = 60 - - // max number of iterations in ApproxRoot function - maxApproxRootIterations = 100 -) - -var ( - precisionReuse = new(big.Int).Exp(big.NewInt(10), big.NewInt(Precision), nil) - fivePrecision = new(big.Int).Quo(precisionReuse, big.NewInt(2)) - precisionMultipliers []*big.Int - zeroInt = big.NewInt(0) - oneInt = big.NewInt(1) - tenInt = big.NewInt(10) -) - -// Decimal errors -var ( - ErrEmptyDecimalStr = errors.New("decimal string cannot be empty") - ErrInvalidDecimalLength = errors.New("invalid decimal length") - ErrInvalidDecimalStr = errors.New("invalid decimal string") -) - -// Set precision multipliers -func init() { - precisionMultipliers = make([]*big.Int, Precision+1) - for i := 0; i <= Precision; i++ { - precisionMultipliers[i] = calcPrecisionMultiplier(int64(i)) - } -} - -func precisionInt() *big.Int { - return new(big.Int).Set(precisionReuse) -} - -func ZeroDec() Dec { return Dec{new(big.Int).Set(zeroInt)} } -func OneDec() Dec { return Dec{precisionInt()} } -func SmallestDec() Dec { return Dec{new(big.Int).Set(oneInt)} } - -// calculate the precision multiplier -func calcPrecisionMultiplier(prec int64) *big.Int { - if prec > Precision { - panic(fmt.Sprintf("too much precision, maximum %v, provided %v", Precision, prec)) - } - zerosToAdd := Precision - prec - multiplier := new(big.Int).Exp(tenInt, big.NewInt(zerosToAdd), nil) - return multiplier -} - -// get the precision multiplier, do not mutate result -func precisionMultiplier(prec int64) *big.Int { - if prec > Precision { - panic(fmt.Sprintf("too much precision, maximum %v, provided %v", Precision, prec)) - } - return precisionMultipliers[prec] -} - -// ______________________________________________________________________________________________ - -// create a new Dec from integer assuming whole number -func NewDec(i int64) Dec { - return NewDecWithPrec(i, 0) -} - -// create a new Dec from integer with decimal place at prec -// CONTRACT: prec <= Precision -func NewDecWithPrec(i, prec int64) Dec { - return Dec{ - new(big.Int).Mul(big.NewInt(i), precisionMultiplier(prec)), - } -} - -// create a new Dec from big integer assuming whole numbers -// CONTRACT: prec <= Precision -func NewDecFromBigInt(i *big.Int) Dec { - return NewDecFromBigIntWithPrec(i, 0) -} - -// create a new Dec from big integer assuming whole numbers -// CONTRACT: prec <= Precision -func NewDecFromBigIntWithPrec(i *big.Int, prec int64) Dec { - return Dec{ - new(big.Int).Mul(i, precisionMultiplier(prec)), - } -} - -// create a new Dec from big integer assuming whole numbers -// CONTRACT: prec <= Precision -func NewDecFromInt(i Int) Dec { - return NewDecFromIntWithPrec(i, 0) -} - -// create a new Dec from big integer with decimal place at prec -// CONTRACT: prec <= Precision -func NewDecFromIntWithPrec(i Int, prec int64) Dec { - return Dec{ - new(big.Int).Mul(i.BigInt(), precisionMultiplier(prec)), - } -} - -// create a decimal from an input decimal string. -// valid must come in the form: -// (-) whole integers (.) decimal integers -// examples of acceptable input include: -// -123.456 -// 456.7890 -// 345 -// -456789 -// -// NOTE - An error will return if more decimal places -// are provided in the string than the constant Precision. -// -// CONTRACT - This function does not mutate the input str. -func NewDecFromStr(str string) (Dec, error) { - if len(str) == 0 { - return Dec{}, ErrEmptyDecimalStr - } - - // first extract any negative symbol - neg := false - if str[0] == '-' { - neg = true - str = str[1:] - } - - if len(str) == 0 { - return Dec{}, ErrEmptyDecimalStr - } - - strs := strings.Split(str, ".") - lenDecs := 0 - combinedStr := strs[0] - - if len(strs) == 2 { // has a decimal place - lenDecs = len(strs[1]) - if lenDecs == 0 || len(combinedStr) == 0 { - return Dec{}, ErrInvalidDecimalLength - } - combinedStr += strs[1] - } else if len(strs) > 2 { - return Dec{}, ErrInvalidDecimalStr - } - - if lenDecs > Precision { - return Dec{}, fmt.Errorf("invalid precision; max: %d, got: %d", Precision, lenDecs) - } - - // add some extra zero's to correct to the Precision factor - zerosToAdd := Precision - lenDecs - zeros := fmt.Sprintf(`%0`+strconv.Itoa(zerosToAdd)+`s`, "") - combinedStr += zeros - - combined, ok := new(big.Int).SetString(combinedStr, 10) // base 10 - if !ok { - return Dec{}, fmt.Errorf("failed to set decimal string: %s", combinedStr) - } - if neg { - combined = new(big.Int).Neg(combined) - } - - return Dec{combined}, nil -} - -// Decimal from string, panic on error -func MustNewDecFromStr(s string) Dec { - dec, err := NewDecFromStr(s) - if err != nil { - panic(err) - } - return dec -} - -// ______________________________________________________________________________________________ -//nolint -func (d Dec) IsNil() bool { return d.i == nil } // is decimal nil -func (d Dec) IsZero() bool { return (d.i).Sign() == 0 } // is equal to zero -func (d Dec) IsNegative() bool { return (d.i).Sign() == -1 } // is negative -func (d Dec) IsPositive() bool { return (d.i).Sign() == 1 } // is positive -func (d Dec) Equal(d2 Dec) bool { return (d.i).Cmp(d2.i) == 0 } // equal decimals -func (d Dec) GT(d2 Dec) bool { return (d.i).Cmp(d2.i) > 0 } // greater than -func (d Dec) GTE(d2 Dec) bool { return (d.i).Cmp(d2.i) >= 0 } // greater than or equal -func (d Dec) LT(d2 Dec) bool { return (d.i).Cmp(d2.i) < 0 } // less than -func (d Dec) LTE(d2 Dec) bool { return (d.i).Cmp(d2.i) <= 0 } // less than or equal -func (d Dec) Neg() Dec { return Dec{new(big.Int).Neg(d.i)} } // reverse the decimal sign -func (d Dec) Abs() Dec { return Dec{new(big.Int).Abs(d.i)} } // absolute value - -// BigInt returns a copy of the underlying big.Int. -func (d Dec) BigInt() *big.Int { - if d.IsNil() { - return nil - } - - copy := new(big.Int) - return copy.Set(d.i) -} - -// addition -func (d Dec) Add(d2 Dec) Dec { - res := new(big.Int).Add(d.i, d2.i) - - if res.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{res} -} - -// subtraction -func (d Dec) Sub(d2 Dec) Dec { - res := new(big.Int).Sub(d.i, d2.i) - - if res.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{res} -} - -// multiplication -func (d Dec) Mul(d2 Dec) Dec { - mul := new(big.Int).Mul(d.i, d2.i) - chopped := chopPrecisionAndRound(mul) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// multiplication truncate -func (d Dec) MulTruncate(d2 Dec) Dec { - mul := new(big.Int).Mul(d.i, d2.i) - chopped := chopPrecisionAndTruncate(mul) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// multiplication -func (d Dec) MulInt(i Int) Dec { - mul := new(big.Int).Mul(d.i, i.i) - - if mul.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{mul} -} - -// MulInt64 - multiplication with int64 -func (d Dec) MulInt64(i int64) Dec { - mul := new(big.Int).Mul(d.i, big.NewInt(i)) - - if mul.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{mul} -} - -// quotient -func (d Dec) Quo(d2 Dec) Dec { - // multiply precision twice - mul := new(big.Int).Mul(d.i, precisionReuse) - mul.Mul(mul, precisionReuse) - - quo := new(big.Int).Quo(mul, d2.i) - chopped := chopPrecisionAndRound(quo) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// quotient truncate -func (d Dec) QuoTruncate(d2 Dec) Dec { - // multiply precision twice - mul := new(big.Int).Mul(d.i, precisionReuse) - mul.Mul(mul, precisionReuse) - - quo := new(big.Int).Quo(mul, d2.i) - chopped := chopPrecisionAndTruncate(quo) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// quotient, round up -func (d Dec) QuoRoundUp(d2 Dec) Dec { - // multiply precision twice - mul := new(big.Int).Mul(d.i, precisionReuse) - mul.Mul(mul, precisionReuse) - - quo := new(big.Int).Quo(mul, d2.i) - chopped := chopPrecisionAndRoundUp(quo) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// quotient -func (d Dec) QuoInt(i Int) Dec { - mul := new(big.Int).Quo(d.i, i.i) - return Dec{mul} -} - -// QuoInt64 - quotient with int64 -func (d Dec) QuoInt64(i int64) Dec { - mul := new(big.Int).Quo(d.i, big.NewInt(i)) - return Dec{mul} -} - -// ApproxRoot returns an approximate estimation of a Dec's positive real nth root -// using Newton's method (where n is positive). The algorithm starts with some guess and -// computes the sequence of improved guesses until an answer converges to an -// approximate answer. It returns `|d|.ApproxRoot() * -1` if input is negative. -// A maximum number of 100 iterations is used a backup boundary condition for -// cases where the answer never converges enough to satisfy the main condition. -func (d Dec) ApproxRoot(root uint64) (guess Dec, err error) { - defer func() { - if r := recover(); r != nil { - var ok bool - err, ok = r.(error) - if !ok { - err = errors.New("out of bounds") - } - } - }() - - if d.IsNegative() { - absRoot, err := d.MulInt64(-1).ApproxRoot(root) - return absRoot.MulInt64(-1), err - } - - if root == 1 || d.IsZero() || d.Equal(OneDec()) { - return d, nil - } - - if root == 0 { - return OneDec(), nil - } - - rootInt := NewIntFromUint64(root) - guess, delta := OneDec(), OneDec() - - for iter := 0; delta.Abs().GT(SmallestDec()) && iter < maxApproxRootIterations; iter++ { - prev := guess.Power(root - 1) - if prev.IsZero() { - prev = SmallestDec() - } - delta = d.Quo(prev) - delta = delta.Sub(guess) - delta = delta.QuoInt(rootInt) - - guess = guess.Add(delta) - } - - return guess, nil -} - -// Power returns a the result of raising to a positive integer power -func (d Dec) Power(power uint64) Dec { - if power == 0 { - return OneDec() - } - tmp := OneDec() - - for i := power; i > 1; { - if i%2 == 0 { - i /= 2 - } else { - tmp = tmp.Mul(d) - i = (i - 1) / 2 - } - d = d.Mul(d) - } - - return d.Mul(tmp) -} - -// ApproxSqrt is a wrapper around ApproxRoot for the common special case -// of finding the square root of a number. It returns -(sqrt(abs(d)) if input is negative. -func (d Dec) ApproxSqrt() (Dec, error) { - return d.ApproxRoot(2) -} - -// is integer, e.g. decimals are zero -func (d Dec) IsInteger() bool { - return new(big.Int).Rem(d.i, precisionReuse).Sign() == 0 -} - -// format decimal state -func (d Dec) Format(s fmt.State, verb rune) { - _, err := s.Write([]byte(d.String())) - if err != nil { - panic(err) - } -} - -func (d Dec) String() string { - if d.i == nil { - return d.i.String() - } - - isNeg := d.IsNegative() - - if isNeg { - d = d.Neg() - } - - bzInt, err := d.i.MarshalText() - if err != nil { - return "" - } - inputSize := len(bzInt) - - var bzStr []byte - - // TODO: Remove trailing zeros - // case 1, purely decimal - if inputSize <= Precision { - bzStr = make([]byte, Precision+2) - - // 0. prefix - bzStr[0] = byte('0') - bzStr[1] = byte('.') - - // set relevant digits to 0 - for i := 0; i < Precision-inputSize; i++ { - bzStr[i+2] = byte('0') - } - - // set final digits - copy(bzStr[2+(Precision-inputSize):], bzInt) - } else { - // inputSize + 1 to account for the decimal point that is being added - bzStr = make([]byte, inputSize+1) - decPointPlace := inputSize - Precision - - copy(bzStr, bzInt[:decPointPlace]) // pre-decimal digits - bzStr[decPointPlace] = byte('.') // decimal point - copy(bzStr[decPointPlace+1:], bzInt[decPointPlace:]) // post-decimal digits - } - - if isNeg { - return "-" + string(bzStr) - } - - return string(bzStr) -} - -// ____ -// __| |__ "chop 'em -// ` \ round!" -// ___|| ~ _ -bankers -// | | __ -// | | | __|__|__ -// |_____: / | $$$ | -// |________| - -// Remove a Precision amount of rightmost digits and perform bankers rounding -// on the remainder (gaussian rounding) on the digits which have been removed. -// -// Mutates the input. Use the non-mutative version if that is undesired -func chopPrecisionAndRound(d *big.Int) *big.Int { - // remove the negative and add it back when returning - if d.Sign() == -1 { - // make d positive, compute chopped value, and then un-mutate d - d = d.Neg(d) - d = chopPrecisionAndRound(d) - d = d.Neg(d) - return d - } - - // get the truncated quotient and remainder - quo, rem := d, big.NewInt(0) - quo, rem = quo.QuoRem(d, precisionReuse, rem) - - if rem.Sign() == 0 { // remainder is zero - return quo - } - - switch rem.Cmp(fivePrecision) { - case -1: - return quo - case 1: - return quo.Add(quo, oneInt) - default: // bankers rounding must take place - // always round to an even number - if quo.Bit(0) == 0 { - return quo - } - return quo.Add(quo, oneInt) - } -} - -func chopPrecisionAndRoundUp(d *big.Int) *big.Int { - // remove the negative and add it back when returning - if d.Sign() == -1 { - // make d positive, compute chopped value, and then un-mutate d - d = d.Neg(d) - // truncate since d is negative... - d = chopPrecisionAndTruncate(d) - d = d.Neg(d) - return d - } - - // get the truncated quotient and remainder - quo, rem := d, big.NewInt(0) - quo, rem = quo.QuoRem(d, precisionReuse, rem) - - if rem.Sign() == 0 { // remainder is zero - return quo - } - - return quo.Add(quo, oneInt) -} - -func chopPrecisionAndRoundNonMutative(d *big.Int) *big.Int { - tmp := new(big.Int).Set(d) - return chopPrecisionAndRound(tmp) -} - -// RoundInt64 rounds the decimal using bankers rounding -func (d Dec) RoundInt64() int64 { - chopped := chopPrecisionAndRoundNonMutative(d.i) - if !chopped.IsInt64() { - panic("Int64() out of bound") - } - return chopped.Int64() -} - -// RoundInt round the decimal using bankers rounding -func (d Dec) RoundInt() Int { - return NewIntFromBigInt(chopPrecisionAndRoundNonMutative(d.i)) -} - -// ___________________________________________________________________________________ - -// similar to chopPrecisionAndRound, but always rounds down -func chopPrecisionAndTruncate(d *big.Int) *big.Int { - return d.Quo(d, precisionReuse) -} - -func chopPrecisionAndTruncateNonMutative(d *big.Int) *big.Int { - tmp := new(big.Int).Set(d) - return chopPrecisionAndTruncate(tmp) -} - -// TruncateInt64 truncates the decimals from the number and returns an int64 -func (d Dec) TruncateInt64() int64 { - chopped := chopPrecisionAndTruncateNonMutative(d.i) - if !chopped.IsInt64() { - panic("Int64() out of bound") - } - return chopped.Int64() -} - -// TruncateInt truncates the decimals from the number and returns an Int -func (d Dec) TruncateInt() Int { - return NewIntFromBigInt(chopPrecisionAndTruncateNonMutative(d.i)) -} - -// TruncateDec truncates the decimals from the number and returns a Dec -func (d Dec) TruncateDec() Dec { - return NewDecFromBigInt(chopPrecisionAndTruncateNonMutative(d.i)) -} - -// Ceil returns the smallest interger value (as a decimal) that is greater than -// or equal to the given decimal. -func (d Dec) Ceil() Dec { - tmp := new(big.Int).Set(d.i) - - quo, rem := tmp, big.NewInt(0) - quo, rem = quo.QuoRem(tmp, precisionReuse, rem) - - // no need to round with a zero remainder regardless of sign - if rem.Cmp(zeroInt) == 0 { - return NewDecFromBigInt(quo) - } - - if rem.Sign() == -1 { - return NewDecFromBigInt(quo) - } - - return NewDecFromBigInt(quo.Add(quo, oneInt)) -} - -// ___________________________________________________________________________________ - -// MaxSortableDec is the largest Dec that can be passed into SortableDecBytes() -// Its negative form is the least Dec that can be passed in. -var MaxSortableDec = OneDec().Quo(SmallestDec()) - -// ValidSortableDec ensures that a Dec is within the sortable bounds, -// a Dec can't have a precision of less than 10^-18. -// Max sortable decimal was set to the reciprocal of SmallestDec. -func ValidSortableDec(dec Dec) bool { - return dec.Abs().LTE(MaxSortableDec) -} - -// SortableDecBytes returns a byte slice representation of a Dec that can be sorted. -// Left and right pads with 0s so there are 18 digits to left and right of the decimal point. -// For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec. -func SortableDecBytes(dec Dec) []byte { - if !ValidSortableDec(dec) { - panic("dec must be within bounds") - } - // Instead of adding an extra byte to all sortable decs in order to handle max sortable, we just - // makes its bytes be "max" which comes after all numbers in ASCIIbetical order - if dec.Equal(MaxSortableDec) { - return []byte("max") - } - // For the same reason, we make the bytes of minimum sortable dec be --, which comes before all numbers. - if dec.Equal(MaxSortableDec.Neg()) { - return []byte("--") - } - // We move the negative sign to the front of all the left padded 0s, to make negative numbers come before positive numbers - if dec.IsNegative() { - return append([]byte("-"), []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", Precision*2+1), dec.Abs().String()))...) - } - return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", Precision*2+1), dec.String())) -} - -// ___________________________________________________________________________________ - -// reuse nil values -var nilJSON []byte - -func init() { - empty := new(big.Int) - bz, _ := empty.MarshalText() - nilJSON, _ = json.Marshal(string(bz)) -} - -// MarshalJSON marshals the decimal -func (d Dec) MarshalJSON() ([]byte, error) { - if d.i == nil { - return nilJSON, nil - } - return json.Marshal(d.String()) -} - -// UnmarshalJSON defines custom decoding scheme -func (d *Dec) UnmarshalJSON(bz []byte) error { - if d.i == nil { - d.i = new(big.Int) - } - - var text string - err := json.Unmarshal(bz, &text) - if err != nil { - return err - } - - // TODO: Reuse dec allocation - newDec, err := NewDecFromStr(text) - if err != nil { - return err - } - - d.i = newDec.i - return nil -} - -// MarshalYAML returns the YAML representation. -func (d Dec) MarshalYAML() (interface{}, error) { - return d.String(), nil -} - -// Marshal implements the gogo proto custom type interface. -func (d Dec) Marshal() ([]byte, error) { - if d.i == nil { - d.i = new(big.Int) - } - return d.i.MarshalText() -} - -// MarshalTo implements the gogo proto custom type interface. -func (d *Dec) MarshalTo(data []byte) (n int, err error) { - if d.i == nil { - d.i = new(big.Int) - } - - if d.i.Cmp(zeroInt) == 0 { - copy(data, []byte{0x30}) - return 1, nil - } - - bz, err := d.Marshal() - if err != nil { - return 0, err - } - - copy(data, bz) - return len(bz), nil -} - -// Unmarshal implements the gogo proto custom type interface. -func (d *Dec) Unmarshal(data []byte) error { - if len(data) == 0 { - d = nil - return nil - } - - if d.i == nil { - d.i = new(big.Int) - } - - if err := d.i.UnmarshalText(data); err != nil { - return err - } - - if d.i.BitLen() > maxBitLen { - return fmt.Errorf("decimal out of range; got: %d, max: %d", d.i.BitLen(), maxBitLen) - } - - return nil -} - -// Size implements the gogo proto custom type interface. -func (d *Dec) Size() int { - bz, _ := d.Marshal() - return len(bz) -} - -// Override Amino binary serialization by proxying to protobuf. -func (d Dec) MarshalAmino() ([]byte, error) { return d.Marshal() } -func (d *Dec) UnmarshalAmino(bz []byte) error { return d.Unmarshal(bz) } - -func (dp DecProto) String() string { - return dp.Dec.String() -} - -// ___________________________________________________________________________________ -// helpers - -// test if two decimal arrays are equal -func DecsEqual(d1s, d2s []Dec) bool { - if len(d1s) != len(d2s) { - return false - } - - for i, d1 := range d1s { - if !d1.Equal(d2s[i]) { - return false - } - } - return true -} - -// minimum decimal between two -func MinDec(d1, d2 Dec) Dec { - if d1.LT(d2) { - return d1 - } - return d2 -} - -// maximum decimal between two -func MaxDec(d1, d2 Dec) Dec { - if d1.LT(d2) { - return d2 - } - return d1 -} - -// intended to be used with require/assert: require.True(DecEq(...)) -func DecEq(t *testing.T, exp, got Dec) (*testing.T, bool, string, string, string) { - return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} diff --git a/types/dec_coin.go b/types/dec_coin.go deleted file mode 100644 index 54920581..00000000 --- a/types/dec_coin.go +++ /dev/null @@ -1,644 +0,0 @@ -package types - -import ( - "fmt" - "sort" - "strings" - - "github.com/pkg/errors" -) - -// Decimal Coin - -// NewDecCoin creates a new DecCoin instance from an Int. -func NewDecCoin(denom string, amount Int) DecCoin { - if err := validate(denom, amount); err != nil { - panic(err) - } - - return DecCoin{ - Denom: denom, - Amount: amount.ToDec(), - } -} - -// NewDecCoinFromDec creates a new DecCoin instance from a Dec. -func NewDecCoinFromDec(denom string, amount Dec) DecCoin { - mustValidateDenom(denom) - - if amount.IsNegative() { - panic(fmt.Sprintf("negative decimal coin amount: %v\n", amount)) - } - - return DecCoin{ - Denom: denom, - Amount: amount, - } -} - -// NewDecCoinFromCoin creates a new DecCoin from a Coin. -func NewDecCoinFromCoin(coin Coin) DecCoin { - if err := validate(coin.Denom, coin.Amount); err != nil { - panic(err) - } - - return DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.ToDec(), - } -} - -// NewInt64DecCoin returns a new DecCoin with a denomination and amount. It will -// panic if the amount is negative or denom is invalid. -func NewInt64DecCoin(denom string, amount int64) DecCoin { - return NewDecCoin(denom, NewInt(amount)) -} - -// IsZero returns if the DecCoin amount is zero. -func (coin DecCoin) IsZero() bool { - return coin.Amount.IsZero() -} - -// IsGTE returns true if they are the same type and the receiver is -// an equal or greater value. -func (coin DecCoin) IsGTE(other DecCoin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return !coin.Amount.LT(other.Amount) -} - -// IsLT returns true if they are the same type and the receiver is -// a smaller value. -func (coin DecCoin) IsLT(other DecCoin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.LT(other.Amount) -} - -// IsEqual returns true if the two sets of Coins have the same value. -func (coin DecCoin) IsEqual(other DecCoin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.Equal(other.Amount) -} - -// Add adds amounts of two decimal coins with same denom. -func (coin DecCoin) Add(coinB DecCoin) DecCoin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("coin denom different: %v %v\n", coin.Denom, coinB.Denom)) - } - return DecCoin{coin.Denom, coin.Amount.Add(coinB.Amount)} -} - -// Sub subtracts amounts of two decimal coins with same denom. -func (coin DecCoin) Sub(coinB DecCoin) DecCoin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("coin denom different: %v %v\n", coin.Denom, coinB.Denom)) - } - res := DecCoin{coin.Denom, coin.Amount.Sub(coinB.Amount)} - if res.IsNegative() { - panic("negative decimal coin amount") - } - return res -} - -// TruncateDecimal returns a Coin with a truncated decimal and a DecCoin for the -// change. Note, the change may be zero. -func (coin DecCoin) TruncateDecimal() (Coin, DecCoin) { - truncated := coin.Amount.TruncateInt() - change := coin.Amount.Sub(truncated.ToDec()) - return NewCoin(coin.Denom, truncated), NewDecCoinFromDec(coin.Denom, change) -} - -// IsPositive returns true if coin amount is positive. -// -// TODO: Remove once unsigned integers are used. -func (coin DecCoin) IsPositive() bool { - return coin.Amount.IsPositive() -} - -// IsNegative returns true if the coin amount is negative and false otherwise. -// -// TODO: Remove once unsigned integers are used. -func (coin DecCoin) IsNegative() bool { - return coin.Amount.IsNegative() -} - -// String implements the Stringer interface for DecCoin. It returns a -// human-readable representation of a decimal coin. -func (coin DecCoin) String() string { - return fmt.Sprintf("%v%v", coin.Amount, coin.Denom) -} - -// IsValid returns true if the DecCoin has a non-negative amount and the denom is vaild. -func (coin DecCoin) IsValid() bool { - if err := ValidateDenom(coin.Denom); err != nil { - return false - } - return !coin.IsNegative() -} - -// ---------------------------------------------------------------------------- -// Decimal Coins - -// DecCoins defines a slice of coins with decimal values -type DecCoins []DecCoin - -// NewDecCoins constructs a new coin set with with decimal values -// from DecCoins. -func NewDecCoins(decCoins ...DecCoin) DecCoins { - // remove zeroes - newDecCoins := removeZeroDecCoins(DecCoins(decCoins)) - if len(newDecCoins) == 0 { - return DecCoins{} - } - - newDecCoins.Sort() - - // detect duplicate Denoms - if dupIndex := findDup(newDecCoins); dupIndex != -1 { - panic(fmt.Errorf("find duplicate denom: %s", newDecCoins[dupIndex])) - } - - if !newDecCoins.IsValid() { - panic(fmt.Errorf("invalid coin set: %s", newDecCoins)) - } - - return newDecCoins -} - -// NewDecCoinsFromCoin constructs a new coin set with decimal values -// from regular Coins. -func NewDecCoinsFromCoins(coins ...Coin) DecCoins { - decCoins := make(DecCoins, len(coins)) - newCoins := NewCoins(coins...) - for i, coin := range newCoins { - decCoins[i] = NewDecCoinFromCoin(coin) - } - - return decCoins -} - -// String implements the Stringer interface for DecCoins. It returns a -// human-readable representation of decimal coins. -func (coins DecCoins) String() string { - if len(coins) == 0 { - return "" - } - - out := "" - for _, coin := range coins { - out += fmt.Sprintf("%v,", coin.String()) - } - - return out[:len(out)-1] -} - -// TruncateDecimal returns the coins with truncated decimals and returns the -// change. Note, it will not return any zero-amount coins in either the truncated or -// change coins. -func (coins DecCoins) TruncateDecimal() (truncatedCoins Coins, changeCoins DecCoins) { - for _, coin := range coins { - truncated, change := coin.TruncateDecimal() - if !truncated.IsZero() { - truncatedCoins = truncatedCoins.Add(truncated) - } - if !change.IsZero() { - changeCoins = changeCoins.Add(change) - } - } - - return truncatedCoins, changeCoins -} - -// Add adds two sets of DecCoins. -// -// NOTE: Add operates under the invariant that coins are sorted by -// denominations. -// -// CONTRACT: Add will never return Coins where one Coin has a non-positive -// amount. In otherwords, IsValid will always return true. -func (coins DecCoins) Add(coinsB ...DecCoin) DecCoins { - return coins.safeAdd(coinsB) -} - -// safeAdd will perform addition of two DecCoins sets. If both coin sets are -// empty, then an empty set is returned. If only a single set is empty, the -// other set is returned. Otherwise, the coins are compared in order of their -// denomination and addition only occurs when the denominations match, otherwise -// the coin is simply added to the sum assuming it's not zero. -func (coins DecCoins) safeAdd(coinsB DecCoins) DecCoins { - sum := ([]DecCoin)(nil) - indexA, indexB := 0, 0 - lenA, lenB := len(coins), len(coinsB) - - for { - if indexA == lenA { - if indexB == lenB { - // return nil coins if both sets are empty - return sum - } - - // return set B (excluding zero coins) if set A is empty - return append(sum, removeZeroDecCoins(coinsB[indexB:])...) - } else if indexB == lenB { - // return set A (excluding zero coins) if set B is empty - return append(sum, removeZeroDecCoins(coins[indexA:])...) - } - - coinA, coinB := coins[indexA], coinsB[indexB] - - switch strings.Compare(coinA.Denom, coinB.Denom) { - case -1: // coin A denom < coin B denom - if !coinA.IsZero() { - sum = append(sum, coinA) - } - - indexA++ - - case 0: // coin A denom == coin B denom - res := coinA.Add(coinB) - if !res.IsZero() { - sum = append(sum, res) - } - - indexA++ - indexB++ - - case 1: // coin A denom > coin B denom - if !coinB.IsZero() { - sum = append(sum, coinB) - } - - indexB++ - } - } -} - -// negative returns a set of coins with all amount negative. -func (coins DecCoins) negative() DecCoins { - res := make([]DecCoin, 0, len(coins)) - for _, coin := range coins { - res = append(res, DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.Neg(), - }) - } - return res -} - -// Sub subtracts a set of DecCoins from another (adds the inverse). -func (coins DecCoins) Sub(coinsB DecCoins) DecCoins { - diff, hasNeg := coins.SafeSub(coinsB) - if hasNeg { - panic("negative coin amount") - } - - return diff -} - -// SafeSub performs the same arithmetic as Sub but returns a boolean if any -// negative coin amount was returned. -func (coins DecCoins) SafeSub(coinsB DecCoins) (DecCoins, bool) { - diff := coins.safeAdd(coinsB.negative()) - return diff, diff.IsAnyNegative() -} - -// Intersect will return a new set of coins which contains the minimum DecCoin -// for common denoms found in both `coins` and `coinsB`. For denoms not common -// to both `coins` and `coinsB` the minimum is considered to be 0, thus they -// are not added to the final set.In other words, trim any denom amount from -// coin which exceeds that of coinB, such that (coin.Intersect(coinB)).IsLTE(coinB). -func (coins DecCoins) Intersect(coinsB DecCoins) DecCoins { - res := make([]DecCoin, len(coins)) - for i, coin := range coins { - minCoin := DecCoin{ - Denom: coin.Denom, - Amount: MinDec(coin.Amount, coinsB.AmountOf(coin.Denom)), - } - res[i] = minCoin - } - return removeZeroDecCoins(res) -} - -// GetDenomByIndex returns the Denom to make the findDup generic -func (coins DecCoins) GetDenomByIndex(i int) string { - return coins[i].Denom -} - -// IsAnyNegative returns true if there is at least one coin whose amount -// is negative; returns false otherwise. It returns false if the DecCoins set -// is empty too. -// -// TODO: Remove once unsigned integers are used. -func (coins DecCoins) IsAnyNegative() bool { - for _, coin := range coins { - if coin.IsNegative() { - return true - } - } - - return false -} - -// MulDec multiplies all the coins by a decimal. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) MulDec(d Dec) DecCoins { - var res DecCoins - for _, coin := range coins { - product := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.Mul(d), - } - - if !product.IsZero() { - res = res.Add(product) - } - } - - return res -} - -// MulDecTruncate multiplies all the decimal coins by a decimal, truncating. It -// panics if d is zero. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) MulDecTruncate(d Dec) DecCoins { - var res DecCoins - - for _, coin := range coins { - product := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.MulTruncate(d), - } - - if !product.IsZero() { - res = res.Add(product) - } - } - - return res -} - -// QuoDec divides all the decimal coins by a decimal. It panics if d is zero. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) QuoDec(d Dec) DecCoins { - if d.IsZero() { - panic("invalid zero decimal") - } - - var res DecCoins - for _, coin := range coins { - quotient := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.Quo(d), - } - - if !quotient.IsZero() { - res = res.Add(quotient) - } - } - - return res -} - -// QuoDecTruncate divides all the decimal coins by a decimal, truncating. It -// panics if d is zero. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) QuoDecTruncate(d Dec) DecCoins { - if d.IsZero() { - panic("invalid zero decimal") - } - - var res DecCoins - for _, coin := range coins { - quotient := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.QuoTruncate(d), - } - - if !quotient.IsZero() { - res = res.Add(quotient) - } - } - - return res -} - -// Empty returns true if there are no coins and false otherwise. -func (coins DecCoins) Empty() bool { - return len(coins) == 0 -} - -// AmountOf returns the amount of a denom from deccoins -func (coins DecCoins) AmountOf(denom string) Dec { - mustValidateDenom(denom) - - switch len(coins) { - case 0: - return ZeroDec() - - case 1: - coin := coins[0] - if coin.Denom == denom { - return coin.Amount - } - return ZeroDec() - - default: - midIdx := len(coins) / 2 // 2:1, 3:1, 4:2 - coin := coins[midIdx] - - switch { - case denom < coin.Denom: - return coins[:midIdx].AmountOf(denom) - case denom == coin.Denom: - return coin.Amount - default: - return coins[midIdx+1:].AmountOf(denom) - } - } -} - -// IsEqual returns true if the two sets of DecCoins have the same value. -func (coins DecCoins) IsEqual(coinsB DecCoins) bool { - if len(coins) != len(coinsB) { - return false - } - - coins = coins.Sort() - coinsB = coinsB.Sort() - - for i := 0; i < len(coins); i++ { - if !coins[i].IsEqual(coinsB[i]) { - return false - } - } - - return true -} - -// IsZero returns whether all coins are zero -func (coins DecCoins) IsZero() bool { - for _, coin := range coins { - if !coin.Amount.IsZero() { - return false - } - } - return true -} - -// IsValid asserts the DecCoins are sorted, have positive amount, and Denom -// does not contain upper case characters. -func (coins DecCoins) IsValid() bool { - switch len(coins) { - case 0: - return true - - case 1: - if err := ValidateDenom(coins[0].Denom); err != nil { - return false - } - return coins[0].IsPositive() - - default: - // check single coin case - if !(DecCoins{coins[0]}).IsValid() { - return false - } - - lowDenom := coins[0].Denom - for _, coin := range coins[1:] { - if strings.ToLower(coin.Denom) != coin.Denom { - return false - } - if coin.Denom <= lowDenom { - return false - } - if !coin.IsPositive() { - return false - } - - // we compare each coin against the last denom - lowDenom = coin.Denom - } - - return true - } -} - -// IsAllPositive returns true if there is at least one coin and all currencies -// have a positive value. -// -// TODO: Remove once unsigned integers are used. -func (coins DecCoins) IsAllPositive() bool { - if len(coins) == 0 { - return false - } - - for _, coin := range coins { - if !coin.IsPositive() { - return false - } - } - - return true -} - -func removeZeroDecCoins(coins DecCoins) DecCoins { - i, l := 0, len(coins) - for i < l { - if coins[i].IsZero() { - // remove coin - coins = append(coins[:i], coins[i+1:]...) - l-- - } else { - i++ - } - } - - return coins[:i] -} - -// ----------------------------------------------------------------------------- -// Sorting - -var _ sort.Interface = Coins{} - -//nolint -func (coins DecCoins) Len() int { return len(coins) } -func (coins DecCoins) Less(i, j int) bool { return coins[i].Denom < coins[j].Denom } -func (coins DecCoins) Swap(i, j int) { coins[i], coins[j] = coins[j], coins[i] } - -// Sort is a helper function to sort the set of decimal coins in-place. -func (coins DecCoins) Sort() DecCoins { - sort.Sort(coins) - return coins -} - -// ---------------------------------------------------------------------------- -// Parsing - -// ParseDecCoin parses a decimal coin from a string, returning an error if -// invalid. An empty string is considered invalid. -func ParseDecCoin(coinStr string) (coin DecCoin, err error) { - coinStr = strings.TrimSpace(coinStr) - - matches := reDecCoin.FindStringSubmatch(coinStr) - if matches == nil { - return DecCoin{}, fmt.Errorf("invalid decimal coin expression: %s", coinStr) - } - - amountStr, denomStr := matches[1], matches[2] - - amount, err := NewDecFromStr(amountStr) - if err != nil { - return DecCoin{}, errors.Wrap(err, fmt.Sprintf("failed to parse decimal coin amount: %s", amountStr)) - } - - if err := ValidateDenom(denomStr); err != nil { - return DecCoin{}, fmt.Errorf("invalid denom cannot contain upper case characters or spaces: %s", err) - } - - return NewDecCoinFromDec(denomStr, amount), nil -} - -// ParseDecCoins will parse out a list of decimal coins separated by commas. -// If nothing is provided, it returns nil DecCoins. Returned decimal coins are -// sorted. -func ParseDecCoins(coinsStr string) (DecCoins, error) { - coinsStr = strings.TrimSpace(coinsStr) - if len(coinsStr) == 0 { - return nil, nil - } - - coinStrs := strings.Split(coinsStr, ",") - coins := make(DecCoins, len(coinStrs)) - for i, coinStr := range coinStrs { - coin, err := ParseDecCoin(coinStr) - if err != nil { - return nil, err - } - - coins[i] = coin - } - - // sort coins for determinism - coins.Sort() - - // validate coins before returning - if !coins.IsValid() { - return nil, fmt.Errorf("parsed decimal coins are invalid: %#v", coins) - } - - return coins, nil -} diff --git a/types/env.go b/types/env.go deleted file mode 100644 index 3687231b..00000000 --- a/types/env.go +++ /dev/null @@ -1,73 +0,0 @@ -package types - -const ( - // prefixChain defines the prefix of this chain - prefixChain = "i" - - // PrefixAcc is the prefix for account - prefixAccount = "a" - - // prefixValidator is the prefix for validator keys - prefixValidator = "v" - - // prefixConsensus is the prefix for consensus keys - prefixConsensus = "c" - - // prefixPublic is the prefix for public - prefixPublic = "p" - - // prefixAddress is the prefix for address - prefixAddress = "a" -) - -var ( - prefixCfg = &AddrPrefixCfg{ - bech32AddressPrefix: map[string]string{ - "account_addr": prefixChain + prefixAccount + prefixAddress, - "validator_addr": prefixChain + prefixValidator + prefixAddress, - "consensus_addr": prefixChain + prefixConsensus + prefixAddress, - "account_pub": prefixChain + prefixAccount + prefixPublic, - "validator_pub": prefixChain + prefixValidator + prefixPublic, - "consensus_pub": prefixChain + prefixConsensus + prefixPublic, - }, - } -) - -type AddrPrefixCfg struct { - bech32AddressPrefix map[string]string -} - -// GetAddrPrefixCfg returns the config instance for the corresponding Network type -func GetAddrPrefixCfg() *AddrPrefixCfg { - return prefixCfg -} - -// GetBech32AccountAddrPrefix returns the Bech32 prefix for account address -func (config *AddrPrefixCfg) GetBech32AccountAddrPrefix() string { - return config.bech32AddressPrefix["account_addr"] -} - -// GetBech32ValidatorAddrPrefix returns the Bech32 prefix for validator address -func (config *AddrPrefixCfg) GetBech32ValidatorAddrPrefix() string { - return config.bech32AddressPrefix["validator_addr"] -} - -// GetBech32ConsensusAddrPrefix returns the Bech32 prefix for consensus node address -func (config *AddrPrefixCfg) GetBech32ConsensusAddrPrefix() string { - return config.bech32AddressPrefix["consensus_addr"] -} - -// GetBech32AccountPubPrefix returns the Bech32 prefix for account public key -func (config *AddrPrefixCfg) GetBech32AccountPubPrefix() string { - return config.bech32AddressPrefix["account_pub"] -} - -// GetBech32ValidatorPubPrefix returns the Bech32 prefix for validator public key -func (config *AddrPrefixCfg) GetBech32ValidatorPubPrefix() string { - return config.bech32AddressPrefix["validator_pub"] -} - -// GetBech32ConsensusPubPrefix returns the Bech32 prefix for consensus node public key -func (config *AddrPrefixCfg) GetBech32ConsensusPubPrefix() string { - return config.bech32AddressPrefix["consensus_pub"] -} diff --git a/types/errors.go b/types/errors.go deleted file mode 100644 index bbae8a2e..00000000 --- a/types/errors.go +++ /dev/null @@ -1,218 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/pkg/errors" -) - -const ( - // RootCodespace is the codespace for all errors defined in irishub - RootCodespace = "sdk" - - OK Code = 0 - Internal Code = 1 - TxDecode Code = 2 - InvalidSequence Code = 3 - Unauthorized Code = 4 - InsufficientFunds Code = 5 - UnknownRequest Code = 6 - InvalidAddress Code = 7 - InvalidPubkey Code = 8 - UnknownAddress Code = 9 - InvalidCoins Code = 10 - OutOfGas Code = 11 - MemoTooLarge Code = 12 - InsufficientFee Code = 13 - TooManySignatures Code = 14 - NoSignatures Code = 15 - ErrJsonMarshal Code = 16 - ErrJsonUnmarshal Code = 17 - InvalidRequest Code = 18 - TxInMempoolCache Code = 19 - MempoolIsFull Code = 20 - TxTooLarge Code = 21 -) - -var ( - // errUnknown = register(RootCodespace, 111222, "unknown error") - errInvalid = register(RootCodespace, 999999, "sdk check error") -) - -func init() { - _ = register(RootCodespace, OK, "success") - _ = register(RootCodespace, Internal, "internal") - _ = register(RootCodespace, TxDecode, "tx parse error") - _ = register(RootCodespace, InvalidSequence, "invalid sequence") - _ = register(RootCodespace, Unauthorized, "unauthorized") - _ = register(RootCodespace, InsufficientFunds, "insufficient funds") - _ = register(RootCodespace, UnknownRequest, "unknown request") - _ = register(RootCodespace, InvalidAddress, "invalid address") - _ = register(RootCodespace, InvalidPubkey, "invalid pubkey") - _ = register(RootCodespace, UnknownAddress, "unknown address") - _ = register(RootCodespace, InvalidCoins, "invalid coins") - _ = register(RootCodespace, OutOfGas, "out of gas") - _ = register(RootCodespace, MemoTooLarge, "memo too large") - _ = register(RootCodespace, InsufficientFee, "insufficient fee") - _ = register(RootCodespace, TooManySignatures, "maximum number of signatures exceeded") - _ = register(RootCodespace, NoSignatures, "no signatures supplied") - _ = register(RootCodespace, ErrJsonMarshal, "failed to marshal JSON bytes") - _ = register(RootCodespace, ErrJsonUnmarshal, "failed to unmarshal JSON bytes") - _ = register(RootCodespace, InvalidRequest, "invalid request") - _ = register(RootCodespace, TxInMempoolCache, "tx already in mempool") - _ = register(RootCodespace, MempoolIsFull, "mempool is full") - _ = register(RootCodespace, TxTooLarge, "tx too large") -} - -type Code uint32 -type CodeV017 uint32 - -// Error represents a root error. -// -// Weave framework is using root error to categorize issues. Each instance -// created during the runtime should wrap one of the declared root errors. This -// allows error tests and returning all errors to the client in a safe manner. -// -// All popular root errors are declared in this package. If an extension has to -// declare a custom root error, always use register function to ensure -// error code uniqueness. -type Error interface { - Error() string - Code() uint32 - Codespace() string -} - -// GetError is used to covert irishub error to sdk error -func GetError(codespace string, code uint32, log ...string) Error { - codeV1, ok := v17CodeMap[code] - if !ok { - codeV1 = InvalidRequest - } - return sdkError{ - codespace: codespace, - code: uint32(codeV1), - desc: log[0], - } -} - -// Wrap extends given error with an additional information. -// -// If the wrapped error does not provide ABCICode method (ie. stdlib errors), -// it will be labeled as internal error. -// -// If err is nil, this returns nil, avoiding the need for an if statement when -// wrapping a error returned at the end of a function -func Wrap(err error) Error { - if err == nil { - return nil - } - - return sdkError{ - codespace: errInvalid.Codespace(), - code: errInvalid.Code(), - desc: err.Error(), - } -} - -func WrapWithMessage(err error, format string, args ...interface{}) Error { - desc := fmt.Sprintf(format, args...) - return Wrap(errors.WithMessage(err, desc)) -} - -// Wrapf extends given error with an additional information. -// -// This function works like Wrap function with additional functionality of -// formatting the input as specified. -func Wrapf(format string, args ...interface{}) Error { - desc := fmt.Sprintf(format, args...) - return Wrap(errors.New(desc)) -} - -type sdkError struct { - codespace string - code uint32 - desc string -} - -func (e sdkError) Error() string { - return e.desc -} - -func (e sdkError) Code() uint32 { - return e.code -} - -func (e sdkError) Codespace() string { - return e.codespace -} - -// register returns an error instance that should be used as the base for -// creating error instances during runtime. -// -// Popular root errors are declared in this package, but extensions may want to -// declare custom codes. This function ensures that no error code is used -// twice. Attempt to reuse an error code results in panic. -// -// Use this function only during a program startup phase. -func register(codespace string, code Code, description string) Error { - err := sdkError{ - codespace: codespace, - code: uint32(code), - desc: description, - } - setUsed(err) - - return err -} - -// usedCodes is keeping track of used codes to ensure their uniqueness. No two -// error instances should share the same (codespace, code) tuple. -var usedCodes = map[string]Error{} - -func errorID(codespace string, code uint32) string { - return fmt.Sprintf("%s:%d", codespace, code) -} - -func setUsed(err Error) { - usedCodes[errorID(err.Codespace(), err.Code())] = err -} - -var v17CodeMap = map[uint32]Code{ - 0: OK, - 1: Internal, - 2: TxDecode, - 3: InvalidSequence, - 4: Unauthorized, - 5: InsufficientFunds, - 6: UnknownRequest, - 7: InvalidAddress, - 8: InvalidPubkey, - 9: UnknownAddress, - 10: InvalidCoins, - 11: InvalidCoins, - 12: OutOfGas, - 13: MemoTooLarge, - 14: InsufficientFee, - 15: UnknownRequest, - 16: TooManySignatures, - 17: OutOfGas, - 18: InvalidRequest, - 19: InvalidRequest, - 20: InvalidRequest, - 21: TxTooLarge, - 22: InvalidRequest, - 23: InvalidRequest, -} - -func CatchPanic(fn func(errMsg string)) { - if err := recover(); err != nil { - var msg string - switch e := err.(type) { - case error: - msg = e.Error() - case string: - msg = e - } - fn(msg) - } -} diff --git a/types/event.go b/types/event.go deleted file mode 100644 index 51fc0cff..00000000 --- a/types/event.go +++ /dev/null @@ -1,231 +0,0 @@ -package types - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "strings" -) - -type WSClient interface { - SubscribeNewBlock(builder *EventQueryBuilder, handler EventNewBlockHandler) (Subscription, Error) - SubscribeTx(builder *EventQueryBuilder, handler EventTxHandler) (Subscription, Error) - SubscribeNewBlockHeader(handler EventNewBlockHeaderHandler) (Subscription, Error) - SubscribeValidatorSetUpdates(handler EventValidatorSetUpdatesHandler) (Subscription, Error) - Unsubscribe(subscription Subscription) Error -} - -type TmClient interface { - ABCIClient - SignClient - WSClient - StatusClient - NetworkClient -} - -type EventKey string -type EventValue interface{} - -type Subscription struct { - Ctx context.Context `json:"-"` - Query string `json:"query"` - ID string `json:"id"` -} - -type EventHandler func(data EventData) - -// EventData for SubscribeAny -type EventData interface{} - -// EventDataTx for SubscribeTx -type EventDataTx struct { - Hash string `json:"hash"` - Height int64 `json:"height"` - Index uint32 `json:"index"` - Tx Tx `json:"tx"` - Result TxResult `json:"result"` -} - -func (tx EventDataTx) MarshalJson() []byte { - bz, _ := json.Marshal(tx) - return bz -} - -type TxResult struct { - Code uint32 `json:"code"` - Log string `json:"log"` - GasWanted int64 `json:"gas_wanted"` - GasUsed int64 `json:"gas_used"` - Events StringEvents `json:"events"` -} - -type Attributes []Attribute - -func (a Attributes) GetValues(key string) (values []string) { - for _, attr := range a { - if attr.Key == key { - values = append(values, attr.Value) - } - } - return -} - -func (a Attributes) GetValue(key string) string { - for _, attr := range a { - if attr.Key == key { - return attr.Value - } - } - return "" -} - -func (a Attributes) String() string { - var attrs = make([]string, len(a)) - for i, attr := range a { - attrs[i] = fmt.Sprintf("%s=%s", attr.Key, attr.Value) - } - return strings.Join(attrs, ",") -} - -type EventTxHandler func(EventDataTx) - -//EventDataNewBlock for SubscribeNewBlock -type EventDataNewBlock struct { - Block Block `json:"block"` - ResultBeginBlock ResultBeginBlock `json:"result_begin_block"` - ResultEndBlock ResultEndBlock `json:"result_end_block"` -} - -type ValidatorUpdate struct { - PubKey PubKey `json:"pub_key"` - Power int64 `json:"power"` -} - -type PubKey struct { - Type string `json:"type"` - Value string `json:"value"` -} - -type EventNewBlockHandler func(EventDataNewBlock) - -//EventDataNewBlockHeader for SubscribeNewBlockHeader -type EventDataNewBlockHeader struct { - Header Header `json:"header"` - - ResultBeginBlock ResultBeginBlock `json:"result_begin_block"` - ResultEndBlock ResultEndBlock `json:"result_end_block"` -} - -type EventNewBlockHeaderHandler func(EventDataNewBlockHeader) - -//EventDataValidatorSetUpdates for SubscribeValidatorSetUpdates -type Validator struct { - Bech32Address string `json:"bech32_address"` - Bech32PubKey string `json:"bech32_pubkey"` - Address string `json:"address"` - PubKey PubKey `json:"pub_key"` - VotingPower int64 `json:"voting_power"` - ProposerPriority int64 `json:"proposer_priority"` -} -type EventDataValidatorSetUpdates struct { - ValidatorUpdates []Validator `json:"validator_updates"` -} - -type EventValidatorSetUpdatesHandler func(EventDataValidatorSetUpdates) - -//EventQueryBuilder for build query string -type condition struct { - key EventKey - value EventValue - op string -} - -// Cond return a condition object with a key -func Cond(key EventKey) *condition { - return &condition{ - key: key, - } -} - -// NewCond return a condition object with a complete event type and attrKey -func NewCond(typ, attrKey string) *condition { - return &condition{ - key: EventKey(fmt.Sprintf("%s.%s", typ, attrKey)), - } -} - -func (c *condition) LTE(v EventValue) *condition { - return c.fill(v, "<=") -} - -func (c *condition) GTE(v EventValue) *condition { - return c.fill(v, ">=") -} - -func (c *condition) LE(v EventValue) *condition { - return c.fill(v, "<") -} - -func (c *condition) GE(v EventValue) *condition { - return c.fill(v, ">") -} - -func (c *condition) EQ(v EventValue) *condition { - return c.fill(v, "=") -} - -//func (c *condition) Contains(v EventValue) *condition { -// return c.fill(v, "CONTAINS") -//} - -func (c *condition) fill(v EventValue, op string) *condition { - c.value = v - c.op = op - return c -} - -func (c *condition) String() string { - if len(c.key) == 0 || len(c.op) == 0 { - return "" - } - - switch c.value.(type) { - case int64, uint64: - return fmt.Sprintf("%s%s%d", c.key, c.op, c.value) - default: - return fmt.Sprintf("%s%s'%s'", c.key, c.op, c.value) - } -} - -//EventQueryBuilder is responsible for constructing listening conditions -type EventQueryBuilder struct { - conditions []string -} - -func NewEventQueryBuilder() *EventQueryBuilder { - return &EventQueryBuilder{ - conditions: []string{}, - } -} - -//AddCondition is responsible for adding listening conditions -func (eqb *EventQueryBuilder) AddCondition(c *condition) *EventQueryBuilder { - if c == nil { - return nil - } - eqb.conditions = append(eqb.conditions, c.String()) - return eqb -} - -//Build is responsible for constructing the listening condition into a listening instruction identified by tendermint -func (eqb *EventQueryBuilder) Build() string { - var buf bytes.Buffer - for _, condition := range eqb.conditions { - if buf.Len() > 0 { - buf.WriteString(" AND ") - } - buf.WriteString(condition) - } - return buf.String() -} diff --git a/types/events.go b/types/events.go deleted file mode 100644 index 9102e3b7..00000000 --- a/types/events.go +++ /dev/null @@ -1,263 +0,0 @@ -package types - -import ( - "fmt" - "sort" - "strings" - - abci "github.com/tendermint/tendermint/abci/types" -) - -// ---------------------------------------------------------------------------- -// Event Manager -// ---------------------------------------------------------------------------- - -// EventManager implements a simple wrapper around a slice of Event objects that -// can be emitted from. -type EventManager struct { - events Events -} - -func NewEventManager() *EventManager { - return &EventManager{EmptyEvents()} -} - -func (em *EventManager) Events() Events { return em.events } - -// EmitEvent stores a single Event object. -func (em *EventManager) EmitEvent(event Event) { - em.events = em.events.AppendEvent(event) -} - -// EmitEvents stores a series of Event objects. -func (em *EventManager) EmitEvents(events Events) { - em.events = em.events.AppendEvents(events) -} - -// ABCIEvents returns all stored Event objects as abci.Event objects. -func (em EventManager) ABCIEvents() []abci.Event { - return em.events.ToABCIEvents() -} - -// ---------------------------------------------------------------------------- -// Events -// ---------------------------------------------------------------------------- - -type ( - // Event is a type alias for an ABCI Event - Event abci.Event - - // Events defines a slice of Event objects - Events []Event -) - -// NewEvent creates a new Event object with a given type and slice of one or more -// attributes. -func NewEvent(ty string, attrs ...Attribute) Event { - e := Event{Type: ty} - - for _, attr := range attrs { - e.Attributes = append(e.Attributes, attr.ToKVPair()) - } - - return e -} - -// NewAttribute returns a new key/value Attribute object. -func NewAttribute(k, v string) Attribute { - return Attribute{k, v} -} - -// EmptyEvents returns an empty slice of events. -func EmptyEvents() Events { - return make(Events, 0) -} - -func (a Attribute) String() string { - return fmt.Sprintf("%s: %s", a.Key, a.Value) -} - -// ToKVPair converts an Attribute object into a Tendermint key/value pair. -func (a Attribute) ToKVPair() abci.EventAttribute { - return abci.EventAttribute{Key: toBytes(a.Key), Value: toBytes(a.Value)} -} - -// AppendAttributes adds one or more attributes to an Event. -func (e Event) AppendAttributes(attrs ...Attribute) Event { - for _, attr := range attrs { - e.Attributes = append(e.Attributes, attr.ToKVPair()) - } - return e -} - -// AppendEvent adds an Event to a slice of events. -func (e Events) AppendEvent(event Event) Events { - return append(e, event) -} - -// AppendEvents adds a slice of Event objects to an exist slice of Event objects. -func (e Events) AppendEvents(events Events) Events { - return append(e, events...) -} - -// ToABCIEvents converts a slice of Event objects to a slice of abci.Event -// objects. -func (e Events) ToABCIEvents() []abci.Event { - res := make([]abci.Event, len(e)) - for i, ev := range e { - res[i] = abci.Event{Type: ev.Type, Attributes: ev.Attributes} - } - - return res -} - -func toBytes(i interface{}) []byte { - switch x := i.(type) { - case []uint8: - return x - case string: - return []byte(x) - default: - panic(i) - } -} - -// Common event types and attribute keys -var ( - TypeKey EventKey = "tm.event" - - EventTypeMessage = "message" - EventTypeCreateContext = "create_context" - EventTypeResponseService = "respond_service" - EventTypeSubmitProposal = "submit_proposal" - - AttributeKeyAction = "action" - AttributeKeyModule = "module" - AttributeKeySender = "sender" - AttributeKeyAmount = "amount" - - TxValue EventValue = "Tx" -) - -type ( - // StringAttributes defines a slice of StringEvents objects. - StringEvents []StringEvent -) - -func (se StringEvents) String() string { - var sb strings.Builder - - for _, e := range se { - sb.WriteString(fmt.Sprintf("\t\t- %s\n", e.Type)) - - for _, attr := range e.Attributes { - sb.WriteString(fmt.Sprintf("\t\t\t- %s\n", attr.String())) - } - } - - return strings.TrimRight(sb.String(), "\n") -} - -// Flatten returns a flattened version of StringEvents by grouping all attributes -// per unique event type. -func (se StringEvents) Flatten() StringEvents { - flatEvents := make(map[string][]Attribute) - - for _, e := range se { - flatEvents[e.Type] = append(flatEvents[e.Type], e.Attributes...) - } - keys := make([]string, 0, len(flatEvents)) - res := make(StringEvents, 0, len(flatEvents)) // appeneded to keys, same length of what is allocated to keys - - for ty := range flatEvents { - keys = append(keys, ty) - } - - sort.Strings(keys) - for _, ty := range keys { - res = append(res, StringEvent{Type: ty, Attributes: flatEvents[ty]}) - } - - return res -} - -// StringifyEvent converts an Event object to a StringEvent object. -func StringifyEvent(e abci.Event) StringEvent { - res := StringEvent{Type: e.Type} - - for _, attr := range e.Attributes { - res.Attributes = append( - res.Attributes, - Attribute{string(attr.Key), string(attr.Value)}, - ) - } - - return res -} - -// StringifyEvents converts a slice of Event objects into a slice of StringEvent -// objects. -func StringifyEvents(events []abci.Event) StringEvents { - res := make(StringEvents, 0, len(events)) - - for _, e := range events { - res = append(res, StringifyEvent(e)) - } - - return res.Flatten() -} - -// MarkEventsToIndex returns the set of ABCI events, where each event's attribute -// has it's index value marked based on the provided set of events to index. -func MarkEventsToIndex(events []abci.Event, indexSet map[string]struct{}) []abci.Event { - indexAll := len(indexSet) == 0 - updatedEvents := make([]abci.Event, len(events)) - - for i, e := range events { - updatedEvent := abci.Event{ - Type: e.Type, - Attributes: make([]abci.EventAttribute, len(e.Attributes)), - } - - for j, attr := range e.Attributes { - _, index := indexSet[fmt.Sprintf("%s.%s", e.Type, attr.Key)] - updatedAttr := abci.EventAttribute{ - Key: attr.Key, - Value: attr.Value, - Index: index || indexAll, - } - - updatedEvent.Attributes[j] = updatedAttr - } - - updatedEvents[i] = updatedEvent - } - - return updatedEvents -} - -func (se StringEvents) GetValue(typ, key string) (string, error) { - for _, e := range se { - if e.Type == typ { - for _, attr := range e.Attributes { - if attr.Key == key { - return attr.Value, nil - } - } - } - } - return "", fmt.Errorf("not found type:%s key:%s", typ, key) -} - -func (se StringEvents) GetValues(typ, key string) (res []string) { - for _, e := range se { - if e.Type == typ { - for _, attr := range e.Attributes { - if attr.Key == key { - res = append(res, attr.Value) - } - } - } - } - return res -} diff --git a/types/handler_map.go b/types/handler_map.go deleted file mode 100644 index c929467b..00000000 --- a/types/handler_map.go +++ /dev/null @@ -1,58 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// SignModeHandlerMap is SignModeHandler that aggregates multiple SignModeHandler's into -// a single handler -type SignModeHandlerMap struct { - defaultMode signing.SignMode - modes []signing.SignMode - signModeHandlers map[signing.SignMode]SignModeHandler -} - -var _ SignModeHandler = SignModeHandlerMap{} - -// NewSignModeHandlerMap returns a new SignModeHandlerMap with the provided defaultMode and handlers -func NewSignModeHandlerMap(defaultMode signing.SignMode, handlers []SignModeHandler) SignModeHandlerMap { - handlerMap := make(map[signing.SignMode]SignModeHandler) - var modes []signing.SignMode - - for _, h := range handlers { - for _, m := range h.Modes() { - if _, have := handlerMap[m]; have { - panic(fmt.Errorf("duplicate sign mode handler for mode %s", m)) - } - handlerMap[m] = h - modes = append(modes, m) - } - } - - return SignModeHandlerMap{ - defaultMode: defaultMode, - modes: modes, - signModeHandlers: handlerMap, - } -} - -// DefaultMode implements SignModeHandler.DefaultMode -func (h SignModeHandlerMap) DefaultMode() signing.SignMode { - return h.defaultMode -} - -// Modes implements SignModeHandler.Modes -func (h SignModeHandlerMap) Modes() []signing.SignMode { - return h.modes -} - -// DefaultMode implements SignModeHandler.GetSignBytes -func (h SignModeHandlerMap) GetSignBytes(mode signing.SignMode, data SignerData, tx Tx) ([]byte, error) { - handler, found := h.signModeHandlers[mode] - if !found { - return nil, fmt.Errorf("can't verify sign mode %s", mode.String()) - } - return handler.GetSignBytes(mode, data, tx) -} diff --git a/types/int.go b/types/int.go deleted file mode 100644 index bf1a0f55..00000000 --- a/types/int.go +++ /dev/null @@ -1,429 +0,0 @@ -package types - -import ( - "encoding" - "encoding/json" - "fmt" - "testing" - - "math/big" -) - -const maxBitLen = 255 - -func newIntegerFromString(s string) (*big.Int, bool) { - return new(big.Int).SetString(s, 0) -} - -func equal(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == 0 } - -func gt(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == 1 } - -func gte(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) >= 0 } - -func lt(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == -1 } - -func lte(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) <= 0 } - -func add(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Add(i, i2) } - -func sub(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Sub(i, i2) } - -func mul(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Mul(i, i2) } - -func div(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Quo(i, i2) } - -func mod(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Mod(i, i2) } - -func neg(i *big.Int) *big.Int { return new(big.Int).Neg(i) } - -func min(i *big.Int, i2 *big.Int) *big.Int { - if i.Cmp(i2) == 1 { - return new(big.Int).Set(i2) - } - - return new(big.Int).Set(i) -} - -func max(i *big.Int, i2 *big.Int) *big.Int { - if i.Cmp(i2) == -1 { - return new(big.Int).Set(i2) - } - - return new(big.Int).Set(i) -} - -func unmarshalText(i *big.Int, text string) error { - if err := i.UnmarshalText([]byte(text)); err != nil { - return err - } - - if i.BitLen() > maxBitLen { - return fmt.Errorf("integer out of range: %s", text) - } - - return nil -} - -// Int wraps integer with 256 bit range bound -// Checks overflow, underflow and division by zero -// Exists in range from -(2^maxBitLen-1) to 2^maxBitLen-1 -type Int struct { - i *big.Int -} - -// BigInt converts Int to big.Int -func (i Int) BigInt() *big.Int { - if i.IsNil() { - return nil - } - return new(big.Int).Set(i.i) -} - -// IsNil returns true if Int is uninitialized -func (i Int) IsNil() bool { - return i.i == nil -} - -// NewInt constructs Int from int64 -func NewInt(n int64) Int { - return Int{big.NewInt(n)} -} - -// NewIntFromUint64 constructs an Int from a uint64. -func NewIntFromUint64(n uint64) Int { - b := big.NewInt(0) - b.SetUint64(n) - return Int{b} -} - -// NewIntFromBigInt constructs Int from big.Int -func NewIntFromBigInt(i *big.Int) Int { - if i.BitLen() > maxBitLen { - panic("NewIntFromBigInt() out of bound") - } - return Int{i} -} - -// NewIntFromString constructs Int from string -func NewIntFromString(s string) (res Int, ok bool) { - i, ok := newIntegerFromString(s) - if !ok { - return - } - // Check overflow - if i.BitLen() > maxBitLen { - ok = false - return - } - return Int{i}, true -} - -// NewIntWithDecimal constructs Int with decimal -// Result value is n*10^dec -func NewIntWithDecimal(n int64, dec int) Int { - if dec < 0 { - panic("NewIntWithDecimal() decimal is negative") - } - exp := new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(dec)), nil) - i := new(big.Int) - i.Mul(big.NewInt(n), exp) - - // Check overflow - if i.BitLen() > maxBitLen { - panic("NewIntWithDecimal() out of bound") - } - return Int{i} -} - -// ZeroInt returns Int value with zero -func ZeroInt() Int { return Int{big.NewInt(0)} } - -// OneInt returns Int value with one -func OneInt() Int { return Int{big.NewInt(1)} } - -// ToDec converts Int to Dec -func (i Int) ToDec() Dec { - return NewDecFromInt(i) -} - -// Int64 converts Int to int64 -// Panics if the value is out of range -func (i Int) Int64() int64 { - if !i.i.IsInt64() { - panic("Int64() out of bound") - } - return i.i.Int64() -} - -// IsInt64 returns true if Int64() not panics -func (i Int) IsInt64() bool { - return i.i.IsInt64() -} - -// Uint64 converts Int to uint64 -// Panics if the value is out of range -func (i Int) Uint64() uint64 { - if !i.i.IsUint64() { - panic("Uint64() out of bounds") - } - return i.i.Uint64() -} - -// IsUint64 returns true if Uint64() not panics -func (i Int) IsUint64() bool { - return i.i.IsUint64() -} - -// IsZero returns true if Int is zero -func (i Int) IsZero() bool { - return i.i.Sign() == 0 -} - -// IsNegative returns true if Int is negative -func (i Int) IsNegative() bool { - return i.i.Sign() == -1 -} - -// IsPositive returns true if Int is positive -func (i Int) IsPositive() bool { - return i.i.Sign() == 1 -} - -// Sign returns sign of Int -func (i Int) Sign() int { - return i.i.Sign() -} - -// Equal compares two Ints -func (i Int) Equal(i2 Int) bool { - return equal(i.i, i2.i) -} - -// GT returns true if first Int is greater than second -func (i Int) GT(i2 Int) bool { - return gt(i.i, i2.i) -} - -// GTE returns true if receiver Int is greater than or equal to the parameter -// Int. -func (i Int) GTE(i2 Int) bool { - return gte(i.i, i2.i) -} - -// LT returns true if first Int is lesser than second -func (i Int) LT(i2 Int) bool { - return lt(i.i, i2.i) -} - -// LTE returns true if first Int is less than or equal to second -func (i Int) LTE(i2 Int) bool { - return lte(i.i, i2.i) -} - -// Add adds Int from another -func (i Int) Add(i2 Int) (res Int) { - res = Int{add(i.i, i2.i)} - // Check overflow - if res.i.BitLen() > maxBitLen { - panic("Int overflow") - } - return -} - -// AddRaw adds int64 to Int -func (i Int) AddRaw(i2 int64) Int { - return i.Add(NewInt(i2)) -} - -// Sub subtracts Int from another -func (i Int) Sub(i2 Int) (res Int) { - res = Int{sub(i.i, i2.i)} - // Check overflow - if res.i.BitLen() > maxBitLen { - panic("Int overflow") - } - return -} - -// SubRaw subtracts int64 from Int -func (i Int) SubRaw(i2 int64) Int { - return i.Sub(NewInt(i2)) -} - -// Mul multiples two Ints -func (i Int) Mul(i2 Int) (res Int) { - // Check overflow - if i.i.BitLen()+i2.i.BitLen()-1 > maxBitLen { - panic("Int overflow") - } - res = Int{mul(i.i, i2.i)} - // Check overflow if sign of both are same - if res.i.BitLen() > maxBitLen { - panic("Int overflow") - } - return -} - -// MulRaw multipies Int and int64 -func (i Int) MulRaw(i2 int64) Int { - return i.Mul(NewInt(i2)) -} - -// Quo divides Int with Int -func (i Int) Quo(i2 Int) (res Int) { - // Check division-by-zero - if i2.i.Sign() == 0 { - panic("Division by zero") - } - return Int{div(i.i, i2.i)} -} - -// QuoRaw divides Int with int64 -func (i Int) QuoRaw(i2 int64) Int { - return i.Quo(NewInt(i2)) -} - -// Mod returns remainder after dividing with Int -func (i Int) Mod(i2 Int) Int { - if i2.Sign() == 0 { - panic("division-by-zero") - } - return Int{mod(i.i, i2.i)} -} - -// ModRaw returns remainder after dividing with int64 -func (i Int) ModRaw(i2 int64) Int { - return i.Mod(NewInt(i2)) -} - -// Neg negates Int -func (i Int) Neg() (res Int) { - return Int{neg(i.i)} -} - -// return the minimum of the ints -func MinInt(i1, i2 Int) Int { - return Int{min(i1.BigInt(), i2.BigInt())} -} - -// MaxInt returns the maximum between two integers. -func MaxInt(i, i2 Int) Int { - return Int{max(i.BigInt(), i2.BigInt())} -} - -// Human readable string -func (i Int) String() string { - return i.i.String() -} - -// MarshalJSON defines custom encoding scheme -func (i Int) MarshalJSON() ([]byte, error) { - if i.i == nil { // Necessary since default Uint initialization has i.i as nil - i.i = new(big.Int) - } - return marshalJSON(i.i) -} - -// UnmarshalJSON defines custom decoding scheme -func (i *Int) UnmarshalJSON(bz []byte) error { - if i.i == nil { // Necessary since default Int initialization has i.i as nil - i.i = new(big.Int) - } - return unmarshalJSON(i.i, bz) -} - -// MarshalJSON for custom encoding scheme -// Must be encoded as a string for JSON precision -func marshalJSON(i encoding.TextMarshaler) ([]byte, error) { - text, err := i.MarshalText() - if err != nil { - return nil, err - } - - return json.Marshal(string(text)) -} - -// UnmarshalJSON for custom decoding scheme -// Must be encoded as a string for JSON precision -func unmarshalJSON(i *big.Int, bz []byte) error { - var text string - if err := json.Unmarshal(bz, &text); err != nil { - return err - } - - return unmarshalText(i, text) -} - -// MarshalYAML returns the YAML representation. -func (i Int) MarshalYAML() (interface{}, error) { - return i.String(), nil -} - -// Marshal implements the gogo proto custom type interface. -func (i Int) Marshal() ([]byte, error) { - if i.i == nil { - i.i = new(big.Int) - } - return i.i.MarshalText() -} - -// MarshalTo implements the gogo proto custom type interface. -func (i *Int) MarshalTo(data []byte) (n int, err error) { - if i.i == nil { - i.i = new(big.Int) - } - if len(i.i.Bytes()) == 0 { - copy(data, []byte{0x30}) - return 1, nil - } - - bz, err := i.Marshal() - if err != nil { - return 0, err - } - - copy(data, bz) - return len(bz), nil -} - -// Unmarshal implements the gogo proto custom type interface. -func (i *Int) Unmarshal(data []byte) error { - if len(data) == 0 { - i = nil - return nil - } - - if i.i == nil { - i.i = new(big.Int) - } - - if err := i.i.UnmarshalText(data); err != nil { - return err - } - - if i.i.BitLen() > maxBitLen { - return fmt.Errorf("integer out of range; got: %d, max: %d", i.i.BitLen(), maxBitLen) - } - - return nil -} - -// Size implements the gogo proto custom type interface. -func (i *Int) Size() int { - bz, _ := i.Marshal() - return len(bz) -} - -// Override Amino binary serialization by proxying to protobuf. -func (i Int) MarshalAmino() ([]byte, error) { return i.Marshal() } -func (i *Int) UnmarshalAmino(bz []byte) error { return i.Unmarshal(bz) } - -// intended to be used with require/assert: require.True(IntEq(...)) -func IntEq(t *testing.T, exp, got Int) (*testing.T, bool, string, string, string) { - return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} - -func (ip IntProto) String() string { - return ip.Int.String() -} diff --git a/types/kv/kv.pb.go b/types/kv/kv.pb.go deleted file mode 100644 index fe70f525..00000000 --- a/types/kv/kv.pb.go +++ /dev/null @@ -1,558 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/kv/v1beta1/kv.proto - -package kv - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// Pairs defines a repeated slice of Pair objects. -type Pairs struct { - Pairs []Pair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"` -} - -func (m *Pairs) Reset() { *m = Pairs{} } -func (m *Pairs) String() string { return proto.CompactTextString(m) } -func (*Pairs) ProtoMessage() {} -func (*Pairs) Descriptor() ([]byte, []int) { - return fileDescriptor_a44e87fe7182bb73, []int{0} -} -func (m *Pairs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pairs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pairs.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 *Pairs) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pairs.Merge(m, src) -} -func (m *Pairs) XXX_Size() int { - return m.Size() -} -func (m *Pairs) XXX_DiscardUnknown() { - xxx_messageInfo_Pairs.DiscardUnknown(m) -} - -var xxx_messageInfo_Pairs proto.InternalMessageInfo - -func (m *Pairs) GetPairs() []Pair { - if m != nil { - return m.Pairs - } - return nil -} - -// Pair defines a key/value bytes tuple. -type Pair struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Pair) Reset() { *m = Pair{} } -func (m *Pair) String() string { return proto.CompactTextString(m) } -func (*Pair) ProtoMessage() {} -func (*Pair) Descriptor() ([]byte, []int) { - return fileDescriptor_a44e87fe7182bb73, []int{1} -} -func (m *Pair) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pair.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 *Pair) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pair.Merge(m, src) -} -func (m *Pair) XXX_Size() int { - return m.Size() -} -func (m *Pair) XXX_DiscardUnknown() { - xxx_messageInfo_Pair.DiscardUnknown(m) -} - -var xxx_messageInfo_Pair proto.InternalMessageInfo - -func (m *Pair) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Pair) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func init() { - proto.RegisterType((*Pairs)(nil), "cosmos.base.kv.v1beta1.Pairs") - proto.RegisterType((*Pair)(nil), "cosmos.base.kv.v1beta1.Pair") -} - -func init() { proto.RegisterFile("cosmos/base/kv/v1beta1/kv.proto", fileDescriptor_a44e87fe7182bb73) } - -var fileDescriptor_a44e87fe7182bb73 = []byte{ - // 232 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0xcf, 0x2e, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, - 0x49, 0x34, 0xd4, 0xcf, 0x2e, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x28, 0xd0, - 0x03, 0x29, 0xd0, 0xcb, 0x2e, 0xd3, 0x83, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, - 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0x95, 0x1c, 0xb9, 0x58, 0x03, 0x12, 0x33, 0x8b, 0x8a, 0x85, 0x2c, - 0xb8, 0x58, 0x0b, 0x40, 0x0c, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x19, 0x3d, 0xec, 0xc6, - 0xe8, 0x81, 0x54, 0x3b, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0xd1, 0xa0, 0xa4, 0xc7, 0xc5, - 0x02, 0x12, 0x14, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, - 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, 0x10, - 0x8e, 0x93, 0xcb, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa5, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x67, 0x16, 0x65, 0x16, 0xe7, 0xa5, 0x96, - 0x80, 0xe9, 0x8c, 0xd2, 0x24, 0xdd, 0xe2, 0x94, 0x6c, 0xdd, 0xf4, 0x7c, 0xfd, 0x92, 0xca, 0x82, - 0xd4, 0x62, 0xfd, 0xec, 0xb2, 0x24, 0x36, 0xb0, 0xfb, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xfa, 0x0d, 0xdf, 0x2c, 0x10, 0x01, 0x00, 0x00, -} - -func (m *Pairs) 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 *Pairs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pairs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Pairs) > 0 { - for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintKv(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Pair) 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 *Pair) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pair) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintKv(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKv(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintKv(dAtA []byte, offset int, v uint64) int { - offset -= sovKv(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Pairs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Pairs) > 0 { - for _, e := range m.Pairs { - l = e.Size() - n += 1 + l + sovKv(uint64(l)) - } - } - return n -} - -func (m *Pair) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKv(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKv(uint64(l)) - } - return n -} - -func sovKv(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKv(x uint64) (n int) { - return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Pairs) 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 ErrIntOverflowKv - } - 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: Pairs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pairs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pairs = append(m.Pairs, Pair{}) - if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKv(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKv - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Pair) 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 ErrIntOverflowKv - } - 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: Pair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKv(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKv - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKv(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, ErrIntOverflowKv - } - 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, ErrIntOverflowKv - } - 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, ErrIntOverflowKv - } - 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, ErrInvalidLengthKv - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKv - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKv - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKv = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKv = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/module.go b/types/module.go deleted file mode 100644 index 1549b1e6..00000000 --- a/types/module.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -import ( - "github.com/tendermint/tendermint/crypto" - - cdctypes "github.com/irisnet/irishub-sdk-go/codec/types" -) - -//The purpose of this interface is to convert the irishub system type to the user receiving type -// and standardize the user interface -type Response interface { - Convert() interface{} -} - -type SplitAble interface { - Len() int - Sub(begin, end int) SplitAble -} - -type Module interface { - Name() string - RegisterInterfaceTypes(registry cdctypes.InterfaceRegistry) -} - -type KeyManager interface { - Sign(name, password string, data []byte) ([]byte, crypto.PubKey, error) - Insert(name, password string) (string, string, error) - Recover(name, password, mnemonic, hdPath string) (string, error) - Import(name, password string, privKeyArmor string) (address string, err error) - Export(name, password string) (privKeyArmor string, err error) - Delete(name, password string) error - Find(name, password string) (crypto.PubKey, AccAddress, error) -} diff --git a/types/proof.go b/types/proof.go deleted file mode 100644 index 102c8017..00000000 --- a/types/proof.go +++ /dev/null @@ -1,13 +0,0 @@ -package types - -import "github.com/tendermint/tendermint/proto/tendermint/crypto" - -type ProofValue struct { - Proof []byte `json:"proof"` - Path []string `json:"path"` - Value []byte `json:"value"` -} - -type MerkleProof struct { - Proof *crypto.ProofOps `json:"proof"` -} diff --git a/types/pubkey.go b/types/pubkey.go deleted file mode 100644 index a5ef6cef..00000000 --- a/types/pubkey.go +++ /dev/null @@ -1,106 +0,0 @@ -package types - -// -//import ( -// "fmt" -// -// "github.com/tendermint/tendermint/crypto" -// "github.com/tendermint/tendermint/crypto/ed25519" -// "github.com/tendermint/tendermint/crypto/sr25519" -// -// "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1" -// "github.com/irisnet/irishub-sdk-go/crypto/types" -// "github.com/irisnet/irishub-sdk-go/crypto/types/multisig" -//) -// -//// DefaultPublicKeyCodec implements the standard PublicKeyCodec for the SDK which -//// supports a standard set of public key types -//type DefaultPublicKeyCodec struct{} -// -//var _ types.PublicKeyCodec = DefaultPublicKeyCodec{} -// -//// Decode implements the PublicKeyCodec.Decode method -//func (cdc DefaultPublicKeyCodec) Decode(key *types.PublicKey) (crypto.PubKey, error) { -// // key being nil is allowed as all fields in proto are optional -// if key == nil { -// return nil, nil -// } -// if key.Sum == nil { -// return nil, nil -// } -// switch key := key.Sum.(type) { -// case *types.PublicKey_Secp256K1: -// n := len(key.Secp256K1) -// if n != secp256k1.PubKeySize { -// return nil, fmt.Errorf("wrong length %d for secp256k1 public key", n) -// } -// -// res := make(secp256k1.PubKey, secp256k1.PubKeySize) -// copy(res, key.Secp256K1) -// return res, nil -// case *types.PublicKey_Ed25519: -// n := len(key.Ed25519) -// if n != ed25519.PubKeySize { -// return nil, fmt.Errorf("wrong length %d for ed25519 public key", n) -// } -// -// res := make(ed25519.PubKey, ed25519.PubKeySize) -// copy(res, key.Ed25519) -// return res, nil -// case *types.PublicKey_Sr25519: -// n := len(key.Sr25519) -// if n != sr25519.PubKeySize { -// return nil, fmt.Errorf("wrong length %d for sr25519 public key", n) -// } -// -// res := make(sr25519.PubKey, sr25519.PubKeySize) -// copy(res, key.Sr25519) -// -// return res, nil -// case *types.PublicKey_Multisig: -// pubKeys := key.Multisig.PubKeys -// resKeys := make([]crypto.PubKey, len(pubKeys)) -// for i, k := range pubKeys { -// dk, err := cdc.Decode(k) -// if err != nil { -// return nil, err -// } -// resKeys[i] = dk -// } -// -// return multisig.NewPubKeyMultisigThreshold(int(key.Multisig.K), resKeys), nil -// default: -// return nil, fmt.Errorf("can't decode PubKey of type %T. Use a custom PublicKeyCodec instead", key) -// } -//} -// -//// Encode implements the PublicKeyCodec.Encode method -//func (cdc DefaultPublicKeyCodec) Encode(key crypto.PubKey) (*types.PublicKey, error) { -// if key == nil { -// return &types.PublicKey{}, nil -// } -// switch key := key.(type) { -// case secp256k1.PubKey: -// return &types.PublicKey{Sum: &types.PublicKey_Secp256K1{Secp256K1: key}}, nil -// case ed25519.PubKey: -// return &types.PublicKey{Sum: &types.PublicKey_Ed25519{Ed25519: key}}, nil -// case sr25519.PubKey: -// return &types.PublicKey{Sum: &types.PublicKey_Sr25519{Sr25519: key}}, nil -// case multisig.PubKeyMultisigThreshold: -// pubKeys := key.PubKeys -// resKeys := make([]*types.PublicKey, len(pubKeys)) -// for i, k := range pubKeys { -// dk, err := cdc.Encode(k) -// if err != nil { -// return nil, err -// } -// resKeys[i] = dk -// } -// return &types.PublicKey{Sum: &types.PublicKey_Multisig{Multisig: &types.PubKeyMultisigThreshold{ -// K: uint32(key.K), -// PubKeys: resKeys, -// }}}, nil -// default: -// return nil, fmt.Errorf("can't encode PubKey of type %T. Use a custom PublicKeyCodec instead", key) -// } -//} diff --git a/types/query/pagination.pb.go b/types/query/pagination.pb.go deleted file mode 100644 index 8fee17e2..00000000 --- a/types/query/pagination.pb.go +++ /dev/null @@ -1,674 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/query/v1beta1/pagination.proto - -package query - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/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 - -// PageRequest is to be embedded in gRPC request messages for efficient -// pagination. Ex: -// -// message SomeRequest { -// Foo some_parameter = 1; -// PageRequest pagination = 2; -// } -type PageRequest struct { - // key is a value returned in PageResponse.next_key to begin - // querying the next page most efficiently. Only one of offset or key - // should be set. - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // offset is a numeric offset that can be used when key is unavailable. - // It is less efficient than using key. Only one of offset or key should - // be set. - Offset uint64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` - // limit is the total number of results to be returned in the result page. - // If left empty it will default to a value to be set by each app. - Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` - // count_total is set to true to indicate that the result set should include - // a count of the total number of items available for pagination in UIs. - // count_total is only respected when offset is used. It is ignored when key - // is set. - CountTotal bool `protobuf:"varint,4,opt,name=count_total,json=countTotal,proto3" json:"count_total,omitempty"` -} - -func (m *PageRequest) Reset() { *m = PageRequest{} } -func (m *PageRequest) String() string { return proto.CompactTextString(m) } -func (*PageRequest) ProtoMessage() {} -func (*PageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_53d6d609fe6828af, []int{0} -} -func (m *PageRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PageRequest.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 *PageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PageRequest.Merge(m, src) -} -func (m *PageRequest) XXX_Size() int { - return m.Size() -} -func (m *PageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PageRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PageRequest proto.InternalMessageInfo - -func (m *PageRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *PageRequest) GetOffset() uint64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *PageRequest) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *PageRequest) GetCountTotal() bool { - if m != nil { - return m.CountTotal - } - return false -} - -// PageResponse is to be embedded in gRPC response messages where the -// corresponding request message has used PageRequest. -// -// message SomeResponse { -// repeated Bar results = 1; -// PageResponse page = 2; -// } -type PageResponse struct { - // next_key is the key to be passed to PageRequest.key to - // query the next page most efficiently - NextKey []byte `protobuf:"bytes,1,opt,name=next_key,json=nextKey,proto3" json:"next_key,omitempty"` - // total is total number of results available if PageRequest.count_total - // was set, its value is undefined otherwise - Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` -} - -func (m *PageResponse) Reset() { *m = PageResponse{} } -func (m *PageResponse) String() string { return proto.CompactTextString(m) } -func (*PageResponse) ProtoMessage() {} -func (*PageResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_53d6d609fe6828af, []int{1} -} -func (m *PageResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PageResponse.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 *PageResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PageResponse.Merge(m, src) -} -func (m *PageResponse) XXX_Size() int { - return m.Size() -} -func (m *PageResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PageResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PageResponse proto.InternalMessageInfo - -func (m *PageResponse) GetNextKey() []byte { - if m != nil { - return m.NextKey - } - return nil -} - -func (m *PageResponse) GetTotal() uint64 { - if m != nil { - return m.Total - } - return 0 -} - -func init() { - proto.RegisterType((*PageRequest)(nil), "cosmos.base.query.v1beta1.PageRequest") - proto.RegisterType((*PageResponse)(nil), "cosmos.base.query.v1beta1.PageResponse") -} - -func init() { - proto.RegisterFile("cosmos/base/query/v1beta1/pagination.proto", fileDescriptor_53d6d609fe6828af) -} - -var fileDescriptor_53d6d609fe6828af = []byte{ - // 275 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0x41, 0x4b, 0xc3, 0x30, - 0x18, 0x86, 0x1b, 0x37, 0xe7, 0xc8, 0x76, 0x90, 0x20, 0xd2, 0x5d, 0x62, 0xd9, 0xa9, 0x08, 0x6d, - 0x18, 0xfe, 0x00, 0xc1, 0x8b, 0x07, 0x2f, 0x52, 0x3c, 0x79, 0x19, 0x69, 0xfd, 0xd6, 0x85, 0xad, - 0x49, 0xd7, 0x7c, 0x15, 0xfb, 0x2f, 0xfc, 0x59, 0x1e, 0x77, 0xf4, 0x28, 0xed, 0x1f, 0x91, 0x36, - 0x83, 0x9d, 0x92, 0xf7, 0xe5, 0xe1, 0x7b, 0xe0, 0xa5, 0xf7, 0x99, 0xb1, 0x85, 0xb1, 0x22, 0x95, - 0x16, 0xc4, 0xa1, 0x86, 0xaa, 0x11, 0x9f, 0xab, 0x14, 0x50, 0xae, 0x44, 0x29, 0x73, 0xa5, 0x25, - 0x2a, 0xa3, 0xe3, 0xb2, 0x32, 0x68, 0xd8, 0xc2, 0xb1, 0x71, 0xcf, 0xc6, 0x03, 0x1b, 0x9f, 0xd8, - 0xa5, 0xa6, 0xb3, 0x57, 0x99, 0x43, 0x02, 0x87, 0x1a, 0x2c, 0xb2, 0x6b, 0x3a, 0xda, 0x41, 0xe3, - 0x93, 0x80, 0x84, 0xf3, 0xa4, 0xff, 0xb2, 0x5b, 0x3a, 0x31, 0x9b, 0x8d, 0x05, 0xf4, 0x2f, 0x02, - 0x12, 0x8e, 0x93, 0x53, 0x62, 0x37, 0xf4, 0x72, 0xaf, 0x0a, 0x85, 0xfe, 0x68, 0xa8, 0x5d, 0x60, - 0x77, 0x74, 0x96, 0x99, 0x5a, 0xe3, 0x1a, 0x0d, 0xca, 0xbd, 0x3f, 0x0e, 0x48, 0x38, 0x4d, 0xe8, - 0x50, 0xbd, 0xf5, 0xcd, 0xf2, 0x91, 0xce, 0x9d, 0xcf, 0x96, 0x46, 0x5b, 0x60, 0x0b, 0x3a, 0xd5, - 0xf0, 0x85, 0xeb, 0xb3, 0xf5, 0xaa, 0xcf, 0x2f, 0xd0, 0xf4, 0x06, 0x77, 0xc5, 0x89, 0x5d, 0x78, - 0x7a, 0xfe, 0x69, 0x39, 0x39, 0xb6, 0x9c, 0xfc, 0xb5, 0x9c, 0x7c, 0x77, 0xdc, 0x3b, 0x76, 0xdc, - 0xfb, 0xed, 0xb8, 0xf7, 0x1e, 0xe5, 0x0a, 0xb7, 0x75, 0x1a, 0x67, 0xa6, 0x10, 0xaa, 0x52, 0x56, - 0x03, 0x0e, 0xef, 0xb6, 0x4e, 0x23, 0xfb, 0xb1, 0x8b, 0x72, 0x23, 0xb0, 0x29, 0xc1, 0xba, 0xb5, - 0xd2, 0xc9, 0xb0, 0xcd, 0xc3, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0x45, 0x81, 0x38, 0x49, - 0x01, 0x00, 0x00, -} - -func (m *PageRequest) 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 *PageRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CountTotal { - i-- - if m.CountTotal { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Limit != 0 { - i = encodeVarintPagination(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x18 - } - if m.Offset != 0 { - i = encodeVarintPagination(dAtA, i, uint64(m.Offset)) - i-- - dAtA[i] = 0x10 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintPagination(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PageResponse) 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 *PageResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Total != 0 { - i = encodeVarintPagination(dAtA, i, uint64(m.Total)) - i-- - dAtA[i] = 0x10 - } - if len(m.NextKey) > 0 { - i -= len(m.NextKey) - copy(dAtA[i:], m.NextKey) - i = encodeVarintPagination(dAtA, i, uint64(len(m.NextKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintPagination(dAtA []byte, offset int, v uint64) int { - offset -= sovPagination(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PageRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovPagination(uint64(l)) - } - if m.Offset != 0 { - n += 1 + sovPagination(uint64(m.Offset)) - } - if m.Limit != 0 { - n += 1 + sovPagination(uint64(m.Limit)) - } - if m.CountTotal { - n += 2 - } - return n -} - -func (m *PageResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NextKey) - if l > 0 { - n += 1 + l + sovPagination(uint64(l)) - } - if m.Total != 0 { - n += 1 + sovPagination(uint64(m.Total)) - } - return n -} - -func sovPagination(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozPagination(x uint64) (n int) { - return sovPagination(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PageRequest) 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 ErrIntOverflowPagination - } - 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: PageRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PageRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPagination - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPagination - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Offset |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CountTotal", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CountTotal = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipPagination(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPagination - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PageResponse) 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 ErrIntOverflowPagination - } - 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: PageResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PageResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPagination - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPagination - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NextKey = append(m.NextKey[:0], dAtA[iNdEx:postIndex]...) - if m.NextKey == nil { - m.NextKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) - } - m.Total = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Total |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipPagination(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPagination - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipPagination(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, ErrIntOverflowPagination - } - 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, ErrIntOverflowPagination - } - 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, ErrIntOverflowPagination - } - 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, ErrInvalidLengthPagination - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPagination - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPagination - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthPagination = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPagination = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPagination = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/result.go b/types/result.go deleted file mode 100644 index 49fcd2b6..00000000 --- a/types/result.go +++ /dev/null @@ -1,265 +0,0 @@ -package types - -import ( - "encoding/hex" - "encoding/json" - "fmt" - "math" - "strings" - - yaml "gopkg.in/yaml.v2" - - ctypes "github.com/tendermint/tendermint/rpc/core/types" - - "github.com/irisnet/irishub-sdk-go/codec" - codectypes "github.com/irisnet/irishub-sdk-go/codec/types" -) - -var cdc = codec.NewLegacyAmino() - -func (gi GasInfo) String() string { - bz, _ := yaml.Marshal(gi) - return string(bz) -} - -func (r Result) String() string { - bz, _ := yaml.Marshal(r) - return string(bz) -} - -func (r Result) GetEvents() Events { - events := make(Events, len(r.Events)) - for i, e := range r.Events { - events[i] = Event(e) - } - - return events -} - -// ABCIMessageLogs represents a slice of ABCIMessageLog. -type ABCIMessageLogs []ABCIMessageLog - -func NewABCIMessageLog(i uint32, log string, events Events) ABCIMessageLog { - return ABCIMessageLog{ - MsgIndex: i, - Log: log, - Events: StringifyEvents(events.ToABCIEvents()), - } -} - -// String implements the fmt.Stringer interface for the ABCIMessageLogs type. -func (logs ABCIMessageLogs) String() (str string) { - if logs != nil { - raw, err := cdc.MarshalJSON(logs) - if err == nil { - str = string(raw) - } - } - - return str -} - -// NewResponseResultTx returns a TxResponse given a ResultTx from tendermint -func NewResponseResultTx(res *ctypes.ResultTx, anyTx *codectypes.Any, timestamp string) *TxResponse { - if res == nil { - return nil - } - - parsedLogs, _ := ParseABCILogs(res.TxResult.Log) - - return &TxResponse{ - TxHash: res.Hash.String(), - Height: res.Height, - Codespace: res.TxResult.Codespace, - Code: res.TxResult.Code, - Data: strings.ToUpper(hex.EncodeToString(res.TxResult.Data)), - RawLog: res.TxResult.Log, - Logs: parsedLogs, - Info: res.TxResult.Info, - GasWanted: res.TxResult.GasWanted, - GasUsed: res.TxResult.GasUsed, - Tx: anyTx, - Timestamp: timestamp, - } -} - -// NewResponseFormatBroadcastTxCommit returns a TxResponse given a -// ResultBroadcastTxCommit from tendermint. -func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - if !res.CheckTx.IsOK() { - return newTxResponseCheckTx(res) - } - - return newTxResponseDeliverTx(res) -} - -func newTxResponseCheckTx(res *ctypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - var txHash string - if res.Hash != nil { - txHash = res.Hash.String() - } - - parsedLogs, _ := ParseABCILogs(res.CheckTx.Log) - - return &TxResponse{ - Height: res.Height, - TxHash: txHash, - Codespace: res.CheckTx.Codespace, - Code: res.CheckTx.Code, - Data: strings.ToUpper(hex.EncodeToString(res.CheckTx.Data)), - RawLog: res.CheckTx.Log, - Logs: parsedLogs, - Info: res.CheckTx.Info, - GasWanted: res.CheckTx.GasWanted, - GasUsed: res.CheckTx.GasUsed, - } -} - -func newTxResponseDeliverTx(res *ctypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - var txHash string - if res.Hash != nil { - txHash = res.Hash.String() - } - - parsedLogs, _ := ParseABCILogs(res.DeliverTx.Log) - - return &TxResponse{ - Height: res.Height, - TxHash: txHash, - Codespace: res.DeliverTx.Codespace, - Code: res.DeliverTx.Code, - Data: strings.ToUpper(hex.EncodeToString(res.DeliverTx.Data)), - RawLog: res.DeliverTx.Log, - Logs: parsedLogs, - Info: res.DeliverTx.Info, - GasWanted: res.DeliverTx.GasWanted, - GasUsed: res.DeliverTx.GasUsed, - } -} - -// NewResponseFormatBroadcastTx returns a TxResponse given a ResultBroadcastTx from tendermint -func NewResponseFormatBroadcastTx(res *ctypes.ResultBroadcastTx) *TxResponse { - if res == nil { - return nil - } - - parsedLogs, _ := ParseABCILogs(res.Log) - - return &TxResponse{ - Code: res.Code, - Codespace: res.Codespace, - Data: res.Data.String(), - RawLog: res.Log, - Logs: parsedLogs, - TxHash: res.Hash.String(), - } -} - -func (r TxResponse) String() string { - var sb strings.Builder - sb.WriteString("Response:\n") - - if r.Height > 0 { - sb.WriteString(fmt.Sprintf(" Height: %d\n", r.Height)) - } - if r.TxHash != "" { - sb.WriteString(fmt.Sprintf(" TxHash: %s\n", r.TxHash)) - } - if r.Code > 0 { - sb.WriteString(fmt.Sprintf(" Code: %d\n", r.Code)) - } - if r.Data != "" { - sb.WriteString(fmt.Sprintf(" Data: %s\n", r.Data)) - } - if r.RawLog != "" { - sb.WriteString(fmt.Sprintf(" Raw Log: %s\n", r.RawLog)) - } - if r.Logs != nil { - sb.WriteString(fmt.Sprintf(" Logs: %s\n", r.Logs)) - } - if r.Info != "" { - sb.WriteString(fmt.Sprintf(" Info: %s\n", r.Info)) - } - if r.GasWanted != 0 { - sb.WriteString(fmt.Sprintf(" GasWanted: %d\n", r.GasWanted)) - } - if r.GasUsed != 0 { - sb.WriteString(fmt.Sprintf(" GasUsed: %d\n", r.GasUsed)) - } - if r.Codespace != "" { - sb.WriteString(fmt.Sprintf(" Codespace: %s\n", r.Codespace)) - } - if r.Timestamp != "" { - sb.WriteString(fmt.Sprintf(" Timestamp: %s\n", r.Timestamp)) - } - - return strings.TrimSpace(sb.String()) -} - -// Empty returns true if the response is empty -func (r TxResponse) Empty() bool { - return r.TxHash == "" && r.Logs == nil -} - -func NewSearchTxsResult(totalCount, count, page, limit uint64, txs []*TxResponse) *SearchTxsResult { - return &SearchTxsResult{ - TotalCount: totalCount, - Count: count, - PageNumber: page, - PageTotal: uint64(math.Ceil(float64(totalCount) / float64(limit))), - Limit: limit, - Txs: txs, - } -} - -// ParseABCILogs attempts to parse a stringified ABCI tx log into a slice of -// ABCIMessageLog types. It returns an error upon JSON decoding failure. -func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { - err = json.Unmarshal([]byte(logs), &res) - return res, err -} - -var _, _ codectypes.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -// -// types.UnpackInterfaces needs to be called for each nested Tx because -// there are generally interfaces to unpack in Tx's -func (s SearchTxsResult) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - for _, tx := range s.Txs { - err := codectypes.UnpackInterfaces(tx, unpacker) - if err != nil { - return err - } - } - return nil -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (r TxResponse) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - if r.Tx != nil { - var tx Tx - return unpacker.UnpackAny(r.Tx, &tx) - } - return nil -} - -// GetTx unpacks the Tx from within a TxResponse and returns it -func (r TxResponse) GetTx() Tx { - if tx, ok := r.Tx.GetCachedValue().(Tx); ok { - return tx - } - return nil -} diff --git a/types/sign_mode_handler.go b/types/sign_mode_handler.go deleted file mode 100644 index a7b1eb09..00000000 --- a/types/sign_mode_handler.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// SignModeHandler defines a interface to be implemented by types which will handle -// SignMode's by generating sign bytes from a Tx and SignerData -type SignModeHandler interface { - // DefaultMode is the default mode that is to be used with this handler if no - // other mode is specified. This can be useful for testing and CLI usage - DefaultMode() signing.SignMode - - // Modes is the list of modes supporting by this handler - Modes() []signing.SignMode - - // GetSignBytes returns the sign bytes for the provided SignMode, SignerData and Tx, - // or an error - GetSignBytes(mode signing.SignMode, data SignerData, tx Tx) ([]byte, error) -} - -// SignerData is the specific information needed to sign a transaction that generally -// isn't included in the transaction body itself -type SignerData struct { - // ChainID is the chain that this transaction is targeted - ChainID string - - // AccountNumber is the account number of the signer - AccountNumber uint64 - - // Sequence is the account sequence number of the signer that is used - // for replay protection. This field is only useful for Legacy Amino signing, - // since in SIGN_MODE_DIRECT the account sequence is already in the signer - // info. - Sequence uint64 -} diff --git a/types/stdtx.go b/types/stdtx.go deleted file mode 100644 index 29b83525..00000000 --- a/types/stdtx.go +++ /dev/null @@ -1,236 +0,0 @@ -package types - -import ( - "encoding/json" - "errors" - "fmt" - - "github.com/irisnet/irishub-sdk-go/codec" -) - -const ( - // maxMemoCharacters = 100 - // txSigLimit = 7 - maxGasWanted = uint64((1 << 63) - 1) - - Sync BroadcastMode = "sync" - Async BroadcastMode = "async" - Commit BroadcastMode = "commit" -) - -type BroadcastMode string - -type Msgs []Msg - -func (m Msgs) Len() int { - return len(m) -} - -func (m Msgs) Sub(begin, end int) SplitAble { - return m[begin:end] -} - -// StdFee includes the amount of coins paid in fees and the maximum -// Gas to be used by the transaction. The ratio yields an effective "gasprice", -// which must be above some miminum to be accepted into the mempool. -type StdFee struct { - Amount Coins `json:"amount"` - Gas uint64 `json:"gas"` -} - -func NewStdFee(gas uint64, amount ...Coin) StdFee { - return StdFee{ - Amount: amount, - Gas: gas, - } -} - -// Fee bytes for signing later -func (fee StdFee) Bytes() []byte { - //if len(fee.Amount) == 0 { - // fee.Amount = Coins{} - //} - //bz, err := NewCodec().MarshalJSON(fee) - //if err != nil { - // panic(err) - //} - //return bz - //TODO - return nil -} - -// Standard Signature -type StdSignature struct { - PubKey []byte `json:"pub_key" yaml:"pub_key"` // optional - Signature []byte `json:"signature" yaml:"signature"` -} - -// StdSignMsg is a convenience structure for passing along -// a Msg with the other requirements for a StdSignDoc before -// it is signed. For use in the CLI. -type StdSignMsg struct { - ChainID string `json:"chain_id"` - AccountNumber uint64 `json:"account_number"` - Sequence uint64 `json:"sequence"` - Fee StdFee `json:"fee"` - Msgs []Msg `json:"msgs"` - Memo string `json:"memo"` -} - -// get message bytes -func (msg StdSignMsg) Bytes(cdc codec.Marshaler) []byte { - var msgsBytes []json.RawMessage - for _, msg := range msg.Msgs { - msgsBytes = append(msgsBytes, json.RawMessage(msg.GetSignBytes())) - } - bz, err := json.Marshal(StdSignDoc{ - AccountNumber: msg.AccountNumber, - ChainID: msg.ChainID, - Fee: json.RawMessage(msg.Fee.Bytes()), - Memo: msg.Memo, - Msgs: msgsBytes, - Sequence: msg.Sequence, - }) - if err != nil { - panic(err) - } - return MustSortJSON(bz) -} - -// StdSignDoc is replay-prevention structure. -// It includes the result of msg.GetSignBytes(), -// as well as the ChainID (prevent cross chain replay) -// and the Sequence numbers for each signature (prevent -// inchain replay and enforce tx ordering per account). -type StdSignDoc struct { - AccountNumber uint64 `json:"account_number"` - ChainID string `json:"chain_id"` - Fee json.RawMessage `json:"fee"` - Memo string `json:"memo"` - Msgs []json.RawMessage `json:"msgs"` - Sequence uint64 `json:"sequence"` -} - -// StdTx is a standard way to wrap a Msg with Fee and Signatures. -// NOTE: the first signature is the fee payer (Signatures must not be nil). -type StdTx struct { - Msgs []Msg `json:"msg"` - Fee StdFee `json:"fee"` - Signatures []StdSignature `json:"signatures"` - Memo string `json:"memo"` -} - -func NewStdTx(msgs []Msg, fee StdFee, sigs []StdSignature, memo string) StdTx { - return StdTx{ - Msgs: msgs, - Fee: fee, - Signatures: sigs, - Memo: memo, - } -} - -//nolint -// GetMsgs returns the all the transaction's messages. -func (tx StdTx) GetMsgs() []Msg { return tx.Msgs } -func (tx StdTx) GetSignBytes() []string { - var bz []string - for _, msg := range tx.Msgs { - bz = append(bz, string(msg.GetSignBytes())) - } - return bz -} - -// ValidateBasic does a simple and lightweight validation check that doesn't -// require access to any other information. -func (tx StdTx) ValidateBasic() error { - stdSigs := tx.GetSignatures() - - if tx.Fee.Gas > maxGasWanted { - return fmt.Errorf("invalid gas supplied; %d > %d", tx.Fee.Gas, maxGasWanted) - } - - if tx.Fee.Amount.IsAnyNegative() { - return fmt.Errorf("invalid fee %s amount provided", tx.Fee.Amount) - } - - if len(stdSigs) == 0 { - return errors.New("no signers") - } - if len(stdSigs) != len(tx.GetSigners()) { - return errors.New("wrong number of signers") - } - if len(stdSigs) != len(tx.GetSigners()) { - return fmt.Errorf( - "wrong number of signers; expected %d, got %d", len(tx.GetSigners()), len(stdSigs), - ) - } - return nil -} - -// GetSigners returns the addresses that must sign the transaction. -// Addresses are returned in a deterministic order. -// They are accumulated from the GetSigners method for each Msg -// in the order they appear in tx.GetMsgs(). -// Duplicate addresses will be omitted. -func (tx StdTx) GetSigners() []AccAddress { - seen := map[string]bool{} - var signers []AccAddress - for _, msg := range tx.GetMsgs() { - for _, addr := range msg.GetSigners() { - if !seen[addr.String()] { - signers = append(signers, addr) - seen[addr.String()] = true - } - } - } - return signers -} - -//nolint -func (tx StdTx) GetMemo() string { return tx.Memo } - -// GetSignatures returns the signature of signers who signed the Msg. -// CONTRACT: Length returned is same as length of -// pubkeys returned from MsgKeySigners, and the order -// matches. -// CONTRACT: If the signature is missing (ie the Msg is -// invalid), then the corresponding signature is -// .Empty(). -func (tx StdTx) GetSignatures() []StdSignature { return tx.Signatures } - -type BaseTx struct { - From string `json:"from"` - Password string `json:"password"` - Gas uint64 `json:"gas"` - Fee DecCoins `json:"fee"` - Memo string `json:"memo"` - Mode BroadcastMode `json:"broadcast_mode"` - Simulate bool `json:"simulate"` - AccountNumber uint64 `json:"account_number"` - Sequence uint64 `json:"sequence"` -} - -// ResultTx encapsulates the return result of the transaction. When the transaction fails, -// it is an empty object. The specific error information can be obtained through the Error interface. -type ResultTx struct { - GasWanted int64 `json:"gas_wanted"` - GasUsed int64 `json:"gas_used"` - Events StringEvents `json:"events"` - Hash string `json:"hash"` - Height int64 `json:"height"` -} - -// ResultQueryTx is used to prepare info to display -type ResultQueryTx struct { - Hash string `json:"hash"` - Height int64 `json:"height"` - Tx Tx `json:"tx"` - Result TxResult `json:"result"` - Timestamp string `json:"timestamp"` -} - -// ResultSearchTxs defines a structure for querying txs pageable -type ResultSearchTxs struct { - Total int `json:"total"` // Count of all txs - Txs []ResultQueryTx `json:"txs"` // List of txs in current page -} diff --git a/types/store/aes.go b/types/store/aes.go deleted file mode 100644 index 44b5a5ac..00000000 --- a/types/store/aes.go +++ /dev/null @@ -1,64 +0,0 @@ -package store - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "encoding/base64" - "fmt" - "io" -) - -type AES struct{} - -func (AES) Encrypt(text string, key string) (string, error) { - plaintext := []byte(text) - k := generateKey(key) - - block, err := aes.NewCipher(k) - if err != nil { - return "", err - } - - cipherText := make([]byte, aes.BlockSize+len(plaintext)) - iv := cipherText[:aes.BlockSize] - if _, err := io.ReadFull(rand.Reader, iv); err != nil { - return "", err - } - - stream := cipher.NewCFBEncrypter(block, iv) - stream.XORKeyStream(cipherText[aes.BlockSize:], plaintext) - - return base64.URLEncoding.EncodeToString(cipherText), nil -} - -func (AES) Decrypt(cryptoText string, key string) (string, error) { - cipherText, _ := base64.URLEncoding.DecodeString(cryptoText) - k := generateKey(key) - block, err := aes.NewCipher(k) - if err != nil { - return "", err - } - - if len(cipherText) < aes.BlockSize { - return "", err - } - iv := cipherText[:aes.BlockSize] - cipherText = cipherText[aes.BlockSize:] - - stream := cipher.NewCFBDecrypter(block, iv) - stream.XORKeyStream(cipherText, cipherText) - return fmt.Sprintf("%s", cipherText), nil -} - -func generateKey(key string) (genKey []byte) { - keyBz := []byte(key) - genKey = make([]byte, 32) - copy(genKey, keyBz) - for i := 32; i < len(keyBz); { - for j := 0; j < 32 && i < len(keyBz); j, i = j+1, i+1 { - genKey[j] ^= keyBz[i] - } - } - return genKey -} diff --git a/types/store/codec.go b/types/store/codec.go deleted file mode 100644 index 6d0cd29c..00000000 --- a/types/store/codec.go +++ /dev/null @@ -1,31 +0,0 @@ -package store - -import ( - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/codec" - cryptoAmino "github.com/irisnet/irishub-sdk-go/crypto/codec" - "github.com/irisnet/irishub-sdk-go/crypto/hd" -) - -var cdc *codec.LegacyAmino - -func init() { - cdc = codec.NewLegacyAmino() - cryptoAmino.RegisterCrypto(cdc) - RegisterCodec(cdc) - cdc.Seal() -} - -// RegisterCodec registers concrete types and interfaces on the given codec. -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterInterface((*Info)(nil), nil) - cdc.RegisterConcrete(hd.BIP44Params{}, "crypto/keys/hd/BIP44Params", nil) - cdc.RegisterConcrete(localInfo{}, "crypto/keys/localInfo", nil) -} - -// PubKeyFromBytes unmarshals public key bytes and returns a PubKey -func PubKeyFromBytes(pubKeyBytes []byte) (pubKey crypto.PubKey, err error) { - err = cdc.UnmarshalBinaryBare(pubKeyBytes, &pubKey) - return -} diff --git a/types/store/file.go b/types/store/file.go deleted file mode 100644 index 691772c9..00000000 --- a/types/store/file.go +++ /dev/null @@ -1,194 +0,0 @@ -package store - -// -//import ( -// "encoding/json" -// "fmt" -// "io/ioutil" -// "os" -// "path/filepath" -// "strings" -// "time" -// -// "github.com/99designs/keyring" -// jose "github.com/dvsekhvalnov/jose2go" -// "github.com/mitchellh/go-homedir" -// "github.com/mtibben/percent" -// "github.com/pkg/errors" -// -// cryptoamino "github.com/irisnet/irishub-sdk-go/crypto/codec" -// "github.com/irisnet/irishub-sdk-go/crypto/hd" -//) -// -//const ( -// keyringFileDirName = "keyring-file" -//) -// -//var ( -// _ KeyDAO = FileDAO{} -// -// filenameEscape = func(s string) string { -// return percent.Encode(s, "/") -// } -//) -// -////Execute the local file system to realize the persistence of the key data, and the stored data is encrypted using `PBES2`. -////Can directly read the data of `iris` keys (--keyring-backend = file) -//type FileDAO struct { -// dir string -//} -// -//func NewFileDAO(dir string) KeyDAO { -// fileDir := filepath.Join(dir, keyringFileDirName) -// return &FileDAO{dir: fileDir} -//} -// -//// Write will use user password to encrypt data and save to file, the file name is user name -//func (f FileDAO) Write(name, password string, info KeyInfo) error { -// pubkey, err := PubKeyFromBytes(info.PubKey) -// if err != nil { -// return err -// } -// -// lInfo := localInfo{ -// Name: info.Name, -// PubKey: pubkey, -// PrivKeyArmor: info.PrivKeyArmor, -// Algo: hd.PubKeyType(info.Algo), -// } -// -// item := keyring.Item{ -// Key: name, -// Data: marshalInfo(lInfo), -// } -// -// bytes, err := json.Marshal(item) -// if err != nil { -// return err -// } -// -// token, err := jose.Encrypt( -// string(bytes), jose.PBES2_HS256_A128KW, jose.A256GCM, password, -// jose.Headers(map[string]interface{}{"created": time.Now().String()}), -// ) -// if err != nil { -// return err -// } -// -// filename, err := f.filename(item.Key) -// if err != nil { -// return err -// } -// -// return ioutil.WriteFile(filename, []byte(token), 0600) -//} -// -//// Read will read encrypted data from file and decrypt with user password -//func (f FileDAO) Read(name, password string) (KeyInfo, error) { -// filename, err := f.filename(name) -// if err != nil { -// return KeyInfo{}, err -// } -// -// if len(password) == 0 { -// return KeyInfo{}, fmt.Errorf("no password") -// } -// -// bytes, err := ioutil.ReadFile(filename) -// if err != nil { -// return KeyInfo{}, errors.Wrap(err, "not found") -// } -// -// payload, _, err := jose.Decode(string(bytes), password) -// if err != nil { -// return KeyInfo{}, err -// } -// -// var decoded keyring.Item -// err = json.Unmarshal([]byte(payload), &decoded) -// if err != nil { -// return KeyInfo{}, err -// } -// -// info, err := unmarshalInfo(decoded.Data) -// if err != nil { -// return KeyInfo{}, err -// } -// -// i, ok := info.(localInfo) -// if !ok { -// return KeyInfo{}, fmt.Errorf("only support type KeyInfo") -// } -// -// return KeyInfo{ -// Name: i.Name, -// PubKey: cryptoamino.MarshalPubkey(i.PubKey), -// PrivKeyArmor: i.PrivKeyArmor, -// Algo: string(i.Algo), -// }, nil -//} -// -//// Delete will delete user data and use user password to verify permissions -//func (f FileDAO) Delete(name, password string) error { -// //Perform security verification -// if _, err := f.Read(name, password); err != nil { -// return err -// } -// -// filename, err := f.filename(name) -// if err != nil { -// return err -// } -// -// return os.Remove(filename) -//} -// -//// Has returns whether the specified user name exists -//func (f FileDAO) Has(name string) bool { -// filename, err := f.filename(name) -// if err != nil { -// return false -// } -// if _, err = os.Stat(filename); err == nil { -// return true -// } -// if os.IsNotExist(err) { -// return false -// } -// return false -//} -// -//func (f *FileDAO) filename(key string) (string, error) { -// dir, err := f.resolveDir() -// if err != nil { -// return "", err -// } -// -// return filepath.Join(dir, filenameEscape(string(infoKey(key)))), nil -//} -// -//func (f *FileDAO) resolveDir() (string, error) { -// if f.dir == "" { -// return "", fmt.Errorf("no directory provided for file keyring") -// } -// -// dir := f.dir -// -// // expand tilde for home directory -// if strings.HasPrefix(dir, "~") { -// home, err := homedir.Dir() -// if err != nil { -// return "", err -// } -// dir = strings.Replace(dir, "~", home, 1) -// } -// -// stat, err := os.Stat(dir) -// if os.IsNotExist(err) { -// err = os.MkdirAll(dir, 0700) -// } else if err != nil && !stat.IsDir() { -// err = fmt.Errorf("%s is a file, not a directory", dir) -// } -// -// return dir, err -//} diff --git a/types/store/level_db.go b/types/store/level_db.go deleted file mode 100644 index f718f19a..00000000 --- a/types/store/level_db.go +++ /dev/null @@ -1,118 +0,0 @@ -package store - -import ( - "encoding/json" - "fmt" - "path/filepath" - - dbm "github.com/tendermint/tm-db" -) - -const ( - keyDBName = "keys" - infoSuffix = "info" -) - -var ( - _ KeyDAO = LevelDBDAO{} -) - -type LevelDBDAO struct { - db dbm.DB - Crypto -} - -// NewLevelDB initialize a keybase based on the configuration. -// Use leveldb as storage -func NewLevelDB(rootDir string, crypto Crypto) (KeyDAO, error) { - db, err := dbm.NewGoLevelDB(keyDBName, filepath.Join(rootDir, "keys")) - if err != nil { - return nil, err - } - - if crypto == nil { - crypto = AES{} - } - - levelDB := LevelDBDAO{ - db: db, - Crypto: crypto, - } - return levelDB, nil -} - -// Write add a key information to the local store -func (k LevelDBDAO) Write(name, password string, info KeyInfo) error { - if k.Has(name) { - return fmt.Errorf("name %s has exist", name) - } - - privStr, err := k.Encrypt(info.PrivKeyArmor, password) - if err != nil { - return err - } - - info.PrivKeyArmor = privStr - - bz, err := json.Marshal(info) - if err != nil { - return err - } - return k.db.SetSync(infoKey(name), bz) -} - -// Read read a key information from the local store -func (k LevelDBDAO) Read(name, password string) (store KeyInfo, err error) { - bz, err := k.db.Get(infoKey(name)) - if bz == nil || err != nil { - return store, err - } - - if err := json.Unmarshal(bz, &store); err != nil { - return store, err - } - - if len(password) > 0 { - privStr, err := k.Decrypt(store.PrivKeyArmor, password) - if err != nil { - return store, err - } - store.PrivKeyArmor = privStr - } - return -} - -// ReadMetadata read a key information from the local store -func (k LevelDBDAO) ReadMetadata(name string) (store KeyInfo, err error) { - bz, err := k.db.Get(infoKey(name)) - if bz == nil || err != nil { - return store, err - } - - if err := json.Unmarshal(bz, &store); err != nil { - return store, err - } - return -} - -// Delete delete a key from the local store -func (k LevelDBDAO) Delete(name, password string) error { - _, err := k.Read(name, password) - if err != nil { - return err - } - return k.db.DeleteSync(infoKey(name)) -} - -// Delete delete a key from the local store -func (k LevelDBDAO) Has(name string) bool { - existed, err := k.db.Has(infoKey(name)) - if err != nil { - return false - } - return existed -} - -func infoKey(name string) []byte { - return []byte(fmt.Sprintf("%s.%s", name, infoSuffix)) -} diff --git a/types/store/memory.go b/types/store/memory.go deleted file mode 100644 index f1a2d2c2..00000000 --- a/types/store/memory.go +++ /dev/null @@ -1,40 +0,0 @@ -package store - -// Use memory as storage, use with caution in build environment -type MemoryDAO struct { - store map[string]KeyInfo - Crypto -} - -func NewMemory(crypto Crypto) MemoryDAO { - if crypto == nil { - crypto = AES{} - } - return MemoryDAO{ - store: make(map[string]KeyInfo), - Crypto: crypto, - } -} -func (m MemoryDAO) Write(name, password string, store KeyInfo) error { - m.store[name] = store - return nil -} - -func (m MemoryDAO) Read(name, password string) (KeyInfo, error) { - return m.store[name], nil -} - -// ReadMetadata read a key information from the local store -func (m MemoryDAO) ReadMetadata(name string) (store KeyInfo, err error) { - return m.store[name], nil -} - -func (m MemoryDAO) Delete(name, password string) error { - delete(m.store, name) - return nil -} - -func (m MemoryDAO) Has(name string) bool { - _, ok := m.store[name] - return ok -} diff --git a/types/store/types.go b/types/store/types.go deleted file mode 100644 index 643a777e..00000000 --- a/types/store/types.go +++ /dev/null @@ -1,107 +0,0 @@ -package store - -import ( - "fmt" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/crypto/hd" -) - -var ( - _ Info = &localInfo{} -) - -// KeyType reflects a human-readable type for key listing. -type KeyType uint - -// Info KeyTypes -const ( - TypeLocal KeyType = 0 -) - -// KeyInfo saves the basic information of the key -type KeyInfo struct { - Name string `json:"name"` - PubKey []byte `json:"pubkey"` - PrivKeyArmor string `json:"priv_key_armor"` - Algo string `json:"algo"` -} - -type KeyDAO interface { - // Write will use user password to encrypt data and save to file, the file name is user name - Write(name, password string, store KeyInfo) error - - // Read will read encrypted data from file and decrypt with user password - Read(name, password string) (KeyInfo, error) - - // Delete will delete user data and use user password to verify permissions - Delete(name, password string) error - - // Has returns whether the specified user name exists - Has(name string) bool -} - -type Crypto interface { - Encrypt(data string, password string) (string, error) - Decrypt(data string, password string) (string, error) -} - -// Info is the publicly exposed information about a keypair -type Info interface { - // Human-readable type for key listing - GetType() KeyType - // Name of the key - GetName() string - // Public key - GetPubKey() crypto.PubKey - // Bip44 Path - GetPath() (*hd.BIP44Params, error) - // Algo - GetAlgo() hd.PubKeyType -} - -// localInfo is the public information about a locally stored key -// Note: Algo must be last field in struct for backwards amino compatibility -type localInfo struct { - Name string `json:"name"` - PubKey crypto.PubKey `json:"pubkey"` - PrivKeyArmor string `json:"privkey.armor"` - Algo hd.PubKeyType `json:"algo"` -} - -// GetType implements Info interface -func (i localInfo) GetType() KeyType { - return TypeLocal -} - -// GetType implements Info interface -func (i localInfo) GetName() string { - return i.Name -} - -// GetType implements Info interface -func (i localInfo) GetPubKey() crypto.PubKey { - return i.PubKey -} - -// GetType implements Info interface -func (i localInfo) GetAlgo() hd.PubKeyType { - return i.Algo -} - -// GetType implements Info interface -func (i localInfo) GetPath() (*hd.BIP44Params, error) { - return nil, fmt.Errorf("BIP44 Paths are not available for this type") -} - -// encoding info -func marshalInfo(i Info) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(i) -} - -// decoding info -func unmarshalInfo(bz []byte) (info Info, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(bz, &info) - return -} diff --git a/types/tm_types.go b/types/tm_types.go deleted file mode 100644 index 26497d1b..00000000 --- a/types/tm_types.go +++ /dev/null @@ -1,47 +0,0 @@ -package types - -import ( - "encoding/hex" - "strings" - - "github.com/tendermint/tendermint/crypto" - tmbytes "github.com/tendermint/tendermint/libs/bytes" - tmclient "github.com/tendermint/tendermint/rpc/client" - tmtypes "github.com/tendermint/tendermint/types" - - cryptoAmino "github.com/irisnet/irishub-sdk-go/crypto/codec" - "github.com/irisnet/irishub-sdk-go/types/kv" -) - -type ( - HexBytes = tmbytes.HexBytes - ABCIClient = tmclient.ABCIClient - SignClient = tmclient.SignClient - StatusClient = tmclient.StatusClient - NetworkClient = tmclient.NetworkClient - Header = tmtypes.Header - Pair = kv.Pair - - TmPubKey = crypto.PubKey -) - -var ( - PubKeyFromBytes = cryptoAmino.PubKeyFromBytes -) - -func MustHexBytesFrom(hexStr string) HexBytes { - v, _ := hex.DecodeString(hexStr) - return HexBytes(v) -} - -func HexBytesFrom(hexStr string) (HexBytes, error) { - v, err := hex.DecodeString(hexStr) - if err != nil { - return nil, err - } - return HexBytes(v), nil -} - -func HexStringFrom(bz []byte) string { - return strings.ToUpper(hex.EncodeToString(bz)) -} diff --git a/types/token.go b/types/token.go deleted file mode 100644 index 064de34c..00000000 --- a/types/token.go +++ /dev/null @@ -1,37 +0,0 @@ -package types - -// var ( -// POINT = Token{ -// Symbol: "iris", -// Name: "Network staking token", -// Scale: 0, -// MinUnit: "uiris", -// InitialSupply: 2000000000, -// MaxSupply: 1000000000000, -// Mintable: true, -// Owner: "", -// } -// ) - -type Token struct { - Symbol string `json:"symbol"` - Name string `json:"name"` - Scale uint32 `json:"scale"` - MinUnit string `json:"min_unit"` - InitialSupply uint64 `json:"initial_supply"` - MaxSupply uint64 `json:"max_supply"` - Mintable bool `json:"mintable"` - Owner string `json:"owner"` -} - -// GetCoinType returns CnType -func (t Token) GetCoinType() CoinType { - return CoinType{ - Name: t.Name, - MinUnit: NewUnit(t.MinUnit, uint8(t.Scale)), - MainUnit: NewUnit(t.Symbol, 0), - Desc: t.Name, - } -} - -type Tokens []Token diff --git a/types/tx/builder.go b/types/tx/builder.go deleted file mode 100644 index 32c819e8..00000000 --- a/types/tx/builder.go +++ /dev/null @@ -1,351 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - - "github.com/tendermint/tendermint/crypto" - - codectypes "github.com/irisnet/irishub-sdk-go/codec/types" - "github.com/irisnet/irishub-sdk-go/types" - sdk "github.com/irisnet/irishub-sdk-go/types" - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// wrapper is a wrapper around the tx.Tx proto.Message which retain the raw -// body and auth_info bytes. -type wrapper struct { - tx *Tx - - // bodyBz represents the protobuf encoding of TxBody. This should be encoding - // from the client using TxRaw if the tx was decoded from the wire - bodyBz []byte - - // authInfoBz represents the protobuf encoding of TxBody. This should be encoding - // from the client using TxRaw if the tx was decoded from the wire - authInfoBz []byte - - txBodyHasUnknownNonCriticals bool -} - -var ( - _ ExtensionOptionsTxBuilder = &wrapper{} - _ codectypes.IntoAny = &wrapper{} -) - -// ExtensionOptionsTxBuilder defines a TxBuilder that can also set extensions. -type ExtensionOptionsTxBuilder interface { - SetExtensionOptions(...*codectypes.Any) - SetNonCriticalExtensionOptions(...*codectypes.Any) -} - -func newBuilder() *wrapper { - return &wrapper{ - tx: &Tx{ - Body: &TxBody{}, - AuthInfo: &AuthInfo{ - Fee: &Fee{}, - }, - }, - } -} - -func (w *wrapper) GetMsgs() []sdk.Msg { - return w.tx.GetMsgs() -} - -func (w *wrapper) ValidateBasic() error { - return w.tx.ValidateBasic() -} - -func (w *wrapper) getBodyBytes() []byte { - if len(w.bodyBz) == 0 { - // if bodyBz is empty, then marshal the body. bodyBz will generally - // be set to nil whenever SetBody is called so the result of calling - // this method should always return the correct bytes. Note that after - // decoding bodyBz is derived from TxRaw so that it matches what was - // transmitted over the wire - var err error - w.bodyBz, err = proto.Marshal(w.tx.Body) - if err != nil { - panic(err) - } - } - return w.bodyBz -} - -func (w *wrapper) getAuthInfoBytes() []byte { - if len(w.authInfoBz) == 0 { - // if authInfoBz is empty, then marshal the body. authInfoBz will generally - // be set to nil whenever SetAuthInfo is called so the result of calling - // this method should always return the correct bytes. Note that after - // decoding authInfoBz is derived from TxRaw so that it matches what was - // transmitted over the wire - var err error - w.authInfoBz, err = proto.Marshal(w.tx.AuthInfo) - if err != nil { - panic(err) - } - } - return w.authInfoBz -} - -func (w *wrapper) GetSigners() []sdk.AccAddress { - return w.tx.GetSigners() -} - -func (w *wrapper) GetPubKeys() []crypto.PubKey { - signerInfos := w.tx.AuthInfo.SignerInfos - pks := make([]crypto.PubKey, len(signerInfos)) - - for i, si := range signerInfos { - // NOTE: it is okay to leave this nil if there is no PubKey in the SignerInfo. - // PubKey's can be left unset in SignerInfo. - if si.PublicKey == nil { - continue - } - - pk, ok := si.PublicKey.GetCachedValue().(crypto.PubKey) - if ok { - pks[i] = pk - } - } - - return pks -} - -func (w *wrapper) GetGas() uint64 { - return w.tx.AuthInfo.Fee.GasLimit -} - -func (w *wrapper) GetFee() sdk.Coins { - return w.tx.AuthInfo.Fee.Amount -} - -func (w *wrapper) FeePayer() sdk.AccAddress { - feePayer := w.tx.AuthInfo.Fee.Payer - if feePayer != "" { - payerAddr, err := sdk.AccAddressFromBech32(feePayer) - if err != nil { - panic(err) - } - return payerAddr - } - // use first signer as default if no payer specified - return w.GetSigners()[0] -} - -func (w *wrapper) FeeGranter() sdk.AccAddress { - feePayer := w.tx.AuthInfo.Fee.Granter - if feePayer != "" { - granterAddr, err := sdk.AccAddressFromBech32(feePayer) - if err != nil { - panic(err) - } - return granterAddr - } - return nil -} - -func (w *wrapper) GetMemo() string { - return w.tx.Body.Memo -} - -func (w *wrapper) GetSignatures() [][]byte { - return w.tx.Signatures -} - -// GetTimeoutHeight returns the transaction's timeout height (if set). -func (w *wrapper) GetTimeoutHeight() uint64 { - return w.tx.Body.TimeoutHeight -} - -func (w *wrapper) GetSignaturesV2() ([]signing.SignatureV2, error) { - signerInfos := w.tx.AuthInfo.SignerInfos - sigs := w.tx.Signatures - pubKeys := w.GetPubKeys() - n := len(signerInfos) - res := make([]signing.SignatureV2, n) - - for i, si := range signerInfos { - // handle nil signatures (in case of simulation) - if si.ModeInfo == nil { - res[i] = signing.SignatureV2{ - PubKey: pubKeys[i], - } - } else { - var err error - sigData, err := ModeInfoAndSigToSignatureData(si.ModeInfo, sigs[i]) - if err != nil { - return nil, err - } - res[i] = signing.SignatureV2{ - PubKey: pubKeys[i], - Data: sigData, - Sequence: si.GetSequence(), - } - - } - } - - return res, nil -} - -func (w *wrapper) SetMsgs(msgs ...sdk.Msg) error { - anys := make([]*codectypes.Any, len(msgs)) - - for i, msg := range msgs { - var err error - anys[i], err = codectypes.NewAnyWithValue(msg) - if err != nil { - return err - } - } - - w.tx.Body.Messages = anys - - // set bodyBz to nil because the cached bodyBz no longer matches tx.Body - w.bodyBz = nil - - return nil -} - -// SetTimeoutHeight sets the transaction's height timeout. -func (w *wrapper) SetTimeoutHeight(height uint64) { - w.tx.Body.TimeoutHeight = height - - // set bodyBz to nil because the cached bodyBz no longer matches tx.Body - w.bodyBz = nil -} - -func (w *wrapper) SetMemo(memo string) { - w.tx.Body.Memo = memo - - // set bodyBz to nil because the cached bodyBz no longer matches tx.Body - w.bodyBz = nil -} - -func (w *wrapper) SetGasLimit(limit uint64) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.GasLimit = limit - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetFeeAmount(coins sdk.Coins) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.Amount = coins - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetFeePayer(feePayer sdk.AccAddress) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.Payer = feePayer.String() - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetFeeGranter(feeGranter sdk.AccAddress) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.Granter = feeGranter.String() - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetSignatures(signatures ...signing.SignatureV2) error { - n := len(signatures) - signerInfos := make([]*SignerInfo, n) - rawSigs := make([][]byte, n) - - for i, sig := range signatures { - var modeInfo *ModeInfo - modeInfo, rawSigs[i] = SignatureDataToModeInfoAndSig(sig.Data) - any, err := PubKeyToAny(sig.PubKey) - if err != nil { - return err - } - signerInfos[i] = &SignerInfo{ - PublicKey: any, - ModeInfo: modeInfo, - Sequence: sig.Sequence, - } - } - - w.setSignerInfos(signerInfos) - w.setSignatures(rawSigs) - - return nil -} - -func (w *wrapper) setSignerInfos(infos []*SignerInfo) { - w.tx.AuthInfo.SignerInfos = infos - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) setSignatures(sigs [][]byte) { - w.tx.Signatures = sigs -} - -func (w *wrapper) GetTx() sdk.Tx { - return w -} - -// GetProtoTx returns the tx as a proto.Message. -func (w *wrapper) AsAny() *codectypes.Any { - // We're sure here that w.tx is a proto.Message, so this will call - // codectypes.NewAnyWithValue under the hood. - return codectypes.UnsafePackAny(w.tx) -} - -// WrapTx creates a TxBuilder wrapper around a tx.Tx proto message. -func WrapTx(protoTx *Tx) types.TxBuilder { - return &wrapper{ - tx: protoTx, - } -} - -func (w *wrapper) GetExtensionOptions() []*codectypes.Any { - return w.tx.Body.ExtensionOptions -} - -func (w *wrapper) GetNonCriticalExtensionOptions() []*codectypes.Any { - return w.tx.Body.NonCriticalExtensionOptions -} - -func (w *wrapper) SetExtensionOptions(extOpts ...*codectypes.Any) { - w.tx.Body.ExtensionOptions = extOpts - w.bodyBz = nil -} - -func (w *wrapper) SetNonCriticalExtensionOptions(extOpts ...*codectypes.Any) { - w.tx.Body.NonCriticalExtensionOptions = extOpts - w.bodyBz = nil -} - -// PubKeyToAny converts a crypto.PubKey to a proto Any. -func PubKeyToAny(key crypto.PubKey) (*codectypes.Any, error) { - protoMsg, ok := key.(proto.Message) - if !ok { - return nil, sdk.Wrap(fmt.Errorf("err invalid key, can't proto encode %T", protoMsg)) - } - return codectypes.NewAnyWithValue(protoMsg) -} diff --git a/types/tx/config.go b/types/tx/config.go deleted file mode 100644 index a476b903..00000000 --- a/types/tx/config.go +++ /dev/null @@ -1,65 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/irisnet/irishub-sdk-go/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" - signingtypes "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -type config struct { - handler sdk.SignModeHandler - decoder sdk.TxDecoder - encoder sdk.TxEncoder - jsonDecoder sdk.TxDecoder - jsonEncoder sdk.TxEncoder - protoCodec *codec.ProtoCodec -} - -// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The -// first enabled sign mode will become the default sign mode. -func NewTxConfig(protoCodec *codec.ProtoCodec, enabledSignModes []signingtypes.SignMode) sdk.TxConfig { - return &config{ - handler: MakeSignModeHandler(enabledSignModes), - decoder: DefaultTxDecoder(protoCodec), - encoder: DefaultTxEncoder(), - jsonDecoder: DefaultJSONTxDecoder(protoCodec), - jsonEncoder: DefaultJSONTxEncoder(), - protoCodec: protoCodec, - } -} - -func (g config) NewTxBuilder() sdk.TxBuilder { - return newBuilder() -} - -// WrapTxBuilder returns a builder from provided transaction -func (g config) WrapTxBuilder(newTx sdk.Tx) (sdk.TxBuilder, error) { - newBuilder, ok := newTx.(*wrapper) - if !ok { - return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, newTx) - } - - return newBuilder, nil -} - -func (g config) SignModeHandler() sdk.SignModeHandler { - return g.handler -} - -func (g config) TxEncoder() sdk.TxEncoder { - return g.encoder -} - -func (g config) TxDecoder() sdk.TxDecoder { - return g.decoder -} - -func (g config) TxJSONEncoder() sdk.TxEncoder { - return g.jsonEncoder -} - -func (g config) TxJSONDecoder() sdk.TxDecoder { - return g.jsonDecoder -} diff --git a/types/tx/decoder.go b/types/tx/decoder.go deleted file mode 100644 index 0dca9a08..00000000 --- a/types/tx/decoder.go +++ /dev/null @@ -1,79 +0,0 @@ -package tx - -import ( - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/codec/unknownproto" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// DefaultTxDecoder returns a default protobuf TxDecoder using the provided Marshaler. -func DefaultTxDecoder(cdc *codec.ProtoCodec) sdk.TxDecoder { - return func(txBytes []byte) (sdk.Tx, error) { - var raw TxRaw - - // reject all unknown proto fields in the root TxRaw - err := unknownproto.RejectUnknownFieldsStrict(txBytes, &raw) - if err != nil { - return nil, err - } - - err = cdc.UnmarshalBinaryBare(txBytes, &raw) - if err != nil { - return nil, err - } - - var body TxBody - - // allow non-critical unknown fields in TxBody - txBodyHasUnknownNonCriticals, err := unknownproto.RejectUnknownFields(raw.BodyBytes, &body, true) - if err != nil { - return nil, err - } - - err = cdc.UnmarshalBinaryBare(raw.BodyBytes, &body) - if err != nil { - return nil, err - } - - var authInfo AuthInfo - - // reject all unknown proto fields in AuthInfo - err = unknownproto.RejectUnknownFieldsStrict(raw.AuthInfoBytes, &authInfo) - if err != nil { - return nil, err - } - - err = cdc.UnmarshalBinaryBare(raw.AuthInfoBytes, &authInfo) - if err != nil { - return nil, err - } - - theTx := &Tx{ - Body: &body, - AuthInfo: &authInfo, - Signatures: raw.Signatures, - } - - return &wrapper{ - tx: theTx, - bodyBz: raw.BodyBytes, - authInfoBz: raw.AuthInfoBytes, - txBodyHasUnknownNonCriticals: txBodyHasUnknownNonCriticals, - }, nil - } -} - -// DefaultJSONTxDecoder returns a default protobuf JSON TxDecoder using the provided Marshaler. -func DefaultJSONTxDecoder(cdc *codec.ProtoCodec) sdk.TxDecoder { - return func(txBytes []byte) (sdk.Tx, error) { - var theTx Tx - err := cdc.UnmarshalJSON(txBytes, &theTx) - if err != nil { - return nil, err - } - - return &wrapper{ - tx: &theTx, - }, nil - } -} diff --git a/types/tx/direct.go b/types/tx/direct.go deleted file mode 100644 index 14405da5..00000000 --- a/types/tx/direct.go +++ /dev/null @@ -1,52 +0,0 @@ -package tx - -import ( - "fmt" - - sdk "github.com/irisnet/irishub-sdk-go/types" - signingtypes "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// signModeDirectHandler defines the SIGN_MODE_DIRECT SignModeHandler -type signModeDirectHandler struct{} - -var _ sdk.SignModeHandler = signModeDirectHandler{} - -// DefaultMode implements SignModeHandler.DefaultMode -func (signModeDirectHandler) DefaultMode() signingtypes.SignMode { - return signingtypes.SignMode_SIGN_MODE_DIRECT -} - -// Modes implements SignModeHandler.Modes -func (signModeDirectHandler) Modes() []signingtypes.SignMode { - return []signingtypes.SignMode{signingtypes.SignMode_SIGN_MODE_DIRECT} -} - -// GetSignBytes implements SignModeHandler.GetSignBytes -func (signModeDirectHandler) GetSignBytes(mode signingtypes.SignMode, data sdk.SignerData, tx sdk.Tx) ([]byte, error) { - if mode != signingtypes.SignMode_SIGN_MODE_DIRECT { - return nil, fmt.Errorf("expected %s, got %s", signingtypes.SignMode_SIGN_MODE_DIRECT, mode) - } - - protoTx, ok := tx.(*wrapper) - if !ok { - return nil, fmt.Errorf("can only handle a protobuf Tx, got %T", tx) - } - - bodyBz := protoTx.getBodyBytes() - authInfoBz := protoTx.getAuthInfoBytes() - - return DirectSignBytes(bodyBz, authInfoBz, data.ChainID, data.AccountNumber) -} - -// DirectSignBytes returns the SIGN_MODE_DIRECT sign bytes for the provided TxBody bytes, AuthInfo bytes, chain ID, -// account number and sequence. -func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string, accnum uint64) ([]byte, error) { - signDoc := SignDoc{ - BodyBytes: bodyBytes, - AuthInfoBytes: authInfoBytes, - ChainId: chainID, - AccountNumber: accnum, - } - return signDoc.Marshal() -} diff --git a/types/tx/encoder.go b/types/tx/encoder.go deleted file mode 100644 index 6c78663f..00000000 --- a/types/tx/encoder.go +++ /dev/null @@ -1,46 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/irishub-sdk-go/codec" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// DefaultTxEncoder returns a default protobuf TxEncoder using the provided Marshaler -func DefaultTxEncoder() sdk.TxEncoder { - return func(tx sdk.Tx) ([]byte, error) { - txWrapper, ok := tx.(*wrapper) - if !ok { - return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, tx) - } - - raw := &TxRaw{ - BodyBytes: txWrapper.getBodyBytes(), - AuthInfoBytes: txWrapper.getAuthInfoBytes(), - Signatures: txWrapper.tx.Signatures, - } - - return proto.Marshal(raw) - } -} - -// DefaultJSONTxEncoder returns a default protobuf JSON TxEncoder using the provided Marshaler. -func DefaultJSONTxEncoder() sdk.TxEncoder { - return func(tx sdk.Tx) ([]byte, error) { - txWrapper, ok := tx.(*wrapper) - if ok { - return codec.ProtoMarshalJSON(txWrapper.tx) - } - - protoTx, ok := tx.(*Tx) - if ok { - return codec.ProtoMarshalJSON(protoTx) - } - - return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, tx) - - } -} diff --git a/types/tx/mode_handler.go b/types/tx/mode_handler.go deleted file mode 100644 index 8f4587e7..00000000 --- a/types/tx/mode_handler.go +++ /dev/null @@ -1,40 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/irisnet/irishub-sdk-go/types" - signingtypes "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// DefaultSignModes are the default sign modes enabled for protobuf transactions. -var DefaultSignModes = []signingtypes.SignMode{ - signingtypes.SignMode_SIGN_MODE_DIRECT, - //signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, -} - -// makeSignModeHandler returns the default protobuf SignModeHandler supporting -// SIGN_MODE_DIRECT and SIGN_MODE_LEGACY_AMINO_JSON. -func MakeSignModeHandler(modes []signingtypes.SignMode) types.SignModeHandler { - if len(modes) < 1 { - panic(fmt.Errorf("no sign modes enabled")) - } - - handlers := make([]types.SignModeHandler, len(modes)) - - for i, mode := range modes { - switch mode { - case signingtypes.SignMode_SIGN_MODE_DIRECT: - handlers[i] = signModeDirectHandler{} - case signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON: - //handlers[i] = signModeLegacyAminoJSONHandler{} - default: - panic(fmt.Errorf("unsupported sign mode %+v", mode)) - } - } - - return types.NewSignModeHandlerMap( - modes[0], - handlers, - ) -} diff --git a/types/tx/signing/signature.go b/types/tx/signing/signature.go deleted file mode 100644 index f954312a..00000000 --- a/types/tx/signing/signature.go +++ /dev/null @@ -1,100 +0,0 @@ -package signing - -import ( - "fmt" - - "github.com/tendermint/tendermint/crypto" -) - -// SignatureV2 is a convenience type that is easier to use in application logic -// than the protobuf SignerInfo's and raw signature bytes. It goes beyond the -// first sdk.Signature types by supporting sign modes and explicitly nested -// multi-signatures. It is intended to be used for both building and verifying -// signatures. -type SignatureV2 struct { - // PubKey is the public key to use for verifying the signature - PubKey crypto.PubKey - - // Data is the actual data of the signature which includes SignMode's and - // the signatures themselves for either single or multi-signatures. - Data SignatureData - - // Sequence is the sequence of this account. Only populated in - // SIGN_MODE_DIRECT. - Sequence uint64 - - // Ugly flag to keep backwards-compatibility with Amino StdSignatures. - // In SIGN_MODE_DIRECT, sequence is in AuthInfo, and will thus be populated - // in the Sequence field above. The ante handler then checks this Sequence - // with the actual sequence on-chain. - // In SIGN_MODE_LEGACY_AMINO_JSON, sequence is signed via StdSignDoc, and - // checked during signature verification. It's not populated in the - // Sequence field above. This flag indicates that the Sequence field should - // be skipped in ante handlers. - // TLDR; - // - false (by default) in SIGN_MODE_DIRECT - // - true in SIGN_MODE_LEGACY_AMINO_JSON - // ref: https://github.com/irisnet/irishub-sdk-go/issues/7229 - SkipSequenceCheck bool -} - -// SignatureDataToProto converts a SignatureData to SignatureDescriptor_Data. -// SignatureDescriptor_Data is considered an encoding type whereas SignatureData is used for -// business logic. -func SignatureDataToProto(data SignatureData) *SignatureDescriptor_Data { - switch data := data.(type) { - case *SingleSignatureData: - return &SignatureDescriptor_Data{ - Sum: &SignatureDescriptor_Data_Single_{ - Single: &SignatureDescriptor_Data_Single{ - Mode: data.SignMode, - Signature: data.Signature, - }, - }, - } - case *MultiSignatureData: - descDatas := make([]*SignatureDescriptor_Data, len(data.Signatures)) - - for j, d := range data.Signatures { - descDatas[j] = SignatureDataToProto(d) - } - - return &SignatureDescriptor_Data{ - Sum: &SignatureDescriptor_Data_Multi_{ - Multi: &SignatureDescriptor_Data_Multi{ - Bitarray: data.BitArray, - Signatures: descDatas, - }, - }, - } - default: - panic(fmt.Errorf("unexpected case %+v", data)) - } -} - -// SignatureDataFromProto converts a SignatureDescriptor_Data to SignatureData. -// SignatureDescriptor_Data is considered an encoding type whereas SignatureData is used for -// business logic. -func SignatureDataFromProto(descData *SignatureDescriptor_Data) SignatureData { - switch descData := descData.Sum.(type) { - case *SignatureDescriptor_Data_Single_: - return &SingleSignatureData{ - SignMode: descData.Single.Mode, - Signature: descData.Single.Signature, - } - case *SignatureDescriptor_Data_Multi_: - multi := descData.Multi - datas := make([]SignatureData, len(multi.Signatures)) - - for j, d := range multi.Signatures { - datas[j] = SignatureDataFromProto(d) - } - - return &MultiSignatureData{ - BitArray: multi.Bitarray, - Signatures: datas, - } - default: - panic(fmt.Errorf("unexpected case %+v", descData)) - } -} diff --git a/types/tx/signing/signature_data.go b/types/tx/signing/signature_data.go deleted file mode 100644 index 3a3ddad5..00000000 --- a/types/tx/signing/signature_data.go +++ /dev/null @@ -1,36 +0,0 @@ -package signing - -import ( - "github.com/irisnet/irishub-sdk-go/crypto/types" -) - -// SignatureData represents either a *SingleSignatureData or *MultiSignatureData. -// It is a convenience type that is easier to use in business logic than the encoded -// protobuf ModeInfo's and raw signatures. -type SignatureData interface { - isSignatureData() -} - -// SingleSignatureData represents the signature and SignMode of a single (non-multisig) signer -type SingleSignatureData struct { - // SignMode represents the SignMode of the signature - SignMode SignMode - - // SignMode represents the SignMode of the signature - Signature []byte -} - -// MultiSignatureData represents the nested SignatureData of a multisig signature -type MultiSignatureData struct { - // BitArray is a compact way of indicating which signers from the multisig key - // have signed - BitArray *types.CompactBitArray - - // Signatures is the nested SignatureData's for each signer - Signatures []SignatureData -} - -var _, _ SignatureData = &SingleSignatureData{}, &MultiSignatureData{} - -func (m *SingleSignatureData) isSignatureData() {} -func (m *MultiSignatureData) isSignatureData() {} diff --git a/types/tx/signing/signing.pb.go b/types/tx/signing/signing.pb.go deleted file mode 100644 index 9557e685..00000000 --- a/types/tx/signing/signing.pb.go +++ /dev/null @@ -1,1453 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/tx/signing/v1beta1/signing.proto - -package signing - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - types1 "github.com/irisnet/irishub-sdk-go/crypto/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// SignMode represents a signing mode with its own security guarantees. -type SignMode int32 - -const ( - // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - // rejected - SignMode_SIGN_MODE_UNSPECIFIED SignMode = 0 - // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - // verified with raw bytes from Tx - SignMode_SIGN_MODE_DIRECT SignMode = 1 - // SIGN_MODE_TEXTUAL is a future signing mode that will verify some - // human-readable textual representation on top of the binary representation - // from SIGN_MODE_DIRECT - SignMode_SIGN_MODE_TEXTUAL SignMode = 2 - // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - // Amino JSON and will be removed in the future - SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127 -) - -var SignMode_name = map[int32]string{ - 0: "SIGN_MODE_UNSPECIFIED", - 1: "SIGN_MODE_DIRECT", - 2: "SIGN_MODE_TEXTUAL", - 127: "SIGN_MODE_LEGACY_AMINO_JSON", -} - -var SignMode_value = map[string]int32{ - "SIGN_MODE_UNSPECIFIED": 0, - "SIGN_MODE_DIRECT": 1, - "SIGN_MODE_TEXTUAL": 2, - "SIGN_MODE_LEGACY_AMINO_JSON": 127, -} - -func (x SignMode) String() string { - return proto.EnumName(SignMode_name, int32(x)) -} - -func (SignMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{0} -} - -// SignatureDescriptors wraps multiple SignatureDescriptor's. -type SignatureDescriptors struct { - // signatures are the signature descriptors - Signatures []*SignatureDescriptor `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *SignatureDescriptors) Reset() { *m = SignatureDescriptors{} } -func (m *SignatureDescriptors) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptors) ProtoMessage() {} -func (*SignatureDescriptors) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{0} -} -func (m *SignatureDescriptors) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptors.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 *SignatureDescriptors) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptors.Merge(m, src) -} -func (m *SignatureDescriptors) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptors) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptors.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptors proto.InternalMessageInfo - -func (m *SignatureDescriptors) GetSignatures() []*SignatureDescriptor { - if m != nil { - return m.Signatures - } - return nil -} - -// SignatureDescriptor is a convenience type which represents the full data for -// a signature including the public key of the signer, signing modes and the -// signature itself. It is primarily used for coordinating signatures between -// clients. -type SignatureDescriptor struct { - // public_key is the public key of the signer - PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - Data *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. - Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` -} - -func (m *SignatureDescriptor) Reset() { *m = SignatureDescriptor{} } -func (m *SignatureDescriptor) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor) ProtoMessage() {} -func (*SignatureDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1} -} -func (m *SignatureDescriptor) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor.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 *SignatureDescriptor) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor.Merge(m, src) -} -func (m *SignatureDescriptor) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor proto.InternalMessageInfo - -func (m *SignatureDescriptor) GetPublicKey() *types.Any { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *SignatureDescriptor) GetData() *SignatureDescriptor_Data { - if m != nil { - return m.Data - } - return nil -} - -func (m *SignatureDescriptor) GetSequence() uint64 { - if m != nil { - return m.Sequence - } - return 0 -} - -// Data represents signature data -type SignatureDescriptor_Data struct { - // sum is the oneof that specifies whether this represents single or multi-signature data - // - // Types that are valid to be assigned to Sum: - // *SignatureDescriptor_Data_Single_ - // *SignatureDescriptor_Data_Multi_ - Sum isSignatureDescriptor_Data_Sum `protobuf_oneof:"sum"` -} - -func (m *SignatureDescriptor_Data) Reset() { *m = SignatureDescriptor_Data{} } -func (m *SignatureDescriptor_Data) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor_Data) ProtoMessage() {} -func (*SignatureDescriptor_Data) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1, 0} -} -func (m *SignatureDescriptor_Data) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor_Data.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 *SignatureDescriptor_Data) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor_Data.Merge(m, src) -} -func (m *SignatureDescriptor_Data) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor_Data) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor_Data.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor_Data proto.InternalMessageInfo - -type isSignatureDescriptor_Data_Sum interface { - isSignatureDescriptor_Data_Sum() - MarshalTo([]byte) (int, error) - Size() int -} - -type SignatureDescriptor_Data_Single_ struct { - Single *SignatureDescriptor_Data_Single `protobuf:"bytes,1,opt,name=single,proto3,oneof" json:"single,omitempty"` -} -type SignatureDescriptor_Data_Multi_ struct { - Multi *SignatureDescriptor_Data_Multi `protobuf:"bytes,2,opt,name=multi,proto3,oneof" json:"multi,omitempty"` -} - -func (*SignatureDescriptor_Data_Single_) isSignatureDescriptor_Data_Sum() {} -func (*SignatureDescriptor_Data_Multi_) isSignatureDescriptor_Data_Sum() {} - -func (m *SignatureDescriptor_Data) GetSum() isSignatureDescriptor_Data_Sum { - if m != nil { - return m.Sum - } - return nil -} - -func (m *SignatureDescriptor_Data) GetSingle() *SignatureDescriptor_Data_Single { - if x, ok := m.GetSum().(*SignatureDescriptor_Data_Single_); ok { - return x.Single - } - return nil -} - -func (m *SignatureDescriptor_Data) GetMulti() *SignatureDescriptor_Data_Multi { - if x, ok := m.GetSum().(*SignatureDescriptor_Data_Multi_); ok { - return x.Multi - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*SignatureDescriptor_Data) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*SignatureDescriptor_Data_Single_)(nil), - (*SignatureDescriptor_Data_Multi_)(nil), - } -} - -// Single is the signature data for a single signer -type SignatureDescriptor_Data_Single struct { - // mode is the signing mode of the single signer - Mode SignMode `protobuf:"varint,1,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"` - // signature is the raw signature bytes - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (m *SignatureDescriptor_Data_Single) Reset() { *m = SignatureDescriptor_Data_Single{} } -func (m *SignatureDescriptor_Data_Single) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor_Data_Single) ProtoMessage() {} -func (*SignatureDescriptor_Data_Single) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1, 0, 0} -} -func (m *SignatureDescriptor_Data_Single) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor_Data_Single) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor_Data_Single.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 *SignatureDescriptor_Data_Single) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor_Data_Single.Merge(m, src) -} -func (m *SignatureDescriptor_Data_Single) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor_Data_Single) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor_Data_Single.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor_Data_Single proto.InternalMessageInfo - -func (m *SignatureDescriptor_Data_Single) GetMode() SignMode { - if m != nil { - return m.Mode - } - return SignMode_SIGN_MODE_UNSPECIFIED -} - -func (m *SignatureDescriptor_Data_Single) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -// Multi is the signature data for a multisig public key -type SignatureDescriptor_Data_Multi struct { - // bitarray specifies which keys within the multisig are signing - Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"` - // signatures is the signatures of the multi-signature - Signatures []*SignatureDescriptor_Data `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *SignatureDescriptor_Data_Multi) Reset() { *m = SignatureDescriptor_Data_Multi{} } -func (m *SignatureDescriptor_Data_Multi) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor_Data_Multi) ProtoMessage() {} -func (*SignatureDescriptor_Data_Multi) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1, 0, 1} -} -func (m *SignatureDescriptor_Data_Multi) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor_Data_Multi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor_Data_Multi.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 *SignatureDescriptor_Data_Multi) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor_Data_Multi.Merge(m, src) -} -func (m *SignatureDescriptor_Data_Multi) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor_Data_Multi) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor_Data_Multi.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor_Data_Multi proto.InternalMessageInfo - -func (m *SignatureDescriptor_Data_Multi) GetBitarray() *types1.CompactBitArray { - if m != nil { - return m.Bitarray - } - return nil -} - -func (m *SignatureDescriptor_Data_Multi) GetSignatures() []*SignatureDescriptor_Data { - if m != nil { - return m.Signatures - } - return nil -} - -func init() { - proto.RegisterEnum("cosmos.tx.signing.v1beta1.SignMode", SignMode_name, SignMode_value) - proto.RegisterType((*SignatureDescriptors)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptors") - proto.RegisterType((*SignatureDescriptor)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor") - proto.RegisterType((*SignatureDescriptor_Data)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data") - proto.RegisterType((*SignatureDescriptor_Data_Single)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single") - proto.RegisterType((*SignatureDescriptor_Data_Multi)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi") -} - -func init() { - proto.RegisterFile("cosmos/tx/signing/v1beta1/signing.proto", fileDescriptor_9a54958ff3d0b1b9) -} - -var fileDescriptor_9a54958ff3d0b1b9 = []byte{ - // 551 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xed, 0x7c, 0x29, 0xdd, 0x22, 0x14, 0x96, 0x54, 0x4a, 0x0c, 0x32, 0x51, 0x39, 0x10, - 0x21, 0x65, 0xad, 0x26, 0x07, 0x04, 0xb7, 0x7c, 0x98, 0x34, 0x34, 0x1f, 0x60, 0xa7, 0x12, 0x70, - 0xb1, 0x6c, 0x67, 0xeb, 0xae, 0x1a, 0x7b, 0x8d, 0x77, 0x8d, 0xea, 0x13, 0xaf, 0xc0, 0x6b, 0xf0, - 0x1c, 0x5c, 0x38, 0xf6, 0xc8, 0x11, 0x25, 0xcf, 0xc0, 0x1d, 0xc5, 0x8e, 0x93, 0x20, 0x15, 0xa1, - 0xe6, 0x64, 0xcd, 0xcc, 0x7f, 0x7f, 0xf3, 0x5f, 0xcd, 0x78, 0xc1, 0x33, 0x9b, 0x32, 0x97, 0x32, - 0x85, 0x5f, 0x2b, 0x8c, 0x38, 0x1e, 0xf1, 0x1c, 0xe5, 0xf3, 0x89, 0x85, 0xb9, 0x79, 0x92, 0xc6, - 0xc8, 0x0f, 0x28, 0xa7, 0xb0, 0x9a, 0x08, 0x11, 0xbf, 0x46, 0x69, 0x61, 0x2d, 0x94, 0x1a, 0x6b, - 0x86, 0x1d, 0x44, 0x3e, 0xa7, 0x8a, 0x1b, 0xce, 0x39, 0x61, 0x64, 0x0b, 0x4a, 0x13, 0x09, 0x49, - 0xaa, 0x3a, 0x94, 0x3a, 0x73, 0xac, 0xc4, 0x91, 0x15, 0x5e, 0x28, 0xa6, 0x17, 0x25, 0xa5, 0xe3, - 0x0b, 0x50, 0xd6, 0x89, 0xe3, 0x99, 0x3c, 0x0c, 0x70, 0x0f, 0x33, 0x3b, 0x20, 0x3e, 0xa7, 0x01, - 0x83, 0x63, 0x00, 0x58, 0x9a, 0x67, 0x15, 0xb1, 0x96, 0xad, 0x1f, 0x36, 0x11, 0xfa, 0xa7, 0x23, - 0x74, 0x0b, 0x44, 0xdb, 0x21, 0x1c, 0xff, 0xce, 0x81, 0x87, 0xb7, 0x68, 0x60, 0x0b, 0x00, 0x3f, - 0xb4, 0xe6, 0xc4, 0x36, 0xae, 0x70, 0x54, 0x11, 0x6b, 0x62, 0xfd, 0xb0, 0x59, 0x46, 0x89, 0x5f, - 0x94, 0xfa, 0x45, 0x6d, 0x2f, 0xd2, 0x0e, 0x12, 0xdd, 0x19, 0x8e, 0x60, 0x1f, 0xe4, 0x66, 0x26, - 0x37, 0x2b, 0x99, 0x58, 0xde, 0xba, 0x9b, 0x2d, 0xd4, 0x33, 0xb9, 0xa9, 0xc5, 0x00, 0x28, 0x81, - 0x22, 0xc3, 0x9f, 0x42, 0xec, 0xd9, 0xb8, 0x92, 0xad, 0x89, 0xf5, 0x9c, 0xb6, 0x89, 0xa5, 0xef, - 0x59, 0x90, 0x5b, 0x49, 0xe1, 0x14, 0x14, 0x18, 0xf1, 0x9c, 0x39, 0x5e, 0xdb, 0x7b, 0xb5, 0x47, - 0x3f, 0xa4, 0xc7, 0x84, 0x53, 0x41, 0x5b, 0xb3, 0xe0, 0x3b, 0x90, 0x8f, 0xa7, 0xb4, 0xbe, 0xc4, - 0xcb, 0x7d, 0xa0, 0xa3, 0x15, 0xe0, 0x54, 0xd0, 0x12, 0x92, 0x64, 0x80, 0x42, 0xd2, 0x06, 0xbe, - 0x00, 0x39, 0x97, 0xce, 0x12, 0xc3, 0xf7, 0x9b, 0x4f, 0xff, 0xc3, 0x1e, 0xd1, 0x19, 0xd6, 0xe2, - 0x03, 0xf0, 0x31, 0x38, 0xd8, 0x0c, 0x2d, 0x76, 0x76, 0x4f, 0xdb, 0x26, 0xa4, 0x6f, 0x22, 0xc8, - 0xc7, 0x3d, 0xe1, 0x19, 0x28, 0x5a, 0x84, 0x9b, 0x41, 0x60, 0xa6, 0x43, 0x53, 0xd2, 0x26, 0xc9, - 0x4e, 0xa2, 0xcd, 0x0a, 0xa6, 0x9d, 0xba, 0xd4, 0xf5, 0x4d, 0x9b, 0x77, 0x08, 0x6f, 0xaf, 0x8e, - 0x69, 0x1b, 0x00, 0xd4, 0xff, 0xda, 0xb5, 0x4c, 0xbc, 0x6b, 0x7b, 0x0d, 0x75, 0x07, 0xd3, 0xc9, - 0x83, 0x2c, 0x0b, 0xdd, 0xe7, 0x0c, 0x14, 0xd3, 0x2b, 0xc2, 0x2a, 0x38, 0xd2, 0x07, 0xfd, 0xb1, - 0x31, 0x9a, 0xf4, 0x54, 0xe3, 0x7c, 0xac, 0xbf, 0x55, 0xbb, 0x83, 0xd7, 0x03, 0xb5, 0x57, 0x12, - 0x60, 0x19, 0x94, 0xb6, 0xa5, 0xde, 0x40, 0x53, 0xbb, 0xd3, 0x92, 0x08, 0x8f, 0xc0, 0x83, 0x6d, - 0x76, 0xaa, 0xbe, 0x9f, 0x9e, 0xb7, 0x87, 0xa5, 0x0c, 0x7c, 0x02, 0x1e, 0x6d, 0xd3, 0x43, 0xb5, - 0xdf, 0xee, 0x7e, 0x30, 0xda, 0xa3, 0xc1, 0x78, 0x62, 0xbc, 0xd1, 0x27, 0xe3, 0xd2, 0x97, 0xce, - 0xf0, 0xc7, 0x42, 0x16, 0x6f, 0x16, 0xb2, 0xf8, 0x6b, 0x21, 0x8b, 0x5f, 0x97, 0xb2, 0x70, 0xb3, - 0x94, 0x85, 0x9f, 0x4b, 0x59, 0xf8, 0xd8, 0x74, 0x08, 0xbf, 0x0c, 0x2d, 0x64, 0x53, 0x57, 0x21, - 0x01, 0x61, 0x1e, 0xe6, 0xf1, 0xf7, 0x32, 0xb4, 0x1a, 0x6c, 0x76, 0xd5, 0x70, 0xa8, 0xc2, 0x23, - 0x1f, 0xef, 0xbe, 0x0e, 0x56, 0x21, 0xfe, 0x0d, 0x5a, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfa, - 0x35, 0xb3, 0x26, 0x39, 0x04, 0x00, 0x00, -} - -func (m *SignatureDescriptors) 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 *SignatureDescriptors) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor) 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 *SignatureDescriptor) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sequence != 0 { - i = encodeVarintSigning(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x18 - } - if m.Data != nil { - { - size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.PublicKey != nil { - { - size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor_Data) 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 *SignatureDescriptor_Data) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor_Data_Single_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Single_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Single != nil { - { - size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *SignatureDescriptor_Data_Multi_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Multi_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Multi != nil { - { - size, err := m.Multi.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *SignatureDescriptor_Data_Single) 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 *SignatureDescriptor_Data_Single) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Single) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintSigning(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if m.Mode != 0 { - i = encodeVarintSigning(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor_Data_Multi) 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 *SignatureDescriptor_Data_Multi) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Multi) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Bitarray != nil { - { - size, err := m.Bitarray.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintSigning(dAtA []byte, offset int, v uint64) int { - offset -= sovSigning(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *SignatureDescriptors) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovSigning(uint64(l)) - } - } - return n -} - -func (m *SignatureDescriptor) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = m.PublicKey.Size() - n += 1 + l + sovSigning(uint64(l)) - } - if m.Data != nil { - l = m.Data.Size() - n += 1 + l + sovSigning(uint64(l)) - } - if m.Sequence != 0 { - n += 1 + sovSigning(uint64(m.Sequence)) - } - return n -} - -func (m *SignatureDescriptor_Data) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n -} - -func (m *SignatureDescriptor_Data_Single_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Single != nil { - l = m.Single.Size() - n += 1 + l + sovSigning(uint64(l)) - } - return n -} -func (m *SignatureDescriptor_Data_Multi_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Multi != nil { - l = m.Multi.Size() - n += 1 + l + sovSigning(uint64(l)) - } - return n -} -func (m *SignatureDescriptor_Data_Single) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Mode != 0 { - n += 1 + sovSigning(uint64(m.Mode)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovSigning(uint64(l)) - } - return n -} - -func (m *SignatureDescriptor_Data_Multi) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Bitarray != nil { - l = m.Bitarray.Size() - n += 1 + l + sovSigning(uint64(l)) - } - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovSigning(uint64(l)) - } - } - return n -} - -func sovSigning(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozSigning(x uint64) (n int) { - return sovSigning(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *SignatureDescriptors) 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 ErrIntOverflowSigning - } - 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: SignatureDescriptors: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignatureDescriptors: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, &SignatureDescriptor{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor) 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 ErrIntOverflowSigning - } - 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: SignatureDescriptor: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignatureDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PublicKey == nil { - m.PublicKey = &types.Any{} - } - if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &SignatureDescriptor_Data{} - } - if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor_Data) 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 ErrIntOverflowSigning - } - 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: Data: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SignatureDescriptor_Data_Single{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &SignatureDescriptor_Data_Single_{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Multi", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SignatureDescriptor_Data_Multi{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &SignatureDescriptor_Data_Multi_{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor_Data_Single) 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 ErrIntOverflowSigning - } - 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: Single: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Single: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mode |= SignMode(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor_Data_Multi) 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 ErrIntOverflowSigning - } - 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: Multi: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Multi: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bitarray", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Bitarray == nil { - m.Bitarray = &types1.CompactBitArray{} - } - if err := m.Bitarray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, &SignatureDescriptor_Data{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSigning(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, ErrIntOverflowSigning - } - 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, ErrIntOverflowSigning - } - 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, ErrIntOverflowSigning - } - 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, ErrInvalidLengthSigning - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSigning - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthSigning - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthSigning = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSigning = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSigning = fmt.Errorf("proto: unexpected end of group") -) diff --git a/types/tx/sigs.go b/types/tx/sigs.go deleted file mode 100644 index 181949e9..00000000 --- a/types/tx/sigs.go +++ /dev/null @@ -1,149 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/irishub-sdk-go/codec" - "github.com/irisnet/irishub-sdk-go/crypto/types" - "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -// SignatureDataToModeInfoAndSig converts a SignatureData to a ModeInfo and raw bytes signature -func SignatureDataToModeInfoAndSig(data signing.SignatureData) (*ModeInfo, []byte) { - if data == nil { - return nil, nil - } - - switch data := data.(type) { - case *signing.SingleSignatureData: - return &ModeInfo{ - Sum: &ModeInfo_Single_{ - Single: &ModeInfo_Single{Mode: data.SignMode}, - }, - }, data.Signature - case *signing.MultiSignatureData: - n := len(data.Signatures) - modeInfos := make([]*ModeInfo, n) - sigs := make([][]byte, n) - - for i, d := range data.Signatures { - modeInfos[i], sigs[i] = SignatureDataToModeInfoAndSig(d) - } - - multisig := types.MultiSignature{ - Signatures: sigs, - } - sig, err := multisig.Marshal() - if err != nil { - panic(err) - } - - return &ModeInfo{ - Sum: &ModeInfo_Multi_{ - Multi: &ModeInfo_Multi{ - Bitarray: data.BitArray, - ModeInfos: modeInfos, - }, - }, - }, sig - default: - panic(fmt.Sprintf("unexpected signature data type %T", data)) - } -} - -// ModeInfoAndSigToSignatureData converts a ModeInfo and raw bytes signature to a SignatureData or returns -// an error -func ModeInfoAndSigToSignatureData(modeInfo *ModeInfo, sig []byte) (signing.SignatureData, error) { - switch modeInfo := modeInfo.Sum.(type) { - case *ModeInfo_Single_: - return &signing.SingleSignatureData{ - SignMode: modeInfo.Single.Mode, - Signature: sig, - }, nil - - case *ModeInfo_Multi_: - multi := modeInfo.Multi - - sigs, err := decodeMultisignatures(sig) - if err != nil { - return nil, err - } - - sigv2s := make([]signing.SignatureData, len(sigs)) - for i, mi := range multi.ModeInfos { - sigv2s[i], err = ModeInfoAndSigToSignatureData(mi, sigs[i]) - if err != nil { - return nil, err - } - } - - return &signing.MultiSignatureData{ - BitArray: multi.Bitarray, - Signatures: sigv2s, - }, nil - - default: - panic(fmt.Errorf("unexpected ModeInfo data type %T", modeInfo)) - } -} - -// decodeMultisignatures safely decodes the the raw bytes as a MultiSignature protobuf message -func decodeMultisignatures(bz []byte) ([][]byte, error) { - multisig := types.MultiSignature{} - err := multisig.Unmarshal(bz) - if err != nil { - return nil, err - } - // NOTE: it is import to reject multi-signatures that contain unrecognized fields because this is an exploitable - // malleability in the protobuf message. Basically an attacker could bloat a MultiSignature message with unknown - // fields, thus bloating the transaction and causing it to fail. - if len(multisig.XXX_unrecognized) > 0 { - return nil, fmt.Errorf("rejecting unrecognized fields found in MultiSignature") - } - return multisig.Signatures, nil -} - -func (g config) MarshalSignatureJSON(sigs []signing.SignatureV2) ([]byte, error) { - descs := make([]*signing.SignatureDescriptor, len(sigs)) - - for i, sig := range sigs { - any, err := PubKeyToAny(sig.PubKey) - if err != nil { - return nil, err - } - - descData := signing.SignatureDataToProto(sig.Data) - - descs[i] = &signing.SignatureDescriptor{ - PublicKey: any, - Data: descData, - } - } - - toJSON := &signing.SignatureDescriptors{Signatures: descs} - - return codec.ProtoMarshalJSON(toJSON) -} - -func (g config) UnmarshalSignatureJSON(bz []byte) ([]signing.SignatureV2, error) { - var sigDescs signing.SignatureDescriptors - if err := g.protoCodec.UnmarshalJSON(bz, &sigDescs); err != nil { - return nil, err - } - - sigs := make([]signing.SignatureV2, len(sigDescs.Signatures)) - for i, desc := range sigDescs.Signatures { - pubKey, _ := desc.PublicKey.GetCachedValue().(crypto.PubKey) - data := signing.SignatureDataFromProto(desc.Data) - - sigs[i] = signing.SignatureV2{ - PubKey: pubKey, - Data: data, - Sequence: desc.Sequence, - } - } - - return sigs, nil -} diff --git a/types/tx/tx.pb.go b/types/tx/tx.pb.go deleted file mode 100644 index 89db41f7..00000000 --- a/types/tx/tx.pb.go +++ /dev/null @@ -1,3108 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/tx/v1beta1/tx.proto - -package tx - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/irishub-sdk-go/codec/types" - types1 "github.com/irisnet/irishub-sdk-go/crypto/types" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/irishub-sdk-go/types" - types2 "github.com/irisnet/irishub-sdk-go/types" - signing "github.com/irisnet/irishub-sdk-go/types/tx/signing" - 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 - -// Tx is the standard type used for broadcasting transactions. -type Tx struct { - // body is the processable content of the transaction - Body *TxBody `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // auth_info is the authorization related content of the transaction, - // specifically signers, signer modes and fee - AuthInfo *AuthInfo `protobuf:"bytes,2,opt,name=auth_info,json=authInfo,proto3" json:"auth_info,omitempty"` - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - Signatures [][]byte `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *Tx) Reset() { *m = Tx{} } -func (m *Tx) String() string { return proto.CompactTextString(m) } -func (*Tx) ProtoMessage() {} -func (*Tx) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{0} -} -func (m *Tx) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Tx.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 *Tx) XXX_Merge(src proto.Message) { - xxx_messageInfo_Tx.Merge(m, src) -} -func (m *Tx) XXX_Size() int { - return m.Size() -} -func (m *Tx) XXX_DiscardUnknown() { - xxx_messageInfo_Tx.DiscardUnknown(m) -} - -var xxx_messageInfo_Tx proto.InternalMessageInfo - -func (m *Tx) GetBody() *TxBody { - if m != nil { - return m.Body - } - return nil -} - -func (m *Tx) GetAuthInfo() *AuthInfo { - if m != nil { - return m.AuthInfo - } - return nil -} - -func (m *Tx) GetSignatures() [][]byte { - if m != nil { - return m.Signatures - } - return nil -} - -// TxRaw is a variant of Tx that pins the signer's exact binary representation -// of body and auth_info. This is used for signing, broadcasting and -// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and -// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used -// as the transaction ID. -type TxRaw struct { - // body_bytes is a protobuf serialization of a TxBody that matches the - // representation in SignDoc. - BodyBytes []byte `protobuf:"bytes,1,opt,name=body_bytes,json=bodyBytes,proto3" json:"body_bytes,omitempty"` - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in SignDoc. - AuthInfoBytes []byte `protobuf:"bytes,2,opt,name=auth_info_bytes,json=authInfoBytes,proto3" json:"auth_info_bytes,omitempty"` - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - Signatures [][]byte `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *TxRaw) Reset() { *m = TxRaw{} } -func (m *TxRaw) String() string { return proto.CompactTextString(m) } -func (*TxRaw) ProtoMessage() {} -func (*TxRaw) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{1} -} -func (m *TxRaw) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxRaw.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 *TxRaw) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxRaw.Merge(m, src) -} -func (m *TxRaw) XXX_Size() int { - return m.Size() -} -func (m *TxRaw) XXX_DiscardUnknown() { - xxx_messageInfo_TxRaw.DiscardUnknown(m) -} - -var xxx_messageInfo_TxRaw proto.InternalMessageInfo - -func (m *TxRaw) GetBodyBytes() []byte { - if m != nil { - return m.BodyBytes - } - return nil -} - -func (m *TxRaw) GetAuthInfoBytes() []byte { - if m != nil { - return m.AuthInfoBytes - } - return nil -} - -func (m *TxRaw) GetSignatures() [][]byte { - if m != nil { - return m.Signatures - } - return nil -} - -// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. -type SignDoc struct { - // body_bytes is protobuf serialization of a TxBody that matches the - // representation in TxRaw. - BodyBytes []byte `protobuf:"bytes,1,opt,name=body_bytes,json=bodyBytes,proto3" json:"body_bytes,omitempty"` - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in TxRaw. - AuthInfoBytes []byte `protobuf:"bytes,2,opt,name=auth_info_bytes,json=authInfoBytes,proto3" json:"auth_info_bytes,omitempty"` - // chain_id is the unique identifier of the chain this transaction targets. - // It prevents signed transactions from being used on another chain by an - // attacker - ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - // account_number is the account number of the account in state - AccountNumber uint64 `protobuf:"varint,4,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"` -} - -func (m *SignDoc) Reset() { *m = SignDoc{} } -func (m *SignDoc) String() string { return proto.CompactTextString(m) } -func (*SignDoc) ProtoMessage() {} -func (*SignDoc) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{2} -} -func (m *SignDoc) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignDoc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignDoc.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 *SignDoc) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignDoc.Merge(m, src) -} -func (m *SignDoc) XXX_Size() int { - return m.Size() -} -func (m *SignDoc) XXX_DiscardUnknown() { - xxx_messageInfo_SignDoc.DiscardUnknown(m) -} - -var xxx_messageInfo_SignDoc proto.InternalMessageInfo - -func (m *SignDoc) GetBodyBytes() []byte { - if m != nil { - return m.BodyBytes - } - return nil -} - -func (m *SignDoc) GetAuthInfoBytes() []byte { - if m != nil { - return m.AuthInfoBytes - } - return nil -} - -func (m *SignDoc) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *SignDoc) GetAccountNumber() uint64 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -// TxBody is the body of a transaction that all signers sign over. -type TxBody struct { - // messages is a list of messages to be executed. The required signers of - // those messages define the number and order of elements in AuthInfo's - // signer_infos and Tx's signatures. Each required signer address is added to - // the list only the first time it occurs. - // - // By convention, the first required signer (usually from the first message) - // is referred to as the primary signer and pays the fee for the whole - // transaction. - Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - // memo is any arbitrary memo to be added to the transaction - Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` - // timeout is the block height after which this transaction will not - // be processed by the chain - TimeoutHeight uint64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, the transaction will be rejected - ExtensionOptions []*types.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"` - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, they will be ignored - NonCriticalExtensionOptions []*types.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"` -} - -func (m *TxBody) Reset() { *m = TxBody{} } -func (m *TxBody) String() string { return proto.CompactTextString(m) } -func (*TxBody) ProtoMessage() {} -func (*TxBody) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{3} -} -func (m *TxBody) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxBody) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxBody.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 *TxBody) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxBody.Merge(m, src) -} -func (m *TxBody) XXX_Size() int { - return m.Size() -} -func (m *TxBody) XXX_DiscardUnknown() { - xxx_messageInfo_TxBody.DiscardUnknown(m) -} - -var xxx_messageInfo_TxBody proto.InternalMessageInfo - -func (m *TxBody) GetMessages() []*types.Any { - if m != nil { - return m.Messages - } - return nil -} - -func (m *TxBody) GetMemo() string { - if m != nil { - return m.Memo - } - return "" -} - -func (m *TxBody) GetTimeoutHeight() uint64 { - if m != nil { - return m.TimeoutHeight - } - return 0 -} - -func (m *TxBody) GetExtensionOptions() []*types.Any { - if m != nil { - return m.ExtensionOptions - } - return nil -} - -func (m *TxBody) GetNonCriticalExtensionOptions() []*types.Any { - if m != nil { - return m.NonCriticalExtensionOptions - } - return nil -} - -// AuthInfo describes the fee and signer modes that are used to sign a -// transaction. -type AuthInfo struct { - // signer_infos defines the signing modes for the required signers. The number - // and order of elements must match the required signers from TxBody's - // messages. The first element is the primary signer and the one which pays - // the fee. - SignerInfos []*SignerInfo `protobuf:"bytes,1,rep,name=signer_infos,json=signerInfos,proto3" json:"signer_infos,omitempty"` - // Fee is the fee and gas limit for the transaction. The first signer is the - // primary signer and the one which pays the fee. The fee can be calculated - // based on the cost of evaluating the body and doing signature verification - // of the signers. This can be estimated via simulation. - Fee *Fee `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee,omitempty"` -} - -func (m *AuthInfo) Reset() { *m = AuthInfo{} } -func (m *AuthInfo) String() string { return proto.CompactTextString(m) } -func (*AuthInfo) ProtoMessage() {} -func (*AuthInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{4} -} -func (m *AuthInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthInfo.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 *AuthInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthInfo.Merge(m, src) -} -func (m *AuthInfo) XXX_Size() int { - return m.Size() -} -func (m *AuthInfo) XXX_DiscardUnknown() { - xxx_messageInfo_AuthInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthInfo proto.InternalMessageInfo - -func (m *AuthInfo) GetSignerInfos() []*SignerInfo { - if m != nil { - return m.SignerInfos - } - return nil -} - -func (m *AuthInfo) GetFee() *Fee { - if m != nil { - return m.Fee - } - return nil -} - -// SignerInfo describes the public key and signing mode of a single top-level -// signer. -type SignerInfo struct { - // public_key is the public key of the signer. It is optional for accounts - // that already exist in state. If unset, the verifier can use the required \ - // signer address for this position and lookup the public key. - PublicKey *types.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - // mode_info describes the signing mode of the signer and is a nested - // structure to support nested multisig pubkey's - ModeInfo *ModeInfo `protobuf:"bytes,2,opt,name=mode_info,json=modeInfo,proto3" json:"mode_info,omitempty"` - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to - // prevent replay attacks. - Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` -} - -func (m *SignerInfo) Reset() { *m = SignerInfo{} } -func (m *SignerInfo) String() string { return proto.CompactTextString(m) } -func (*SignerInfo) ProtoMessage() {} -func (*SignerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{5} -} -func (m *SignerInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignerInfo.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 *SignerInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignerInfo.Merge(m, src) -} -func (m *SignerInfo) XXX_Size() int { - return m.Size() -} -func (m *SignerInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SignerInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_SignerInfo proto.InternalMessageInfo - -func (m *SignerInfo) GetPublicKey() *types.Any { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *SignerInfo) GetModeInfo() *ModeInfo { - if m != nil { - return m.ModeInfo - } - return nil -} - -func (m *SignerInfo) GetSequence() uint64 { - if m != nil { - return m.Sequence - } - return 0 -} - -// ModeInfo describes the signing mode of a single or nested multisig signer. -type ModeInfo struct { - // sum is the oneof that specifies whether this represents a single or nested - // multisig signer - // - // Types that are valid to be assigned to Sum: - // *ModeInfo_Single_ - // *ModeInfo_Multi_ - Sum isModeInfo_Sum `protobuf_oneof:"sum"` -} - -func (m *ModeInfo) Reset() { *m = ModeInfo{} } -func (m *ModeInfo) String() string { return proto.CompactTextString(m) } -func (*ModeInfo) ProtoMessage() {} -func (*ModeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{6} -} -func (m *ModeInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModeInfo.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 *ModeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModeInfo.Merge(m, src) -} -func (m *ModeInfo) XXX_Size() int { - return m.Size() -} -func (m *ModeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_ModeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_ModeInfo proto.InternalMessageInfo - -type isModeInfo_Sum interface { - isModeInfo_Sum() - MarshalTo([]byte) (int, error) - Size() int -} - -type ModeInfo_Single_ struct { - Single *ModeInfo_Single `protobuf:"bytes,1,opt,name=single,proto3,oneof" json:"single,omitempty"` -} -type ModeInfo_Multi_ struct { - Multi *ModeInfo_Multi `protobuf:"bytes,2,opt,name=multi,proto3,oneof" json:"multi,omitempty"` -} - -func (*ModeInfo_Single_) isModeInfo_Sum() {} -func (*ModeInfo_Multi_) isModeInfo_Sum() {} - -func (m *ModeInfo) GetSum() isModeInfo_Sum { - if m != nil { - return m.Sum - } - return nil -} - -func (m *ModeInfo) GetSingle() *ModeInfo_Single { - if x, ok := m.GetSum().(*ModeInfo_Single_); ok { - return x.Single - } - return nil -} - -func (m *ModeInfo) GetMulti() *ModeInfo_Multi { - if x, ok := m.GetSum().(*ModeInfo_Multi_); ok { - return x.Multi - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ModeInfo) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*ModeInfo_Single_)(nil), - (*ModeInfo_Multi_)(nil), - } -} - -// Single is the mode info for a single signer. It is structured as a message -// to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the -// future -type ModeInfo_Single struct { - // mode is the signing mode of the single signer - Mode signing.SignMode `protobuf:"varint,1,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"` -} - -func (m *ModeInfo_Single) Reset() { *m = ModeInfo_Single{} } -func (m *ModeInfo_Single) String() string { return proto.CompactTextString(m) } -func (*ModeInfo_Single) ProtoMessage() {} -func (*ModeInfo_Single) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{6, 0} -} -func (m *ModeInfo_Single) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModeInfo_Single) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModeInfo_Single.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 *ModeInfo_Single) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModeInfo_Single.Merge(m, src) -} -func (m *ModeInfo_Single) XXX_Size() int { - return m.Size() -} -func (m *ModeInfo_Single) XXX_DiscardUnknown() { - xxx_messageInfo_ModeInfo_Single.DiscardUnknown(m) -} - -var xxx_messageInfo_ModeInfo_Single proto.InternalMessageInfo - -func (m *ModeInfo_Single) GetMode() signing.SignMode { - if m != nil { - return m.Mode - } - return signing.SignMode_SIGN_MODE_UNSPECIFIED -} - -// Multi is the mode info for a multisig public key -type ModeInfo_Multi struct { - // bitarray specifies which keys within the multisig are signing - Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"` - // mode_infos is the corresponding modes of the signers of the multisig - // which could include nested multisig public keys - ModeInfos []*ModeInfo `protobuf:"bytes,2,rep,name=mode_infos,json=modeInfos,proto3" json:"mode_infos,omitempty"` -} - -func (m *ModeInfo_Multi) Reset() { *m = ModeInfo_Multi{} } -func (m *ModeInfo_Multi) String() string { return proto.CompactTextString(m) } -func (*ModeInfo_Multi) ProtoMessage() {} -func (*ModeInfo_Multi) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{6, 1} -} -func (m *ModeInfo_Multi) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModeInfo_Multi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModeInfo_Multi.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 *ModeInfo_Multi) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModeInfo_Multi.Merge(m, src) -} -func (m *ModeInfo_Multi) XXX_Size() int { - return m.Size() -} -func (m *ModeInfo_Multi) XXX_DiscardUnknown() { - xxx_messageInfo_ModeInfo_Multi.DiscardUnknown(m) -} - -var xxx_messageInfo_ModeInfo_Multi proto.InternalMessageInfo - -func (m *ModeInfo_Multi) GetBitarray() *types1.CompactBitArray { - if m != nil { - return m.Bitarray - } - return nil -} - -func (m *ModeInfo_Multi) GetModeInfos() []*ModeInfo { - if m != nil { - return m.ModeInfos - } - return nil -} - -// Fee includes the amount of coins paid in fees and the maximum -// gas to be used by the transaction. The ratio yields an effective "gasprice", -// which must be above some miminum to be accepted into the mempool. -type Fee struct { - // amount is the amount of coins to be paid as a fee - Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/irisnet/irishub-sdk-go/types.Coins" json:"amount"` - // gas_limit is the maximum gas that can be used in transaction processing - // before an out of gas error occurs - GasLimit uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` - // if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - // the payer must be a tx signer (and thus have signed this field in AuthInfo). - // setting this field does *not* change the ordering of required signers for the transaction. - Payer string `protobuf:"bytes,3,opt,name=payer,proto3" json:"payer,omitempty"` - // if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - // to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - // not support fee grants, this will fail - Granter string `protobuf:"bytes,4,opt,name=granter,proto3" json:"granter,omitempty"` -} - -func (m *Fee) Reset() { *m = Fee{} } -func (m *Fee) String() string { return proto.CompactTextString(m) } -func (*Fee) ProtoMessage() {} -func (*Fee) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{7} -} -func (m *Fee) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Fee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Fee.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 *Fee) XXX_Merge(src proto.Message) { - xxx_messageInfo_Fee.Merge(m, src) -} -func (m *Fee) XXX_Size() int { - return m.Size() -} -func (m *Fee) XXX_DiscardUnknown() { - xxx_messageInfo_Fee.DiscardUnknown(m) -} - -var xxx_messageInfo_Fee proto.InternalMessageInfo - -func (m *Fee) GetAmount() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -func (m *Fee) GetGasLimit() uint64 { - if m != nil { - return m.GasLimit - } - return 0 -} - -func (m *Fee) GetPayer() string { - if m != nil { - return m.Payer - } - return "" -} - -func (m *Fee) GetGranter() string { - if m != nil { - return m.Granter - } - return "" -} - -func init() { - proto.RegisterType((*Tx)(nil), "cosmos.tx.v1beta1.Tx") - proto.RegisterType((*TxRaw)(nil), "cosmos.tx.v1beta1.TxRaw") - proto.RegisterType((*SignDoc)(nil), "cosmos.tx.v1beta1.SignDoc") - proto.RegisterType((*TxBody)(nil), "cosmos.tx.v1beta1.TxBody") - proto.RegisterType((*AuthInfo)(nil), "cosmos.tx.v1beta1.AuthInfo") - proto.RegisterType((*SignerInfo)(nil), "cosmos.tx.v1beta1.SignerInfo") - proto.RegisterType((*ModeInfo)(nil), "cosmos.tx.v1beta1.ModeInfo") - proto.RegisterType((*ModeInfo_Single)(nil), "cosmos.tx.v1beta1.ModeInfo.Single") - proto.RegisterType((*ModeInfo_Multi)(nil), "cosmos.tx.v1beta1.ModeInfo.Multi") - proto.RegisterType((*Fee)(nil), "cosmos.tx.v1beta1.Fee") -} - -func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) } - -var fileDescriptor_96d1575ffde80842 = []byte{ - // 851 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xdd, 0x6e, 0xdc, 0x44, - 0x14, 0x5e, 0xef, 0x5f, 0x76, 0x4f, 0x92, 0x96, 0x8e, 0x22, 0xb4, 0xd9, 0xa8, 0x6e, 0x58, 0x04, - 0xac, 0x90, 0xd6, 0xa6, 0xa9, 0x10, 0x3f, 0xe2, 0x82, 0x6c, 0x4b, 0x95, 0xaa, 0x14, 0xa4, 0x49, - 0xae, 0x7a, 0x63, 0x8d, 0xbd, 0x13, 0x7b, 0xd4, 0xf5, 0xcc, 0xe2, 0x19, 0x17, 0xfb, 0x21, 0x90, - 0x2a, 0x24, 0xc4, 0x3b, 0xf0, 0x0c, 0x3c, 0x40, 0x2f, 0x7b, 0xc9, 0x15, 0x44, 0xc9, 0x83, 0x80, - 0x66, 0x3c, 0x76, 0x22, 0x58, 0x25, 0x5c, 0xf4, 0xca, 0x73, 0xce, 0x7c, 0xe7, 0x9b, 0xcf, 0xe7, - 0x0f, 0xc6, 0x91, 0x90, 0xa9, 0x90, 0xbe, 0x2a, 0xfc, 0x97, 0xf7, 0x43, 0xaa, 0xc8, 0x7d, 0x5f, - 0x15, 0xde, 0x2a, 0x13, 0x4a, 0xa0, 0x3b, 0xd5, 0x9d, 0xa7, 0x0a, 0xcf, 0xde, 0x8d, 0x77, 0x62, - 0x11, 0x0b, 0x73, 0xeb, 0xeb, 0x53, 0x05, 0x1c, 0xcf, 0x2c, 0x49, 0x94, 0x95, 0x2b, 0x25, 0xfc, - 0x34, 0x5f, 0x2a, 0x26, 0x59, 0xdc, 0x30, 0xd6, 0x0e, 0x0b, 0x77, 0x2d, 0x3c, 0x24, 0x92, 0x36, - 0x98, 0x48, 0x30, 0x6e, 0xef, 0x3f, 0xba, 0xd4, 0x24, 0x59, 0xcc, 0x19, 0xbf, 0x64, 0xb2, 0xb6, - 0x05, 0xee, 0xc6, 0x42, 0xc4, 0x4b, 0xea, 0x1b, 0x2b, 0xcc, 0x4f, 0x7d, 0xc2, 0xcb, 0xea, 0x6a, - 0xf2, 0x93, 0x03, 0xed, 0x93, 0x02, 0xcd, 0xa0, 0x1b, 0x8a, 0x45, 0x39, 0x72, 0xf6, 0x9d, 0xe9, - 0xe6, 0xc1, 0xae, 0xf7, 0x9f, 0x3f, 0xf2, 0x4e, 0x8a, 0xb9, 0x58, 0x94, 0xd8, 0xc0, 0xd0, 0xe7, - 0x30, 0x24, 0xb9, 0x4a, 0x02, 0xc6, 0x4f, 0xc5, 0xa8, 0x6d, 0x62, 0xf6, 0xd6, 0xc4, 0x1c, 0xe6, - 0x2a, 0x79, 0xc2, 0x4f, 0x05, 0x1e, 0x10, 0x7b, 0x42, 0x2e, 0x80, 0xd6, 0x46, 0x54, 0x9e, 0x51, - 0x39, 0xea, 0xec, 0x77, 0xa6, 0x5b, 0xf8, 0x8a, 0x67, 0xc2, 0xa1, 0x77, 0x52, 0x60, 0xf2, 0x23, - 0xba, 0x0b, 0xa0, 0x9f, 0x0a, 0xc2, 0x52, 0x51, 0x69, 0x74, 0x6d, 0xe1, 0xa1, 0xf6, 0xcc, 0xb5, - 0x03, 0x7d, 0x08, 0xb7, 0x1b, 0x05, 0x16, 0xd3, 0x36, 0x98, 0xed, 0xfa, 0xa9, 0x0a, 0x77, 0xd3, - 0x7b, 0x3f, 0x3b, 0xb0, 0x71, 0xcc, 0x62, 0xfe, 0x48, 0x44, 0x6f, 0xeb, 0xc9, 0x5d, 0x18, 0x44, - 0x09, 0x61, 0x3c, 0x60, 0x8b, 0x51, 0x67, 0xdf, 0x99, 0x0e, 0xf1, 0x86, 0xb1, 0x9f, 0x2c, 0xd0, - 0x07, 0x70, 0x8b, 0x44, 0x91, 0xc8, 0xb9, 0x0a, 0x78, 0x9e, 0x86, 0x34, 0x1b, 0x75, 0xf7, 0x9d, - 0x69, 0x17, 0x6f, 0x5b, 0xef, 0x77, 0xc6, 0x39, 0xf9, 0xa5, 0x0d, 0xfd, 0x2a, 0xdf, 0xe8, 0x13, - 0x18, 0xa4, 0x54, 0x4a, 0x12, 0x1b, 0x45, 0x9d, 0xe9, 0xe6, 0xc1, 0x8e, 0x57, 0x55, 0xd3, 0xab, - 0xab, 0xe9, 0x1d, 0xf2, 0x12, 0x37, 0x28, 0x84, 0xa0, 0x9b, 0xd2, 0xb4, 0x2a, 0xcb, 0x10, 0x9b, - 0xb3, 0x7e, 0x57, 0xb1, 0x94, 0x8a, 0x5c, 0x05, 0x09, 0x65, 0x71, 0xa2, 0x8c, 0xb0, 0x2e, 0xde, - 0xb6, 0xde, 0x23, 0xe3, 0x44, 0x73, 0xb8, 0x43, 0x0b, 0x45, 0xb9, 0x64, 0x82, 0x07, 0x62, 0xa5, - 0x98, 0xe0, 0x72, 0xf4, 0xf7, 0xc6, 0x35, 0xcf, 0xbe, 0xd3, 0xe0, 0xbf, 0xaf, 0xe0, 0xe8, 0x39, - 0xb8, 0x5c, 0xf0, 0x20, 0xca, 0x98, 0x62, 0x11, 0x59, 0x06, 0x6b, 0x08, 0x6f, 0x5f, 0x43, 0xb8, - 0xc7, 0x05, 0x7f, 0x68, 0x63, 0xbf, 0xf9, 0x17, 0xf7, 0xe4, 0x25, 0x0c, 0xea, 0x96, 0x42, 0x5f, - 0xc3, 0x96, 0x2e, 0x23, 0xcd, 0x4c, 0x3d, 0xea, 0xe4, 0xdc, 0x5d, 0xd3, 0x85, 0xc7, 0x06, 0x66, - 0xfa, 0x70, 0x53, 0x36, 0x67, 0x89, 0xa6, 0xd0, 0x39, 0xa5, 0xd4, 0xb6, 0xef, 0xbb, 0x6b, 0x02, - 0x1f, 0x53, 0x8a, 0x35, 0x64, 0xf2, 0xab, 0x03, 0x70, 0xc9, 0x82, 0x1e, 0x00, 0xac, 0xf2, 0x70, - 0xc9, 0xa2, 0xe0, 0x05, 0xad, 0x47, 0x66, 0xfd, 0xdf, 0x0c, 0x2b, 0xdc, 0x53, 0x6a, 0x46, 0x26, - 0x15, 0x0b, 0x7a, 0xd3, 0xc8, 0x3c, 0x13, 0x0b, 0x5a, 0x8d, 0x4c, 0x6a, 0x4f, 0x68, 0x0c, 0x03, - 0x49, 0x7f, 0xc8, 0x29, 0x8f, 0xa8, 0x2d, 0x5b, 0x63, 0x4f, 0xce, 0xda, 0x30, 0xa8, 0x43, 0xd0, - 0x57, 0xd0, 0x97, 0x8c, 0xc7, 0x4b, 0x6a, 0x35, 0x4d, 0xae, 0xe1, 0xf7, 0x8e, 0x0d, 0xf2, 0xa8, - 0x85, 0x6d, 0x0c, 0xfa, 0x02, 0x7a, 0x66, 0xff, 0x58, 0x71, 0xef, 0x5d, 0x17, 0xfc, 0x4c, 0x03, - 0x8f, 0x5a, 0xb8, 0x8a, 0x18, 0x1f, 0x42, 0xbf, 0xa2, 0x43, 0x9f, 0x41, 0x57, 0xeb, 0x36, 0x02, - 0x6e, 0x1d, 0xbc, 0x7f, 0x85, 0xa3, 0xde, 0x48, 0x57, 0xab, 0xa2, 0xf9, 0xb0, 0x09, 0x18, 0xbf, - 0x72, 0xa0, 0x67, 0x58, 0xd1, 0x53, 0x18, 0x84, 0x4c, 0x91, 0x2c, 0x23, 0x75, 0x6e, 0xfd, 0x9a, - 0xa6, 0xda, 0x9b, 0x5e, 0xb3, 0x26, 0x6b, 0xae, 0x87, 0x22, 0x5d, 0x91, 0x48, 0xcd, 0x99, 0x3a, - 0xd4, 0x61, 0xb8, 0x21, 0x40, 0x5f, 0x02, 0x34, 0x59, 0xd7, 0xe3, 0xda, 0xb9, 0x29, 0xed, 0xc3, - 0x3a, 0xed, 0x72, 0xde, 0x83, 0x8e, 0xcc, 0xd3, 0xc9, 0xef, 0x0e, 0x74, 0x1e, 0x53, 0x8a, 0x12, - 0xe8, 0x93, 0x54, 0x0f, 0xa9, 0x6d, 0xb5, 0x66, 0x49, 0xea, 0xf5, 0x7c, 0x45, 0x0a, 0xe3, 0xf3, - 0x4f, 0x5f, 0xff, 0x79, 0xaf, 0xf5, 0xdb, 0x5f, 0xf7, 0x66, 0x31, 0x53, 0x49, 0x1e, 0x7a, 0x91, - 0x48, 0x7d, 0x96, 0x31, 0xc9, 0xa9, 0x32, 0xdf, 0x24, 0x0f, 0x67, 0x72, 0xf1, 0x62, 0x16, 0x0b, - 0x5f, 0x95, 0x2b, 0x2a, 0x4d, 0x94, 0xc4, 0x96, 0x1f, 0xed, 0xc1, 0x30, 0x26, 0x32, 0x58, 0xb2, - 0x94, 0x29, 0x53, 0x8d, 0x2e, 0x1e, 0xc4, 0x44, 0x7e, 0xab, 0x6d, 0xb4, 0x03, 0xbd, 0x15, 0x29, - 0x69, 0x66, 0x57, 0x4b, 0x65, 0xa0, 0x11, 0x6c, 0xc4, 0x19, 0xe1, 0xca, 0x6e, 0x94, 0x21, 0xae, - 0xcd, 0xf9, 0xa3, 0xd7, 0xe7, 0xae, 0xf3, 0xe6, 0xdc, 0x75, 0xce, 0xce, 0x5d, 0xe7, 0xd5, 0x85, - 0xdb, 0x7a, 0x73, 0xe1, 0xb6, 0xfe, 0xb8, 0x70, 0x5b, 0xcf, 0x3f, 0xfe, 0x9f, 0xea, 0x7c, 0x55, - 0x84, 0x7d, 0xd3, 0xd6, 0x0f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xde, 0xe7, 0xdb, 0x7e, 0x07, - 0x07, 0x00, 0x00, -} - -func (m *Tx) 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 *Tx) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Signatures[iNdEx]) - copy(dAtA[i:], m.Signatures[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signatures[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.AuthInfo != nil { - { - size, err := m.AuthInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TxRaw) 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 *TxRaw) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxRaw) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Signatures[iNdEx]) - copy(dAtA[i:], m.Signatures[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signatures[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.AuthInfoBytes) > 0 { - i -= len(m.AuthInfoBytes) - copy(dAtA[i:], m.AuthInfoBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.AuthInfoBytes))) - i-- - dAtA[i] = 0x12 - } - if len(m.BodyBytes) > 0 { - i -= len(m.BodyBytes) - copy(dAtA[i:], m.BodyBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.BodyBytes))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SignDoc) 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 *SignDoc) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignDoc) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AccountNumber != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.AccountNumber)) - i-- - dAtA[i] = 0x20 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0x1a - } - if len(m.AuthInfoBytes) > 0 { - i -= len(m.AuthInfoBytes) - copy(dAtA[i:], m.AuthInfoBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.AuthInfoBytes))) - i-- - dAtA[i] = 0x12 - } - if len(m.BodyBytes) > 0 { - i -= len(m.BodyBytes) - copy(dAtA[i:], m.BodyBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.BodyBytes))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TxBody) 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 *TxBody) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NonCriticalExtensionOptions) > 0 { - for iNdEx := len(m.NonCriticalExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.NonCriticalExtensionOptions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x7f - i-- - dAtA[i] = 0xfa - } - } - if len(m.ExtensionOptions) > 0 { - for iNdEx := len(m.ExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ExtensionOptions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3f - i-- - dAtA[i] = 0xfa - } - } - if m.TimeoutHeight != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeoutHeight)) - i-- - dAtA[i] = 0x18 - } - if len(m.Memo) > 0 { - i -= len(m.Memo) - copy(dAtA[i:], m.Memo) - i = encodeVarintTx(dAtA, i, uint64(len(m.Memo))) - i-- - dAtA[i] = 0x12 - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *AuthInfo) 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 *AuthInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Fee != nil { - { - size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.SignerInfos) > 0 { - for iNdEx := len(m.SignerInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SignerInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SignerInfo) 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 *SignerInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sequence != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x18 - } - if m.ModeInfo != nil { - { - size, err := m.ModeInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.PublicKey != nil { - { - size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ModeInfo) 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 *ModeInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *ModeInfo_Single_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Single_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Single != nil { - { - size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *ModeInfo_Multi_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Multi_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Multi != nil { - { - size, err := m.Multi.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *ModeInfo_Single) 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 *ModeInfo_Single) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Single) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Mode != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ModeInfo_Multi) 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 *ModeInfo_Multi) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Multi) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ModeInfos) > 0 { - for iNdEx := len(m.ModeInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ModeInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Bitarray != nil { - { - size, err := m.Bitarray.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Fee) 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 *Fee) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Fee) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Granter) > 0 { - i -= len(m.Granter) - copy(dAtA[i:], m.Granter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Granter))) - i-- - dAtA[i] = 0x22 - } - if len(m.Payer) > 0 { - i -= len(m.Payer) - copy(dAtA[i:], m.Payer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Payer))) - i-- - dAtA[i] = 0x1a - } - if m.GasLimit != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) - i-- - dAtA[i] = 0x10 - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func 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 *Tx) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.AuthInfo != nil { - l = m.AuthInfo.Size() - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - l = len(b) - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *TxRaw) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BodyBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.AuthInfoBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - l = len(b) - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *SignDoc) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BodyBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.AuthInfoBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovTx(uint64(m.AccountNumber)) - } - return n -} - -func (m *TxBody) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.TimeoutHeight != 0 { - n += 1 + sovTx(uint64(m.TimeoutHeight)) - } - if len(m.ExtensionOptions) > 0 { - for _, e := range m.ExtensionOptions { - l = e.Size() - n += 2 + l + sovTx(uint64(l)) - } - } - if len(m.NonCriticalExtensionOptions) > 0 { - for _, e := range m.NonCriticalExtensionOptions { - l = e.Size() - n += 2 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *AuthInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SignerInfos) > 0 { - for _, e := range m.SignerInfos { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.Fee != nil { - l = m.Fee.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *SignerInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = m.PublicKey.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.ModeInfo != nil { - l = m.ModeInfo.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.Sequence != 0 { - n += 1 + sovTx(uint64(m.Sequence)) - } - return n -} - -func (m *ModeInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n -} - -func (m *ModeInfo_Single_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Single != nil { - l = m.Single.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} -func (m *ModeInfo_Multi_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Multi != nil { - l = m.Multi.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} -func (m *ModeInfo_Single) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Mode != 0 { - n += 1 + sovTx(uint64(m.Mode)) - } - return n -} - -func (m *ModeInfo_Multi) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Bitarray != nil { - l = m.Bitarray.Size() - n += 1 + l + sovTx(uint64(l)) - } - if len(m.ModeInfos) > 0 { - for _, e := range m.ModeInfos { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *Fee) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.GasLimit != 0 { - n += 1 + sovTx(uint64(m.GasLimit)) - } - l = len(m.Payer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Granter) - if l > 0 { - n += 1 + l + sovTx(uint64(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 *Tx) 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: Tx: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Tx: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &TxBody{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthInfo == nil { - m.AuthInfo = &AuthInfo{} - } - if err := m.AuthInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var 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.Signatures = append(m.Signatures, make([]byte, postIndex-iNdEx)) - copy(m.Signatures[len(m.Signatures)-1], 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 *TxRaw) 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: TxRaw: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxRaw: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodyBytes", 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.BodyBytes = append(m.BodyBytes[:0], dAtA[iNdEx:postIndex]...) - if m.BodyBytes == nil { - m.BodyBytes = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthInfoBytes", 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.AuthInfoBytes = append(m.AuthInfoBytes[:0], dAtA[iNdEx:postIndex]...) - if m.AuthInfoBytes == nil { - m.AuthInfoBytes = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", 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.Signatures = append(m.Signatures, make([]byte, postIndex-iNdEx)) - copy(m.Signatures[len(m.Signatures)-1], 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 *SignDoc) 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: SignDoc: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignDoc: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodyBytes", 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.BodyBytes = append(m.BodyBytes[:0], dAtA[iNdEx:postIndex]...) - if m.BodyBytes == nil { - m.BodyBytes = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthInfoBytes", 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.AuthInfoBytes = append(m.AuthInfoBytes[:0], dAtA[iNdEx:postIndex]...) - if m.AuthInfoBytes == nil { - m.AuthInfoBytes = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", 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.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) - } - m.AccountNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AccountNumber |= uint64(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 *TxBody) 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: TxBody: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxBody: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, &types.Any{}) - if err := m.Messages[len(m.Messages)-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 Memo", 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.Memo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimeoutHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 1023: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtensionOptions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExtensionOptions = append(m.ExtensionOptions, &types.Any{}) - if err := m.ExtensionOptions[len(m.ExtensionOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2047: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NonCriticalExtensionOptions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NonCriticalExtensionOptions = append(m.NonCriticalExtensionOptions, &types.Any{}) - if err := m.NonCriticalExtensionOptions[len(m.NonCriticalExtensionOptions)-1].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 *AuthInfo) 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: AuthInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignerInfos", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignerInfos = append(m.SignerInfos, &SignerInfo{}) - if err := m.SignerInfos[len(m.SignerInfos)-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 Fee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Fee == nil { - m.Fee = &Fee{} - } - if err := m.Fee.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 *SignerInfo) 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: SignerInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignerInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PublicKey == nil { - m.PublicKey = &types.Any{} - } - if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModeInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ModeInfo == nil { - m.ModeInfo = &ModeInfo{} - } - if err := m.ModeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(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 *ModeInfo) 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: ModeInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModeInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Single", 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 - } - v := &ModeInfo_Single{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &ModeInfo_Single_{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Multi", 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 - } - v := &ModeInfo_Multi{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &ModeInfo_Multi_{v} - 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 *ModeInfo_Single) 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: Single: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Single: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mode |= signing.SignMode(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 *ModeInfo_Multi) 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: Multi: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Multi: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bitarray", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Bitarray == nil { - m.Bitarray = &types1.CompactBitArray{} - } - if err := m.Bitarray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModeInfos", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ModeInfos = append(m.ModeInfos, &ModeInfo{}) - if err := m.ModeInfos[len(m.ModeInfos)-1].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 *Fee) 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: Fee: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Fee: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types2.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) - } - m.GasLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payer", 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.Payer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Granter", 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.Granter = 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 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/types/tx/types.go b/types/tx/types.go deleted file mode 100644 index 14cca379..00000000 --- a/types/tx/types.go +++ /dev/null @@ -1,120 +0,0 @@ -package tx - -import ( - "errors" - "fmt" - - codectypes "github.com/irisnet/irishub-sdk-go/codec/types" - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// MaxGasWanted defines the max gas allowed. -const MaxGasWanted = uint64((1 << 63) - 1) - -var _, _ codectypes.UnpackInterfacesMessage = &Tx{}, &TxBody{} -var _ sdk.Tx = &Tx{} - -// GetMsgs implements the GetMsgs method on sdk.Tx. -func (t *Tx) GetMsgs() []sdk.Msg { - if t == nil || t.Body == nil { - return nil - } - - anys := t.Body.Messages - res := make([]sdk.Msg, len(anys)) - for i, any := range anys { - msg := any.GetCachedValue().(sdk.Msg) - res[i] = msg - } - return res -} - -// ValidateBasic implements the ValidateBasic method on sdk.Tx. -func (t *Tx) ValidateBasic() error { - if t == nil { - return fmt.Errorf("bad Tx") - } - - body := t.Body - if body == nil { - return fmt.Errorf("missing TxBody") - } - - authInfo := t.AuthInfo - if authInfo == nil { - return fmt.Errorf("missing AuthInfo") - } - - fee := authInfo.Fee - if fee == nil { - return fmt.Errorf("missing fee") - } - - if fee.GasLimit > MaxGasWanted { - return fmt.Errorf( - "invalid gas supplied; %d > %d", fee.GasLimit, MaxGasWanted, - ) - } - - if fee.Amount.IsAnyNegative() { - return fmt.Errorf( - "invalid fee provided: %s", fee.Amount, - ) - } - - sigs := t.Signatures - - if len(sigs) == 0 { - return errors.New("no signatures supplied") - } - - if len(sigs) != len(t.GetSigners()) { - return fmt.Errorf( - "wrong number of signers; expected %d, got %d", t.GetSigners(), len(sigs), - ) - } - - return nil -} - -// GetSigners retrieves all the signers of a tx. -func (t *Tx) GetSigners() []sdk.AccAddress { - var signers []sdk.AccAddress - seen := map[string]bool{} - - for _, msg := range t.GetMsgs() { - for _, addr := range msg.GetSigners() { - if !seen[addr.String()] { - signers = append(signers, addr) - seen[addr.String()] = true - } - } - } - - return signers -} - -// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (t *Tx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - if t.Body != nil { - return t.Body.UnpackInterfaces(unpacker) - } - return nil -} - -// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (m *TxBody) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - for _, any := range m.Messages { - var msg sdk.Msg - if err := unpacker.UnpackAny(any, &msg); err != nil { - return err - } - } - return nil -} - -// RegisterInterfaces registers the sdk.Tx interface. -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - registry.RegisterInterface("cosmos.tx.v1beta1.Tx", (*sdk.Tx)(nil)) - registry.RegisterImplementations((*sdk.Tx)(nil), &Tx{}) -} diff --git a/types/tx_config.go b/types/tx_config.go deleted file mode 100644 index 299211f4..00000000 --- a/types/tx_config.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - signingtypes "github.com/irisnet/irishub-sdk-go/types/tx/signing" -) - -type ( - // TxBuilder defines an interface which an application-defined concrete transaction - // type must implement. Namely, it must be able to set messages, generate - // signatures, and provide canonical bytes to sign over. The transaction must - // also know how to encode itself. - TxBuilder interface { - GetTx() Tx - - SetMsgs(msgs ...Msg) error - SetSignatures(signatures ...signingtypes.SignatureV2) error - SetMemo(memo string) - SetFeeAmount(amount Coins) - SetGasLimit(limit uint64) - SetTimeoutHeight(height uint64) - } - - // TxEncodingConfig defines an interface that contains transaction - // encoders and decoders - TxEncodingConfig interface { - TxEncoder() TxEncoder - TxDecoder() TxDecoder - TxJSONEncoder() TxEncoder - TxJSONDecoder() TxDecoder - MarshalSignatureJSON([]signingtypes.SignatureV2) ([]byte, error) - UnmarshalSignatureJSON([]byte) ([]signingtypes.SignatureV2, error) - } - - // TxConfig defines an interface a client can utilize to generate an - // application-defined concrete transaction type. The type returned must - // implement TxBuilder. - TxConfig interface { - TxEncodingConfig - - NewTxBuilder() TxBuilder - WrapTxBuilder(Tx) (TxBuilder, error) - SignModeHandler() SignModeHandler - } -) diff --git a/types/tx_msg.go b/types/tx_msg.go deleted file mode 100644 index e75b7b6a..00000000 --- a/types/tx_msg.go +++ /dev/null @@ -1,87 +0,0 @@ -package types - -import ( - "github.com/gogo/protobuf/proto" - - "github.com/tendermint/tendermint/crypto" -) - -type ( - // Msg defines the interface a transaction message must fulfill. - Msg interface { - proto.Message - - // Return the message type. - // Must be alphanumeric or empty. - Route() string - - // Returns a human-readable string for the message, intended for utilization - // within tags - Type() string - - // ValidateBasic does a simple validation check that - // doesn't require access to any other information. - ValidateBasic() error - - // Get the canonical byte representation of the Msg. - GetSignBytes() []byte - - // Signers returns the addrs of signers that must sign. - // CONTRACT: All signatures must be present to be valid. - // CONTRACT: Returns addrs in some deterministic order. - GetSigners() []AccAddress - } - - // Fee defines an interface for an application application-defined concrete - // transaction type to be able to set and return the transaction fee. - Fee interface { - GetGas() uint64 - GetAmount() Coins - } - - // Signature defines an interface for an application application-defined - // concrete transaction type to be able to set and return transaction signatures. - Signature interface { - GetPubKey() crypto.PubKey - GetSignature() []byte - } - - // Tx defines the interface a transaction must fulfill. - Tx interface { - // Gets the all the transaction's messages. - GetMsgs() []Msg - - // ValidateBasic does a simple and lightweight validation check that doesn't - // require access to any other information. - ValidateBasic() error - } - - // FeeTx defines the interface to be implemented by Tx to use the FeeDecorators - FeeTx interface { - Tx - GetGas() uint64 - GetFee() Coins - FeePayer() AccAddress - FeeGranter() AccAddress - } - - // Tx must have GetMemo() method to use ValidateMemoDecorator - TxWithMemo interface { - Tx - GetMemo() string - } - - // TxWithTimeoutHeight extends the Tx interface by allowing a transaction to - // set a height timeout. - TxWithTimeoutHeight interface { - Tx - - GetTimeoutHeight() uint64 - } -) - -// TxDecoder unmarshals transaction bytes -type TxDecoder func(txBytes []byte) (Tx, error) - -// TxEncoder marshals transaction to bytes -type TxEncoder func(tx Tx) ([]byte, error) diff --git a/types/utils.go b/types/utils.go deleted file mode 100644 index 7cc3347f..00000000 --- a/types/utils.go +++ /dev/null @@ -1,75 +0,0 @@ -package types - -import ( - "encoding/binary" - "encoding/json" - "time" -) - -// SortedJSON takes any JSON and returns it sorted by keys. Also, all white-spaces -// are removed. -// This method can be used to canonicalize JSON to be returned by GetSignBytes, -// e.g. for the ledger integration. -// If the passed JSON isn't valid it will return an error. -func SortJSON(toSortJSON []byte) ([]byte, error) { - var c interface{} - if err := json.Unmarshal(toSortJSON, &c); err != nil { - return nil, err - } - return json.Marshal(c) -} - -// MustSortJSON is like SortJSON but panic if an error occurs, e.g., if -// the passed JSON isn't valid. -func MustSortJSON(toSortJSON []byte) []byte { - js, err := SortJSON(toSortJSON) - if err != nil { - panic(err) - } - return js -} - -// Uint64ToBigEndian - marshals uint64 to a bigendian byte slice so it can be sorted -func Uint64ToBigEndian(i uint64) []byte { - b := make([]byte, 8) - binary.BigEndian.PutUint64(b, i) - return b -} - -// BigEndianToUint64 returns an uint64 from big endian encoded bytes. If encoding -// is empty, zero is returned. -func BigEndianToUint64(bz []byte) uint64 { - if len(bz) == 0 { - return 0 - } - - return binary.BigEndian.Uint64(bz) -} - -// Slight modification of the RFC3339Nano but it right pads all zeros and drops the time zone info -const SortableTimeFormat = "2006-01-02T15:04:05.000000000" - -// Formats a time.Time into a []byte that can be sorted -func FormatTimeBytes(t time.Time) []byte { - return []byte(t.UTC().Round(0).Format(SortableTimeFormat)) -} - -// Parses a []byte encoded using FormatTimeKey back into a time.Time -func ParseTimeBytes(bz []byte) (time.Time, error) { - str := string(bz) - t, err := time.Parse(SortableTimeFormat, str) - if err != nil { - return t, err - } - return t.UTC().Round(0), nil -} - -// copy bytes -func CopyBytes(bz []byte) (ret []byte) { - if bz == nil { - return nil - } - ret = make([]byte, len(bz)) - copy(ret, bz) - return ret -} diff --git a/utils/bech32/bech32.go b/utils/bech32/bech32.go deleted file mode 100644 index 7ab4b951..00000000 --- a/utils/bech32/bech32.go +++ /dev/null @@ -1,49 +0,0 @@ -package bech32 - -import ( - "errors" - "fmt" - - "github.com/btcsuite/btcutil/bech32" -) - -// GetFromBech32 decodes a byte string from a Bech32 encoded string. -func GetFromBech32(bech32str, prefix string) ([]byte, error) { - if len(bech32str) == 0 { - return nil, errors.New("decoding Bech32 address failed: must provide an address") - } - - hrp, bz, err := DecodeAndConvert(bech32str) - if err != nil { - return nil, err - } - - if hrp != prefix { - return nil, fmt.Errorf("invalid Bech32 prefix; expected %s, got %s", prefix, hrp) - } - - return bz, nil -} - -//ConvertAndEncode converts from a base64 encoded byte string to base32 encoded byte string and then to bech32 -func ConvertAndEncode(hrp string, data []byte) (string, error) { - converted, err := bech32.ConvertBits(data, 8, 5, true) - if err != nil { - return "", err - } - return bech32.Encode(hrp, converted) - -} - -//DecodeAndConvert decodes a bech32 encoded string and converts to base64 encoded bytes -func DecodeAndConvert(bech string) (string, []byte, error) { - hrp, data, err := bech32.Decode(bech) - if err != nil { - return "", nil, err - } - converted, err := bech32.ConvertBits(data, 5, 8, false) - if err != nil { - return "", nil, err - } - return hrp, converted, nil -} diff --git a/utils/cache/cache.go b/utils/cache/cache.go deleted file mode 100644 index 08df0568..00000000 --- a/utils/cache/cache.go +++ /dev/null @@ -1,70 +0,0 @@ -package cache - -import ( - "errors" - "time" - - "github.com/bluele/gcache" -) - -type Cache interface { - Set(key, value interface{}) error - SetWithExpire(key, value interface{}, expiration time.Duration) error - Get(key interface{}) (interface{}, error) - Remove(key interface{}) bool -} - -type LRU struct { - cache gcache.Cache - enabled bool -} - -func NewCache(capacity int, enable bool) Cache { - return &LRU{ - cache: gcache.New(capacity).LRU().Build(), - enabled: enable, - } -} - -func (l *LRU) Set(key, value interface{}) error { - if !l.enabled { - return nil - } - return l.cache.Set(key, value) -} - -func (l *LRU) SetWithExpire(key, value interface{}, expiration time.Duration) error { - if !l.enabled { - return nil - } - return l.cache.SetWithExpire(key, value, expiration) -} - -func (l LRU) Get(key interface{}) (interface{}, error) { - if !l.enabled { - return nil, errors.New("cache not enabled") - } - return l.cache.Get(key) -} - -func (l *LRU) Remove(key interface{}) bool { - if !l.enabled { - return false - } - return l.cache.Remove(key) -} - -func (l *LRU) Expire(key interface{}) bool { - if !l.enabled { - return true - } - return l.Remove(key) -} - -func (l *LRU) Enable() { - l.enabled = true -} - -func (l *LRU) Disable() { - l.enabled = false -} diff --git a/utils/commom.go b/utils/commom.go deleted file mode 100644 index fdc27af9..00000000 --- a/utils/commom.go +++ /dev/null @@ -1,58 +0,0 @@ -package utils - -import ( - "crypto/rand" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -// GenerateRandomBytes returns securely generated random bytes. -// It will return an error if the system's secure random -// number generator fails to function correctly, in which -// case the caller should not continue. -func GenerateRandomBytes(n int) ([]byte, error) { - b := make([]byte, n) - _, err := rand.Read(b) - // Note that err == nil only if we read len(b) bytes. - if err != nil { - return nil, err - } - - return b, nil -} - -func SubArray(subLen int, array sdk.SplitAble) (segments []sdk.SplitAble) { - maxLen := array.Len() - if maxLen <= subLen { - return []sdk.SplitAble{array} - } - - batch := maxLen / subLen - if maxLen%subLen > 0 { - batch++ - } - - for i := 1; i <= batch; i++ { - start := (i - 1) * subLen - end := i * subLen - if i != batch { - segments = append(segments, array.Sub(start, end)) - } else { - segments = append(segments, array.Sub(start, array.Len())) - } - } - return segments -} - -func ParsePage(page uint64, size uint64) (offset, limit uint64) { - if page == 0 { - page = 1 - } - if size == 0 { - size = 10 - } - - offset = (page - 1) * size - limit = size - return -} diff --git a/utils/common_test.go b/utils/common_test.go deleted file mode 100644 index a935a6c4..00000000 --- a/utils/common_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package utils - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/irisnet/irishub-sdk-go/types" -) - -func TestSplitArray(t *testing.T) { - data := Ints{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - subData := SubArray(4, data) - require.Len(t, subData, 3) -} - -type Ints []int - -func (i Ints) Len() int { - return len(i) -} - -func (i Ints) Sub(begin, end int) sdk.SplitAble { - return i[begin:end] -} diff --git a/utils/log/logger.go b/utils/log/logger.go deleted file mode 100644 index ddfcb358..00000000 --- a/utils/log/logger.go +++ /dev/null @@ -1,113 +0,0 @@ -package log - -import ( - "io" - "os" - "strings" - - "github.com/sirupsen/logrus" - "github.com/tendermint/tendermint/libs/log" -) - -var ( - _ log.Logger = LogrusLogger{} - _ log.Logger = entry{} -) - -type LogrusLogger struct { - logger *logrus.Logger -} - -func NewDefaultLogger() LogrusLogger { - logger := logrus.New() - - logger.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) - logger.SetOutput(os.Stdout) - logger.SetLevel(logrus.InfoLevel) - return LogrusLogger{ - logger: logger, - } -} - -func NewLogger(cfg Config) LogrusLogger { - logger := logrus.New() - - switch cfg.Format { - case FormatText: - logger.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) - case FormatJSON: - logger.SetFormatter(&logrus.JSONFormatter{}) - } - - switch strings.ToLower(cfg.Level) { - case DebugLevel: - logger.SetLevel(logrus.DebugLevel) - case InfoLevel: - logger.SetLevel(logrus.InfoLevel) - case WarnLevel: - logger.SetLevel(logrus.WarnLevel) - case ErrorLevel: - logger.SetLevel(logrus.ErrorLevel) - } - - logger.SetOutput(os.Stdout) - return LogrusLogger{ - logger: logger, - } -} - -func (l *LogrusLogger) SetOutput(output io.Writer) { - l.logger.SetOutput(os.Stdout) -} - -func (l LogrusLogger) Debug(msg string, keyvals ...interface{}) { - l.logger.WithFields(argsToFields(keyvals...)).Debug(msg) -} - -func (l LogrusLogger) Info(msg string, keyvals ...interface{}) { - l.logger.WithFields(argsToFields(keyvals...)).Info(msg) -} - -func (l LogrusLogger) Error(msg string, keyvals ...interface{}) { - l.logger.WithFields(argsToFields(keyvals...)).Error(msg) -} - -func (l LogrusLogger) With(keyvals ...interface{}) log.Logger { - return entry{ - l.logger.WithFields(argsToFields(keyvals...)), - } -} - -type entry struct { - *logrus.Entry -} - -func (e entry) Debug(msg string, keyvals ...interface{}) { - e.Entry.WithFields(argsToFields(keyvals...)).Debug(msg) -} - -func (e entry) Info(msg string, keyvals ...interface{}) { - e.Entry.WithFields(argsToFields(keyvals...)).Info(msg) -} - -func (e entry) Error(msg string, keyvals ...interface{}) { - e.Entry.WithFields(argsToFields(keyvals...)).Error(msg) -} - -func (e entry) With(keyvals ...interface{}) log.Logger { - return entry{ - e.WithFields(argsToFields(keyvals...)), - } -} - -func argsToFields(keyvals ...interface{}) logrus.Fields { - var fields = make(logrus.Fields) - if len(keyvals)%2 != 0 { - return fields - } - - for i := 0; i < len(keyvals); i += 2 { - fields[keyvals[i].(string)] = keyvals[i+1] - } - return fields -} diff --git a/utils/log/logger_test.go b/utils/log/logger_test.go deleted file mode 100644 index 90bf68be..00000000 --- a/utils/log/logger_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package log - -import ( - "testing" -) - -func TestNewLogger(t *testing.T) { - log1 := NewLogger(Config{ - Format: "json", - Level: "info", - }) - - log1.Info("Hello World", "foo", "bar") - log1.Info("Hello World", "foo1", "bar") - log1.Info("Hello World", "foo2", "bar") - log1.Info("Hello World", "foo3", "bar") -} diff --git a/utils/log/type.go b/utils/log/type.go deleted file mode 100644 index f4f52f57..00000000 --- a/utils/log/type.go +++ /dev/null @@ -1,16 +0,0 @@ -package log - -const ( - DebugLevel = "debug" - InfoLevel = "info" - WarnLevel = "warn" - ErrorLevel = "error" - - FormatText = "text" - FormatJSON = "json" -) - -type Config struct { - Format string `json:"format" yaml:"format" ` - Level string `json:"level" yaml:"level"` -} diff --git a/utils/uuid/codec.go b/utils/uuid/codec.go deleted file mode 100644 index d7ddf2de..00000000 --- a/utils/uuid/codec.go +++ /dev/null @@ -1,186 +0,0 @@ -// reference: https://github.com/binance-chain/go-sdk/blob/master/common/uuid/codec.go -package uuid - -import ( - "bytes" - "encoding/hex" - "fmt" -) - -// FromBytes returns UUID converted from raw byte slice input. -// It will return error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (u UUID, err error) { - err = u.UnmarshalBinary(input) - return -} - -// FromBytesOrNil returns UUID converted from raw byte slice input. -// Same behavior as FromBytes, but returns a Nil UUID on error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -// FromString returns UUID parsed from string input. -// Input is expected in a form accepted by UnmarshalText. -func FromString(input string) (u UUID, err error) { - err = u.UnmarshalText([]byte(input)) - return -} - -// FromStringOrNil returns UUID parsed from string input. -// Same behavior as FromString, but returns a Nil UUID on error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. -func (u UUID) MarshalText() (text []byte, err error) { - text = []byte(u.String()) - return -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -// "6ba7b8109dad11d180b400c04fd430c8" -// ABNF for supported UUID text representation follows: -// uuid := canonical | hashlike | braced | urn -// plain := canonical | hashlike -// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct -// hashlike := 12hexoct -// braced := '{' plain '}' -// urn := URN ':' UUID-NID ':' plain -// URN := 'urn' -// UUID-NID := 'uuid' -// 12hexoct := 6hexoct 6hexoct -// 6hexoct := 4hexoct 2hexoct -// 4hexoct := 2hexoct 2hexoct -// 2hexoct := hexoct hexoct -// hexoct := hexdig hexdig -// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | -// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | -// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' -func (u *UUID) UnmarshalText(text []byte) (err error) { - switch len(text) { - case 32: - return u.decodeHashLike(text) - case 36: - return u.decodeCanonical(text) - case 38: - return u.decodeBraced(text) - case 41: - fallthrough - case 45: - return u.decodeURN(text) - default: - return fmt.Errorf("uuid: incorrect UUID length: %s", text) - } -} - -// decodeCanonical decodes UUID string in format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8". -func (u *UUID) decodeCanonical(t []byte) (err error) { - if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - src := t[:] - dst := u[:] - - for i, byteGroup := range byteGroups { - if i > 0 { - src = src[1:] // skip dash - } - _, err = hex.Decode(dst[:byteGroup/2], src[:byteGroup]) - if err != nil { - return - } - src = src[byteGroup:] - dst = dst[byteGroup/2:] - } - - return -} - -// decodeHashLike decodes UUID string in format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeHashLike(t []byte) (err error) { - src := t[:] - dst := u[:] - - if _, err = hex.Decode(dst, src); err != nil { - return err - } - return -} - -// decodeBraced decodes UUID string in format -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" or in format -// "{6ba7b8109dad11d180b400c04fd430c8}". -func (u *UUID) decodeBraced(t []byte) (err error) { - l := len(t) - - if t[0] != '{' || t[l-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - return u.decodePlain(t[1 : l-1]) -} - -// decodeURN decodes UUID string in format -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in format -// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeURN(t []byte) (err error) { - total := len(t) - - urn_uuid_prefix := t[:9] - - if !bytes.Equal(urn_uuid_prefix, urnPrefix) { - return fmt.Errorf("uuid: incorrect UUID format: %s", t) - } - - return u.decodePlain(t[9:total]) -} - -// decodePlain decodes UUID string in canonical format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodePlain(t []byte) (err error) { - switch len(t) { - case 32: - return u.decodeHashLike(t) - case 36: - return u.decodeCanonical(t) - default: - return fmt.Errorf("uuid: incorrrect UUID length: %s", t) - } -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() (data []byte, err error) { - data = u.Bytes() - return -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) (err error) { - if len(data) != Size { - err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - return - } - copy(u[:], data) - - return -} diff --git a/utils/uuid/generator.go b/utils/uuid/generator.go deleted file mode 100644 index 43c1f833..00000000 --- a/utils/uuid/generator.go +++ /dev/null @@ -1,245 +0,0 @@ -// reference: https://github.com/binance-chain/go-sdk/blob/master/common/uuid/generator.go -package uuid - -import ( - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "encoding/binary" - "fmt" - "hash" - "io" - "net" - "os" - "sync" - "time" -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -type epochFunc func() time.Time -type hwAddrFunc func() (net.HardwareAddr, error) - -var ( - global = newRFC4122Generator() - - posixUID = uint32(os.Getuid()) - posixGID = uint32(os.Getgid()) -) - -// NewV1 returns UUID based on current timestamp and MAC address. -func NewV1() (UUID, error) { - return global.NewV1() -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func NewV2(domain byte) (UUID, error) { - return global.NewV2(domain) -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - return global.NewV3(ns, name) -} - -// NewV4 returns random generated UUID. -func NewV4() (UUID, error) { - return global.NewV4() -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - return global.NewV5(ns, name) -} - -// Generator provides interface for generating UUIDs. -type Generator interface { - NewV1() (UUID, error) - NewV2(domain byte) (UUID, error) - NewV3(ns UUID, name string) UUID - NewV4() (UUID, error) - NewV5(ns UUID, name string) UUID -} - -// Default generator implementation. -type rfc4122Generator struct { - clockSequenceOnce sync.Once - hardwareAddrOnce sync.Once - storageMutex sync.Mutex - - rand io.Reader - - epochFunc epochFunc - hwAddrFunc hwAddrFunc - lastTime uint64 - clockSequence uint16 - hardwareAddr [6]byte -} - -func newRFC4122Generator() Generator { - return &rfc4122Generator{ - epochFunc: time.Now, - hwAddrFunc: defaultHWAddrFunc, - rand: rand.Reader, - } -} - -// NewV1 returns UUID based on current timestamp and MAC address. -func (g *rfc4122Generator) NewV1() (UUID, error) { - u := UUID{} - - timeNow, clockSeq, err := g.getClockSequence() - if err != nil { - return Nil, err - } - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - hardwareAddr, err := g.getHardwareAddr() - if err != nil { - return Nil, err - } - copy(u[10:], hardwareAddr) - - u.SetVersion(V1) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func (g *rfc4122Generator) NewV2(domain byte) (UUID, error) { - u, err := g.NewV1() - if err != nil { - return Nil, err - } - - switch domain { - case DomainPerson: - binary.BigEndian.PutUint32(u[:], posixUID) - case DomainGroup: - binary.BigEndian.PutUint32(u[:], posixGID) - } - - u[9] = domain - - u.SetVersion(V2) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func (g *rfc4122Generator) NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(V3) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV4 returns random generated UUID. -func (g *rfc4122Generator) NewV4() (UUID, error) { - u := UUID{} - if _, err := io.ReadFull(g.rand, u[:]); err != nil { - return Nil, err - } - u.SetVersion(V4) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func (g *rfc4122Generator) NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(V5) - u.SetVariant(VariantRFC4122) - - return u -} - -// Returns epoch and clock sequence. -func (g *rfc4122Generator) getClockSequence() (uint64, uint16, error) { - var err error - g.clockSequenceOnce.Do(func() { - buf := make([]byte, 2) - if _, err = io.ReadFull(g.rand, buf); err != nil { - return - } - g.clockSequence = binary.BigEndian.Uint16(buf) - }) - if err != nil { - return 0, 0, err - } - - g.storageMutex.Lock() - defer g.storageMutex.Unlock() - - timeNow := g.getEpoch() - // Clock didn't change since last UUID generation. - // Should increase clock sequence. - if timeNow <= g.lastTime { - g.clockSequence++ - } - g.lastTime = timeNow - - return timeNow, g.clockSequence, nil -} - -// Returns hardware address. -func (g *rfc4122Generator) getHardwareAddr() ([]byte, error) { - var err error - g.hardwareAddrOnce.Do(func() { - if hwAddr, err := g.hwAddrFunc(); err == nil { - copy(g.hardwareAddr[:], hwAddr) - return - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence. - if _, err = io.ReadFull(g.rand, g.hardwareAddr[:]); err != nil { - return - } - // Set multicast bit as recommended by RFC 4122 - g.hardwareAddr[0] |= 0x01 - }) - if err != nil { - return []byte{}, err - } - return g.hardwareAddr[:], nil -} - -// Returns difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and current time. -func (g *rfc4122Generator) getEpoch() uint64 { - return epochStart + uint64(g.epochFunc().UnixNano()/100) -} - -// Returns UUID based on hashing of namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - _, _ = h.Write(ns[:]) - _, _ = h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} - -// Returns hardware address. -func defaultHWAddrFunc() (net.HardwareAddr, error) { - ifaces, err := net.Interfaces() - if err != nil { - return []byte{}, err - } - for _, iface := range ifaces { - if len(iface.HardwareAddr) >= 6 { - return iface.HardwareAddr, nil - } - } - return []byte{}, fmt.Errorf("uuid: no HW address found") -} diff --git a/utils/uuid/uuid.go b/utils/uuid/uuid.go deleted file mode 100644 index 142fd666..00000000 --- a/utils/uuid/uuid.go +++ /dev/null @@ -1,138 +0,0 @@ -//Package uuid reference: https://github.com/binance-chain/go-sdk/blob/master/common/uuid/uuid.go -package uuid - -import ( - "bytes" - "encoding/hex" -) - -// Size of a UUID in bytes. -const Size = 16 - -// UUID representation compliant with specification -// described in RFC 4122. -type UUID [Size]byte - -// UUID versions -const ( - _ byte = iota - V1 - V2 - V3 - V4 - V5 -) - -// UUID layout variants. -const ( - VariantNCS byte = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// String parse helpers. -var ( - urnPrefix = []byte("urn:uuid:") - byteGroups = []int{8, 4, 4, 4, 12} -) - -// Nil is special form of UUID that is specified to have all -// 128 bits set to zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) -) - -// Equal returns true if u1 and u2 equals, otherwise returns false. -func Equal(u1 UUID, u2 UUID) bool { - return bytes.Equal(u1[:], u2[:]) -} - -// Version returns algorithm version used to generate UUID. -func (u UUID) Version() byte { - return u[6] >> 4 -} - -// Variant returns UUID layout variant. -func (u UUID) Variant() byte { - switch { - case (u[8] >> 7) == 0x00: - return VariantNCS - case (u[8] >> 6) == 0x02: - return VariantRFC4122 - case (u[8] >> 5) == 0x06: - return VariantMicrosoft - case (u[8] >> 5) == 0x07: - fallthrough - default: - return VariantFuture - } -} - -// Bytes returns bytes slice representation of UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Returns canonical string representation of UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := make([]byte, 36) - - hex.Encode(buf[0:8], u[0:4]) - buf[8] = '-' - hex.Encode(buf[9:13], u[4:6]) - buf[13] = '-' - hex.Encode(buf[14:18], u[6:8]) - buf[18] = '-' - hex.Encode(buf[19:23], u[8:10]) - buf[23] = '-' - hex.Encode(buf[24:], u[10:]) - - return string(buf) -} - -// SetVersion sets version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets variant bits. -func (u *UUID) SetVariant(v byte) { - switch v { - case VariantNCS: - u[8] = u[8]&(0xff>>1) | (0x00 << 7) - case VariantRFC4122: - u[8] = u[8]&(0xff>>2) | (0x02 << 6) - case VariantMicrosoft: - u[8] = u[8]&(0xff>>3) | (0x06 << 5) - case VariantFuture: - fallthrough - default: - u[8] = u[8]&(0xff>>3) | (0x07 << 5) - } -} - -// Must is a helper that wraps a call to a function returning (UUID, error) -// and panics if the error is non-nil. It is intended for use in variable -// initializations such as -// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")); -func Must(u UUID, err error) UUID { - if err != nil { - panic(err) - } - return u -} From 4d9fae7aab57d3193ebb08c9f2117d613baf2313 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 11:04:38 +0800 Subject: [PATCH 15/41] make format pkg --- core-sdk/bank/bank.go | 3 ++- core-sdk/client.go | 3 ++- core-sdk/client/account.go | 6 ++++-- core-sdk/client/base_client.go | 14 ++++++++------ core-sdk/client/grpc_client.go | 8 +++++--- core-sdk/client/keys.go | 4 +++- core-sdk/client/rpc_client.go | 4 +++- core-sdk/client/store.go | 1 + core-sdk/client/tx.go | 8 +++++--- core-sdk/common/bech32/bech32.go | 1 + core-sdk/common/commom.go | 1 + core-sdk/common/common_test.go | 3 ++- core-sdk/common/crypto/keys/ed25519/ed25519.go | 6 ++++-- core-sdk/common/crypto/keys/sm2/gm_sm2.go | 3 ++- core-sdk/integration_test/bank_test.go | 8 +++++--- core-sdk/integration_test/integration_test.go | 14 ++++++++------ core-sdk/types/address.go | 1 + core-sdk/types/address_test.go | 6 ++++-- core-sdk/types/auth/types.go | 4 +++- core-sdk/types/block.go | 4 +++- core-sdk/types/config.go | 3 ++- core-sdk/types/events.go | 3 ++- core-sdk/types/factory.go | 1 + core-sdk/types/module.go | 3 ++- core-sdk/types/result.go | 3 ++- core-sdk/types/stdtx.go | 1 + core-sdk/types/store/codec.go | 3 ++- core-sdk/types/store/types.go | 4 +++- core-sdk/types/tm_types.go | 8 +++++--- core-sdk/types/tx.go | 3 ++- core-sdk/types/tx/types.go | 1 + module-sdk/coinswap/coinswap.go | 3 ++- module-sdk/gov/export.go | 3 ++- module-sdk/gov/gov.go | 3 ++- module-sdk/gov/proposal.go | 5 +++-- module-sdk/gov/types.go | 1 + module-sdk/htlc/htlc.go | 1 + module-sdk/htlc/types.go | 1 + module-sdk/integration_test/coinswap_test.go | 3 ++- module-sdk/integration_test/gov_test.go | 1 + module-sdk/integration_test/htlc_test.go | 1 + module-sdk/integration_test/integration_test.go | 9 +++++---- module-sdk/integration_test/nft_test.go | 3 ++- module-sdk/integration_test/oracle_test.go | 3 ++- module-sdk/integration_test/random_test.go | 5 +++-- module-sdk/integration_test/record_test.go | 1 + module-sdk/integration_test/service_test.go | 3 ++- module-sdk/integration_test/staking_test.go | 1 + module-sdk/integration_test/token_test.go | 3 ++- module-sdk/nft/nft.go | 1 + module-sdk/nft/types.go | 3 ++- module-sdk/oracle/export.go | 3 ++- module-sdk/oracle/oracle.go | 1 + module-sdk/oracle/types.go | 3 ++- module-sdk/random/random.go | 3 ++- module-sdk/record/record.go | 1 + module-sdk/record/types.go | 1 + module-sdk/service/export.go | 3 ++- module-sdk/service/query.go | 1 + module-sdk/service/service.go | 3 ++- module-sdk/service/types.go | 3 ++- module-sdk/staking/delegation.go | 5 +++-- module-sdk/staking/export.go | 3 ++- module-sdk/staking/staking.go | 1 + module-sdk/staking/types.go | 1 + module-sdk/token/token.go | 3 ++- module-sdk/token/types.go | 3 ++- 67 files changed, 154 insertions(+), 73 deletions(-) diff --git a/core-sdk/bank/bank.go b/core-sdk/bank/bank.go index 9ba33961..a03459fd 100644 --- a/core-sdk/bank/bank.go +++ b/core-sdk/bank/bank.go @@ -3,11 +3,12 @@ package bank import ( "context" "fmt" + "strings" + "github.com/irisnet/core-sdk-go/common" commoncodec "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" - "strings" ) type bankClient struct { diff --git a/core-sdk/client.go b/core-sdk/client.go index 52484637..39a7b3ef 100644 --- a/core-sdk/client.go +++ b/core-sdk/client.go @@ -1,6 +1,8 @@ package sdk import ( + "github.com/tendermint/tendermint/libs/log" + "github.com/irisnet/core-sdk-go/bank" "github.com/irisnet/core-sdk-go/client" commoncodec "github.com/irisnet/core-sdk-go/common/codec" @@ -8,7 +10,6 @@ import ( commoncryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/types" txtypes "github.com/irisnet/core-sdk-go/types/tx" - "github.com/tendermint/tendermint/libs/log" ) type Client struct { diff --git a/core-sdk/client/account.go b/core-sdk/client/account.go index a11a43cc..21c78b62 100644 --- a/core-sdk/client/account.go +++ b/core-sdk/client/account.go @@ -3,13 +3,15 @@ package client import ( "context" "fmt" + "time" + + "github.com/tendermint/tendermint/libs/log" + "github.com/irisnet/core-sdk-go/bank" cache "github.com/irisnet/core-sdk-go/common/cache" commoncodec "github.com/irisnet/core-sdk-go/common/codec" sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/auth" - "github.com/tendermint/tendermint/libs/log" - "time" ) // Must be used with locker, otherwise there are thread safety issues diff --git a/core-sdk/client/base_client.go b/core-sdk/client/base_client.go index d1ec721f..774bba73 100644 --- a/core-sdk/client/base_client.go +++ b/core-sdk/client/base_client.go @@ -7,20 +7,22 @@ import ( "encoding/hex" "errors" "fmt" + "strings" + "time" + "github.com/avast/retry-go" "github.com/gogo/protobuf/proto" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/crypto/tmhash" + "github.com/tendermint/tendermint/libs/log" + rpcclient "github.com/tendermint/tendermint/rpc/client" + "github.com/irisnet/core-sdk-go/common" commoncache "github.com/irisnet/core-sdk-go/common/cache" commoncodec "github.com/irisnet/core-sdk-go/common/codec" sdklog "github.com/irisnet/core-sdk-go/common/log" sdktypes "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/tx" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - "github.com/tendermint/tendermint/libs/log" - rpcclient "github.com/tendermint/tendermint/rpc/client" - "strings" - "time" ) const ( diff --git a/core-sdk/client/grpc_client.go b/core-sdk/client/grpc_client.go index 1c46901c..5a9b7fad 100644 --- a/core-sdk/client/grpc_client.go +++ b/core-sdk/client/grpc_client.go @@ -1,12 +1,14 @@ package client import ( - "github.com/irisnet/core-sdk-go/types" + "sync" + "time" + "github.com/prometheus/common/log" "google.golang.org/grpc" "google.golang.org/grpc/keepalive" - "sync" - "time" + + "github.com/irisnet/core-sdk-go/types" ) var clientConnSingleton *grpc.ClientConn diff --git a/core-sdk/client/keys.go b/core-sdk/client/keys.go index f629e3e6..7e9955bc 100644 --- a/core-sdk/client/keys.go +++ b/core-sdk/client/keys.go @@ -2,6 +2,9 @@ package client import ( "fmt" + + tmcrypto "github.com/tendermint/tendermint/crypto" + kmg "github.com/irisnet/core-sdk-go/common/crypto" cryptoamino "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" @@ -9,7 +12,6 @@ import ( commoncryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/store" - tmcrypto "github.com/tendermint/tendermint/crypto" ) type keyManager struct { diff --git a/core-sdk/client/rpc_client.go b/core-sdk/client/rpc_client.go index 3ec8751a..936a954f 100644 --- a/core-sdk/client/rpc_client.go +++ b/core-sdk/client/rpc_client.go @@ -3,13 +3,15 @@ package client import ( "context" "fmt" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" + "github.com/tendermint/tendermint/crypto/tmhash" "github.com/tendermint/tendermint/libs/log" rpc "github.com/tendermint/tendermint/rpc/client" rpchttp "github.com/tendermint/tendermint/rpc/client/http" tmtypes "github.com/tendermint/tendermint/types" + commoncodec "github.com/irisnet/core-sdk-go/common/codec" + "github.com/irisnet/core-sdk-go/common/uuid" sdk "github.com/irisnet/core-sdk-go/types" ) diff --git a/core-sdk/client/store.go b/core-sdk/client/store.go index 78f6918c..cdb15ea5 100644 --- a/core-sdk/client/store.go +++ b/core-sdk/client/store.go @@ -3,6 +3,7 @@ package client import ( "context" "errors" + rpcclient "github.com/tendermint/tendermint/rpc/client" ) diff --git a/core-sdk/client/tx.go b/core-sdk/client/tx.go index 23dfe336..ad021983 100644 --- a/core-sdk/client/tx.go +++ b/core-sdk/client/tx.go @@ -4,11 +4,13 @@ import ( "context" "encoding/hex" "errors" - "github.com/gogo/protobuf/jsonpb" - sdk "github.com/irisnet/core-sdk-go/types" - ctypes "github.com/tendermint/tendermint/rpc/core/types" "strings" "time" + + "github.com/gogo/protobuf/jsonpb" + ctypes "github.com/tendermint/tendermint/rpc/core/types" + + sdk "github.com/irisnet/core-sdk-go/types" ) // QueryTx returns the tx info diff --git a/core-sdk/common/bech32/bech32.go b/core-sdk/common/bech32/bech32.go index 8059dfd1..7ab4b951 100644 --- a/core-sdk/common/bech32/bech32.go +++ b/core-sdk/common/bech32/bech32.go @@ -3,6 +3,7 @@ package bech32 import ( "errors" "fmt" + "github.com/btcsuite/btcutil/bech32" ) diff --git a/core-sdk/common/commom.go b/core-sdk/common/commom.go index 3d6cdc9a..4f9124ed 100644 --- a/core-sdk/common/commom.go +++ b/core-sdk/common/commom.go @@ -2,6 +2,7 @@ package common import ( "crypto/rand" + "github.com/irisnet/core-sdk-go/types" ) diff --git a/core-sdk/common/common_test.go b/core-sdk/common/common_test.go index 3aa85dab..1d8f17e5 100644 --- a/core-sdk/common/common_test.go +++ b/core-sdk/common/common_test.go @@ -1,9 +1,10 @@ package common import ( - "github.com/irisnet/core-sdk-go/types" "testing" + "github.com/irisnet/core-sdk-go/types" + "github.com/stretchr/testify/require" ) diff --git a/core-sdk/common/crypto/keys/ed25519/ed25519.go b/core-sdk/common/crypto/keys/ed25519/ed25519.go index f19d1289..4611fafa 100644 --- a/core-sdk/common/crypto/keys/ed25519/ed25519.go +++ b/core-sdk/common/crypto/keys/ed25519/ed25519.go @@ -3,14 +3,16 @@ package ed25519 import ( "crypto/subtle" "fmt" - "github.com/irisnet/core-sdk-go/common/codec" "io" - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" + "github.com/irisnet/core-sdk-go/common/codec" + "github.com/tendermint/tendermint/crypto" tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/tmhash" "golang.org/x/crypto/ed25519" + + cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" ) //------------------------------------- diff --git a/core-sdk/common/crypto/keys/sm2/gm_sm2.go b/core-sdk/common/crypto/keys/sm2/gm_sm2.go index accdef30..cdddec8c 100644 --- a/core-sdk/common/crypto/keys/sm2/gm_sm2.go +++ b/core-sdk/common/crypto/keys/sm2/gm_sm2.go @@ -4,8 +4,9 @@ import ( "bytes" "crypto/rand" "fmt" - "github.com/tjfoc/gmsm/sm2" "log" + + "github.com/tjfoc/gmsm/sm2" ) //Generate key pair diff --git a/core-sdk/integration_test/bank_test.go b/core-sdk/integration_test/bank_test.go index 51304a4b..5f94658f 100644 --- a/core-sdk/integration_test/bank_test.go +++ b/core-sdk/integration_test/bank_test.go @@ -3,12 +3,14 @@ package integration_test import ( "encoding/json" "fmt" - "github.com/irisnet/core-sdk-go/bank" - "github.com/irisnet/core-sdk-go/types" - "github.com/stretchr/testify/require" "math/rand" "sync" "time" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/core-sdk-go/bank" + "github.com/irisnet/core-sdk-go/types" ) func (s IntegrationTestSuite) TestBank() { diff --git a/core-sdk/integration_test/integration_test.go b/core-sdk/integration_test/integration_test.go index 20db94e0..ceba9da6 100644 --- a/core-sdk/integration_test/integration_test.go +++ b/core-sdk/integration_test/integration_test.go @@ -1,18 +1,20 @@ package integration_test import ( - sdk "github.com/irisnet/core-sdk-go" - "github.com/irisnet/core-sdk-go/common/crypto" - "github.com/irisnet/core-sdk-go/common/log" - "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/store" - "github.com/stretchr/testify/suite" "io/ioutil" "math/rand" "os" "path/filepath" "testing" "time" + + "github.com/stretchr/testify/suite" + + sdk "github.com/irisnet/core-sdk-go" + "github.com/irisnet/core-sdk-go/common/crypto" + "github.com/irisnet/core-sdk-go/common/log" + "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/store" ) const ( diff --git a/core-sdk/types/address.go b/core-sdk/types/address.go index 6e85e2f0..1c977838 100644 --- a/core-sdk/types/address.go +++ b/core-sdk/types/address.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/irisnet/core-sdk-go/common/bech32" ) diff --git a/core-sdk/types/address_test.go b/core-sdk/types/address_test.go index 26458b09..3030bce1 100644 --- a/core-sdk/types/address_test.go +++ b/core-sdk/types/address_test.go @@ -2,9 +2,11 @@ package types import ( "fmt" - "github.com/irisnet/core-sdk-go/common/bech32" - "github.com/stretchr/testify/require" "testing" + + "github.com/stretchr/testify/require" + + "github.com/irisnet/core-sdk-go/common/bech32" ) func TestGetFromBech32(t *testing.T) { diff --git a/core-sdk/types/auth/types.go b/core-sdk/types/auth/types.go index 4abe4084..19728b71 100644 --- a/core-sdk/types/auth/types.go +++ b/core-sdk/types/auth/types.go @@ -4,11 +4,13 @@ import ( "encoding/json" "errors" "fmt" + "github.com/gogo/protobuf/proto" + "github.com/tendermint/tendermint/crypto" + commoncodec "github.com/irisnet/core-sdk-go/common/codec" codectypes "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/tendermint/tendermint/crypto" ) // Account is an interface used to store coins at a given address within state. diff --git a/core-sdk/types/block.go b/core-sdk/types/block.go index 6443c9dd..99a76a26 100644 --- a/core-sdk/types/block.go +++ b/core-sdk/types/block.go @@ -2,11 +2,13 @@ package types import ( "encoding/base64" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" + abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/encoding" ctypes "github.com/tendermint/tendermint/rpc/core/types" tmtypes "github.com/tendermint/tendermint/types" + + commoncodec "github.com/irisnet/core-sdk-go/common/codec" ) type Block struct { diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go index 89faf61d..2cec49fd 100644 --- a/core-sdk/types/config.go +++ b/core-sdk/types/config.go @@ -2,9 +2,10 @@ package types import ( "fmt" + "os" + "github.com/irisnet/core-sdk-go/common/crypto" "github.com/irisnet/core-sdk-go/types/store" - "os" ) const ( diff --git a/core-sdk/types/events.go b/core-sdk/types/events.go index 3086e1e6..7f5508df 100644 --- a/core-sdk/types/events.go +++ b/core-sdk/types/events.go @@ -2,9 +2,10 @@ package types import ( "fmt" - abci "github.com/tendermint/tendermint/abci/types" "sort" "strings" + + abci "github.com/tendermint/tendermint/abci/types" ) // ---------------------------------------------------------------------------- diff --git a/core-sdk/types/factory.go b/core-sdk/types/factory.go index 334ef47a..77210f39 100644 --- a/core-sdk/types/factory.go +++ b/core-sdk/types/factory.go @@ -3,6 +3,7 @@ package types import ( "errors" "fmt" + "github.com/irisnet/core-sdk-go/types/tx/signing" ) diff --git a/core-sdk/types/module.go b/core-sdk/types/module.go index f5817b23..7015eca6 100644 --- a/core-sdk/types/module.go +++ b/core-sdk/types/module.go @@ -1,8 +1,9 @@ package types import ( - codectypes "github.com/irisnet/core-sdk-go/common/codec/types" "github.com/tendermint/tendermint/crypto" + + codectypes "github.com/irisnet/core-sdk-go/common/codec/types" ) //The purpose of this interface is to convert the irishub system type to the user receiving type diff --git a/core-sdk/types/result.go b/core-sdk/types/result.go index 5c0c3784..8137b375 100644 --- a/core-sdk/types/result.go +++ b/core-sdk/types/result.go @@ -4,10 +4,11 @@ import ( "encoding/hex" "encoding/json" "fmt" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" "math" "strings" + commoncodec "github.com/irisnet/core-sdk-go/common/codec" + yaml "gopkg.in/yaml.v2" ctypes "github.com/tendermint/tendermint/rpc/core/types" diff --git a/core-sdk/types/stdtx.go b/core-sdk/types/stdtx.go index 0a19441b..db88cf84 100644 --- a/core-sdk/types/stdtx.go +++ b/core-sdk/types/stdtx.go @@ -4,6 +4,7 @@ import ( "encoding/json" "errors" "fmt" + commoncodec "github.com/irisnet/core-sdk-go/common/codec" ) diff --git a/core-sdk/types/store/codec.go b/core-sdk/types/store/codec.go index 0f7e6564..b90fbf69 100644 --- a/core-sdk/types/store/codec.go +++ b/core-sdk/types/store/codec.go @@ -1,10 +1,11 @@ package store import ( + "github.com/tendermint/tendermint/crypto" + "github.com/irisnet/core-sdk-go/common/codec" cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/common/crypto/hd" - "github.com/tendermint/tendermint/crypto" ) var cdc *codec.LegacyAmino diff --git a/core-sdk/types/store/types.go b/core-sdk/types/store/types.go index 5bd451a3..2f3c9d09 100644 --- a/core-sdk/types/store/types.go +++ b/core-sdk/types/store/types.go @@ -2,8 +2,10 @@ package store import ( "fmt" - "github.com/irisnet/core-sdk-go/common/crypto/hd" + "github.com/tendermint/tendermint/crypto" + + "github.com/irisnet/core-sdk-go/common/crypto/hd" ) var ( diff --git a/core-sdk/types/tm_types.go b/core-sdk/types/tm_types.go index 6fd1ae92..94982f56 100644 --- a/core-sdk/types/tm_types.go +++ b/core-sdk/types/tm_types.go @@ -2,13 +2,15 @@ package types import ( "encoding/hex" - cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" - "github.com/irisnet/core-sdk-go/types/kv" + "strings" + "github.com/tendermint/tendermint/crypto" tmbytes "github.com/tendermint/tendermint/libs/bytes" tmclient "github.com/tendermint/tendermint/rpc/client" tmtypes "github.com/tendermint/tendermint/types" - "strings" + + cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" + "github.com/irisnet/core-sdk-go/types/kv" ) type ( diff --git a/core-sdk/types/tx.go b/core-sdk/types/tx.go index 37341095..7bf8af33 100644 --- a/core-sdk/types/tx.go +++ b/core-sdk/types/tx.go @@ -1,8 +1,9 @@ package types import ( - commoncodec "github.com/irisnet/core-sdk-go/common/codec" "github.com/tendermint/tendermint/crypto" + + commoncodec "github.com/irisnet/core-sdk-go/common/codec" ) type ( diff --git a/core-sdk/types/tx/types.go b/core-sdk/types/tx/types.go index 91b4274e..033cf53a 100644 --- a/core-sdk/types/tx/types.go +++ b/core-sdk/types/tx/types.go @@ -3,6 +3,7 @@ package tx import ( "errors" "fmt" + "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" diff --git a/module-sdk/coinswap/coinswap.go b/module-sdk/coinswap/coinswap.go index 0b16aa7d..666065f7 100644 --- a/module-sdk/coinswap/coinswap.go +++ b/module-sdk/coinswap/coinswap.go @@ -4,10 +4,11 @@ import ( "context" "errors" "fmt" + "strings" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" - "strings" ) type coinswapClient struct { diff --git a/module-sdk/gov/export.go b/module-sdk/gov/export.go index c0b84b09..ac472914 100644 --- a/module-sdk/gov/export.go +++ b/module-sdk/gov/export.go @@ -1,8 +1,9 @@ package gov import ( - sdk "github.com/irisnet/core-sdk-go/types" "time" + + sdk "github.com/irisnet/core-sdk-go/types" ) // expose Gov module api for user diff --git a/module-sdk/gov/gov.go b/module-sdk/gov/gov.go index 26888fbf..273db909 100644 --- a/module-sdk/gov/gov.go +++ b/module-sdk/gov/gov.go @@ -2,11 +2,12 @@ package gov import ( "context" + "strconv" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/query" - "strconv" ) type govClient struct { diff --git a/module-sdk/gov/proposal.go b/module-sdk/gov/proposal.go index 6497d10e..68751338 100644 --- a/module-sdk/gov/proposal.go +++ b/module-sdk/gov/proposal.go @@ -2,12 +2,13 @@ package gov import ( "fmt" + "strings" + "time" + "github.com/gogo/protobuf/proto" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" yaml "gopkg.in/yaml.v2" - "strings" - "time" ) // DefaultStartingProposalID is 1 diff --git a/module-sdk/gov/types.go b/module-sdk/gov/types.go index c4486bf3..834e4383 100644 --- a/module-sdk/gov/types.go +++ b/module-sdk/gov/types.go @@ -2,6 +2,7 @@ package gov import ( "fmt" + "github.com/gogo/protobuf/proto" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" diff --git a/module-sdk/htlc/htlc.go b/module-sdk/htlc/htlc.go index 3cde1546..137cf10e 100644 --- a/module-sdk/htlc/htlc.go +++ b/module-sdk/htlc/htlc.go @@ -2,6 +2,7 @@ package htlc import ( "context" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" diff --git a/module-sdk/htlc/types.go b/module-sdk/htlc/types.go index 7bb895ee..c2844c0f 100644 --- a/module-sdk/htlc/types.go +++ b/module-sdk/htlc/types.go @@ -2,6 +2,7 @@ package htlc import ( "encoding/hex" + sdk "github.com/irisnet/core-sdk-go/types" ) diff --git a/module-sdk/integration_test/coinswap_test.go b/module-sdk/integration_test/coinswap_test.go index 19a48c66..ec7a26ba 100644 --- a/module-sdk/integration_test/coinswap_test.go +++ b/module-sdk/integration_test/coinswap_test.go @@ -1,11 +1,12 @@ package integrationtest import ( + "time" + "github.com/irisnet/coinswap-sdk-go" sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/token-sdk-go" "github.com/stretchr/testify/require" - "time" ) func (s IntegrationTestSuite) TestCoinSwap() { diff --git a/module-sdk/integration_test/gov_test.go b/module-sdk/integration_test/gov_test.go index 6fb5ca64..8c43f15d 100644 --- a/module-sdk/integration_test/gov_test.go +++ b/module-sdk/integration_test/gov_test.go @@ -3,6 +3,7 @@ package integrationtest import ( "encoding/json" "fmt" + "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/gov-sdk-go" "github.com/stretchr/testify/require" diff --git a/module-sdk/integration_test/htlc_test.go b/module-sdk/integration_test/htlc_test.go index 1af77b73..59cb9a08 100644 --- a/module-sdk/integration_test/htlc_test.go +++ b/module-sdk/integration_test/htlc_test.go @@ -4,6 +4,7 @@ import ( "encoding/hex" "encoding/json" "fmt" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/htlc-sdk-go" "github.com/stretchr/testify/require" diff --git a/module-sdk/integration_test/integration_test.go b/module-sdk/integration_test/integration_test.go index 070ddf8a..78a049d8 100644 --- a/module-sdk/integration_test/integration_test.go +++ b/module-sdk/integration_test/integration_test.go @@ -1,16 +1,17 @@ package integrationtest import ( - "github.com/irisnet/core-sdk-go/common/log" - "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/store" - "github.com/stretchr/testify/suite" "io/ioutil" "math/rand" "os" "path/filepath" "testing" "time" + + "github.com/irisnet/core-sdk-go/common/log" + "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/core-sdk-go/types/store" + "github.com/stretchr/testify/suite" ) const ( diff --git a/module-sdk/integration_test/nft_test.go b/module-sdk/integration_test/nft_test.go index ce67b01e..958419eb 100644 --- a/module-sdk/integration_test/nft_test.go +++ b/module-sdk/integration_test/nft_test.go @@ -2,10 +2,11 @@ package integrationtest import ( "fmt" + "strings" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/nft-sdk-go" "github.com/stretchr/testify/require" - "strings" ) func (s IntegrationTestSuite) TestNFT() { diff --git a/module-sdk/integration_test/oracle_test.go b/module-sdk/integration_test/oracle_test.go index d5ee0ee4..e422ee3d 100644 --- a/module-sdk/integration_test/oracle_test.go +++ b/module-sdk/integration_test/oracle_test.go @@ -2,11 +2,12 @@ package integrationtest import ( "fmt" + "time" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/oracle-sdk-go" "github.com/irisnet/service-sdk-go" "github.com/stretchr/testify/require" - "time" ) var serviceName = generateServiceName() diff --git a/module-sdk/integration_test/random_test.go b/module-sdk/integration_test/random_test.go index bf000e55..39da8d35 100644 --- a/module-sdk/integration_test/random_test.go +++ b/module-sdk/integration_test/random_test.go @@ -1,10 +1,11 @@ package integrationtest import ( - "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/random-sdk-go" "strconv" "time" + + "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/random-sdk-go" ) type TestRandom struct { diff --git a/module-sdk/integration_test/record_test.go b/module-sdk/integration_test/record_test.go index 43ca067f..e6029f5b 100644 --- a/module-sdk/integration_test/record_test.go +++ b/module-sdk/integration_test/record_test.go @@ -2,6 +2,7 @@ package integrationtest import ( "fmt" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/record-sdk-go" "github.com/stretchr/testify/require" diff --git a/module-sdk/integration_test/service_test.go b/module-sdk/integration_test/service_test.go index 93b90d5d..69865508 100644 --- a/module-sdk/integration_test/service_test.go +++ b/module-sdk/integration_test/service_test.go @@ -1,11 +1,12 @@ package integrationtest import ( + "time" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/query" "github.com/irisnet/service-sdk-go" "github.com/stretchr/testify/require" - "time" ) func (s IntegrationTestSuite) TestService() { diff --git a/module-sdk/integration_test/staking_test.go b/module-sdk/integration_test/staking_test.go index cde4917b..49ae6913 100644 --- a/module-sdk/integration_test/staking_test.go +++ b/module-sdk/integration_test/staking_test.go @@ -2,6 +2,7 @@ package integrationtest import ( "context" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/staking-sdk-go" "github.com/stretchr/testify/require" diff --git a/module-sdk/integration_test/token_test.go b/module-sdk/integration_test/token_test.go index d2f04760..ebc8d144 100644 --- a/module-sdk/integration_test/token_test.go +++ b/module-sdk/integration_test/token_test.go @@ -1,10 +1,11 @@ package integrationtest import ( + "strings" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/token-sdk-go" "github.com/stretchr/testify/require" - "strings" ) func (s IntegrationTestSuite) TestToken() { diff --git a/module-sdk/nft/nft.go b/module-sdk/nft/nft.go index d9ae1efd..992bd4f5 100644 --- a/module-sdk/nft/nft.go +++ b/module-sdk/nft/nft.go @@ -2,6 +2,7 @@ package nft import ( "context" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" diff --git a/module-sdk/nft/types.go b/module-sdk/nft/types.go index ebda11b4..c837d9d7 100644 --- a/module-sdk/nft/types.go +++ b/module-sdk/nft/types.go @@ -1,8 +1,9 @@ package nft import ( - sdk "github.com/irisnet/core-sdk-go/types" "strings" + + sdk "github.com/irisnet/core-sdk-go/types" ) const ( diff --git a/module-sdk/oracle/export.go b/module-sdk/oracle/export.go index 3e13ed89..cda347c3 100644 --- a/module-sdk/oracle/export.go +++ b/module-sdk/oracle/export.go @@ -1,8 +1,9 @@ package oracle import ( - sdk "github.com/irisnet/core-sdk-go/types" "time" + + sdk "github.com/irisnet/core-sdk-go/types" ) // expose Oracle module api for user diff --git a/module-sdk/oracle/oracle.go b/module-sdk/oracle/oracle.go index 6fb3058e..2594d82d 100644 --- a/module-sdk/oracle/oracle.go +++ b/module-sdk/oracle/oracle.go @@ -2,6 +2,7 @@ package oracle import ( "context" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" diff --git a/module-sdk/oracle/types.go b/module-sdk/oracle/types.go index ee3bb12d..aab13a56 100644 --- a/module-sdk/oracle/types.go +++ b/module-sdk/oracle/types.go @@ -3,9 +3,10 @@ package oracle import ( "bytes" "fmt" - sdk "github.com/irisnet/core-sdk-go/types" "regexp" "strings" + + sdk "github.com/irisnet/core-sdk-go/types" ) const ( diff --git a/module-sdk/random/random.go b/module-sdk/random/random.go index ce6e1e15..f882c55c 100644 --- a/module-sdk/random/random.go +++ b/module-sdk/random/random.go @@ -2,10 +2,11 @@ package random import ( "context" + "strconv" + "github.com/irisnet/core-sdk-go/common/codec" cdctypes "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" - "strconv" ) type randomClient struct { diff --git a/module-sdk/record/record.go b/module-sdk/record/record.go index 2a013256..fa0ad2e0 100644 --- a/module-sdk/record/record.go +++ b/module-sdk/record/record.go @@ -2,6 +2,7 @@ package record import ( "encoding/hex" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" diff --git a/module-sdk/record/types.go b/module-sdk/record/types.go index 68044e57..48592886 100644 --- a/module-sdk/record/types.go +++ b/module-sdk/record/types.go @@ -2,6 +2,7 @@ package record import ( "fmt" + sdk "github.com/irisnet/core-sdk-go/types" ) diff --git a/module-sdk/service/export.go b/module-sdk/service/export.go index e66d11ff..f56f7105 100644 --- a/module-sdk/service/export.go +++ b/module-sdk/service/export.go @@ -1,9 +1,10 @@ package service import ( + "time" + sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/query" - "time" ) // Tx defines a set of transaction interfaces in the service module diff --git a/module-sdk/service/query.go b/module-sdk/service/query.go index 4bee8b27..bdf391a4 100644 --- a/module-sdk/service/query.go +++ b/module-sdk/service/query.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + sdk "github.com/irisnet/core-sdk-go/types" ) diff --git a/module-sdk/service/service.go b/module-sdk/service/service.go index c26e3877..e4bd768d 100644 --- a/module-sdk/service/service.go +++ b/module-sdk/service/service.go @@ -3,11 +3,12 @@ package service import ( "context" "encoding/json" + "strings" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/query" - "strings" ) type serviceClient struct { diff --git a/module-sdk/service/types.go b/module-sdk/service/types.go index f0ceee17..f185e40d 100644 --- a/module-sdk/service/types.go +++ b/module-sdk/service/types.go @@ -4,8 +4,9 @@ import ( json2 "encoding/json" "errors" "fmt" - sdk "github.com/irisnet/core-sdk-go/types" "strings" + + sdk "github.com/irisnet/core-sdk-go/types" ) const ( diff --git a/module-sdk/staking/delegation.go b/module-sdk/staking/delegation.go index 2c976b2b..1342053c 100644 --- a/module-sdk/staking/delegation.go +++ b/module-sdk/staking/delegation.go @@ -3,11 +3,12 @@ package staking import ( "encoding/json" "fmt" + "strings" + "time" + "github.com/irisnet/core-sdk-go/common/codec" sdk "github.com/irisnet/core-sdk-go/types" yaml "gopkg.in/yaml.v2" - "strings" - "time" ) // Implements Delegation interface diff --git a/module-sdk/staking/export.go b/module-sdk/staking/export.go index ffc25b54..3b4e549c 100644 --- a/module-sdk/staking/export.go +++ b/module-sdk/staking/export.go @@ -1,8 +1,9 @@ package staking import ( - sdk "github.com/irisnet/core-sdk-go/types" "time" + + sdk "github.com/irisnet/core-sdk-go/types" ) // expose Staking module api for user diff --git a/module-sdk/staking/staking.go b/module-sdk/staking/staking.go index 238a3d13..53014bb0 100644 --- a/module-sdk/staking/staking.go +++ b/module-sdk/staking/staking.go @@ -2,6 +2,7 @@ package staking import ( "context" + "github.com/irisnet/core-sdk-go/common" "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" diff --git a/module-sdk/staking/types.go b/module-sdk/staking/types.go index dcfa3b1f..6b169092 100644 --- a/module-sdk/staking/types.go +++ b/module-sdk/staking/types.go @@ -2,6 +2,7 @@ package staking import ( "bytes" + "github.com/irisnet/core-sdk-go/common/codec" codectypes "github.com/irisnet/core-sdk-go/common/codec/types" crypto "github.com/irisnet/core-sdk-go/common/crypto/types" diff --git a/module-sdk/token/token.go b/module-sdk/token/token.go index 820c358f..8869d7e1 100644 --- a/module-sdk/token/token.go +++ b/module-sdk/token/token.go @@ -5,10 +5,11 @@ package token import ( "context" + "strconv" + "github.com/irisnet/core-sdk-go/common/codec" "github.com/irisnet/core-sdk-go/common/codec/types" sdk "github.com/irisnet/core-sdk-go/types" - "strconv" ) type tokenClient struct { diff --git a/module-sdk/token/types.go b/module-sdk/token/types.go index a5c9555c..69f8eb96 100644 --- a/module-sdk/token/types.go +++ b/module-sdk/token/types.go @@ -3,8 +3,9 @@ package token import ( json2 "encoding/json" "errors" - sdk "github.com/irisnet/core-sdk-go/types" "strconv" + + sdk "github.com/irisnet/core-sdk-go/types" ) const ( From 78554d1e8a9f43b3713aa6853c35458e5483faf0 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 11:10:58 +0800 Subject: [PATCH 16/41] fix TestUnit.yml --- .github/workflows/TestUnit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestUnit.yml b/.github/workflows/TestUnit.yml index e3ea4e1f..a5034bff 100644 --- a/.github/workflows/TestUnit.yml +++ b/.github/workflows/TestUnit.yml @@ -9,4 +9,4 @@ jobs: - name: Checkout source code uses: actions/checkout@v1 - name: Run unit tests - run: sudo sh -c "make test-integration" + run: sudo sh -c "make test-unit" From aed2681d35a98b3af8cae488932fb8db7df4da41 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 11:37:13 +0800 Subject: [PATCH 17/41] fix TestUnit --- .github/workflows/TestUnit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestUnit.yml b/.github/workflows/TestUnit.yml index a5034bff..e3ea4e1f 100644 --- a/.github/workflows/TestUnit.yml +++ b/.github/workflows/TestUnit.yml @@ -9,4 +9,4 @@ jobs: - name: Checkout source code uses: actions/checkout@v1 - name: Run unit tests - run: sudo sh -c "make test-unit" + run: sudo sh -c "make test-integration" From dab5bcf5da400e0eaf1132d5e4c3ad309c8a50b1 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 11:43:00 +0800 Subject: [PATCH 18/41] delete module unused proto --- .../proto/cosmos/auth/v1beta1/auth.proto | 49 ----- .../proto/cosmos/auth/v1beta1/query.proto | 47 ----- .../proto/cosmos/bank/v1beta1/bank.proto | 85 -------- .../proto/cosmos/bank/v1beta1/query.proto | 111 ----------- module-sdk/proto/cosmos/bank/v1beta1/tx.proto | 27 --- .../proto/cosmos/base/abci/v1beta1/abci.proto | 137 ------------- .../proto/cosmos/base/kv/v1beta1/kv.proto | 17 -- .../base/query/v1beta1/pagination.proto | 50 ----- .../proto/cosmos/base/v1beta1/coin.proto | 40 ---- .../proto/cosmos/crypto/ed25519/keys.proto | 22 --- .../proto/cosmos/crypto/multisig/keys.proto | 18 -- .../crypto/multisig/v1beta1/multisig.proto | 25 --- .../proto/cosmos/crypto/secp256k1/keys.proto | 22 --- .../cosmos/tx/signing/v1beta1/signing.proto | 79 -------- module-sdk/proto/cosmos/tx/v1beta1/tx.proto | 182 ------------------ 15 files changed, 911 deletions(-) delete mode 100644 module-sdk/proto/cosmos/auth/v1beta1/auth.proto delete mode 100644 module-sdk/proto/cosmos/auth/v1beta1/query.proto delete mode 100644 module-sdk/proto/cosmos/bank/v1beta1/bank.proto delete mode 100644 module-sdk/proto/cosmos/bank/v1beta1/query.proto delete mode 100644 module-sdk/proto/cosmos/bank/v1beta1/tx.proto delete mode 100644 module-sdk/proto/cosmos/base/abci/v1beta1/abci.proto delete mode 100644 module-sdk/proto/cosmos/base/kv/v1beta1/kv.proto delete mode 100644 module-sdk/proto/cosmos/base/query/v1beta1/pagination.proto delete mode 100644 module-sdk/proto/cosmos/base/v1beta1/coin.proto delete mode 100644 module-sdk/proto/cosmos/crypto/ed25519/keys.proto delete mode 100644 module-sdk/proto/cosmos/crypto/multisig/keys.proto delete mode 100644 module-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto delete mode 100644 module-sdk/proto/cosmos/crypto/secp256k1/keys.proto delete mode 100644 module-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto delete mode 100644 module-sdk/proto/cosmos/tx/v1beta1/tx.proto diff --git a/module-sdk/proto/cosmos/auth/v1beta1/auth.proto b/module-sdk/proto/cosmos/auth/v1beta1/auth.proto deleted file mode 100644 index 78dff78c..00000000 --- a/module-sdk/proto/cosmos/auth/v1beta1/auth.proto +++ /dev/null @@ -1,49 +0,0 @@ -syntax = "proto3"; -package cosmos.auth.v1beta1; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/modules/auth"; - -// BaseAccount defines a base account type. It contains all the necessary fields -// for basic account functionality. Any custom account type should extend this -// type for additional functionality (e.g. vesting). -message BaseAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = false; - - option (cosmos_proto.implements_interface) = "AccountI"; - - string address = 1; - google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; - uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""]; - uint64 sequence = 4; -} - -// ModuleAccount defines an account for modules that holds coins on a pool. -message ModuleAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (cosmos_proto.implements_interface) = "ModuleAccountI"; - - BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; - string name = 2; - repeated string permissions = 3; -} - -// Params defines the parameters for the auth module. -message Params { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - - uint64 max_memo_characters = 1 [(gogoproto.moretags) = "yaml:\"max_memo_characters\""]; - uint64 tx_sig_limit = 2 [(gogoproto.moretags) = "yaml:\"tx_sig_limit\""]; - uint64 tx_size_cost_per_byte = 3 [(gogoproto.moretags) = "yaml:\"tx_size_cost_per_byte\""]; - uint64 sig_verify_cost_ed25519 = 4 - [(gogoproto.customname) = "SigVerifyCostED25519", (gogoproto.moretags) = "yaml:\"sig_verify_cost_ed25519\""]; - uint64 sig_verify_cost_secp256k1 = 5 - [(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""]; -} diff --git a/module-sdk/proto/cosmos/auth/v1beta1/query.proto b/module-sdk/proto/cosmos/auth/v1beta1/query.proto deleted file mode 100644 index 51c169b0..00000000 --- a/module-sdk/proto/cosmos/auth/v1beta1/query.proto +++ /dev/null @@ -1,47 +0,0 @@ -syntax = "proto3"; -package cosmos.auth.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "google/api/annotations.proto"; -import "cosmos/auth/v1beta1/auth.proto"; -import "cosmos_proto/cosmos.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/modules/auth"; - -// Query defines the gRPC querier service. -service Query { - // Account returns account details based on address. - rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}"; - } - - // Params queries all parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/params"; - } -} - -// QueryAccountRequest is the request type for the Query/Account RPC method. -message QueryAccountRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address defines the address to query for. - string address = 1; -} - -// QueryAccountResponse is the response type for the Query/Account RPC method. -message QueryAccountResponse { - // account defines the account of the corresponding address. - google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; -} - -// 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 defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/module-sdk/proto/cosmos/bank/v1beta1/bank.proto b/module-sdk/proto/cosmos/bank/v1beta1/bank.proto deleted file mode 100644 index b90ead51..00000000 --- a/module-sdk/proto/cosmos/bank/v1beta1/bank.proto +++ /dev/null @@ -1,85 +0,0 @@ -syntax = "proto3"; -package cosmos.bank.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/modules/bank"; - -// Params defines the parameters for the bank module. -message Params { - option (gogoproto.goproto_stringer) = false; - repeated SendEnabled send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled,omitempty\""]; - bool default_send_enabled = 2 [(gogoproto.moretags) = "yaml:\"default_send_enabled,omitempty\""]; -} - -// SendEnabled maps coin denom to a send_enabled status (whether a denom is -// sendable). -message SendEnabled { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - string denom = 1; - bool enabled = 2; -} - -// Input models transaction input. -message Input { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string address = 1; - repeated cosmos.base.v1beta1.Coin coins = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/irishub-sdk-go/types.Coins"]; -} - -// Output models transaction outputs. -message Output { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string address = 1; - repeated cosmos.base.v1beta1.Coin coins = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/irishub-sdk-go/types.Coins"]; -} - -// Supply represents a struct that passively keeps track of the total supply -// amounts in the network. -message Supply { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - option (cosmos_proto.implements_interface) = "*github.com/irisnet/irishub-sdk-go/modules/bank/exported.SupplyI"; - - repeated cosmos.base.v1beta1.Coin total = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/irishub-sdk-go/types.Coins"]; -} - -// DenomUnit represents a struct that describes a given -// denomination unit of the basic token. -message DenomUnit { - // denom represents the string name of the given denom unit (e.g uatom). - string denom = 1; - // exponent represents power of 10 exponent that one must - // raise the base_denom to in order to equal the given DenomUnit's denom - // 1 denom = 1^exponent base_denom - // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - // exponent = 6, thus: 1 atom = 10^6 uatom). - uint32 exponent = 2; - // aliases is a list of string aliases for the given denom - repeated string aliases = 3; -} - -// Metadata represents a struct that describes -// a basic token. -message Metadata { - string description = 1; - // denom_units represents the list of DenomUnit's for a given coin - repeated DenomUnit denom_units = 2; - // base represents the base denom (should be the DenomUnit with exponent = 0). - string base = 3; - // display indicates the suggested denom that should be - // displayed in clients. - string display = 4; -} diff --git a/module-sdk/proto/cosmos/bank/v1beta1/query.proto b/module-sdk/proto/cosmos/bank/v1beta1/query.proto deleted file mode 100644 index 2d1ad63b..00000000 --- a/module-sdk/proto/cosmos/bank/v1beta1/query.proto +++ /dev/null @@ -1,111 +0,0 @@ -syntax = "proto3"; -package cosmos.bank.v1beta1; - -import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/bank/v1beta1/bank.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/modules/bank"; - -// Query defines the gRPC querier service. -service Query { - // Balance queries the balance of a single coin for a single account. - rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/{denom}"; - } - - // AllBalances queries the balance of all coins for a single account. - rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; - } - - // TotalSupply queries the total supply of all coins. - rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; - } - - // SupplyOf queries the supply of a single coin. - rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply/{denom}"; - } - - // Params queries the parameters of x/bank module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/params"; - } -} - -// QueryBalanceRequest is the request type for the Query/Balance RPC method. -message QueryBalanceRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the address to query balances for. - string address = 1; - - // denom is the coin denom to query balances for. - string denom = 2; -} - -// QueryBalanceResponse is the response type for the Query/Balance RPC method. -message QueryBalanceResponse { - // balance is the balance of the coin. - cosmos.base.v1beta1.Coin balance = 1; -} - -// QueryBalanceRequest is the request type for the Query/AllBalances RPC method. -message QueryAllBalancesRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the address to query balances for. - string address = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} - -// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC -// method. -message QueryAllBalancesResponse { - // balances is the balances of all the coins. - repeated cosmos.base.v1beta1.Coin balances = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/irishub-sdk-go/types.Coins"]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC -// method. -message QueryTotalSupplyRequest {} - -// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC -// method -message QueryTotalSupplyResponse { - // supply is the supply of the coins - repeated cosmos.base.v1beta1.Coin supply = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/irishub-sdk-go/types.Coins"]; -} - -// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. -message QuerySupplyOfRequest { - // denom is the coin denom to query balances for. - string denom = 1; -} - -// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. -message QuerySupplyOfResponse { - // amount is the supply of the coin. - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; -} - -// QueryParamsRequest defines the request type for querying x/bank parameters. -message QueryParamsRequest {} - -// QueryParamsResponse defines the response type for querying x/bank parameters. -message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/module-sdk/proto/cosmos/bank/v1beta1/tx.proto b/module-sdk/proto/cosmos/bank/v1beta1/tx.proto deleted file mode 100644 index 7eed8c1d..00000000 --- a/module-sdk/proto/cosmos/bank/v1beta1/tx.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; -package cosmos.bank.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/bank/v1beta1/bank.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/modules/bank"; - -// MsgSend represents a message to send coins from one account to another. -message MsgSend { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; - string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/irishub-sdk-go/types.Coins"]; -} - -// MsgMultiSend represents an arbitrary multi-in, multi-out send message. -message MsgMultiSend { - option (gogoproto.equal) = false; - - repeated Input inputs = 1 [(gogoproto.nullable) = false]; - repeated Output outputs = 2 [(gogoproto.nullable) = false]; -} diff --git a/module-sdk/proto/cosmos/base/abci/v1beta1/abci.proto b/module-sdk/proto/cosmos/base/abci/v1beta1/abci.proto deleted file mode 100644 index 4ca3ad57..00000000 --- a/module-sdk/proto/cosmos/base/abci/v1beta1/abci.proto +++ /dev/null @@ -1,137 +0,0 @@ -syntax = "proto3"; -package cosmos.base.abci.v1beta1; - -import "gogoproto/gogo.proto"; -import "tendermint/abci/types.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/types"; -option (gogoproto.goproto_stringer_all) = false; - -// TxResponse defines a structure containing relevant tx data and metadata. The -// tags are stringified and the log is JSON decoded. -message TxResponse { - option (gogoproto.goproto_getters) = false; - // The block height - int64 height = 1; - // The transaction hash. - string txhash = 2 [(gogoproto.customname) = "TxHash"]; - // Namespace for the Code - string codespace = 3; - // Response code. - uint32 code = 4; - // Result bytes, if any. - string data = 5; - // The output of the application's logger (raw string). May be - // non-deterministic. - string raw_log = 6; - // The output of the application's logger (typed). May be non-deterministic. - repeated ABCIMessageLog logs = 7 [(gogoproto.castrepeated) = "ABCIMessageLogs", (gogoproto.nullable) = false]; - // Additional information. May be non-deterministic. - string info = 8; - // Amount of gas requested for transaction. - int64 gas_wanted = 9; - // Amount of gas consumed by transaction. - int64 gas_used = 10; - // The request transaction bytes. - google.protobuf.Any tx = 11; - // Time of the previous block. For heights > 1, it's the weighted median of - // the timestamps of the valid votes in the block.LastCommit. For height == 1, - // it's genesis time. - string timestamp = 12; -} - -// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. -message ABCIMessageLog { - option (gogoproto.stringer) = true; - - uint32 msg_index = 1; - string log = 2; - - // Events contains a slice of Event objects that were emitted during some - // execution. - repeated StringEvent events = 3 [(gogoproto.castrepeated) = "StringEvents", (gogoproto.nullable) = false]; -} - -// StringEvent defines en Event object wrapper where all the attributes -// contain key/value pairs that are strings instead of raw bytes. -message StringEvent { - option (gogoproto.stringer) = true; - - string type = 1; - repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; -} - -// Attribute defines an attribute wrapper where the key and value are -// strings instead of raw bytes. -message Attribute { - string key = 1; - string value = 2; -} - -// GasInfo defines tx execution gas context. -message GasInfo { - // GasWanted is the maximum units of work we allow this tx to perform. - uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""]; - - // GasUsed is the amount of gas actually consumed. - uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""]; -} - -// Result is the union of ResponseFormat and ResponseCheckTx. -message Result { - option (gogoproto.goproto_getters) = false; - - // Data is any data returned from message or handler execution. It MUST be - // length prefixed in order to separate data from multiple message executions. - bytes data = 1; - - // Log contains the log information from message or handler execution. - string log = 2; - - // Events contains a slice of Event objects that were emitted during message - // or handler execution. - repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false]; -} - -// SimulationResponse defines the response generated when a transaction is -// successfully simulated. -message SimulationResponse { - GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Result result = 2; -} - -// MsgData defines the data returned in a Result object during message -// execution. -message MsgData { - option (gogoproto.stringer) = true; - - string msg_type = 1; - bytes data = 2; -} - -// TxMsgData defines a list of MsgData. A transaction will have a MsgData object -// for each message. -message TxMsgData { - option (gogoproto.stringer) = true; - - repeated MsgData data = 1; -} - -// SearchTxsResult defines a structure for querying txs pageable -message SearchTxsResult { - option (gogoproto.stringer) = true; - - // Count of all txs - uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"]; - // Count of txs in current page - uint64 count = 2; - // Index of current page, start from 1 - uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"]; - // Count of total pages - uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"]; - // Max count txs per page - uint64 limit = 5; - // List of txs in current page - repeated TxResponse txs = 6; -} diff --git a/module-sdk/proto/cosmos/base/kv/v1beta1/kv.proto b/module-sdk/proto/cosmos/base/kv/v1beta1/kv.proto deleted file mode 100644 index 27d3e3cc..00000000 --- a/module-sdk/proto/cosmos/base/kv/v1beta1/kv.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package cosmos.base.kv.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/types/kv"; - -// Pairs defines a repeated slice of Pair objects. -message Pairs { - repeated Pair pairs = 1 [(gogoproto.nullable) = false]; -} - -// Pair defines a key/value bytes tuple. -message Pair { - bytes key = 1; - bytes value = 2; -} diff --git a/module-sdk/proto/cosmos/base/query/v1beta1/pagination.proto b/module-sdk/proto/cosmos/base/query/v1beta1/pagination.proto deleted file mode 100644 index 0056a429..00000000 --- a/module-sdk/proto/cosmos/base/query/v1beta1/pagination.proto +++ /dev/null @@ -1,50 +0,0 @@ -syntax = "proto3"; -package cosmos.base.query.v1beta1; - -option go_package = "github.com/irisnet/irishub-sdk-go/types/query"; - -// PageRequest is to be embedded in gRPC request messages for efficient -// pagination. Ex: -// -// message SomeRequest { -// Foo some_parameter = 1; -// PageRequest pagination = 2; -// } -message PageRequest { - // key is a value returned in PageResponse.next_key to begin - // querying the next page most efficiently. Only one of offset or key - // should be set. - bytes key = 1; - - // offset is a numeric offset that can be used when key is unavailable. - // It is less efficient than using key. Only one of offset or key should - // be set. - uint64 offset = 2; - - // limit is the total number of results to be returned in the result page. - // If left empty it will default to a value to be set by each app. - uint64 limit = 3; - - // count_total is set to true to indicate that the result set should include - // a count of the total number of items available for pagination in UIs. - // count_total is only respected when offset is used. It is ignored when key - // is set. - bool count_total = 4; -} - -// PageResponse is to be embedded in gRPC response messages where the -// corresponding request message has used PageRequest. -// -// message SomeResponse { -// repeated Bar results = 1; -// PageResponse page = 2; -// } -message PageResponse { - // next_key is the key to be passed to PageRequest.key to - // query the next page most efficiently - bytes next_key = 1; - - // total is total number of results available if PageRequest.count_total - // was set, its value is undefined otherwise - uint64 total = 2; -} diff --git a/module-sdk/proto/cosmos/base/v1beta1/coin.proto b/module-sdk/proto/cosmos/base/v1beta1/coin.proto deleted file mode 100644 index 802f5857..00000000 --- a/module-sdk/proto/cosmos/base/v1beta1/coin.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; -package cosmos.base.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/types"; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = false; - -// Coin defines a token with a denomination and an amount. -// -// NOTE: The amount field is an Int which implements the custom method -// signatures required by gogoproto. -message Coin { - option (gogoproto.equal) = true; - - string denom = 1; - string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; -} - -// DecCoin defines a token with a denomination and a decimal amount. -// -// NOTE: The amount field is an Dec which implements the custom method -// signatures required by gogoproto. -message DecCoin { - option (gogoproto.equal) = true; - - string denom = 1; - string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; -} - -// IntProto defines a Protobuf wrapper around an Int object. -message IntProto { - string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; -} - -// DecProto defines a Protobuf wrapper around a Dec object. -message DecProto { - string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; -} diff --git a/module-sdk/proto/cosmos/crypto/ed25519/keys.proto b/module-sdk/proto/cosmos/crypto/ed25519/keys.proto deleted file mode 100644 index a26a6a53..00000000 --- a/module-sdk/proto/cosmos/crypto/ed25519/keys.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.ed25519; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/crypto/keys/ed25519"; - -// PubKey defines a ed25519 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -message PubKey { - option (gogoproto.goproto_stringer) = false; - - bytes key = 1; -} - -// PrivKey defines a ed25519 private key. -message PrivKey { - bytes key = 1; -} diff --git a/module-sdk/proto/cosmos/crypto/multisig/keys.proto b/module-sdk/proto/cosmos/crypto/multisig/keys.proto deleted file mode 100644 index 5a7c880c..00000000 --- a/module-sdk/proto/cosmos/crypto/multisig/keys.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.multisig; - -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/crypto/keys/multisig"; - -// LegacyAminoPubKey specifies a public key type -// which nests multiple public keys and a threshold, -// it uses legacy amino address rules. -message LegacyAminoPubKey { - option (gogoproto.goproto_getters) = false; - - uint32 threshold = 1 [(gogoproto.moretags) = "yaml:\"threshold\""]; - repeated google.protobuf.Any public_keys = 2 - [(gogoproto.customname) = "PubKeys", (gogoproto.moretags) = "yaml:\"pubkeys\""]; -} diff --git a/module-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto b/module-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto deleted file mode 100644 index 1d10f1c8..00000000 --- a/module-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.multisig.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/crypto/types"; - -// MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. -// See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers -// signed and with which modes. -message MultiSignature { - option (gogoproto.goproto_unrecognized) = true; - repeated bytes signatures = 1; -} - -// CompactBitArray is an implementation of a space efficient bit array. -// This is used to ensure that the encoded data takes up a minimal amount of -// space after proto encoding. -// This is not thread safe, and is not intended for concurrent usage. -message CompactBitArray { - option (gogoproto.goproto_stringer) = false; - - uint32 extra_bits_stored = 1; - bytes elems = 2; -} diff --git a/module-sdk/proto/cosmos/crypto/secp256k1/keys.proto b/module-sdk/proto/cosmos/crypto/secp256k1/keys.proto deleted file mode 100644 index d0589791..00000000 --- a/module-sdk/proto/cosmos/crypto/secp256k1/keys.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.secp256k1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/crypto/keys/secp256k1"; - -// PubKey defines a secp256k1 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -message PubKey { - option (gogoproto.goproto_stringer) = false; - - bytes key = 1; -} - -// PrivKey defines a secp256k1 private key. -message PrivKey { - bytes key = 1; -} diff --git a/module-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto b/module-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto deleted file mode 100644 index ad38f18a..00000000 --- a/module-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto +++ /dev/null @@ -1,79 +0,0 @@ -syntax = "proto3"; -package cosmos.tx.signing.v1beta1; - -import "cosmos/crypto/multisig/v1beta1/multisig.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/types/tx/signing"; - -// SignMode represents a signing mode with its own security guarantees. -enum SignMode { - // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - // rejected - SIGN_MODE_UNSPECIFIED = 0; - - // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - // verified with raw bytes from Tx - SIGN_MODE_DIRECT = 1; - - // SIGN_MODE_TEXTUAL is a future signing mode that will verify some - // human-readable textual representation on top of the binary representation - // from SIGN_MODE_DIRECT - SIGN_MODE_TEXTUAL = 2; - - // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - // Amino JSON and will be removed in the future - SIGN_MODE_LEGACY_AMINO_JSON = 127; -} - -// SignatureDescriptors wraps multiple SignatureDescriptor's. -message SignatureDescriptors { - // signatures are the signature descriptors - repeated SignatureDescriptor signatures = 1; -} - -// SignatureDescriptor is a convenience type which represents the full data for -// a signature including the public key of the signer, signing modes and the -// signature itself. It is primarily used for coordinating signatures between -// clients. -message SignatureDescriptor { - // public_key is the public key of the signer - google.protobuf.Any public_key = 1; - - Data data = 2; - - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. - uint64 sequence = 3; - - // Data represents signature data - message Data { - // sum is the oneof that specifies whether this represents single or multi-signature data - oneof sum { - // single represents a single signer - Single single = 1; - - // multi represents a multisig signer - Multi multi = 2; - } - - // Single is the signature data for a single signer - message Single { - // mode is the signing mode of the single signer - SignMode mode = 1; - - // signature is the raw signature bytes - bytes signature = 2; - } - - // Multi is the signature data for a multisig public key - message Multi { - // bitarray specifies which keys within the multisig are signing - cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; - - // signatures is the signatures of the multi-signature - repeated Data signatures = 2; - } - } -} diff --git a/module-sdk/proto/cosmos/tx/v1beta1/tx.proto b/module-sdk/proto/cosmos/tx/v1beta1/tx.proto deleted file mode 100644 index 9b3391fe..00000000 --- a/module-sdk/proto/cosmos/tx/v1beta1/tx.proto +++ /dev/null @@ -1,182 +0,0 @@ -syntax = "proto3"; -package cosmos.tx.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/crypto/multisig/v1beta1/multisig.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/tx/signing/v1beta1/signing.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/irishub-sdk-go/types/tx"; - -// Tx is the standard type used for broadcasting transactions. -message Tx { - // body is the processable content of the transaction - TxBody body = 1; - - // auth_info is the authorization related content of the transaction, - // specifically signers, signer modes and fee - AuthInfo auth_info = 2; - - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - repeated bytes signatures = 3; -} - -// TxRaw is a variant of Tx that pins the signer's exact binary representation -// of body and auth_info. This is used for signing, broadcasting and -// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and -// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used -// as the transaction ID. -message TxRaw { - // body_bytes is a protobuf serialization of a TxBody that matches the - // representation in SignDoc. - bytes body_bytes = 1; - - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in SignDoc. - bytes auth_info_bytes = 2; - - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - repeated bytes signatures = 3; -} - -// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. -message SignDoc { - // body_bytes is protobuf serialization of a TxBody that matches the - // representation in TxRaw. - bytes body_bytes = 1; - - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in TxRaw. - bytes auth_info_bytes = 2; - - // chain_id is the unique identifier of the chain this transaction targets. - // It prevents signed transactions from being used on another chain by an - // attacker - string chain_id = 3; - - // account_number is the account number of the account in state - uint64 account_number = 4; -} - -// TxBody is the body of a transaction that all signers sign over. -message TxBody { - // messages is a list of messages to be executed. The required signers of - // those messages define the number and order of elements in AuthInfo's - // signer_infos and Tx's signatures. Each required signer address is added to - // the list only the first time it occurs. - // - // By convention, the first required signer (usually from the first message) - // is referred to as the primary signer and pays the fee for the whole - // transaction. - repeated google.protobuf.Any messages = 1; - - // memo is any arbitrary memo to be added to the transaction - string memo = 2; - - // timeout is the block height after which this transaction will not - // be processed by the chain - uint64 timeout_height = 3; - - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, the transaction will be rejected - repeated google.protobuf.Any extension_options = 1023; - - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, they will be ignored - repeated google.protobuf.Any non_critical_extension_options = 2047; -} - -// AuthInfo describes the fee and signer modes that are used to sign a -// transaction. -message AuthInfo { - // signer_infos defines the signing modes for the required signers. The number - // and order of elements must match the required signers from TxBody's - // messages. The first element is the primary signer and the one which pays - // the fee. - repeated SignerInfo signer_infos = 1; - - // Fee is the fee and gas limit for the transaction. The first signer is the - // primary signer and the one which pays the fee. The fee can be calculated - // based on the cost of evaluating the body and doing signature verification - // of the signers. This can be estimated via simulation. - Fee fee = 2; -} - -// SignerInfo describes the public key and signing mode of a single top-level -// signer. -message SignerInfo { - // public_key is the public key of the signer. It is optional for accounts - // that already exist in state. If unset, the verifier can use the required \ - // signer address for this position and lookup the public key. - google.protobuf.Any public_key = 1; - - // mode_info describes the signing mode of the signer and is a nested - // structure to support nested multisig pubkey's - ModeInfo mode_info = 2; - - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to - // prevent replay attacks. - uint64 sequence = 3; -} - -// ModeInfo describes the signing mode of a single or nested multisig signer. -message ModeInfo { - // sum is the oneof that specifies whether this represents a single or nested - // multisig signer - oneof sum { - // single represents a single signer - Single single = 1; - - // multi represents a nested multisig signer - Multi multi = 2; - } - - // Single is the mode info for a single signer. It is structured as a message - // to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the - // future - message Single { - // mode is the signing mode of the single signer - cosmos.tx.signing.v1beta1.SignMode mode = 1; - } - - // Multi is the mode info for a multisig public key - message Multi { - // bitarray specifies which keys within the multisig are signing - cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; - - // mode_infos is the corresponding modes of the signers of the multisig - // which could include nested multisig public keys - repeated ModeInfo mode_infos = 2; - } -} - -// Fee includes the amount of coins paid in fees and the maximum -// gas to be used by the transaction. The ratio yields an effective "gasprice", -// which must be above some miminum to be accepted into the mempool. -message Fee { - // amount is the amount of coins to be paid as a fee - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/irishub-sdk-go/types.Coins"]; - - // gas_limit is the maximum gas that can be used in transaction processing - // before an out of gas error occurs - uint64 gas_limit = 2; - - // if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - // the payer must be a tx signer (and thus have signed this field in AuthInfo). - // setting this field does *not* change the ordering of required signers for the transaction. - string payer = 3; - - // if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - // to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - // not support fee grants, this will fail - string granter = 4; -} From ae15d113bb6a8d08f9ecda5298d5a7d0bba8350f Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 13:54:00 +0800 Subject: [PATCH 19/41] fix go mod --- module-sdk/coinswap/go.mod | 2 +- module-sdk/gov/go.mod | 2 +- module-sdk/htlc/go.mod | 2 +- module-sdk/integration_test/go.mod | 2 +- module-sdk/keys/go.mod | 2 +- module-sdk/nft/go.mod | 2 +- module-sdk/oracle/go.mod | 4 ++-- module-sdk/random/go.mod | 2 +- module-sdk/record/go.mod | 2 +- module-sdk/service/go.mod | 2 +- module-sdk/staking/go.mod | 2 +- module-sdk/token/go.mod | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index b83a9832..2b5c1ce1 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -8,6 +8,6 @@ github.com/irisnet/core-sdk-go v0.1.0 ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index 55fd4632..489c83a7 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index 01560b22..65a04602 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index d87f35f9..29ce74fe 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -21,7 +21,7 @@ github.com/irisnet/oracle-sdk-go v0.1.0 replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/irisnet/coinswap-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/coinswap github.com/irisnet/gov-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/gov github.com/irisnet/htlc-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/htlc diff --git a/module-sdk/keys/go.mod b/module-sdk/keys/go.mod index 58716753..ed427f41 100644 --- a/module-sdk/keys/go.mod +++ b/module-sdk/keys/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index 9b417c9f..356dbd25 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 4a1b13dc..1948fb7f 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -9,7 +9,7 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk - github.com/irisnet/service-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/service +github.com/irisnet/core-sdk-go => ../../../core-sdk + github.com/irisnet/service-sdk-go => ../../../module-sdk/service github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index 58d84495..a4d40e6e 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index ecd9afaf..569f36d3 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index c936a429..5b64b714 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index 2b4ee50f..2db15608 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index 4b90aa14..d691e662 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/core-sdk +github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file From fe65fae27a0a6e9fb3580fd624258e22f23c746b Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 14:11:02 +0800 Subject: [PATCH 20/41] fix TestUnit --- .github/workflows/TestUnit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestUnit.yml b/.github/workflows/TestUnit.yml index e3ea4e1f..cceec41b 100644 --- a/.github/workflows/TestUnit.yml +++ b/.github/workflows/TestUnit.yml @@ -2,7 +2,7 @@ name: TestUnit on: [pull_request] jobs: - test-unit: + test-integration: name: Test Units runs-on: ubuntu-16.04 steps: From 1639cc171860aa9aaa4cf804ca0a4faba4ff481e Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 14:13:00 +0800 Subject: [PATCH 21/41] fix TestUnit --- .github/workflows/TestUnit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestUnit.yml b/.github/workflows/TestUnit.yml index cceec41b..e3ea4e1f 100644 --- a/.github/workflows/TestUnit.yml +++ b/.github/workflows/TestUnit.yml @@ -2,7 +2,7 @@ name: TestUnit on: [pull_request] jobs: - test-integration: + test-unit: name: Test Units runs-on: ubuntu-16.04 steps: From bbcbdca93ad8925c9d51223fa88bf7a3b791293c Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 14:56:23 +0800 Subject: [PATCH 22/41] fix TestUnit --- module-sdk/Makefile | 12 ++++++- module-sdk/integration_test/client.go | 33 +++++++++++++------- module-sdk/integration_test/coinswap_test.go | 6 ++-- module-sdk/integration_test/gov_test.go | 3 +- module-sdk/integration_test/htlc_test.go | 3 +- module-sdk/integration_test/nft_test.go | 3 +- module-sdk/integration_test/oracle_test.go | 6 ++-- module-sdk/integration_test/random_test.go | 1 + module-sdk/integration_test/record_test.go | 3 +- module-sdk/integration_test/service_test.go | 3 +- module-sdk/integration_test/staking_test.go | 3 +- module-sdk/integration_test/token_test.go | 3 +- 12 files changed, 56 insertions(+), 23 deletions(-) diff --git a/module-sdk/Makefile b/module-sdk/Makefile index c4119b6f..3e31a131 100644 --- a/module-sdk/Makefile +++ b/module-sdk/Makefile @@ -6,7 +6,17 @@ format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs misspell -w find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/integration-test - + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/coinswap-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/gov-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/htlc-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/keys-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/nft-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/oracle-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/random-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/record-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/service-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/staking-sdk-go + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/token-sdk-go test-unit: @go test -v $(PACKAGES_UNITTEST) diff --git a/module-sdk/integration_test/client.go b/module-sdk/integration_test/client.go index 9fe1e65c..985c1050 100644 --- a/module-sdk/integration_test/client.go +++ b/module-sdk/integration_test/client.go @@ -1,7 +1,6 @@ package integrationtest import ( - "github.com/irisnet/coinswap-sdk-go" "github.com/irisnet/core-sdk-go/bank" "github.com/irisnet/core-sdk-go/client" "github.com/irisnet/core-sdk-go/common/codec" @@ -9,17 +8,29 @@ import ( cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" "github.com/irisnet/core-sdk-go/types" txtypes "github.com/irisnet/core-sdk-go/types/tx" - "github.com/irisnet/gov-sdk-go" - "github.com/irisnet/htlc-sdk-go" - "github.com/irisnet/keys-sdk-go" - "github.com/irisnet/nft-sdk-go" - "github.com/irisnet/oracle-sdk-go" - "github.com/irisnet/random-sdk-go" - "github.com/irisnet/record-sdk-go" - "github.com/irisnet/service-sdk-go" - "github.com/irisnet/staking-sdk-go" - "github.com/irisnet/token-sdk-go" "github.com/tendermint/tendermint/libs/log" + + "github.com/irisnet/token-sdk-go" + + "github.com/irisnet/coinswap-sdk-go" + + "github.com/irisnet/staking-sdk-go" + + "github.com/irisnet/service-sdk-go" + + "github.com/irisnet/record-sdk-go" + + "github.com/irisnet/random-sdk-go" + + "github.com/irisnet/oracle-sdk-go" + + "github.com/irisnet/nft-sdk-go" + + "github.com/irisnet/keys-sdk-go" + + "github.com/irisnet/htlc-sdk-go" + + "github.com/irisnet/gov-sdk-go" ) type Client struct { diff --git a/module-sdk/integration_test/coinswap_test.go b/module-sdk/integration_test/coinswap_test.go index ec7a26ba..4c35e94a 100644 --- a/module-sdk/integration_test/coinswap_test.go +++ b/module-sdk/integration_test/coinswap_test.go @@ -3,10 +3,12 @@ package integrationtest import ( "time" - "github.com/irisnet/coinswap-sdk-go" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/token-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/token-sdk-go" + + "github.com/irisnet/coinswap-sdk-go" ) func (s IntegrationTestSuite) TestCoinSwap() { diff --git a/module-sdk/integration_test/gov_test.go b/module-sdk/integration_test/gov_test.go index 8c43f15d..c72a00a5 100644 --- a/module-sdk/integration_test/gov_test.go +++ b/module-sdk/integration_test/gov_test.go @@ -5,8 +5,9 @@ import ( "fmt" "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/gov-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/gov-sdk-go" ) func (s IntegrationTestSuite) TestGov() { diff --git a/module-sdk/integration_test/htlc_test.go b/module-sdk/integration_test/htlc_test.go index 59cb9a08..efe517d0 100644 --- a/module-sdk/integration_test/htlc_test.go +++ b/module-sdk/integration_test/htlc_test.go @@ -6,9 +6,10 @@ import ( "fmt" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/htlc-sdk-go" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/tmhash" + + "github.com/irisnet/htlc-sdk-go" ) func (s IntegrationTestSuite) TestHTLC() { diff --git a/module-sdk/integration_test/nft_test.go b/module-sdk/integration_test/nft_test.go index 958419eb..08346151 100644 --- a/module-sdk/integration_test/nft_test.go +++ b/module-sdk/integration_test/nft_test.go @@ -5,8 +5,9 @@ import ( "strings" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/nft-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/nft-sdk-go" ) func (s IntegrationTestSuite) TestNFT() { diff --git a/module-sdk/integration_test/oracle_test.go b/module-sdk/integration_test/oracle_test.go index e422ee3d..72e06df3 100644 --- a/module-sdk/integration_test/oracle_test.go +++ b/module-sdk/integration_test/oracle_test.go @@ -5,9 +5,11 @@ import ( "time" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/oracle-sdk-go" - "github.com/irisnet/service-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/service-sdk-go" + + "github.com/irisnet/oracle-sdk-go" ) var serviceName = generateServiceName() diff --git a/module-sdk/integration_test/random_test.go b/module-sdk/integration_test/random_test.go index 39da8d35..09607bd8 100644 --- a/module-sdk/integration_test/random_test.go +++ b/module-sdk/integration_test/random_test.go @@ -5,6 +5,7 @@ import ( "time" "github.com/irisnet/core-sdk-go/types" + "github.com/irisnet/random-sdk-go" ) diff --git a/module-sdk/integration_test/record_test.go b/module-sdk/integration_test/record_test.go index e6029f5b..b9e3130b 100644 --- a/module-sdk/integration_test/record_test.go +++ b/module-sdk/integration_test/record_test.go @@ -4,8 +4,9 @@ import ( "fmt" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/record-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/record-sdk-go" ) func (s IntegrationTestSuite) TestRecord() { diff --git a/module-sdk/integration_test/service_test.go b/module-sdk/integration_test/service_test.go index 69865508..d97d9c20 100644 --- a/module-sdk/integration_test/service_test.go +++ b/module-sdk/integration_test/service_test.go @@ -5,8 +5,9 @@ import ( sdk "github.com/irisnet/core-sdk-go/types" "github.com/irisnet/core-sdk-go/types/query" - "github.com/irisnet/service-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/service-sdk-go" ) func (s IntegrationTestSuite) TestService() { diff --git a/module-sdk/integration_test/staking_test.go b/module-sdk/integration_test/staking_test.go index 49ae6913..cac65f67 100644 --- a/module-sdk/integration_test/staking_test.go +++ b/module-sdk/integration_test/staking_test.go @@ -4,8 +4,9 @@ import ( "context" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/staking-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/staking-sdk-go" ) func (s IntegrationTestSuite) TestStaking() { diff --git a/module-sdk/integration_test/token_test.go b/module-sdk/integration_test/token_test.go index ebc8d144..7bbb02cf 100644 --- a/module-sdk/integration_test/token_test.go +++ b/module-sdk/integration_test/token_test.go @@ -4,8 +4,9 @@ import ( "strings" sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/token-sdk-go" "github.com/stretchr/testify/require" + + "github.com/irisnet/token-sdk-go" ) func (s IntegrationTestSuite) TestToken() { From c19ab5986a8ff7f7f8da6f66f179bcefa508d04d Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 5 Jul 2021 15:44:19 +0800 Subject: [PATCH 23/41] fix Makefile --- module-sdk/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/module-sdk/Makefile b/module-sdk/Makefile index 3e31a131..b444a7ae 100644 --- a/module-sdk/Makefile +++ b/module-sdk/Makefile @@ -17,6 +17,7 @@ format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/service-sdk-go find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/staking-sdk-go find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/token-sdk-go + test-unit: @go test -v $(PACKAGES_UNITTEST) From 3af696b49d9651ced440b3b4d50fb29e231a3e9b Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 6 Jul 2021 11:02:17 +0800 Subject: [PATCH 24/41] =?UTF-8?q?1=E3=80=81add=20default=20TokenManager=20?= =?UTF-8?q?2=E3=80=81fix=20mod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 20 ----------- core-sdk/integration_test/integration_test.go | 1 - core-sdk/types/config.go | 3 ++ core-sdk/types/token_manager.go | 33 +++++++++++++++++++ module-sdk/coinswap/coinswap.pb.go | 4 +-- module-sdk/coinswap/go.mod | 2 +- module-sdk/coinswap/tx.pb.go | 10 +++--- module-sdk/gov/go.mod | 2 +- module-sdk/htlc/go.mod | 2 +- module-sdk/integration_test/go.mod | 28 ++++++++-------- module-sdk/keys/go.mod | 2 +- module-sdk/nft/go.mod | 2 +- module-sdk/oracle/go.mod | 2 +- module-sdk/random/go.mod | 2 +- module-sdk/record/go.mod | 2 +- module-sdk/service/go.mod | 2 +- module-sdk/staking/go.mod | 2 +- module-sdk/token/go.mod | 2 +- 18 files changed, 69 insertions(+), 52 deletions(-) delete mode 100644 Makefile create mode 100644 core-sdk/types/token_manager.go diff --git a/Makefile b/Makefile deleted file mode 100644 index 7cc2dfdd..00000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PACKAGES=$(shell go list ./...) -PACKAGES_UNITTEST=$(shell go list ./... | grep -v integration_test) -export GO111MODULE = on - -format: - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs gofmt -w -s - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/irishub-sdk-go - -test-unit: - @go test -v $(PACKAGES_UNITTEST) - -test-integration: - cd integration_test/scripts/ && sh build.sh && sh start.sh - sleep 2s - @go test -v $(PACKAGES) - cd integration_test/scripts/ && sh clean.sh - -proto-gen: - @./third_party/protocgen.sh \ No newline at end of file diff --git a/core-sdk/integration_test/integration_test.go b/core-sdk/integration_test/integration_test.go index ceba9da6..bd95584c 100644 --- a/core-sdk/integration_test/integration_test.go +++ b/core-sdk/integration_test/integration_test.go @@ -147,7 +147,6 @@ func (TokenManager TokenManager) SaveTokens(tokens ...types.Token) { } func (TokenManager TokenManager) ToMinCoin(coins ...types.DecCoin) (types.Coins, types.Error) { - for i := range coins { if coins[i].Denom == "iris" { coins[i].Denom = "uiris" diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go index 2cec49fd..34738228 100644 --- a/core-sdk/types/config.go +++ b/core-sdk/types/config.go @@ -241,6 +241,9 @@ func CachedOption(enabled bool) Option { func TokenManagerOption(tokenManager TokenManager) Option { return func(cfg *ClientConfig) error { + if tokenManager == nil { + tokenManager = DefaultTokenManager{} + } cfg.TokenManager = tokenManager return nil } diff --git a/core-sdk/types/token_manager.go b/core-sdk/types/token_manager.go new file mode 100644 index 00000000..752706a6 --- /dev/null +++ b/core-sdk/types/token_manager.go @@ -0,0 +1,33 @@ +package types + +type DefaultTokenManager struct{} + +func (TokenManager DefaultTokenManager) QueryToken(denom string) (Token, error) { + return Token{}, nil +} + +func (TokenManager DefaultTokenManager) SaveTokens(tokens ...Token) { + return +} + +func (TokenManager DefaultTokenManager) ToMinCoin(coins ...DecCoin) (Coins, Error) { + for i := range coins { + if coins[i].Denom == "iris" { + coins[i].Denom = "uiris" + coins[i].Amount = coins[i].Amount.MulInt(NewIntWithDecimal(1, 6)) + } + } + ucoins, _ := DecCoins(coins).TruncateDecimal() + return ucoins, nil +} + +func (TokenManager DefaultTokenManager) ToMainCoin(coins ...Coin) (DecCoins, Error) { + decCoins := make(DecCoins, len(coins), 0) + for _, coin := range coins { + if coin.Denom == "uiris" { + amtount := NewDecFromInt(coin.Amount).Mul(NewDecWithPrec(1, 6)) + decCoins = append(decCoins, NewDecCoinFromDec("iris", amtount)) + } + } + return decCoins, nil +} diff --git a/module-sdk/coinswap/coinswap.pb.go b/module-sdk/coinswap/coinswap.pb.go index 2d9f7087..cb137800 100644 --- a/module-sdk/coinswap/coinswap.pb.go +++ b/module-sdk/coinswap/coinswap.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + github_com_irisnet_core_sdk_go_types "github.com/irisnet/core-sdk-go/types" types "github.com/irisnet/core-sdk-go/types" io "io" math "math" @@ -105,7 +105,7 @@ var xxx_messageInfo_Output proto.InternalMessageInfo // Params defines token module's parameters type Params struct { - Fee github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` + Fee github_com_irisnet_core_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` } func (m *Params) Reset() { *m = Params{} } diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index 2b5c1ce1..5eed4b28 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -8,6 +8,6 @@ github.com/irisnet/core-sdk-go v0.1.0 ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 ) \ No newline at end of file diff --git a/module-sdk/coinswap/tx.pb.go b/module-sdk/coinswap/tx.pb.go index 3ffbad02..ffd6df48 100644 --- a/module-sdk/coinswap/tx.pb.go +++ b/module-sdk/coinswap/tx.pb.go @@ -9,7 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + github_com_irisnet_core_sdk_go_types "github.com/irisnet/core-sdk-go/types" types "github.com/irisnet/core-sdk-go/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -33,8 +33,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgAddLiquidity defines a msg for adding liquidity to a reserve pool type MsgAddLiquidity struct { MaxToken types.Coin `protobuf:"bytes,1,opt,name=max_token,json=maxToken,proto3" json:"max_token" yaml:"max_token"` - ExactStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=exact_standard_amt,json=exactStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"exact_standard_amt" yaml:"exact_standard_amt"` - MinLiquidity github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_liquidity,json=minLiquidity,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_liquidity" yaml:"min_liquidity"` + ExactStandardAmt github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,2,opt,name=exact_standard_amt,json=exactStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"exact_standard_amt" yaml:"exact_standard_amt"` + MinLiquidity github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_liquidity,json=minLiquidity,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_liquidity" yaml:"min_liquidity"` Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` } @@ -113,8 +113,8 @@ var xxx_messageInfo_MsgAddLiquidityResponse proto.InternalMessageInfo // MsgRemoveLiquidity defines a msg for removing liquidity from a reserve pool type MsgRemoveLiquidity struct { WithdrawLiquidity types.Coin `protobuf:"bytes,1,opt,name=withdraw_liquidity,json=withdrawLiquidity,proto3" json:"withdraw_liquidity" yaml:"withdraw_liquidity"` - MinToken github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=min_token,json=minToken,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_token" yaml:"min_token"` - MinStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_standard_amt,json=minStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_standard_amt" yaml:"min_standard_amt"` + MinToken github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,2,opt,name=min_token,json=minToken,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_token" yaml:"min_token"` + MinStandardAmt github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_standard_amt,json=minStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_standard_amt" yaml:"min_standard_amt"` Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` } diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index 489c83a7..6b79924d 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index 65a04602..4dc534a1 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index 29ce74fe..a44f0f1b 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -3,9 +3,10 @@ module github.com/irisnet/integration-test go 1.16 require ( +github.com/irisnet/module-sdk v0.1.1 github.com/gogo/protobuf v1.3.3 -github.com/irisnet/core-sdk-go v0.1.0 github.com/irisnet/coinswap-sdk-go v0.1.0 +github.com/irisnet/core-sdk-go v0.1.0 github.com/irisnet/gov-sdk-go v0.1.0 github.com/irisnet/htlc-sdk-go v0.1.0 github.com/irisnet/nft-sdk-go v0.1.0 @@ -21,16 +22,17 @@ github.com/irisnet/oracle-sdk-go v0.1.0 replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -github.com/irisnet/core-sdk-go => ../../../core-sdk -github.com/irisnet/coinswap-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/coinswap -github.com/irisnet/gov-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/gov -github.com/irisnet/htlc-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/htlc -github.com/irisnet/nft-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/nft -github.com/irisnet/random-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/random -github.com/irisnet/service-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/service -github.com/irisnet/record-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/record -github.com/irisnet/staking-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/staking -github.com/irisnet/token-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/token -github.com/irisnet/keys-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/keys -github.com/irisnet/oracle-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/oracle +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 +github.com/irisnet/module-sdk => github.com/Nicke-lucky/module-sdk-go 8c6093a2351a9a83e58715becd7dbd2411cc06fa +github.com/irisnet/gov-sdk-go => ../../module-sdk/gov +github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc +github.com/irisnet/nft-sdk-go => ../../module-sdk/nft +github.com/irisnet/random-sdk-go => ../../module-sdk/random +github.com/irisnet/service-sdk-go => ../../module-sdk/service +github.com/irisnet/record-sdk-go => ../../module-sdk/record +github.com/irisnet/staking-sdk-go => ../../module-sdk/staking +github.com/irisnet/token-sdk-go => ../../module-sdk/token +github.com/irisnet/keys-sdk-go => ../../module-sdk/keys +github.com/irisnet/oracle-sdk-go => ../../module-sdk/oracle +github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap ) \ No newline at end of file diff --git a/module-sdk/keys/go.mod b/module-sdk/keys/go.mod index ed427f41..c6b406a1 100644 --- a/module-sdk/keys/go.mod +++ b/module-sdk/keys/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index 356dbd25..fbc4ee7c 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 1948fb7f..13c307e3 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -9,7 +9,7 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/irisnet/service-sdk-go => ../../../module-sdk/service github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index a4d40e6e..b1a8c759 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index 569f36d3..0354527b 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index 5b64b714..80e4af44 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index 2db15608..9eef7320 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index d691e662..457eb078 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file From 32bec210264a4187c9a0d8651633f7b675dd408c Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 6 Jul 2021 11:02:17 +0800 Subject: [PATCH 25/41] =?UTF-8?q?1=E3=80=81add=20default=20TokenManager=20?= =?UTF-8?q?2=E3=80=81fix=20mod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 20 ----------- core-sdk/integration_test/integration_test.go | 1 - core-sdk/types/config.go | 3 ++ core-sdk/types/token_manager.go | 33 +++++++++++++++++++ module-sdk/coinswap/coinswap.pb.go | 4 +-- module-sdk/coinswap/go.mod | 2 +- module-sdk/coinswap/tx.pb.go | 10 +++--- module-sdk/gov/go.mod | 2 +- module-sdk/htlc/go.mod | 2 +- module-sdk/integration_test/go.mod | 28 ++++++++-------- module-sdk/keys/go.mod | 2 +- module-sdk/nft/go.mod | 2 +- module-sdk/oracle/go.mod | 2 +- module-sdk/random/go.mod | 2 +- module-sdk/record/go.mod | 2 +- module-sdk/service/go.mod | 2 +- module-sdk/staking/go.mod | 2 +- module-sdk/token/go.mod | 2 +- 18 files changed, 69 insertions(+), 52 deletions(-) delete mode 100644 Makefile create mode 100644 core-sdk/types/token_manager.go diff --git a/Makefile b/Makefile deleted file mode 100644 index 7cc2dfdd..00000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PACKAGES=$(shell go list ./...) -PACKAGES_UNITTEST=$(shell go list ./... | grep -v integration_test) -export GO111MODULE = on - -format: - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs gofmt -w -s - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/irishub-sdk-go - -test-unit: - @go test -v $(PACKAGES_UNITTEST) - -test-integration: - cd integration_test/scripts/ && sh build.sh && sh start.sh - sleep 2s - @go test -v $(PACKAGES) - cd integration_test/scripts/ && sh clean.sh - -proto-gen: - @./third_party/protocgen.sh \ No newline at end of file diff --git a/core-sdk/integration_test/integration_test.go b/core-sdk/integration_test/integration_test.go index ceba9da6..bd95584c 100644 --- a/core-sdk/integration_test/integration_test.go +++ b/core-sdk/integration_test/integration_test.go @@ -147,7 +147,6 @@ func (TokenManager TokenManager) SaveTokens(tokens ...types.Token) { } func (TokenManager TokenManager) ToMinCoin(coins ...types.DecCoin) (types.Coins, types.Error) { - for i := range coins { if coins[i].Denom == "iris" { coins[i].Denom = "uiris" diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go index 2cec49fd..34738228 100644 --- a/core-sdk/types/config.go +++ b/core-sdk/types/config.go @@ -241,6 +241,9 @@ func CachedOption(enabled bool) Option { func TokenManagerOption(tokenManager TokenManager) Option { return func(cfg *ClientConfig) error { + if tokenManager == nil { + tokenManager = DefaultTokenManager{} + } cfg.TokenManager = tokenManager return nil } diff --git a/core-sdk/types/token_manager.go b/core-sdk/types/token_manager.go new file mode 100644 index 00000000..752706a6 --- /dev/null +++ b/core-sdk/types/token_manager.go @@ -0,0 +1,33 @@ +package types + +type DefaultTokenManager struct{} + +func (TokenManager DefaultTokenManager) QueryToken(denom string) (Token, error) { + return Token{}, nil +} + +func (TokenManager DefaultTokenManager) SaveTokens(tokens ...Token) { + return +} + +func (TokenManager DefaultTokenManager) ToMinCoin(coins ...DecCoin) (Coins, Error) { + for i := range coins { + if coins[i].Denom == "iris" { + coins[i].Denom = "uiris" + coins[i].Amount = coins[i].Amount.MulInt(NewIntWithDecimal(1, 6)) + } + } + ucoins, _ := DecCoins(coins).TruncateDecimal() + return ucoins, nil +} + +func (TokenManager DefaultTokenManager) ToMainCoin(coins ...Coin) (DecCoins, Error) { + decCoins := make(DecCoins, len(coins), 0) + for _, coin := range coins { + if coin.Denom == "uiris" { + amtount := NewDecFromInt(coin.Amount).Mul(NewDecWithPrec(1, 6)) + decCoins = append(decCoins, NewDecCoinFromDec("iris", amtount)) + } + } + return decCoins, nil +} diff --git a/module-sdk/coinswap/coinswap.pb.go b/module-sdk/coinswap/coinswap.pb.go index 2d9f7087..cb137800 100644 --- a/module-sdk/coinswap/coinswap.pb.go +++ b/module-sdk/coinswap/coinswap.pb.go @@ -7,7 +7,7 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + github_com_irisnet_core_sdk_go_types "github.com/irisnet/core-sdk-go/types" types "github.com/irisnet/core-sdk-go/types" io "io" math "math" @@ -105,7 +105,7 @@ var xxx_messageInfo_Output proto.InternalMessageInfo // Params defines token module's parameters type Params struct { - Fee github_com_irisnet_irishub_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` + Fee github_com_irisnet_core_sdk_go_types.Dec `protobuf:"bytes,1,opt,name=fee,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Dec" json:"fee"` } func (m *Params) Reset() { *m = Params{} } diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index 2b5c1ce1..5eed4b28 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -8,6 +8,6 @@ github.com/irisnet/core-sdk-go v0.1.0 ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 ) \ No newline at end of file diff --git a/module-sdk/coinswap/tx.pb.go b/module-sdk/coinswap/tx.pb.go index 3ffbad02..ffd6df48 100644 --- a/module-sdk/coinswap/tx.pb.go +++ b/module-sdk/coinswap/tx.pb.go @@ -9,7 +9,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" + github_com_irisnet_core_sdk_go_types "github.com/irisnet/core-sdk-go/types" types "github.com/irisnet/core-sdk-go/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -33,8 +33,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgAddLiquidity defines a msg for adding liquidity to a reserve pool type MsgAddLiquidity struct { MaxToken types.Coin `protobuf:"bytes,1,opt,name=max_token,json=maxToken,proto3" json:"max_token" yaml:"max_token"` - ExactStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=exact_standard_amt,json=exactStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"exact_standard_amt" yaml:"exact_standard_amt"` - MinLiquidity github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_liquidity,json=minLiquidity,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_liquidity" yaml:"min_liquidity"` + ExactStandardAmt github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,2,opt,name=exact_standard_amt,json=exactStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"exact_standard_amt" yaml:"exact_standard_amt"` + MinLiquidity github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_liquidity,json=minLiquidity,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_liquidity" yaml:"min_liquidity"` Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` } @@ -113,8 +113,8 @@ var xxx_messageInfo_MsgAddLiquidityResponse proto.InternalMessageInfo // MsgRemoveLiquidity defines a msg for removing liquidity from a reserve pool type MsgRemoveLiquidity struct { WithdrawLiquidity types.Coin `protobuf:"bytes,1,opt,name=withdraw_liquidity,json=withdrawLiquidity,proto3" json:"withdraw_liquidity" yaml:"withdraw_liquidity"` - MinToken github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,2,opt,name=min_token,json=minToken,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_token" yaml:"min_token"` - MinStandardAmt github_com_irisnet_irishub_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_standard_amt,json=minStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_standard_amt" yaml:"min_standard_amt"` + MinToken github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,2,opt,name=min_token,json=minToken,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_token" yaml:"min_token"` + MinStandardAmt github_com_irisnet_core_sdk_go_types.Int `protobuf:"bytes,3,opt,name=min_standard_amt,json=minStandardAmt,proto3,customtype=github.com/irisnet/irishub-sdk-go/types.Int" json:"min_standard_amt" yaml:"min_standard_amt"` Deadline int64 `protobuf:"varint,4,opt,name=deadline,proto3" json:"deadline,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` } diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index 489c83a7..6b79924d 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index 65a04602..4dc534a1 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index 29ce74fe..a44f0f1b 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -3,9 +3,10 @@ module github.com/irisnet/integration-test go 1.16 require ( +github.com/irisnet/module-sdk v0.1.1 github.com/gogo/protobuf v1.3.3 -github.com/irisnet/core-sdk-go v0.1.0 github.com/irisnet/coinswap-sdk-go v0.1.0 +github.com/irisnet/core-sdk-go v0.1.0 github.com/irisnet/gov-sdk-go v0.1.0 github.com/irisnet/htlc-sdk-go v0.1.0 github.com/irisnet/nft-sdk-go v0.1.0 @@ -21,16 +22,17 @@ github.com/irisnet/oracle-sdk-go v0.1.0 replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -github.com/irisnet/core-sdk-go => ../../../core-sdk -github.com/irisnet/coinswap-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/coinswap -github.com/irisnet/gov-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/gov -github.com/irisnet/htlc-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/htlc -github.com/irisnet/nft-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/nft -github.com/irisnet/random-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/random -github.com/irisnet/service-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/service -github.com/irisnet/record-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/record -github.com/irisnet/staking-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/staking -github.com/irisnet/token-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/token -github.com/irisnet/keys-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/keys -github.com/irisnet/oracle-sdk-go => /Users/nicker/sandbox/bianjie/sdk/irishub-sdk-go/module-sdk/oracle +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 +github.com/irisnet/module-sdk => github.com/Nicke-lucky/module-sdk-go 8c6093a2351a9a83e58715becd7dbd2411cc06fa +github.com/irisnet/gov-sdk-go => ../../module-sdk/gov +github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc +github.com/irisnet/nft-sdk-go => ../../module-sdk/nft +github.com/irisnet/random-sdk-go => ../../module-sdk/random +github.com/irisnet/service-sdk-go => ../../module-sdk/service +github.com/irisnet/record-sdk-go => ../../module-sdk/record +github.com/irisnet/staking-sdk-go => ../../module-sdk/staking +github.com/irisnet/token-sdk-go => ../../module-sdk/token +github.com/irisnet/keys-sdk-go => ../../module-sdk/keys +github.com/irisnet/oracle-sdk-go => ../../module-sdk/oracle +github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap ) \ No newline at end of file diff --git a/module-sdk/keys/go.mod b/module-sdk/keys/go.mod index ed427f41..c6b406a1 100644 --- a/module-sdk/keys/go.mod +++ b/module-sdk/keys/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index 356dbd25..fbc4ee7c 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 1948fb7f..13c307e3 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -9,7 +9,7 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/irisnet/service-sdk-go => ../../../module-sdk/service github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index a4d40e6e..b1a8c759 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index 569f36d3..0354527b 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index 5b64b714..80e4af44 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index 2db15608..9eef7320 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index d691e662..457eb078 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -8,6 +8,6 @@ require ( ) replace ( -github.com/irisnet/core-sdk-go => ../../../core-sdk +github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 ) \ No newline at end of file From 5d47caf334d37499bce192688a5cdabbab87126f Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 6 Jul 2021 11:25:07 +0800 Subject: [PATCH 26/41] =?UTF-8?q?1=E3=80=81fix=20go=20mod=20and=20file=20p?= =?UTF-8?q?ath?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crypto/keys/secp256k1/secp256k1_cgo.go | 2 +- core-sdk/go.mod | 7 ++-- core-sdk/go.sum | 41 ------------------- .../crypto/multisig/v1beta1/multisig.proto | 2 +- 4 files changed, 6 insertions(+), 46 deletions(-) diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go index d274a287..0a36a664 100644 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go +++ b/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go @@ -5,7 +5,7 @@ package secp256k1 import ( "github.com/tendermint/tendermint/crypto" - "github.com/irisnet/core-sdk-go/crypto/keys/secp256k1/internal/secp256k1" + "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1/internal/secp256k1" ) // Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg. diff --git a/core-sdk/go.mod b/core-sdk/go.mod index ec956250..3612cdbb 100644 --- a/core-sdk/go.mod +++ b/core-sdk/go.mod @@ -3,17 +3,18 @@ module github.com/irisnet/core-sdk-go go 1.16 require ( - github.com/avast/retry-go v3.0.0+incompatible // indirect + github.com/avast/retry-go v3.0.0+incompatible github.com/bluele/gcache v0.0.2 github.com/btcsuite/btcd v0.21.0-beta github.com/btcsuite/btcutil v1.0.2 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d github.com/gogo/protobuf v1.3.3 - github.com/golang/protobuf v1.4.3 // indirect + github.com/golang/protobuf v1.4.3 github.com/magiconair/properties v1.8.1 + github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pkg/errors v0.9.1 - github.com/prometheus/common v0.14.0 // indirect + github.com/prometheus/common v0.14.0 github.com/regen-network/cosmos-proto v0.3.1 github.com/sirupsen/logrus v1.6.0 github.com/stretchr/testify v1.7.0 diff --git a/core-sdk/go.sum b/core-sdk/go.sum index 8226f61b..675c2268 100644 --- a/core-sdk/go.sum +++ b/core-sdk/go.sum @@ -85,7 +85,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -99,9 +98,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= -github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -111,7 +108,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= @@ -202,8 +198,6 @@ github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSN github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= -github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= @@ -216,18 +210,15 @@ github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51 github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= @@ -278,7 +269,6 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -412,8 +402,6 @@ github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzy github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.2-alpha.regen.4 h1:c9jEnU+xm6vqyrQe3M94UFWqiXxRIKKnqBOh2EACmBE= github.com/regen-network/protobuf v1.3.2-alpha.regen.4/go.mod h1:/J8/bR1T/NXyIdQDLUaq15LjNE83nRzkyrLAMcPewig= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -425,8 +413,6 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73DK8Y= github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -445,14 +431,12 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -476,12 +460,6 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RM github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= 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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= -github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= -github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= -github.com/tendermint/tendermint v0.34.10 h1:wBOc/It8sh/pVH9np2V5fBvRmIyFN/bUrGPx+eAHexs= -github.com/tendermint/tendermint v0.34.10/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= -github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= @@ -489,14 +467,11 @@ github.com/tjfoc/gmsm v1.4.0 h1:8nbaiZG+iVdh+fXVw0DZoZZa7a4TGm3Qab+xdrdzj8s= github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= 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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= @@ -528,7 +503,6 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= @@ -554,8 +528,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -571,13 +543,10 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -586,8 +555,6 @@ golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb h1:mUVeFHoDKis5nxCAzoAi7E8Ghb86EXh/RK6wtvJIqRY= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -598,7 +565,6 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -668,12 +634,9 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200110213125-a7a6caa82ab2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -705,7 +668,6 @@ google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -725,8 +687,6 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= @@ -748,7 +708,6 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= diff --git a/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto b/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto index 32d2e703..e14b42ce 100644 --- a/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto +++ b/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto @@ -3,7 +3,7 @@ package cosmos.crypto.multisig.v1beta1; import "gogoproto/gogo.proto"; -option go_package = "github.com/irisnet/core-sdk-go/crypto/types"; +option go_package = "github.com/irisnet/core-sdk-go/common/crypto/types"; // MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. // See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers From 05cee1c28fa4b3a3f35ccd10b98f4d05a7740db6 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 6 Jul 2021 14:56:07 +0800 Subject: [PATCH 27/41] =?UTF-8?q?1=E3=80=81fix=20go=20mod=20and=20sum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core-sdk/types/config.go | 4 + module-sdk/coinswap/go.mod | 15 +- module-sdk/coinswap/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/gov/go.mod | 15 +- module-sdk/gov/go.sum | 767 +++++++++++++++++++++++++++++ module-sdk/htlc/go.mod | 13 +- module-sdk/htlc/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/integration_test/go.mod | 60 +-- module-sdk/integration_test/go.sum | 110 ++++- module-sdk/keys/go.mod | 11 +- module-sdk/keys/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/nft/go.mod | 12 +- module-sdk/nft/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/oracle/go.mod | 17 +- module-sdk/oracle/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/random/go.mod | 12 +- module-sdk/random/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/record/go.mod | 12 +- module-sdk/record/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/service/go.mod | 12 +- module-sdk/service/go.sum | 766 ++++++++++++++++++++++++++++ module-sdk/staking/go.mod | 16 +- module-sdk/staking/go.sum | 767 +++++++++++++++++++++++++++++ module-sdk/token/go.mod | 14 +- module-sdk/token/go.sum | 767 +++++++++++++++++++++++++++++ 25 files changed, 8639 insertions(+), 113 deletions(-) create mode 100644 module-sdk/coinswap/go.sum create mode 100644 module-sdk/gov/go.sum create mode 100644 module-sdk/htlc/go.sum create mode 100644 module-sdk/keys/go.sum create mode 100644 module-sdk/nft/go.sum create mode 100644 module-sdk/oracle/go.sum create mode 100644 module-sdk/random/go.sum create mode 100644 module-sdk/record/go.sum create mode 100644 module-sdk/service/go.sum create mode 100644 module-sdk/staking/go.sum create mode 100644 module-sdk/token/go.sum diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go index 34738228..e495651d 100644 --- a/core-sdk/types/config.go +++ b/core-sdk/types/config.go @@ -127,6 +127,10 @@ func (cfg *ClientConfig) checkAndSetDefault() error { return err } + if err := TokenManagerOption(cfg.TokenManager)(cfg); err != nil { + return err + } + if err := TxSizeLimitOption(cfg.TxSizeLimit)(cfg); err != nil { return err } diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index 5eed4b28..6f57c45a 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -1,13 +1,16 @@ -module github.com/irisnet/coinswap-sdk-go +module github.com/irisnet/irishub-sdk-go/module-sdk/coinswap go 1.16 require ( -github.com/gogo/protobuf v1.3.3 -github.com/irisnet/core-sdk-go v0.1.0 + github.com/gogo/protobuf v1.3.3 + github.com/irisnet/core-sdk-go v0.1.0 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 ) replace ( -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => ../../../core-sdk +) + diff --git a/module-sdk/coinswap/go.sum b/module-sdk/coinswap/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/coinswap/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index 6b79924d..743d923f 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -3,11 +3,16 @@ module github.com/irisnet/gov-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.4.3 + github.com/irisnet/core-sdk-go v0.1.0 + github.com/regen-network/cosmos-proto v0.3.1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 + gopkg.in/yaml.v2 v2.3.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/gov/go.sum b/module-sdk/gov/go.sum new file mode 100644 index 00000000..e75a9e1e --- /dev/null +++ b/module-sdk/gov/go.sum @@ -0,0 +1,767 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index 4dc534a1..7a172b8f 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -3,11 +3,14 @@ module github.com/irisnet/htlc-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.4.3 + github.com/irisnet/core-sdk-go v0.1.0 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/htlc/go.sum b/module-sdk/htlc/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/htlc/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index a44f0f1b..319ce3cd 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -1,38 +1,38 @@ -module github.com/irisnet/integration-test +module github.com/irisnet/integration-test go 1.16 require ( -github.com/irisnet/module-sdk v0.1.1 -github.com/gogo/protobuf v1.3.3 -github.com/irisnet/coinswap-sdk-go v0.1.0 -github.com/irisnet/core-sdk-go v0.1.0 -github.com/irisnet/gov-sdk-go v0.1.0 -github.com/irisnet/htlc-sdk-go v0.1.0 -github.com/irisnet/nft-sdk-go v0.1.0 -github.com/irisnet/random-sdk-go v0.1.0 -github.com/irisnet/service-sdk-go v0.1.0 -github.com/irisnet/record-sdk-go v0.1.0 -github.com/irisnet/staking-sdk-go v0.1.0 -github.com/irisnet/token-sdk-go v0.1.0 -github.com/irisnet/keys-sdk-go v0.1.0 -github.com/irisnet/oracle-sdk-go v0.1.0 + github.com/irisnet/coinswap-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/gov-sdk-go v0.1.0 + github.com/irisnet/htlc-sdk-go v0.1.0 + github.com/irisnet/keys-sdk-go v0.1.0 + github.com/irisnet/nft-sdk-go v0.1.0 + github.com/irisnet/oracle-sdk-go v0.1.0 + github.com/irisnet/random-sdk-go v0.1.0 + github.com/irisnet/record-sdk-go v0.1.0 + github.com/irisnet/service-sdk-go v0.1.0 + github.com/irisnet/staking-sdk-go v0.1.0 + github.com/irisnet/token-sdk-go v0.1.0 + github.com/stretchr/testify v1.7.0 + github.com/tendermint/tendermint v0.34.11 ) replace ( -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/irisnet/module-sdk => github.com/Nicke-lucky/module-sdk-go 8c6093a2351a9a83e58715becd7dbd2411cc06fa -github.com/irisnet/gov-sdk-go => ../../module-sdk/gov -github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc -github.com/irisnet/nft-sdk-go => ../../module-sdk/nft -github.com/irisnet/random-sdk-go => ../../module-sdk/random -github.com/irisnet/service-sdk-go => ../../module-sdk/service -github.com/irisnet/record-sdk-go => ../../module-sdk/record -github.com/irisnet/staking-sdk-go => ../../module-sdk/staking -github.com/irisnet/token-sdk-go => ../../module-sdk/token -github.com/irisnet/keys-sdk-go => ../../module-sdk/keys -github.com/irisnet/oracle-sdk-go => ../../module-sdk/oracle -github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap + github.com/irisnet/core-sdk-go => ../../../core-sdk + github.com/irisnet/gov-sdk-go => ../../module-sdk/gov + github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc + github.com/irisnet/keys-sdk-go => ../../module-sdk/keys + github.com/irisnet/nft-sdk-go => ../../module-sdk/nft + github.com/irisnet/oracle-sdk-go => ../../module-sdk/oracle + github.com/irisnet/random-sdk-go => ../../module-sdk/random + github.com/irisnet/record-sdk-go => ../../module-sdk/record + github.com/irisnet/service-sdk-go => ../../module-sdk/service + github.com/irisnet/staking-sdk-go => ../../module-sdk/staking + github.com/irisnet/token-sdk-go => ../../module-sdk/token + github.com/tendermint/tendermint => github.com/bianjieai/tendermint v0.34.1-irita-210113 +) diff --git a/module-sdk/integration_test/go.sum b/module-sdk/integration_test/go.sum index ae927da5..5dc02b37 100644 --- a/module-sdk/integration_test/go.sum +++ b/module-sdk/integration_test/go.sum @@ -13,20 +13,29 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= 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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -36,20 +45,27 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= 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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bianjieai/tendermint v0.34.1-irita-210113 h1:p0sDVhwIBScHlJta4zoO5dDbhjBmVKknaM+pwibmi1g= +github.com/bianjieai/tendermint v0.34.1-irita-210113/go.mod h1:NJCKYDQ5I18NZSqS98EVpkdBKILvc+potW7xkV/5BUA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw= github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= 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= @@ -61,7 +77,9 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -69,7 +87,6 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -81,25 +98,28 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= -github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -112,25 +132,33 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= @@ -154,20 +182,24 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= @@ -180,20 +212,20 @@ github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51 github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= @@ -225,6 +257,7 @@ github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -241,24 +274,31 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -281,7 +321,9 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= @@ -290,10 +332,12 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= 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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -309,13 +353,16 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -324,12 +371,14 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= @@ -337,6 +386,7 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -344,27 +394,32 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73DK8Y= github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= @@ -372,19 +427,18 @@ github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPH github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -397,23 +451,24 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= -github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= -github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= -github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= -github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0 h1:8nbaiZG+iVdh+fXVw0DZoZZa7a4TGm3Qab+xdrdzj8s= github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= 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= @@ -423,6 +478,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -451,9 +507,9 @@ golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -493,12 +549,10 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -507,6 +561,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -555,11 +610,13 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -593,6 +650,7 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -620,8 +678,8 @@ google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -639,11 +697,10 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -654,12 +711,14 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -667,6 +726,7 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= @@ -676,7 +736,9 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/module-sdk/keys/go.mod b/module-sdk/keys/go.mod index c6b406a1..6c9e54e2 100644 --- a/module-sdk/keys/go.mod +++ b/module-sdk/keys/go.mod @@ -2,12 +2,9 @@ module ithub.com/irisnet/keys-sdk-go go 1.16 -require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 -) +require github.com/irisnet/core-sdk-go v0.1.0 replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/keys/go.sum b/module-sdk/keys/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/keys/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index fbc4ee7c..a30d3715 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -3,11 +3,13 @@ module github.com/irisnet/nft-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/irisnet/core-sdk-go v0.1.0 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/nft/go.sum b/module-sdk/nft/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/nft/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 13c307e3..23a7eb75 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -3,13 +3,16 @@ module github.com/irisnet/oracle-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/irisnet/service-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.4.3 + github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/service-sdk-go v0.1.0 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 - github.com/irisnet/service-sdk-go => ../../../module-sdk/service -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add + github.com/irisnet/service-sdk-go => ../../../module-sdk/service +) diff --git a/module-sdk/oracle/go.sum b/module-sdk/oracle/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/oracle/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index b1a8c759..1945ecf0 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -3,11 +3,13 @@ module github.com/irisnet/random-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/irisnet/core-sdk-go v0.1.0 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/random/go.sum b/module-sdk/random/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/random/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index 0354527b..3b09feda 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -3,11 +3,13 @@ module github.com/irisnet/record-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/irisnet/core-sdk-go v0.1.0 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/record/go.sum b/module-sdk/record/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/record/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index 80e4af44..1bc07dc1 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -3,11 +3,15 @@ module github.com/irisnet/service-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.4.3 + github.com/irisnet/core-sdk-go v0.1.0 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 + gopkg.in/yaml.v2 v2.3.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add ) \ No newline at end of file diff --git a/module-sdk/service/go.sum b/module-sdk/service/go.sum new file mode 100644 index 00000000..0852c6e2 --- /dev/null +++ b/module-sdk/service/go.sum @@ -0,0 +1,766 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index 9eef7320..ae37f443 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -3,11 +3,17 @@ module github.com/irisnet/staking-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/golang/protobuf v1.4.3 + github.com/irisnet/core-sdk-go v0.1.0 + github.com/regen-network/cosmos-proto v0.3.1 + github.com/tendermint/tendermint v0.34.11 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 + gopkg.in/yaml.v2 v2.3.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/staking/go.sum b/module-sdk/staking/go.sum new file mode 100644 index 00000000..e75a9e1e --- /dev/null +++ b/module-sdk/staking/go.sum @@ -0,0 +1,767 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index 457eb078..d3d7b92d 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -3,11 +3,15 @@ module github.com/irisnet/token-sdk-go go 1.16 require ( - github.com/irisnet/core-sdk-go v0.1.0 - github.com/gogo/protobuf v1.3.3 + github.com/gogo/protobuf v1.3.3 + github.com/irisnet/core-sdk-go v0.1.0 + github.com/regen-network/cosmos-proto v0.3.1 + google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 + google.golang.org/grpc v1.37.0 + gopkg.in/yaml.v2 v2.3.0 ) replace ( -github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go 3f1da92ff70f692ab20a6f7326429de1f5c69a34 -github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 -) \ No newline at end of file + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add +) diff --git a/module-sdk/token/go.sum b/module-sdk/token/go.sum new file mode 100644 index 00000000..e75a9e1e --- /dev/null +++ b/module-sdk/token/go.sum @@ -0,0 +1,767 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= +github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= +github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= +github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= +github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= +github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= +github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= +github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= +github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= +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= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= +github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= +github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= +github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= +github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= +github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= +github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= +github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= +github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= +github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= +github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= +github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= +github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= +github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= +github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= +github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= +github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= +github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= +github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= +github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= +github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= +github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= +github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= +github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= +github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= +github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= +github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= +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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= +github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= +github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= +github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= +github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= +github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= +github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= +github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= +github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= +github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= +github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= +github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= +github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= +github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= +github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= +github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= +github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= +github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= +github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= +go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= +go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= +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= +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= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= +golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +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-20180826012351-8a410e7b638d/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= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= +gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= +sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= From b664ca715648e956658500aed89133cc90559acb Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 6 Jul 2021 20:14:26 +0800 Subject: [PATCH 28/41] =?UTF-8?q?1=E3=80=81fix=20go=20mod=202=E3=80=81fix?= =?UTF-8?q?=20=20coinswap=20test=203=E3=80=81fix=20token=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module-sdk/coinswap/coinswap.go | 2 +- module-sdk/integration_test/go.mod | 2 +- module-sdk/integration_test/staking_test.go | 4 ---- module-sdk/token/token.go | 23 ++++++++++++++++++++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/module-sdk/coinswap/coinswap.go b/module-sdk/coinswap/coinswap.go index 666065f7..e72860dd 100644 --- a/module-sdk/coinswap/coinswap.go +++ b/module-sdk/coinswap/coinswap.go @@ -242,7 +242,7 @@ func (swap coinswapClient) SellTokenWithAutoEstimate(gotTokenDenom string, soldC func (swap coinswapClient) QueryPool(denom string) (*QueryPoolResponse, error) { conn, err := swap.GenConn() - defer func() { _ = conn.Close() }() + if err != nil { return nil, sdk.Wrap(err) } diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index 319ce3cd..b58cd904 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -23,7 +23,7 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap - github.com/irisnet/core-sdk-go => ../../../core-sdk + github.com/irisnet/core-sdk-go => ../../core-sdk github.com/irisnet/gov-sdk-go => ../../module-sdk/gov github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc github.com/irisnet/keys-sdk-go => ../../module-sdk/keys diff --git a/module-sdk/integration_test/staking_test.go b/module-sdk/integration_test/staking_test.go index cac65f67..9a48f2d9 100644 --- a/module-sdk/integration_test/staking_test.go +++ b/module-sdk/integration_test/staking_test.go @@ -15,10 +15,6 @@ func (s IntegrationTestSuite) TestStaking() { "TestStaking", testStaking, }, - //{ - // "TestCreateAndEdit", - // testCreateAndEdit, - //}, { "TestQueryHistoricalInfo", queryHistoricalInfo, diff --git a/module-sdk/token/token.go b/module-sdk/token/token.go index 8869d7e1..a6a94b35 100644 --- a/module-sdk/token/token.go +++ b/module-sdk/token/token.go @@ -112,7 +112,28 @@ func (t tokenClient) MintToken(symbol string, amount uint64, to string, baseTx s } func (t tokenClient) QueryToken(denom string) (sdk.Token, error) { - return t.BaseClient.QueryToken(denom) + conn, err := t.GenConn() + if err != nil { + return sdk.Token{}, sdk.Wrap(err) + } + + request := &QueryTokenRequest{ + Denom: denom, + } + res, err := NewQueryClient(conn).Token(context.Background(), request) + if err != nil { + return sdk.Token{}, err + } + var evi TokenInterface + if err = t.UnpackAny(res.Token, &evi); err != nil { + return sdk.Token{}, err + } + tokens := make(Tokens, 0) + tokens = append(tokens, evi.(*Token)) + ts := tokens.Convert().(sdk.Tokens) + t.SaveTokens(ts...) + //return t.BaseClient.QueryToken(denom) + return ts[0], nil } func (t tokenClient) QueryTokens(owner string) (sdk.Tokens, error) { From a2c7a9bb6af76d1ac3b80ff81e4ca1967eb35421 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Wed, 7 Jul 2021 13:59:31 +0800 Subject: [PATCH 29/41] =?UTF-8?q?1=E3=80=81fix=20token.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module-sdk/token/token.go | 1 - 1 file changed, 1 deletion(-) diff --git a/module-sdk/token/token.go b/module-sdk/token/token.go index a6a94b35..8254ea04 100644 --- a/module-sdk/token/token.go +++ b/module-sdk/token/token.go @@ -132,7 +132,6 @@ func (t tokenClient) QueryToken(denom string) (sdk.Token, error) { tokens = append(tokens, evi.(*Token)) ts := tokens.Convert().(sdk.Tokens) t.SaveTokens(ts...) - //return t.BaseClient.QueryToken(denom) return ts[0], nil } From d8c720fa08ada0b4b1c091ab0d80d16814797545 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Thu, 8 Jul 2021 16:52:23 +0800 Subject: [PATCH 30/41] =?UTF-8?q?1=E3=80=81fix=20base=5Fclient?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core-sdk/client/base_client.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-sdk/client/base_client.go b/core-sdk/client/base_client.go index 774bba73..8cd3c749 100644 --- a/core-sdk/client/base_client.go +++ b/core-sdk/client/base_client.go @@ -63,8 +63,7 @@ func NewBaseClient(cfg sdktypes.ClientConfig, encodingConfig sdktypes.EncodingCo cfg: &cfg, encodingConfig: encodingConfig, l: NewLocker(concurrency).setLogger(logger), - //KeyManager: cfg.KeyManager, - TokenManager: cfg.TokenManager, + TokenManager: cfg.TokenManager, } base.KeyManager = keyManager{ From acd89f451fb33c8125f53fcaaef7ac9595328e5c Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Thu, 8 Jul 2021 18:06:05 +0800 Subject: [PATCH 31/41] =?UTF-8?q?1=E3=80=81fix=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module-sdk/integration_test/client.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/module-sdk/integration_test/client.go b/module-sdk/integration_test/client.go index 985c1050..fe738060 100644 --- a/module-sdk/integration_test/client.go +++ b/module-sdk/integration_test/client.go @@ -130,9 +130,7 @@ func (client Client) Manager() types.BaseClient { func (client Client) RegisterModule(ms ...types.Module) { for _, m := range ms { - // m.RegisterCodec(client.encodingConfig.Amino) m.RegisterInterfaceTypes(client.encodingConfig.InterfaceRegistry) - } } From 1e10e662fd0951e5fb325d54882478e0a494fb00 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 12 Jul 2021 13:59:07 +0800 Subject: [PATCH 32/41] modify grpc client --- core-sdk/bank/bank.go | 1 - core-sdk/client/grpc_client.go | 15 ++------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/core-sdk/bank/bank.go b/core-sdk/bank/bank.go index a03459fd..b4b7b673 100644 --- a/core-sdk/bank/bank.go +++ b/core-sdk/bank/bank.go @@ -45,7 +45,6 @@ func (b bankClient) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { // TotalSupply queries the total supply of all coins. func (b bankClient) TotalSupply() (sdk.Coins, sdk.Error) { conn, err := b.GenConn() - defer func() { _ = conn.Close() }() if err != nil { return nil, sdk.Wrap(err) } diff --git a/core-sdk/client/grpc_client.go b/core-sdk/client/grpc_client.go index 5a9b7fad..81a6b99a 100644 --- a/core-sdk/client/grpc_client.go +++ b/core-sdk/client/grpc_client.go @@ -1,14 +1,10 @@ package client import ( - "sync" - "time" - + "github.com/irisnet/core-sdk-go/types" "github.com/prometheus/common/log" "google.golang.org/grpc" - "google.golang.org/grpc/keepalive" - - "github.com/irisnet/core-sdk-go/types" + "sync" ) var clientConnSingleton *grpc.ClientConn @@ -19,15 +15,8 @@ type grpcClient struct { func NewGRPCClient(url string) types.GRPCClient { once.Do(func() { - var kacp = keepalive.ClientParameters{ - Time: 10 * time.Second, // send pings every 10 seconds if there is no activity - Timeout: time.Second, // wait 1 second for ping ack before considering the connection dead - PermitWithoutStream: true, // send pings even without active streams - } - dialOpts := []grpc.DialOption{ grpc.WithInsecure(), - grpc.WithKeepaliveParams(kacp), } clientConn, err := grpc.Dial(url, dialOpts...) if err != nil { From 8621bd4e8014ca90ba518430d20e87597860daba Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 12 Jul 2021 16:29:59 +0800 Subject: [PATCH 33/41] fix go mod --- core-sdk/client/grpc_client.go | 7 ++++--- module-sdk/coinswap/go.mod | 8 ++------ module-sdk/coinswap/go.sum | 4 ++-- module-sdk/gov/go.mod | 7 ++----- module-sdk/gov/go.sum | 4 ++-- module-sdk/htlc/go.mod | 7 ++----- module-sdk/htlc/go.sum | 4 ++-- module-sdk/integration_test/go.mod | 3 +-- module-sdk/integration_test/go.sum | 4 ++-- module-sdk/keys/go.mod | 7 ++----- module-sdk/keys/go.sum | 4 ++-- module-sdk/nft/go.mod | 7 ++----- module-sdk/nft/go.sum | 4 ++-- module-sdk/oracle/go.mod | 5 ++--- module-sdk/oracle/go.sum | 4 ++-- module-sdk/random/go.mod | 7 ++----- module-sdk/random/go.sum | 4 ++-- module-sdk/record/go.mod | 7 ++----- module-sdk/record/go.sum | 4 ++-- module-sdk/service/go.mod | 7 ++----- module-sdk/service/go.sum | 4 ++-- module-sdk/staking/go.mod | 7 ++----- module-sdk/staking/go.sum | 4 ++-- module-sdk/token/go.mod | 7 ++----- module-sdk/token/go.sum | 4 ++-- 25 files changed, 51 insertions(+), 83 deletions(-) diff --git a/core-sdk/client/grpc_client.go b/core-sdk/client/grpc_client.go index 81a6b99a..f0af1956 100644 --- a/core-sdk/client/grpc_client.go +++ b/core-sdk/client/grpc_client.go @@ -1,10 +1,12 @@ package client import ( - "github.com/irisnet/core-sdk-go/types" + "sync" + "github.com/prometheus/common/log" "google.golang.org/grpc" - "sync" + + "github.com/irisnet/core-sdk-go/types" ) var clientConnSingleton *grpc.ClientConn @@ -25,7 +27,6 @@ func NewGRPCClient(url string) types.GRPCClient { } clientConnSingleton = clientConn }) - return &grpcClient{} } diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index 6f57c45a..ebf6b0d7 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -4,13 +4,9 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => ../../../core-sdk -) - +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/coinswap/go.sum b/module-sdk/coinswap/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/coinswap/go.sum +++ b/module-sdk/coinswap/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index 743d923f..fc778f3b 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -5,14 +5,11 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 github.com/regen-network/cosmos-proto v0.3.1 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 gopkg.in/yaml.v2 v2.3.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/gov/go.sum b/module-sdk/gov/go.sum index e75a9e1e..40f5f630 100644 --- a/module-sdk/gov/go.sum +++ b/module-sdk/gov/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index 7a172b8f..110900d1 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -5,12 +5,9 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/htlc/go.sum b/module-sdk/htlc/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/htlc/go.sum +++ b/module-sdk/htlc/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index b58cd904..be84e7f4 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/irisnet/coinswap-sdk-go v0.1.0 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 github.com/irisnet/gov-sdk-go v0.1.0 github.com/irisnet/htlc-sdk-go v0.1.0 github.com/irisnet/keys-sdk-go v0.1.0 @@ -23,7 +23,6 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap - github.com/irisnet/core-sdk-go => ../../core-sdk github.com/irisnet/gov-sdk-go => ../../module-sdk/gov github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc github.com/irisnet/keys-sdk-go => ../../module-sdk/keys diff --git a/module-sdk/integration_test/go.sum b/module-sdk/integration_test/go.sum index 5dc02b37..7093ac6f 100644 --- a/module-sdk/integration_test/go.sum +++ b/module-sdk/integration_test/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -254,6 +252,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/keys/go.mod b/module-sdk/keys/go.mod index 6c9e54e2..9ef3ffd0 100644 --- a/module-sdk/keys/go.mod +++ b/module-sdk/keys/go.mod @@ -2,9 +2,6 @@ module ithub.com/irisnet/keys-sdk-go go 1.16 -require github.com/irisnet/core-sdk-go v0.1.0 +require github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/keys/go.sum b/module-sdk/keys/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/keys/go.sum +++ b/module-sdk/keys/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index a30d3715..46a3994e 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -4,12 +4,9 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/nft/go.sum b/module-sdk/nft/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/nft/go.sum +++ b/module-sdk/nft/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 23a7eb75..8c8e7a36 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 github.com/irisnet/service-sdk-go v0.1.0 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 @@ -13,6 +13,5 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add - github.com/irisnet/service-sdk-go => ../../../module-sdk/service + github.com/irisnet/service-sdk-go => ../../module-sdk/service ) diff --git a/module-sdk/oracle/go.sum b/module-sdk/oracle/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/oracle/go.sum +++ b/module-sdk/oracle/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index 1945ecf0..c2026172 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -4,12 +4,9 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/random/go.sum b/module-sdk/random/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/random/go.sum +++ b/module-sdk/random/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index 3b09feda..7a198074 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -4,12 +4,9 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/record/go.sum b/module-sdk/record/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/record/go.sum +++ b/module-sdk/record/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index 1bc07dc1..f4d98228 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -5,13 +5,10 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 gopkg.in/yaml.v2 v2.3.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) \ No newline at end of file +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/service/go.sum b/module-sdk/service/go.sum index 0852c6e2..869f356b 100644 --- a/module-sdk/service/go.sum +++ b/module-sdk/service/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index ae37f443..ddcda130 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 github.com/regen-network/cosmos-proto v0.3.1 github.com/tendermint/tendermint v0.34.11 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 @@ -13,7 +13,4 @@ require ( gopkg.in/yaml.v2 v2.3.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/staking/go.sum b/module-sdk/staking/go.sum index e75a9e1e..40f5f630 100644 --- a/module-sdk/staking/go.sum +++ b/module-sdk/staking/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index d3d7b92d..13161e29 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -4,14 +4,11 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.1.0 + github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 github.com/regen-network/cosmos-proto v0.3.1 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 gopkg.in/yaml.v2 v2.3.0 ) -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/core-sdk-go => github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add -) +replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/token/go.sum b/module-sdk/token/go.sum index e75a9e1e..40f5f630 100644 --- a/module-sdk/token/go.sum +++ b/module-sdk/token/go.sum @@ -18,8 +18,6 @@ github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1: github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add h1:qxDexErlzSdZo8OSUETb6NMSCtVBWl3A9djHEvjG19g= -github.com/Nicke-lucky/core-sdk-go v0.0.0-20210706063401-ba48b2920add/go.mod h1:0vpYjS6BdH3NEFXdQJQZGvI35aUXmYj8lk2UXPTm4Lc= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -257,6 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= +github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= From ad6aa2915f7516802ff861ee7e86f9555bac2981 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 12 Jul 2021 18:46:17 +0800 Subject: [PATCH 34/41] fix baseClient Interface to streamline --- core-sdk/client.go | 11 +++++-- core-sdk/client/account.go | 20 ++++++------ core-sdk/client/base_client.go | 40 +++++++++++------------ core-sdk/client/keys.go | 58 +++++++++++++++++----------------- core-sdk/types/client.go | 2 +- 5 files changed, 67 insertions(+), 64 deletions(-) diff --git a/core-sdk/client.go b/core-sdk/client.go index 39a7b3ef..703491d9 100644 --- a/core-sdk/client.go +++ b/core-sdk/client.go @@ -17,6 +17,7 @@ type Client struct { moduleManager map[string]types.Module encodingConfig types.EncodingConfig types.BaseClient + types.KeyManager Bank bank.Client } @@ -25,19 +26,23 @@ func NewClient(cfg types.ClientConfig) Client { // create a instance of baseClient baseClient := client.NewBaseClient(cfg, encodingConfig, nil) + bankClient := bank.NewClient(baseClient, encodingConfig.Marshaler) - client := &Client{ + client := Client{ logger: baseClient.Logger(), BaseClient: baseClient, moduleManager: make(map[string]types.Module), encodingConfig: encodingConfig, - + KeyManager: client.KeyManager{ + KeyDAO: cfg.KeyDAO, + Algo: cfg.Algo, + }, Bank: bankClient, } client.RegisterModule( bankClient, ) - return *client + return client } func (client *Client) SetLogger(logger log.Logger) { diff --git a/core-sdk/client/account.go b/core-sdk/client/account.go index 21c78b62..73317092 100644 --- a/core-sdk/client/account.go +++ b/core-sdk/client/account.go @@ -15,17 +15,17 @@ import ( ) // Must be used with locker, otherwise there are thread safety issues -type accountQuery struct { +type AccountQuery struct { sdk.Queries sdk.GRPCClient log.Logger cache.Cache cdc commoncodec.Marshaler - km sdk.KeyManager + Km sdk.KeyManager expiration time.Duration } -func (a accountQuery) QueryAndRefreshAccount(address string) (sdk.BaseAccount, sdk.Error) { +func (a AccountQuery) QueryAndRefreshAccount(address string) (sdk.BaseAccount, sdk.Error) { account, err := a.Get(a.prefixKey(address)) if err != nil { return a.refresh(address) @@ -43,7 +43,7 @@ func (a accountQuery) QueryAndRefreshAccount(address string) (sdk.BaseAccount, s return baseAcc, nil } -func (a accountQuery) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { +func (a AccountQuery) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { conn, err := a.GenConn() if err != nil { @@ -79,7 +79,7 @@ func (a accountQuery) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) return account, nil } -func (a accountQuery) QueryAddress(name, password string) (sdk.AccAddress, sdk.Error) { +func (a AccountQuery) QueryAddress(name, password string) (sdk.AccAddress, sdk.Error) { addr, err := a.Get(a.prefixKey(name)) if err == nil { address, err := sdk.AccAddressFromBech32(addr.(string)) @@ -91,7 +91,7 @@ func (a accountQuery) QueryAddress(name, password string) (sdk.AccAddress, sdk.E } } - _, address, err := a.km.Find(name, password) + _, address, err := a.Km.Find(name, password) if err != nil { a.Debug("can't find account", "name", name) return address, sdk.Wrap(err) @@ -104,11 +104,11 @@ func (a accountQuery) QueryAddress(name, password string) (sdk.AccAddress, sdk.E return address, nil } -func (a accountQuery) removeCache(address string) bool { +func (a AccountQuery) removeCache(address string) bool { return a.Remove(a.prefixKey(address)) } -func (a accountQuery) refresh(address string) (sdk.BaseAccount, sdk.Error) { +func (a AccountQuery) refresh(address string) (sdk.BaseAccount, sdk.Error) { account, err := a.QueryAccount(address) if err != nil { a.Error("update cache failed", "address", address, "errMsg", err.Error()) @@ -119,7 +119,7 @@ func (a accountQuery) refresh(address string) (sdk.BaseAccount, sdk.Error) { return account, nil } -func (a accountQuery) saveAccount(account sdk.BaseAccount) { +func (a AccountQuery) saveAccount(account sdk.BaseAccount) { address := account.Address info := accountInfo{ N: account.AccountNumber, @@ -132,7 +132,7 @@ func (a accountQuery) saveAccount(account sdk.BaseAccount) { a.Debug("cache account", "address", address, "expiration", a.expiration.String()) } -func (a accountQuery) prefixKey(address string) string { +func (a AccountQuery) prefixKey(address string) string { return fmt.Sprintf("account:%s", address) } diff --git a/core-sdk/client/base_client.go b/core-sdk/client/base_client.go index 8cd3c749..b4ddedfa 100644 --- a/core-sdk/client/base_client.go +++ b/core-sdk/client/base_client.go @@ -17,6 +17,8 @@ import ( "github.com/tendermint/tendermint/libs/log" rpcclient "github.com/tendermint/tendermint/rpc/client" + "google.golang.org/grpc" + "github.com/irisnet/core-sdk-go/common" commoncache "github.com/irisnet/core-sdk-go/common/cache" commoncodec "github.com/irisnet/core-sdk-go/common/codec" @@ -35,15 +37,11 @@ const ( type baseClient struct { sdktypes.TmClient - sdktypes.GRPCClient sdktypes.TokenManager - sdktypes.KeyManager - logger log.Logger cfg *sdktypes.ClientConfig encodingConfig sdktypes.EncodingConfig - - l *locker - accountQuery + l *locker + AccountQuery } // NewBaseClient return the baseClient for every sub modules @@ -58,38 +56,34 @@ func NewBaseClient(cfg sdktypes.ClientConfig, encodingConfig sdktypes.EncodingCo base := baseClient{ TmClient: NewRPCClient(cfg.NodeURI, encodingConfig.Amino, encodingConfig.TxConfig.TxDecoder(), logger, cfg.Timeout), - GRPCClient: NewGRPCClient(cfg.GRPCAddr), - logger: logger, cfg: &cfg, encodingConfig: encodingConfig, l: NewLocker(concurrency).setLogger(logger), TokenManager: cfg.TokenManager, } - base.KeyManager = keyManager{ - keyDAO: cfg.KeyDAO, - algo: cfg.Algo, - } - c := commoncache.NewCache(cacheCapacity, cfg.Cached) - base.accountQuery = accountQuery{ + base.AccountQuery = AccountQuery{ Queries: base, - GRPCClient: base.GRPCClient, - Logger: base.Logger(), + GRPCClient: NewGRPCClient(cfg.GRPCAddr), + Logger: logger, Cache: c, cdc: encodingConfig.Marshaler, - km: base.KeyManager, + Km: KeyManager{ + KeyDAO: cfg.KeyDAO, + Algo: cfg.Algo, + }, expiration: cacheExpirePeriod, } return &base } func (base *baseClient) Logger() log.Logger { - return base.logger + return base.AccountQuery.Logger } func (base *baseClient) SetLogger(logger log.Logger) { - base.logger = logger + base.AccountQuery.Logger = logger } // Codec returns codec. @@ -97,6 +91,10 @@ func (base *baseClient) Marshaler() commoncodec.Marshaler { return base.encodingConfig.Marshaler } +func (base *baseClient) GenConn() (*grpc.ClientConn, error) { + return base.AccountQuery.GenConn() +} + func (base *baseClient) BuildTxHash(msg []sdktypes.Msg, baseTx sdktypes.BaseTx) (string, sdktypes.Error) { txByte, _, err := base.buildTx(msg, baseTx) if err != nil { @@ -324,7 +322,7 @@ func (base baseClient) QueryStore(key sdktypes.HexBytes, storeName string, heigh func (base *baseClient) prepare(baseTx sdktypes.BaseTx) (*sdktypes.Factory, error) { factory := sdktypes.NewFactory(). WithChainID(base.cfg.ChainID). - WithKeyManager(base.KeyManager). + WithKeyManager(base.AccountQuery.Km). WithMode(base.cfg.Mode). WithSimulateAndExecute(baseTx.SimulateAndExecute). WithGas(base.cfg.Gas). @@ -383,7 +381,7 @@ func (base *baseClient) prepare(baseTx sdktypes.BaseTx) (*sdktypes.Factory, erro func (base *baseClient) prepareWithAccount(addr string, accountNumber, sequence uint64, baseTx sdktypes.BaseTx) (*sdktypes.Factory, error) { factory := sdktypes.NewFactory(). WithChainID(base.cfg.ChainID). - WithKeyManager(base.KeyManager). + WithKeyManager(base.AccountQuery.Km). WithMode(base.cfg.Mode). WithSimulateAndExecute(baseTx.SimulateAndExecute). WithGas(base.cfg.Gas). diff --git a/core-sdk/client/keys.go b/core-sdk/client/keys.go index 7e9955bc..313f76c5 100644 --- a/core-sdk/client/keys.go +++ b/core-sdk/client/keys.go @@ -14,18 +14,18 @@ import ( "github.com/irisnet/core-sdk-go/types/store" ) -type keyManager struct { - keyDAO store.KeyDAO - algo string +type KeyManager struct { + KeyDAO store.KeyDAO + Algo string } -func (k keyManager) Add(name, password string) (string, string, types.Error) { +func (k KeyManager) Add(name, password string) (string, string, types.Error) { address, mnemonic, err := k.Insert(name, password) return address, mnemonic, types.Wrap(err) } -func (k keyManager) Sign(name, password string, data []byte) ([]byte, tmcrypto.PubKey, error) { - info, err := k.keyDAO.Read(name, password) +func (k KeyManager) Sign(name, password string, data []byte) ([]byte, tmcrypto.PubKey, error) { + info, err := k.KeyDAO.Read(name, password) if err != nil { return nil, nil, fmt.Errorf("name %s not exist", name) } @@ -43,12 +43,12 @@ func (k keyManager) Sign(name, password string, data []byte) ([]byte, tmcrypto.P return signByte, FromTmPubKey(info.Algo, km.ExportPubKey()), nil } -func (k keyManager) Insert(name, password string) (string, string, error) { - if k.keyDAO.Has(name) { +func (k KeyManager) Insert(name, password string) (string, string, error) { + if k.KeyDAO.Has(name) { return "", "", fmt.Errorf("name %s has existed", name) } - km, err := kmg.NewAlgoKeyManager(k.algo) + km, err := kmg.NewAlgoKeyManager(k.Algo) if err != nil { return "", "", err } @@ -62,17 +62,17 @@ func (k keyManager) Insert(name, password string) (string, string, error) { Name: name, PubKey: cryptoamino.MarshalPubkey(pubKey), PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.algo, + Algo: k.Algo, } - if err = k.keyDAO.Write(name, password, info); err != nil { + if err = k.KeyDAO.Write(name, password, info); err != nil { return "", "", err } return address, mnemonic, nil } -func (k keyManager) Recover(name, password, mnemonic, hdPath string) (string, error) { - if k.keyDAO.Has(name) { +func (k KeyManager) Recover(name, password, mnemonic, hdPath string) (string, error) { + if k.KeyDAO.Has(name) { return "", fmt.Errorf("name %s has existed", name) } var ( @@ -80,9 +80,9 @@ func (k keyManager) Recover(name, password, mnemonic, hdPath string) (string, er err error ) if hdPath == "" { - km, err = kmg.NewMnemonicKeyManager(mnemonic, k.algo) + km, err = kmg.NewMnemonicKeyManager(mnemonic, k.Algo) } else { - km, err = kmg.NewMnemonicKeyManagerWithHDPath(mnemonic, k.algo, hdPath) + km, err = kmg.NewMnemonicKeyManagerWithHDPath(mnemonic, k.Algo, hdPath) } if err != nil { @@ -98,18 +98,18 @@ func (k keyManager) Recover(name, password, mnemonic, hdPath string) (string, er Name: name, PubKey: cryptoamino.MarshalPubkey(pubKey), PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.algo, + Algo: k.Algo, } - if err = k.keyDAO.Write(name, password, info); err != nil { + if err = k.KeyDAO.Write(name, password, info); err != nil { return "", err } return address, nil } -func (k keyManager) Import(name, password, armor string) (string, error) { - if k.keyDAO.Has(name) { +func (k KeyManager) Import(name, password, armor string) (string, error) { + if k.KeyDAO.Has(name) { return "", fmt.Errorf("%s has existed", name) } @@ -127,18 +127,18 @@ func (k keyManager) Import(name, password, armor string) (string, error) { Name: name, PubKey: cryptoamino.MarshalPubkey(pubKey), PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.algo, + Algo: k.Algo, } - err = k.keyDAO.Write(name, password, info) + err = k.KeyDAO.Write(name, password, info) if err != nil { return "", err } return address, nil } -func (k keyManager) Export(name, password string) (armor string, err error) { - info, err := k.keyDAO.Read(name, password) +func (k KeyManager) Export(name, password string) (armor string, err error) { + info, err := k.KeyDAO.Read(name, password) if err != nil { return armor, fmt.Errorf("name %s not exist", name) } @@ -151,12 +151,12 @@ func (k keyManager) Export(name, password string) (armor string, err error) { return km.ExportPrivKey(password) } -func (k keyManager) Delete(name, password string) error { - return k.keyDAO.Delete(name, password) +func (k KeyManager) Delete(name, password string) error { + return k.KeyDAO.Delete(name, password) } -func (k keyManager) Find(name, password string) (tmcrypto.PubKey, types.AccAddress, error) { - info, err := k.keyDAO.Read(name, password) +func (k KeyManager) Find(name, password string) (tmcrypto.PubKey, types.AccAddress, error) { + info, err := k.KeyDAO.Read(name, password) if err != nil { return nil, nil, types.WrapWithMessage(err, "name %s not exist", name) } @@ -169,10 +169,10 @@ func (k keyManager) Find(name, password string) (tmcrypto.PubKey, types.AccAddre return FromTmPubKey(info.Algo, pubKey), types.AccAddress(pubKey.Address().Bytes()), nil } -func FromTmPubKey(algo string, pubKey tmcrypto.PubKey) commoncryptotypes.PubKey { +func FromTmPubKey(Algo string, pubKey tmcrypto.PubKey) commoncryptotypes.PubKey { var pubkey commoncryptotypes.PubKey pubkeyBytes := pubKey.Bytes() - switch algo { + switch Algo { case "sm2": pubkey = &sm2.PubKey{Key: pubkeyBytes} case "secp256k1": diff --git a/core-sdk/types/client.go b/core-sdk/types/client.go index bb182ace..769aef1d 100644 --- a/core-sdk/types/client.go +++ b/core-sdk/types/client.go @@ -61,9 +61,9 @@ type Logger interface { type BaseClient interface { TokenManager TxManager - KeyManager Queries TmClient Logger GRPCClient + // KeyManager } From a79fdba73a0c611106ac1001a3684221c944896a Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 13 Jul 2021 16:41:52 +0800 Subject: [PATCH 35/41] fix baseClient Interface to streamline --- core-sdk/client/base_client.go | 10 +- core-sdk/client/keys.go | 56 ++ core-sdk/types/client.go | 2 +- module-sdk/integration_test/client.go | 4 +- module-sdk/integration_test/go.mod | 4 +- module-sdk/integration_test/go.sum | 3 +- module-sdk/keys/doc.go | 17 - module-sdk/keys/export.go | 15 - module-sdk/keys/go.mod | 7 - module-sdk/keys/go.sum | 766 -------------------------- module-sdk/keys/keys.go | 51 -- 11 files changed, 68 insertions(+), 867 deletions(-) delete mode 100644 module-sdk/keys/doc.go delete mode 100644 module-sdk/keys/export.go delete mode 100644 module-sdk/keys/go.mod delete mode 100644 module-sdk/keys/go.sum delete mode 100644 module-sdk/keys/keys.go diff --git a/core-sdk/client/base_client.go b/core-sdk/client/base_client.go index b4ddedfa..4573755b 100644 --- a/core-sdk/client/base_client.go +++ b/core-sdk/client/base_client.go @@ -38,6 +38,7 @@ const ( type baseClient struct { sdktypes.TmClient sdktypes.TokenManager + sdktypes.KeyManager cfg *sdktypes.ClientConfig encodingConfig sdktypes.EncodingConfig l *locker @@ -61,6 +62,10 @@ func NewBaseClient(cfg sdktypes.ClientConfig, encodingConfig sdktypes.EncodingCo l: NewLocker(concurrency).setLogger(logger), TokenManager: cfg.TokenManager, } + base.KeyManager = KeyManager{ + KeyDAO: cfg.KeyDAO, + Algo: cfg.Algo, + } c := commoncache.NewCache(cacheCapacity, cfg.Cached) base.AccountQuery = AccountQuery{ @@ -69,10 +74,7 @@ func NewBaseClient(cfg sdktypes.ClientConfig, encodingConfig sdktypes.EncodingCo Logger: logger, Cache: c, cdc: encodingConfig.Marshaler, - Km: KeyManager{ - KeyDAO: cfg.KeyDAO, - Algo: cfg.Algo, - }, + Km: base.KeyManager, expiration: cacheExpirePeriod, } return &base diff --git a/core-sdk/client/keys.go b/core-sdk/client/keys.go index 313f76c5..831831f8 100644 --- a/core-sdk/client/keys.go +++ b/core-sdk/client/keys.go @@ -180,3 +180,59 @@ func FromTmPubKey(Algo string, pubKey tmcrypto.PubKey) commoncryptotypes.PubKey } return pubkey } + +type Client interface { + Add(name, password string) (address string, mnemonic string, err types.Error) + Recover(name, password, mnemonic string) (address string, err types.Error) + RecoverWithHDPath(name, password, mnemonic, hdPath string) (address string, err types.Error) + Import(name, password, privKeyArmor string) (address string, err types.Error) + Export(name, password string) (privKeyArmor string, err types.Error) + Delete(name, password string) types.Error + Show(name, password string) (string, types.Error) +} + +type keysClient struct { + types.KeyManager +} + +func NewClient(keyManager types.KeyManager) Client { + return keysClient{keyManager} +} + +func (k keysClient) Add(name, password string) (string, string, types.Error) { + address, mnemonic, err := k.Insert(name, password) + return address, mnemonic, types.Wrap(err) +} + +func (k keysClient) Recover(name, password, mnemonic string) (string, types.Error) { + address, err := k.KeyManager.Recover(name, password, mnemonic, "") + return address, types.Wrap(err) +} + +func (k keysClient) RecoverWithHDPath(name, password, mnemonic, hdPath string) (string, types.Error) { + address, err := k.KeyManager.Recover(name, password, mnemonic, hdPath) + return address, types.Wrap(err) +} + +func (k keysClient) Import(name, password, privKeyArmor string) (string, types.Error) { + address, err := k.KeyManager.Import(name, password, privKeyArmor) + return address, types.Wrap(err) +} + +func (k keysClient) Export(name, password string) (string, types.Error) { + keystore, err := k.KeyManager.Export(name, password) + return keystore, types.Wrap(err) +} + +func (k keysClient) Delete(name, password string) types.Error { + err := k.KeyManager.Delete(name, password) + return types.Wrap(err) +} + +func (k keysClient) Show(name, password string) (string, types.Error) { + _, address, err := k.KeyManager.Find(name, password) + if err != nil { + return "", types.Wrap(err) + } + return address.String(), nil +} diff --git a/core-sdk/types/client.go b/core-sdk/types/client.go index 769aef1d..38c334fb 100644 --- a/core-sdk/types/client.go +++ b/core-sdk/types/client.go @@ -65,5 +65,5 @@ type BaseClient interface { TmClient Logger GRPCClient - // KeyManager + KeyManager } diff --git a/module-sdk/integration_test/client.go b/module-sdk/integration_test/client.go index fe738060..be378250 100644 --- a/module-sdk/integration_test/client.go +++ b/module-sdk/integration_test/client.go @@ -22,12 +22,12 @@ import ( "github.com/irisnet/random-sdk-go" + keys "github.com/irisnet/core-sdk-go/client" + "github.com/irisnet/oracle-sdk-go" "github.com/irisnet/nft-sdk-go" - "github.com/irisnet/keys-sdk-go" - "github.com/irisnet/htlc-sdk-go" "github.com/irisnet/gov-sdk-go" diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index be84e7f4..2187ccf5 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -4,10 +4,9 @@ go 1.16 require ( github.com/irisnet/coinswap-sdk-go v0.1.0 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210713083711-a3be069f0258 github.com/irisnet/gov-sdk-go v0.1.0 github.com/irisnet/htlc-sdk-go v0.1.0 - github.com/irisnet/keys-sdk-go v0.1.0 github.com/irisnet/nft-sdk-go v0.1.0 github.com/irisnet/oracle-sdk-go v0.1.0 github.com/irisnet/random-sdk-go v0.1.0 @@ -25,7 +24,6 @@ replace ( github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap github.com/irisnet/gov-sdk-go => ../../module-sdk/gov github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc - github.com/irisnet/keys-sdk-go => ../../module-sdk/keys github.com/irisnet/nft-sdk-go => ../../module-sdk/nft github.com/irisnet/oracle-sdk-go => ../../module-sdk/oracle github.com/irisnet/random-sdk-go => ../../module-sdk/random diff --git a/module-sdk/integration_test/go.sum b/module-sdk/integration_test/go.sum index 7093ac6f..c8e02782 100644 --- a/module-sdk/integration_test/go.sum +++ b/module-sdk/integration_test/go.sum @@ -252,8 +252,9 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210713083711-a3be069f0258 h1:IoJdAlVfUmxBNQa3xyTov1K8zdJU3tZavbcIxrPFdkQ= +github.com/irisnet/core-sdk-go v0.0.0-20210713083711-a3be069f0258/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/keys/doc.go b/module-sdk/keys/doc.go deleted file mode 100644 index 1ce83fdf..00000000 --- a/module-sdk/keys/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Package keys allows you to manage your local tendermint keystore (wallets) for iris. -// -// **NOTE:** You need to implement the [[KeyDAO]] Interface first. -// -// As a quick start: -// -// CreateRecord a new key. -// -// client := test.NewClient() -// name, password := "test2", "1234567890" -// -// address, mnemonic, err := client.KeyI.Add(name, password) -// require.NoError(client.T(), err) -// require.NotEmpty(client.T(), address) -// require.NotEmpty(client.T(), mnemonic) -// -package keys diff --git a/module-sdk/keys/export.go b/module-sdk/keys/export.go deleted file mode 100644 index cf647732..00000000 --- a/module-sdk/keys/export.go +++ /dev/null @@ -1,15 +0,0 @@ -package keys - -import ( - sdk "github.com/irisnet/core-sdk-go/types" -) - -type Client interface { - Add(name, password string) (address string, mnemonic string, err sdk.Error) - Recover(name, password, mnemonic string) (address string, err sdk.Error) - RecoverWithHDPath(name, password, mnemonic, hdPath string) (address string, err sdk.Error) - Import(name, password, privKeyArmor string) (address string, err sdk.Error) - Export(name, password string) (privKeyArmor string, err sdk.Error) - Delete(name, password string) sdk.Error - Show(name, password string) (string, sdk.Error) -} diff --git a/module-sdk/keys/go.mod b/module-sdk/keys/go.mod deleted file mode 100644 index 9ef3ffd0..00000000 --- a/module-sdk/keys/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module ithub.com/irisnet/keys-sdk-go - -go 1.16 - -require github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 - -replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/module-sdk/keys/go.sum b/module-sdk/keys/go.sum deleted file mode 100644 index 869f356b..00000000 --- a/module-sdk/keys/go.sum +++ /dev/null @@ -1,766 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= -github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= -github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= -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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -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= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= -github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= -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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/confio/ics23/go v0.0.0-20200817220745-f173e6211efb/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/iavl v0.15.0-rc3.0.20201009144442-230e9bdf52cd/go.mod h1:3xOIaNNX19p0QrX0VqWa6voPRoJRGGYtny+DH8NEPvE= -github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= -github.com/cosmos/iavl v0.15.3/go.mod h1:OLjQiAQ4fGD2KDZooyJG9yz+p2ao2IAYSbke8mVvSA4= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v2 v2.2007.1/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= -github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= -github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= -github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.1/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= -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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= -github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= -github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= -github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= -github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -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/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= -github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= -github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= -github.com/tendermint/tendermint v0.34.11 h1:q1Yh76oG4QbS07xhmIJh5iAE0fYpJ8P8YKYtjnWfJRY= -github.com/tendermint/tendermint v0.34.11/go.mod h1:aeHL7alPh4uTBIJQ8mgFEE8VwJLXI1VD3rVOmH2Mcy0= -github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= -github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= -github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= -github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -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= -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= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -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-20180826012351-8a410e7b638d/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= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= -google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/module-sdk/keys/keys.go b/module-sdk/keys/keys.go deleted file mode 100644 index 2fcae343..00000000 --- a/module-sdk/keys/keys.go +++ /dev/null @@ -1,51 +0,0 @@ -package keys - -import ( - sdk "github.com/irisnet/core-sdk-go/types" -) - -type keysClient struct { - sdk.KeyManager -} - -func NewClient(keyManager sdk.KeyManager) Client { - return keysClient{keyManager} -} - -func (k keysClient) Add(name, password string) (string, string, sdk.Error) { - address, mnemonic, err := k.Insert(name, password) - return address, mnemonic, sdk.Wrap(err) -} - -func (k keysClient) Recover(name, password, mnemonic string) (string, sdk.Error) { - address, err := k.KeyManager.Recover(name, password, mnemonic, "") - return address, sdk.Wrap(err) -} - -func (k keysClient) RecoverWithHDPath(name, password, mnemonic, hdPath string) (string, sdk.Error) { - address, err := k.KeyManager.Recover(name, password, mnemonic, hdPath) - return address, sdk.Wrap(err) -} - -func (k keysClient) Import(name, password, privKeyArmor string) (string, sdk.Error) { - address, err := k.KeyManager.Import(name, password, privKeyArmor) - return address, sdk.Wrap(err) -} - -func (k keysClient) Export(name, password string) (string, sdk.Error) { - keystore, err := k.KeyManager.Export(name, password) - return keystore, sdk.Wrap(err) -} - -func (k keysClient) Delete(name, password string) sdk.Error { - err := k.KeyManager.Delete(name, password) - return sdk.Wrap(err) -} - -func (k keysClient) Show(name, password string) (string, sdk.Error) { - _, address, err := k.KeyManager.Find(name, password) - if err != nil { - return "", sdk.Wrap(err) - } - return address.String(), nil -} From 2caecd73c91b2214cae89efa14da7de6177f0183 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Tue, 13 Jul 2021 18:47:41 +0800 Subject: [PATCH 36/41] fix Bech32 Address Prefix --- core-sdk/types/config.go | 17 +++++++++++++++++ core-sdk/types/env.go | 4 ++-- module-sdk/integration_test/client.go | 1 - 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go index e495651d..93610546 100644 --- a/core-sdk/types/config.go +++ b/core-sdk/types/config.go @@ -66,6 +66,9 @@ type ClientConfig struct { KeyManager crypto.KeyManager TxSizeLimit uint64 + + //bech32 Address Prefix + Bech32AddressPrefix AddrPrefixCfg } func NewClientConfig(uri, grpcAddr, chainID string, options ...Option) (ClientConfig, error) { @@ -135,6 +138,10 @@ func (cfg *ClientConfig) checkAndSetDefault() error { return err } + if err := Bech32AddressPrefixOption(cfg.Bech32AddressPrefix)(cfg); err != nil { + return err + } + return GasAdjustmentOption(cfg.GasAdjustment)(cfg) } @@ -269,3 +276,13 @@ func KeyManagerOption(keyManager crypto.KeyManager) Option { return nil } } + +func Bech32AddressPrefixOption(bech32AddressPrefix AddrPrefixCfg) Option { + return func(cfg *ClientConfig) error { + if bech32AddressPrefix.bech32AddressPrefix == nil { + bech32AddressPrefix = *PrefixCfg + } + cfg.Bech32AddressPrefix = bech32AddressPrefix + return nil + } +} diff --git a/core-sdk/types/env.go b/core-sdk/types/env.go index 3687231b..d4fbd38d 100644 --- a/core-sdk/types/env.go +++ b/core-sdk/types/env.go @@ -21,7 +21,7 @@ const ( ) var ( - prefixCfg = &AddrPrefixCfg{ + PrefixCfg = &AddrPrefixCfg{ bech32AddressPrefix: map[string]string{ "account_addr": prefixChain + prefixAccount + prefixAddress, "validator_addr": prefixChain + prefixValidator + prefixAddress, @@ -39,7 +39,7 @@ type AddrPrefixCfg struct { // GetAddrPrefixCfg returns the config instance for the corresponding Network type func GetAddrPrefixCfg() *AddrPrefixCfg { - return prefixCfg + return PrefixCfg } // GetBech32AccountAddrPrefix returns the Bech32 prefix for account address diff --git a/module-sdk/integration_test/client.go b/module-sdk/integration_test/client.go index be378250..46b42e65 100644 --- a/module-sdk/integration_test/client.go +++ b/module-sdk/integration_test/client.go @@ -59,7 +59,6 @@ func NewClient(cfg types.ClientConfig) Client { // create a instance of baseClient baseClient := client.NewBaseClient(cfg, encodingConfig, nil) keysClient := keys.NewClient(baseClient) - bankClient := bank.NewClient(baseClient, encodingConfig.Marshaler) tokenClient := token.NewClient(baseClient, encodingConfig.Marshaler) stakingClient := staking.NewClient(baseClient, encodingConfig.Marshaler) From 6233304b5b042ffd3edfcd9b424c8283c907e0cf Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Wed, 14 Jul 2021 18:27:16 +0800 Subject: [PATCH 37/41] fix Bech32 Address Prefix --- core-sdk/integration_test/integration_test.go | 11 ++++++++++- core-sdk/types/config.go | 2 +- core-sdk/types/env.go | 16 ++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/core-sdk/integration_test/integration_test.go b/core-sdk/integration_test/integration_test.go index bd95584c..d5623e10 100644 --- a/core-sdk/integration_test/integration_test.go +++ b/core-sdk/integration_test/integration_test.go @@ -49,12 +49,21 @@ func TestSuite(t *testing.T) { } func (s *IntegrationTestSuite) SetupSuite() { - + bech32AddressPrefix := types.AddrPrefixCfg{ + Bech32AddressPrefix: map[string]string{ + "account_addr": "aaaa", + "validator_addr": "aaaa", + "consensus_addr": "aaaa", + "account_pub": "aaaa", + "validator_pub": "aaaa", + "consensus_pub": "aaaa"}, + } options := []types.Option{ types.KeyDAOOption(store.NewMemory(nil)), types.TimeoutOption(10), types.TokenManagerOption(TokenManager{}), types.KeyManagerOption(crypto.NewKeyManager()), + types.Bech32AddressPrefixOption(bech32AddressPrefix), } cfg, err := types.NewClientConfig(nodeURI, grpcAddr, chainID, options...) if err != nil { diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go index 93610546..c5c58131 100644 --- a/core-sdk/types/config.go +++ b/core-sdk/types/config.go @@ -279,7 +279,7 @@ func KeyManagerOption(keyManager crypto.KeyManager) Option { func Bech32AddressPrefixOption(bech32AddressPrefix AddrPrefixCfg) Option { return func(cfg *ClientConfig) error { - if bech32AddressPrefix.bech32AddressPrefix == nil { + if bech32AddressPrefix.Bech32AddressPrefix == nil { bech32AddressPrefix = *PrefixCfg } cfg.Bech32AddressPrefix = bech32AddressPrefix diff --git a/core-sdk/types/env.go b/core-sdk/types/env.go index d4fbd38d..931e47d8 100644 --- a/core-sdk/types/env.go +++ b/core-sdk/types/env.go @@ -22,7 +22,7 @@ const ( var ( PrefixCfg = &AddrPrefixCfg{ - bech32AddressPrefix: map[string]string{ + Bech32AddressPrefix: map[string]string{ "account_addr": prefixChain + prefixAccount + prefixAddress, "validator_addr": prefixChain + prefixValidator + prefixAddress, "consensus_addr": prefixChain + prefixConsensus + prefixAddress, @@ -34,7 +34,7 @@ var ( ) type AddrPrefixCfg struct { - bech32AddressPrefix map[string]string + Bech32AddressPrefix map[string]string } // GetAddrPrefixCfg returns the config instance for the corresponding Network type @@ -44,30 +44,30 @@ func GetAddrPrefixCfg() *AddrPrefixCfg { // GetBech32AccountAddrPrefix returns the Bech32 prefix for account address func (config *AddrPrefixCfg) GetBech32AccountAddrPrefix() string { - return config.bech32AddressPrefix["account_addr"] + return config.Bech32AddressPrefix["account_addr"] } // GetBech32ValidatorAddrPrefix returns the Bech32 prefix for validator address func (config *AddrPrefixCfg) GetBech32ValidatorAddrPrefix() string { - return config.bech32AddressPrefix["validator_addr"] + return config.Bech32AddressPrefix["validator_addr"] } // GetBech32ConsensusAddrPrefix returns the Bech32 prefix for consensus node address func (config *AddrPrefixCfg) GetBech32ConsensusAddrPrefix() string { - return config.bech32AddressPrefix["consensus_addr"] + return config.Bech32AddressPrefix["consensus_addr"] } // GetBech32AccountPubPrefix returns the Bech32 prefix for account public key func (config *AddrPrefixCfg) GetBech32AccountPubPrefix() string { - return config.bech32AddressPrefix["account_pub"] + return config.Bech32AddressPrefix["account_pub"] } // GetBech32ValidatorPubPrefix returns the Bech32 prefix for validator public key func (config *AddrPrefixCfg) GetBech32ValidatorPubPrefix() string { - return config.bech32AddressPrefix["validator_pub"] + return config.Bech32AddressPrefix["validator_pub"] } // GetBech32ConsensusPubPrefix returns the Bech32 prefix for consensus node public key func (config *AddrPrefixCfg) GetBech32ConsensusPubPrefix() string { - return config.bech32AddressPrefix["consensus_pub"] + return config.Bech32AddressPrefix["consensus_pub"] } From 2b18590f0e43cb2125bf4005360c549200689c7e Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Fri, 16 Jul 2021 10:45:12 +0800 Subject: [PATCH 38/41] delete core-sdk --- core-sdk/Makefile | 20 - core-sdk/bank/bank.go | 197 - core-sdk/bank/bank.pb.go | 1887 ------- core-sdk/bank/codec.go | 33 - core-sdk/bank/export.go | 43 - core-sdk/bank/params.go | 23 - core-sdk/bank/query.pb.go | 2220 -------- core-sdk/bank/tx.pb.go | 669 --- core-sdk/bank/types.go | 218 - core-sdk/client.go | 107 - core-sdk/client/account.go | 142 - core-sdk/client/base_client.go | 479 -- core-sdk/client/grpc_client.go | 35 - core-sdk/client/keys.go | 238 - core-sdk/client/rpc_client.go | 212 - core-sdk/client/store.go | 24 - core-sdk/client/tx.go | 242 - core-sdk/common/bech32/bech32.go | 49 - core-sdk/common/cache/cache.go | 70 - core-sdk/common/codec/amino.go | 185 - core-sdk/common/codec/amino_codec.go | 80 - core-sdk/common/codec/any.go | 42 - core-sdk/common/codec/codec.go | 66 - core-sdk/common/codec/json.go | 30 - core-sdk/common/codec/legacy/codec.go | 20 - core-sdk/common/codec/legacy/doc.go | 4 - core-sdk/common/codec/proto_codec.go | 154 - core-sdk/common/codec/types/any.go | 133 - core-sdk/common/codec/types/any.pb.go | 584 --- core-sdk/common/codec/types/compat.go | 213 - core-sdk/common/codec/types/doc.go | 6 - .../common/codec/types/interface_registry.go | 272 - core-sdk/common/codec/unknownproto/doc.go | 24 - .../codec/unknownproto/unknown_fields.go | 403 -- core-sdk/common/commom.go | 58 - core-sdk/common/common_test.go | 25 - core-sdk/common/crypto/armor.go | 210 - core-sdk/common/crypto/codec/amino.go | 59 - core-sdk/common/crypto/codec/proto.go | 27 - core-sdk/common/crypto/hd/algo.go | 88 - core-sdk/common/crypto/hd/hdpath.go | 267 - core-sdk/common/crypto/key_manager.go | 130 - core-sdk/common/crypto/key_manager_test.go | 25 - .../common/crypto/keys/ed25519/ed25519.go | 234 - .../crypto/keys/ed25519/ed25519_test.go | 218 - .../common/crypto/keys/ed25519/keys.pb.go | 497 -- .../keys/internal/benchmarking/bench.go | 92 - core-sdk/common/crypto/keys/multisig/codec.go | 35 - .../common/crypto/keys/multisig/keys.pb.go | 360 -- .../common/crypto/keys/multisig/multisig.go | 168 - .../crypto/keys/secp256k1/bench_test.go | 28 - .../secp256k1/internal/secp256k1/.gitignore | 24 - .../keys/secp256k1/internal/secp256k1/LICENSE | 31 - .../secp256k1/internal/secp256k1/README.md | 3 - .../secp256k1/internal/secp256k1/curve.go | 328 -- .../keys/secp256k1/internal/secp256k1/ext.h | 130 - .../secp256k1/libsecp256k1/.gitignore | 49 - .../secp256k1/libsecp256k1/.travis.yml | 69 - .../internal/secp256k1/libsecp256k1/COPYING | 19 - .../secp256k1/libsecp256k1/Makefile.am | 177 - .../internal/secp256k1/libsecp256k1/README.md | 61 - .../internal/secp256k1/libsecp256k1/TODO | 3 - .../secp256k1/libsecp256k1/autogen.sh | 3 - .../build-aux/m4/ax_jni_include_dir.m4 | 140 - .../build-aux/m4/ax_prog_cc_for_build.m4 | 125 - .../libsecp256k1/build-aux/m4/bitcoin_secp.m4 | 69 - .../secp256k1/libsecp256k1/configure.ac | 493 -- .../libsecp256k1/contrib/lax_der_parsing.c | 150 - .../libsecp256k1/contrib/lax_der_parsing.h | 91 - .../contrib/lax_der_privatekey_parsing.c | 113 - .../contrib/lax_der_privatekey_parsing.h | 90 - .../libsecp256k1/include/secp256k1.h | 577 --- .../libsecp256k1/include/secp256k1_ecdh.h | 31 - .../libsecp256k1/include/secp256k1_recovery.h | 110 - .../secp256k1/libsecp256k1/libsecp256k1.pc.in | 13 - .../secp256k1/libsecp256k1/obj/.gitignore | 0 .../libsecp256k1/sage/group_prover.sage | 322 -- .../libsecp256k1/sage/secp256k1.sage | 306 -- .../libsecp256k1/sage/weierstrass_prover.sage | 264 - .../libsecp256k1/src/asm/field_10x26_arm.s | 919 ---- .../secp256k1/libsecp256k1/src/basic-config.h | 32 - .../secp256k1/libsecp256k1/src/bench.h | 66 - .../secp256k1/libsecp256k1/src/bench_ecdh.c | 54 - .../libsecp256k1/src/bench_internal.c | 382 -- .../libsecp256k1/src/bench_recover.c | 60 - .../libsecp256k1/src/bench_schnorr_verify.c | 73 - .../secp256k1/libsecp256k1/src/bench_sign.c | 56 - .../secp256k1/libsecp256k1/src/bench_verify.c | 112 - .../secp256k1/libsecp256k1/src/ecdsa.h | 21 - .../secp256k1/libsecp256k1/src/ecdsa_impl.h | 315 -- .../secp256k1/libsecp256k1/src/eckey.h | 25 - .../secp256k1/libsecp256k1/src/eckey_impl.h | 99 - .../secp256k1/libsecp256k1/src/ecmult.h | 31 - .../secp256k1/libsecp256k1/src/ecmult_const.h | 15 - .../libsecp256k1/src/ecmult_const_impl.h | 239 - .../secp256k1/libsecp256k1/src/ecmult_gen.h | 43 - .../libsecp256k1/src/ecmult_gen_impl.h | 210 - .../secp256k1/libsecp256k1/src/ecmult_impl.h | 406 -- .../secp256k1/libsecp256k1/src/field.h | 132 - .../secp256k1/libsecp256k1/src/field_10x26.h | 47 - .../libsecp256k1/src/field_10x26_impl.h | 1140 ---- .../secp256k1/libsecp256k1/src/field_5x52.h | 47 - .../libsecp256k1/src/field_5x52_asm_impl.h | 502 -- .../libsecp256k1/src/field_5x52_impl.h | 451 -- .../libsecp256k1/src/field_5x52_int128_impl.h | 277 - .../secp256k1/libsecp256k1/src/field_impl.h | 315 -- .../secp256k1/libsecp256k1/src/gen_context.c | 74 - .../secp256k1/libsecp256k1/src/group.h | 144 - .../secp256k1/libsecp256k1/src/group_impl.h | 700 --- .../secp256k1/libsecp256k1/src/hash.h | 41 - .../secp256k1/libsecp256k1/src/hash_impl.h | 281 - .../src/java/org/bitcoin/NativeSecp256k1.java | 446 -- .../java/org/bitcoin/NativeSecp256k1Test.java | 226 - .../java/org/bitcoin/NativeSecp256k1Util.java | 45 - .../java/org/bitcoin/Secp256k1Context.java | 51 - .../src/java/org_bitcoin_NativeSecp256k1.c | 377 -- .../src/java/org_bitcoin_NativeSecp256k1.h | 119 - .../src/java/org_bitcoin_Secp256k1Context.c | 15 - .../src/java/org_bitcoin_Secp256k1Context.h | 22 - .../src/modules/ecdh/Makefile.am.include | 8 - .../libsecp256k1/src/modules/ecdh/main_impl.h | 54 - .../src/modules/ecdh/tests_impl.h | 105 - .../src/modules/recovery/Makefile.am.include | 8 - .../src/modules/recovery/main_impl.h | 193 - .../src/modules/recovery/tests_impl.h | 393 -- .../internal/secp256k1/libsecp256k1/src/num.h | 74 - .../secp256k1/libsecp256k1/src/num_gmp.h | 20 - .../secp256k1/libsecp256k1/src/num_gmp_impl.h | 288 -- .../secp256k1/libsecp256k1/src/num_impl.h | 24 - .../secp256k1/libsecp256k1/src/scalar.h | 106 - .../secp256k1/libsecp256k1/src/scalar_4x64.h | 19 - .../libsecp256k1/src/scalar_4x64_impl.h | 949 ---- .../secp256k1/libsecp256k1/src/scalar_8x32.h | 19 - .../libsecp256k1/src/scalar_8x32_impl.h | 721 --- .../secp256k1/libsecp256k1/src/scalar_impl.h | 370 -- .../secp256k1/libsecp256k1/src/scalar_low.h | 15 - .../libsecp256k1/src/scalar_low_impl.h | 114 - .../secp256k1/libsecp256k1/src/secp256k1.c | 559 -- .../secp256k1/libsecp256k1/src/testrand.h | 38 - .../libsecp256k1/src/testrand_impl.h | 110 - .../secp256k1/libsecp256k1/src/tests.c | 4525 ---------------- .../libsecp256k1/src/tests_exhaustive.c | 470 -- .../secp256k1/libsecp256k1/src/util.h | 113 - .../secp256k1/internal/secp256k1/panic_cb.go | 21 - .../secp256k1/internal/secp256k1/secp256.go | 167 - .../common/crypto/keys/secp256k1/keys.pb.go | 499 -- .../common/crypto/keys/secp256k1/secp256k1.go | 205 - .../crypto/keys/secp256k1/secp256k1_cgo.go | 24 - .../keys/secp256k1/secp256k1_cgo_test.go | 40 - .../keys/secp256k1/secp256k1_internal_test.go | 46 - .../crypto/keys/secp256k1/secp256k1_nocgo.go | 70 - .../keys/secp256k1/secp256k1_nocgo_test.go | 38 - .../crypto/keys/secp256k1/secp256k1_test.go | 251 - core-sdk/common/crypto/keys/sm2/gm_sm2.go | 103 - .../common/crypto/keys/sm2/gm_sm2_test.go | 17 - core-sdk/common/crypto/keys/sm2/keys.pb.go | 497 -- core-sdk/common/crypto/keys/sm2/sm2.go | 217 - .../common/crypto/types/compact_bit_array.go | 248 - core-sdk/common/crypto/types/multisig.pb.go | 551 -- .../crypto/types/multisig/multisignature.go | 90 - .../common/crypto/types/multisig/pubkey.go | 28 - core-sdk/common/crypto/types/types.go | 30 - core-sdk/common/log/logger.go | 113 - core-sdk/common/log/logger_test.go | 30 - core-sdk/common/log/type.go | 16 - core-sdk/common/uuid/codec.go | 186 - core-sdk/common/uuid/generator.go | 245 - core-sdk/common/uuid/uuid.go | 138 - core-sdk/go.mod | 37 - core-sdk/go.sum | 741 --- core-sdk/integration_test/bank_test.go | 185 - core-sdk/integration_test/integration_test.go | 178 - core-sdk/integration_test/scripts/Dockerfile | 10 - core-sdk/integration_test/scripts/build.sh | 1 - core-sdk/integration_test/scripts/clean.sh | 2 - .../scripts/node/config/app.toml | 151 - .../scripts/node/config/config.toml | 392 -- .../scripts/node/config/genesis.json | 343 -- .../scripts/node/config/node_key.json | 1 - .../node/config/priv_validator_key.json | 11 - .../node/data/priv_validator_state.json | 5 - core-sdk/integration_test/scripts/priv.key | 9 - core-sdk/integration_test/scripts/setup.sh | 1 - core-sdk/integration_test/scripts/start.sh | 1 - core-sdk/proto/cosmos/auth/v1beta1/auth.proto | 49 - .../proto/cosmos/auth/v1beta1/query.proto | 47 - core-sdk/proto/cosmos/bank/v1beta1/bank.proto | 85 - .../proto/cosmos/bank/v1beta1/query.proto | 111 - core-sdk/proto/cosmos/bank/v1beta1/tx.proto | 27 - .../proto/cosmos/base/abci/v1beta1/abci.proto | 137 - .../proto/cosmos/base/kv/v1beta1/kv.proto | 17 - .../base/query/v1beta1/pagination.proto | 50 - core-sdk/proto/cosmos/base/v1beta1/coin.proto | 40 - .../proto/cosmos/crypto/ed25519/keys.proto | 22 - .../proto/cosmos/crypto/multisig/keys.proto | 18 - .../crypto/multisig/v1beta1/multisig.proto | 25 - .../proto/cosmos/crypto/secp256k1/keys.proto | 22 - .../cosmos/tx/signing/v1beta1/signing.proto | 79 - core-sdk/proto/cosmos/tx/v1beta1/tx.proto | 182 - core-sdk/readme.md | 15 - .../github.com/confio/ics23/go/proofs.pb.go | 4590 ----------------- .../gogo/protobuf/gogoproto/gogo.pb.go | 888 ---- .../regen-network/cosmos-proto/cosmos.pb.go | 77 - .../third_party/proto/confio/proofs.proto | 234 - .../proto/cosmos_proto/cosmos.proto | 16 - .../third_party/proto/gogoproto/gogo.proto | 145 - .../proto/google/api/annotations.proto | 31 - .../third_party/proto/google/api/http.proto | 318 -- .../proto/google/api/httpbody.proto | 78 - .../proto/google/protobuf/any.proto | 161 - .../proto/tendermint/abci/types.proto | 407 -- .../proto/tendermint/crypto/keys.proto | 16 - .../proto/tendermint/crypto/proof.proto | 41 - .../proto/tendermint/libs/bits/types.proto | 9 - .../proto/tendermint/types/evidence.proto | 31 - .../proto/tendermint/types/params.proto | 81 - .../proto/tendermint/types/types.proto | 162 - .../proto/tendermint/types/validator.proto | 25 - .../proto/tendermint/version/types.proto | 24 - core-sdk/third_party/protocgen.sh | 18 - core-sdk/types/abci.pb.go | 3084 ----------- core-sdk/types/account.go | 10 - core-sdk/types/address.go | 352 -- core-sdk/types/address_test.go | 25 - core-sdk/types/auth/auth.pb.go | 1049 ---- core-sdk/types/auth/params.go | 11 - core-sdk/types/auth/query.pb.go | 930 ---- core-sdk/types/auth/tests/auth_test.go | 17 - core-sdk/types/auth/types.go | 146 - core-sdk/types/block.go | 131 - core-sdk/types/client.go | 69 - core-sdk/types/codec.go | 15 - core-sdk/types/coin.go | 681 --- core-sdk/types/coin.pb.go | 978 ---- core-sdk/types/coin_type.go | 88 - core-sdk/types/config.go | 288 -- core-sdk/types/dec.go | 797 --- core-sdk/types/dec_coin.go | 644 --- core-sdk/types/doc.go | 6 - core-sdk/types/env.go | 73 - core-sdk/types/errors.go | 235 - core-sdk/types/event.go | 231 - core-sdk/types/events.go | 234 - core-sdk/types/factory.go | 299 -- core-sdk/types/handler_map.go | 58 - core-sdk/types/int.go | 429 -- core-sdk/types/kv/kv.pb.go | 558 -- core-sdk/types/module.go | 33 - core-sdk/types/proof.go | 13 - core-sdk/types/query/pagination.pb.go | 674 --- core-sdk/types/result.go | 258 - core-sdk/types/sign_mode_handler.go | 36 - core-sdk/types/stdtx.go | 227 - core-sdk/types/store/aes.go | 64 - core-sdk/types/store/codec.go | 31 - core-sdk/types/store/level_db.go | 118 - core-sdk/types/store/memory.go | 40 - core-sdk/types/store/types.go | 107 - core-sdk/types/tm_types.go | 47 - core-sdk/types/token.go | 24 - core-sdk/types/token_manager.go | 33 - core-sdk/types/tx.go | 53 - core-sdk/types/tx/builder.go | 351 -- core-sdk/types/tx/config.go | 65 - core-sdk/types/tx/decoder.go | 79 - core-sdk/types/tx/direct.go | 52 - core-sdk/types/tx/encoder.go | 46 - core-sdk/types/tx/mode_handler.go | 40 - core-sdk/types/tx/signing/signature.go | 100 - core-sdk/types/tx/signing/signature_data.go | 36 - core-sdk/types/tx/signing/signing.pb.go | 1453 ------ core-sdk/types/tx/sigs.go | 149 - core-sdk/types/tx/tx.pb.go | 3107 ----------- core-sdk/types/tx/types.go | 121 - core-sdk/types/tx_config.go | 44 - core-sdk/types/tx_msg.go | 87 - core-sdk/types/utils.go | 75 - 277 files changed, 66558 deletions(-) delete mode 100644 core-sdk/Makefile delete mode 100644 core-sdk/bank/bank.go delete mode 100644 core-sdk/bank/bank.pb.go delete mode 100644 core-sdk/bank/codec.go delete mode 100644 core-sdk/bank/export.go delete mode 100644 core-sdk/bank/params.go delete mode 100644 core-sdk/bank/query.pb.go delete mode 100644 core-sdk/bank/tx.pb.go delete mode 100644 core-sdk/bank/types.go delete mode 100644 core-sdk/client.go delete mode 100644 core-sdk/client/account.go delete mode 100644 core-sdk/client/base_client.go delete mode 100644 core-sdk/client/grpc_client.go delete mode 100644 core-sdk/client/keys.go delete mode 100644 core-sdk/client/rpc_client.go delete mode 100644 core-sdk/client/store.go delete mode 100644 core-sdk/client/tx.go delete mode 100644 core-sdk/common/bech32/bech32.go delete mode 100644 core-sdk/common/cache/cache.go delete mode 100644 core-sdk/common/codec/amino.go delete mode 100644 core-sdk/common/codec/amino_codec.go delete mode 100644 core-sdk/common/codec/any.go delete mode 100644 core-sdk/common/codec/codec.go delete mode 100644 core-sdk/common/codec/json.go delete mode 100644 core-sdk/common/codec/legacy/codec.go delete mode 100644 core-sdk/common/codec/legacy/doc.go delete mode 100644 core-sdk/common/codec/proto_codec.go delete mode 100644 core-sdk/common/codec/types/any.go delete mode 100644 core-sdk/common/codec/types/any.pb.go delete mode 100644 core-sdk/common/codec/types/compat.go delete mode 100644 core-sdk/common/codec/types/doc.go delete mode 100644 core-sdk/common/codec/types/interface_registry.go delete mode 100644 core-sdk/common/codec/unknownproto/doc.go delete mode 100644 core-sdk/common/codec/unknownproto/unknown_fields.go delete mode 100644 core-sdk/common/commom.go delete mode 100644 core-sdk/common/common_test.go delete mode 100644 core-sdk/common/crypto/armor.go delete mode 100644 core-sdk/common/crypto/codec/amino.go delete mode 100644 core-sdk/common/crypto/codec/proto.go delete mode 100644 core-sdk/common/crypto/hd/algo.go delete mode 100644 core-sdk/common/crypto/hd/hdpath.go delete mode 100644 core-sdk/common/crypto/key_manager.go delete mode 100644 core-sdk/common/crypto/key_manager_test.go delete mode 100644 core-sdk/common/crypto/keys/ed25519/ed25519.go delete mode 100644 core-sdk/common/crypto/keys/ed25519/ed25519_test.go delete mode 100644 core-sdk/common/crypto/keys/ed25519/keys.pb.go delete mode 100644 core-sdk/common/crypto/keys/internal/benchmarking/bench.go delete mode 100644 core-sdk/common/crypto/keys/multisig/codec.go delete mode 100644 core-sdk/common/crypto/keys/multisig/keys.pb.go delete mode 100644 core-sdk/common/crypto/keys/multisig/multisig.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/bench_test.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/.gitignore delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/LICENSE delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/README.md delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/curve.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/ext.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO delete mode 100755 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/obj/.gitignore delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include delete mode 100755 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h delete mode 100755 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/panic_cb.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/secp256.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/keys.pb.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/secp256k1.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo_test.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/secp256k1_internal_test.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo_test.go delete mode 100644 core-sdk/common/crypto/keys/secp256k1/secp256k1_test.go delete mode 100644 core-sdk/common/crypto/keys/sm2/gm_sm2.go delete mode 100644 core-sdk/common/crypto/keys/sm2/gm_sm2_test.go delete mode 100644 core-sdk/common/crypto/keys/sm2/keys.pb.go delete mode 100644 core-sdk/common/crypto/keys/sm2/sm2.go delete mode 100644 core-sdk/common/crypto/types/compact_bit_array.go delete mode 100644 core-sdk/common/crypto/types/multisig.pb.go delete mode 100644 core-sdk/common/crypto/types/multisig/multisignature.go delete mode 100644 core-sdk/common/crypto/types/multisig/pubkey.go delete mode 100644 core-sdk/common/crypto/types/types.go delete mode 100644 core-sdk/common/log/logger.go delete mode 100644 core-sdk/common/log/logger_test.go delete mode 100644 core-sdk/common/log/type.go delete mode 100644 core-sdk/common/uuid/codec.go delete mode 100644 core-sdk/common/uuid/generator.go delete mode 100644 core-sdk/common/uuid/uuid.go delete mode 100644 core-sdk/go.mod delete mode 100644 core-sdk/go.sum delete mode 100644 core-sdk/integration_test/bank_test.go delete mode 100644 core-sdk/integration_test/integration_test.go delete mode 100644 core-sdk/integration_test/scripts/Dockerfile delete mode 100755 core-sdk/integration_test/scripts/build.sh delete mode 100755 core-sdk/integration_test/scripts/clean.sh delete mode 100644 core-sdk/integration_test/scripts/node/config/app.toml delete mode 100644 core-sdk/integration_test/scripts/node/config/config.toml delete mode 100644 core-sdk/integration_test/scripts/node/config/genesis.json delete mode 100644 core-sdk/integration_test/scripts/node/config/node_key.json delete mode 100644 core-sdk/integration_test/scripts/node/config/priv_validator_key.json delete mode 100644 core-sdk/integration_test/scripts/node/data/priv_validator_state.json delete mode 100644 core-sdk/integration_test/scripts/priv.key delete mode 100755 core-sdk/integration_test/scripts/setup.sh delete mode 100755 core-sdk/integration_test/scripts/start.sh delete mode 100644 core-sdk/proto/cosmos/auth/v1beta1/auth.proto delete mode 100644 core-sdk/proto/cosmos/auth/v1beta1/query.proto delete mode 100644 core-sdk/proto/cosmos/bank/v1beta1/bank.proto delete mode 100644 core-sdk/proto/cosmos/bank/v1beta1/query.proto delete mode 100644 core-sdk/proto/cosmos/bank/v1beta1/tx.proto delete mode 100644 core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto delete mode 100644 core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto delete mode 100644 core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto delete mode 100644 core-sdk/proto/cosmos/base/v1beta1/coin.proto delete mode 100644 core-sdk/proto/cosmos/crypto/ed25519/keys.proto delete mode 100644 core-sdk/proto/cosmos/crypto/multisig/keys.proto delete mode 100644 core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto delete mode 100644 core-sdk/proto/cosmos/crypto/secp256k1/keys.proto delete mode 100644 core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto delete mode 100644 core-sdk/proto/cosmos/tx/v1beta1/tx.proto delete mode 100644 core-sdk/readme.md delete mode 100644 core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go delete mode 100644 core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go delete mode 100644 core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go delete mode 100644 core-sdk/third_party/proto/confio/proofs.proto delete mode 100644 core-sdk/third_party/proto/cosmos_proto/cosmos.proto delete mode 100644 core-sdk/third_party/proto/gogoproto/gogo.proto delete mode 100644 core-sdk/third_party/proto/google/api/annotations.proto delete mode 100644 core-sdk/third_party/proto/google/api/http.proto delete mode 100644 core-sdk/third_party/proto/google/api/httpbody.proto delete mode 100644 core-sdk/third_party/proto/google/protobuf/any.proto delete mode 100644 core-sdk/third_party/proto/tendermint/abci/types.proto delete mode 100644 core-sdk/third_party/proto/tendermint/crypto/keys.proto delete mode 100644 core-sdk/third_party/proto/tendermint/crypto/proof.proto delete mode 100644 core-sdk/third_party/proto/tendermint/libs/bits/types.proto delete mode 100644 core-sdk/third_party/proto/tendermint/types/evidence.proto delete mode 100644 core-sdk/third_party/proto/tendermint/types/params.proto delete mode 100644 core-sdk/third_party/proto/tendermint/types/types.proto delete mode 100644 core-sdk/third_party/proto/tendermint/types/validator.proto delete mode 100644 core-sdk/third_party/proto/tendermint/version/types.proto delete mode 100755 core-sdk/third_party/protocgen.sh delete mode 100644 core-sdk/types/abci.pb.go delete mode 100644 core-sdk/types/account.go delete mode 100644 core-sdk/types/address.go delete mode 100644 core-sdk/types/address_test.go delete mode 100644 core-sdk/types/auth/auth.pb.go delete mode 100644 core-sdk/types/auth/params.go delete mode 100644 core-sdk/types/auth/query.pb.go delete mode 100644 core-sdk/types/auth/tests/auth_test.go delete mode 100644 core-sdk/types/auth/types.go delete mode 100644 core-sdk/types/block.go delete mode 100644 core-sdk/types/client.go delete mode 100644 core-sdk/types/codec.go delete mode 100644 core-sdk/types/coin.go delete mode 100644 core-sdk/types/coin.pb.go delete mode 100644 core-sdk/types/coin_type.go delete mode 100644 core-sdk/types/config.go delete mode 100644 core-sdk/types/dec.go delete mode 100644 core-sdk/types/dec_coin.go delete mode 100644 core-sdk/types/doc.go delete mode 100644 core-sdk/types/env.go delete mode 100644 core-sdk/types/errors.go delete mode 100644 core-sdk/types/event.go delete mode 100644 core-sdk/types/events.go delete mode 100644 core-sdk/types/factory.go delete mode 100644 core-sdk/types/handler_map.go delete mode 100644 core-sdk/types/int.go delete mode 100644 core-sdk/types/kv/kv.pb.go delete mode 100644 core-sdk/types/module.go delete mode 100644 core-sdk/types/proof.go delete mode 100644 core-sdk/types/query/pagination.pb.go delete mode 100644 core-sdk/types/result.go delete mode 100644 core-sdk/types/sign_mode_handler.go delete mode 100644 core-sdk/types/stdtx.go delete mode 100644 core-sdk/types/store/aes.go delete mode 100644 core-sdk/types/store/codec.go delete mode 100644 core-sdk/types/store/level_db.go delete mode 100644 core-sdk/types/store/memory.go delete mode 100644 core-sdk/types/store/types.go delete mode 100644 core-sdk/types/tm_types.go delete mode 100644 core-sdk/types/token.go delete mode 100644 core-sdk/types/token_manager.go delete mode 100644 core-sdk/types/tx.go delete mode 100644 core-sdk/types/tx/builder.go delete mode 100644 core-sdk/types/tx/config.go delete mode 100644 core-sdk/types/tx/decoder.go delete mode 100644 core-sdk/types/tx/direct.go delete mode 100644 core-sdk/types/tx/encoder.go delete mode 100644 core-sdk/types/tx/mode_handler.go delete mode 100644 core-sdk/types/tx/signing/signature.go delete mode 100644 core-sdk/types/tx/signing/signature_data.go delete mode 100644 core-sdk/types/tx/signing/signing.pb.go delete mode 100644 core-sdk/types/tx/sigs.go delete mode 100644 core-sdk/types/tx/tx.pb.go delete mode 100644 core-sdk/types/tx/types.go delete mode 100644 core-sdk/types/tx_config.go delete mode 100644 core-sdk/types/tx_msg.go delete mode 100644 core-sdk/types/utils.go diff --git a/core-sdk/Makefile b/core-sdk/Makefile deleted file mode 100644 index c309df12..00000000 --- a/core-sdk/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PACKAGES=$(shell go list ./...) -PACKAGES_UNITTEST=$(shell go list ./... | grep -v integration_test) -export GO111MODULE = on - -format: - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs gofmt -w -s - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*.pb.go" | xargs goimports -w -local github.com/irisnet/core-sdk-go - -test-unit: - @go test -v $(PACKAGES_UNITTEST) - -test-integration: - cd integration_test/scripts/ && sh build.sh && sh start.sh - sleep 2s - @go test -v $(PACKAGES) - cd integration_test/scripts/ && sh clean.sh - -proto-gen: - @./third_party/protocgen.sh \ No newline at end of file diff --git a/core-sdk/bank/bank.go b/core-sdk/bank/bank.go deleted file mode 100644 index b4b7b673..00000000 --- a/core-sdk/bank/bank.go +++ /dev/null @@ -1,197 +0,0 @@ -package bank - -import ( - "context" - "fmt" - "strings" - - "github.com/irisnet/core-sdk-go/common" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/codec/types" - sdk "github.com/irisnet/core-sdk-go/types" -) - -type bankClient struct { - sdk.BaseClient - commoncodec.Marshaler -} - -//bank NewClient -func NewClient(bc sdk.BaseClient, cdc commoncodec.Marshaler) Client { - return bankClient{ - BaseClient: bc, - Marshaler: cdc, - } -} - -func (b bankClient) Name() string { - return ModuleName -} - -func (b bankClient) RegisterInterfaceTypes(registry types.InterfaceRegistry) { - RegisterInterfaces(registry) -} - -// QueryAccount return account information specified address -func (b bankClient) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { - account, err := b.BaseClient.QueryAccount(address) - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - return account, nil -} - -// TotalSupply queries the total supply of all coins. -func (b bankClient) TotalSupply() (sdk.Coins, sdk.Error) { - conn, err := b.GenConn() - if err != nil { - return nil, sdk.Wrap(err) - } - - resp, err := NewQueryClient(conn).TotalSupply( - context.Background(), - &QueryTotalSupplyRequest{}, - ) - if err != nil { - return nil, sdk.Wrap(err) - } - return resp.Supply, nil -} - -// Send is responsible for transferring tokens from `From` to `to` account -func (b bankClient) Send(to string, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := b.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf("%s not found", baseTx.From) - } - - amt, err := b.ToMinCoin(amount...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - outAddr, err := sdk.AccAddressFromBech32(to) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf(fmt.Sprintf("%s invalid address", to)) - } - - msg := NewMsgSend(sender, outAddr, amt) - return b.BuildAndSend([]sdk.Msg{msg}, baseTx) -} - -func (b bankClient) SendWitchSpecAccountInfo(to string, sequence, accountNumber uint64, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) { - sender, err := b.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf("%s not found", baseTx.From) - } - - amt, err := b.ToMinCoin(amount...) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - outAddr, err := sdk.AccAddressFromBech32(to) - if err != nil { - return sdk.ResultTx{}, sdk.Wrapf(fmt.Sprintf("%s invalid address", to)) - } - - msg := NewMsgSend(sender, outAddr, amt) - return b.BuildAndSendWithAccount(sender.String(), accountNumber, sequence, []sdk.Msg{msg}, baseTx) -} - -func (b bankClient) MultiSend(request MultiSendRequest, baseTx sdk.BaseTx) (resTxs []sdk.ResultTx, err sdk.Error) { - sender, err := b.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, sdk.Wrapf("%s not found", baseTx.From) - } - - if len(request.Receipts) > maxMsgLen { - return b.SendBatch(sender, request, baseTx) - } - - var inputs = make([]Input, len(request.Receipts)) - var outputs = make([]Output, len(request.Receipts)) - for i, receipt := range request.Receipts { - amt, err := b.ToMinCoin(receipt.Amount...) - if err != nil { - return nil, sdk.Wrap(err) - } - - outAddr, e := sdk.AccAddressFromBech32(receipt.Address) - if e != nil { - return nil, sdk.Wrapf(fmt.Sprintf("%s invalid address", receipt.Address)) - } - - inputs[i] = NewInput(sender, amt) - outputs[i] = NewOutput(outAddr, amt) - } - - msg := NewMsgMultiSend(inputs, outputs) - res, err := b.BuildAndSend([]sdk.Msg{msg}, baseTx) - if err != nil { - return nil, sdk.Wrap(err) - } - - resTxs = append(resTxs, res) - return -} - -func (b bankClient) SendBatch(sender sdk.AccAddress, request MultiSendRequest, baseTx sdk.BaseTx) ([]sdk.ResultTx, sdk.Error) { - batchReceipts := common.SubArray(maxMsgLen, request) - - var msgs sdk.Msgs - for _, receipts := range batchReceipts { - - req := receipts.(MultiSendRequest) - var inputs = make([]Input, len(req.Receipts)) - var outputs = make([]Output, len(req.Receipts)) - for i, receipt := range req.Receipts { - amt, err := b.ToMinCoin(receipt.Amount...) - if err != nil { - return nil, sdk.Wrap(err) - } - - outAddr, e := sdk.AccAddressFromBech32(receipt.Address) - if e != nil { - return nil, sdk.Wrapf(fmt.Sprintf("%s invalid address", receipt.Address)) - } - - inputs[i] = NewInput(sender, amt) - outputs[i] = NewOutput(outAddr, amt) - } - msgs = append(msgs, NewMsgMultiSend(inputs, outputs)) - } - return b.BaseClient.SendBatch(msgs, baseTx) -} - -// SubscribeSendTx Subscribe MsgSend event and return subscription -func (b bankClient) SubscribeSendTx(from, to string, callback EventMsgSendCallback) sdk.Subscription { - var builder = sdk.NewEventQueryBuilder() - - from = strings.TrimSpace(from) - if len(from) != 0 { - builder.AddCondition(sdk.NewCond(sdk.EventTypeMessage, - sdk.AttributeKeySender).EQ(sdk.EventValue(from))) - } - - to = strings.TrimSpace(to) - if len(to) != 0 { - builder.AddCondition(sdk.Cond("transfer.recipient").EQ(sdk.EventValue(to))) - } - - subscription, _ := b.SubscribeTx(builder, func(data sdk.EventDataTx) { - for _, msg := range data.Tx.GetMsgs() { - if value, ok := msg.(*MsgSend); ok { - callback(EventDataMsgSend{ - Height: data.Height, - Hash: data.Hash, - From: value.FromAddress, - To: value.ToAddress, - Amount: value.Amount, - }) - } - } - }) - return subscription -} diff --git a/core-sdk/bank/bank.pb.go b/core-sdk/bank/bank.pb.go deleted file mode 100644 index e421cbc9..00000000 --- a/core-sdk/bank/bank.pb.go +++ /dev/null @@ -1,1887 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/bank/v1beta1/bank.proto - -package bank - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" - types "github.com/irisnet/core-sdk-go/types" - _ "github.com/regen-network/cosmos-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 - -// Params defines the parameters for the bank module. -type Params struct { - SendEnabled []*SendEnabled `protobuf:"bytes,1,rep,name=send_enabled,json=sendEnabled,proto3" json:"send_enabled,omitempty" yaml:"send_enabled,omitempty"` - DefaultSendEnabled bool `protobuf:"varint,2,opt,name=default_send_enabled,json=defaultSendEnabled,proto3" json:"default_send_enabled,omitempty" yaml:"default_send_enabled,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []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 - -func (m *Params) GetSendEnabled() []*SendEnabled { - if m != nil { - return m.SendEnabled - } - return nil -} - -func (m *Params) GetDefaultSendEnabled() bool { - if m != nil { - return m.DefaultSendEnabled - } - return false -} - -// SendEnabled maps coin denom to a send_enabled status (whether a denom is -// sendable). -type SendEnabled struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` -} - -func (m *SendEnabled) Reset() { *m = SendEnabled{} } -func (*SendEnabled) ProtoMessage() {} -func (*SendEnabled) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{1} -} -func (m *SendEnabled) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SendEnabled) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SendEnabled.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 *SendEnabled) XXX_Merge(src proto.Message) { - xxx_messageInfo_SendEnabled.Merge(m, src) -} -func (m *SendEnabled) XXX_Size() int { - return m.Size() -} -func (m *SendEnabled) XXX_DiscardUnknown() { - xxx_messageInfo_SendEnabled.DiscardUnknown(m) -} - -var xxx_messageInfo_SendEnabled proto.InternalMessageInfo - -func (m *SendEnabled) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *SendEnabled) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -// Input models transaction input. -type Input struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coins github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/irisnet/core-sdk-go/types.Coins" json:"coins"` -} - -func (m *Input) Reset() { *m = Input{} } -func (m *Input) String() string { return proto.CompactTextString(m) } -func (*Input) ProtoMessage() {} -func (*Input) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{2} -} -func (m *Input) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Input.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 *Input) XXX_Merge(src proto.Message) { - xxx_messageInfo_Input.Merge(m, src) -} -func (m *Input) XXX_Size() int { - return m.Size() -} -func (m *Input) XXX_DiscardUnknown() { - xxx_messageInfo_Input.DiscardUnknown(m) -} - -var xxx_messageInfo_Input proto.InternalMessageInfo - -// Output models transaction outputs. -type Output struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - Coins github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,2,rep,name=coins,proto3,castrepeated=github.com/irisnet/core-sdk-go/types.Coins" json:"coins"` -} - -func (m *Output) Reset() { *m = Output{} } -func (m *Output) String() string { return proto.CompactTextString(m) } -func (*Output) ProtoMessage() {} -func (*Output) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{3} -} -func (m *Output) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Output.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 *Output) XXX_Merge(src proto.Message) { - xxx_messageInfo_Output.Merge(m, src) -} -func (m *Output) XXX_Size() int { - return m.Size() -} -func (m *Output) XXX_DiscardUnknown() { - xxx_messageInfo_Output.DiscardUnknown(m) -} - -var xxx_messageInfo_Output proto.InternalMessageInfo - -// Supply represents a struct that passively keeps track of the total supply -// amounts in the network. -type Supply struct { - Total github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=total,proto3,castrepeated=github.com/irisnet/core-sdk-go/types.Coins" json:"total"` -} - -func (m *Supply) Reset() { *m = Supply{} } -func (*Supply) ProtoMessage() {} -func (*Supply) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{4} -} -func (m *Supply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Supply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Supply.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 *Supply) XXX_Merge(src proto.Message) { - xxx_messageInfo_Supply.Merge(m, src) -} -func (m *Supply) XXX_Size() int { - return m.Size() -} -func (m *Supply) XXX_DiscardUnknown() { - xxx_messageInfo_Supply.DiscardUnknown(m) -} - -var xxx_messageInfo_Supply proto.InternalMessageInfo - -// DenomUnit represents a struct that describes a given -// denomination unit of the basic token. -type DenomUnit struct { - // denom represents the string name of the given denom unit (e.g uatom). - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // exponent represents power of 10 exponent that one must - // raise the base_denom to in order to equal the given DenomUnit's denom - // 1 denom = 1^exponent base_denom - // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - // exponent = 6, thus: 1 atom = 10^6 uatom). - Exponent uint32 `protobuf:"varint,2,opt,name=exponent,proto3" json:"exponent,omitempty"` - // aliases is a list of string aliases for the given denom - Aliases []string `protobuf:"bytes,3,rep,name=aliases,proto3" json:"aliases,omitempty"` -} - -func (m *DenomUnit) Reset() { *m = DenomUnit{} } -func (m *DenomUnit) String() string { return proto.CompactTextString(m) } -func (*DenomUnit) ProtoMessage() {} -func (*DenomUnit) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{5} -} -func (m *DenomUnit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DenomUnit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DenomUnit.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 *DenomUnit) XXX_Merge(src proto.Message) { - xxx_messageInfo_DenomUnit.Merge(m, src) -} -func (m *DenomUnit) XXX_Size() int { - return m.Size() -} -func (m *DenomUnit) XXX_DiscardUnknown() { - xxx_messageInfo_DenomUnit.DiscardUnknown(m) -} - -var xxx_messageInfo_DenomUnit proto.InternalMessageInfo - -func (m *DenomUnit) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *DenomUnit) GetExponent() uint32 { - if m != nil { - return m.Exponent - } - return 0 -} - -func (m *DenomUnit) GetAliases() []string { - if m != nil { - return m.Aliases - } - return nil -} - -// Metadata represents a struct that describes -// a basic token. -type Metadata struct { - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - // denom_units represents the list of DenomUnit's for a given coin - DenomUnits []*DenomUnit `protobuf:"bytes,2,rep,name=denom_units,json=denomUnits,proto3" json:"denom_units,omitempty"` - // base represents the base denom (should be the DenomUnit with exponent = 0). - Base string `protobuf:"bytes,3,opt,name=base,proto3" json:"base,omitempty"` - // display indicates the suggested denom that should be - // displayed in clients. - Display string `protobuf:"bytes,4,opt,name=display,proto3" json:"display,omitempty"` -} - -func (m *Metadata) Reset() { *m = Metadata{} } -func (m *Metadata) String() string { return proto.CompactTextString(m) } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_dd052eee12edf988, []int{6} -} -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Metadata.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 *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) -} -func (m *Metadata) XXX_Size() int { - return m.Size() -} -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) -} - -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func (m *Metadata) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *Metadata) GetDenomUnits() []*DenomUnit { - if m != nil { - return m.DenomUnits - } - return nil -} - -func (m *Metadata) GetBase() string { - if m != nil { - return m.Base - } - return "" -} - -func (m *Metadata) GetDisplay() string { - if m != nil { - return m.Display - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "cosmos.bank.v1beta1.Params") - proto.RegisterType((*SendEnabled)(nil), "cosmos.bank.v1beta1.SendEnabled") - proto.RegisterType((*Input)(nil), "cosmos.bank.v1beta1.Input") - proto.RegisterType((*Output)(nil), "cosmos.bank.v1beta1.Output") - proto.RegisterType((*Supply)(nil), "cosmos.bank.v1beta1.Supply") - proto.RegisterType((*DenomUnit)(nil), "cosmos.bank.v1beta1.DenomUnit") - proto.RegisterType((*Metadata)(nil), "cosmos.bank.v1beta1.Metadata") -} - -func init() { proto.RegisterFile("cosmos/bank/v1beta1/bank.proto", fileDescriptor_dd052eee12edf988) } - -var fileDescriptor_dd052eee12edf988 = []byte{ - // 579 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0x3f, 0x8b, 0x13, 0x4f, - 0x18, 0xde, 0xb9, 0xdc, 0xe5, 0x97, 0x9b, 0xfc, 0x6c, 0xd6, 0x14, 0x7b, 0x01, 0x77, 0xd7, 0x05, - 0x21, 0x8a, 0xd9, 0x70, 0x8a, 0x4d, 0x1a, 0x25, 0x2a, 0x7a, 0x85, 0x78, 0xec, 0x21, 0x82, 0x16, - 0x61, 0x36, 0x33, 0xc9, 0x0d, 0xb7, 0x3b, 0xb3, 0xec, 0xcc, 0x8a, 0xf9, 0x06, 0x96, 0x82, 0x16, - 0x82, 0xcd, 0xd5, 0xd6, 0x7e, 0x02, 0xab, 0x2b, 0x0f, 0x6d, 0xac, 0xa2, 0x24, 0x8d, 0xf5, 0x7d, - 0x02, 0x99, 0x99, 0xcd, 0x9f, 0x83, 0x88, 0x58, 0x08, 0x56, 0x3b, 0xef, 0xbc, 0xcf, 0xfb, 0x3c, - 0x0f, 0xef, 0xfb, 0xce, 0x42, 0x77, 0xc0, 0x45, 0xca, 0x45, 0x27, 0x46, 0xec, 0xa8, 0xf3, 0x62, - 0x37, 0x26, 0x12, 0xed, 0xea, 0x20, 0xcc, 0x72, 0x2e, 0xb9, 0x7d, 0xd1, 0xe4, 0x43, 0x7d, 0x55, - 0xe6, 0x9b, 0x8d, 0x11, 0x1f, 0x71, 0x9d, 0xef, 0xa8, 0x93, 0x81, 0x36, 0x77, 0x0c, 0xb4, 0x6f, - 0x12, 0x65, 0x9d, 0x49, 0x2d, 0x55, 0x04, 0x59, 0xa8, 0x0c, 0x38, 0x65, 0x26, 0x1f, 0x7c, 0x01, - 0xb0, 0xba, 0x8f, 0x72, 0x94, 0x0a, 0x7b, 0x08, 0xff, 0x17, 0x84, 0xe1, 0x3e, 0x61, 0x28, 0x4e, - 0x08, 0x76, 0x80, 0x5f, 0x69, 0xd5, 0x6f, 0xf8, 0xe1, 0x1a, 0x1f, 0xe1, 0x01, 0x61, 0xf8, 0xbe, - 0xc1, 0xf5, 0x2e, 0x9f, 0x4d, 0xbc, 0x4b, 0x63, 0x94, 0x26, 0xdd, 0x60, 0xb5, 0xfe, 0x3a, 0x4f, - 0xa9, 0x24, 0x69, 0x26, 0xc7, 0x41, 0x54, 0x17, 0x4b, 0xbc, 0xfd, 0x1c, 0x36, 0x30, 0x19, 0xa2, - 0x22, 0x91, 0xfd, 0x73, 0x7a, 0x1b, 0x3e, 0x68, 0xd5, 0x7a, 0x57, 0xcf, 0x26, 0xde, 0x15, 0xc3, - 0xb6, 0x0e, 0xb5, 0xca, 0x6a, 0x97, 0x80, 0x15, 0x33, 0xdd, 0xcd, 0x77, 0xc7, 0x9e, 0x15, 0x3c, - 0x80, 0xf5, 0x95, 0x4b, 0xbb, 0x01, 0xb7, 0x30, 0x61, 0x3c, 0x75, 0x80, 0x0f, 0x5a, 0xdb, 0x91, - 0x09, 0x6c, 0x07, 0xfe, 0x77, 0x4e, 0x3a, 0x9a, 0x87, 0xdd, 0x9a, 0x22, 0xf9, 0x71, 0xec, 0x81, - 0xe0, 0x0d, 0x80, 0x5b, 0x7b, 0x2c, 0x2b, 0xa4, 0x42, 0x23, 0x8c, 0x73, 0x22, 0x44, 0xc9, 0x32, - 0x0f, 0xed, 0x21, 0xdc, 0x52, 0x0d, 0x15, 0xce, 0x86, 0x6e, 0xd8, 0xce, 0xb2, 0x61, 0x82, 0x2c, - 0x1a, 0x76, 0x97, 0x53, 0xd6, 0xbb, 0x75, 0x32, 0xf1, 0xac, 0x0f, 0xdf, 0xbc, 0xf6, 0x88, 0xca, - 0xc3, 0x22, 0x0e, 0x07, 0x3c, 0xed, 0xd0, 0x9c, 0x0a, 0x46, 0xa4, 0xfe, 0x1e, 0x16, 0x71, 0x5b, - 0xe0, 0xa3, 0xf6, 0x88, 0x77, 0xe4, 0x38, 0x23, 0x42, 0x57, 0x89, 0xc8, 0xd0, 0x77, 0x6b, 0xaf, - 0x8c, 0x2b, 0x2b, 0x78, 0x0b, 0x60, 0xf5, 0x71, 0x21, 0xff, 0x35, 0x5b, 0x9f, 0x00, 0xac, 0x1e, - 0x14, 0x59, 0x96, 0x8c, 0x95, 0xb8, 0xe4, 0x12, 0x25, 0xe5, 0x12, 0xfd, 0x05, 0x71, 0x4d, 0xdf, - 0xdd, 0x57, 0xe2, 0xf3, 0x69, 0x7d, 0xfe, 0xd8, 0xbe, 0x73, 0xed, 0xf7, 0x34, 0x29, 0xc7, 0x45, - 0x42, 0xca, 0x87, 0x47, 0x5e, 0x66, 0x3c, 0x97, 0x04, 0x87, 0xc6, 0xf8, 0x5e, 0xf0, 0x14, 0x6e, - 0xdf, 0x53, 0xeb, 0xf1, 0x84, 0x51, 0xf9, 0x8b, 0xc5, 0x69, 0xc2, 0x9a, 0x2a, 0x63, 0x84, 0x49, - 0xbd, 0x39, 0x17, 0xa2, 0x45, 0xac, 0xe7, 0x91, 0x50, 0x24, 0x88, 0x70, 0x2a, 0x7e, 0x45, 0xcf, - 0xc3, 0x84, 0xc1, 0x7b, 0x00, 0x6b, 0x8f, 0x88, 0x44, 0x18, 0x49, 0x64, 0xfb, 0xb0, 0x8e, 0x89, - 0x18, 0xe4, 0x34, 0x93, 0x94, 0xb3, 0x92, 0x7e, 0xf5, 0xca, 0xbe, 0xad, 0x10, 0x8c, 0xa7, 0xfd, - 0x82, 0x51, 0x39, 0x1f, 0xa2, 0xbb, 0xf6, 0x31, 0x2e, 0xfc, 0x46, 0x10, 0xcf, 0x8f, 0xc2, 0xb6, - 0xe1, 0xa6, 0xea, 0xb6, 0x53, 0xd1, 0xdc, 0xfa, 0xac, 0xdc, 0x61, 0x2a, 0xb2, 0x04, 0x8d, 0x9d, - 0x4d, 0xb3, 0x2d, 0x65, 0xd8, 0x7b, 0x78, 0x32, 0x75, 0xc1, 0xe9, 0xd4, 0x05, 0xdf, 0xa7, 0x2e, - 0x78, 0x3d, 0x73, 0xad, 0xd3, 0x99, 0x6b, 0x7d, 0x9d, 0xb9, 0xd6, 0xb3, 0xf0, 0xcf, 0x3a, 0x1a, - 0x57, 0xf5, 0x8f, 0xe5, 0xe6, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x87, 0x74, 0xf2, 0x72, 0xe0, - 0x04, 0x00, 0x00, -} - -func (this *SendEnabled) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*SendEnabled) - if !ok { - that2, ok := that.(SendEnabled) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if this.Enabled != that1.Enabled { - return false - } - return true -} -func (this *Supply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Supply) - if !ok { - that2, ok := that.(Supply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Total) != len(that1.Total) { - return false - } - for i := range this.Total { - if !this.Total[i].Equal(&that1.Total[i]) { - 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 - if m.DefaultSendEnabled { - i-- - if m.DefaultSendEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.SendEnabled) > 0 { - for iNdEx := len(m.SendEnabled) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SendEnabled[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SendEnabled) 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 *SendEnabled) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SendEnabled) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintBank(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Input) 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 *Input) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Coins) > 0 { - for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintBank(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Output) 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 *Output) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Coins) > 0 { - for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintBank(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Supply) 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 *Supply) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Total) > 0 { - for iNdEx := len(m.Total) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Total[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *DenomUnit) 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 *DenomUnit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DenomUnit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Aliases) > 0 { - for iNdEx := len(m.Aliases) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Aliases[iNdEx]) - copy(dAtA[i:], m.Aliases[iNdEx]) - i = encodeVarintBank(dAtA, i, uint64(len(m.Aliases[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.Exponent != 0 { - i = encodeVarintBank(dAtA, i, uint64(m.Exponent)) - i-- - dAtA[i] = 0x10 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintBank(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Metadata) 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 *Metadata) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Display) > 0 { - i -= len(m.Display) - copy(dAtA[i:], m.Display) - i = encodeVarintBank(dAtA, i, uint64(len(m.Display))) - i-- - dAtA[i] = 0x22 - } - if len(m.Base) > 0 { - i -= len(m.Base) - copy(dAtA[i:], m.Base) - i = encodeVarintBank(dAtA, i, uint64(len(m.Base))) - i-- - dAtA[i] = 0x1a - } - if len(m.DenomUnits) > 0 { - for iNdEx := len(m.DenomUnits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.DenomUnits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintBank(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintBank(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintBank(dAtA []byte, offset int, v uint64) int { - offset -= sovBank(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 - if len(m.SendEnabled) > 0 { - for _, e := range m.SendEnabled { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - if m.DefaultSendEnabled { - n += 2 - } - return n -} - -func (m *SendEnabled) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if m.Enabled { - n += 2 - } - return n -} - -func (m *Input) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if len(m.Coins) > 0 { - for _, e := range m.Coins { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *Output) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if len(m.Coins) > 0 { - for _, e := range m.Coins { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *Supply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Total) > 0 { - for _, e := range m.Total { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *DenomUnit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if m.Exponent != 0 { - n += 1 + sovBank(uint64(m.Exponent)) - } - if len(m.Aliases) > 0 { - for _, s := range m.Aliases { - l = len(s) - n += 1 + l + sovBank(uint64(l)) - } - } - return n -} - -func (m *Metadata) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Description) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - if len(m.DenomUnits) > 0 { - for _, e := range m.DenomUnits { - l = e.Size() - n += 1 + l + sovBank(uint64(l)) - } - } - l = len(m.Base) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - l = len(m.Display) - if l > 0 { - n += 1 + l + sovBank(uint64(l)) - } - return n -} - -func sovBank(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozBank(x uint64) (n int) { - return sovBank(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 ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SendEnabled", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SendEnabled = append(m.SendEnabled, &SendEnabled{}) - if err := m.SendEnabled[len(m.SendEnabled)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DefaultSendEnabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DefaultSendEnabled = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SendEnabled) 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 ErrIntOverflowBank - } - 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: SendEnabled: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SendEnabled: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Input) 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 ErrIntOverflowBank - } - 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: Input: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Coins = append(m.Coins, types.Coin{}) - if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Output) 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 ErrIntOverflowBank - } - 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: Output: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Coins = append(m.Coins, types.Coin{}) - if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Supply) 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 ErrIntOverflowBank - } - 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: Supply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Total = append(m.Total, types.Coin{}) - if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DenomUnit) 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 ErrIntOverflowBank - } - 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: DenomUnit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DenomUnit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) - } - m.Exponent = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Exponent |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Aliases", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Aliases = append(m.Aliases, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Metadata) 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 ErrIntOverflowBank - } - 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: Metadata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomUnits", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBank - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DenomUnits = append(m.DenomUnits, &DenomUnit{}) - if err := m.DenomUnits[len(m.DenomUnits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Base", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Base = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Display", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBank - } - 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 ErrInvalidLengthBank - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthBank - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Display = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBank(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthBank - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipBank(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, ErrIntOverflowBank - } - 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, ErrIntOverflowBank - } - 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, ErrIntOverflowBank - } - 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, ErrInvalidLengthBank - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupBank - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthBank - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthBank = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowBank = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupBank = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/bank/codec.go b/core-sdk/bank/codec.go deleted file mode 100644 index 90e2cf7a..00000000 --- a/core-sdk/bank/codec.go +++ /dev/null @@ -1,33 +0,0 @@ -package bank - -import ( - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/codec/types" - commoncryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" - sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/auth" -) - -var ( - amino = commoncodec.NewLegacyAmino() - ModuleCdc = commoncodec.NewAminoCodec(amino) -) - -func init() { - commoncryptocodec.RegisterCrypto(amino) - amino.Seal() -} - -// No duplicate registration -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgSend{}, - &MsgMultiSend{}, - ) - - registry.RegisterImplementations( - (*auth.Account)(nil), - &auth.BaseAccount{}, - ) -} diff --git a/core-sdk/bank/export.go b/core-sdk/bank/export.go deleted file mode 100644 index 0072eca0..00000000 --- a/core-sdk/bank/export.go +++ /dev/null @@ -1,43 +0,0 @@ -package bank - -import ( - sdk "github.com/irisnet/core-sdk-go/types" -) - -// expose bank module api for user -type Client interface { - sdk.Module - Send(to string, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - SendWitchSpecAccountInfo(to string, sequence, accountNumber uint64, amount sdk.DecCoins, baseTx sdk.BaseTx) (sdk.ResultTx, sdk.Error) - MultiSend(receipts MultiSendRequest, baseTx sdk.BaseTx) ([]sdk.ResultTx, sdk.Error) - SubscribeSendTx(from, to string, callback EventMsgSendCallback) sdk.Subscription - QueryAccount(address string) (sdk.BaseAccount, sdk.Error) - TotalSupply() (sdk.Coins, sdk.Error) -} - -type Receipt struct { - Address string `json:"address"` - Amount sdk.DecCoins `json:"amount"` -} - -type MultiSendRequest struct { - Receipts []Receipt -} - -func (msr MultiSendRequest) Len() int { - return len(msr.Receipts) -} - -func (msr MultiSendRequest) Sub(begin, end int) sdk.SplitAble { - return MultiSendRequest{Receipts: msr.Receipts[begin:end]} -} - -type EventDataMsgSend struct { - Height int64 `json:"height"` - Hash string `json:"hash"` - From string `json:"from"` - To string `json:"to"` - Amount []sdk.Coin `json:"amount"` -} - -type EventMsgSendCallback func(EventDataMsgSend) diff --git a/core-sdk/bank/params.go b/core-sdk/bank/params.go deleted file mode 100644 index 30d94d2b..00000000 --- a/core-sdk/bank/params.go +++ /dev/null @@ -1,23 +0,0 @@ -package bank - -import ( - yaml "gopkg.in/yaml.v2" -) - -// String implements the stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} - -// String implements stringer insterface -func (se SendEnabled) String() string { - out, _ := yaml.Marshal(se) - return string(out) -} - -// String returns a human readable string representation of a supplier. -func (supply Supply) String() string { - bz, _ := yaml.Marshal(supply) - return string(bz) -} diff --git a/core-sdk/bank/query.pb.go b/core-sdk/bank/query.pb.go deleted file mode 100644 index 3dbf405b..00000000 --- a/core-sdk/bank/query.pb.go +++ /dev/null @@ -1,2220 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/bank/v1beta1/query.proto - -package bank - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" - types "github.com/irisnet/core-sdk-go/types" - query "github.com/irisnet/core-sdk-go/types/query" - _ "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 - -// QueryBalanceRequest is the request type for the Query/Balance RPC method. -type QueryBalanceRequest struct { - // address is the address to query balances for. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // denom is the coin denom to query balances for. - Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QueryBalanceRequest) Reset() { *m = QueryBalanceRequest{} } -func (m *QueryBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*QueryBalanceRequest) ProtoMessage() {} -func (*QueryBalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{0} -} -func (m *QueryBalanceRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBalanceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBalanceRequest.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 *QueryBalanceRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBalanceRequest.Merge(m, src) -} -func (m *QueryBalanceRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryBalanceRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBalanceRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBalanceRequest proto.InternalMessageInfo - -// QueryBalanceResponse is the response type for the Query/Balance RPC method. -type QueryBalanceResponse struct { - // balance is the balance of the coin. - Balance *types.Coin `protobuf:"bytes,1,opt,name=balance,proto3" json:"balance,omitempty"` -} - -func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} } -func (m *QueryBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*QueryBalanceResponse) ProtoMessage() {} -func (*QueryBalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{1} -} -func (m *QueryBalanceResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryBalanceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryBalanceResponse.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 *QueryBalanceResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryBalanceResponse.Merge(m, src) -} -func (m *QueryBalanceResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryBalanceResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryBalanceResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryBalanceResponse proto.InternalMessageInfo - -func (m *QueryBalanceResponse) GetBalance() *types.Coin { - if m != nil { - return m.Balance - } - return nil -} - -// QueryBalanceRequest is the request type for the Query/AllBalances RPC method. -type QueryAllBalancesRequest struct { - // address is the address to query balances for. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // pagination defines an optional pagination for the request. - Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllBalancesRequest) Reset() { *m = QueryAllBalancesRequest{} } -func (m *QueryAllBalancesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAllBalancesRequest) ProtoMessage() {} -func (*QueryAllBalancesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{2} -} -func (m *QueryAllBalancesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllBalancesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllBalancesRequest.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 *QueryAllBalancesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBalancesRequest.Merge(m, src) -} -func (m *QueryAllBalancesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAllBalancesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBalancesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllBalancesRequest proto.InternalMessageInfo - -// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC -// method. -type QueryAllBalancesResponse struct { - // balances is the balances of all the coins. - Balances github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=balances,proto3,castrepeated=github.com/irisnet/core-sdk-go/types.Coins" json:"balances"` - // pagination defines the pagination in the response. - Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` -} - -func (m *QueryAllBalancesResponse) Reset() { *m = QueryAllBalancesResponse{} } -func (m *QueryAllBalancesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAllBalancesResponse) ProtoMessage() {} -func (*QueryAllBalancesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{3} -} -func (m *QueryAllBalancesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAllBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAllBalancesResponse.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 *QueryAllBalancesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAllBalancesResponse.Merge(m, src) -} -func (m *QueryAllBalancesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAllBalancesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAllBalancesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAllBalancesResponse proto.InternalMessageInfo - -func (m *QueryAllBalancesResponse) GetBalances() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.Balances - } - return nil -} - -func (m *QueryAllBalancesResponse) GetPagination() *query.PageResponse { - if m != nil { - return m.Pagination - } - return nil -} - -// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC -// method. -type QueryTotalSupplyRequest struct { -} - -func (m *QueryTotalSupplyRequest) Reset() { *m = QueryTotalSupplyRequest{} } -func (m *QueryTotalSupplyRequest) String() string { return proto.CompactTextString(m) } -func (*QueryTotalSupplyRequest) ProtoMessage() {} -func (*QueryTotalSupplyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{4} -} -func (m *QueryTotalSupplyRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTotalSupplyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTotalSupplyRequest.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 *QueryTotalSupplyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTotalSupplyRequest.Merge(m, src) -} -func (m *QueryTotalSupplyRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryTotalSupplyRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTotalSupplyRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTotalSupplyRequest proto.InternalMessageInfo - -// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC -// method -type QueryTotalSupplyResponse struct { - // supply is the supply of the coins - Supply github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,1,rep,name=supply,proto3,castrepeated=github.com/irisnet/core-sdk-go/types.Coins" json:"supply"` -} - -func (m *QueryTotalSupplyResponse) Reset() { *m = QueryTotalSupplyResponse{} } -func (m *QueryTotalSupplyResponse) String() string { return proto.CompactTextString(m) } -func (*QueryTotalSupplyResponse) ProtoMessage() {} -func (*QueryTotalSupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{5} -} -func (m *QueryTotalSupplyResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryTotalSupplyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryTotalSupplyResponse.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 *QueryTotalSupplyResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryTotalSupplyResponse.Merge(m, src) -} -func (m *QueryTotalSupplyResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryTotalSupplyResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryTotalSupplyResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryTotalSupplyResponse proto.InternalMessageInfo - -func (m *QueryTotalSupplyResponse) GetSupply() github_com_irisnet_irishub_sdk_go_types.Coins { - if m != nil { - return m.Supply - } - return nil -} - -// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. -type QuerySupplyOfRequest struct { - // denom is the coin denom to query balances for. - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` -} - -func (m *QuerySupplyOfRequest) Reset() { *m = QuerySupplyOfRequest{} } -func (m *QuerySupplyOfRequest) String() string { return proto.CompactTextString(m) } -func (*QuerySupplyOfRequest) ProtoMessage() {} -func (*QuerySupplyOfRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{6} -} -func (m *QuerySupplyOfRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySupplyOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySupplyOfRequest.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 *QuerySupplyOfRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupplyOfRequest.Merge(m, src) -} -func (m *QuerySupplyOfRequest) XXX_Size() int { - return m.Size() -} -func (m *QuerySupplyOfRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupplyOfRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySupplyOfRequest proto.InternalMessageInfo - -func (m *QuerySupplyOfRequest) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. -type QuerySupplyOfResponse struct { - // amount is the supply of the coin. - Amount types.Coin `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount"` -} - -func (m *QuerySupplyOfResponse) Reset() { *m = QuerySupplyOfResponse{} } -func (m *QuerySupplyOfResponse) String() string { return proto.CompactTextString(m) } -func (*QuerySupplyOfResponse) ProtoMessage() {} -func (*QuerySupplyOfResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9c6fc1939682df13, []int{7} -} -func (m *QuerySupplyOfResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QuerySupplyOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QuerySupplyOfResponse.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 *QuerySupplyOfResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QuerySupplyOfResponse.Merge(m, src) -} -func (m *QuerySupplyOfResponse) XXX_Size() int { - return m.Size() -} -func (m *QuerySupplyOfResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QuerySupplyOfResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QuerySupplyOfResponse proto.InternalMessageInfo - -func (m *QuerySupplyOfResponse) GetAmount() types.Coin { - if m != nil { - return m.Amount - } - return types.Coin{} -} - -// QueryParamsRequest defines the request type for querying x/bank parameters. -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_9c6fc1939682df13, []int{8} -} -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 defines the response type for querying x/bank parameters. -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_9c6fc1939682df13, []int{9} -} -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{} -} - -func init() { - proto.RegisterType((*QueryBalanceRequest)(nil), "cosmos.bank.v1beta1.QueryBalanceRequest") - proto.RegisterType((*QueryBalanceResponse)(nil), "cosmos.bank.v1beta1.QueryBalanceResponse") - proto.RegisterType((*QueryAllBalancesRequest)(nil), "cosmos.bank.v1beta1.QueryAllBalancesRequest") - proto.RegisterType((*QueryAllBalancesResponse)(nil), "cosmos.bank.v1beta1.QueryAllBalancesResponse") - proto.RegisterType((*QueryTotalSupplyRequest)(nil), "cosmos.bank.v1beta1.QueryTotalSupplyRequest") - proto.RegisterType((*QueryTotalSupplyResponse)(nil), "cosmos.bank.v1beta1.QueryTotalSupplyResponse") - proto.RegisterType((*QuerySupplyOfRequest)(nil), "cosmos.bank.v1beta1.QuerySupplyOfRequest") - proto.RegisterType((*QuerySupplyOfResponse)(nil), "cosmos.bank.v1beta1.QuerySupplyOfResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.bank.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.bank.v1beta1.QueryParamsResponse") -} - -func init() { proto.RegisterFile("cosmos/bank/v1beta1/query.proto", fileDescriptor_9c6fc1939682df13) } - -var fileDescriptor_9c6fc1939682df13 = []byte{ - // 685 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x85, 0xa6, 0xe5, 0xb2, 0x5d, 0x83, 0x48, 0x53, 0x70, 0x90, 0x2b, 0xe8, 0x0f, - 0x1a, 0x9f, 0xda, 0x0a, 0x55, 0xb0, 0x11, 0x24, 0x40, 0x62, 0x68, 0x08, 0x4c, 0x6c, 0xe7, 0xe4, - 0x70, 0xad, 0xda, 0x77, 0x6e, 0xce, 0x46, 0xaa, 0xaa, 0x4a, 0x08, 0x81, 0xc4, 0x04, 0x48, 0x0c, - 0x0c, 0x2c, 0x9d, 0xf9, 0x4b, 0x3a, 0x16, 0xb1, 0x30, 0x01, 0x6a, 0x41, 0xe2, 0xcf, 0x40, 0xb9, - 0x1f, 0xc6, 0x69, 0xdc, 0x24, 0x0b, 0x53, 0xec, 0xbb, 0xf7, 0xbe, 0xef, 0xf3, 0xde, 0x7d, 0xcf, - 0x81, 0xb5, 0x36, 0x17, 0x21, 0x17, 0xd8, 0x25, 0x6c, 0x1b, 0x3f, 0x5f, 0x75, 0x69, 0x4c, 0x56, - 0xf1, 0x4e, 0x42, 0xbb, 0xbb, 0x4e, 0xd4, 0xe5, 0x31, 0x47, 0x33, 0x2a, 0xc0, 0xe9, 0x05, 0x38, - 0x3a, 0xa0, 0xba, 0x9c, 0x66, 0x09, 0xaa, 0xa2, 0xd3, 0xdc, 0x88, 0x78, 0x3e, 0x23, 0xb1, 0xcf, - 0x99, 0x12, 0xa8, 0x96, 0x3d, 0xee, 0x71, 0xf9, 0x88, 0x7b, 0x4f, 0x7a, 0xf5, 0xb2, 0xc7, 0xb9, - 0x17, 0x50, 0x4c, 0x22, 0x1f, 0x13, 0xc6, 0x78, 0x2c, 0x53, 0x84, 0xde, 0xb5, 0xb2, 0xfa, 0x46, - 0xb9, 0xcd, 0x7d, 0x36, 0xb0, 0x9f, 0xa1, 0x96, 0x84, 0x72, 0xdf, 0xde, 0x84, 0x33, 0x8f, 0x7a, - 0x54, 0x0d, 0x12, 0x10, 0xd6, 0xa6, 0x2d, 0xba, 0x93, 0x50, 0x11, 0xa3, 0x0a, 0x9c, 0x22, 0x9d, - 0x4e, 0x97, 0x0a, 0x51, 0x01, 0x57, 0xc1, 0xe2, 0x85, 0x96, 0x79, 0x45, 0x65, 0x38, 0xd9, 0xa1, - 0x8c, 0x87, 0x95, 0x09, 0xb9, 0xae, 0x5e, 0x6e, 0x4f, 0xbf, 0x39, 0xa8, 0x15, 0xfe, 0x1c, 0xd4, - 0x0a, 0xf6, 0x43, 0x58, 0xee, 0x17, 0x14, 0x11, 0x67, 0x82, 0xa2, 0x75, 0x38, 0xe5, 0xaa, 0x25, - 0xa9, 0x58, 0x5a, 0x9b, 0x75, 0xd2, 0x79, 0x09, 0x6a, 0xe6, 0xe5, 0xdc, 0xe5, 0x3e, 0x6b, 0x99, - 0x48, 0xfb, 0x35, 0x80, 0x97, 0xa4, 0xda, 0x9d, 0x20, 0xd0, 0x82, 0x62, 0x34, 0xe2, 0x3d, 0x08, - 0xff, 0xcd, 0x56, 0x72, 0x96, 0xd6, 0xae, 0xf7, 0x55, 0x53, 0xc7, 0x66, 0x6a, 0x36, 0x89, 0x67, - 0x1a, 0x6f, 0x65, 0x32, 0x33, 0x4d, 0x7d, 0x01, 0xb0, 0x32, 0xc8, 0xa1, 0x3b, 0x0b, 0xe0, 0xb4, - 0xe6, 0xed, 0x91, 0x9c, 0x1b, 0xda, 0x5a, 0xe3, 0xe6, 0xe1, 0xf7, 0x5a, 0xe1, 0xf3, 0x8f, 0x5a, - 0xdd, 0xf3, 0xe3, 0xad, 0xc4, 0x75, 0xda, 0x3c, 0xc4, 0x7e, 0xd7, 0x17, 0x8c, 0xc6, 0xf2, 0x77, - 0x2b, 0x71, 0xeb, 0xa2, 0xb3, 0x5d, 0xf7, 0x38, 0x8e, 0x77, 0x23, 0x2a, 0x64, 0x96, 0x68, 0xa5, - 0x15, 0xd0, 0xfd, 0x9c, 0xe6, 0x16, 0x46, 0x36, 0xa7, 0x50, 0xb3, 0xdd, 0xd9, 0xb3, 0x7a, 0xb4, - 0x4f, 0x78, 0x4c, 0x82, 0xc7, 0x49, 0x14, 0x05, 0xbb, 0x7a, 0x08, 0xf6, 0x2b, 0xd3, 0x6e, 0xdf, - 0x9e, 0x6e, 0x77, 0x0b, 0x16, 0x85, 0x5c, 0xf9, 0x6f, 0xcd, 0x6a, 0x7d, 0x7b, 0x45, 0x5b, 0x49, - 0x01, 0x6c, 0x3e, 0x33, 0x27, 0x9f, 0x5a, 0x10, 0x64, 0x2c, 0x68, 0x37, 0xe1, 0xc5, 0x53, 0xd1, - 0x1a, 0x78, 0x03, 0x16, 0x49, 0xc8, 0x13, 0x16, 0x8f, 0x34, 0x5e, 0xe3, 0x7c, 0x0f, 0xb8, 0xa5, - 0xc3, 0xed, 0x32, 0x44, 0x52, 0xb1, 0x49, 0xba, 0x24, 0x34, 0xbe, 0xb3, 0x9b, 0xfa, 0xc6, 0x98, - 0x55, 0x5d, 0xe5, 0x16, 0x2c, 0x46, 0x72, 0x45, 0x57, 0x99, 0x73, 0x72, 0x3e, 0x07, 0x8e, 0x4a, - 0x32, 0x75, 0x54, 0xc2, 0xda, 0xef, 0x49, 0x38, 0x29, 0x25, 0xd1, 0x47, 0x00, 0xa7, 0xb4, 0xbf, - 0xd0, 0x62, 0xae, 0x40, 0xce, 0x65, 0xad, 0x2e, 0x8d, 0x11, 0xa9, 0x28, 0xed, 0x8d, 0x97, 0x5f, - 0x7f, 0x7d, 0x98, 0x58, 0x45, 0x18, 0xe7, 0x7f, 0x17, 0x94, 0xc9, 0xf0, 0x9e, 0xbe, 0x4a, 0xfb, - 0x78, 0x4f, 0x0e, 0x77, 0x1f, 0x7d, 0x02, 0xb0, 0x94, 0x31, 0x3f, 0x5a, 0x39, 0xbb, 0xe6, 0xe0, - 0x5d, 0xad, 0xd6, 0xc7, 0x8c, 0xd6, 0x94, 0x58, 0x52, 0x2e, 0xa1, 0x85, 0x31, 0x29, 0xd1, 0x3b, - 0x00, 0x4b, 0x19, 0xaf, 0x0e, 0xa3, 0x1b, 0xb4, 0xfb, 0x30, 0xba, 0x9c, 0x0b, 0x60, 0xcf, 0x4b, - 0xba, 0x2b, 0x68, 0x2e, 0x97, 0x4e, 0x79, 0x17, 0xbd, 0x05, 0x70, 0xda, 0x38, 0x11, 0x0d, 0x39, - 0xa0, 0x53, 0xde, 0xae, 0x2e, 0x8f, 0x13, 0xaa, 0x41, 0x6e, 0x48, 0x90, 0x6b, 0x68, 0x7e, 0x08, - 0x48, 0x7a, 0x80, 0x2f, 0x00, 0x2c, 0x2a, 0xf7, 0xa1, 0x85, 0xb3, 0x6b, 0xf4, 0x59, 0xbd, 0xba, - 0x38, 0x3a, 0x70, 0xac, 0x99, 0x28, 0x9f, 0x37, 0x1e, 0x1c, 0x1e, 0x5b, 0xe0, 0xe8, 0xd8, 0x02, - 0x3f, 0x8f, 0x2d, 0xf0, 0xfe, 0xc4, 0x2a, 0x1c, 0x9d, 0x58, 0x85, 0x6f, 0x27, 0x56, 0xe1, 0xa9, - 0x33, 0xfa, 0x03, 0x11, 0xf2, 0x4e, 0x12, 0x50, 0x25, 0xec, 0x16, 0xe5, 0x9f, 0xd7, 0xfa, 0xdf, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x3d, 0x7b, 0xcd, 0x85, 0x94, 0x07, 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 { - // Balance queries the balance of a single coin for a single account. - Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) - // AllBalances queries the balance of all coins for a single account. - AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) - // TotalSupply queries the total supply of all coins. - TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) - // SupplyOf queries the supply of a single coin. - SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) - // Params queries the parameters of x/bank module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) { - out := new(QueryBalanceResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/Balance", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AllBalances(ctx context.Context, in *QueryAllBalancesRequest, opts ...grpc.CallOption) (*QueryAllBalancesResponse, error) { - out := new(QueryAllBalancesResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/AllBalances", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) TotalSupply(ctx context.Context, in *QueryTotalSupplyRequest, opts ...grpc.CallOption) (*QueryTotalSupplyResponse, error) { - out := new(QueryTotalSupplyResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/TotalSupply", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) SupplyOf(ctx context.Context, in *QuerySupplyOfRequest, opts ...grpc.CallOption) (*QuerySupplyOfResponse, error) { - out := new(QuerySupplyOfResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/SupplyOf", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Balance queries the balance of a single coin for a single account. - Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) - // AllBalances queries the balance of all coins for a single account. - AllBalances(context.Context, *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) - // TotalSupply queries the total supply of all coins. - TotalSupply(context.Context, *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) - // SupplyOf queries the supply of a single coin. - SupplyOf(context.Context, *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) - // Params queries the parameters of x/bank module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Balance(ctx context.Context, req *QueryBalanceRequest) (*QueryBalanceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented") -} -func (*UnimplementedQueryServer) AllBalances(ctx context.Context, req *QueryAllBalancesRequest) (*QueryAllBalancesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AllBalances not implemented") -} -func (*UnimplementedQueryServer) TotalSupply(ctx context.Context, req *QueryTotalSupplyRequest) (*QueryTotalSupplyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method TotalSupply not implemented") -} -func (*UnimplementedQueryServer) SupplyOf(ctx context.Context, req *QuerySupplyOfRequest) (*QuerySupplyOfResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SupplyOf not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryBalanceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Balance(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/Balance", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Balance(ctx, req.(*QueryBalanceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AllBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAllBalancesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AllBalances(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/AllBalances", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AllBalances(ctx, req.(*QueryAllBalancesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_TotalSupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryTotalSupplyRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).TotalSupply(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/TotalSupply", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).TotalSupply(ctx, req.(*QueryTotalSupplyRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_SupplyOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QuerySupplyOfRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).SupplyOf(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.bank.v1beta1.Query/SupplyOf", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).SupplyOf(ctx, req.(*QuerySupplyOfRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/cosmos.bank.v1beta1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.bank.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Balance", - Handler: _Query_Balance_Handler, - }, - { - MethodName: "AllBalances", - Handler: _Query_AllBalances_Handler, - }, - { - MethodName: "TotalSupply", - Handler: _Query_TotalSupply_Handler, - }, - { - MethodName: "SupplyOf", - Handler: _Query_SupplyOf_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/bank/v1beta1/query.proto", -} - -func (m *QueryBalanceRequest) 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 *QueryBalanceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBalanceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryBalanceResponse) 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 *QueryBalanceResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryBalanceResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Balance != nil { - { - size, err := m.Balance.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 *QueryAllBalancesRequest) 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 *QueryAllBalancesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllBalancesRequest) 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.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAllBalancesResponse) 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 *QueryAllBalancesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAllBalancesResponse) 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.Balances) > 0 { - for iNdEx := len(m.Balances) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Balances[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 *QueryTotalSupplyRequest) 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 *QueryTotalSupplyRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTotalSupplyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryTotalSupplyResponse) 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 *QueryTotalSupplyResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryTotalSupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Supply) > 0 { - for iNdEx := len(m.Supply) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Supply[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 *QuerySupplyOfRequest) 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 *QuerySupplyOfRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySupplyOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QuerySupplyOfResponse) 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 *QuerySupplyOfResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QuerySupplyOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Amount.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 *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 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 *QueryBalanceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryBalanceResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Balance != nil { - l = m.Balance.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllBalancesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - if m.Pagination != nil { - l = m.Pagination.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAllBalancesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Balances) > 0 { - for _, e := range m.Balances { - 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 *QueryTotalSupplyRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryTotalSupplyResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Supply) > 0 { - for _, e := range m.Supply { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QuerySupplyOfRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QuerySupplyOfResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Amount.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -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 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 *QueryBalanceRequest) 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: QueryBalanceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBalanceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QueryBalanceResponse) 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: QueryBalanceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBalanceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balance", 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.Balance == nil { - m.Balance = &types.Coin{} - } - if err := m.Balance.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 *QueryAllBalancesRequest) 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: QueryAllBalancesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllBalancesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) - 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.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 *QueryAllBalancesResponse) 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: QueryAllBalancesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Balances", 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.Balances = append(m.Balances, types.Coin{}) - if err := m.Balances[len(m.Balances)-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 *QueryTotalSupplyRequest) 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: QueryTotalSupplyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTotalSupplyRequest: 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 *QueryTotalSupplyResponse) 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: QueryTotalSupplyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryTotalSupplyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Supply", 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.Supply = append(m.Supply, types.Coin{}) - if err := m.Supply[len(m.Supply)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QuerySupplyOfRequest) 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: QuerySupplyOfRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupplyOfRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = 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 *QuerySupplyOfResponse) 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: QuerySupplyOfResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupplyOfResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 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.Amount.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 *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 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/core-sdk/bank/tx.pb.go b/core-sdk/bank/tx.pb.go deleted file mode 100644 index 468ba660..00000000 --- a/core-sdk/bank/tx.pb.go +++ /dev/null @@ -1,669 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/bank/v1beta1/tx.proto - -package bank - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_irisnet_irishub_sdk_go_types "github.com/irisnet/core-sdk-go/types" - types "github.com/irisnet/core-sdk-go/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgSend represents a message to send coins from one account to another. -type MsgSend struct { - FromAddress string `protobuf:"bytes,1,opt,name=from_address,json=fromAddress,proto3" json:"from_address,omitempty" yaml:"from_address"` - ToAddress string `protobuf:"bytes,2,opt,name=to_address,json=toAddress,proto3" json:"to_address,omitempty" yaml:"to_address"` - Amount github_com_irisnet_irishub_sdk_go_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/irisnet/core-sdk-go/types.Coins" json:"amount"` -} - -func (m *MsgSend) Reset() { *m = MsgSend{} } -func (m *MsgSend) String() string { return proto.CompactTextString(m) } -func (*MsgSend) ProtoMessage() {} -func (*MsgSend) Descriptor() ([]byte, []int) { - return fileDescriptor_1d8cb1613481f5b7, []int{0} -} -func (m *MsgSend) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSend.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 *MsgSend) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSend.Merge(m, src) -} -func (m *MsgSend) XXX_Size() int { - return m.Size() -} -func (m *MsgSend) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSend.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSend proto.InternalMessageInfo - -// MsgMultiSend represents an arbitrary multi-in, multi-out send message. -type MsgMultiSend struct { - Inputs []Input `protobuf:"bytes,1,rep,name=inputs,proto3" json:"inputs"` - Outputs []Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs"` -} - -func (m *MsgMultiSend) Reset() { *m = MsgMultiSend{} } -func (m *MsgMultiSend) String() string { return proto.CompactTextString(m) } -func (*MsgMultiSend) ProtoMessage() {} -func (*MsgMultiSend) Descriptor() ([]byte, []int) { - return fileDescriptor_1d8cb1613481f5b7, []int{1} -} -func (m *MsgMultiSend) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMultiSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMultiSend.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 *MsgMultiSend) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMultiSend.Merge(m, src) -} -func (m *MsgMultiSend) XXX_Size() int { - return m.Size() -} -func (m *MsgMultiSend) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMultiSend.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMultiSend proto.InternalMessageInfo - -func (m *MsgMultiSend) GetInputs() []Input { - if m != nil { - return m.Inputs - } - return nil -} - -func (m *MsgMultiSend) GetOutputs() []Output { - if m != nil { - return m.Outputs - } - return nil -} - -func init() { - proto.RegisterType((*MsgSend)(nil), "cosmos.bank.v1beta1.MsgSend") - proto.RegisterType((*MsgMultiSend)(nil), "cosmos.bank.v1beta1.MsgMultiSend") -} - -func init() { proto.RegisterFile("cosmos/bank/v1beta1/tx.proto", fileDescriptor_1d8cb1613481f5b7) } - -var fileDescriptor_1d8cb1613481f5b7 = []byte{ - // 387 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xbd, 0x6e, 0xe2, 0x40, - 0x14, 0x85, 0x6d, 0x40, 0xb0, 0x0c, 0x34, 0x6b, 0x76, 0xb5, 0x2c, 0xbb, 0xb2, 0x91, 0x2b, 0x1a, - 0xc6, 0x62, 0x7f, 0xa4, 0xc8, 0xa9, 0xe2, 0x34, 0x49, 0x81, 0x22, 0x39, 0x5d, 0x9a, 0xc8, 0xc6, - 0x13, 0x63, 0x81, 0x7d, 0x91, 0x67, 0x1c, 0x85, 0x37, 0x88, 0x94, 0x26, 0x8f, 0x40, 0x9d, 0x27, - 0xa1, 0xa4, 0x4c, 0x45, 0x22, 0x68, 0xd2, 0x45, 0xe2, 0x09, 0xa2, 0x19, 0x1b, 0x07, 0x29, 0x48, - 0xa9, 0xec, 0xd1, 0x77, 0xbf, 0xe3, 0x7b, 0x3c, 0xe8, 0xf7, 0x00, 0x68, 0x08, 0xd4, 0x70, 0x9d, - 0x68, 0x64, 0x5c, 0xf7, 0x5c, 0xc2, 0x9c, 0x9e, 0xc1, 0x6e, 0xf0, 0x24, 0x06, 0x06, 0x4a, 0x23, - 0xa5, 0x98, 0x53, 0x9c, 0xd1, 0xd6, 0x37, 0x1f, 0x7c, 0x10, 0xdc, 0xe0, 0x6f, 0xe9, 0x68, 0x4b, - 0xcd, 0x83, 0x28, 0xc9, 0x83, 0x06, 0x10, 0x44, 0x1f, 0xf8, 0xce, 0x87, 0x44, 0xae, 0xe0, 0xfa, - 0xab, 0x8c, 0x2a, 0x7d, 0xea, 0x9f, 0x93, 0xc8, 0x53, 0x4c, 0x54, 0xbf, 0x8a, 0x21, 0xbc, 0x74, - 0x3c, 0x2f, 0x26, 0x94, 0x36, 0xe5, 0xb6, 0xdc, 0xa9, 0x5a, 0x3f, 0x36, 0x4b, 0xad, 0x31, 0x75, - 0xc2, 0xb1, 0xa9, 0xef, 0x52, 0xdd, 0xae, 0xf1, 0xe3, 0x51, 0x7a, 0x52, 0xfe, 0x21, 0xc4, 0x20, - 0x37, 0x0b, 0xc2, 0xfc, 0xbe, 0x59, 0x6a, 0x5f, 0x53, 0xf3, 0x9d, 0xe9, 0x76, 0x95, 0xc1, 0xd6, - 0x1a, 0xa2, 0xb2, 0x13, 0x42, 0x12, 0xb1, 0x66, 0xb1, 0x5d, 0xec, 0xd4, 0xfe, 0xfc, 0xc4, 0x79, - 0x73, 0x4a, 0xb6, 0xcd, 0xf1, 0x31, 0x04, 0x91, 0xf5, 0x7f, 0xbe, 0xd4, 0xa4, 0x87, 0x27, 0xad, - 0xeb, 0x07, 0x6c, 0x98, 0xb8, 0x78, 0x00, 0xa1, 0x11, 0xc4, 0x01, 0x8d, 0x08, 0x13, 0xcf, 0x61, - 0xe2, 0x76, 0xa9, 0x37, 0xea, 0xfa, 0x60, 0xb0, 0xe9, 0x84, 0x50, 0x61, 0x51, 0x3b, 0xcb, 0x37, - 0xbf, 0xdc, 0xce, 0x34, 0xe9, 0x65, 0xa6, 0x49, 0xfa, 0x9d, 0x8c, 0xea, 0x7d, 0xea, 0xf7, 0x93, - 0x31, 0x0b, 0x44, 0xed, 0x03, 0x54, 0x0e, 0xa2, 0x49, 0xc2, 0x78, 0x61, 0xbe, 0x44, 0x0b, 0xef, - 0xf9, 0xfd, 0xf8, 0x94, 0x8f, 0x58, 0x25, 0xbe, 0x85, 0x9d, 0xcd, 0x2b, 0x87, 0xa8, 0x02, 0x09, - 0x13, 0x6a, 0x41, 0xa8, 0xbf, 0xf6, 0xaa, 0x67, 0x62, 0x26, 0x73, 0xb7, 0x86, 0x59, 0xe2, 0xdb, - 0x58, 0x27, 0xf3, 0x95, 0x2a, 0x2f, 0x56, 0xaa, 0xfc, 0xbc, 0x52, 0xe5, 0xfb, 0xb5, 0x2a, 0x2d, - 0xd6, 0xaa, 0xf4, 0xb8, 0x56, 0xa5, 0x0b, 0xfc, 0x79, 0xd1, 0x10, 0xbc, 0x64, 0x4c, 0xd2, 0xcb, - 0x75, 0xcb, 0xe2, 0x42, 0xff, 0xbe, 0x05, 0x00, 0x00, 0xff, 0xff, 0x3a, 0xeb, 0x3d, 0x9a, 0x5b, - 0x02, 0x00, 0x00, -} - -func (m *MsgSend) 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 *MsgSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.ToAddress) > 0 { - i -= len(m.ToAddress) - copy(dAtA[i:], m.ToAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.ToAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.FromAddress) > 0 { - i -= len(m.FromAddress) - copy(dAtA[i:], m.FromAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgMultiSend) 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 *MsgMultiSend) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMultiSend) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Outputs) > 0 { - for iNdEx := len(m.Outputs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Outputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Inputs) > 0 { - for iNdEx := len(m.Inputs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Inputs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func 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 *MsgSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ToAddress) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgMultiSend) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Inputs) > 0 { - for _, e := range m.Inputs { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.Outputs) > 0 { - for _, e := range m.Outputs { - l = e.Size() - n += 1 + l + sovTx(uint64(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 *MsgSend) 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: MsgSend: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSend: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", 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.FromAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ToAddress", 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.ToAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].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 *MsgMultiSend) 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: MsgMultiSend: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMultiSend: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Inputs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Inputs = append(m.Inputs, Input{}) - if err := m.Inputs[len(m.Inputs)-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 Outputs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Outputs = append(m.Outputs, Output{}) - if err := m.Outputs[len(m.Outputs)-1].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 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/core-sdk/bank/types.go b/core-sdk/bank/types.go deleted file mode 100644 index 9c722132..00000000 --- a/core-sdk/bank/types.go +++ /dev/null @@ -1,218 +0,0 @@ -package bank - -import ( - "errors" - "fmt" - - sdk "github.com/irisnet/core-sdk-go/types" -) - -const ( - maxMsgLen = 5 - ModuleName = "bank" - - TypeMsgSend = "send" - TypeMsgMultiSend = "multisend" -) - -var _ sdk.Msg = &MsgSend{} - -// NewMsgSend - construct a msg to send coins from one account to another. -//nolint:interfacer -func NewMsgSend(fromAddr, toAddr sdk.AccAddress, amount sdk.Coins) *MsgSend { - return &MsgSend{ - FromAddress: fromAddr.String(), - ToAddress: toAddr.String(), - Amount: amount, - } -} - -// Route Implements Msg. -func (msg MsgSend) Route() string { return ModuleName } - -// Type Implements Msg. -func (msg MsgSend) Type() string { return TypeMsgSend } - -func (msg MsgSend) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.FromAddress) - if err != nil { - return errors.New("invalid sender address") - } - - _, err = sdk.AccAddressFromBech32(msg.ToAddress) - if err != nil { - return errors.New("invalid recipient address") - } - - if !msg.Amount.IsValid() { - return errors.New("invalid coins") - } - - if !msg.Amount.IsAllPositive() { - return errors.New("invalid coins") - } - - return nil -} - -// GetSignBytes Implements Msg. -func (msg MsgSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners Implements Msg. -func (msg MsgSend) GetSigners() []sdk.AccAddress { - from, err := sdk.AccAddressFromBech32(msg.FromAddress) - if err != nil { - panic(err) - } - return []sdk.AccAddress{from} -} - -var _ sdk.Msg = &MsgMultiSend{} - -// NewMsgMultiSend - construct arbitrary multi-in, multi-out send msg. -func NewMsgMultiSend(in []Input, out []Output) *MsgMultiSend { - return &MsgMultiSend{Inputs: in, Outputs: out} -} - -func (msg MsgMultiSend) Route() string { return ModuleName } - -// Type Implements Msg -func (msg MsgMultiSend) Type() string { return TypeMsgMultiSend } - -// Implements Msg. -func (msg MsgMultiSend) ValidateBasic() error { - // this just makes sure all the inputs and outputs are properly formatted, - // not that they actually have the money inside - if len(msg.Inputs) == 0 { - return errors.New("invalid input coins") - } - if len(msg.Outputs) == 0 { - return errors.New("invalid output coins") - } - // make sure all inputs and outputs are individually valid - var totalIn, totalOut sdk.Coins - for _, in := range msg.Inputs { - if err := in.ValidateBasic(); err != nil { - return err - } - totalIn = totalIn.Add(in.Coins...) - } - for _, out := range msg.Outputs { - if err := out.ValidateBasic(); err != nil { - return err - } - totalOut = totalOut.Add(out.Coins...) - } - // make sure inputs and outputs match - if !totalIn.IsEqual(totalOut) { - return errors.New("inputs and outputs don't match") - } - return nil -} - -// GetSignBytes Implements Msg. -func (msg MsgMultiSend) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} - -// GetSigners Implements Msg. -func (msg MsgMultiSend) GetSigners() []sdk.AccAddress { - addrs := make([]sdk.AccAddress, len(msg.Inputs)) - for i, in := range msg.Inputs { - addr, _ := sdk.AccAddressFromBech32(in.Address) - addrs[i] = addr - } - - return addrs -} - -// ValidateBasic - validate transaction input -func (in Input) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(in.Address) - if err != nil { - return err - } - - if in.Coins.Empty() { - return errors.New("empty input coins") - } - - if !in.Coins.IsValid() { - return fmt.Errorf("invalid input coins [%s]", in.Coins) - } - - if !in.Coins.IsAllPositive() { - return fmt.Errorf("invalid input coins [%s]", in.Coins) - } - - return nil -} - -// NewInput - create a transaction input, used with MsgMultiSend -//nolint:interfacer -func NewInput(addr sdk.AccAddress, coins sdk.Coins) Input { - return Input{ - Address: addr.String(), - Coins: coins, - } -} - -// ValidateBasic - validate transaction output -func (out Output) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(out.Address) - if err != nil { - return fmt.Errorf("invalid output address (%s)", err) - } - - if out.Coins.Empty() { - return errors.New("empty input coins") - } - - if !out.Coins.IsValid() { - return fmt.Errorf("invalid input coins [%s]", out.Coins) - } - - if !out.Coins.IsAllPositive() { - return fmt.Errorf("invalid input coins [%s]", out.Coins) - } - return nil -} - -// NewOutput - create a transaction output, used with MsgMultiSend -//nolint:interfacer -func NewOutput(addr sdk.AccAddress, coins sdk.Coins) Output { - return Output{ - Address: addr.String(), - Coins: coins, - } -} - -// ValidateInputsOutputs validates that each respective input and output is -// valid and that the sum of inputs is equal to the sum of outputs. -func ValidateInputsOutputs(inputs []Input, outputs []Output) error { - var totalIn, totalOut sdk.Coins - for _, in := range inputs { - if err := in.ValidateBasic(); err != nil { - return err - } - - totalIn = totalIn.Add(in.Coins...) - } - - for _, out := range outputs { - if err := out.ValidateBasic(); err != nil { - return err - } - - totalOut = totalOut.Add(out.Coins...) - } - - // make sure inputs and outputs match - if !totalIn.IsEqual(totalOut) { - return errors.New("sum inputs != sum outputs") - } - - return nil -} diff --git a/core-sdk/client.go b/core-sdk/client.go deleted file mode 100644 index 703491d9..00000000 --- a/core-sdk/client.go +++ /dev/null @@ -1,107 +0,0 @@ -package sdk - -import ( - "github.com/tendermint/tendermint/libs/log" - - "github.com/irisnet/core-sdk-go/bank" - "github.com/irisnet/core-sdk-go/client" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - cryptotypes "github.com/irisnet/core-sdk-go/common/codec/types" - commoncryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" - "github.com/irisnet/core-sdk-go/types" - txtypes "github.com/irisnet/core-sdk-go/types/tx" -) - -type Client struct { - logger log.Logger - moduleManager map[string]types.Module - encodingConfig types.EncodingConfig - types.BaseClient - types.KeyManager - Bank bank.Client -} - -func NewClient(cfg types.ClientConfig) Client { - encodingConfig := makeEncodingConfig() - - // create a instance of baseClient - baseClient := client.NewBaseClient(cfg, encodingConfig, nil) - - bankClient := bank.NewClient(baseClient, encodingConfig.Marshaler) - client := Client{ - logger: baseClient.Logger(), - BaseClient: baseClient, - moduleManager: make(map[string]types.Module), - encodingConfig: encodingConfig, - KeyManager: client.KeyManager{ - KeyDAO: cfg.KeyDAO, - Algo: cfg.Algo, - }, - Bank: bankClient, - } - client.RegisterModule( - bankClient, - ) - return client -} - -func (client *Client) SetLogger(logger log.Logger) { - client.BaseClient.SetLogger(logger) -} - -func (client *Client) Codec() *commoncodec.LegacyAmino { - return client.encodingConfig.Amino -} - -func (client *Client) AppCodec() commoncodec.Marshaler { - return client.encodingConfig.Marshaler -} - -func (client *Client) EncodingConfig() types.EncodingConfig { - return client.encodingConfig -} - -func (client *Client) Manager() types.BaseClient { - return client.BaseClient -} - -func (client *Client) RegisterModule(ms ...types.Module) { - for _, m := range ms { - m.RegisterInterfaceTypes(client.encodingConfig.InterfaceRegistry) - } -} - -func (client *Client) Module(name string) types.Module { - return client.moduleManager[name] -} - -func makeEncodingConfig() types.EncodingConfig { - amino := commoncodec.NewLegacyAmino() - interfaceRegistry := cryptotypes.NewInterfaceRegistry() - marshaler := commoncodec.NewProtoCodec(interfaceRegistry) - txCfg := txtypes.NewTxConfig(marshaler, txtypes.DefaultSignModes) - - encodingConfig := types.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Marshaler: marshaler, - TxConfig: txCfg, - Amino: amino, - } - RegisterLegacyAminoCodec(encodingConfig.Amino) - RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} - -// RegisterLegacyAminoCodec registers the sdk message type. -func RegisterLegacyAminoCodec(cdc *commoncodec.LegacyAmino) { - cdc.RegisterInterface((*types.Msg)(nil), nil) - cdc.RegisterInterface((*types.Tx)(nil), nil) - commoncryptocodec.RegisterCrypto(cdc) -} - -// RegisterInterfaces registers the sdk message type. -func RegisterInterfaces(registry cryptotypes.InterfaceRegistry) { - registry.RegisterInterface("cosmos.v1beta1.Msg", (*types.Msg)(nil)) - txtypes.RegisterInterfaces(registry) - commoncryptocodec.RegisterInterfaces(registry) -} diff --git a/core-sdk/client/account.go b/core-sdk/client/account.go deleted file mode 100644 index 73317092..00000000 --- a/core-sdk/client/account.go +++ /dev/null @@ -1,142 +0,0 @@ -package client - -import ( - "context" - "fmt" - "time" - - "github.com/tendermint/tendermint/libs/log" - - "github.com/irisnet/core-sdk-go/bank" - cache "github.com/irisnet/core-sdk-go/common/cache" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/auth" -) - -// Must be used with locker, otherwise there are thread safety issues -type AccountQuery struct { - sdk.Queries - sdk.GRPCClient - log.Logger - cache.Cache - cdc commoncodec.Marshaler - Km sdk.KeyManager - expiration time.Duration -} - -func (a AccountQuery) QueryAndRefreshAccount(address string) (sdk.BaseAccount, sdk.Error) { - account, err := a.Get(a.prefixKey(address)) - if err != nil { - return a.refresh(address) - } - - acc := account.(accountInfo) - baseAcc := sdk.BaseAccount{ - Address: address, - AccountNumber: acc.N, - Sequence: acc.S + 1, - } - a.saveAccount(baseAcc) - - a.Debug("query account from cache", "address", address) - return baseAcc, nil -} - -func (a AccountQuery) QueryAccount(address string) (sdk.BaseAccount, sdk.Error) { - conn, err := a.GenConn() - - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - request := &auth.QueryAccountRequest{ - Address: address, - } - - response, err := auth.NewQueryClient(conn).Account(context.Background(), request) - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - var baseAccount auth.Account - if err := a.cdc.UnpackAny(response.Account, &baseAccount); err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - account := baseAccount.(*auth.BaseAccount).ConvertAccount(a.cdc).(sdk.BaseAccount) - - breq := &bank.QueryAllBalancesRequest{ - Address: address, - Pagination: nil, - } - balances, err := bank.NewQueryClient(conn).AllBalances(context.Background(), breq) - if err != nil { - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - account.Coins = balances.Balances - return account, nil -} - -func (a AccountQuery) QueryAddress(name, password string) (sdk.AccAddress, sdk.Error) { - addr, err := a.Get(a.prefixKey(name)) - if err == nil { - address, err := sdk.AccAddressFromBech32(addr.(string)) - if err != nil { - a.Debug("invalid address", "name", name) - _ = a.Remove(a.prefixKey(name)) - } else { - return address, nil - } - } - - _, address, err := a.Km.Find(name, password) - if err != nil { - a.Debug("can't find account", "name", name) - return address, sdk.Wrap(err) - } - - if err := a.SetWithExpire(a.prefixKey(name), address.String(), a.expiration); err != nil { - a.Debug("cache user failed", "name", name) - } - a.Debug("query user from cache", "name", name, "address", address.String()) - return address, nil -} - -func (a AccountQuery) removeCache(address string) bool { - return a.Remove(a.prefixKey(address)) -} - -func (a AccountQuery) refresh(address string) (sdk.BaseAccount, sdk.Error) { - account, err := a.QueryAccount(address) - if err != nil { - a.Error("update cache failed", "address", address, "errMsg", err.Error()) - return sdk.BaseAccount{}, sdk.Wrap(err) - } - - a.saveAccount(account) - return account, nil -} - -func (a AccountQuery) saveAccount(account sdk.BaseAccount) { - address := account.Address - info := accountInfo{ - N: account.AccountNumber, - S: account.Sequence, - } - if err := a.SetWithExpire(a.prefixKey(address), info, a.expiration); err != nil { - a.Debug("cache user failed", "address", account.Address) - return - } - a.Debug("cache account", "address", address, "expiration", a.expiration.String()) -} - -func (a AccountQuery) prefixKey(address string) string { - return fmt.Sprintf("account:%s", address) -} - -type accountInfo struct { - N uint64 `json:"n"` - S uint64 `json:"s"` -} diff --git a/core-sdk/client/base_client.go b/core-sdk/client/base_client.go deleted file mode 100644 index 4573755b..00000000 --- a/core-sdk/client/base_client.go +++ /dev/null @@ -1,479 +0,0 @@ -// Package modules is to warpped the API provided by each module of IRITA -// -package client - -import ( - "context" - "encoding/hex" - "errors" - "fmt" - "strings" - "time" - - "github.com/avast/retry-go" - "github.com/gogo/protobuf/proto" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/tmhash" - "github.com/tendermint/tendermint/libs/log" - rpcclient "github.com/tendermint/tendermint/rpc/client" - - "google.golang.org/grpc" - - "github.com/irisnet/core-sdk-go/common" - commoncache "github.com/irisnet/core-sdk-go/common/cache" - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - sdklog "github.com/irisnet/core-sdk-go/common/log" - sdktypes "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/tx" -) - -const ( - concurrency = 16 - cacheCapacity = 100 - cacheExpirePeriod = 1 * time.Minute - tryThreshold = 3 - maxBatch = 100 -) - -type baseClient struct { - sdktypes.TmClient - sdktypes.TokenManager - sdktypes.KeyManager - cfg *sdktypes.ClientConfig - encodingConfig sdktypes.EncodingConfig - l *locker - AccountQuery -} - -// NewBaseClient return the baseClient for every sub modules -func NewBaseClient(cfg sdktypes.ClientConfig, encodingConfig sdktypes.EncodingConfig, logger log.Logger) sdktypes.BaseClient { - // create logger - if logger == nil { - logger = sdklog.NewLogger(sdklog.Config{ - Format: sdklog.FormatText, - Level: cfg.Level, - }) - } - - base := baseClient{ - TmClient: NewRPCClient(cfg.NodeURI, encodingConfig.Amino, encodingConfig.TxConfig.TxDecoder(), logger, cfg.Timeout), - cfg: &cfg, - encodingConfig: encodingConfig, - l: NewLocker(concurrency).setLogger(logger), - TokenManager: cfg.TokenManager, - } - base.KeyManager = KeyManager{ - KeyDAO: cfg.KeyDAO, - Algo: cfg.Algo, - } - - c := commoncache.NewCache(cacheCapacity, cfg.Cached) - base.AccountQuery = AccountQuery{ - Queries: base, - GRPCClient: NewGRPCClient(cfg.GRPCAddr), - Logger: logger, - Cache: c, - cdc: encodingConfig.Marshaler, - Km: base.KeyManager, - expiration: cacheExpirePeriod, - } - return &base -} - -func (base *baseClient) Logger() log.Logger { - return base.AccountQuery.Logger -} - -func (base *baseClient) SetLogger(logger log.Logger) { - base.AccountQuery.Logger = logger -} - -// Codec returns codec. -func (base *baseClient) Marshaler() commoncodec.Marshaler { - return base.encodingConfig.Marshaler -} - -func (base *baseClient) GenConn() (*grpc.ClientConn, error) { - return base.AccountQuery.GenConn() -} - -func (base *baseClient) BuildTxHash(msg []sdktypes.Msg, baseTx sdktypes.BaseTx) (string, sdktypes.Error) { - txByte, _, err := base.buildTx(msg, baseTx) - if err != nil { - return "", sdktypes.Wrap(err) - } - return strings.ToUpper(hex.EncodeToString(tmhash.Sum(txByte))), nil -} - -func (base *baseClient) BuildAndSign(msg []sdktypes.Msg, baseTx sdktypes.BaseTx) ([]byte, sdktypes.Error) { - builder, err := base.prepare(baseTx) - if err != nil { - return nil, sdktypes.Wrap(err) - } - - txByte, err := builder.BuildAndSign(baseTx.From, msg, true) - if err != nil { - return nil, sdktypes.Wrap(err) - } - - base.Logger().Debug("sign transaction success") - return txByte, nil -} - -func (base *baseClient) BuildAndSendWithAccount(addr string, accountNumber, sequence uint64, msg []sdktypes.Msg, baseTx sdktypes.BaseTx) (sdktypes.ResultTx, sdktypes.Error) { - txByte, ctx, err := base.buildTxWithAccount(addr, accountNumber, sequence, msg, baseTx) - if err != nil { - return sdktypes.ResultTx{}, err - } - - valid, err := base.ValidateTxSize(len(txByte), msg) - if err != nil { - return sdktypes.ResultTx{}, err - } - if !valid { - base.Logger().Debug("tx is too large") - // filter out transactions that have been sent - // reset the maximum number of msg in each transaction - //batch = batch / 2 - return sdktypes.ResultTx{}, sdktypes.GetError(sdktypes.RootCodespace, uint32(sdktypes.TxTooLarge)) - } - return base.broadcastTx(txByte, ctx.Mode()) -} - -func (base *baseClient) BuildAndSend(msg []sdktypes.Msg, baseTx sdktypes.BaseTx) (sdktypes.ResultTx, sdktypes.Error) { - var res sdktypes.ResultTx - var address string - - // lock the account - base.l.Lock(baseTx.From) - defer base.l.Unlock(baseTx.From) - - retryableFunc := func() error { - txByte, ctx, e := base.buildTx(msg, baseTx) - if e != nil { - return e - } - - if res, e = base.broadcastTx(txByte, ctx.Mode()); e != nil { - address = ctx.Address() - return e - } - return nil - } - - retryIfFunc := func(err error) bool { - e, ok := err.(sdktypes.Error) - if ok && sdktypes.Code(e.Code()) == sdktypes.WrongSequence { - return true - } - return false - } - - onRetryFunc := func(n uint, err error) { - _ = base.removeCache(address) - base.Logger().Error("wrong sequence, will retry", - "address", address, "attempts", n, "err", err.Error()) - } - - err := retry.Do(retryableFunc, - retry.Attempts(tryThreshold), - retry.RetryIf(retryIfFunc), - retry.OnRetry(onRetryFunc), - ) - - if err != nil { - return res, sdktypes.Wrap(err) - } - return res, nil -} - -func (base *baseClient) SendBatch(msgs sdktypes.Msgs, baseTx sdktypes.BaseTx) (rs []sdktypes.ResultTx, err sdktypes.Error) { - if msgs == nil || len(msgs) == 0 { - return rs, sdktypes.Wrapf("must have at least one message in list") - } - - defer sdktypes.CatchPanic(func(errMsg string) { - base.Logger().Error("broadcast msg failed", "errMsg", errMsg) - }) - // validate msg - for _, m := range msgs { - if err := m.ValidateBasic(); err != nil { - return rs, sdktypes.Wrap(err) - } - } - base.Logger().Debug("validate msg success") - - // lock the account - base.l.Lock(baseTx.From) - defer base.l.Unlock(baseTx.From) - - var address string - var batch = maxBatch - - retryableFunc := func() error { - for i, ms := range common.SubArray(batch, msgs) { - mss := ms.(sdktypes.Msgs) - txByte, ctx, err := base.buildTx(mss, baseTx) - if err != nil { - return err - } - - valid, err := base.ValidateTxSize(len(txByte), mss) - if err != nil { - return err - } - if !valid { - base.Logger().Debug("tx is too large", "msgsLength", batch) - // filter out transactions that have been sent - msgs = msgs[i*batch:] - // reset the maximum number of msg in each transaction - batch = batch / 2 - return sdktypes.GetError(sdktypes.RootCodespace, uint32(sdktypes.TxTooLarge)) - } - res, err := base.broadcastTx(txByte, ctx.Mode()) - if err != nil { - address = ctx.Address() - return err - } - rs = append(rs, res) - } - return nil - } - - retryIf := func(err error) bool { - e, ok := err.(sdktypes.Error) - if ok && (sdktypes.Code(e.Code()) == sdktypes.InvalidSequence || sdktypes.Code(e.Code()) == sdktypes.TxTooLarge) { - return true - } - return false - } - - onRetry := func(n uint, err error) { - _ = base.removeCache(address) - base.Logger().Error("wrong sequence, will retry", - "address", address, "attempts", n, "err", err.Error()) - } - - _ = retry.Do(retryableFunc, - retry.Attempts(tryThreshold), - retry.RetryIf(retryIf), - retry.OnRetry(onRetry), - ) - return rs, nil -} - -func (base baseClient) QueryWithResponse(path string, data interface{}, result sdktypes.Response) error { - res, err := base.Query(path, data) - if err != nil { - return err - } - - if err := base.encodingConfig.Marshaler.UnmarshalJSON(res, result.(proto.Message)); err != nil { - return err - } - - return nil -} - -func (base baseClient) Query(path string, data interface{}) ([]byte, error) { - var bz []byte - var err error - if data != nil { - bz, err = base.encodingConfig.Marshaler.MarshalJSON(data.(proto.Message)) - if err != nil { - return nil, err - } - } - - opts := rpcclient.ABCIQueryOptions{ - // Height: cliCtx.Height, - Prove: false, - } - result, err := base.ABCIQueryWithOptions(context.Background(), path, bz, opts) - if err != nil { - return nil, err - } - - resp := result.Response - if !resp.IsOK() { - return nil, errors.New(resp.Log) - } - - return resp.Value, nil -} - -func (base baseClient) QueryStore(key sdktypes.HexBytes, storeName string, height int64, prove bool) (res abci.ResponseQuery, err error) { - path := fmt.Sprintf("/store/%s/%s", storeName, "key") - opts := rpcclient.ABCIQueryOptions{ - Prove: prove, - Height: height, - } - - result, err := base.ABCIQueryWithOptions(context.Background(), path, key, opts) - if err != nil { - return res, err - } - - resp := result.Response - if !resp.IsOK() { - return res, errors.New(resp.Log) - } - return resp, nil -} - -func (base *baseClient) prepare(baseTx sdktypes.BaseTx) (*sdktypes.Factory, error) { - factory := sdktypes.NewFactory(). - WithChainID(base.cfg.ChainID). - WithKeyManager(base.AccountQuery.Km). - WithMode(base.cfg.Mode). - WithSimulateAndExecute(baseTx.SimulateAndExecute). - WithGas(base.cfg.Gas). - WithGasAdjustment(base.cfg.GasAdjustment). - WithSignModeHandler(tx.MakeSignModeHandler(tx.DefaultSignModes)). - WithTxConfig(base.encodingConfig.TxConfig). - WithQueryFunc(base.QueryWithData) - - addr, err := base.QueryAddress(baseTx.From, baseTx.Password) - if err != nil { - return nil, err - } - factory.WithAddress(addr.String()) - - account, err := base.QueryAndRefreshAccount(addr.String()) - if err != nil { - return nil, err - } - factory.WithAccountNumber(account.AccountNumber). - WithSequence(account.Sequence). - WithPassword(baseTx.Password) - - if !baseTx.Fee.Empty() && baseTx.Fee.IsValid() { - fees, err := base.TokenManager.ToMinCoin(baseTx.Fee...) - if err != nil { - return nil, err - } - factory.WithFee(fees) - } else { - fees, err := base.TokenManager.ToMinCoin(base.cfg.Fee...) - if err != nil { - panic(err) - } - factory.WithFee(fees) - } - - if len(baseTx.Mode) > 0 { - factory.WithMode(baseTx.Mode) - } - - if baseTx.Gas > 0 { - factory.WithGas(baseTx.Gas) - } - - if baseTx.GasAdjustment > 0 { - factory.WithGasAdjustment(baseTx.GasAdjustment) - } - - if len(baseTx.Memo) > 0 { - factory.WithMemo(baseTx.Memo) - } - return factory, nil -} - -// TODO -func (base *baseClient) prepareWithAccount(addr string, accountNumber, sequence uint64, baseTx sdktypes.BaseTx) (*sdktypes.Factory, error) { - factory := sdktypes.NewFactory(). - WithChainID(base.cfg.ChainID). - WithKeyManager(base.AccountQuery.Km). - WithMode(base.cfg.Mode). - WithSimulateAndExecute(baseTx.SimulateAndExecute). - WithGas(base.cfg.Gas). - WithSignModeHandler(tx.MakeSignModeHandler(tx.DefaultSignModes)). - WithTxConfig(base.encodingConfig.TxConfig) - - factory.WithAddress(addr). - WithAccountNumber(accountNumber). - WithSequence(sequence). - WithPassword(baseTx.Password) - - if !baseTx.Fee.Empty() && baseTx.Fee.IsValid() { - fees, err := base.TokenManager.ToMinCoin(baseTx.Fee...) - if err != nil { - return nil, err - } - factory.WithFee(fees) - } else { - fees, err := base.TokenManager.ToMinCoin(base.cfg.Fee...) - if err != nil { - panic(err) - } - factory.WithFee(fees) - } - - if len(baseTx.Mode) > 0 { - factory.WithMode(baseTx.Mode) - } - - if baseTx.Gas > 0 { - factory.WithGas(baseTx.Gas) - } - - if len(baseTx.Memo) > 0 { - factory.WithMemo(baseTx.Memo) - } - return factory, nil -} - -func (base *baseClient) ValidateTxSize(txSize int, msgs []sdktypes.Msg) (bool, sdktypes.Error) { - if uint64(txSize) > base.cfg.TxSizeLimit { - return false, nil - } - return true, nil -} - -type locker struct { - shards []chan int - size int - logger log.Logger -} - -//NewLocker implement the function of lock, can lock resources according to conditions -func NewLocker(size int) *locker { - shards := make([]chan int, size) - for i := 0; i < size; i++ { - shards[i] = make(chan int, 1) - } - return &locker{ - shards: shards, - size: size, - } -} - -func (l *locker) setLogger(logger log.Logger) *locker { - l.logger = logger - return l -} - -func (l *locker) Lock(key string) { - ch := l.getShard(key) - ch <- 1 -} - -func (l *locker) Unlock(key string) { - ch := l.getShard(key) - <-ch -} - -func (l *locker) getShard(key string) chan int { - index := uint(l.indexFor(key)) % uint(l.size) - return l.shards[index] -} - -func (l *locker) indexFor(key string) uint32 { - hash := uint32(2166136261) - const prime32 = uint32(16777619) - for i := 0; i < len(key); i++ { - hash *= prime32 - hash ^= uint32(key[i]) - } - return hash -} diff --git a/core-sdk/client/grpc_client.go b/core-sdk/client/grpc_client.go deleted file mode 100644 index f0af1956..00000000 --- a/core-sdk/client/grpc_client.go +++ /dev/null @@ -1,35 +0,0 @@ -package client - -import ( - "sync" - - "github.com/prometheus/common/log" - "google.golang.org/grpc" - - "github.com/irisnet/core-sdk-go/types" -) - -var clientConnSingleton *grpc.ClientConn -var once sync.Once - -type grpcClient struct { -} - -func NewGRPCClient(url string) types.GRPCClient { - once.Do(func() { - dialOpts := []grpc.DialOption{ - grpc.WithInsecure(), - } - clientConn, err := grpc.Dial(url, dialOpts...) - if err != nil { - log.Error(err.Error()) - panic(err) - } - clientConnSingleton = clientConn - }) - return &grpcClient{} -} - -func (g grpcClient) GenConn() (*grpc.ClientConn, error) { - return clientConnSingleton, nil -} diff --git a/core-sdk/client/keys.go b/core-sdk/client/keys.go deleted file mode 100644 index 831831f8..00000000 --- a/core-sdk/client/keys.go +++ /dev/null @@ -1,238 +0,0 @@ -package client - -import ( - "fmt" - - tmcrypto "github.com/tendermint/tendermint/crypto" - - kmg "github.com/irisnet/core-sdk-go/common/crypto" - cryptoamino "github.com/irisnet/core-sdk-go/common/crypto/codec" - "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" - "github.com/irisnet/core-sdk-go/common/crypto/keys/sm2" - commoncryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" - "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/store" -) - -type KeyManager struct { - KeyDAO store.KeyDAO - Algo string -} - -func (k KeyManager) Add(name, password string) (string, string, types.Error) { - address, mnemonic, err := k.Insert(name, password) - return address, mnemonic, types.Wrap(err) -} - -func (k KeyManager) Sign(name, password string, data []byte) ([]byte, tmcrypto.PubKey, error) { - info, err := k.KeyDAO.Read(name, password) - if err != nil { - return nil, nil, fmt.Errorf("name %s not exist", name) - } - - km, err := kmg.NewPrivateKeyManager([]byte(info.PrivKeyArmor), string(info.Algo)) - if err != nil { - return nil, nil, fmt.Errorf("name %s not exist", name) - } - - signByte, err := km.Sign(data) - if err != nil { - return nil, nil, err - } - - return signByte, FromTmPubKey(info.Algo, km.ExportPubKey()), nil -} - -func (k KeyManager) Insert(name, password string) (string, string, error) { - if k.KeyDAO.Has(name) { - return "", "", fmt.Errorf("name %s has existed", name) - } - - km, err := kmg.NewAlgoKeyManager(k.Algo) - if err != nil { - return "", "", err - } - - mnemonic, priv := km.Generate() - - pubKey := km.ExportPubKey() - address := types.AccAddress(pubKey.Address().Bytes()).String() - - info := store.KeyInfo{ - Name: name, - PubKey: cryptoamino.MarshalPubkey(pubKey), - PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.Algo, - } - - if err = k.KeyDAO.Write(name, password, info); err != nil { - return "", "", err - } - return address, mnemonic, nil -} - -func (k KeyManager) Recover(name, password, mnemonic, hdPath string) (string, error) { - if k.KeyDAO.Has(name) { - return "", fmt.Errorf("name %s has existed", name) - } - var ( - km kmg.KeyManager - err error - ) - if hdPath == "" { - km, err = kmg.NewMnemonicKeyManager(mnemonic, k.Algo) - } else { - km, err = kmg.NewMnemonicKeyManagerWithHDPath(mnemonic, k.Algo, hdPath) - } - - if err != nil { - return "", err - } - - _, priv := km.Generate() - - pubKey := km.ExportPubKey() - address := types.AccAddress(pubKey.Address().Bytes()).String() - - info := store.KeyInfo{ - Name: name, - PubKey: cryptoamino.MarshalPubkey(pubKey), - PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.Algo, - } - - if err = k.KeyDAO.Write(name, password, info); err != nil { - return "", err - } - - return address, nil -} - -func (k KeyManager) Import(name, password, armor string) (string, error) { - if k.KeyDAO.Has(name) { - return "", fmt.Errorf("%s has existed", name) - } - - km := kmg.NewKeyManager() - - priv, _, err := km.ImportPrivKey(armor, password) - if err != nil { - return "", err - } - - pubKey := km.ExportPubKey() - address := types.AccAddress(pubKey.Address().Bytes()).String() - - info := store.KeyInfo{ - Name: name, - PubKey: cryptoamino.MarshalPubkey(pubKey), - PrivKeyArmor: string(cryptoamino.MarshalPrivKey(priv)), - Algo: k.Algo, - } - - err = k.KeyDAO.Write(name, password, info) - if err != nil { - return "", err - } - return address, nil -} - -func (k KeyManager) Export(name, password string) (armor string, err error) { - info, err := k.KeyDAO.Read(name, password) - if err != nil { - return armor, fmt.Errorf("name %s not exist", name) - } - - km, err := kmg.NewPrivateKeyManager([]byte(info.PrivKeyArmor), info.Algo) - if err != nil { - return "", err - } - - return km.ExportPrivKey(password) -} - -func (k KeyManager) Delete(name, password string) error { - return k.KeyDAO.Delete(name, password) -} - -func (k KeyManager) Find(name, password string) (tmcrypto.PubKey, types.AccAddress, error) { - info, err := k.KeyDAO.Read(name, password) - if err != nil { - return nil, nil, types.WrapWithMessage(err, "name %s not exist", name) - } - - pubKey, err := cryptoamino.PubKeyFromBytes(info.PubKey) - if err != nil { - return nil, nil, types.WrapWithMessage(err, "name %s not exist", name) - } - - return FromTmPubKey(info.Algo, pubKey), types.AccAddress(pubKey.Address().Bytes()), nil -} - -func FromTmPubKey(Algo string, pubKey tmcrypto.PubKey) commoncryptotypes.PubKey { - var pubkey commoncryptotypes.PubKey - pubkeyBytes := pubKey.Bytes() - switch Algo { - case "sm2": - pubkey = &sm2.PubKey{Key: pubkeyBytes} - case "secp256k1": - pubkey = &secp256k1.PubKey{Key: pubkeyBytes} - } - return pubkey -} - -type Client interface { - Add(name, password string) (address string, mnemonic string, err types.Error) - Recover(name, password, mnemonic string) (address string, err types.Error) - RecoverWithHDPath(name, password, mnemonic, hdPath string) (address string, err types.Error) - Import(name, password, privKeyArmor string) (address string, err types.Error) - Export(name, password string) (privKeyArmor string, err types.Error) - Delete(name, password string) types.Error - Show(name, password string) (string, types.Error) -} - -type keysClient struct { - types.KeyManager -} - -func NewClient(keyManager types.KeyManager) Client { - return keysClient{keyManager} -} - -func (k keysClient) Add(name, password string) (string, string, types.Error) { - address, mnemonic, err := k.Insert(name, password) - return address, mnemonic, types.Wrap(err) -} - -func (k keysClient) Recover(name, password, mnemonic string) (string, types.Error) { - address, err := k.KeyManager.Recover(name, password, mnemonic, "") - return address, types.Wrap(err) -} - -func (k keysClient) RecoverWithHDPath(name, password, mnemonic, hdPath string) (string, types.Error) { - address, err := k.KeyManager.Recover(name, password, mnemonic, hdPath) - return address, types.Wrap(err) -} - -func (k keysClient) Import(name, password, privKeyArmor string) (string, types.Error) { - address, err := k.KeyManager.Import(name, password, privKeyArmor) - return address, types.Wrap(err) -} - -func (k keysClient) Export(name, password string) (string, types.Error) { - keystore, err := k.KeyManager.Export(name, password) - return keystore, types.Wrap(err) -} - -func (k keysClient) Delete(name, password string) types.Error { - err := k.KeyManager.Delete(name, password) - return types.Wrap(err) -} - -func (k keysClient) Show(name, password string) (string, types.Error) { - _, address, err := k.KeyManager.Find(name, password) - if err != nil { - return "", types.Wrap(err) - } - return address.String(), nil -} diff --git a/core-sdk/client/rpc_client.go b/core-sdk/client/rpc_client.go deleted file mode 100644 index 936a954f..00000000 --- a/core-sdk/client/rpc_client.go +++ /dev/null @@ -1,212 +0,0 @@ -package client - -import ( - "context" - "fmt" - - "github.com/tendermint/tendermint/crypto/tmhash" - "github.com/tendermint/tendermint/libs/log" - rpc "github.com/tendermint/tendermint/rpc/client" - rpchttp "github.com/tendermint/tendermint/rpc/client/http" - tmtypes "github.com/tendermint/tendermint/types" - - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - - "github.com/irisnet/core-sdk-go/common/uuid" - sdk "github.com/irisnet/core-sdk-go/types" -) - -type rpcClient struct { - rpc.Client - log.Logger - cdc *commoncodec.LegacyAmino - txDecoder sdk.TxDecoder -} - -func NewRPCClient( - remote string, - cdc *commoncodec.LegacyAmino, - txDecoder sdk.TxDecoder, - logger log.Logger, - timeout uint, -) sdk.TmClient { - client, err := rpchttp.NewWithTimeout(remote, "/websocket", timeout) - if err != nil { - panic(err) - } - - _ = client.Start() - return rpcClient{ - Client: client, - Logger: logger, - cdc: cdc, - txDecoder: txDecoder, - } -} - -// ============================================================================= -// SubscribeNewBlock implement WSClient interface -func (r rpcClient) SubscribeNewBlock(builder *sdk.EventQueryBuilder, handler sdk.EventNewBlockHandler) (sdk.Subscription, sdk.Error) { - if builder == nil { - builder = sdk.NewEventQueryBuilder() - } - builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(tmtypes.EventNewBlock)) - query := builder.Build() - - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataNewBlock)) - }) -} - -// SubscribeTx implement WSClient interface -func (r rpcClient) SubscribeTx(builder *sdk.EventQueryBuilder, handler sdk.EventTxHandler) (sdk.Subscription, sdk.Error) { - if builder == nil { - builder = sdk.NewEventQueryBuilder() - } - query := builder.AddCondition(sdk.Cond(sdk.TypeKey).EQ(sdk.TxValue)).Build() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataTx)) - }) -} - -func (r rpcClient) SubscribeNewBlockHeader(handler sdk.EventNewBlockHeaderHandler) (sdk.Subscription, sdk.Error) { - query := tmtypes.QueryForEvent(tmtypes.EventNewBlockHeader).String() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataNewBlockHeader)) - }) -} - -func (r rpcClient) SubscribeValidatorSetUpdates(handler sdk.EventValidatorSetUpdatesHandler) (sdk.Subscription, sdk.Error) { - query := tmtypes.QueryForEvent(tmtypes.EventValidatorSetUpdates).String() - return r.SubscribeAny(query, func(data sdk.EventData) { - handler(data.(sdk.EventDataValidatorSetUpdates)) - }) -} - -func (r rpcClient) Resubscribe(subscription sdk.Subscription, handler sdk.EventHandler) (err sdk.Error) { - _, err = r.SubscribeAny(subscription.Query, handler) - return -} - -func (r rpcClient) Unsubscribe(subscription sdk.Subscription) sdk.Error { - r.Info("end to subscribe event", "query", subscription.Query, "subscriber", subscription.ID) - err := r.Client.Unsubscribe(subscription.Ctx, subscription.ID, subscription.Query) - if err != nil { - r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) - return sdk.Wrap(err) - } - return nil -} - -func (r rpcClient) SubscribeAny(query string, handler sdk.EventHandler) (subscription sdk.Subscription, err sdk.Error) { - ctx := context.Background() - subscriber := getSubscriber() - ch, e := r.Subscribe(ctx, subscriber, query, 0) - if e != nil { - return subscription, sdk.Wrap(e) - } - - r.Info("subscribe event", "query", query, "subscriber", subscription.ID) - - subscription = sdk.Subscription{ - Ctx: ctx, - Query: query, - ID: subscriber, - } - go func() { - for { - data := <-ch - go func() { - defer sdk.CatchPanic(func(errMsg string) { - r.Error("unsubscribe failed", "query", subscription.Query, "subscriber", subscription.ID, "errMsg", err.Error()) - }) - - switch data := data.Data.(type) { - case tmtypes.EventDataTx: - handler(r.parseTx(data)) - return - case tmtypes.EventDataNewBlock: - handler(r.parseNewBlock(data)) - return - case tmtypes.EventDataNewBlockHeader: - handler(r.parseNewBlockHeader(data)) - return - case tmtypes.EventDataValidatorSetUpdates: - handler(r.parseValidatorSetUpdates(data)) - return - default: - handler(data) - } - }() - } - }() - return -} - -func (r rpcClient) parseTx(data sdk.EventData) sdk.EventDataTx { - dataTx := data.(tmtypes.EventDataTx) - tx, err := r.txDecoder(dataTx.Tx) - if err != nil { - return sdk.EventDataTx{} - } - - hash := sdk.HexBytes(tmhash.Sum(dataTx.Tx)).String() - result := sdk.TxResult{ - Code: dataTx.Result.Code, - Log: dataTx.Result.Log, - GasWanted: dataTx.Result.GasWanted, - GasUsed: dataTx.Result.GasUsed, - Events: sdk.StringifyEvents(dataTx.Result.Events), - } - return sdk.EventDataTx{ - Hash: hash, - Height: dataTx.Height, - Index: dataTx.Index, - Tx: tx, - Result: result, - } -} - -func (r rpcClient) parseNewBlock(data sdk.EventData) sdk.EventDataNewBlock { - block := data.(tmtypes.EventDataNewBlock) - return sdk.EventDataNewBlock{ - Block: sdk.ParseBlock(r.cdc, block.Block), - ResultBeginBlock: sdk.ResultBeginBlock{ - Events: sdk.StringifyEvents(block.ResultBeginBlock.Events), - }, - ResultEndBlock: sdk.ResultEndBlock{ - Events: sdk.StringifyEvents(block.ResultEndBlock.Events), - ValidatorUpdates: sdk.ParseValidatorUpdate(block.ResultEndBlock.ValidatorUpdates), - }, - } -} - -func (r rpcClient) parseNewBlockHeader(data sdk.EventData) sdk.EventDataNewBlockHeader { - blockHeader := data.(tmtypes.EventDataNewBlockHeader) - return sdk.EventDataNewBlockHeader{ - Header: blockHeader.Header, - ResultBeginBlock: sdk.ResultBeginBlock{ - Events: sdk.StringifyEvents(blockHeader.ResultBeginBlock.Events), - }, - ResultEndBlock: sdk.ResultEndBlock{ - Events: sdk.StringifyEvents(blockHeader.ResultEndBlock.Events), - ValidatorUpdates: sdk.ParseValidatorUpdate(blockHeader.ResultEndBlock.ValidatorUpdates), - }, - } -} - -func (r rpcClient) parseValidatorSetUpdates(data sdk.EventData) sdk.EventDataValidatorSetUpdates { - validatorSet := data.(tmtypes.EventDataValidatorSetUpdates) - return sdk.EventDataValidatorSetUpdates{ - ValidatorUpdates: sdk.ParseValidators(r.cdc, validatorSet.ValidatorUpdates), - } -} - -func getSubscriber() string { - subscriber := "irishub-sdk-go" - id, err := uuid.NewV1() - if err == nil { - subscriber = fmt.Sprintf("%s-%s", subscriber, id.String()) - } - return subscriber -} diff --git a/core-sdk/client/store.go b/core-sdk/client/store.go deleted file mode 100644 index cdb15ea5..00000000 --- a/core-sdk/client/store.go +++ /dev/null @@ -1,24 +0,0 @@ -package client - -import ( - "context" - "errors" - - rpcclient "github.com/tendermint/tendermint/rpc/client" -) - -func (base baseClient) QueryWithData(path string, key []byte) ([]byte, int64, error) { - opts := rpcclient.ABCIQueryOptions{ - Prove: true, - } - - result, err := base.ABCIQueryWithOptions(context.Background(), path, key, opts) - if err != nil { - return nil, 0, err - } - - if !result.Response.IsOK() { - return nil, 0, errors.New(result.Response.Log) - } - return result.Response.Value, result.Response.Height, nil -} diff --git a/core-sdk/client/tx.go b/core-sdk/client/tx.go deleted file mode 100644 index ad021983..00000000 --- a/core-sdk/client/tx.go +++ /dev/null @@ -1,242 +0,0 @@ -package client - -import ( - "context" - "encoding/hex" - "errors" - "strings" - "time" - - "github.com/gogo/protobuf/jsonpb" - ctypes "github.com/tendermint/tendermint/rpc/core/types" - - sdk "github.com/irisnet/core-sdk-go/types" -) - -// QueryTx returns the tx info -func (base baseClient) QueryTx(hash string) (sdk.ResultQueryTx, error) { - tx, err := hex.DecodeString(hash) - if err != nil { - return sdk.ResultQueryTx{}, err - } - - res, err := base.Tx(context.Background(), tx, true) - if err != nil { - return sdk.ResultQueryTx{}, err - } - - resBlocks, err := base.getResultBlocks([]*ctypes.ResultTx{res}) - if err != nil { - return sdk.ResultQueryTx{}, err - } - return base.parseTxResult(res, resBlocks[res.Height]) -} - -func (base baseClient) QueryTxs(builder *sdk.EventQueryBuilder, page, size *int) (sdk.ResultSearchTxs, error) { - query := builder.Build() - if len(query) == 0 { - return sdk.ResultSearchTxs{}, errors.New("must declare at least one tag to search") - } - - res, err := base.TxSearch(context.Background(), query, true, page, size, "asc") - if err != nil { - return sdk.ResultSearchTxs{}, err - } - - resBlocks, err := base.getResultBlocks(res.Txs) - if err != nil { - return sdk.ResultSearchTxs{}, err - } - - var txs []sdk.ResultQueryTx - for i, tx := range res.Txs { - txInfo, err := base.parseTxResult(tx, resBlocks[res.Txs[i].Height]) - if err != nil { - return sdk.ResultSearchTxs{}, err - } - txs = append(txs, txInfo) - } - - return sdk.ResultSearchTxs{ - Total: res.TotalCount, - Txs: txs, - }, nil -} - -func (base baseClient) QueryBlock(height int64) (sdk.BlockDetail, error) { - block, err := base.Block(context.Background(), &height) - if err != nil { - return sdk.BlockDetail{}, err - } - - blockResult, err := base.BlockResults(context.Background(), &height) - if err != nil { - return sdk.BlockDetail{}, err - } - - return sdk.BlockDetail{ - BlockID: block.BlockID, - Block: sdk.ParseBlock(base.encodingConfig.Amino, block.Block), - BlockResult: sdk.ParseBlockResult(blockResult), - }, nil -} - -func (base baseClient) EstimateTxGas(txBytes []byte) (uint64, error) { - res, err := base.ABCIQuery(context.Background(), "/app/simulate", txBytes) - if err != nil { - return 0, err - } - - simRes, err := parseQueryResponse(res.Response.Value) - if err != nil { - return 0, err - } - - adjusted := adjustGasEstimate(simRes.GasUsed, base.cfg.GasAdjustment) - return adjusted, nil -} - -func (base *baseClient) buildTx(msgs []sdk.Msg, baseTx sdk.BaseTx) ([]byte, *sdk.Factory, sdk.Error) { - builder, err := base.prepare(baseTx) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - txByte, err := builder.BuildAndSign(baseTx.From, msgs, false) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - base.Logger().Debug("sign transaction success") - return txByte, builder, nil -} - -func (base *baseClient) buildTxWithAccount(addr string, accountNumber, sequence uint64, msgs []sdk.Msg, baseTx sdk.BaseTx) ([]byte, *sdk.Factory, sdk.Error) { - builder, err := base.prepareWithAccount(addr, accountNumber, sequence, baseTx) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - txByte, err := builder.BuildAndSign(baseTx.From, msgs, false) - if err != nil { - return nil, builder, sdk.Wrap(err) - } - - base.Logger().Debug("sign transaction success") - return txByte, builder, nil -} - -func (base baseClient) broadcastTx(txBytes []byte, mode sdk.BroadcastMode) (res sdk.ResultTx, err sdk.Error) { - switch mode { - case sdk.Commit: - res, err = base.broadcastTxCommit(txBytes) - case sdk.Async: - res, err = base.broadcastTxAsync(txBytes) - case sdk.Sync: - res, err = base.broadcastTxSync(txBytes) - default: - err = sdk.Wrapf("commit mode(%s) not supported", mode) - } - return -} - -// broadcastTxCommit broadcasts transaction bytes to a Tendermint node -// and waits for a commit. -func (base baseClient) broadcastTxCommit(tx []byte) (sdk.ResultTx, sdk.Error) { - res, err := base.BroadcastTxCommit(context.Background(), tx) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if !res.CheckTx.IsOK() { - return sdk.ResultTx{}, sdk.GetError(res.CheckTx.Codespace, res.CheckTx.Code, res.CheckTx.Log) - } - - if !res.DeliverTx.IsOK() { - return sdk.ResultTx{}, sdk.GetError(res.DeliverTx.Codespace, res.DeliverTx.Code, res.DeliverTx.Log) - } - - return sdk.ResultTx{ - GasWanted: res.DeliverTx.GasWanted, - GasUsed: res.DeliverTx.GasUsed, - Events: sdk.StringifyEvents(res.DeliverTx.Events), - Hash: res.Hash.String(), - Height: res.Height, - }, nil -} - -// BroadcastTxSync broadcasts transaction bytes to a Tendermint node -// synchronously. -func (base baseClient) broadcastTxSync(tx []byte) (sdk.ResultTx, sdk.Error) { - res, err := base.BroadcastTxSync(context.Background(), tx) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - if res.Code != 0 { - return sdk.ResultTx{}, sdk.GetError(sdk.RootCodespace, res.Code, res.Log) - } - - return sdk.ResultTx{Hash: res.Hash.String()}, nil -} - -// BroadcastTxAsync broadcasts transaction bytes to a Tendermint node -// asynchronously. -func (base baseClient) broadcastTxAsync(tx []byte) (sdk.ResultTx, sdk.Error) { - res, err := base.BroadcastTxAsync(context.Background(), tx) - if err != nil { - return sdk.ResultTx{}, sdk.Wrap(err) - } - - return sdk.ResultTx{Hash: res.Hash.String()}, nil -} - -func (base baseClient) getResultBlocks(resTxs []*ctypes.ResultTx) (map[int64]*ctypes.ResultBlock, error) { - resBlocks := make(map[int64]*ctypes.ResultBlock) - for _, resTx := range resTxs { - if _, ok := resBlocks[resTx.Height]; !ok { - resBlock, err := base.Block(context.Background(), &resTx.Height) - if err != nil { - return nil, err - } - - resBlocks[resTx.Height] = resBlock - } - } - return resBlocks, nil -} - -func (base baseClient) parseTxResult(res *ctypes.ResultTx, resBlock *ctypes.ResultBlock) (sdk.ResultQueryTx, error) { - var tx sdk.Tx - var err error - - if tx, err = base.encodingConfig.TxConfig.TxDecoder()(res.Tx); err != nil { - return sdk.ResultQueryTx{}, err - } - - return sdk.ResultQueryTx{ - Hash: res.Hash.String(), - Height: res.Height, - Tx: tx, - Result: sdk.TxResult{ - Code: res.TxResult.Code, - Log: res.TxResult.Log, - GasWanted: res.TxResult.GasWanted, - GasUsed: res.TxResult.GasUsed, - Events: sdk.StringifyEvents(res.TxResult.Events), - }, - Timestamp: resBlock.Block.Time.Format(time.RFC3339), - }, nil -} - -func adjustGasEstimate(estimate uint64, adjustment float64) uint64 { - return uint64(adjustment * float64(estimate)) -} - -func parseQueryResponse(bz []byte) (sdk.SimulationResponse, error) { - var simRes sdk.SimulationResponse - if err := jsonpb.Unmarshal(strings.NewReader(string(bz)), &simRes); err != nil { - return sdk.SimulationResponse{}, err - } - return simRes, nil -} diff --git a/core-sdk/common/bech32/bech32.go b/core-sdk/common/bech32/bech32.go deleted file mode 100644 index 7ab4b951..00000000 --- a/core-sdk/common/bech32/bech32.go +++ /dev/null @@ -1,49 +0,0 @@ -package bech32 - -import ( - "errors" - "fmt" - - "github.com/btcsuite/btcutil/bech32" -) - -// GetFromBech32 decodes a byte string from a Bech32 encoded string. -func GetFromBech32(bech32str, prefix string) ([]byte, error) { - if len(bech32str) == 0 { - return nil, errors.New("decoding Bech32 address failed: must provide an address") - } - - hrp, bz, err := DecodeAndConvert(bech32str) - if err != nil { - return nil, err - } - - if hrp != prefix { - return nil, fmt.Errorf("invalid Bech32 prefix; expected %s, got %s", prefix, hrp) - } - - return bz, nil -} - -//ConvertAndEncode converts from a base64 encoded byte string to base32 encoded byte string and then to bech32 -func ConvertAndEncode(hrp string, data []byte) (string, error) { - converted, err := bech32.ConvertBits(data, 8, 5, true) - if err != nil { - return "", err - } - return bech32.Encode(hrp, converted) - -} - -//DecodeAndConvert decodes a bech32 encoded string and converts to base64 encoded bytes -func DecodeAndConvert(bech string) (string, []byte, error) { - hrp, data, err := bech32.Decode(bech) - if err != nil { - return "", nil, err - } - converted, err := bech32.ConvertBits(data, 5, 8, false) - if err != nil { - return "", nil, err - } - return hrp, converted, nil -} diff --git a/core-sdk/common/cache/cache.go b/core-sdk/common/cache/cache.go deleted file mode 100644 index 08df0568..00000000 --- a/core-sdk/common/cache/cache.go +++ /dev/null @@ -1,70 +0,0 @@ -package cache - -import ( - "errors" - "time" - - "github.com/bluele/gcache" -) - -type Cache interface { - Set(key, value interface{}) error - SetWithExpire(key, value interface{}, expiration time.Duration) error - Get(key interface{}) (interface{}, error) - Remove(key interface{}) bool -} - -type LRU struct { - cache gcache.Cache - enabled bool -} - -func NewCache(capacity int, enable bool) Cache { - return &LRU{ - cache: gcache.New(capacity).LRU().Build(), - enabled: enable, - } -} - -func (l *LRU) Set(key, value interface{}) error { - if !l.enabled { - return nil - } - return l.cache.Set(key, value) -} - -func (l *LRU) SetWithExpire(key, value interface{}, expiration time.Duration) error { - if !l.enabled { - return nil - } - return l.cache.SetWithExpire(key, value, expiration) -} - -func (l LRU) Get(key interface{}) (interface{}, error) { - if !l.enabled { - return nil, errors.New("cache not enabled") - } - return l.cache.Get(key) -} - -func (l *LRU) Remove(key interface{}) bool { - if !l.enabled { - return false - } - return l.cache.Remove(key) -} - -func (l *LRU) Expire(key interface{}) bool { - if !l.enabled { - return true - } - return l.Remove(key) -} - -func (l *LRU) Enable() { - l.enabled = true -} - -func (l *LRU) Disable() { - l.enabled = false -} diff --git a/core-sdk/common/codec/amino.go b/core-sdk/common/codec/amino.go deleted file mode 100644 index 58879aab..00000000 --- a/core-sdk/common/codec/amino.go +++ /dev/null @@ -1,185 +0,0 @@ -package codec - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - - amino "github.com/tendermint/go-amino" - tmtypes "github.com/tendermint/tendermint/types" - - "github.com/irisnet/core-sdk-go/common/codec/types" -) - -// deprecated: LegacyAmino defines a wrapper for an Amino codec that properly handles protobuf -// types with Any's -type LegacyAmino struct { - Amino *amino.Codec -} - -func (cdc *LegacyAmino) Seal() { - cdc.Amino.Seal() -} - -func NewLegacyAmino() *LegacyAmino { - return &LegacyAmino{amino.NewCodec()} -} - -// RegisterEvidences registers Tendermint evidence types with the provided Amino -// codec. -func RegisterEvidences(cdc *LegacyAmino) { - cdc.Amino.RegisterInterface((*tmtypes.Evidence)(nil), nil) - cdc.Amino.RegisterConcrete(&tmtypes.DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence", nil) -} - -// MarshalJSONIndent provides a utility for indented JSON encoding of an object -// via an Amino codec. It returns an error if it cannot serialize or indent as -// JSON. -func MarshalJSONIndent(cdc *LegacyAmino, obj interface{}) ([]byte, error) { - bz, err := cdc.MarshalJSON(obj) - if err != nil { - return nil, err - } - - var out bytes.Buffer - if err = json.Indent(&out, bz, "", " "); err != nil { - return nil, err - } - - return out.Bytes(), nil -} - -// MustMarshalJSONIndent executes MarshalJSONIndent except it panics upon failure. -func MustMarshalJSONIndent(cdc *LegacyAmino, obj interface{}) []byte { - bz, err := MarshalJSONIndent(cdc, obj) - if err != nil { - panic(fmt.Sprintf("failed to marshal JSON: %s", err)) - } - - return bz -} - -func (cdc *LegacyAmino) marshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoPacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) unmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoUnpacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) jsonMarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONPacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) jsonUnmarshalAnys(o interface{}) error { - return types.UnpackInterfaces(o, types.AminoJSONUnpacker{Cdc: cdc.Amino}) -} - -func (cdc *LegacyAmino) MarshalBinaryBare(o interface{}) ([]byte, error) { - if err := cdc.marshalAnys(o); err != nil { - return nil, err - } - return cdc.Amino.MarshalBinaryBare(o) -} - -func (cdc *LegacyAmino) MustMarshalBinaryBare(o interface{}) []byte { - bz, err := cdc.MarshalBinaryBare(o) - if err != nil { - panic(err) - } - return bz -} - -func (cdc *LegacyAmino) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) { - if err := cdc.marshalAnys(o); err != nil { - return nil, err - } - return cdc.Amino.MarshalBinaryLengthPrefixed(o) -} - -func (cdc *LegacyAmino) MustMarshalBinaryLengthPrefixed(o interface{}) []byte { - bz, err := cdc.MarshalBinaryLengthPrefixed(o) - if err != nil { - panic(err) - } - return bz -} - -func (cdc *LegacyAmino) UnmarshalBinaryBare(bz []byte, ptr interface{}) error { - if err := cdc.Amino.UnmarshalBinaryBare(bz, ptr); err != nil { - return err - } - return cdc.unmarshalAnys(ptr) -} - -func (cdc *LegacyAmino) MustUnmarshalBinaryBare(bz []byte, ptr interface{}) { - if err := cdc.UnmarshalBinaryBare(bz, ptr); err != nil { - panic(err) - } -} - -func (cdc *LegacyAmino) UnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) error { - if err := cdc.Amino.UnmarshalBinaryLengthPrefixed(bz, ptr); err != nil { - return err - } - return cdc.unmarshalAnys(ptr) -} - -func (cdc *LegacyAmino) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr interface{}) { - if err := cdc.UnmarshalBinaryLengthPrefixed(bz, ptr); err != nil { - panic(err) - } -} - -func (cdc *LegacyAmino) MarshalJSON(o interface{}) ([]byte, error) { - if err := cdc.jsonMarshalAnys(o); err != nil { - return nil, err - } - return cdc.Amino.MarshalJSON(o) -} - -func (cdc *LegacyAmino) MustMarshalJSON(o interface{}) []byte { - bz, err := cdc.MarshalJSON(o) - if err != nil { - panic(err) - } - return bz -} - -func (cdc *LegacyAmino) UnmarshalJSON(bz []byte, ptr interface{}) error { - if err := cdc.Amino.UnmarshalJSON(bz, ptr); err != nil { - return err - } - return cdc.jsonUnmarshalAnys(ptr) -} - -func (cdc *LegacyAmino) MustUnmarshalJSON(bz []byte, ptr interface{}) { - if err := cdc.UnmarshalJSON(bz, ptr); err != nil { - panic(err) - } -} - -func (*LegacyAmino) UnpackAny(*types.Any, interface{}) error { - return errors.New("AminoCodec can't handle unpack protobuf Any's") -} - -func (cdc *LegacyAmino) RegisterInterface(ptr interface{}, iopts *amino.InterfaceOptions) { - cdc.Amino.RegisterInterface(ptr, iopts) -} - -func (cdc *LegacyAmino) RegisterConcrete(o interface{}, name string, copts *amino.ConcreteOptions) { - cdc.Amino.RegisterConcrete(o, name, copts) -} - -func (cdc *LegacyAmino) MarshalJSONIndent(o interface{}, prefix, indent string) ([]byte, error) { - if err := cdc.jsonMarshalAnys(o); err != nil { - panic(err) - } - return cdc.Amino.MarshalJSONIndent(o, prefix, indent) -} - -func (cdc *LegacyAmino) PrintTypes(out io.Writer) error { - return cdc.Amino.PrintTypes(out) -} diff --git a/core-sdk/common/codec/amino_codec.go b/core-sdk/common/codec/amino_codec.go deleted file mode 100644 index 21b751e8..00000000 --- a/core-sdk/common/codec/amino_codec.go +++ /dev/null @@ -1,80 +0,0 @@ -package codec - -import "github.com/gogo/protobuf/proto" - -// AminoCodec defines a codec that utilizes Codec for both binary and JSON -// encoding. -type AminoCodec struct { - *LegacyAmino -} - -var _ Marshaler = &AminoCodec{} - -// NewAminoCodec returns a reference to a new AminoCodec -func NewAminoCodec(codec *LegacyAmino) *AminoCodec { - return &AminoCodec{LegacyAmino: codec} -} - -// MarshalBinaryBare implements BinaryMarshaler.MarshalBinaryBare method. -func (ac *AminoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { - return ac.LegacyAmino.MarshalBinaryBare(o) -} - -// MustMarshalBinaryBare implements BinaryMarshaler.MustMarshalBinaryBare method. -func (ac *AminoCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte { - return ac.LegacyAmino.MustMarshalBinaryBare(o) -} - -// MarshalBinaryLengthPrefixed implements BinaryMarshaler.MarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) { - return ac.LegacyAmino.MarshalBinaryLengthPrefixed(o) -} - -// MustMarshalBinaryLengthPrefixed implements BinaryMarshaler.MustMarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte { - return ac.LegacyAmino.MustMarshalBinaryLengthPrefixed(o) -} - -// UnmarshalBinaryBare implements BinaryMarshaler.UnmarshalBinaryBare method. -func (ac *AminoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { - return ac.LegacyAmino.UnmarshalBinaryBare(bz, ptr) -} - -// MustUnmarshalBinaryBare implements BinaryMarshaler.MustUnmarshalBinaryBare method. -func (ac *AminoCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) { - ac.LegacyAmino.MustUnmarshalBinaryBare(bz, ptr) -} - -// UnmarshalBinaryLengthPrefixed implements BinaryMarshaler.UnmarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error { - return ac.LegacyAmino.UnmarshalBinaryLengthPrefixed(bz, ptr) -} - -// MustUnmarshalBinaryLengthPrefixed implements BinaryMarshaler.MustUnmarshalBinaryLengthPrefixed method. -func (ac *AminoCodec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) { - ac.LegacyAmino.MustUnmarshalBinaryLengthPrefixed(bz, ptr) -} - -// MarshalJSON implements JSONMarshaler.MarshalJSON method, -// it marshals to JSON using legacy amino codec. -func (ac *AminoCodec) MarshalJSON(o proto.Message) ([]byte, error) { - return ac.LegacyAmino.MarshalJSON(o) -} - -// MustMarshalJSON implements JSONMarshaler.MustMarshalJSON method, -// it executes MarshalJSON except it panics upon failure. -func (ac *AminoCodec) MustMarshalJSON(o proto.Message) []byte { - return ac.LegacyAmino.MustMarshalJSON(o) -} - -// UnmarshalJSON implements JSONMarshaler.UnmarshalJSON method, -// it unmarshals from JSON using legacy amino codec. -func (ac *AminoCodec) UnmarshalJSON(bz []byte, ptr proto.Message) error { - return ac.LegacyAmino.UnmarshalJSON(bz, ptr) -} - -// MustUnmarshalJSON implements JSONMarshaler.MustUnmarshalJSON method, -// it executes UnmarshalJSON except it panics upon failure. -func (ac *AminoCodec) MustUnmarshalJSON(bz []byte, ptr proto.Message) { - ac.LegacyAmino.MustUnmarshalJSON(bz, ptr) -} diff --git a/core-sdk/common/codec/any.go b/core-sdk/common/codec/any.go deleted file mode 100644 index 1b6b5ea3..00000000 --- a/core-sdk/common/codec/any.go +++ /dev/null @@ -1,42 +0,0 @@ -package codec - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/core-sdk-go/common/codec/types" -) - -// MarshalAny is a convenience function for packing the provided value in an -// Any and then proto marshaling it to bytes -func MarshalAny(m BinaryMarshaler, x interface{}) ([]byte, error) { - msg, ok := x.(proto.Message) - if !ok { - return nil, fmt.Errorf("can't proto marshal %T", x) - } - - any := &types.Any{} - if err := any.Pack(msg); err != nil { - return nil, err - } - - return m.MarshalBinaryBare(any) -} - -// UnmarshalAny is a convenience function for proto unmarshaling an Any from -// bz and then unpacking it to the interface pointer passed in as iface using -// the provided AnyUnpacker or returning an error -// -// Ex: -// var x MyInterface -// err := UnmarshalAny(unpacker, &x, bz) -func UnmarshalAny(m BinaryMarshaler, iface interface{}, bz []byte) error { - any := &types.Any{} - - if err := m.UnmarshalBinaryBare(bz, any); err != nil { - return err - } - - return m.UnpackAny(any, iface) -} diff --git a/core-sdk/common/codec/codec.go b/core-sdk/common/codec/codec.go deleted file mode 100644 index 60c532ab..00000000 --- a/core-sdk/common/codec/codec.go +++ /dev/null @@ -1,66 +0,0 @@ -package codec - -import ( - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/core-sdk-go/common/codec/types" -) - -type ( - // Marshaler defines the interface module codecs must implement in order to support - // backwards compatibility with Amino while allowing custom Protobuf-based - // serialization. Note, Amino can still be used without any dependency on - // Protobuf. There are two typical implementations that fulfill this contract: - // - // 1. AminoCodec: Provides full Amino serialization compatibility. - // 2. ProtoCodec: Provides full Protobuf serialization compatibility. - Marshaler interface { - BinaryMarshaler - JSONMarshaler - } - - BinaryMarshaler interface { - MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) - MustMarshalBinaryBare(o ProtoMarshaler) []byte - - MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) - MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte - - UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error - MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) - - UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error - MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) - - types.AnyUnpacker - } - - JSONMarshaler interface { - MarshalJSON(o proto.Message) ([]byte, error) - MustMarshalJSON(o proto.Message) []byte - - UnmarshalJSON(bz []byte, ptr proto.Message) error - MustUnmarshalJSON(bz []byte, ptr proto.Message) - } - - // ProtoMarshaler defines an interface a type must implement as protocol buffer - // defined message. - ProtoMarshaler interface { - proto.Message // for JSON serialization - - Marshal() ([]byte, error) - MarshalTo(data []byte) (n int, err error) - MarshalToSizedBuffer(dAtA []byte) (int, error) - Size() int - Unmarshal(data []byte) error - } - - // AminoMarshaler defines an interface where Amino marshalling can be - // overridden by custom marshalling. - AminoMarshaler interface { - MarshalAmino() ([]byte, error) - UnmarshalAmino([]byte) error - MarshalAminoJSON() ([]byte, error) - UnmarshalAminoJSON([]byte) error - } -) diff --git a/core-sdk/common/codec/json.go b/core-sdk/common/codec/json.go deleted file mode 100644 index 7ba5099b..00000000 --- a/core-sdk/common/codec/json.go +++ /dev/null @@ -1,30 +0,0 @@ -package codec - -import ( - "bytes" - - "github.com/irisnet/core-sdk-go/common/codec/types" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" -) - -// ProtoMarshalJSON provides an auxiliary function to return Proto3 JSON encoded -// bytes of a message. -func ProtoMarshalJSON(msg proto.Message) ([]byte, error) { - // We use the OrigName because camel casing fields just doesn't make sense. - // EmitDefaults is also often the more expected behavior for CLI users - jm := &jsonpb.Marshaler{OrigName: true, EmitDefaults: true} - err := types.UnpackInterfaces(msg, types.ProtoJSONPacker{JSONPBMarshaler: jm}) - if err != nil { - return nil, err - } - - buf := new(bytes.Buffer) - - if err := jm.Marshal(buf, msg); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} diff --git a/core-sdk/common/codec/legacy/codec.go b/core-sdk/common/codec/legacy/codec.go deleted file mode 100644 index 30321752..00000000 --- a/core-sdk/common/codec/legacy/codec.go +++ /dev/null @@ -1,20 +0,0 @@ -package legacy - -import ( - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - - cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" -) - -// Cdc defines a global generic sealed Amino codec to be used throughout sdk. It -// has all Tendermint crypto and evidence types registered. -// -// TODO: Deprecated - remove this global. -var Cdc *commoncodec.LegacyAmino - -func init() { - Cdc = commoncodec.NewLegacyAmino() - cryptocodec.RegisterCrypto(Cdc) - commoncodec.RegisterEvidences(Cdc) - Cdc.Seal() -} diff --git a/core-sdk/common/codec/legacy/doc.go b/core-sdk/common/codec/legacy/doc.go deleted file mode 100644 index d89944f3..00000000 --- a/core-sdk/common/codec/legacy/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Package legacy contains a global amino Cdc which is deprecated but -// still used in several places within the SDK. This package is intended -// to be removed at some point in the future when the global Cdc is removed. -package legacy diff --git a/core-sdk/common/codec/proto_codec.go b/core-sdk/common/codec/proto_codec.go deleted file mode 100644 index 216a52e4..00000000 --- a/core-sdk/common/codec/proto_codec.go +++ /dev/null @@ -1,154 +0,0 @@ -package codec - -import ( - "encoding/binary" - "fmt" - "strings" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/core-sdk-go/common/codec/types" -) - -// ProtoCodec defines a codec that utilizes Protobuf for both binary and JSON -// encoding. -type ProtoCodec struct { - anyUnpacker types.AnyUnpacker -} - -var _ Marshaler = &ProtoCodec{} - -// NewProtoCodec returns a reference to a new ProtoCodec -func NewProtoCodec(anyUnpacker types.AnyUnpacker) *ProtoCodec { - return &ProtoCodec{anyUnpacker: anyUnpacker} -} - -// MarshalBinaryBare implements BinaryMarshaler.MarshalBinaryBare method. -func (pc *ProtoCodec) MarshalBinaryBare(o ProtoMarshaler) ([]byte, error) { - return o.Marshal() -} - -// MustMarshalBinaryBare implements BinaryMarshaler.MustMarshalBinaryBare method. -func (pc *ProtoCodec) MustMarshalBinaryBare(o ProtoMarshaler) []byte { - bz, err := pc.MarshalBinaryBare(o) - if err != nil { - panic(err) - } - - return bz -} - -// MarshalBinaryLengthPrefixed implements BinaryMarshaler.MarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) MarshalBinaryLengthPrefixed(o ProtoMarshaler) ([]byte, error) { - bz, err := pc.MarshalBinaryBare(o) - if err != nil { - return nil, err - } - - var sizeBuf [binary.MaxVarintLen64]byte - n := binary.PutUvarint(sizeBuf[:], uint64(o.Size())) - return append(sizeBuf[:n], bz...), nil -} - -// MustMarshalBinaryLengthPrefixed implements BinaryMarshaler.MustMarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) MustMarshalBinaryLengthPrefixed(o ProtoMarshaler) []byte { - bz, err := pc.MarshalBinaryLengthPrefixed(o) - if err != nil { - panic(err) - } - - return bz -} - -// UnmarshalBinaryBare implements BinaryMarshaler.UnmarshalBinaryBare method. -func (pc *ProtoCodec) UnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) error { - if err := ptr.Unmarshal(bz); err != nil { - return err - } - return types.UnpackInterfaces(ptr, pc.anyUnpacker) -} - -// MustUnmarshalBinaryBare implements BinaryMarshaler.MustUnmarshalBinaryBare method. -func (pc *ProtoCodec) MustUnmarshalBinaryBare(bz []byte, ptr ProtoMarshaler) { - if err := pc.UnmarshalBinaryBare(bz, ptr); err != nil { - panic(err) - } -} - -// UnmarshalBinaryLengthPrefixed implements BinaryMarshaler.UnmarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error { - size, n := binary.Uvarint(bz) - if n < 0 { - return fmt.Errorf("invalid number of bytes read from length-prefixed encoding: %d", n) - } - - if size > uint64(len(bz)-n) { - return fmt.Errorf("not enough bytes to read; want: %v, got: %v", size, len(bz)-n) - } else if size < uint64(len(bz)-n) { - return fmt.Errorf("too many bytes to read; want: %v, got: %v", size, len(bz)-n) - } - - bz = bz[n:] - return pc.UnmarshalBinaryBare(bz, ptr) -} - -// MustUnmarshalBinaryLengthPrefixed implements BinaryMarshaler.MustUnmarshalBinaryLengthPrefixed method. -func (pc *ProtoCodec) MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) { - if err := pc.UnmarshalBinaryLengthPrefixed(bz, ptr); err != nil { - panic(err) - } -} - -// MarshalJSON implements JSONMarshaler.MarshalJSON method, -// it marshals to JSON using proto codec. -func (pc *ProtoCodec) MarshalJSON(o proto.Message) ([]byte, error) { - m, ok := o.(ProtoMarshaler) - if !ok { - return nil, fmt.Errorf("cannot protobuf JSON encode unsupported type: %T", o) - } - - return ProtoMarshalJSON(m) -} - -// MustMarshalJSON implements JSONMarshaler.MustMarshalJSON method, -// it executes MarshalJSON except it panics upon failure. -func (pc *ProtoCodec) MustMarshalJSON(o proto.Message) []byte { - bz, err := pc.MarshalJSON(o) - if err != nil { - panic(err) - } - - return bz -} - -// UnmarshalJSON implements JSONMarshaler.UnmarshalJSON method, -// it unmarshals from JSON using proto codec. -func (pc *ProtoCodec) UnmarshalJSON(bz []byte, ptr proto.Message) error { - m, ok := ptr.(ProtoMarshaler) - if !ok { - return fmt.Errorf("cannot protobuf JSON decode unsupported type: %T", ptr) - } - - err := jsonpb.Unmarshal(strings.NewReader(string(bz)), m) - if err != nil { - return err - } - - return types.UnpackInterfaces(ptr, pc.anyUnpacker) -} - -// MustUnmarshalJSON implements JSONMarshaler.MustUnmarshalJSON method, -// it executes UnmarshalJSON except it panics upon failure. -func (pc *ProtoCodec) MustUnmarshalJSON(bz []byte, ptr proto.Message) { - if err := pc.UnmarshalJSON(bz, ptr); err != nil { - panic(err) - } -} - -// UnpackAny implements AnyUnpacker.UnpackAny method, -// it unpacks the value in any to the interface pointer passed in as -// iface. -func (pc *ProtoCodec) UnpackAny(any *types.Any, iface interface{}) error { - return pc.anyUnpacker.UnpackAny(any, iface) -} diff --git a/core-sdk/common/codec/types/any.go b/core-sdk/common/codec/types/any.go deleted file mode 100644 index df7ff8a3..00000000 --- a/core-sdk/common/codec/types/any.go +++ /dev/null @@ -1,133 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" -) - -type Any struct { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - - // nolint - TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"` - // Must be a valid serialized protocol buffer of the above specified type. - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - - // nolint - XXX_NoUnkeyedLiteral struct{} `json:"-"` - - // nolint - XXX_unrecognized []byte `json:"-"` - - // nolint - XXX_sizecache int32 `json:"-"` - - cachedValue interface{} - - compat *anyCompat -} - -// NewAnyWithValue constructs a new Any packed with the value provided or -// returns an error if that value couldn't be packed. This also caches -// the packed value so that it can be retrieved from GetCachedValue without -// unmarshaling -func NewAnyWithValue(value proto.Message) (*Any, error) { - any := &Any{} - - err := any.Pack(value) - if err != nil { - return nil, err - } - - return any, nil -} - -// Pack packs the value x in the Any or returns an error. This also caches -// the packed value so that it can be retrieved from GetCachedValue without -// unmarshaling -func (any *Any) Pack(x proto.Message) error { - any.TypeUrl = "/" + proto.MessageName(x) - bz, err := proto.Marshal(x) - if err != nil { - return err - } - - any.Value = bz - any.cachedValue = x - - return nil -} - -// UnsafePackAny packs the value x in the Any and instead of returning the error -// in the case of a packing failure, keeps the cached value. This should only -// be used in situations where compatibility is needed with amino. Amino-only -// values can safely be packed using this method when they will only be -// marshaled with amino and not protobuf. -func UnsafePackAny(x interface{}) *Any { - if msg, ok := x.(proto.Message); ok { - any, err := NewAnyWithValue(msg) - if err == nil { - return any - } - } - return &Any{cachedValue: x} -} - -// PackAny is a checked and safe version of UnsafePackAny. It assures that -// `x` implements the proto.Message interface and uses it to serialize `x`. -// [DEPRECATED]: should be moved away: https://github.com/cosmos/cosmos-sdk/issues/7479 -func PackAny(x interface{}) (*Any, error) { - if x == nil { - return nil, nil - } - if intoany, ok := x.(IntoAny); ok { - return intoany.AsAny(), nil - } - protoMsg, ok := x.(proto.Message) - if !ok { - return nil, fmt.Errorf("Expecting %T to implement proto.Message", x) - } - return NewAnyWithValue(protoMsg) -} - -// GetCachedValue returns the cached value from the Any if present -func (any *Any) GetCachedValue() interface{} { - return any.cachedValue -} - -// ClearCachedValue clears the cached value from the Any -func (any *Any) ClearCachedValue() { - any.cachedValue = nil -} - -// IntoAny represents a type that can be wrapped into an Any. -type IntoAny interface { - AsAny() *Any -} diff --git a/core-sdk/common/codec/types/any.pb.go b/core-sdk/common/codec/types/any.pb.go deleted file mode 100644 index d0843816..00000000 --- a/core-sdk/common/codec/types/any.pb.go +++ /dev/null @@ -1,584 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: third_party/proto/google/protobuf/any.proto - -package types - -import ( - bytes "bytes" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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 - -func (m *Any) Reset() { *m = Any{} } -func (*Any) ProtoMessage() {} -func (*Any) Descriptor() ([]byte, []int) { - return fileDescriptor_cb68f365a8e2bcdc, []int{0} -} -func (*Any) XXX_WellKnownType() string { return "Any" } -func (m *Any) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Any.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 *Any) XXX_Merge(src proto.Message) { - xxx_messageInfo_Any.Merge(m, src) -} -func (m *Any) XXX_Size() int { - return m.Size() -} -func (m *Any) XXX_DiscardUnknown() { - xxx_messageInfo_Any.DiscardUnknown(m) -} - -var xxx_messageInfo_Any proto.InternalMessageInfo - -func (m *Any) GetTypeUrl() string { - if m != nil { - return m.TypeUrl - } - return "" -} - -func (m *Any) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (*Any) XXX_MessageName() string { - return "google.protobuf.Any" -} -func init() { -} - -func init() { - proto.RegisterFile("third_party/proto/google/protobuf/any.proto", fileDescriptor_cb68f365a8e2bcdc) -} - -var fileDescriptor_cb68f365a8e2bcdc = []byte{ - // 246 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0xc9, 0xc8, 0x2c, - 0x4a, 0x89, 0x2f, 0x48, 0x2c, 0x2a, 0xa9, 0xd4, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x4f, 0xcf, - 0xcf, 0x4f, 0xcf, 0x49, 0x85, 0x70, 0x92, 0x4a, 0xd3, 0xf4, 0x13, 0xf3, 0x2a, 0xf5, 0xc0, 0x1c, - 0x21, 0x7e, 0x88, 0x94, 0x1e, 0x4c, 0x4a, 0x4a, 0x0d, 0x9b, 0xee, 0xf4, 0x7c, 0x04, 0x0b, 0xa2, - 0x54, 0xc9, 0x86, 0x8b, 0xd9, 0x31, 0xaf, 0x52, 0x48, 0x92, 0x8b, 0xa3, 0xa4, 0xb2, 0x20, 0x35, - 0xbe, 0xb4, 0x28, 0x47, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x88, 0x1d, 0xc4, 0x0f, 0x2d, 0xca, - 0x11, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x09, - 0x82, 0x70, 0xac, 0x58, 0x3e, 0x2c, 0x94, 0x67, 0x70, 0x6a, 0x66, 0xbc, 0xf1, 0x50, 0x8e, 0xe1, - 0xc3, 0x43, 0x39, 0xc6, 0x1f, 0x0f, 0xe5, 0x18, 0x1b, 0x1e, 0xc9, 0x31, 0xae, 0x78, 0x24, 0xc7, - 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0xbe, 0x78, 0x24, - 0xc7, 0xf0, 0x01, 0x24, 0xfe, 0x58, 0x8e, 0xf1, 0xc0, 0x63, 0x39, 0x86, 0x13, 0x8f, 0xe5, 0x18, - 0xb9, 0x84, 0x93, 0xf3, 0x73, 0xf5, 0xd0, 0x5c, 0xec, 0xc4, 0xe1, 0x98, 0x57, 0x19, 0x00, 0xe2, - 0x04, 0x30, 0x46, 0xb1, 0x82, 0x2c, 0x2f, 0x5e, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, - 0xce, 0x1d, 0xa2, 0x34, 0x00, 0xaa, 0x54, 0x2f, 0x3c, 0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, - 0x2f, 0x04, 0xa4, 0x2c, 0x89, 0x0d, 0x6c, 0x86, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc3, - 0x46, 0x5f, 0x32, 0x01, 0x00, 0x00, -} - -func (this *Any) Compare(that interface{}) int { - if that == nil { - if this == nil { - return 0 - } - return 1 - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return 1 - } - } - if that1 == nil { - if this == nil { - return 0 - } - return 1 - } else if this == nil { - return -1 - } - if this.TypeUrl != that1.TypeUrl { - if this.TypeUrl < that1.TypeUrl { - return -1 - } - return 1 - } - if c := bytes.Compare(this.Value, that1.Value); c != 0 { - return c - } - if c := bytes.Compare(this.XXX_unrecognized, that1.XXX_unrecognized); c != 0 { - return c - } - return 0 -} -func (this *Any) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Any) - if !ok { - that2, ok := that.(Any) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.TypeUrl != that1.TypeUrl { - return false - } - if !bytes.Equal(this.Value, that1.Value) { - return false - } - if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { - return false - } - return true -} -func (this *Any) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&types.Any{") - s = append(s, "TypeUrl: "+fmt.Sprintf("%#v", this.TypeUrl)+",\n") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - if this.XXX_unrecognized != nil { - s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringAny(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *Any) 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 *Any) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Any) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintAny(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.TypeUrl) > 0 { - i -= len(m.TypeUrl) - copy(dAtA[i:], m.TypeUrl) - i = encodeVarintAny(dAtA, i, uint64(len(m.TypeUrl))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintAny(dAtA []byte, offset int, v uint64) int { - offset -= sovAny(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func NewPopulatedAny(r randyAny, easy bool) *Any { - this := &Any{} - this.TypeUrl = string(randStringAny(r)) - v1 := r.Intn(100) - this.Value = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Value[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedAny(r, 3) - } - return this -} - -type randyAny interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneAny(r randyAny) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringAny(r randyAny) string { - v2 := r.Intn(100) - tmps := make([]rune, v2) - for i := 0; i < v2; i++ { - tmps[i] = randUTF8RuneAny(r) - } - return string(tmps) -} -func randUnrecognizedAny(r randyAny, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldAny(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldAny(dAtA []byte, r randyAny, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - v3 := r.Int63() - if r.Intn(2) == 0 { - v3 *= -1 - } - dAtA = encodeVarintPopulateAny(dAtA, uint64(v3)) - case 1: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateAny(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateAny(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateAny(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *Any) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TypeUrl) - if l > 0 { - n += 1 + l + sovAny(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovAny(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovAny(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAny(x uint64) (n int) { - return sovAny(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *Any) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Any{`, - `TypeUrl:` + fmt.Sprintf("%v", this.TypeUrl) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`, - `}`, - }, "") - return s -} -func valueToStringAny(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *Any) 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 ErrIntOverflowAny - } - 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: Any: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Any: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TypeUrl", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAny - } - 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 ErrInvalidLengthAny - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAny - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TypeUrl = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAny - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAny - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAny - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAny(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthAny - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthAny - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAny(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, ErrIntOverflowAny - } - 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, ErrIntOverflowAny - } - 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, ErrIntOverflowAny - } - 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, ErrInvalidLengthAny - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAny - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAny - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAny = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAny = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAny = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/common/codec/types/compat.go b/core-sdk/common/codec/types/compat.go deleted file mode 100644 index 3aa02412..00000000 --- a/core-sdk/common/codec/types/compat.go +++ /dev/null @@ -1,213 +0,0 @@ -package types - -import ( - "fmt" - "reflect" - "runtime/debug" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" - - amino "github.com/tendermint/go-amino" -) - -type anyCompat struct { - aminoBz []byte - jsonBz []byte - err error -} - -var Debug = true - -func anyCompatError(errType string, x interface{}) error { - if Debug { - debug.PrintStack() - } - return fmt.Errorf( - "%s marshaling error for %+v, this is likely because "+ - "amino is being used directly (instead of codec.LegacyAmino which is preferred) "+ - "or UnpackInterfacesMessage is not defined for some type which contains "+ - "a protobuf Any either directly or via one of its members. To see a "+ - "stacktrace of where the error is coming from, set the var Debug = true "+ - "in codec/types/compat.go", - errType, x, - ) -} - -func (any Any) MarshalAmino() ([]byte, error) { - ac := any.compat - if ac == nil { - return nil, anyCompatError("amino binary unmarshal", any) - } - return ac.aminoBz, ac.err -} - -func (any *Any) UnmarshalAmino(bz []byte) error { - any.compat = &anyCompat{ - aminoBz: bz, - err: nil, - } - return nil -} - -func (any *Any) MarshalJSON() ([]byte, error) { - ac := any.compat - if ac == nil { - return nil, anyCompatError("JSON marshal", any) - } - return ac.jsonBz, ac.err -} - -func (any *Any) UnmarshalJSON(bz []byte) error { - any.compat = &anyCompat{ - jsonBz: bz, - err: nil, - } - return nil -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the binary un-marshaling phase -type AminoUnpacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoUnpacker{} - -func (a AminoUnpacker) UnpackAny(any *Any, iface interface{}) error { - ac := any.compat - if ac == nil { - return anyCompatError("amino binary unmarshal", reflect.TypeOf(iface)) - } - err := a.Cdc.UnmarshalBinaryBare(ac.aminoBz, iface) - if err != nil { - return err - } - val := reflect.ValueOf(iface).Elem().Interface() - err = UnpackInterfaces(val, a) - if err != nil { - return err - } - if m, ok := val.(proto.Message); ok { - err := any.Pack(m) - if err != nil { - return err - } - } else { - any.cachedValue = val - } - - // this is necessary for tests that use reflect.DeepEqual and compare - // proto vs amino marshaled values - any.compat = nil - - return nil -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the binary marshaling phase -type AminoPacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoPacker{} - -func (a AminoPacker) UnpackAny(any *Any, _ interface{}) error { - err := UnpackInterfaces(any.cachedValue, a) - if err != nil { - return err - } - bz, err := a.Cdc.MarshalBinaryBare(any.cachedValue) - any.compat = &anyCompat{ - aminoBz: bz, - err: err, - } - return err -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the JSON marshaling phase -type AminoJSONUnpacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoJSONUnpacker{} - -func (a AminoJSONUnpacker) UnpackAny(any *Any, iface interface{}) error { - ac := any.compat - if ac == nil { - return anyCompatError("JSON unmarshal", reflect.TypeOf(iface)) - } - err := a.Cdc.UnmarshalJSON(ac.jsonBz, iface) - if err != nil { - return err - } - val := reflect.ValueOf(iface).Elem().Interface() - err = UnpackInterfaces(val, a) - if err != nil { - return err - } - if m, ok := val.(proto.Message); ok { - err := any.Pack(m) - if err != nil { - return err - } - } else { - any.cachedValue = val - } - - // this is necessary for tests that use reflect.DeepEqual and compare - // proto vs amino marshaled values - any.compat = nil - - return nil -} - -// AminoUnpacker is an AnyUnpacker provided for backwards compatibility with -// amino for the JSON un-marshaling phase -type AminoJSONPacker struct { - Cdc *amino.Codec -} - -var _ AnyUnpacker = AminoJSONPacker{} - -func (a AminoJSONPacker) UnpackAny(any *Any, _ interface{}) error { - err := UnpackInterfaces(any.cachedValue, a) - if err != nil { - return err - } - bz, err := a.Cdc.MarshalJSON(any.cachedValue) - any.compat = &anyCompat{ - jsonBz: bz, - err: err, - } - return err -} - -// ProtoJSONPacker is an AnyUnpacker provided for compatibility with jsonpb -type ProtoJSONPacker struct { - JSONPBMarshaler *jsonpb.Marshaler -} - -var _ AnyUnpacker = ProtoJSONPacker{} - -func (a ProtoJSONPacker) UnpackAny(any *Any, _ interface{}) error { - if any == nil { - return nil - } - - if any.cachedValue != nil { - err := UnpackInterfaces(any.cachedValue, a) - if err != nil { - return err - } - } - - bz, err := a.JSONPBMarshaler.MarshalToString(any) - any.compat = &anyCompat{ - jsonBz: []byte(bz), - err: err, - } - - return err -} diff --git a/core-sdk/common/codec/types/doc.go b/core-sdk/common/codec/types/doc.go deleted file mode 100644 index 9f89f0c9..00000000 --- a/core-sdk/common/codec/types/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -/* -Package types defines a custom wrapper for google.protobuf.Any which supports -cached values as well as InterfaceRegistry which keeps track of types which can -be used with Any for both security and introspection -*/ -package types diff --git a/core-sdk/common/codec/types/interface_registry.go b/core-sdk/common/codec/types/interface_registry.go deleted file mode 100644 index 3621dc3c..00000000 --- a/core-sdk/common/codec/types/interface_registry.go +++ /dev/null @@ -1,272 +0,0 @@ -package types - -import ( - "fmt" - "reflect" - - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" -) - -// AnyUnpacker is an interface which allows safely unpacking types packed -// in Any's against a whitelist of registered types -type AnyUnpacker interface { - // UnpackAny unpacks the value in any to the interface pointer passed in as - // iface. Note that the type in any must have been registered in the - // underlying whitelist registry as a concrete type for that interface - // Ex: - // var msg sdk.Msg - // err := cdc.UnpackAny(any, &msg) - // ... - UnpackAny(any *Any, iface interface{}) error -} - -// InterfaceRegistry provides a mechanism for registering interfaces and -// implementations that can be safely unpacked from Any -type InterfaceRegistry interface { - AnyUnpacker - jsonpb.AnyResolver - - // RegisterInterface associates protoName as the public name for the - // interface passed in as iface. This is to be used primarily to create - // a public facing registry of interface implementations for clients. - // protoName should be a well-chosen public facing name that remains stable. - // RegisterInterface takes an optional list of impls to be registered - // as implementations of iface. - // - // Ex: - // registry.RegisterInterface("cosmos.v1beta1.Msg", (*sdk.Msg)(nil)) - RegisterInterface(protoName string, iface interface{}, impls ...proto.Message) - - // RegisterImplementations registers impls as concrete implementations of - // the interface iface. - // - // Ex: - // registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSend{}, &MsgMultiSend{}) - RegisterImplementations(iface interface{}, impls ...proto.Message) - - // ListAllInterfaces list the type URLs of all registered interfaces. - ListAllInterfaces() []string - - // ListImplementations lists the valid type URLs for the given interface name that can be used - // for the provided interface type URL. - ListImplementations(ifaceTypeURL string) []string -} - -// UnpackInterfacesMessage is meant to extend protobuf types (which implement -// proto.Message) to support a post-deserialization phase which unpacks -// types packed within Any's using the whitelist provided by AnyUnpacker -type UnpackInterfacesMessage interface { - // UnpackInterfaces is implemented in order to unpack values packed within - // Any's using the AnyUnpacker. It should generally be implemented as - // follows: - // func (s *MyStruct) UnpackInterfaces(unpacker AnyUnpacker) error { - // var x AnyInterface - // // where X is an Any field on MyStruct - // err := unpacker.UnpackAny(s.X, &x) - // if err != nil { - // return nil - // } - // // where Y is a field on MyStruct that implements UnpackInterfacesMessage itself - // err = s.Y.UnpackInterfaces(unpacker) - // if err != nil { - // return nil - // } - // return nil - // } - UnpackInterfaces(unpacker AnyUnpacker) error -} - -type interfaceRegistry struct { - interfaceNames map[string]reflect.Type - interfaceImpls map[reflect.Type]interfaceMap - typeURLMap map[string]reflect.Type -} - -type interfaceMap = map[string]reflect.Type - -// NewInterfaceRegistry returns a new InterfaceRegistry -func NewInterfaceRegistry() InterfaceRegistry { - return &interfaceRegistry{ - interfaceNames: map[string]reflect.Type{}, - interfaceImpls: map[reflect.Type]interfaceMap{}, - typeURLMap: map[string]reflect.Type{}, - } -} - -func (registry *interfaceRegistry) RegisterInterface(protoName string, iface interface{}, impls ...proto.Message) { - typ := reflect.TypeOf(iface) - if typ.Elem().Kind() != reflect.Interface { - panic(fmt.Errorf("%T is not an interface type", iface)) - } - registry.interfaceNames[protoName] = typ - registry.RegisterImplementations(iface, impls...) -} - -func (registry *interfaceRegistry) RegisterImplementations(iface interface{}, impls ...proto.Message) { - for _, impl := range impls { - typeURL := "/" + proto.MessageName(impl) - registry.registerImpl(iface, typeURL, impl) - } -} - -// RegisterCustomTypeURL registers a concrete type which implements the given -// interface under `typeURL`. -// -// This function PANICs if different concrete types are registered under the -// same typeURL. -func (registry *interfaceRegistry) RegisterCustomTypeURL(iface interface{}, typeURL string, impl proto.Message) { - registry.registerImpl(iface, typeURL, impl) -} - -// registerImpl registers a concrete type which implements the given -// interface under `typeURL`. -// -// This function PANICs if different concrete types are registered under the -// same typeURL. -func (registry *interfaceRegistry) registerImpl(iface interface{}, typeURL string, impl proto.Message) { - ityp := reflect.TypeOf(iface).Elem() - imap, found := registry.interfaceImpls[ityp] - if !found { - imap = map[string]reflect.Type{} - } - - implType := reflect.TypeOf(impl) - if !implType.AssignableTo(ityp) { - panic(fmt.Errorf("type %T doesn't actually implement interface %+v", impl, ityp)) - } - - // Check if we already registered something under the given typeURL. It's - // okay to register the same concrete type again, but if we are registering - // a new concrete type under the same typeURL, then we throw an error (here, - // we panic). - foundImplType, found := imap[typeURL] - if found && foundImplType != implType { - panic( - fmt.Errorf( - "concrete type %s has already been registered under typeURL %s, cannot register %s under same typeURL. "+ - "This usually means that there are conflicting modules registering different concrete types "+ - "for a same interface implementation", - foundImplType, - typeURL, - implType, - ), - ) - } - - imap[typeURL] = implType - registry.typeURLMap[typeURL] = implType - - registry.interfaceImpls[ityp] = imap -} - -func (registry *interfaceRegistry) ListAllInterfaces() []string { - interfaceNames := registry.interfaceNames - keys := make([]string, 0, len(interfaceNames)) - for key := range interfaceNames { - keys = append(keys, key) - } - return keys -} - -func (registry *interfaceRegistry) ListImplementations(ifaceName string) []string { - typ, ok := registry.interfaceNames[ifaceName] - if !ok { - return []string{} - } - - impls, ok := registry.interfaceImpls[typ.Elem()] - if !ok { - return []string{} - } - - keys := make([]string, 0, len(impls)) - for key := range impls { - keys = append(keys, key) - } - return keys -} - -func (registry *interfaceRegistry) UnpackAny(any *Any, iface interface{}) error { - // here we gracefully handle the case in which `any` itself is `nil`, which may occur in message decoding - if any == nil { - return nil - } - - if any.TypeUrl == "" { - // if TypeUrl is empty return nil because without it we can't actually unpack anything - return nil - } - - rv := reflect.ValueOf(iface) - if rv.Kind() != reflect.Ptr { - return fmt.Errorf("UnpackAny expects a pointer") - } - - rt := rv.Elem().Type() - - cachedValue := any.cachedValue - if cachedValue != nil { - if reflect.TypeOf(cachedValue).AssignableTo(rt) { - rv.Elem().Set(reflect.ValueOf(cachedValue)) - return nil - } - } - - imap, found := registry.interfaceImpls[rt] - if !found { - return fmt.Errorf("no registered implementations of type %+v", rt) - } - - typ, found := imap[any.TypeUrl] - if !found { - return fmt.Errorf("no concrete type registered for type URL %s against interface %T", any.TypeUrl, iface) - } - - msg, ok := reflect.New(typ.Elem()).Interface().(proto.Message) - if !ok { - return fmt.Errorf("can't proto unmarshal %T", msg) - } - - err := proto.Unmarshal(any.Value, msg) - if err != nil { - return err - } - - err = UnpackInterfaces(msg, registry) - if err != nil { - return err - } - - rv.Elem().Set(reflect.ValueOf(msg)) - - any.cachedValue = msg - - return nil -} - -// Resolve returns the proto message given its typeURL. It works with types -// registered with RegisterInterface/RegisterImplementations, as well as those -// registered with RegisterWithCustomTypeURL. -func (registry *interfaceRegistry) Resolve(typeURL string) (proto.Message, error) { - typ, found := registry.typeURLMap[typeURL] - if !found { - return nil, fmt.Errorf("unable to resolve type URL %s", typeURL) - } - - msg, ok := reflect.New(typ.Elem()).Interface().(proto.Message) - if !ok { - return nil, fmt.Errorf("can't resolve type URL %s", typeURL) - } - - return msg, nil -} - -// UnpackInterfaces is a convenience function that calls UnpackInterfaces -// on x if x implements UnpackInterfacesMessage -func UnpackInterfaces(x interface{}, unpacker AnyUnpacker) error { - if msg, ok := x.(UnpackInterfacesMessage); ok { - return msg.UnpackInterfaces(unpacker) - } - return nil -} diff --git a/core-sdk/common/codec/unknownproto/doc.go b/core-sdk/common/codec/unknownproto/doc.go deleted file mode 100644 index 0e0a4634..00000000 --- a/core-sdk/common/codec/unknownproto/doc.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -unknownproto implements functionality to "type check" protobuf serialized byte sequences -against an expected proto.Message to report: - -a) Unknown fields in the stream -- this is indicative of mismatched services, perhaps a malicious actor - -b) Mismatched wire types for a field -- this is indicative of mismatched services - -Its API signature is similar to proto.Unmarshal([]byte, proto.Message) in the strict case - - if err := RejectUnknownFieldsStrict(protoBlob, protoMessage, false); err != nil { - // Handle the error. - } - -and ideally should be added before invoking proto.Unmarshal, if you'd like to enforce the features mentioned above. - -By default, for security we report every single field that's unknown, whether a non-critical field or not. To customize -this behavior, please set the boolean parameter allowUnknownNonCriticals to true to RejectUnknownFields: - - if err := RejectUnknownFields(protoBlob, protoMessage, true); err != nil { - // Handle the error. - } -*/ -package unknownproto diff --git a/core-sdk/common/codec/unknownproto/unknown_fields.go b/core-sdk/common/codec/unknownproto/unknown_fields.go deleted file mode 100644 index 36979d5d..00000000 --- a/core-sdk/common/codec/unknownproto/unknown_fields.go +++ /dev/null @@ -1,403 +0,0 @@ -package unknownproto - -import ( - "bytes" - "compress/gzip" - "errors" - "fmt" - "io/ioutil" - "reflect" - "sync" - - "github.com/gogo/protobuf/proto" - "github.com/gogo/protobuf/protoc-gen-gogo/descriptor" - "google.golang.org/protobuf/encoding/protowire" - - "github.com/irisnet/core-sdk-go/common/codec/types" -) - -const bit11NonCritical = 1 << 10 - -type descriptorIface interface { - Descriptor() ([]byte, []int) -} - -// RejectUnknownFieldsStrict rejects any bytes bz with an error that has unknown fields for the provided proto.Message type. -// This function traverses inside of messages nested via google.protobuf.Any. It does not do any deserialization of the proto.Message. -func RejectUnknownFieldsStrict(bz []byte, msg proto.Message) error { - _, err := RejectUnknownFields(bz, msg, false) - return err -} - -// RejectUnknownFields rejects any bytes bz with an error that has unknown fields for the provided proto.Message type with an -// option to allow non-critical fields (specified as those fields with bit 11) to pass through. In either case, the -// hasUnknownNonCriticals will be set to true if non-critical fields were encountered during traversal. This flag can be -// used to treat a message with non-critical field different in different security contexts (such as transaction signing). -// This function traverses inside of messages nested via google.protobuf.Any. It does not do any deserialization of the proto.Message. -func RejectUnknownFields(bz []byte, msg proto.Message, allowUnknownNonCriticals bool) (hasUnknownNonCriticals bool, err error) { - if len(bz) == 0 { - return hasUnknownNonCriticals, nil - } - - desc, ok := msg.(descriptorIface) - if !ok { - return hasUnknownNonCriticals, fmt.Errorf("%T does not have a Descriptor() method", msg) - } - - fieldDescProtoFromTagNum, _, err := getDescriptorInfo(desc, msg) - if err != nil { - return hasUnknownNonCriticals, err - } - - for len(bz) > 0 { - tagNum, wireType, m := protowire.ConsumeTag(bz) - if m < 0 { - return hasUnknownNonCriticals, errors.New("invalid length") - } - - fieldDescProto, ok := fieldDescProtoFromTagNum[int32(tagNum)] - switch { - case ok: - // Assert that the wireTypes match. - if !canEncodeType(wireType, fieldDescProto.GetType()) { - return hasUnknownNonCriticals, &errMismatchedWireType{ - Type: reflect.ValueOf(msg).Type().String(), - TagNum: tagNum, - GotWireType: wireType, - WantWireType: protowire.Type(fieldDescProto.WireType()), - } - } - - default: - isCriticalField := tagNum&bit11NonCritical == 0 - - if !isCriticalField { - hasUnknownNonCriticals = true - } - - if isCriticalField || !allowUnknownNonCriticals { - // The tag is critical, so report it. - return hasUnknownNonCriticals, &errUnknownField{ - Type: reflect.ValueOf(msg).Type().String(), - TagNum: tagNum, - WireType: wireType, - } - } - } - - // Skip over the bytes that store fieldNumber and wireType bytes. - bz = bz[m:] - n := protowire.ConsumeFieldValue(tagNum, wireType, bz) - fieldBytes := bz[:n] - bz = bz[n:] - - // An unknown but non-critical field or just a scalar type (aka *INT and BYTES like). - if fieldDescProto == nil || fieldDescProto.IsScalar() { - continue - } - - protoMessageName := fieldDescProto.GetTypeName() - if protoMessageName == "" { - switch typ := fieldDescProto.GetType(); typ { - case descriptor.FieldDescriptorProto_TYPE_STRING, descriptor.FieldDescriptorProto_TYPE_BYTES: - // At this point only TYPE_STRING is expected to be unregistered, since FieldDescriptorProto.IsScalar() returns false for - // TYPE_BYTES and TYPE_STRING as per - // https://github.com/gogo/protobuf/blob/5628607bb4c51c3157aacc3a50f0ab707582b805/protoc-gen-gogo/descriptor/descriptor.go#L95-L118 - default: - return hasUnknownNonCriticals, fmt.Errorf("failed to get typename for message of type %v, can only be TYPE_STRING or TYPE_BYTES", typ) - } - continue - } - - // Let's recursively traverse and typecheck the field. - - // consume length prefix of nested message - _, o := protowire.ConsumeVarint(fieldBytes) - fieldBytes = fieldBytes[o:] - - if protoMessageName == ".google.protobuf.Any" { - // Firstly typecheck types.Any to ensure nothing snuck in. - hasUnknownNonCriticalsChild, err := RejectUnknownFields(fieldBytes, (*types.Any)(nil), allowUnknownNonCriticals) - hasUnknownNonCriticals = hasUnknownNonCriticals || hasUnknownNonCriticalsChild - if err != nil { - return hasUnknownNonCriticals, err - } - // And finally we can extract the TypeURL containing the protoMessageName. - any := new(types.Any) - if err := proto.Unmarshal(fieldBytes, any); err != nil { - return hasUnknownNonCriticals, err - } - protoMessageName = any.TypeUrl - fieldBytes = any.Value - } - - msg, err := protoMessageForTypeName(protoMessageName[1:]) - if err != nil { - return hasUnknownNonCriticals, err - } - - hasUnknownNonCriticalsChild, err := RejectUnknownFields(fieldBytes, msg, allowUnknownNonCriticals) - hasUnknownNonCriticals = hasUnknownNonCriticals || hasUnknownNonCriticalsChild - if err != nil { - return hasUnknownNonCriticals, err - } - } - - return hasUnknownNonCriticals, nil -} - -var protoMessageForTypeNameMu sync.RWMutex -var protoMessageForTypeNameCache = make(map[string]proto.Message) - -// protoMessageForTypeName takes in a fully qualified name e.g. testdata.TestVersionFD1 -// and returns a corresponding empty protobuf message that serves the prototype for typechecking. -func protoMessageForTypeName(protoMessageName string) (proto.Message, error) { - protoMessageForTypeNameMu.RLock() - msg, ok := protoMessageForTypeNameCache[protoMessageName] - protoMessageForTypeNameMu.RUnlock() - if ok { - return msg, nil - } - - concreteGoType := proto.MessageType(protoMessageName) - if concreteGoType == nil { - return nil, fmt.Errorf("failed to retrieve the message of type %q", protoMessageName) - } - - value := reflect.New(concreteGoType).Elem() - msg, ok = value.Interface().(proto.Message) - if !ok { - return nil, fmt.Errorf("%q does not implement proto.Message", protoMessageName) - } - - // Now cache it. - protoMessageForTypeNameMu.Lock() - protoMessageForTypeNameCache[protoMessageName] = msg - protoMessageForTypeNameMu.Unlock() - - return msg, nil -} - -// checks is a mapping of protowire.Type to supported descriptor.FieldDescriptorProto_Type. -// it is implemented this way so as to have constant time lookups and avoid the overhead -// from O(n) walking of switch. The change to using this mapping boosts throughput by about 200%. -var checks = [...]map[descriptor.FieldDescriptorProto_Type]bool{ - // "0 Varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum" - 0: { - descriptor.FieldDescriptorProto_TYPE_INT32: true, - descriptor.FieldDescriptorProto_TYPE_INT64: true, - descriptor.FieldDescriptorProto_TYPE_UINT32: true, - descriptor.FieldDescriptorProto_TYPE_UINT64: true, - descriptor.FieldDescriptorProto_TYPE_SINT32: true, - descriptor.FieldDescriptorProto_TYPE_SINT64: true, - descriptor.FieldDescriptorProto_TYPE_BOOL: true, - descriptor.FieldDescriptorProto_TYPE_ENUM: true, - }, - - // "1 64-bit: fixed64, sfixed64, double" - 1: { - descriptor.FieldDescriptorProto_TYPE_FIXED64: true, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: true, - descriptor.FieldDescriptorProto_TYPE_DOUBLE: true, - }, - - // "2 Length-delimited: string, bytes, embedded messages, packed repeated fields" - 2: { - descriptor.FieldDescriptorProto_TYPE_STRING: true, - descriptor.FieldDescriptorProto_TYPE_BYTES: true, - descriptor.FieldDescriptorProto_TYPE_MESSAGE: true, - // The following types can be packed repeated. - // ref: "Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed"." - // ref: https://developers.google.com/protocol-buffers/docs/encoding#packed - descriptor.FieldDescriptorProto_TYPE_INT32: true, - descriptor.FieldDescriptorProto_TYPE_INT64: true, - descriptor.FieldDescriptorProto_TYPE_UINT32: true, - descriptor.FieldDescriptorProto_TYPE_UINT64: true, - descriptor.FieldDescriptorProto_TYPE_SINT32: true, - descriptor.FieldDescriptorProto_TYPE_SINT64: true, - descriptor.FieldDescriptorProto_TYPE_BOOL: true, - descriptor.FieldDescriptorProto_TYPE_ENUM: true, - descriptor.FieldDescriptorProto_TYPE_FIXED64: true, - descriptor.FieldDescriptorProto_TYPE_SFIXED64: true, - descriptor.FieldDescriptorProto_TYPE_DOUBLE: true, - }, - - // "3 Start group: groups (deprecated)" - 3: { - descriptor.FieldDescriptorProto_TYPE_GROUP: true, - }, - - // "4 End group: groups (deprecated)" - 4: { - descriptor.FieldDescriptorProto_TYPE_GROUP: true, - }, - - // "5 32-bit: fixed32, sfixed32, float" - 5: { - descriptor.FieldDescriptorProto_TYPE_FIXED32: true, - descriptor.FieldDescriptorProto_TYPE_SFIXED32: true, - descriptor.FieldDescriptorProto_TYPE_FLOAT: true, - }, -} - -// canEncodeType returns true if the wireType is suitable for encoding the descriptor type. -// See https://developers.google.com/protocol-buffers/docs/encoding#structure. -func canEncodeType(wireType protowire.Type, descType descriptor.FieldDescriptorProto_Type) bool { - if iwt := int(wireType); iwt < 0 || iwt >= len(checks) { - return false - } - return checks[wireType][descType] -} - -// errMismatchedWireType describes a mismatch between -// expected and got wireTypes for a specific tag number. -type errMismatchedWireType struct { - Type string - GotWireType protowire.Type - WantWireType protowire.Type - TagNum protowire.Number -} - -// String implements fmt.Stringer. -func (mwt *errMismatchedWireType) String() string { - return fmt.Sprintf("Mismatched %q: {TagNum: %d, GotWireType: %q != WantWireType: %q}", - mwt.Type, mwt.TagNum, wireTypeToString(mwt.GotWireType), wireTypeToString(mwt.WantWireType)) -} - -// Error implements the error interface. -func (mwt *errMismatchedWireType) Error() string { - return mwt.String() -} - -var _ error = (*errMismatchedWireType)(nil) - -func wireTypeToString(wt protowire.Type) string { - switch wt { - case 0: - return "varint" - case 1: - return "fixed64" - case 2: - return "bytes" - case 3: - return "start_group" - case 4: - return "end_group" - case 5: - return "fixed32" - default: - return fmt.Sprintf("unknown type: %d", wt) - } -} - -// errUnknownField represents an error indicating that we encountered -// a field that isn't available in the target proto.Message. -type errUnknownField struct { - Type string - TagNum protowire.Number - WireType protowire.Type -} - -// String implements fmt.Stringer. -func (twt *errUnknownField) String() string { - return fmt.Sprintf("errUnknownField %q: {TagNum: %d, WireType:%q}", - twt.Type, twt.TagNum, wireTypeToString(twt.WireType)) -} - -// Error implements the error interface. -func (twt *errUnknownField) Error() string { - return twt.String() -} - -var _ error = (*errUnknownField)(nil) - -var ( - protoFileToDesc = make(map[string]*descriptor.FileDescriptorProto) - protoFileToDescMu sync.RWMutex -) - -func unnestDesc(mdescs []*descriptor.DescriptorProto, indices []int) *descriptor.DescriptorProto { - mdesc := mdescs[indices[0]] - for _, index := range indices[1:] { - mdesc = mdesc.NestedType[index] - } - return mdesc -} - -// Invoking descriptor.ForMessage(proto.Message.(Descriptor).Descriptor()) is incredibly slow -// for every single message, thus the need for a hand-rolled custom version that's performant and cacheable. -func extractFileDescMessageDesc(desc descriptorIface) (*descriptor.FileDescriptorProto, *descriptor.DescriptorProto, error) { - gzippedPb, indices := desc.Descriptor() - - protoFileToDescMu.RLock() - cached, ok := protoFileToDesc[string(gzippedPb)] - protoFileToDescMu.RUnlock() - - if ok { - return cached, unnestDesc(cached.MessageType, indices), nil - } - - // Time to gunzip the content of the FileDescriptor and then proto unmarshal them. - gzr, err := gzip.NewReader(bytes.NewReader(gzippedPb)) - if err != nil { - return nil, nil, err - } - protoBlob, err := ioutil.ReadAll(gzr) - if err != nil { - return nil, nil, err - } - - fdesc := new(descriptor.FileDescriptorProto) - if err := proto.Unmarshal(protoBlob, fdesc); err != nil { - return nil, nil, err - } - - // Now cache the FileDescriptor. - protoFileToDescMu.Lock() - protoFileToDesc[string(gzippedPb)] = fdesc - protoFileToDescMu.Unlock() - - // Unnest the type if necessary. - return fdesc, unnestDesc(fdesc.MessageType, indices), nil -} - -type descriptorMatch struct { - cache map[int32]*descriptor.FieldDescriptorProto - desc *descriptor.DescriptorProto -} - -var descprotoCacheMu sync.RWMutex -var descprotoCache = make(map[reflect.Type]*descriptorMatch) - -// getDescriptorInfo retrieves the mapping of field numbers to their respective field descriptors. -func getDescriptorInfo(desc descriptorIface, msg proto.Message) (map[int32]*descriptor.FieldDescriptorProto, *descriptor.DescriptorProto, error) { - key := reflect.ValueOf(msg).Type() - - descprotoCacheMu.RLock() - got, ok := descprotoCache[key] - descprotoCacheMu.RUnlock() - - if ok { - return got.cache, got.desc, nil - } - - // Now compute and cache the index. - _, md, err := extractFileDescMessageDesc(desc) - if err != nil { - return nil, nil, err - } - - tagNumToTypeIndex := make(map[int32]*descriptor.FieldDescriptorProto) - for _, field := range md.Field { - tagNumToTypeIndex[field.GetNumber()] = field - } - - descprotoCacheMu.Lock() - descprotoCache[key] = &descriptorMatch{ - cache: tagNumToTypeIndex, - desc: md, - } - descprotoCacheMu.Unlock() - - return tagNumToTypeIndex, md, nil -} diff --git a/core-sdk/common/commom.go b/core-sdk/common/commom.go deleted file mode 100644 index 4f9124ed..00000000 --- a/core-sdk/common/commom.go +++ /dev/null @@ -1,58 +0,0 @@ -package common - -import ( - "crypto/rand" - - "github.com/irisnet/core-sdk-go/types" -) - -// GenerateRandomBytes returns securely generated random bytes. -// It will return an error if the system's secure random -// number generator fails to function correctly, in which -// case the caller should not continue. -func GenerateRandomBytes(n int) ([]byte, error) { - b := make([]byte, n) - _, err := rand.Read(b) - // Note that err == nil only if we read len(b) bytes. - if err != nil { - return nil, err - } - - return b, nil -} - -func SubArray(subLen int, array types.SplitAble) (segments []types.SplitAble) { - maxLen := array.Len() - if maxLen <= subLen { - return []types.SplitAble{array} - } - - batch := maxLen / subLen - if maxLen%subLen > 0 { - batch++ - } - - for i := 1; i <= batch; i++ { - start := (i - 1) * subLen - end := i * subLen - if i != batch { - segments = append(segments, array.Sub(start, end)) - } else { - segments = append(segments, array.Sub(start, array.Len())) - } - } - return segments -} - -func ParsePage(page uint64, size uint64) (offset, limit uint64) { - if page == 0 { - page = 1 - } - if size == 0 { - size = 10 - } - - offset = (page - 1) * size - limit = size - return -} diff --git a/core-sdk/common/common_test.go b/core-sdk/common/common_test.go deleted file mode 100644 index 1d8f17e5..00000000 --- a/core-sdk/common/common_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package common - -import ( - "testing" - - "github.com/irisnet/core-sdk-go/types" - - "github.com/stretchr/testify/require" -) - -func TestSplitArray(t *testing.T) { - data := Ints{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - subData := SubArray(4, data) - require.Len(t, subData, 3) -} - -type Ints []int - -func (i Ints) Len() int { - return len(i) -} - -func (i Ints) Sub(begin, end int) types.SplitAble { - return i[begin:end] -} diff --git a/core-sdk/common/crypto/armor.go b/core-sdk/common/crypto/armor.go deleted file mode 100644 index 6a59b718..00000000 --- a/core-sdk/common/crypto/armor.go +++ /dev/null @@ -1,210 +0,0 @@ -package crypto - -import ( - "encoding/hex" - "fmt" - - "github.com/pkg/errors" - - "github.com/tendermint/crypto/bcrypt" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/armor" - "github.com/tendermint/tendermint/crypto/xsalsa20symmetric" - - "github.com/irisnet/core-sdk-go/common/codec/legacy" - cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" -) - -const ( - blockTypePrivKey = "TENDERMINT PRIVATE KEY" - blockTypeKeyInfo = "TENDERMINT KEY INFO" - blockTypePubKey = "TENDERMINT PUBLIC KEY" - - defaultAlgo = "secp256k1" - - headerVersion = "version" - headerType = "type" -) - -// BcryptSecurityParameter is security parameter var, and it can be changed within the lcd test. -// Making the bcrypt security parameter a var shouldn't be a security issue: -// One can't verify an invalid key by maliciously changing the bcrypt -// parameter during a runtime vulnerability. The main security -// threat this then exposes would be something that changes this during -// runtime before the user creates their key. This vulnerability must -// succeed to update this to that same value before every subsequent call -// to the keys command in future startups / or the attacker must get access -// to the filesystem. However, with a similar threat model (changing -// variables in runtime), one can cause the user to sign a different tx -// than what they see, which is a significantly cheaper attack then breaking -// a bcrypt hash. (Recall that the nonce still exists to break rainbow tables) -// For further notes on security parameter choice, see README.md -var BcryptSecurityParameter = 12 - -//----------------------------------------------------------------- -// add armor - -// Armor the InfoBytes -func ArmorInfoBytes(bz []byte) string { - header := map[string]string{ - headerType: "Info", - headerVersion: "0.0.0", - } - - return armor.EncodeArmor(blockTypeKeyInfo, header, bz) -} - -// Armor the PubKeyBytes -func ArmorPubKeyBytes(bz []byte, algo string) string { - header := map[string]string{ - headerVersion: "0.0.1", - } - if algo != "" { - header[headerType] = algo - } - - return armor.EncodeArmor(blockTypePubKey, header, bz) -} - -//----------------------------------------------------------------- -// remove armor - -// Unarmor the InfoBytes -func UnarmorInfoBytes(armorStr string) ([]byte, error) { - bz, header, err := unarmorBytes(armorStr, blockTypeKeyInfo) - if err != nil { - return nil, err - } - - if header[headerVersion] != "0.0.0" { - return nil, fmt.Errorf("unrecognized version: %v", header[headerVersion]) - } - - return bz, nil -} - -// UnarmorPubKeyBytes returns the pubkey byte slice, a string of the algo type, and an error -func UnarmorPubKeyBytes(armorStr string) (bz []byte, algo string, err error) { - bz, header, err := unarmorBytes(armorStr, blockTypePubKey) - if err != nil { - return nil, "", fmt.Errorf("couldn't unarmor bytes: %v", err) - } - - switch header[headerVersion] { - case "0.0.0": - return bz, defaultAlgo, err - case "0.0.1": - if header[headerType] == "" { - header[headerType] = defaultAlgo - } - - return bz, header[headerType], err - case "": - return nil, "", fmt.Errorf("header's version field is empty") - default: - err = fmt.Errorf("unrecognized version: %v", header[headerVersion]) - return nil, "", err - } -} - -func unarmorBytes(armorStr, blockType string) (bz []byte, header map[string]string, err error) { - bType, header, bz, err := armor.DecodeArmor(armorStr) - if err != nil { - return - } - - if bType != blockType { - err = fmt.Errorf("unrecognized armor type %q, expected: %q", bType, blockType) - return - } - - return -} - -//----------------------------------------------------------------- -// encrypt/decrypt with armor - -// Encrypt and armor the private key. -func EncryptArmorPrivKey(privKey crypto.PrivKey, passphrase string, algo string) string { - saltBytes, encBytes := encryptPrivKey(privKey, passphrase) - header := map[string]string{ - "kdf": "bcrypt", - "salt": fmt.Sprintf("%X", saltBytes), - } - - if algo != "" { - header[headerType] = algo - } - - armorStr := armor.EncodeArmor(blockTypePrivKey, header, encBytes) - - return armorStr -} - -// encrypt the given privKey with the passphrase using a randomly -// generated salt and the xsalsa20 cipher. returns the salt and the -// encrypted priv key. -func encryptPrivKey(privKey crypto.PrivKey, passphrase string) (saltBytes []byte, encBytes []byte) { - saltBytes = crypto.CRandBytes(16) - key, err := bcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter) - - if err != nil { - panic(errors.Wrap(err, "error generating bcrypt key from passphrase")) - } - - key = crypto.Sha256(key) // get 32 bytes - privKeyBytes := legacy.Cdc.Amino.MustMarshalBinaryBare(privKey) - - return saltBytes, xsalsa20symmetric.EncryptSymmetric(privKeyBytes, key) -} - -// UnarmorDecryptPrivKey returns the privkey byte slice, a string of the algo type, and an error -func UnarmorDecryptPrivKey(armorStr string, passphrase string) (privKey crypto.PrivKey, algo string, err error) { - blockType, header, encBytes, err := armor.DecodeArmor(armorStr) - if err != nil { - return privKey, "", err - } - - if blockType != blockTypePrivKey { - return privKey, "", fmt.Errorf("unrecognized armor type: %v", blockType) - } - - if header["kdf"] != "bcrypt" { - return privKey, "", fmt.Errorf("unrecognized KDF type: %v", header["kdf"]) - } - - if header["salt"] == "" { - return privKey, "", fmt.Errorf("missing salt bytes") - } - - saltBytes, err := hex.DecodeString(header["salt"]) - if err != nil { - return privKey, "", fmt.Errorf("error decoding salt: %v", err.Error()) - } - - privKey, err = decryptPrivKey(saltBytes, encBytes, passphrase) - - if header[headerType] == "" { - header[headerType] = defaultAlgo - } - - return privKey, header[headerType], err -} - -func decryptPrivKey(saltBytes []byte, encBytes []byte, passphrase string) (privKey crypto.PrivKey, err error) { - key, err := bcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter) - if err != nil { - return privKey, errors.Wrap(err, "error generating bcrypt key from passphrase") - } - - key = crypto.Sha256(key) // Get 32 bytes - - privKeyBytes, err := xsalsa20symmetric.DecryptSymmetric(encBytes, key) - if err != nil && err.Error() == "Ciphertext decryption failed" { - return privKey, errors.New("wrong password") - } else if err != nil { - return privKey, err - } - - return cryptoAmino.PrivKeyFromBytes(privKeyBytes) -} diff --git a/core-sdk/common/crypto/codec/amino.go b/core-sdk/common/crypto/codec/amino.go deleted file mode 100644 index e16eb467..00000000 --- a/core-sdk/common/crypto/codec/amino.go +++ /dev/null @@ -1,59 +0,0 @@ -package codec - -import ( - "github.com/tendermint/tendermint/crypto" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/sr25519" - - commoncrypto "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/crypto/keys/ed25519" - kmultisig "github.com/irisnet/core-sdk-go/common/crypto/keys/multisig" - "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" -) - -var amino *commoncrypto.LegacyAmino - -func init() { - amino = commoncrypto.NewLegacyAmino() - RegisterCrypto(amino) -} - -// RegisterCrypto registers all crypto dependency types with the provided Amino codec. -func RegisterCrypto(cdc *commoncrypto.LegacyAmino) { - cdc.RegisterInterface((*crypto.PubKey)(nil), nil) - cdc.RegisterInterface((*cryptotypes.PubKey)(nil), nil) - cdc.RegisterConcrete(sr25519.PubKey{}, sr25519.PubKeyName, nil) - - cdc.RegisterConcrete(tmed25519.PubKey{}, tmed25519.PubKeyName, nil) - cdc.RegisterConcrete(&ed25519.PubKey{}, ed25519.PubKeyName, nil) - cdc.RegisterConcrete(&secp256k1.PubKey{}, secp256k1.PubKeyName, nil) - cdc.RegisterConcrete(&kmultisig.LegacyAminoPubKey{}, kmultisig.PubKeyAminoRoute, nil) - - cdc.RegisterInterface((*crypto.PrivKey)(nil), nil) - cdc.RegisterConcrete(sr25519.PrivKey{}, sr25519.PrivKeyName, nil) - - cdc.RegisterConcrete(tmed25519.PrivKey{}, tmed25519.PrivKeyName, nil) - cdc.RegisterConcrete(&ed25519.PrivKey{}, ed25519.PrivKeyName, nil) - cdc.RegisterConcrete(&secp256k1.PrivKey{}, secp256k1.PrivKeyName, nil) -} - -// PrivKeyFromBytes unmarshals private key bytes and returns a PrivKey -func PrivKeyFromBytes(privKeyBytes []byte) (privKey crypto.PrivKey, err error) { - err = amino.UnmarshalBinaryBare(privKeyBytes, &privKey) - return -} - -// PubKeyFromBytes unmarshals public key bytes and returns a PubKey -func PubKeyFromBytes(pubKeyBytes []byte) (pubKey crypto.PubKey, err error) { - err = amino.UnmarshalBinaryBare(pubKeyBytes, &pubKey) - return -} - -func MarshalPubkey(pubkey crypto.PubKey) []byte { - return amino.MustMarshalBinaryBare(pubkey) -} - -func MarshalPrivKey(privKey crypto.PrivKey) []byte { - return amino.MustMarshalBinaryBare(privKey) -} diff --git a/core-sdk/common/crypto/codec/proto.go b/core-sdk/common/crypto/codec/proto.go deleted file mode 100644 index 256b3d7a..00000000 --- a/core-sdk/common/crypto/codec/proto.go +++ /dev/null @@ -1,27 +0,0 @@ -package codec - -import ( - tmcrypto "github.com/tendermint/tendermint/crypto" - - codectypes "github.com/irisnet/core-sdk-go/common/codec/types" - "github.com/irisnet/core-sdk-go/common/crypto/keys/ed25519" - "github.com/irisnet/core-sdk-go/common/crypto/keys/multisig" - "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" -) - -// RegisterInterfaces registers the sdk.Tx interface. -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - // TODO We now register both Tendermint's PubKey and our own PubKey. In the - // long-term, we should move away from Tendermint's PubKey, and delete - // these lines. - registry.RegisterInterface("tendermint.crypto.Pubkey", (*tmcrypto.PubKey)(nil)) - registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &ed25519.PubKey{}) - registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &secp256k1.PubKey{}) - registry.RegisterImplementations((*tmcrypto.PubKey)(nil), &multisig.LegacyAminoPubKey{}) - - registry.RegisterInterface("cosmos.crypto.Pubkey", (*cryptotypes.PubKey)(nil)) - registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &ed25519.PubKey{}) - registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &secp256k1.PubKey{}) - registry.RegisterImplementations((*cryptotypes.PubKey)(nil), &multisig.LegacyAminoPubKey{}) -} diff --git a/core-sdk/common/crypto/hd/algo.go b/core-sdk/common/crypto/hd/algo.go deleted file mode 100644 index 71dd71f7..00000000 --- a/core-sdk/common/crypto/hd/algo.go +++ /dev/null @@ -1,88 +0,0 @@ -package hd - -import ( - "fmt" - - bip39 "github.com/cosmos/go-bip39" - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" -) - -type SignatureAlgo interface { - Name() PubKeyType - Derive() DeriveFn - Generate() GenerateFn -} - -func NewSigningAlgoFromString(str string) (SignatureAlgo, error) { - switch str { - case string(Secp256k1.Name()): - return Secp256k1, nil - default: - return nil, fmt.Errorf("provided algorithm `%s` is not supported", str) - } -} - -// PubKeyType defines an algorithm to derive key-pairs which can be used for cryptographic signing. -type PubKeyType string - -const ( - // MultiType implies that a pubkey is a multisignature - MultiType = PubKeyType("multi") - // Secp256k1Type uses the Bitcoin secp256k1 ECDSA parameters. - Secp256k1Type = PubKeyType("secp256k1") - // Ed25519Type represents the Ed25519Type signature system. - // It is currently not supported for end-user keys (wallets/ledgers). - Ed25519Type = PubKeyType("ed25519") - // Sr25519Type represents the Sr25519Type signature system. - Sr25519Type = PubKeyType("sr25519") -) - -var ( - // Secp256k1 uses the Bitcoin secp256k1 ECDSA parameters. - Secp256k1 = secp256k1Algo{} -) - -type DeriveFn func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) -type GenerateFn func(bz []byte) crypto.PrivKey - -type WalletGenerator interface { - Derive(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) - Generate(bz []byte) crypto.PrivKey -} - -type secp256k1Algo struct { -} - -func (s secp256k1Algo) Name() PubKeyType { - return Secp256k1Type -} - -// Derive derives and returns the secp256k1 private key for the given seed and HD path. -func (s secp256k1Algo) Derive() DeriveFn { - return func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) { - seed, err := bip39.NewSeedWithErrorChecking(mnemonic, bip39Passphrase) - if err != nil { - return nil, err - } - - masterPriv, ch := ComputeMastersFromSeed(seed) - if len(hdPath) == 0 { - return masterPriv[:], nil - } - derivedKey, err := DerivePrivateKeyForPath(masterPriv, ch, hdPath) - - return derivedKey, err - } -} - -// Generate generates a secp256k1 private key from the given bytes. -func (s secp256k1Algo) Generate() GenerateFn { - return func(bz []byte) crypto.PrivKey { - var bzArr = make([]byte, secp256k1.PrivKeySize) - copy(bzArr, bz) - - return &secp256k1.PrivKey{Key: bzArr} - } -} diff --git a/core-sdk/common/crypto/hd/hdpath.go b/core-sdk/common/crypto/hd/hdpath.go deleted file mode 100644 index f80e53ca..00000000 --- a/core-sdk/common/crypto/hd/hdpath.go +++ /dev/null @@ -1,267 +0,0 @@ -package hd - -import ( - "crypto/hmac" - "crypto/sha512" - "encoding/binary" - "fmt" - "math/big" - "strconv" - "strings" - - "github.com/btcsuite/btcd/btcec" -) - -const ( - BIP44Prefix = "44'/118'/" - PartialPath = "0'/0/0" - FullPath = BIP44Prefix + PartialPath -) - -// BIP44Params wraps BIP 44 params (5 level BIP 32 path). -// To receive a canonical string representation ala -// m / purpose' / coinType' / account' / change / addressIndex -// call String() on a BIP44Params instance. -type BIP44Params struct { - Purpose uint32 `json:"purpose"` - CoinType uint32 `json:"coinType"` - Account uint32 `json:"account"` - Change bool `json:"change"` - AddressIndex uint32 `json:"addressIndex"` -} - -// NewParams creates a BIP 44 parameter object from the params: -// m / purpose' / coinType' / account' / change / addressIndex -func NewParams(purpose, coinType, account uint32, change bool, addressIdx uint32) *BIP44Params { - return &BIP44Params{ - Purpose: purpose, - CoinType: coinType, - Account: account, - Change: change, - AddressIndex: addressIdx, - } -} - -// Parse the BIP44 path and unmarshal into the struct. -func NewParamsFromPath(path string) (*BIP44Params, error) { - spl := strings.Split(path, "/") - if len(spl) != 5 { - return nil, fmt.Errorf("path length is wrong. Expected 5, got %d", len(spl)) - } - - // Check items can be parsed - purpose, err := hardenedInt(spl[0]) - if err != nil { - return nil, err - } - - coinType, err := hardenedInt(spl[1]) - if err != nil { - return nil, err - } - - account, err := hardenedInt(spl[2]) - if err != nil { - return nil, err - } - - change, err := hardenedInt(spl[3]) - if err != nil { - return nil, err - } - - addressIdx, err := hardenedInt(spl[4]) - if err != nil { - return nil, err - } - - // Confirm valid values - if spl[0] != "44'" { - return nil, fmt.Errorf("first field in path must be 44', got %v", spl[0]) - } - - if !isHardened(spl[1]) || !isHardened(spl[2]) { - return nil, - fmt.Errorf("second and third field in path must be hardened (ie. contain the suffix ', got %v and %v", spl[1], spl[2]) - } - - if isHardened(spl[3]) || isHardened(spl[4]) { - return nil, - fmt.Errorf("fourth and fifth field in path must not be hardened (ie. not contain the suffix ', got %v and %v", spl[3], spl[4]) - } - - if !(change == 0 || change == 1) { - return nil, fmt.Errorf("change field can only be 0 or 1") - } - - return &BIP44Params{ - Purpose: purpose, - CoinType: coinType, - Account: account, - Change: change > 0, - AddressIndex: addressIdx, - }, nil -} - -func hardenedInt(field string) (uint32, error) { - field = strings.TrimSuffix(field, "'") - - i, err := strconv.ParseUint(field, 10, 32) - if err != nil { - return 0, err - } - - return uint32(i), nil -} - -func isHardened(field string) bool { - return strings.HasSuffix(field, "'") -} - -// NewFundraiserParams creates a BIP 44 parameter object from the params: -// m / 44' / coinType' / account' / 0 / address_index -// The fixed parameters (purpose', coin_type', and change) are determined by what was used in the fundraiser. -func NewFundraiserParams(account, coinType, addressIdx uint32) *BIP44Params { - return NewParams(44, coinType, account, false, addressIdx) -} - -// DerivationPath returns the BIP44 fields as an array. -func (p BIP44Params) DerivationPath() []uint32 { - change := uint32(0) - if p.Change { - change = 1 - } - - return []uint32{ - p.Purpose, - p.CoinType, - p.Account, - change, - p.AddressIndex, - } -} - -func (p BIP44Params) String() string { - var changeStr string - if p.Change { - changeStr = "1" - } else { - changeStr = "0" - } - // m / Purpose' / coin_type' / Account' / Change / address_index - return fmt.Sprintf("%d'/%d'/%d'/%s/%d", - p.Purpose, - p.CoinType, - p.Account, - changeStr, - p.AddressIndex) -} - -// ComputeMastersFromSeed returns the master secret key's, and chain code. -func ComputeMastersFromSeed(seed []byte) (secret [32]byte, chainCode [32]byte) { - curveIdentifier := []byte("Bitcoin seed") - secret, chainCode = i64(curveIdentifier, seed) - - return -} - -// DerivePrivateKeyForPath derives the private key by following the BIP 32/44 path from privKeyBytes, -// using the given chainCode. -func DerivePrivateKeyForPath(privKeyBytes, chainCode [32]byte, path string) ([]byte, error) { - data := privKeyBytes - parts := strings.Split(path, "/") - - for _, part := range parts { - // do we have an apostrophe? - harden := part[len(part)-1:] == "'" - // harden == private derivation, else public derivation: - if harden { - part = part[:len(part)-1] - } - - idx, err := strconv.ParseUint(part, 10, 32) - if err != nil { - return []byte{}, fmt.Errorf("invalid BIP 32 path: %s", err) - } - - data, chainCode = derivePrivateKey(data, chainCode, uint32(idx), harden) - } - - derivedKey := make([]byte, 32) - n := copy(derivedKey, data[:]) - - if n != 32 || len(data) != 32 { - return []byte{}, fmt.Errorf("expected a (secp256k1) key of length 32, got length: %v", len(data)) - } - - return derivedKey, nil -} - -// derivePrivateKey derives the private key with index and chainCode. -// If harden is true, the derivation is 'hardened'. -// It returns the new private key and new chain code. -// For more information on hardened keys see: -// - https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki -func derivePrivateKey(privKeyBytes [32]byte, chainCode [32]byte, index uint32, harden bool) ([32]byte, [32]byte) { - var data []byte - - if harden { - index |= 0x80000000 - - data = append([]byte{byte(0)}, privKeyBytes[:]...) - } else { - // this can't return an error: - _, ecPub := btcec.PrivKeyFromBytes(btcec.S256(), privKeyBytes[:]) - pubkeyBytes := ecPub.SerializeCompressed() - data = pubkeyBytes - - /* By using btcec, we can remove the dependency on tendermint/crypto/secp256k1 - pubkey := secp256k1.PrivKeySecp256k1(privKeyBytes).PubKey() - public := pubkey.(secp256k1.PubKeySecp256k1) - data = public[:] - */ - } - - data = append(data, uint32ToBytes(index)...) - data2, chainCode2 := i64(chainCode[:], data) - x := addScalars(privKeyBytes[:], data2[:]) - - return x, chainCode2 -} - -// modular big endian addition -func addScalars(a []byte, b []byte) [32]byte { - aInt := new(big.Int).SetBytes(a) - bInt := new(big.Int).SetBytes(b) - sInt := new(big.Int).Add(aInt, bInt) - x := sInt.Mod(sInt, btcec.S256().N).Bytes() - x2 := [32]byte{} - copy(x2[32-len(x):], x) - - return x2 -} - -func uint32ToBytes(i uint32) []byte { - b := [4]byte{} - binary.BigEndian.PutUint32(b[:], i) - - return b[:] -} - -// i64 returns the two halfs of the SHA512 HMAC of key and data. -func i64(key []byte, data []byte) (il [32]byte, ir [32]byte) { - mac := hmac.New(sha512.New, key) - // sha512 does not err - _, _ = mac.Write(data) - - I := mac.Sum(nil) - copy(il[:], I[:32]) - copy(ir[:], I[32:]) - - return -} - -// CreateHDPath returns BIP 44 object from account and index parameters. -func CreateHDPath(coinType, account, index uint32) *BIP44Params { - return NewFundraiserParams(account, coinType, index) -} diff --git a/core-sdk/common/crypto/key_manager.go b/core-sdk/common/crypto/key_manager.go deleted file mode 100644 index 94508832..00000000 --- a/core-sdk/common/crypto/key_manager.go +++ /dev/null @@ -1,130 +0,0 @@ -package crypto - -import ( - "fmt" - "strings" - - "github.com/pkg/errors" - - "github.com/tendermint/tendermint/crypto" - - "github.com/cosmos/go-bip39" - - cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" - "github.com/irisnet/core-sdk-go/common/crypto/hd" -) - -const ( - defaultBIP39Passphrase = "" -) - -type KeyManager interface { - Generate() (string, crypto.PrivKey) - Sign(data []byte) ([]byte, error) - - ExportPrivKey(password string) (armor string, err error) - ImportPrivKey(armor, passphrase string) (crypto.PrivKey, string, error) - - ExportPubKey() crypto.PubKey -} - -type keyManager struct { - privKey crypto.PrivKey - mnemonic, algo string -} - -func NewKeyManager() KeyManager { - return &keyManager{} -} - -func NewAlgoKeyManager(algo string) (KeyManager, error) { - entropy, err := bip39.NewEntropy(256) - if err != nil { - return nil, err - } - mnemonic, err := bip39.NewMnemonic(entropy) - if err != nil { - return nil, err - } - return NewMnemonicKeyManager(mnemonic, algo) -} - -func NewMnemonicKeyManager(mnemonic string, algo string) (KeyManager, error) { - k := keyManager{ - mnemonic: mnemonic, - algo: algo, - } - err := k.recoveryFromMnemonic(mnemonic, hd.FullPath, algo) - return &k, err -} - -func NewMnemonicKeyManagerWithHDPath(mnemonic, algo, hdPath string) (KeyManager, error) { - k := keyManager{ - mnemonic: mnemonic, - algo: algo, - } - err := k.recoveryFromMnemonic(mnemonic, hdPath, algo) - return &k, err -} - -func NewPrivateKeyManager(priv []byte, algo string) (KeyManager, error) { - privKey, err := cryptoAmino.PrivKeyFromBytes(priv) - if err != nil { - return nil, errors.Wrap(err, "failed to decrypt private key") - } - k := keyManager{ - privKey: privKey, - algo: algo, - } - return &k, err -} - -func (m *keyManager) Generate() (string, crypto.PrivKey) { - return m.mnemonic, m.privKey -} - -func (m *keyManager) Sign(data []byte) ([]byte, error) { - return m.privKey.Sign(data) -} - -func (m *keyManager) recoveryFromMnemonic(mnemonic, hdPath, algoStr string) error { - words := strings.Split(mnemonic, " ") - if len(words) != 12 && len(words) != 24 { - return fmt.Errorf("mnemonic length should either be 12 or 24") - } - - algo, err := hd.NewSigningAlgoFromString(algoStr) - if err != nil { - return err - } - - // create master key and derive first key for keyring - derivedPriv, err := algo.Derive()(mnemonic, defaultBIP39Passphrase, hdPath) - if err != nil { - return err - } - - privKey := algo.Generate()(derivedPriv) - m.privKey = privKey - m.algo = algoStr - return nil -} - -func (m *keyManager) ExportPrivKey(password string) (armor string, err error) { - return EncryptArmorPrivKey(m.privKey, password, m.algo), nil -} - -func (m *keyManager) ImportPrivKey(armor, passphrase string) (crypto.PrivKey, string, error) { - privKey, algo, err := UnarmorDecryptPrivKey(armor, passphrase) - if err != nil { - return nil, "", errors.Wrap(err, "failed to decrypt private key") - } - - m.privKey = privKey - m.algo = algo - return privKey, algo, nil -} - -func (m *keyManager) ExportPubKey() crypto.PubKey { - return m.privKey.PubKey() -} diff --git a/core-sdk/common/crypto/key_manager_test.go b/core-sdk/common/crypto/key_manager_test.go deleted file mode 100644 index 86a64e4b..00000000 --- a/core-sdk/common/crypto/key_manager_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package crypto_test - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/irisnet/core-sdk-go/common/crypto" - sdk "github.com/irisnet/core-sdk-go/types" -) - -func TestNewMnemonicKeyManager(t *testing.T) { - mnemonic := "nerve leader thank marriage spice task van start piece crowd run hospital control outside cousin romance left choice poet wagon rude climb leisure spring" - - km, err := crypto.NewMnemonicKeyManager(mnemonic, "secp256k1") - assert.NoError(t, err) - - pubKey := km.ExportPubKey() - pubkeyBech32, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pubKey) - assert.NoError(t, err) - assert.Equal(t, "iap1qf6rwt2vpsdx9tcwq03w4dw9udd657u0gmknjd4l0ht699x6npll6hf0ru9", pubkeyBech32) - - address := sdk.AccAddress(pubKey.Address()).String() - assert.Equal(t, "iaa1y9kd9uy7a4qnjp0z5yjx5jhrkv2ycdkzqc0h8z", address) -} diff --git a/core-sdk/common/crypto/keys/ed25519/ed25519.go b/core-sdk/common/crypto/keys/ed25519/ed25519.go deleted file mode 100644 index 4611fafa..00000000 --- a/core-sdk/common/crypto/keys/ed25519/ed25519.go +++ /dev/null @@ -1,234 +0,0 @@ -package ed25519 - -import ( - "crypto/subtle" - "fmt" - "io" - - "github.com/irisnet/core-sdk-go/common/codec" - - "github.com/tendermint/tendermint/crypto" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/tmhash" - "golang.org/x/crypto/ed25519" - - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" -) - -//------------------------------------- - -const ( - PrivKeyName = "cosmos/PrivKeyEd25519" - PubKeyName = "cosmos/PubKeyEd25519" - // PubKeySize is is the size, in bytes, of public keys as used in this package. - PubKeySize = 32 - // PrivKeySize is the size, in bytes, of private keys as used in this package. - PrivKeySize = 64 - // Size of an Edwards25519 signature. Namely the size of a compressed - // Edwards25519 point, and a field element. Both of which are 32 bytes. - SignatureSize = 64 - // SeedSize is the size, in bytes, of private key seeds. These are the - // private key representations used by RFC 8032. - SeedSize = 32 - - keyType = "ed25519" -) - -var _ cryptotypes.PrivKey = &PrivKey{} -var _ codec.AminoMarshaler = &PrivKey{} - -// Bytes returns the privkey byte format. -func (privKey *PrivKey) Bytes() []byte { - return privKey.Key -} - -// Sign produces a signature on the provided message. -// This assumes the privkey is wellformed in the golang format. -// The first 32 bytes should be random, -// corresponding to the normal ed25519 private key. -// The latter 32 bytes should be the compressed public key. -// If these conditions aren't met, Sign will panic or produce an -// incorrect signature. -func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) { - return ed25519.Sign(ed25519.PrivateKey(privKey.Key), msg), nil -} - -// PubKey gets the corresponding public key from the private key. -// -// Panics if the private key is not initialized. -func (privKey *PrivKey) PubKey() crypto.PubKey { - // If the latter 32 bytes of the privkey are all zero, privkey is not - // initialized. - initialized := false - for _, v := range privKey.Key[32:] { - if v != 0 { - initialized = true - break - } - } - - if !initialized { - panic("Expected ed25519 PrivKey to include concatenated pubkey bytes") - } - - pubkeyBytes := make([]byte, PubKeySize) - copy(pubkeyBytes, privKey.Key[32:]) - return &PubKey{Key: pubkeyBytes} -} - -// Equals - you probably don't need to use this. -// Runs in constant time based on length of the keys. -func (privKey *PrivKey) Equals(other crypto.PrivKey) bool { - if privKey.Type() != other.Type() { - return false - } - - return subtle.ConstantTimeCompare(privKey.Bytes(), other.Bytes()) == 1 -} - -func (privKey *PrivKey) Type() string { - return keyType -} - -// MarshalAmino overrides Amino binary marshalling. -func (privKey PrivKey) MarshalAmino() ([]byte, error) { - return privKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PrivKeySize { - return fmt.Errorf("invalid privkey size") - } - privKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return privKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { - return privKey.UnmarshalAmino(bz) -} - -// GenPrivKey generates a new ed25519 private key. -// It uses OS randomness in conjunction with the current global random seed -// in tendermint/libs/common to generate the private key. -func GenPrivKey() *PrivKey { - return genPrivKey(crypto.CReader()) -} - -// genPrivKey generates a new ed25519 private key using the provided reader. -func genPrivKey(rand io.Reader) *PrivKey { - seed := make([]byte, SeedSize) - - _, err := io.ReadFull(rand, seed) - if err != nil { - panic(err) - } - - return &PrivKey{Key: ed25519.NewKeyFromSeed(seed)} -} - -// GenPrivKeyFromSecret hashes the secret with SHA2, and uses -// that 32 byte output to create the private key. -// NOTE: secret should be the output of a KDF like bcrypt, -// if it's derived from user input. -func GenPrivKeyFromSecret(secret []byte) *PrivKey { - seed := crypto.Sha256(secret) // Not Ripemd160 because we want 32 bytes. - - return &PrivKey{Key: ed25519.NewKeyFromSeed(seed)} -} - -//------------------------------------- - -var _ cryptotypes.PubKey = &PubKey{} -var _ codec.AminoMarshaler = &PubKey{} -var _ cryptotypes.IntoTmPubKey = &PubKey{} - -// Address is the SHA256-20 of the raw pubkey bytes. -func (pubKey *PubKey) Address() crypto.Address { - if len(pubKey.Key) != PubKeySize { - panic("pubkey is incorrect size") - } - return crypto.Address(tmhash.SumTruncated(pubKey.Key)) -} - -// Bytes returns the PubKey byte format. -func (pubKey *PubKey) Bytes() []byte { - return pubKey.Key -} - -func (pubKey *PubKey) VerifySignature(msg []byte, sig []byte) bool { - // make sure we use the same algorithm to sign - if len(sig) != SignatureSize { - return false - } - - return ed25519.Verify(ed25519.PublicKey(pubKey.Key), msg, sig) -} - -func (pubKey *PubKey) String() string { - return fmt.Sprintf("PubKeyEd25519{%X}", pubKey.Key) -} - -func (pubKey *PubKey) Type() string { - return keyType -} - -func (pubKey *PubKey) Equals(other crypto.PubKey) bool { - if pubKey.Type() != other.Type() { - return false - } - - return subtle.ConstantTimeCompare(pubKey.Bytes(), other.Bytes()) == 1 -} - -// MarshalAmino overrides Amino binary marshalling. -func (pubKey PubKey) MarshalAmino() ([]byte, error) { - return pubKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PubKeySize { - return fmt.Errorf("invalid pubkey size") - } - pubKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return pubKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { - return pubKey.UnmarshalAmino(bz) -} - -// AsTmPubKey converts our own PubKey into a Tendermint ED25519 pubkey. -func (pubKey *PubKey) AsTmPubKey() crypto.PubKey { - return tmed25519.PubKey(pubKey.Key) -} - -// FromTmEd25519 converts a Tendermint ED25519 pubkey into our own ED25519 -// PubKey. -func FromTmEd25519(pubKey crypto.PubKey) (*PubKey, error) { - tmPk, ok := pubKey.(tmed25519.PubKey) - if !ok { - return nil, fmt.Errorf("expected %T, got %T", tmed25519.PubKey{}, pubKey) - } - - return &PubKey{Key: []byte(tmPk)}, nil -} diff --git a/core-sdk/common/crypto/keys/ed25519/ed25519_test.go b/core-sdk/common/crypto/keys/ed25519/ed25519_test.go deleted file mode 100644 index 6e51e1d0..00000000 --- a/core-sdk/common/crypto/keys/ed25519/ed25519_test.go +++ /dev/null @@ -1,218 +0,0 @@ -package ed25519_test - -import ( - "encoding/base64" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/sr25519" - - "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/crypto/keys/ed25519" - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" -) - -func TestSignAndValidateEd25519(t *testing.T) { - privKey := ed25519.GenPrivKey() - pubKey := privKey.PubKey() - - msg := crypto.CRandBytes(128) - sig, err := privKey.Sign(msg) - require.Nil(t, err) - - // Test the signature - assert.True(t, pubKey.VerifySignature(msg, sig)) - - // Mutate the signature, just one bit. - // TODO: Replace this with a much better fuzzer, tendermint/ed25519/issues/10 - sig[7] ^= byte(0x01) - - assert.False(t, pubKey.VerifySignature(msg, sig)) -} - -func TestPubKeyEquals(t *testing.T) { - ed25519PubKey := ed25519.GenPrivKey().PubKey().(*ed25519.PubKey) - - testCases := []struct { - msg string - pubKey cryptotypes.PubKey - other crypto.PubKey - expectEq bool - }{ - { - "different bytes", - ed25519PubKey, - ed25519.GenPrivKey().PubKey(), - false, - }, - { - "equals", - ed25519PubKey, - &ed25519.PubKey{ - Key: ed25519PubKey.Key, - }, - true, - }, - { - "different types", - ed25519PubKey, - sr25519.GenPrivKey().PubKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.pubKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestPrivKeyEquals(t *testing.T) { - ed25519PrivKey := ed25519.GenPrivKey() - - testCases := []struct { - msg string - privKey cryptotypes.PrivKey - other crypto.PrivKey - expectEq bool - }{ - { - "different bytes", - ed25519PrivKey, - ed25519.GenPrivKey(), - false, - }, - { - "equals", - ed25519PrivKey, - &ed25519.PrivKey{ - Key: ed25519PrivKey.Key, - }, - true, - }, - { - "different types", - ed25519PrivKey, - sr25519.GenPrivKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.privKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestMarshalAmino(t *testing.T) { - aminoCdc := codec.NewLegacyAmino() - privKey := ed25519.GenPrivKey() - pubKey := privKey.PubKey().(*ed25519.PubKey) - - testCases := []struct { - desc string - msg codec.AminoMarshaler - typ interface{} - expBinary []byte - expJSON string - }{ - { - "ed25519 private key", - privKey, - &ed25519.PrivKey{}, - append([]byte{64}, privKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(privKey.Bytes()) + "\"", - }, - { - "ed25519 public key", - pubKey, - &ed25519.PubKey{}, - append([]byte{32}, pubKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(pubKey.Bytes()) + "\"", - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - // Do a round trip of encoding/decoding binary. - bz, err := aminoCdc.MarshalBinaryBare(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expBinary, bz) - - err = aminoCdc.UnmarshalBinaryBare(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - - // Do a round trip of encoding/decoding JSON. - bz, err = aminoCdc.MarshalJSON(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expJSON, string(bz)) - - err = aminoCdc.UnmarshalJSON(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - }) - } -} - -func TestMarshalAmino_BackwardsCompatibility(t *testing.T) { - aminoCdc := codec.NewLegacyAmino() - // Create Tendermint keys. - tmPrivKey := tmed25519.GenPrivKey() - tmPubKey := tmPrivKey.PubKey() - // Create our own keys, with the same private key as Tendermint's. - privKey := &ed25519.PrivKey{Key: []byte(tmPrivKey)} - pubKey := privKey.PubKey().(*ed25519.PubKey) - - testCases := []struct { - desc string - tmKey interface{} - ourKey interface{} - marshalFn func(o interface{}) ([]byte, error) - }{ - { - "ed25519 private key, binary", - tmPrivKey, - privKey, - aminoCdc.MarshalBinaryBare, - }, - { - "ed25519 private key, JSON", - tmPrivKey, - privKey, - aminoCdc.MarshalJSON, - }, - { - "ed25519 public key, binary", - tmPubKey, - pubKey, - aminoCdc.MarshalBinaryBare, - }, - { - "ed25519 public key, JSON", - tmPubKey, - pubKey, - aminoCdc.MarshalJSON, - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - // Make sure Amino encoding override is not breaking backwards compatibility. - bz1, err := tc.marshalFn(tc.tmKey) - require.NoError(t, err) - bz2, err := tc.marshalFn(tc.ourKey) - require.NoError(t, err) - require.Equal(t, bz1, bz2) - }) - } -} diff --git a/core-sdk/common/crypto/keys/ed25519/keys.pb.go b/core-sdk/common/crypto/keys/ed25519/keys.pb.go deleted file mode 100644 index f5ed5203..00000000 --- a/core-sdk/common/crypto/keys/ed25519/keys.pb.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/ed25519/keys.proto - -package ed25519 - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// PubKey defines a ed25519 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -type PubKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_48fe3336771e732d, []int{0} -} -func (m *PubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey.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 *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(m, src) -} -func (m *PubKey) XXX_Size() int { - return m.Size() -} -func (m *PubKey) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey proto.InternalMessageInfo - -func (m *PubKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -// PrivKey defines a ed25519 private key. -type PrivKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PrivKey) Reset() { *m = PrivKey{} } -func (m *PrivKey) String() string { return proto.CompactTextString(m) } -func (*PrivKey) ProtoMessage() {} -func (*PrivKey) Descriptor() ([]byte, []int) { - return fileDescriptor_48fe3336771e732d, []int{1} -} -func (m *PrivKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PrivKey.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 *PrivKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrivKey.Merge(m, src) -} -func (m *PrivKey) XXX_Size() int { - return m.Size() -} -func (m *PrivKey) XXX_DiscardUnknown() { - xxx_messageInfo_PrivKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PrivKey proto.InternalMessageInfo - -func (m *PrivKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func init() { - proto.RegisterType((*PubKey)(nil), "cosmos.crypto.ed25519.PubKey") - proto.RegisterType((*PrivKey)(nil), "cosmos.crypto.ed25519.PrivKey") -} - -func init() { proto.RegisterFile("cosmos/crypto/ed25519/keys.proto", fileDescriptor_48fe3336771e732d) } - -var fileDescriptor_48fe3336771e732d = []byte{ - // 194 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x4f, 0x4d, 0x31, 0x32, 0x35, 0x35, - 0xb4, 0xd4, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0xa8, - 0xd0, 0x83, 0xa8, 0xd0, 0x83, 0xaa, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd0, 0x07, - 0xb1, 0x20, 0x8a, 0x95, 0x14, 0xb8, 0xd8, 0x02, 0x4a, 0x93, 0xbc, 0x53, 0x2b, 0x85, 0x04, 0xb8, - 0x98, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x40, 0x4c, 0x2b, 0x96, 0x19, - 0x0b, 0xe4, 0x19, 0x94, 0xa4, 0xb9, 0xd8, 0x03, 0x8a, 0x32, 0xcb, 0xb0, 0x2a, 0x71, 0xf2, 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, 0xd3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, - 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xcc, 0xa2, 0xcc, 0xe2, 0xbc, 0xd4, 0x12, 0x30, 0x9d, 0x51, - 0x9a, 0xa4, 0x5b, 0x9c, 0x92, 0xad, 0x9b, 0x9e, 0x0f, 0xf3, 0x02, 0xc8, 0xe9, 0x30, 0x7f, 0x24, - 0xb1, 0x81, 0x9d, 0x65, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xf7, 0x97, 0xb6, 0xe7, 0x00, - 0x00, 0x00, -} - -func (m *PubKey) 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 *PubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PrivKey) 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 *PrivKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { - offset -= sovKeys(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func (m *PrivKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func sovKeys(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKeys(x uint64) (n int) { - return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PubKey) 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 ErrIntOverflowKeys - } - 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: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrivKey) 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 ErrIntOverflowKeys - } - 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: PrivKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrivKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKeys(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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrInvalidLengthKeys - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKeys - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKeys - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/common/crypto/keys/internal/benchmarking/bench.go b/core-sdk/common/crypto/keys/internal/benchmarking/bench.go deleted file mode 100644 index b74b901d..00000000 --- a/core-sdk/common/crypto/keys/internal/benchmarking/bench.go +++ /dev/null @@ -1,92 +0,0 @@ -package benchmarking - -import ( - "io" - "testing" - - "github.com/tendermint/tendermint/crypto" -) - -// The code in this file is adapted from agl/ed25519. -// As such it is under the following license. -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found at the bottom of this file. - -type zeroReader struct{} - -func (zeroReader) Read(buf []byte) (int, error) { - for i := range buf { - buf[i] = 0 - } - return len(buf), nil -} - -// BenchmarkKeyGeneration benchmarks the given key generation algorithm using -// a dummy reader. -func BenchmarkKeyGeneration(b *testing.B, generateKey func(reader io.Reader) crypto.PrivKey) { - var zero zeroReader - for i := 0; i < b.N; i++ { - generateKey(zero) - } -} - -// BenchmarkSigning benchmarks the given signing algorithm using -// the provided privkey. -func BenchmarkSigning(b *testing.B, priv crypto.PrivKey) { - message := []byte("Hello, world!") - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := priv.Sign(message) - - if err != nil { - b.FailNow() - } - } -} - -// BenchmarkVerification benchmarks the given verification algorithm using -// the provided privkey on a constant message. -func BenchmarkVerification(b *testing.B, priv crypto.PrivKey) { - pub := priv.PubKey() - // use a short message, so this time doesn't get dominated by hashing. - message := []byte("Hello, world!") - signature, err := priv.Sign(message) - if err != nil { - b.Fatal(err) - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - pub.VerifySignature(message, signature) - } -} - -// Below is the aforementioned license. - -// Copyright (c) 2012 The Go Authors. All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: - -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/core-sdk/common/crypto/keys/multisig/codec.go b/core-sdk/common/crypto/keys/multisig/codec.go deleted file mode 100644 index da9944f4..00000000 --- a/core-sdk/common/crypto/keys/multisig/codec.go +++ /dev/null @@ -1,35 +0,0 @@ -package multisig - -import ( - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/sr25519" - - "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/crypto/keys/ed25519" - "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" -) - -// TODO: Figure out API for others to either add their own pubkey types, or -// to make verify / marshal accept a AminoCdc. -const ( - PubKeyAminoRoute = "tendermint/PubKeyMultisigThreshold" -) - -var AminoCdc = codec.NewLegacyAmino() - -func init() { - // TODO We now register both Tendermint's PubKey and our own PubKey. In the - // long-term, we should move away from Tendermint's PubKey, and delete this - // first line. - AminoCdc.RegisterInterface((*crypto.PubKey)(nil), nil) - AminoCdc.RegisterInterface((*cryptotypes.PubKey)(nil), nil) - AminoCdc.RegisterConcrete(ed25519.PubKey{}, - ed25519.PubKeyName, nil) - AminoCdc.RegisterConcrete(sr25519.PubKey{}, - sr25519.PubKeyName, nil) - AminoCdc.RegisterConcrete(&secp256k1.PubKey{}, - secp256k1.PubKeyName, nil) - AminoCdc.RegisterConcrete(&LegacyAminoPubKey{}, - PubKeyAminoRoute, nil) -} diff --git a/core-sdk/common/crypto/keys/multisig/keys.pb.go b/core-sdk/common/crypto/keys/multisig/keys.pb.go deleted file mode 100644 index d3389b34..00000000 --- a/core-sdk/common/crypto/keys/multisig/keys.pb.go +++ /dev/null @@ -1,360 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/multisig/keys.proto - -package multisig - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/core-sdk-go/common/codec/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// LegacyAminoPubKey specifies a public key type -// which nests multiple public keys and a threshold, -// it uses legacy amino address rules. -type LegacyAminoPubKey struct { - Threshold uint32 `protobuf:"varint,1,opt,name=threshold,proto3" json:"threshold,omitempty" yaml:"threshold"` - PubKeys []*types.Any `protobuf:"bytes,2,rep,name=public_keys,json=publicKeys,proto3" json:"public_keys,omitempty" yaml:"pubkeys"` -} - -func (m *LegacyAminoPubKey) Reset() { *m = LegacyAminoPubKey{} } -func (m *LegacyAminoPubKey) String() string { return proto.CompactTextString(m) } -func (*LegacyAminoPubKey) ProtoMessage() {} -func (*LegacyAminoPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_46b57537e097d47d, []int{0} -} -func (m *LegacyAminoPubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LegacyAminoPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LegacyAminoPubKey.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 *LegacyAminoPubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_LegacyAminoPubKey.Merge(m, src) -} -func (m *LegacyAminoPubKey) XXX_Size() int { - return m.Size() -} -func (m *LegacyAminoPubKey) XXX_DiscardUnknown() { - xxx_messageInfo_LegacyAminoPubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_LegacyAminoPubKey proto.InternalMessageInfo - -func init() { - proto.RegisterType((*LegacyAminoPubKey)(nil), "cosmos.crypto.multisig.LegacyAminoPubKey") -} - -func init() { proto.RegisterFile("cosmos/crypto/multisig/keys.proto", fileDescriptor_46b57537e097d47d) } - -var fileDescriptor_46b57537e097d47d = []byte{ - // 297 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0xcf, 0x2d, 0xcd, 0x29, 0xc9, 0x2c, - 0xce, 0x4c, 0xd7, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, - 0x28, 0xd1, 0x83, 0x28, 0xd1, 0x83, 0x29, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, 0xd1, - 0x07, 0xb1, 0x20, 0xaa, 0xa5, 0x24, 0xd3, 0xf3, 0xf3, 0xd3, 0x73, 0x52, 0xf5, 0xc1, 0xbc, 0xa4, - 0xd2, 0x34, 0xfd, 0xc4, 0xbc, 0x4a, 0x88, 0x94, 0xd2, 0x62, 0x46, 0x2e, 0x41, 0x9f, 0xd4, 0xf4, - 0xc4, 0xe4, 0x4a, 0xc7, 0xdc, 0xcc, 0xbc, 0xfc, 0x80, 0xd2, 0x24, 0xef, 0xd4, 0x4a, 0x21, 0x23, - 0x2e, 0xce, 0x92, 0x8c, 0xa2, 0xd4, 0xe2, 0x8c, 0xfc, 0x9c, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, - 0x5e, 0x27, 0x91, 0x4f, 0xf7, 0xe4, 0x05, 0x2a, 0x13, 0x73, 0x73, 0xac, 0x94, 0xe0, 0x52, 0x4a, - 0x41, 0x08, 0x65, 0x42, 0x21, 0x5c, 0xdc, 0x05, 0xa5, 0x49, 0x39, 0x99, 0xc9, 0xf1, 0x20, 0x77, - 0x4a, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x1b, 0x89, 0xe8, 0x41, 0xac, 0xd6, 0x83, 0x59, 0xad, 0xe7, - 0x98, 0x57, 0xe9, 0x24, 0xfb, 0xe8, 0x9e, 0x3c, 0x3b, 0xc4, 0xaa, 0xe2, 0x4f, 0xf7, 0xe4, 0xf9, - 0x20, 0xc6, 0x16, 0x94, 0x26, 0x81, 0x74, 0x2a, 0x05, 0x71, 0x41, 0xcc, 0x01, 0xc9, 0x5a, 0xb1, - 0x74, 0x2c, 0x90, 0x67, 0x70, 0x0a, 0x38, 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, 0xb3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xcc, 0xa2, 0xcc, - 0xe2, 0xbc, 0xd4, 0x12, 0x30, 0x9d, 0x51, 0x9a, 0xa4, 0x5b, 0x9c, 0x92, 0xad, 0x9b, 0x9e, 0x0f, - 0x0b, 0x46, 0x90, 0xd9, 0xf0, 0xb0, 0x4c, 0x62, 0x03, 0x3b, 0xc8, 0x18, 0x10, 0x00, 0x00, 0xff, - 0xff, 0xfb, 0x05, 0xd9, 0x7a, 0x6c, 0x01, 0x00, 0x00, -} - -func (m *LegacyAminoPubKey) 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 *LegacyAminoPubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LegacyAminoPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PubKeys) > 0 { - for iNdEx := len(m.PubKeys) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PubKeys[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintKeys(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Threshold != 0 { - i = encodeVarintKeys(dAtA, i, uint64(m.Threshold)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { - offset -= sovKeys(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *LegacyAminoPubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Threshold != 0 { - n += 1 + sovKeys(uint64(m.Threshold)) - } - if len(m.PubKeys) > 0 { - for _, e := range m.PubKeys { - l = e.Size() - n += 1 + l + sovKeys(uint64(l)) - } - } - return n -} - -func sovKeys(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKeys(x uint64) (n int) { - return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *LegacyAminoPubKey) 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 ErrIntOverflowKeys - } - 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: LegacyAminoPubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LegacyAminoPubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - 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 ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Threshold |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKeys", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubKeys = append(m.PubKeys, &types.Any{}) - if err := m.PubKeys[len(m.PubKeys)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKeys(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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrInvalidLengthKeys - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKeys - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKeys - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/common/crypto/keys/multisig/multisig.go b/core-sdk/common/crypto/keys/multisig/multisig.go deleted file mode 100644 index e2d3f9d1..00000000 --- a/core-sdk/common/crypto/keys/multisig/multisig.go +++ /dev/null @@ -1,168 +0,0 @@ -package multisig - -import ( - fmt "fmt" - - tmcrypto "github.com/tendermint/tendermint/crypto" - - proto "github.com/gogo/protobuf/proto" - - "github.com/irisnet/core-sdk-go/common/codec/types" - crypto "github.com/irisnet/core-sdk-go/common/crypto/types" - multisigtypes "github.com/irisnet/core-sdk-go/common/crypto/types/multisig" - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -var _ multisigtypes.PubKey = &LegacyAminoPubKey{} -var _ types.UnpackInterfacesMessage = &LegacyAminoPubKey{} - -// NewLegacyAminoPubKey returns a new LegacyAminoPubKey. -// Panics if len(pubKeys) < k or 0 >= k. -func NewLegacyAminoPubKey(k int, pubKeys []tmcrypto.PubKey) *LegacyAminoPubKey { - if k <= 0 { - panic("threshold k of n multisignature: k <= 0") - } - if len(pubKeys) < k { - panic("threshold k of n multisignature: len(pubKeys) < k") - } - anyPubKeys, err := packPubKeys(pubKeys) - if err != nil { - panic(err) - } - return &LegacyAminoPubKey{Threshold: uint32(k), PubKeys: anyPubKeys} -} - -// Address implements crypto.PubKey Address method -func (m *LegacyAminoPubKey) Address() tmcrypto.Address { - return tmcrypto.AddressHash(m.Bytes()) -} - -// Bytes returns the proto encoded version of the LegacyAminoPubKey -func (m *LegacyAminoPubKey) Bytes() []byte { - return AminoCdc.MustMarshalBinaryBare(m) -} - -// VerifyMultisignature implements the multisigtypes.PubKey VerifyMultisignature method -func (m *LegacyAminoPubKey) VerifyMultisignature(getSignBytes multisigtypes.GetSignBytesFunc, sig *signing.MultiSignatureData) error { - bitarray := sig.BitArray - sigs := sig.Signatures - size := bitarray.Count() - pubKeys := m.GetPubKeys() - // ensure bit array is the correct size - if len(pubKeys) != size { - return fmt.Errorf("bit array size is incorrect %d", len(pubKeys)) - } - // ensure size of signature list - if len(sigs) < int(m.Threshold) || len(sigs) > size { - return fmt.Errorf("signature size is incorrect %d", len(sigs)) - } - // ensure at least k signatures are set - if bitarray.NumTrueBitsBefore(size) < int(m.Threshold) { - return fmt.Errorf("minimum number of signatures not set, have %d, expected %d", bitarray.NumTrueBitsBefore(size), int(m.Threshold)) - } - // index in the list of signatures which we are concerned with. - sigIndex := 0 - for i := 0; i < size; i++ { - if bitarray.GetIndex(i) { - si := sig.Signatures[sigIndex] - switch si := si.(type) { - case *signing.SingleSignatureData: - msg, err := getSignBytes(si.SignMode) - if err != nil { - return err - } - if !pubKeys[i].VerifySignature(msg, si.Signature) { - return fmt.Errorf("unable to verify signature at index %d", i) - } - case *signing.MultiSignatureData: - nestedMultisigPk, ok := pubKeys[i].(multisigtypes.PubKey) - if !ok { - return fmt.Errorf("unable to parse pubkey of index %d", i) - } - if err := nestedMultisigPk.VerifyMultisignature(getSignBytes, si); err != nil { - return err - } - default: - return fmt.Errorf("improper signature data type for index %d", sigIndex) - } - sigIndex++ - } - } - return nil -} - -// VerifySignature implements crypto.PubKey VerifySignature method, -// it panics because it can't handle MultiSignatureData -// cf. https://github.com/cosmos/cosmos-sdk/issues/7109#issuecomment-686329936 -func (m *LegacyAminoPubKey) VerifySignature(msg []byte, sig []byte) bool { - panic("not implemented") -} - -// GetPubKeys implements the PubKey.GetPubKeys method -func (m *LegacyAminoPubKey) GetPubKeys() []tmcrypto.PubKey { - if m != nil { - pubKeys := make([]tmcrypto.PubKey, len(m.PubKeys)) - for i := 0; i < len(m.PubKeys); i++ { - pubKeys[i] = m.PubKeys[i].GetCachedValue().(tmcrypto.PubKey) - } - return pubKeys - } - - return nil -} - -// Equals returns true if m and other both have the same number of keys, and -// all constituent keys are the same, and in the same order. -func (m *LegacyAminoPubKey) Equals(key tmcrypto.PubKey) bool { - otherKey, ok := key.(multisigtypes.PubKey) - if !ok { - return false - } - pubKeys := m.GetPubKeys() - otherPubKeys := otherKey.GetPubKeys() - if m.GetThreshold() != otherKey.GetThreshold() || len(pubKeys) != len(otherPubKeys) { - return false - } - - for i := 0; i < len(pubKeys); i++ { - if !pubKeys[i].Equals(otherPubKeys[i]) { - return false - } - } - return true -} - -// GetThreshold implements the PubKey.GetThreshold method -func (m *LegacyAminoPubKey) GetThreshold() uint { - return uint(m.Threshold) -} - -// Type returns multisig type -func (m *LegacyAminoPubKey) Type() string { - return "PubKeyMultisigThreshold" -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (m *LegacyAminoPubKey) UnpackInterfaces(unpacker types.AnyUnpacker) error { - for _, any := range m.PubKeys { - var pk crypto.PubKey - err := unpacker.UnpackAny(any, &pk) - if err != nil { - return err - } - } - return nil -} - -func packPubKeys(pubKeys []tmcrypto.PubKey) ([]*types.Any, error) { - anyPubKeys := make([]*types.Any, len(pubKeys)) - - for i := 0; i < len(pubKeys); i++ { - any, err := types.NewAnyWithValue(pubKeys[i].(proto.Message)) - if err != nil { - return nil, err - } - anyPubKeys[i] = any - } - return anyPubKeys, nil -} diff --git a/core-sdk/common/crypto/keys/secp256k1/bench_test.go b/core-sdk/common/crypto/keys/secp256k1/bench_test.go deleted file mode 100644 index d3d030ee..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/bench_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package secp256k1 - -import ( - "io" - "testing" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/common/crypto/keys/internal/benchmarking" -) - -func BenchmarkKeyGeneration(b *testing.B) { - benchmarkKeygenWrapper := func(reader io.Reader) crypto.PrivKey { - priv := genPrivKey(reader) - return &PrivKey{Key: priv} - } - benchmarking.BenchmarkKeyGeneration(b, benchmarkKeygenWrapper) -} - -func BenchmarkSigning(b *testing.B) { - priv := GenPrivKey() - benchmarking.BenchmarkSigning(b, priv) -} - -func BenchmarkVerification(b *testing.B) { - priv := GenPrivKey() - benchmarking.BenchmarkVerification(b, priv) -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/.gitignore b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/.gitignore deleted file mode 100644 index 802b6744..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe - -*~ diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/LICENSE b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/LICENSE deleted file mode 100644 index f9090e14..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -Copyright (c) 2010 The Go Authors. All rights reserved. -Copyright (c) 2011 ThePiachu. All rights reserved. -Copyright (c) 2015 Jeffrey Wilcke. All rights reserved. -Copyright (c) 2015 Felix Lange. All rights reserved. -Copyright (c) 2015 Gustav Simonsson. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of the copyright holder. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/README.md b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/README.md deleted file mode 100644 index d899ca27..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This package is copied from https://github.com/ethereum/go-ethereum/tree/729bf365b5f17325be9107b63b233da54100eec6/crypto/secp256k1 - -Unlike the rest of go-ethereum it is MIT licensed so compatible with our Apache2.0 license. We opt to copy in here rather than depend on go-ethereum to avoid issues with vendoring of the GPL parts of that repository by downstream. diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/curve.go b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/curve.go deleted file mode 100644 index 7a238736..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/curve.go +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Copyright 2011 ThePiachu. All rights reserved. -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// * The name of ThePiachu may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// nolint:gocritic -package secp256k1 - -import ( - "crypto/elliptic" - "math/big" - "unsafe" -) - -/* -#include "libsecp256k1/include/secp256k1.h" -extern int secp256k1_ext_scalar_mul(const secp256k1_context* ctx, - const unsigned char *point, - const unsigned char *scalar); -*/ -import "C" - -const ( - // number of bits in a big.Word - wordBits = 32 << (uint64(^big.Word(0)) >> 63) - // number of bytes in a big.Word - wordBytes = wordBits / 8 -) - -// readBits encodes the absolute value of bigint as big-endian bytes. Callers -// must ensure that buf has enough space. If buf is too short the result will -// be incomplete. -func readBits(bigint *big.Int, buf []byte) { - i := len(buf) - for _, d := range bigint.Bits() { - for j := 0; j < wordBytes && i > 0; j++ { - i-- - buf[i] = byte(d) - d >>= 8 - } - } -} - -// This code is from https://github.com/ThePiachu/GoBit and implements -// several Koblitz elliptic curves over prime fields. -// -// The curve methods, internally, on Jacobian coordinates. For a given -// (x, y) position on the curve, the Jacobian coordinates are (x1, y1, -// z1) where x = x1/z1² and y = y1/z1³. The greatest speedups come -// when the whole calculation can be performed within the transform -// (as in ScalarMult and ScalarBaseMult). But even for Add and Double, -// it's faster to apply and reverse the transform than to operate in -// affine coordinates. - -// A BitCurve represents a Koblitz Curve with a=0. -// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html -type BitCurve struct { - P *big.Int // the order of the underlying field - N *big.Int // the order of the base point - B *big.Int // the constant of the BitCurve equation - Gx, Gy *big.Int // (x,y) of the base point - BitSize int // the size of the underlying field -} - -func (BitCurve *BitCurve) Params() *elliptic.CurveParams { - return &elliptic.CurveParams{ - P: BitCurve.P, - N: BitCurve.N, - B: BitCurve.B, - Gx: BitCurve.Gx, - Gy: BitCurve.Gy, - BitSize: BitCurve.BitSize, - } -} - -// IsOnCurve returns true if the given (x,y) lies on the BitCurve. -func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool { - // y² = x³ + b - y2 := new(big.Int).Mul(y, y) //y² - y2.Mod(y2, BitCurve.P) //y²%P - - x3 := new(big.Int).Mul(x, x) //x² - x3.Mul(x3, x) //x³ - - x3.Add(x3, BitCurve.B) //x³+B - x3.Mod(x3, BitCurve.P) //(x³+B)%P - - return x3.Cmp(y2) == 0 -} - -//TODO: double check if the function is okay -// affineFromJacobian reverses the Jacobian transform. See the comment at the -// top of the file. -func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) { - zinv := new(big.Int).ModInverse(z, BitCurve.P) - zinvsq := new(big.Int).Mul(zinv, zinv) - - xOut = new(big.Int).Mul(x, zinvsq) - xOut.Mod(xOut, BitCurve.P) - zinvsq.Mul(zinvsq, zinv) - yOut = new(big.Int).Mul(y, zinvsq) - yOut.Mod(yOut, BitCurve.P) - return -} - -// Add returns the sum of (x1,y1) and (x2,y2) -func (BitCurve *BitCurve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) { - z := new(big.Int).SetInt64(1) - return BitCurve.affineFromJacobian(BitCurve.addJacobian(x1, y1, z, x2, y2, z)) -} - -// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and -// (x2, y2, z2) and returns their sum, also in Jacobian form. -func (BitCurve *BitCurve) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) { - // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl - z1z1 := new(big.Int).Mul(z1, z1) - z1z1.Mod(z1z1, BitCurve.P) - z2z2 := new(big.Int).Mul(z2, z2) - z2z2.Mod(z2z2, BitCurve.P) - - u1 := new(big.Int).Mul(x1, z2z2) - u1.Mod(u1, BitCurve.P) - u2 := new(big.Int).Mul(x2, z1z1) - u2.Mod(u2, BitCurve.P) - h := new(big.Int).Sub(u2, u1) - if h.Sign() == -1 { - h.Add(h, BitCurve.P) - } - i := new(big.Int).Lsh(h, 1) - i.Mul(i, i) - j := new(big.Int).Mul(h, i) - - s1 := new(big.Int).Mul(y1, z2) - s1.Mul(s1, z2z2) - s1.Mod(s1, BitCurve.P) - s2 := new(big.Int).Mul(y2, z1) - s2.Mul(s2, z1z1) - s2.Mod(s2, BitCurve.P) - r := new(big.Int).Sub(s2, s1) - if r.Sign() == -1 { - r.Add(r, BitCurve.P) - } - r.Lsh(r, 1) - v := new(big.Int).Mul(u1, i) - - x3 := new(big.Int).Set(r) - x3.Mul(x3, x3) - x3.Sub(x3, j) - x3.Sub(x3, v) - x3.Sub(x3, v) - x3.Mod(x3, BitCurve.P) - - y3 := new(big.Int).Set(r) - v.Sub(v, x3) - y3.Mul(y3, v) - s1.Mul(s1, j) - s1.Lsh(s1, 1) - y3.Sub(y3, s1) - y3.Mod(y3, BitCurve.P) - - z3 := new(big.Int).Add(z1, z2) - z3.Mul(z3, z3) - z3.Sub(z3, z1z1) - if z3.Sign() == -1 { - z3.Add(z3, BitCurve.P) - } - z3.Sub(z3, z2z2) - if z3.Sign() == -1 { - z3.Add(z3, BitCurve.P) - } - z3.Mul(z3, h) - z3.Mod(z3, BitCurve.P) - - return x3, y3, z3 -} - -// Double returns 2*(x,y) -func (BitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) { - z1 := new(big.Int).SetInt64(1) - return BitCurve.affineFromJacobian(BitCurve.doubleJacobian(x1, y1, z1)) -} - -// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and -// returns its double, also in Jacobian form. -func (BitCurve *BitCurve) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) { - // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l - - a := new(big.Int).Mul(x, x) //X1² - b := new(big.Int).Mul(y, y) //Y1² - c := new(big.Int).Mul(b, b) //B² - - d := new(big.Int).Add(x, b) //X1+B - d.Mul(d, d) //(X1+B)² - d.Sub(d, a) //(X1+B)²-A - d.Sub(d, c) //(X1+B)²-A-C - d.Mul(d, big.NewInt(2)) //2*((X1+B)²-A-C) - - e := new(big.Int).Mul(big.NewInt(3), a) //3*A - f := new(big.Int).Mul(e, e) //E² - - x3 := new(big.Int).Mul(big.NewInt(2), d) //2*D - x3.Sub(f, x3) //F-2*D - x3.Mod(x3, BitCurve.P) - - y3 := new(big.Int).Sub(d, x3) //D-X3 - y3.Mul(e, y3) //E*(D-X3) - y3.Sub(y3, new(big.Int).Mul(big.NewInt(8), c)) //E*(D-X3)-8*C - y3.Mod(y3, BitCurve.P) - - z3 := new(big.Int).Mul(y, z) //Y1*Z1 - z3.Mul(big.NewInt(2), z3) //3*Y1*Z1 - z3.Mod(z3, BitCurve.P) - - return x3, y3, z3 -} - -func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, scalar []byte) (*big.Int, *big.Int) { - // Ensure scalar is exactly 32 bytes. We pad always, even if - // scalar is 32 bytes long, to avoid a timing side channel. - if len(scalar) > 32 { - panic("can't handle scalars > 256 bits") - } - // NOTE: potential timing issue - padded := make([]byte, 32) - copy(padded[32-len(scalar):], scalar) - scalar = padded - - // Do the multiplication in C, updating point. - point := make([]byte, 64) - readBits(Bx, point[:32]) - readBits(By, point[32:]) - - pointPtr := (*C.uchar)(unsafe.Pointer(&point[0])) - scalarPtr := (*C.uchar)(unsafe.Pointer(&scalar[0])) - res := C.secp256k1_ext_scalar_mul(context, pointPtr, scalarPtr) - - // Unpack the result and clear temporaries. - x := new(big.Int).SetBytes(point[:32]) - y := new(big.Int).SetBytes(point[32:]) - for i := range point { - point[i] = 0 - } - for i := range padded { - scalar[i] = 0 - } - if res != 1 { - return nil, nil - } - return x, y -} - -// ScalarBaseMult returns k*G, where G is the base point of the group and k is -// an integer in big-endian form. -func (BitCurve *BitCurve) ScalarBaseMult(k []byte) (*big.Int, *big.Int) { - return BitCurve.ScalarMult(BitCurve.Gx, BitCurve.Gy, k) -} - -// Marshal converts a point into the form specified in section 4.3.6 of ANSI -// X9.62. -func (BitCurve *BitCurve) Marshal(x, y *big.Int) []byte { - byteLen := (BitCurve.BitSize + 7) >> 3 - ret := make([]byte, 1+2*byteLen) - ret[0] = 4 // uncompressed point flag - readBits(x, ret[1:1+byteLen]) - readBits(y, ret[1+byteLen:]) - return ret -} - -// Unmarshal converts a point, serialised by Marshal, into an x, y pair. On -// error, x = nil. -func (BitCurve *BitCurve) Unmarshal(data []byte) (x, y *big.Int) { - byteLen := (BitCurve.BitSize + 7) >> 3 - if len(data) != 1+2*byteLen { - return - } - if data[0] != 4 { // uncompressed form - return - } - x = new(big.Int).SetBytes(data[1 : 1+byteLen]) - y = new(big.Int).SetBytes(data[1+byteLen:]) - return -} - -var theCurve = new(BitCurve) - -func init() { - // See SEC 2 section 2.7.1 - // curve parameters taken from: - // http://www.secg.org/sec2-v2.pdf - theCurve.P, _ = new(big.Int).SetString("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", 0) - theCurve.N, _ = new(big.Int).SetString("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", 0) - theCurve.B, _ = new(big.Int).SetString("0x0000000000000000000000000000000000000000000000000000000000000007", 0) - theCurve.Gx, _ = new(big.Int).SetString("0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 0) - theCurve.Gy, _ = new(big.Int).SetString("0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 0) - theCurve.BitSize = 256 -} - -// S256 returns a BitCurve which implements secp256k1. -func S256() *BitCurve { - return theCurve -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/ext.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/ext.h deleted file mode 100644 index e422fe4b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/ext.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be found in -// the LICENSE file. - -// secp256k1_context_create_sign_verify creates a context for signing and signature verification. -static secp256k1_context* secp256k1_context_create_sign_verify() { - return secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); -} - -// secp256k1_ext_ecdsa_recover recovers the public key of an encoded compact signature. -// -// Returns: 1: recovery was successful -// 0: recovery was not successful -// Args: ctx: pointer to a context object (cannot be NULL) -// Out: pubkey_out: the serialized 65-byte public key of the signer (cannot be NULL) -// In: sigdata: pointer to a 65-byte signature with the recovery id at the end (cannot be NULL) -// msgdata: pointer to a 32-byte message (cannot be NULL) -static int secp256k1_ext_ecdsa_recover( - const secp256k1_context* ctx, - unsigned char *pubkey_out, - const unsigned char *sigdata, - const unsigned char *msgdata -) { - secp256k1_ecdsa_recoverable_signature sig; - secp256k1_pubkey pubkey; - - if (!secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &sig, sigdata, (int)sigdata[64])) { - return 0; - } - if (!secp256k1_ecdsa_recover(ctx, &pubkey, &sig, msgdata)) { - return 0; - } - size_t outputlen = 65; - return secp256k1_ec_pubkey_serialize(ctx, pubkey_out, &outputlen, &pubkey, SECP256K1_EC_UNCOMPRESSED); -} - -// secp256k1_ext_ecdsa_verify verifies an encoded compact signature. -// -// Returns: 1: signature is valid -// 0: signature is invalid -// Args: ctx: pointer to a context object (cannot be NULL) -// In: sigdata: pointer to a 64-byte signature (cannot be NULL) -// msgdata: pointer to a 32-byte message (cannot be NULL) -// pubkeydata: pointer to public key data (cannot be NULL) -// pubkeylen: length of pubkeydata -static int secp256k1_ext_ecdsa_verify( - const secp256k1_context* ctx, - const unsigned char *sigdata, - const unsigned char *msgdata, - const unsigned char *pubkeydata, - size_t pubkeylen -) { - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pubkey; - - if (!secp256k1_ecdsa_signature_parse_compact(ctx, &sig, sigdata)) { - return 0; - } - if (!secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeydata, pubkeylen)) { - return 0; - } - return secp256k1_ecdsa_verify(ctx, &sig, msgdata, &pubkey); -} - -// secp256k1_ext_reencode_pubkey decodes then encodes a public key. It can be used to -// convert between public key formats. The input/output formats are chosen depending on the -// length of the input/output buffers. -// -// Returns: 1: conversion successful -// 0: conversion unsuccessful -// Args: ctx: pointer to a context object (cannot be NULL) -// Out: out: output buffer that will contain the reencoded key (cannot be NULL) -// In: outlen: length of out (33 for compressed keys, 65 for uncompressed keys) -// pubkeydata: the input public key (cannot be NULL) -// pubkeylen: length of pubkeydata -static int secp256k1_ext_reencode_pubkey( - const secp256k1_context* ctx, - unsigned char *out, - size_t outlen, - const unsigned char *pubkeydata, - size_t pubkeylen -) { - secp256k1_pubkey pubkey; - - if (!secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeydata, pubkeylen)) { - return 0; - } - unsigned int flag = (outlen == 33) ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED; - return secp256k1_ec_pubkey_serialize(ctx, out, &outlen, &pubkey, flag); -} - -// secp256k1_ext_scalar_mul multiplies a point by a scalar in constant time. -// -// Returns: 1: multiplication was successful -// 0: scalar was invalid (zero or overflow) -// Args: ctx: pointer to a context object (cannot be NULL) -// Out: point: the multiplied point (usually secret) -// In: point: pointer to a 64-byte public point, -// encoded as two 256bit big-endian numbers. -// scalar: a 32-byte scalar with which to multiply the point -int secp256k1_ext_scalar_mul(const secp256k1_context* ctx, unsigned char *point, const unsigned char *scalar) { - int ret = 0; - int overflow = 0; - secp256k1_fe feX, feY; - secp256k1_gej res; - secp256k1_ge ge; - secp256k1_scalar s; - ARG_CHECK(point != NULL); - ARG_CHECK(scalar != NULL); - (void)ctx; - - secp256k1_fe_set_b32(&feX, point); - secp256k1_fe_set_b32(&feY, point+32); - secp256k1_ge_set_xy(&ge, &feX, &feY); - secp256k1_scalar_set_b32(&s, scalar, &overflow); - if (overflow || secp256k1_scalar_is_zero(&s)) { - ret = 0; - } else { - secp256k1_ecmult_const(&res, &ge, &s); - secp256k1_ge_set_gej(&ge, &res); - /* Note: can't use secp256k1_pubkey_save here because it is not constant time. */ - secp256k1_fe_normalize(&ge.x); - secp256k1_fe_normalize(&ge.y); - secp256k1_fe_get_b32(point, &ge.x); - secp256k1_fe_get_b32(point+32, &ge.y); - ret = 1; - } - secp256k1_scalar_clear(&s); - return ret; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore deleted file mode 100644 index 87fea161..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.gitignore +++ /dev/null @@ -1,49 +0,0 @@ -bench_inv -bench_ecdh -bench_sign -bench_verify -bench_schnorr_verify -bench_recover -bench_internal -tests -exhaustive_tests -gen_context -*.exe -*.so -*.a -!.gitignore - -Makefile -configure -.libs/ -Makefile.in -aclocal.m4 -autom4te.cache/ -config.log -config.status -*.tar.gz -*.la -libtool -.deps/ -.dirstamp -*.lo -*.o -*~ -src/libsecp256k1-config.h -src/libsecp256k1-config.h.in -src/ecmult_static_context.h -build-aux/config.guess -build-aux/config.sub -build-aux/depcomp -build-aux/install-sh -build-aux/ltmain.sh -build-aux/m4/libtool.m4 -build-aux/m4/lt~obsolete.m4 -build-aux/m4/ltoptions.m4 -build-aux/m4/ltsugar.m4 -build-aux/m4/ltversion.m4 -build-aux/missing -build-aux/compile -build-aux/test-driver -src/stamp-h1 -libsecp256k1.pc diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml deleted file mode 100644 index 24395292..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/.travis.yml +++ /dev/null @@ -1,69 +0,0 @@ -language: c -sudo: false -addons: - apt: - packages: libgmp-dev -compiler: - - clang - - gcc -cache: - directories: - - src/java/guava/ -env: - global: - - FIELD=auto BIGNUM=auto SCALAR=auto ENDOMORPHISM=no STATICPRECOMPUTATION=yes ASM=no BUILD=check EXTRAFLAGS= HOST= ECDH=no RECOVERY=no EXPERIMENTAL=no - - GUAVA_URL=https://search.maven.org/remotecontent?filepath=com/google/guava/guava/18.0/guava-18.0.jar GUAVA_JAR=src/java/guava/guava-18.0.jar - matrix: - - SCALAR=32bit RECOVERY=yes - - SCALAR=32bit FIELD=32bit ECDH=yes EXPERIMENTAL=yes - - SCALAR=64bit - - FIELD=64bit RECOVERY=yes - - FIELD=64bit ENDOMORPHISM=yes - - FIELD=64bit ENDOMORPHISM=yes ECDH=yes EXPERIMENTAL=yes - - FIELD=64bit ASM=x86_64 - - FIELD=64bit ENDOMORPHISM=yes ASM=x86_64 - - FIELD=32bit ENDOMORPHISM=yes - - BIGNUM=no - - BIGNUM=no ENDOMORPHISM=yes RECOVERY=yes EXPERIMENTAL=yes - - BIGNUM=no STATICPRECOMPUTATION=no - - BUILD=distcheck - - EXTRAFLAGS=CPPFLAGS=-DDETERMINISTIC - - EXTRAFLAGS=CFLAGS=-O0 - - BUILD=check-java ECDH=yes EXPERIMENTAL=yes -matrix: - fast_finish: true - include: - - compiler: clang - env: HOST=i686-linux-gnu ENDOMORPHISM=yes - addons: - apt: - packages: - - gcc-multilib - - libgmp-dev:i386 - - compiler: clang - env: HOST=i686-linux-gnu - addons: - apt: - packages: - - gcc-multilib - - compiler: gcc - env: HOST=i686-linux-gnu ENDOMORPHISM=yes - addons: - apt: - packages: - - gcc-multilib - - compiler: gcc - env: HOST=i686-linux-gnu - addons: - apt: - packages: - - gcc-multilib - - libgmp-dev:i386 -before_install: mkdir -p `dirname $GUAVA_JAR` -install: if [ ! -f $GUAVA_JAR ]; then wget $GUAVA_URL -O $GUAVA_JAR; fi -before_script: ./autogen.sh -script: - - if [ -n "$HOST" ]; then export USE_HOST="--host=$HOST"; fi - - if [ "x$HOST" = "xi686-linux-gnu" ]; then export CC="$CC -m32"; fi - - ./configure --enable-experimental=$EXPERIMENTAL --enable-endomorphism=$ENDOMORPHISM --with-field=$FIELD --with-bignum=$BIGNUM --with-scalar=$SCALAR --enable-ecmult-static-precomputation=$STATICPRECOMPUTATION --enable-module-ecdh=$ECDH --enable-module-recovery=$RECOVERY $EXTRAFLAGS $USE_HOST && make -j2 $BUILD -os: linux diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING deleted file mode 100644 index 4522a599..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/COPYING +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Pieter Wuille - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am deleted file mode 100644 index c071fbe2..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/Makefile.am +++ /dev/null @@ -1,177 +0,0 @@ -ACLOCAL_AMFLAGS = -I build-aux/m4 - -lib_LTLIBRARIES = libsecp256k1.la -if USE_JNI -JNI_LIB = libsecp256k1_jni.la -noinst_LTLIBRARIES = $(JNI_LIB) -else -JNI_LIB = -endif -include_HEADERS = include/secp256k1.h -noinst_HEADERS = -noinst_HEADERS += src/scalar.h -noinst_HEADERS += src/scalar_4x64.h -noinst_HEADERS += src/scalar_8x32.h -noinst_HEADERS += src/scalar_low.h -noinst_HEADERS += src/scalar_impl.h -noinst_HEADERS += src/scalar_4x64_impl.h -noinst_HEADERS += src/scalar_8x32_impl.h -noinst_HEADERS += src/scalar_low_impl.h -noinst_HEADERS += src/group.h -noinst_HEADERS += src/group_impl.h -noinst_HEADERS += src/num_gmp.h -noinst_HEADERS += src/num_gmp_impl.h -noinst_HEADERS += src/ecdsa.h -noinst_HEADERS += src/ecdsa_impl.h -noinst_HEADERS += src/eckey.h -noinst_HEADERS += src/eckey_impl.h -noinst_HEADERS += src/ecmult.h -noinst_HEADERS += src/ecmult_impl.h -noinst_HEADERS += src/ecmult_const.h -noinst_HEADERS += src/ecmult_const_impl.h -noinst_HEADERS += src/ecmult_gen.h -noinst_HEADERS += src/ecmult_gen_impl.h -noinst_HEADERS += src/num.h -noinst_HEADERS += src/num_impl.h -noinst_HEADERS += src/field_10x26.h -noinst_HEADERS += src/field_10x26_impl.h -noinst_HEADERS += src/field_5x52.h -noinst_HEADERS += src/field_5x52_impl.h -noinst_HEADERS += src/field_5x52_int128_impl.h -noinst_HEADERS += src/field_5x52_asm_impl.h -noinst_HEADERS += src/java/org_bitcoin_NativeSecp256k1.h -noinst_HEADERS += src/java/org_bitcoin_Secp256k1Context.h -noinst_HEADERS += src/util.h -noinst_HEADERS += src/testrand.h -noinst_HEADERS += src/testrand_impl.h -noinst_HEADERS += src/hash.h -noinst_HEADERS += src/hash_impl.h -noinst_HEADERS += src/field.h -noinst_HEADERS += src/field_impl.h -noinst_HEADERS += src/bench.h -noinst_HEADERS += contrib/lax_der_parsing.h -noinst_HEADERS += contrib/lax_der_parsing.c -noinst_HEADERS += contrib/lax_der_privatekey_parsing.h -noinst_HEADERS += contrib/lax_der_privatekey_parsing.c - -if USE_EXTERNAL_ASM -COMMON_LIB = libsecp256k1_common.la -noinst_LTLIBRARIES = $(COMMON_LIB) -else -COMMON_LIB = -endif - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libsecp256k1.pc - -if USE_EXTERNAL_ASM -if USE_ASM_ARM -libsecp256k1_common_la_SOURCES = src/asm/field_10x26_arm.s -endif -endif - -libsecp256k1_la_SOURCES = src/secp256k1.c -libsecp256k1_la_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES) -libsecp256k1_la_LIBADD = $(JNI_LIB) $(SECP_LIBS) $(COMMON_LIB) - -libsecp256k1_jni_la_SOURCES = src/java/org_bitcoin_NativeSecp256k1.c src/java/org_bitcoin_Secp256k1Context.c -libsecp256k1_jni_la_CPPFLAGS = -DSECP256K1_BUILD $(JNI_INCLUDES) - -noinst_PROGRAMS = -if USE_BENCHMARK -noinst_PROGRAMS += bench_verify bench_sign bench_internal -bench_verify_SOURCES = src/bench_verify.c -bench_verify_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) -bench_sign_SOURCES = src/bench_sign.c -bench_sign_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) -bench_internal_SOURCES = src/bench_internal.c -bench_internal_LDADD = $(SECP_LIBS) $(COMMON_LIB) -bench_internal_CPPFLAGS = -DSECP256K1_BUILD $(SECP_INCLUDES) -endif - -TESTS = -if USE_TESTS -noinst_PROGRAMS += tests -tests_SOURCES = src/tests.c -tests_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/src -I$(top_srcdir)/include $(SECP_INCLUDES) $(SECP_TEST_INCLUDES) -if !ENABLE_COVERAGE -tests_CPPFLAGS += -DVERIFY -endif -tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) -tests_LDFLAGS = -static -TESTS += tests -endif - -if USE_EXHAUSTIVE_TESTS -noinst_PROGRAMS += exhaustive_tests -exhaustive_tests_SOURCES = src/tests_exhaustive.c -exhaustive_tests_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/src $(SECP_INCLUDES) -if !ENABLE_COVERAGE -exhaustive_tests_CPPFLAGS += -DVERIFY -endif -exhaustive_tests_LDADD = $(SECP_LIBS) -exhaustive_tests_LDFLAGS = -static -TESTS += exhaustive_tests -endif - -JAVAROOT=src/java -JAVAORG=org/bitcoin -JAVA_GUAVA=$(srcdir)/$(JAVAROOT)/guava/guava-18.0.jar -CLASSPATH_ENV=CLASSPATH=$(JAVA_GUAVA) -JAVA_FILES= \ - $(JAVAROOT)/$(JAVAORG)/NativeSecp256k1.java \ - $(JAVAROOT)/$(JAVAORG)/NativeSecp256k1Test.java \ - $(JAVAROOT)/$(JAVAORG)/NativeSecp256k1Util.java \ - $(JAVAROOT)/$(JAVAORG)/Secp256k1Context.java - -if USE_JNI - -$(JAVA_GUAVA): - @echo Guava is missing. Fetch it via: \ - wget https://search.maven.org/remotecontent?filepath=com/google/guava/guava/18.0/guava-18.0.jar -O $(@) - @false - -.stamp-java: $(JAVA_FILES) - @echo Compiling $^ - $(AM_V_at)$(CLASSPATH_ENV) javac $^ - @touch $@ - -if USE_TESTS - -check-java: libsecp256k1.la $(JAVA_GUAVA) .stamp-java - $(AM_V_at)java -Djava.library.path="./:./src:./src/.libs:.libs/" -cp "$(JAVA_GUAVA):$(JAVAROOT)" $(JAVAORG)/NativeSecp256k1Test - -endif -endif - -if USE_ECMULT_STATIC_PRECOMPUTATION -CPPFLAGS_FOR_BUILD +=-I$(top_srcdir) -CFLAGS_FOR_BUILD += -Wall -Wextra -Wno-unused-function - -gen_context_OBJECTS = gen_context.o -gen_context_BIN = gen_context$(BUILD_EXEEXT) -gen_%.o: src/gen_%.c - $(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@ - -$(gen_context_BIN): $(gen_context_OBJECTS) - $(CC_FOR_BUILD) $^ -o $@ - -$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h -$(tests_OBJECTS): src/ecmult_static_context.h -$(bench_internal_OBJECTS): src/ecmult_static_context.h - -src/ecmult_static_context.h: $(gen_context_BIN) - ./$(gen_context_BIN) - -CLEANFILES = $(gen_context_BIN) src/ecmult_static_context.h $(JAVAROOT)/$(JAVAORG)/*.class .stamp-java -endif - -EXTRA_DIST = autogen.sh src/gen_context.c src/basic-config.h $(JAVA_FILES) - -if ENABLE_MODULE_ECDH -include src/modules/ecdh/Makefile.am.include -endif - -if ENABLE_MODULE_RECOVERY -include src/modules/recovery/Makefile.am.include -endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md deleted file mode 100644 index 8cd344ea..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/README.md +++ /dev/null @@ -1,61 +0,0 @@ -libsecp256k1 -============ - -[![Build Status](https://travis-ci.org/bitcoin-core/secp256k1.svg?branch=master)](https://travis-ci.org/bitcoin-core/secp256k1) - -Optimized C library for EC operations on curve secp256k1. - -This library is a work in progress and is being used to research best practices. Use at your own risk. - -Features: -* secp256k1 ECDSA signing/verification and key generation. -* Adding/multiplying private/public keys. -* Serialization/parsing of private keys, public keys, signatures. -* Constant time, constant memory access signing and pubkey generation. -* Derandomized DSA (via RFC6979 or with a caller provided function.) -* Very efficient implementation. - -Implementation details ----------------------- - -* General - * No runtime heap allocation. - * Extensive testing infrastructure. - * Structured to facilitate review and analysis. - * Intended to be portable to any system with a C89 compiler and uint64_t support. - * Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.") -* Field operations - * Optimized implementation of arithmetic modulo the curve's field size (2^256 - 0x1000003D1). - * Using 5 52-bit limbs (including hand-optimized assembly for x86_64, by Diederik Huys). - * Using 10 26-bit limbs. - * Field inverses and square roots using a sliding window over blocks of 1s (by Peter Dettman). -* Scalar operations - * Optimized implementation without data-dependent branches of arithmetic modulo the curve's order. - * Using 4 64-bit limbs (relying on __int128 support in the compiler). - * Using 8 32-bit limbs. -* Group operations - * Point addition formula specifically simplified for the curve equation (y^2 = x^3 + 7). - * Use addition between points in Jacobian and affine coordinates where possible. - * Use a unified addition/doubling formula where necessary to avoid data-dependent branches. - * Point/x comparison without a field inversion by comparison in the Jacobian coordinate space. -* Point multiplication for verification (a*P + b*G). - * Use wNAF notation for point multiplicands. - * Use a much larger window for multiples of G, using precomputed multiples. - * Use Shamir's trick to do the multiplication with the public key and the generator simultaneously. - * Optionally (off by default) use secp256k1's efficiently-computable endomorphism to split the P multiplicand into 2 half-sized ones. -* Point multiplication for signing - * Use a precomputed table of multiples of powers of 16 multiplied with the generator, so general multiplication becomes a series of additions. - * Access the table with branch-free conditional moves so memory access is uniform. - * No data-dependent branches - * The precomputed tables add and eventually subtract points for which no known scalar (private key) is known, preventing even an attacker with control over the private key used to control the data internally. - -Build steps ------------ - -libsecp256k1 is built using autotools: - - $ ./autogen.sh - $ ./configure - $ make - $ ./tests - $ sudo make install # optional diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO deleted file mode 100644 index a300e1c5..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/TODO +++ /dev/null @@ -1,3 +0,0 @@ -* Unit tests for fieldelem/groupelem, including ones intended to - trigger fieldelem's boundary cases. -* Complete constant-time operations for signing/keygen diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh deleted file mode 100755 index 65286b93..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/autogen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -e -autoreconf -if --warnings=all diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 deleted file mode 100644 index 1fc36276..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_jni_include_dir.m4 +++ /dev/null @@ -1,140 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_JNI_INCLUDE_DIR -# -# DESCRIPTION -# -# AX_JNI_INCLUDE_DIR finds include directories needed for compiling -# programs using the JNI interface. -# -# JNI include directories are usually in the Java distribution. This is -# deduced from the value of $JAVA_HOME, $JAVAC, or the path to "javac", in -# that order. When this macro completes, a list of directories is left in -# the variable JNI_INCLUDE_DIRS. -# -# Example usage follows: -# -# AX_JNI_INCLUDE_DIR -# -# for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS -# do -# CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" -# done -# -# If you want to force a specific compiler: -# -# - at the configure.in level, set JAVAC=yourcompiler before calling -# AX_JNI_INCLUDE_DIR -# -# - at the configure level, setenv JAVAC -# -# Note: This macro can work with the autoconf M4 macros for Java programs. -# This particular macro is not part of the original set of macros. -# -# LICENSE -# -# Copyright (c) 2008 Don Anderson -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 10 - -AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) -AC_DEFUN([AX_JNI_INCLUDE_DIR],[ - -JNI_INCLUDE_DIRS="" - -if test "x$JAVA_HOME" != x; then - _JTOPDIR="$JAVA_HOME" -else - if test "x$JAVAC" = x; then - JAVAC=javac - fi - AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no]) - if test "x$_ACJNI_JAVAC" = xno; then - AC_MSG_WARN([cannot find JDK; try setting \$JAVAC or \$JAVA_HOME]) - fi - _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") - _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` -fi - -case "$host_os" in - darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - _JINC="$_JTOPDIR/Headers";; - *) _JINC="$_JTOPDIR/include";; -esac -_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) -_AS_ECHO_LOG([_JINC=$_JINC]) - -# On Mac OS X 10.6.4, jni.h is a symlink: -# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h -# -> ../../CurrentJDK/Headers/jni.h. - -AC_CACHE_CHECK(jni headers, ac_cv_jni_header_path, -[ -if test -f "$_JINC/jni.h"; then - ac_cv_jni_header_path="$_JINC" - JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" -else - _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` - if test -f "$_JTOPDIR/include/jni.h"; then - ac_cv_jni_header_path="$_JTOPDIR/include" - JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $ac_cv_jni_header_path" - else - ac_cv_jni_header_path=none - fi -fi -]) - - - -# get the likely subdirectories for system specific java includes -case "$host_os" in -bsdi*) _JNI_INC_SUBDIRS="bsdos";; -darwin*) _JNI_INC_SUBDIRS="darwin";; -freebsd*) _JNI_INC_SUBDIRS="freebsd";; -linux*) _JNI_INC_SUBDIRS="linux genunix";; -osf*) _JNI_INC_SUBDIRS="alpha";; -solaris*) _JNI_INC_SUBDIRS="solaris";; -mingw*) _JNI_INC_SUBDIRS="win32";; -cygwin*) _JNI_INC_SUBDIRS="win32";; -*) _JNI_INC_SUBDIRS="genunix";; -esac - -if test "x$ac_cv_jni_header_path" != "xnone"; then - # add any subdirectories that are present - for JINCSUBDIR in $_JNI_INC_SUBDIRS - do - if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then - JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" - fi - done -fi -]) - -# _ACJNI_FOLLOW_SYMLINKS -# Follows symbolic links on , -# finally setting variable _ACJNI_FOLLOWED -# ---------------------------------------- -AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ -# find the include directory relative to the javac executable -_cur="$1" -while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do - AC_MSG_CHECKING([symlink for $_cur]) - _slink=`ls -ld "$_cur" | sed 's/.* -> //'` - case "$_slink" in - /*) _cur="$_slink";; - # 'X' avoids triggering unwanted echo options. - *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; - esac - AC_MSG_RESULT([$_cur]) -done -_ACJNI_FOLLOWED="$_cur" -])# _ACJNI diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 deleted file mode 100644 index 77fd346a..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/ax_prog_cc_for_build.m4 +++ /dev/null @@ -1,125 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_CC_FOR_BUILD -# -# DESCRIPTION -# -# This macro searches for a C compiler that generates native executables, -# that is a C compiler that surely is not a cross-compiler. This can be -# useful if you have to generate source code at compile-time like for -# example GCC does. -# -# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything -# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). -# The value of these variables can be overridden by the user by specifying -# a compiler with an environment variable (like you do for standard CC). -# -# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object -# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if -# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are -# substituted in the Makefile. -# -# LICENSE -# -# Copyright (c) 2008 Paolo Bonzini -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 8 - -AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD]) -AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_CPP])dnl -AC_REQUIRE([AC_EXEEXT])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl - -dnl Use the standard macros, but make them use other variable names -dnl -pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl -pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl -pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl -pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl -pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl -pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl -pushdef([ac_cv_objext], ac_cv_build_objext)dnl -pushdef([ac_exeext], ac_build_exeext)dnl -pushdef([ac_objext], ac_build_objext)dnl -pushdef([CC], CC_FOR_BUILD)dnl -pushdef([CPP], CPP_FOR_BUILD)dnl -pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl -pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl -pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl -pushdef([host], build)dnl -pushdef([host_alias], build_alias)dnl -pushdef([host_cpu], build_cpu)dnl -pushdef([host_vendor], build_vendor)dnl -pushdef([host_os], build_os)dnl -pushdef([ac_cv_host], ac_cv_build)dnl -pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl -pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl -pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl -pushdef([ac_cv_host_os], ac_cv_build_os)dnl -pushdef([ac_cpp], ac_build_cpp)dnl -pushdef([ac_compile], ac_build_compile)dnl -pushdef([ac_link], ac_build_link)dnl - -save_cross_compiling=$cross_compiling -save_ac_tool_prefix=$ac_tool_prefix -cross_compiling=no -ac_tool_prefix= - -AC_PROG_CC -AC_PROG_CPP -AC_EXEEXT - -ac_tool_prefix=$save_ac_tool_prefix -cross_compiling=$save_cross_compiling - -dnl Restore the old definitions -dnl -popdef([ac_link])dnl -popdef([ac_compile])dnl -popdef([ac_cpp])dnl -popdef([ac_cv_host_os])dnl -popdef([ac_cv_host_vendor])dnl -popdef([ac_cv_host_cpu])dnl -popdef([ac_cv_host_alias])dnl -popdef([ac_cv_host])dnl -popdef([host_os])dnl -popdef([host_vendor])dnl -popdef([host_cpu])dnl -popdef([host_alias])dnl -popdef([host])dnl -popdef([LDFLAGS])dnl -popdef([CPPFLAGS])dnl -popdef([CFLAGS])dnl -popdef([CPP])dnl -popdef([CC])dnl -popdef([ac_objext])dnl -popdef([ac_exeext])dnl -popdef([ac_cv_objext])dnl -popdef([ac_cv_exeext])dnl -popdef([ac_cv_prog_cc_g])dnl -popdef([ac_cv_prog_cc_cross])dnl -popdef([ac_cv_prog_cc_works])dnl -popdef([ac_cv_prog_gcc])dnl -popdef([ac_cv_prog_CPP])dnl - -dnl Finally, set Makefile variables -dnl -BUILD_EXEEXT=$ac_build_exeext -BUILD_OBJEXT=$ac_build_objext -AC_SUBST(BUILD_EXEEXT)dnl -AC_SUBST(BUILD_OBJEXT)dnl -AC_SUBST([CFLAGS_FOR_BUILD])dnl -AC_SUBST([CPPFLAGS_FOR_BUILD])dnl -AC_SUBST([LDFLAGS_FOR_BUILD])dnl -]) diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 deleted file mode 100644 index b74acb8c..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/build-aux/m4/bitcoin_secp.m4 +++ /dev/null @@ -1,69 +0,0 @@ -dnl libsecp25k1 helper checks -AC_DEFUN([SECP_INT128_CHECK],[ -has_int128=$ac_cv_type___int128 -]) - -dnl escape "$0x" below using the m4 quadrigaph @S|@, and escape it again with a \ for the shell. -AC_DEFUN([SECP_64BIT_ASM_CHECK],[ -AC_MSG_CHECKING(for x86_64 assembly availability) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include ]],[[ - uint64_t a = 11, tmp; - __asm__ __volatile__("movq \@S|@0x100000000,%1; mulq %%rsi" : "+a"(a) : "S"(tmp) : "cc", "%rdx"); - ]])],[has_64bit_asm=yes],[has_64bit_asm=no]) -AC_MSG_RESULT([$has_64bit_asm]) -]) - -dnl -AC_DEFUN([SECP_OPENSSL_CHECK],[ - has_libcrypto=no - m4_ifdef([PKG_CHECK_MODULES],[ - PKG_CHECK_MODULES([CRYPTO], [libcrypto], [has_libcrypto=yes],[has_libcrypto=no]) - if test x"$has_libcrypto" = x"yes"; then - TEMP_LIBS="$LIBS" - LIBS="$LIBS $CRYPTO_LIBS" - AC_CHECK_LIB(crypto, main,[AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed])],[has_libcrypto=no]) - LIBS="$TEMP_LIBS" - fi - ]) - if test x$has_libcrypto = xno; then - AC_CHECK_HEADER(openssl/crypto.h,[ - AC_CHECK_LIB(crypto, main,[ - has_libcrypto=yes - CRYPTO_LIBS=-lcrypto - AC_DEFINE(HAVE_LIBCRYPTO,1,[Define this symbol if libcrypto is installed]) - ]) - ]) - LIBS= - fi -if test x"$has_libcrypto" = x"yes" && test x"$has_openssl_ec" = x; then - AC_MSG_CHECKING(for EC functions in libcrypto) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - #include ]],[[ - EC_KEY *eckey = EC_KEY_new_by_curve_name(NID_secp256k1); - ECDSA_sign(0, NULL, 0, NULL, NULL, eckey); - ECDSA_verify(0, NULL, 0, NULL, 0, eckey); - EC_KEY_free(eckey); - ECDSA_SIG *sig_openssl; - sig_openssl = ECDSA_SIG_new(); - (void)sig_openssl->r; - ECDSA_SIG_free(sig_openssl); - ]])],[has_openssl_ec=yes],[has_openssl_ec=no]) - AC_MSG_RESULT([$has_openssl_ec]) -fi -]) - -dnl -AC_DEFUN([SECP_GMP_CHECK],[ -if test x"$has_gmp" != x"yes"; then - CPPFLAGS_TEMP="$CPPFLAGS" - CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS" - LIBS_TEMP="$LIBS" - LIBS="$GMP_LIBS $LIBS" - AC_CHECK_HEADER(gmp.h,[AC_CHECK_LIB(gmp, __gmpz_init,[has_gmp=yes; GMP_LIBS="$GMP_LIBS -lgmp"; AC_DEFINE(HAVE_LIBGMP,1,[Define this symbol if libgmp is installed])])]) - CPPFLAGS="$CPPFLAGS_TEMP" - LIBS="$LIBS_TEMP" -fi -]) diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac deleted file mode 100644 index e5fcbcb4..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/configure.ac +++ /dev/null @@ -1,493 +0,0 @@ -AC_PREREQ([2.60]) -AC_INIT([libsecp256k1],[0.1]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([build-aux/m4]) -AC_CANONICAL_HOST -AH_TOP([#ifndef LIBSECP256K1_CONFIG_H]) -AH_TOP([#define LIBSECP256K1_CONFIG_H]) -AH_BOTTOM([#endif /*LIBSECP256K1_CONFIG_H*/]) -AM_INIT_AUTOMAKE([foreign subdir-objects]) -LT_INIT - -dnl make the compilation flags quiet unless V=1 is used -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -PKG_PROG_PKG_CONFIG - -AC_PATH_TOOL(AR, ar) -AC_PATH_TOOL(RANLIB, ranlib) -AC_PATH_TOOL(STRIP, strip) -AX_PROG_CC_FOR_BUILD - -if test "x$CFLAGS" = "x"; then - CFLAGS="-g" -fi - -AM_PROG_CC_C_O - -AC_PROG_CC_C89 -if test x"$ac_cv_prog_cc_c89" = x"no"; then - AC_MSG_ERROR([c89 compiler support required]) -fi -AM_PROG_AS - -case $host_os in - *darwin*) - if test x$cross_compiling != xyes; then - AC_PATH_PROG([BREW],brew,) - if test x$BREW != x; then - dnl These Homebrew packages may be keg-only, meaning that they won't be found - dnl in expected paths because they may conflict with system files. Ask - dnl Homebrew where each one is located, then adjust paths accordingly. - - openssl_prefix=`$BREW --prefix openssl 2>/dev/null` - gmp_prefix=`$BREW --prefix gmp 2>/dev/null` - if test x$openssl_prefix != x; then - PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH" - export PKG_CONFIG_PATH - fi - if test x$gmp_prefix != x; then - GMP_CPPFLAGS="-I$gmp_prefix/include" - GMP_LIBS="-L$gmp_prefix/lib" - fi - else - AC_PATH_PROG([PORT],port,) - dnl if homebrew isn't installed and macports is, add the macports default paths - dnl as a last resort. - if test x$PORT != x; then - CPPFLAGS="$CPPFLAGS -isystem /opt/local/include" - LDFLAGS="$LDFLAGS -L/opt/local/lib" - fi - fi - fi - ;; -esac - -CFLAGS="$CFLAGS -W" - -warn_CFLAGS="-std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings" -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $warn_CFLAGS" -AC_MSG_CHECKING([if ${CC} supports ${warn_CFLAGS}]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$saved_CFLAGS" - ]) - -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -fvisibility=hidden" -AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[char foo;]])], - [ AC_MSG_RESULT([yes]) ], - [ AC_MSG_RESULT([no]) - CFLAGS="$saved_CFLAGS" - ]) - -AC_ARG_ENABLE(benchmark, - AS_HELP_STRING([--enable-benchmark],[compile benchmark (default is no)]), - [use_benchmark=$enableval], - [use_benchmark=no]) - -AC_ARG_ENABLE(coverage, - AS_HELP_STRING([--enable-coverage],[enable compiler flags to support kcov coverage analysis]), - [enable_coverage=$enableval], - [enable_coverage=no]) - -AC_ARG_ENABLE(tests, - AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]), - [use_tests=$enableval], - [use_tests=yes]) - -AC_ARG_ENABLE(openssl_tests, - AS_HELP_STRING([--enable-openssl-tests],[enable OpenSSL tests, if OpenSSL is available (default is auto)]), - [enable_openssl_tests=$enableval], - [enable_openssl_tests=auto]) - -AC_ARG_ENABLE(experimental, - AS_HELP_STRING([--enable-experimental],[allow experimental configure options (default is no)]), - [use_experimental=$enableval], - [use_experimental=no]) - -AC_ARG_ENABLE(exhaustive_tests, - AS_HELP_STRING([--enable-exhaustive-tests],[compile exhaustive tests (default is yes)]), - [use_exhaustive_tests=$enableval], - [use_exhaustive_tests=yes]) - -AC_ARG_ENABLE(endomorphism, - AS_HELP_STRING([--enable-endomorphism],[enable endomorphism (default is no)]), - [use_endomorphism=$enableval], - [use_endomorphism=no]) - -AC_ARG_ENABLE(ecmult_static_precomputation, - AS_HELP_STRING([--enable-ecmult-static-precomputation],[enable precomputed ecmult table for signing (default is yes)]), - [use_ecmult_static_precomputation=$enableval], - [use_ecmult_static_precomputation=auto]) - -AC_ARG_ENABLE(module_ecdh, - AS_HELP_STRING([--enable-module-ecdh],[enable ECDH shared secret computation (experimental)]), - [enable_module_ecdh=$enableval], - [enable_module_ecdh=no]) - -AC_ARG_ENABLE(module_recovery, - AS_HELP_STRING([--enable-module-recovery],[enable ECDSA pubkey recovery module (default is no)]), - [enable_module_recovery=$enableval], - [enable_module_recovery=no]) - -AC_ARG_ENABLE(jni, - AS_HELP_STRING([--enable-jni],[enable libsecp256k1_jni (default is auto)]), - [use_jni=$enableval], - [use_jni=auto]) - -AC_ARG_WITH([field], [AS_HELP_STRING([--with-field=64bit|32bit|auto], -[Specify Field Implementation. Default is auto])],[req_field=$withval], [req_field=auto]) - -AC_ARG_WITH([bignum], [AS_HELP_STRING([--with-bignum=gmp|no|auto], -[Specify Bignum Implementation. Default is auto])],[req_bignum=$withval], [req_bignum=auto]) - -AC_ARG_WITH([scalar], [AS_HELP_STRING([--with-scalar=64bit|32bit|auto], -[Specify scalar implementation. Default is auto])],[req_scalar=$withval], [req_scalar=auto]) - -AC_ARG_WITH([asm], [AS_HELP_STRING([--with-asm=x86_64|arm|no|auto] -[Specify assembly optimizations to use. Default is auto (experimental: arm)])],[req_asm=$withval], [req_asm=auto]) - -AC_CHECK_TYPES([__int128]) - -AC_MSG_CHECKING([for __builtin_expect]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[void myfunc() {__builtin_expect(0,0);}]])], - [ AC_MSG_RESULT([yes]);AC_DEFINE(HAVE_BUILTIN_EXPECT,1,[Define this symbol if __builtin_expect is available]) ], - [ AC_MSG_RESULT([no]) - ]) - -if test x"$enable_coverage" = x"yes"; then - AC_DEFINE(COVERAGE, 1, [Define this symbol to compile out all VERIFY code]) - CFLAGS="$CFLAGS -O0 --coverage" - LDFLAGS="--coverage" -else - CFLAGS="$CFLAGS -O3" -fi - -if test x"$use_ecmult_static_precomputation" != x"no"; then - save_cross_compiling=$cross_compiling - cross_compiling=no - TEMP_CC="$CC" - CC="$CC_FOR_BUILD" - AC_MSG_CHECKING([native compiler: ${CC_FOR_BUILD}]) - AC_RUN_IFELSE( - [AC_LANG_PROGRAM([], [return 0])], - [working_native_cc=yes], - [working_native_cc=no],[dnl]) - CC="$TEMP_CC" - cross_compiling=$save_cross_compiling - - if test x"$working_native_cc" = x"no"; then - set_precomp=no - if test x"$use_ecmult_static_precomputation" = x"yes"; then - AC_MSG_ERROR([${CC_FOR_BUILD} does not produce working binaries. Please set CC_FOR_BUILD]) - else - AC_MSG_RESULT([${CC_FOR_BUILD} does not produce working binaries. Please set CC_FOR_BUILD]) - fi - else - AC_MSG_RESULT([ok]) - set_precomp=yes - fi -else - set_precomp=no -fi - -if test x"$req_asm" = x"auto"; then - SECP_64BIT_ASM_CHECK - if test x"$has_64bit_asm" = x"yes"; then - set_asm=x86_64 - fi - if test x"$set_asm" = x; then - set_asm=no - fi -else - set_asm=$req_asm - case $set_asm in - x86_64) - SECP_64BIT_ASM_CHECK - if test x"$has_64bit_asm" != x"yes"; then - AC_MSG_ERROR([x86_64 assembly optimization requested but not available]) - fi - ;; - arm) - ;; - no) - ;; - *) - AC_MSG_ERROR([invalid assembly optimization selection]) - ;; - esac -fi - -if test x"$req_field" = x"auto"; then - if test x"set_asm" = x"x86_64"; then - set_field=64bit - fi - if test x"$set_field" = x; then - SECP_INT128_CHECK - if test x"$has_int128" = x"yes"; then - set_field=64bit - fi - fi - if test x"$set_field" = x; then - set_field=32bit - fi -else - set_field=$req_field - case $set_field in - 64bit) - if test x"$set_asm" != x"x86_64"; then - SECP_INT128_CHECK - if test x"$has_int128" != x"yes"; then - AC_MSG_ERROR([64bit field explicitly requested but neither __int128 support or x86_64 assembly available]) - fi - fi - ;; - 32bit) - ;; - *) - AC_MSG_ERROR([invalid field implementation selection]) - ;; - esac -fi - -if test x"$req_scalar" = x"auto"; then - SECP_INT128_CHECK - if test x"$has_int128" = x"yes"; then - set_scalar=64bit - fi - if test x"$set_scalar" = x; then - set_scalar=32bit - fi -else - set_scalar=$req_scalar - case $set_scalar in - 64bit) - SECP_INT128_CHECK - if test x"$has_int128" != x"yes"; then - AC_MSG_ERROR([64bit scalar explicitly requested but __int128 support not available]) - fi - ;; - 32bit) - ;; - *) - AC_MSG_ERROR([invalid scalar implementation selected]) - ;; - esac -fi - -if test x"$req_bignum" = x"auto"; then - SECP_GMP_CHECK - if test x"$has_gmp" = x"yes"; then - set_bignum=gmp - fi - - if test x"$set_bignum" = x; then - set_bignum=no - fi -else - set_bignum=$req_bignum - case $set_bignum in - gmp) - SECP_GMP_CHECK - if test x"$has_gmp" != x"yes"; then - AC_MSG_ERROR([gmp bignum explicitly requested but libgmp not available]) - fi - ;; - no) - ;; - *) - AC_MSG_ERROR([invalid bignum implementation selection]) - ;; - esac -fi - -# select assembly optimization -use_external_asm=no - -case $set_asm in -x86_64) - AC_DEFINE(USE_ASM_X86_64, 1, [Define this symbol to enable x86_64 assembly optimizations]) - ;; -arm) - use_external_asm=yes - ;; -no) - ;; -*) - AC_MSG_ERROR([invalid assembly optimizations]) - ;; -esac - -# select field implementation -case $set_field in -64bit) - AC_DEFINE(USE_FIELD_5X52, 1, [Define this symbol to use the FIELD_5X52 implementation]) - ;; -32bit) - AC_DEFINE(USE_FIELD_10X26, 1, [Define this symbol to use the FIELD_10X26 implementation]) - ;; -*) - AC_MSG_ERROR([invalid field implementation]) - ;; -esac - -# select bignum implementation -case $set_bignum in -gmp) - AC_DEFINE(HAVE_LIBGMP, 1, [Define this symbol if libgmp is installed]) - AC_DEFINE(USE_NUM_GMP, 1, [Define this symbol to use the gmp implementation for num]) - AC_DEFINE(USE_FIELD_INV_NUM, 1, [Define this symbol to use the num-based field inverse implementation]) - AC_DEFINE(USE_SCALAR_INV_NUM, 1, [Define this symbol to use the num-based scalar inverse implementation]) - ;; -no) - AC_DEFINE(USE_NUM_NONE, 1, [Define this symbol to use no num implementation]) - AC_DEFINE(USE_FIELD_INV_BUILTIN, 1, [Define this symbol to use the native field inverse implementation]) - AC_DEFINE(USE_SCALAR_INV_BUILTIN, 1, [Define this symbol to use the native scalar inverse implementation]) - ;; -*) - AC_MSG_ERROR([invalid bignum implementation]) - ;; -esac - -#select scalar implementation -case $set_scalar in -64bit) - AC_DEFINE(USE_SCALAR_4X64, 1, [Define this symbol to use the 4x64 scalar implementation]) - ;; -32bit) - AC_DEFINE(USE_SCALAR_8X32, 1, [Define this symbol to use the 8x32 scalar implementation]) - ;; -*) - AC_MSG_ERROR([invalid scalar implementation]) - ;; -esac - -if test x"$use_tests" = x"yes"; then - SECP_OPENSSL_CHECK - if test x"$has_openssl_ec" = x"yes"; then - if test x"$enable_openssl_tests" != x"no"; then - AC_DEFINE(ENABLE_OPENSSL_TESTS, 1, [Define this symbol if OpenSSL EC functions are available]) - SECP_TEST_INCLUDES="$SSL_CFLAGS $CRYPTO_CFLAGS" - SECP_TEST_LIBS="$CRYPTO_LIBS" - - case $host in - *mingw*) - SECP_TEST_LIBS="$SECP_TEST_LIBS -lgdi32" - ;; - esac - fi - else - if test x"$enable_openssl_tests" = x"yes"; then - AC_MSG_ERROR([OpenSSL tests requested but OpenSSL with EC support is not available]) - fi - fi -else - if test x"$enable_openssl_tests" = x"yes"; then - AC_MSG_ERROR([OpenSSL tests requested but tests are not enabled]) - fi -fi - -if test x"$use_jni" != x"no"; then - AX_JNI_INCLUDE_DIR - have_jni_dependencies=yes - if test x"$enable_module_ecdh" = x"no"; then - have_jni_dependencies=no - fi - if test "x$JNI_INCLUDE_DIRS" = "x"; then - have_jni_dependencies=no - fi - if test "x$have_jni_dependencies" = "xno"; then - if test x"$use_jni" = x"yes"; then - AC_MSG_ERROR([jni support explicitly requested but headers/dependencies were not found. Enable ECDH and try again.]) - fi - AC_MSG_WARN([jni headers/dependencies not found. jni support disabled]) - use_jni=no - else - use_jni=yes - for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do - JNI_INCLUDES="$JNI_INCLUDES -I$JNI_INCLUDE_DIR" - done - fi -fi - -if test x"$set_bignum" = x"gmp"; then - SECP_LIBS="$SECP_LIBS $GMP_LIBS" - SECP_INCLUDES="$SECP_INCLUDES $GMP_CPPFLAGS" -fi - -if test x"$use_endomorphism" = x"yes"; then - AC_DEFINE(USE_ENDOMORPHISM, 1, [Define this symbol to use endomorphism optimization]) -fi - -if test x"$set_precomp" = x"yes"; then - AC_DEFINE(USE_ECMULT_STATIC_PRECOMPUTATION, 1, [Define this symbol to use a statically generated ecmult table]) -fi - -if test x"$enable_module_ecdh" = x"yes"; then - AC_DEFINE(ENABLE_MODULE_ECDH, 1, [Define this symbol to enable the ECDH module]) -fi - -if test x"$enable_module_recovery" = x"yes"; then - AC_DEFINE(ENABLE_MODULE_RECOVERY, 1, [Define this symbol to enable the ECDSA pubkey recovery module]) -fi - -AC_C_BIGENDIAN() - -if test x"$use_external_asm" = x"yes"; then - AC_DEFINE(USE_EXTERNAL_ASM, 1, [Define this symbol if an external (non-inline) assembly implementation is used]) -fi - -AC_MSG_NOTICE([Using static precomputation: $set_precomp]) -AC_MSG_NOTICE([Using assembly optimizations: $set_asm]) -AC_MSG_NOTICE([Using field implementation: $set_field]) -AC_MSG_NOTICE([Using bignum implementation: $set_bignum]) -AC_MSG_NOTICE([Using scalar implementation: $set_scalar]) -AC_MSG_NOTICE([Using endomorphism optimizations: $use_endomorphism]) -AC_MSG_NOTICE([Building for coverage analysis: $enable_coverage]) -AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh]) -AC_MSG_NOTICE([Building ECDSA pubkey recovery module: $enable_module_recovery]) -AC_MSG_NOTICE([Using jni: $use_jni]) - -if test x"$enable_experimental" = x"yes"; then - AC_MSG_NOTICE([******]) - AC_MSG_NOTICE([WARNING: experimental build]) - AC_MSG_NOTICE([Experimental features do not have stable APIs or properties, and may not be safe for production use.]) - AC_MSG_NOTICE([Building ECDH module: $enable_module_ecdh]) - AC_MSG_NOTICE([******]) -else - if test x"$enable_module_ecdh" = x"yes"; then - AC_MSG_ERROR([ECDH module is experimental. Use --enable-experimental to allow.]) - fi - if test x"$set_asm" = x"arm"; then - AC_MSG_ERROR([ARM assembly optimization is experimental. Use --enable-experimental to allow.]) - fi -fi - -AC_CONFIG_HEADERS([src/libsecp256k1-config.h]) -AC_CONFIG_FILES([Makefile libsecp256k1.pc]) -AC_SUBST(JNI_INCLUDES) -AC_SUBST(SECP_INCLUDES) -AC_SUBST(SECP_LIBS) -AC_SUBST(SECP_TEST_LIBS) -AC_SUBST(SECP_TEST_INCLUDES) -AM_CONDITIONAL([ENABLE_COVERAGE], [test x"$enable_coverage" = x"yes"]) -AM_CONDITIONAL([USE_TESTS], [test x"$use_tests" != x"no"]) -AM_CONDITIONAL([USE_EXHAUSTIVE_TESTS], [test x"$use_exhaustive_tests" != x"no"]) -AM_CONDITIONAL([USE_BENCHMARK], [test x"$use_benchmark" = x"yes"]) -AM_CONDITIONAL([USE_ECMULT_STATIC_PRECOMPUTATION], [test x"$set_precomp" = x"yes"]) -AM_CONDITIONAL([ENABLE_MODULE_ECDH], [test x"$enable_module_ecdh" = x"yes"]) -AM_CONDITIONAL([ENABLE_MODULE_RECOVERY], [test x"$enable_module_recovery" = x"yes"]) -AM_CONDITIONAL([USE_JNI], [test x"$use_jni" == x"yes"]) -AM_CONDITIONAL([USE_EXTERNAL_ASM], [test x"$use_external_asm" = x"yes"]) -AM_CONDITIONAL([USE_ASM_ARM], [test x"$set_asm" = x"arm"]) - -dnl make sure nothing new is exported so that we don't break the cache -PKGCONFIG_PATH_TEMP="$PKG_CONFIG_PATH" -unset PKG_CONFIG_PATH -PKG_CONFIG_PATH="$PKGCONFIG_PATH_TEMP" - -AC_OUTPUT diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c deleted file mode 100644 index 5b141a99..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.c +++ /dev/null @@ -1,150 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "lax_der_parsing.h" - -int ecdsa_signature_parse_der_lax(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) { - size_t rpos, rlen, spos, slen; - size_t pos = 0; - size_t lenbyte; - unsigned char tmpsig[64] = {0}; - int overflow = 0; - - /* Hack to initialize sig with a correctly-parsed but invalid signature. */ - secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); - - /* Sequence tag byte */ - if (pos == inputlen || input[pos] != 0x30) { - return 0; - } - pos++; - - /* Sequence length bytes */ - if (pos == inputlen) { - return 0; - } - lenbyte = input[pos++]; - if (lenbyte & 0x80) { - lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { - return 0; - } - pos += lenbyte; - } - - /* Integer tag byte for R */ - if (pos == inputlen || input[pos] != 0x02) { - return 0; - } - pos++; - - /* Integer length for R */ - if (pos == inputlen) { - return 0; - } - lenbyte = input[pos++]; - if (lenbyte & 0x80) { - lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { - return 0; - } - while (lenbyte > 0 && input[pos] == 0) { - pos++; - lenbyte--; - } - if (lenbyte >= sizeof(size_t)) { - return 0; - } - rlen = 0; - while (lenbyte > 0) { - rlen = (rlen << 8) + input[pos]; - pos++; - lenbyte--; - } - } else { - rlen = lenbyte; - } - if (rlen > inputlen - pos) { - return 0; - } - rpos = pos; - pos += rlen; - - /* Integer tag byte for S */ - if (pos == inputlen || input[pos] != 0x02) { - return 0; - } - pos++; - - /* Integer length for S */ - if (pos == inputlen) { - return 0; - } - lenbyte = input[pos++]; - if (lenbyte & 0x80) { - lenbyte -= 0x80; - if (pos + lenbyte > inputlen) { - return 0; - } - while (lenbyte > 0 && input[pos] == 0) { - pos++; - lenbyte--; - } - if (lenbyte >= sizeof(size_t)) { - return 0; - } - slen = 0; - while (lenbyte > 0) { - slen = (slen << 8) + input[pos]; - pos++; - lenbyte--; - } - } else { - slen = lenbyte; - } - if (slen > inputlen - pos) { - return 0; - } - spos = pos; - pos += slen; - - /* Ignore leading zeroes in R */ - while (rlen > 0 && input[rpos] == 0) { - rlen--; - rpos++; - } - /* Copy R value */ - if (rlen > 32) { - overflow = 1; - } else { - memcpy(tmpsig + 32 - rlen, input + rpos, rlen); - } - - /* Ignore leading zeroes in S */ - while (slen > 0 && input[spos] == 0) { - slen--; - spos++; - } - /* Copy S value */ - if (slen > 32) { - overflow = 1; - } else { - memcpy(tmpsig + 64 - slen, input + spos, slen); - } - - if (!overflow) { - overflow = !secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); - } - if (overflow) { - memset(tmpsig, 0, 64); - secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig); - } - return 1; -} - diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h deleted file mode 100644 index 6d27871a..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_parsing.h +++ /dev/null @@ -1,91 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -/**** - * Please do not link this file directly. It is not part of the libsecp256k1 - * project and does not promise any stability in its API, functionality or - * presence. Projects which use this code should instead copy this header - * and its accompanying .c file directly into their codebase. - ****/ - -/* This file defines a function that parses DER with various errors and - * violations. This is not a part of the library itself, because the allowed - * violations are chosen arbitrarily and do not follow or establish any - * standard. - * - * In many places it matters that different implementations do not only accept - * the same set of valid signatures, but also reject the same set of signatures. - * The only means to accomplish that is by strictly obeying a standard, and not - * accepting anything else. - * - * Nonetheless, sometimes there is a need for compatibility with systems that - * use signatures which do not strictly obey DER. The snippet below shows how - * certain violations are easily supported. You may need to adapt it. - * - * Do not use this for new systems. Use well-defined DER or compact signatures - * instead if you have the choice (see secp256k1_ecdsa_signature_parse_der and - * secp256k1_ecdsa_signature_parse_compact). - * - * The supported violations are: - * - All numbers are parsed as nonnegative integers, even though X.609-0207 - * section 8.3.3 specifies that integers are always encoded as two's - * complement. - * - Integers can have length 0, even though section 8.3.1 says they can't. - * - Integers with overly long padding are accepted, violation section - * 8.3.2. - * - 127-byte long length descriptors are accepted, even though section - * 8.1.3.5.c says that they are not. - * - Trailing garbage data inside or after the signature is ignored. - * - The length descriptor of the sequence is ignored. - * - * Compared to for example OpenSSL, many violations are NOT supported: - * - Using overly long tag descriptors for the sequence or integers inside, - * violating section 8.1.2.2. - * - Encoding primitive integers as constructed values, violating section - * 8.3.1. - */ - -#ifndef _SECP256K1_CONTRIB_LAX_DER_PARSING_H_ -#define _SECP256K1_CONTRIB_LAX_DER_PARSING_H_ - -#include - -# ifdef __cplusplus -extern "C" { -# endif - -/** Parse a signature in "lax DER" format - * - * Returns: 1 when the signature could be parsed, 0 otherwise. - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input: a pointer to the signature to be parsed - * inputlen: the length of the array pointed to be input - * - * This function will accept any valid DER encoded signature, even if the - * encoded numbers are out of range. In addition, it will accept signatures - * which violate the DER spec in various ways. Its purpose is to allow - * validation of the Bitcoin blockchain, which includes non-DER signatures - * from before the network rules were updated to enforce DER. Note that - * the set of supported violations is a strict subset of what OpenSSL will - * accept. - * - * After the call, sig will always be initialized. If parsing failed or the - * encoded numbers are out of range, signature validation with it is - * guaranteed to fail for every message and public key. - */ -int ecdsa_signature_parse_der_lax( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const unsigned char *input, - size_t inputlen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c deleted file mode 100644 index c2e63b4b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.c +++ /dev/null @@ -1,113 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014, 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "lax_der_privatekey_parsing.h" - -int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) { - const unsigned char *end = privkey + privkeylen; - int lenb = 0; - int len = 0; - memset(out32, 0, 32); - /* sequence header */ - if (end < privkey+1 || *privkey != 0x30) { - return 0; - } - privkey++; - /* sequence length constructor */ - if (end < privkey+1 || !(*privkey & 0x80)) { - return 0; - } - lenb = *privkey & ~0x80; privkey++; - if (lenb < 1 || lenb > 2) { - return 0; - } - if (end < privkey+lenb) { - return 0; - } - /* sequence length */ - len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0); - privkey += lenb; - if (end < privkey+len) { - return 0; - } - /* sequence element 0: version number (=1) */ - if (end < privkey+3 || privkey[0] != 0x02 || privkey[1] != 0x01 || privkey[2] != 0x01) { - return 0; - } - privkey += 3; - /* sequence element 1: octet string, up to 32 bytes */ - if (end < privkey+2 || privkey[0] != 0x04 || privkey[1] > 0x20 || end < privkey+2+privkey[1]) { - return 0; - } - memcpy(out32 + 32 - privkey[1], privkey + 2, privkey[1]); - if (!secp256k1_ec_seckey_verify(ctx, out32)) { - memset(out32, 0, 32); - return 0; - } - return 1; -} - -int ec_privkey_export_der(const secp256k1_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) { - secp256k1_pubkey pubkey; - size_t pubkeylen = 0; - if (!secp256k1_ec_pubkey_create(ctx, &pubkey, key32)) { - *privkeylen = 0; - return 0; - } - if (compressed) { - static const unsigned char begin[] = { - 0x30,0x81,0xD3,0x02,0x01,0x01,0x04,0x20 - }; - static const unsigned char middle[] = { - 0xA0,0x81,0x85,0x30,0x81,0x82,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48, - 0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04, - 0x21,0x02,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87, - 0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8, - 0x17,0x98,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E, - 0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x24,0x03,0x22,0x00 - }; - unsigned char *ptr = privkey; - memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin); - memcpy(ptr, key32, 32); ptr += 32; - memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle); - pubkeylen = 33; - secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED); - ptr += pubkeylen; - *privkeylen = ptr - privkey; - } else { - static const unsigned char begin[] = { - 0x30,0x82,0x01,0x13,0x02,0x01,0x01,0x04,0x20 - }; - static const unsigned char middle[] = { - 0xA0,0x81,0xA5,0x30,0x81,0xA2,0x02,0x01,0x01,0x30,0x2C,0x06,0x07,0x2A,0x86,0x48, - 0xCE,0x3D,0x01,0x01,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F,0x30,0x06,0x04,0x01,0x00,0x04,0x01,0x07,0x04, - 0x41,0x04,0x79,0xBE,0x66,0x7E,0xF9,0xDC,0xBB,0xAC,0x55,0xA0,0x62,0x95,0xCE,0x87, - 0x0B,0x07,0x02,0x9B,0xFC,0xDB,0x2D,0xCE,0x28,0xD9,0x59,0xF2,0x81,0x5B,0x16,0xF8, - 0x17,0x98,0x48,0x3A,0xDA,0x77,0x26,0xA3,0xC4,0x65,0x5D,0xA4,0xFB,0xFC,0x0E,0x11, - 0x08,0xA8,0xFD,0x17,0xB4,0x48,0xA6,0x85,0x54,0x19,0x9C,0x47,0xD0,0x8F,0xFB,0x10, - 0xD4,0xB8,0x02,0x21,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFE,0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,0xBF,0xD2,0x5E, - 0x8C,0xD0,0x36,0x41,0x41,0x02,0x01,0x01,0xA1,0x44,0x03,0x42,0x00 - }; - unsigned char *ptr = privkey; - memcpy(ptr, begin, sizeof(begin)); ptr += sizeof(begin); - memcpy(ptr, key32, 32); ptr += 32; - memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle); - pubkeylen = 65; - secp256k1_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED); - ptr += pubkeylen; - *privkeylen = ptr - privkey; - } - return 1; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h deleted file mode 100644 index 2fd088f8..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/contrib/lax_der_privatekey_parsing.h +++ /dev/null @@ -1,90 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014, 2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -/**** - * Please do not link this file directly. It is not part of the libsecp256k1 - * project and does not promise any stability in its API, functionality or - * presence. Projects which use this code should instead copy this header - * and its accompanying .c file directly into their codebase. - ****/ - -/* This file contains code snippets that parse DER private keys with - * various errors and violations. This is not a part of the library - * itself, because the allowed violations are chosen arbitrarily and - * do not follow or establish any standard. - * - * It also contains code to serialize private keys in a compatible - * manner. - * - * These functions are meant for compatibility with applications - * that require BER encoded keys. When working with secp256k1-specific - * code, the simple 32-byte private keys normally used by the - * library are sufficient. - */ - -#ifndef _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_ -#define _SECP256K1_CONTRIB_BER_PRIVATEKEY_H_ - -#include - -# ifdef __cplusplus -extern "C" { -# endif - -/** Export a private key in DER format. - * - * Returns: 1 if the private key was valid. - * Args: ctx: pointer to a context object, initialized for signing (cannot - * be NULL) - * Out: privkey: pointer to an array for storing the private key in BER. - * Should have space for 279 bytes, and cannot be NULL. - * privkeylen: Pointer to an int where the length of the private key in - * privkey will be stored. - * In: seckey: pointer to a 32-byte secret key to export. - * compressed: 1 if the key should be exported in - * compressed format, 0 otherwise - * - * This function is purely meant for compatibility with applications that - * require BER encoded keys. When working with secp256k1-specific code, the - * simple 32-byte private keys are sufficient. - * - * Note that this function does not guarantee correct DER output. It is - * guaranteed to be parsable by secp256k1_ec_privkey_import_der - */ -SECP256K1_WARN_UNUSED_RESULT int ec_privkey_export_der( - const secp256k1_context* ctx, - unsigned char *privkey, - size_t *privkeylen, - const unsigned char *seckey, - int compressed -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Import a private key in DER format. - * Returns: 1 if a private key was extracted. - * Args: ctx: pointer to a context object (cannot be NULL). - * Out: seckey: pointer to a 32-byte array for storing the private key. - * (cannot be NULL). - * In: privkey: pointer to a private key in DER format (cannot be NULL). - * privkeylen: length of the DER private key pointed to be privkey. - * - * This function will accept more than just strict DER, and even allow some BER - * violations. The public key stored inside the DER-encoded private key is not - * verified for correctness, nor are the curve parameters. Use this function - * only if you know in advance it is supposed to contain a secp256k1 private - * key. - */ -SECP256K1_WARN_UNUSED_RESULT int ec_privkey_import_der( - const secp256k1_context* ctx, - unsigned char *seckey, - const unsigned char *privkey, - size_t privkeylen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h deleted file mode 100644 index f268e309..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1.h +++ /dev/null @@ -1,577 +0,0 @@ -#ifndef _SECP256K1_ -# define _SECP256K1_ - -# ifdef __cplusplus -extern "C" { -# endif - -#include - -/* These rules specify the order of arguments in API calls: - * - * 1. Context pointers go first, followed by output arguments, combined - * output/input arguments, and finally input-only arguments. - * 2. Array lengths always immediately the follow the argument whose length - * they describe, even if this violates rule 1. - * 3. Within the OUT/OUTIN/IN groups, pointers to data that is typically generated - * later go first. This means: signatures, public nonces, private nonces, - * messages, public keys, secret keys, tweaks. - * 4. Arguments that are not data pointers go last, from more complex to less - * complex: function pointers, algorithm names, messages, void pointers, - * counts, flags, booleans. - * 5. Opaque data pointers follow the function pointer they are to be passed to. - */ - -/** Opaque data structure that holds context information (precomputed tables etc.). - * - * The purpose of context structures is to cache large precomputed data tables - * that are expensive to construct, and also to maintain the randomization data - * for blinding. - * - * Do not create a new context object for each operation, as construction is - * far slower than all other API calls (~100 times slower than an ECDSA - * verification). - * - * A constructed context can safely be used from multiple threads - * simultaneously, but API call that take a non-const pointer to a context - * need exclusive access to it. In particular this is the case for - * secp256k1_context_destroy and secp256k1_context_randomize. - * - * Regarding randomization, either do it once at creation time (in which case - * you do not need any locking for the other calls), or use a read-write lock. - */ -typedef struct secp256k1_context_struct secp256k1_context; - -/** Opaque data structure that holds a parsed and valid public key. - * - * The exact representation of data inside is implementation defined and not - * guaranteed to be portable between different platforms or versions. It is - * however guaranteed to be 64 bytes in size, and can be safely copied/moved. - * If you need to convert to a format suitable for storage, transmission, or - * comparison, use secp256k1_ec_pubkey_serialize and secp256k1_ec_pubkey_parse. - */ -typedef struct { - unsigned char data[64]; -} secp256k1_pubkey; - -/** Opaque data structured that holds a parsed ECDSA signature. - * - * The exact representation of data inside is implementation defined and not - * guaranteed to be portable between different platforms or versions. It is - * however guaranteed to be 64 bytes in size, and can be safely copied/moved. - * If you need to convert to a format suitable for storage, transmission, or - * comparison, use the secp256k1_ecdsa_signature_serialize_* and - * secp256k1_ecdsa_signature_serialize_* functions. - */ -typedef struct { - unsigned char data[64]; -} secp256k1_ecdsa_signature; - -/** A pointer to a function to deterministically generate a nonce. - * - * Returns: 1 if a nonce was successfully generated. 0 will cause signing to fail. - * Out: nonce32: pointer to a 32-byte array to be filled by the function. - * In: msg32: the 32-byte message hash being verified (will not be NULL) - * key32: pointer to a 32-byte secret key (will not be NULL) - * algo16: pointer to a 16-byte array describing the signature - * algorithm (will be NULL for ECDSA for compatibility). - * data: Arbitrary data pointer that is passed through. - * attempt: how many iterations we have tried to find a nonce. - * This will almost always be 0, but different attempt values - * are required to result in a different nonce. - * - * Except for test cases, this function should compute some cryptographic hash of - * the message, the algorithm, the key and the attempt. - */ -typedef int (*secp256k1_nonce_function)( - unsigned char *nonce32, - const unsigned char *msg32, - const unsigned char *key32, - const unsigned char *algo16, - void *data, - unsigned int attempt -); - -# if !defined(SECP256K1_GNUC_PREREQ) -# if defined(__GNUC__)&&defined(__GNUC_MINOR__) -# define SECP256K1_GNUC_PREREQ(_maj,_min) \ - ((__GNUC__<<16)+__GNUC_MINOR__>=((_maj)<<16)+(_min)) -# else -# define SECP256K1_GNUC_PREREQ(_maj,_min) 0 -# endif -# endif - -# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) ) -# if SECP256K1_GNUC_PREREQ(2,7) -# define SECP256K1_INLINE __inline__ -# elif (defined(_MSC_VER)) -# define SECP256K1_INLINE __inline -# else -# define SECP256K1_INLINE -# endif -# else -# define SECP256K1_INLINE inline -# endif - -#ifndef SECP256K1_API -# if defined(_WIN32) -# ifdef SECP256K1_BUILD -# define SECP256K1_API __declspec(dllexport) -# else -# define SECP256K1_API -# endif -# elif defined(__GNUC__) && defined(SECP256K1_BUILD) -# define SECP256K1_API __attribute__ ((visibility ("default"))) -# else -# define SECP256K1_API -# endif -#endif - -/**Warning attributes - * NONNULL is not used if SECP256K1_BUILD is set to avoid the compiler optimizing out - * some paranoid null checks. */ -# if defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4) -# define SECP256K1_WARN_UNUSED_RESULT __attribute__ ((__warn_unused_result__)) -# else -# define SECP256K1_WARN_UNUSED_RESULT -# endif -# if !defined(SECP256K1_BUILD) && defined(__GNUC__) && SECP256K1_GNUC_PREREQ(3, 4) -# define SECP256K1_ARG_NONNULL(_x) __attribute__ ((__nonnull__(_x))) -# else -# define SECP256K1_ARG_NONNULL(_x) -# endif - -/** All flags' lower 8 bits indicate what they're for. Do not use directly. */ -#define SECP256K1_FLAGS_TYPE_MASK ((1 << 8) - 1) -#define SECP256K1_FLAGS_TYPE_CONTEXT (1 << 0) -#define SECP256K1_FLAGS_TYPE_COMPRESSION (1 << 1) -/** The higher bits contain the actual data. Do not use directly. */ -#define SECP256K1_FLAGS_BIT_CONTEXT_VERIFY (1 << 8) -#define SECP256K1_FLAGS_BIT_CONTEXT_SIGN (1 << 9) -#define SECP256K1_FLAGS_BIT_COMPRESSION (1 << 8) - -/** Flags to pass to secp256k1_context_create. */ -#define SECP256K1_CONTEXT_VERIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY) -#define SECP256K1_CONTEXT_SIGN (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN) -#define SECP256K1_CONTEXT_NONE (SECP256K1_FLAGS_TYPE_CONTEXT) - -/** Flag to pass to secp256k1_ec_pubkey_serialize and secp256k1_ec_privkey_export. */ -#define SECP256K1_EC_COMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION) -#define SECP256K1_EC_UNCOMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION) - -/** Create a secp256k1 context object. - * - * Returns: a newly created context object. - * In: flags: which parts of the context to initialize. - */ -SECP256K1_API secp256k1_context* secp256k1_context_create( - unsigned int flags -) SECP256K1_WARN_UNUSED_RESULT; - -/** Copies a secp256k1 context object. - * - * Returns: a newly created context object. - * Args: ctx: an existing context to copy (cannot be NULL) - */ -SECP256K1_API secp256k1_context* secp256k1_context_clone( - const secp256k1_context* ctx -) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT; - -/** Destroy a secp256k1 context object. - * - * The context pointer may not be used afterwards. - * Args: ctx: an existing context to destroy (cannot be NULL) - */ -SECP256K1_API void secp256k1_context_destroy( - secp256k1_context* ctx -); - -/** Set a callback function to be called when an illegal argument is passed to - * an API call. It will only trigger for violations that are mentioned - * explicitly in the header. - * - * The philosophy is that these shouldn't be dealt with through a - * specific return value, as calling code should not have branches to deal with - * the case that this code itself is broken. - * - * On the other hand, during debug stage, one would want to be informed about - * such mistakes, and the default (crashing) may be inadvisable. - * When this callback is triggered, the API function called is guaranteed not - * to cause a crash, though its return value and output arguments are - * undefined. - * - * Args: ctx: an existing context object (cannot be NULL) - * In: fun: a pointer to a function to call when an illegal argument is - * passed to the API, taking a message and an opaque pointer - * (NULL restores a default handler that calls abort). - * data: the opaque pointer to pass to fun above. - */ -SECP256K1_API void secp256k1_context_set_illegal_callback( - secp256k1_context* ctx, - void (*fun)(const char* message, void* data), - const void* data -) SECP256K1_ARG_NONNULL(1); - -/** Set a callback function to be called when an internal consistency check - * fails. The default is crashing. - * - * This can only trigger in case of a hardware failure, miscompilation, - * memory corruption, serious bug in the library, or other error would can - * otherwise result in undefined behaviour. It will not trigger due to mere - * incorrect usage of the API (see secp256k1_context_set_illegal_callback - * for that). After this callback returns, anything may happen, including - * crashing. - * - * Args: ctx: an existing context object (cannot be NULL) - * In: fun: a pointer to a function to call when an internal error occurs, - * taking a message and an opaque pointer (NULL restores a default - * handler that calls abort). - * data: the opaque pointer to pass to fun above. - */ -SECP256K1_API void secp256k1_context_set_error_callback( - secp256k1_context* ctx, - void (*fun)(const char* message, void* data), - const void* data -) SECP256K1_ARG_NONNULL(1); - -/** Parse a variable-length public key into the pubkey object. - * - * Returns: 1 if the public key was fully valid. - * 0 if the public key could not be parsed or is invalid. - * Args: ctx: a secp256k1 context object. - * Out: pubkey: pointer to a pubkey object. If 1 is returned, it is set to a - * parsed version of input. If not, its value is undefined. - * In: input: pointer to a serialized public key - * inputlen: length of the array pointed to by input - * - * This function supports parsing compressed (33 bytes, header byte 0x02 or - * 0x03), uncompressed (65 bytes, header byte 0x04), or hybrid (65 bytes, header - * byte 0x06 or 0x07) format public keys. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse( - const secp256k1_context* ctx, - secp256k1_pubkey* pubkey, - const unsigned char *input, - size_t inputlen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Serialize a pubkey object into a serialized byte sequence. - * - * Returns: 1 always. - * Args: ctx: a secp256k1 context object. - * Out: output: a pointer to a 65-byte (if compressed==0) or 33-byte (if - * compressed==1) byte array to place the serialized key - * in. - * In/Out: outputlen: a pointer to an integer which is initially set to the - * size of output, and is overwritten with the written - * size. - * In: pubkey: a pointer to a secp256k1_pubkey containing an - * initialized public key. - * flags: SECP256K1_EC_COMPRESSED if serialization should be in - * compressed format, otherwise SECP256K1_EC_UNCOMPRESSED. - */ -SECP256K1_API int secp256k1_ec_pubkey_serialize( - const secp256k1_context* ctx, - unsigned char *output, - size_t *outputlen, - const secp256k1_pubkey* pubkey, - unsigned int flags -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Parse an ECDSA signature in compact (64 bytes) format. - * - * Returns: 1 when the signature could be parsed, 0 otherwise. - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input64: a pointer to the 64-byte array to parse - * - * The signature must consist of a 32-byte big endian R value, followed by a - * 32-byte big endian S value. If R or S fall outside of [0..order-1], the - * encoding is invalid. R and S with value 0 are allowed in the encoding. - * - * After the call, sig will always be initialized. If parsing failed or R or - * S are zero, the resulting sig value is guaranteed to fail validation for any - * message and public key. - */ -SECP256K1_API int secp256k1_ecdsa_signature_parse_compact( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const unsigned char *input64 -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Parse a DER ECDSA signature. - * - * Returns: 1 when the signature could be parsed, 0 otherwise. - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input: a pointer to the signature to be parsed - * inputlen: the length of the array pointed to be input - * - * This function will accept any valid DER encoded signature, even if the - * encoded numbers are out of range. - * - * After the call, sig will always be initialized. If parsing failed or the - * encoded numbers are out of range, signature validation with it is - * guaranteed to fail for every message and public key. - */ -SECP256K1_API int secp256k1_ecdsa_signature_parse_der( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const unsigned char *input, - size_t inputlen -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Serialize an ECDSA signature in DER format. - * - * Returns: 1 if enough space was available to serialize, 0 otherwise - * Args: ctx: a secp256k1 context object - * Out: output: a pointer to an array to store the DER serialization - * In/Out: outputlen: a pointer to a length integer. Initially, this integer - * should be set to the length of output. After the call - * it will be set to the length of the serialization (even - * if 0 was returned). - * In: sig: a pointer to an initialized signature object - */ -SECP256K1_API int secp256k1_ecdsa_signature_serialize_der( - const secp256k1_context* ctx, - unsigned char *output, - size_t *outputlen, - const secp256k1_ecdsa_signature* sig -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Serialize an ECDSA signature in compact (64 byte) format. - * - * Returns: 1 - * Args: ctx: a secp256k1 context object - * Out: output64: a pointer to a 64-byte array to store the compact serialization - * In: sig: a pointer to an initialized signature object - * - * See secp256k1_ecdsa_signature_parse_compact for details about the encoding. - */ -SECP256K1_API int secp256k1_ecdsa_signature_serialize_compact( - const secp256k1_context* ctx, - unsigned char *output64, - const secp256k1_ecdsa_signature* sig -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Verify an ECDSA signature. - * - * Returns: 1: correct signature - * 0: incorrect or unparseable signature - * Args: ctx: a secp256k1 context object, initialized for verification. - * In: sig: the signature being verified (cannot be NULL) - * msg32: the 32-byte message hash being verified (cannot be NULL) - * pubkey: pointer to an initialized public key to verify with (cannot be NULL) - * - * To avoid accepting malleable signatures, only ECDSA signatures in lower-S - * form are accepted. - * - * If you need to accept ECDSA signatures from sources that do not obey this - * rule, apply secp256k1_ecdsa_signature_normalize to the signature prior to - * validation, but be aware that doing so results in malleable signatures. - * - * For details, see the comments for that function. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_verify( - const secp256k1_context* ctx, - const secp256k1_ecdsa_signature *sig, - const unsigned char *msg32, - const secp256k1_pubkey *pubkey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Convert a signature to a normalized lower-S form. - * - * Returns: 1 if sigin was not normalized, 0 if it already was. - * Args: ctx: a secp256k1 context object - * Out: sigout: a pointer to a signature to fill with the normalized form, - * or copy if the input was already normalized. (can be NULL if - * you're only interested in whether the input was already - * normalized). - * In: sigin: a pointer to a signature to check/normalize (cannot be NULL, - * can be identical to sigout) - * - * With ECDSA a third-party can forge a second distinct signature of the same - * message, given a single initial signature, but without knowing the key. This - * is done by negating the S value modulo the order of the curve, 'flipping' - * the sign of the random point R which is not included in the signature. - * - * Forgery of the same message isn't universally problematic, but in systems - * where message malleability or uniqueness of signatures is important this can - * cause issues. This forgery can be blocked by all verifiers forcing signers - * to use a normalized form. - * - * The lower-S form reduces the size of signatures slightly on average when - * variable length encodings (such as DER) are used and is cheap to verify, - * making it a good choice. Security of always using lower-S is assured because - * anyone can trivially modify a signature after the fact to enforce this - * property anyway. - * - * The lower S value is always between 0x1 and - * 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, - * inclusive. - * - * No other forms of ECDSA malleability are known and none seem likely, but - * there is no formal proof that ECDSA, even with this additional restriction, - * is free of other malleability. Commonly used serialization schemes will also - * accept various non-unique encodings, so care should be taken when this - * property is required for an application. - * - * The secp256k1_ecdsa_sign function will by default create signatures in the - * lower-S form, and secp256k1_ecdsa_verify will not accept others. In case - * signatures come from a system that cannot enforce this property, - * secp256k1_ecdsa_signature_normalize must be called before verification. - */ -SECP256K1_API int secp256k1_ecdsa_signature_normalize( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature *sigout, - const secp256k1_ecdsa_signature *sigin -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(3); - -/** An implementation of RFC6979 (using HMAC-SHA256) as nonce generation function. - * If a data pointer is passed, it is assumed to be a pointer to 32 bytes of - * extra entropy. - */ -SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_rfc6979; - -/** A default safe nonce generation function (currently equal to secp256k1_nonce_function_rfc6979). */ -SECP256K1_API extern const secp256k1_nonce_function secp256k1_nonce_function_default; - -/** Create an ECDSA signature. - * - * Returns: 1: signature created - * 0: the nonce generation function failed, or the private key was invalid. - * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) - * Out: sig: pointer to an array where the signature will be placed (cannot be NULL) - * In: msg32: the 32-byte message hash being signed (cannot be NULL) - * seckey: pointer to a 32-byte secret key (cannot be NULL) - * noncefp:pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used - * ndata: pointer to arbitrary data used by the nonce generation function (can be NULL) - * - * The created signature is always in lower-S form. See - * secp256k1_ecdsa_signature_normalize for more details. - */ -SECP256K1_API int secp256k1_ecdsa_sign( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature *sig, - const unsigned char *msg32, - const unsigned char *seckey, - secp256k1_nonce_function noncefp, - const void *ndata -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Verify an ECDSA secret key. - * - * Returns: 1: secret key is valid - * 0: secret key is invalid - * Args: ctx: pointer to a context object (cannot be NULL) - * In: seckey: pointer to a 32-byte secret key (cannot be NULL) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_seckey_verify( - const secp256k1_context* ctx, - const unsigned char *seckey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2); - -/** Compute the public key for a secret key. - * - * Returns: 1: secret was valid, public key stores - * 0: secret was invalid, try again - * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) - * Out: pubkey: pointer to the created public key (cannot be NULL) - * In: seckey: pointer to a 32-byte private key (cannot be NULL) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_create( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const unsigned char *seckey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a private key by adding tweak to it. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or if the resulting private key - * would be invalid (only when the tweak is the complement of the - * private key). 1 otherwise. - * Args: ctx: pointer to a context object (cannot be NULL). - * In/Out: seckey: pointer to a 32-byte private key. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_add( - const secp256k1_context* ctx, - unsigned char *seckey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a public key by adding tweak times the generator to it. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or if the resulting public key - * would be invalid (only when the tweak is the complement of the - * corresponding private key). 1 otherwise. - * Args: ctx: pointer to a context object initialized for validation - * (cannot be NULL). - * In/Out: pubkey: pointer to a public key object. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_add( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a private key by multiplying it by a tweak. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or equal to zero. 1 otherwise. - * Args: ctx: pointer to a context object (cannot be NULL). - * In/Out: seckey: pointer to a 32-byte private key. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_privkey_tweak_mul( - const secp256k1_context* ctx, - unsigned char *seckey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Tweak a public key by multiplying it by a tweak value. - * Returns: 0 if the tweak was out of range (chance of around 1 in 2^128 for - * uniformly random 32-byte arrays, or equal to zero. 1 otherwise. - * Args: ctx: pointer to a context object initialized for validation - * (cannot be NULL). - * In/Out: pubkey: pointer to a public key obkect. - * In: tweak: pointer to a 32-byte tweak. - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_tweak_mul( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const unsigned char *tweak -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Updates the context randomization. - * Returns: 1: randomization successfully updated - * 0: error - * Args: ctx: pointer to a context object (cannot be NULL) - * In: seed32: pointer to a 32-byte random seed (NULL resets to initial state) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_context_randomize( - secp256k1_context* ctx, - const unsigned char *seed32 -) SECP256K1_ARG_NONNULL(1); - -/** Add a number of public keys together. - * Returns: 1: the sum of the public keys is valid. - * 0: the sum of the public keys is not valid. - * Args: ctx: pointer to a context object - * Out: out: pointer to a public key object for placing the resulting public key - * (cannot be NULL) - * In: ins: pointer to array of pointers to public keys (cannot be NULL) - * n: the number of public keys to add together (must be at least 1) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_combine( - const secp256k1_context* ctx, - secp256k1_pubkey *out, - const secp256k1_pubkey * const * ins, - size_t n -) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h deleted file mode 100644 index 4b84d7a9..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_ecdh.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _SECP256K1_ECDH_ -# define _SECP256K1_ECDH_ - -# include "secp256k1.h" - -# ifdef __cplusplus -extern "C" { -# endif - -/** Compute an EC Diffie-Hellman secret in constant time - * Returns: 1: exponentiation was successful - * 0: scalar was invalid (zero or overflow) - * Args: ctx: pointer to a context object (cannot be NULL) - * Out: result: a 32-byte array which will be populated by an ECDH - * secret computed from the point and scalar - * In: pubkey: a pointer to a secp256k1_pubkey containing an - * initialized public key - * privkey: a 32-byte scalar with which to multiply the point - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdh( - const secp256k1_context* ctx, - unsigned char *result, - const secp256k1_pubkey *pubkey, - const unsigned char *privkey -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h deleted file mode 100644 index 05537972..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/include/secp256k1_recovery.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef _SECP256K1_RECOVERY_ -# define _SECP256K1_RECOVERY_ - -# include "secp256k1.h" - -# ifdef __cplusplus -extern "C" { -# endif - -/** Opaque data structured that holds a parsed ECDSA signature, - * supporting pubkey recovery. - * - * The exact representation of data inside is implementation defined and not - * guaranteed to be portable between different platforms or versions. It is - * however guaranteed to be 65 bytes in size, and can be safely copied/moved. - * If you need to convert to a format suitable for storage or transmission, use - * the secp256k1_ecdsa_signature_serialize_* and - * secp256k1_ecdsa_signature_parse_* functions. - * - * Furthermore, it is guaranteed that identical signatures (including their - * recoverability) will have identical representation, so they can be - * memcmp'ed. - */ -typedef struct { - unsigned char data[65]; -} secp256k1_ecdsa_recoverable_signature; - -/** Parse a compact ECDSA signature (64 bytes + recovery id). - * - * Returns: 1 when the signature could be parsed, 0 otherwise - * Args: ctx: a secp256k1 context object - * Out: sig: a pointer to a signature object - * In: input64: a pointer to a 64-byte compact signature - * recid: the recovery id (0, 1, 2 or 3) - */ -SECP256K1_API int secp256k1_ecdsa_recoverable_signature_parse_compact( - const secp256k1_context* ctx, - secp256k1_ecdsa_recoverable_signature* sig, - const unsigned char *input64, - int recid -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Convert a recoverable signature into a normal signature. - * - * Returns: 1 - * Out: sig: a pointer to a normal signature (cannot be NULL). - * In: sigin: a pointer to a recoverable signature (cannot be NULL). - */ -SECP256K1_API int secp256k1_ecdsa_recoverable_signature_convert( - const secp256k1_context* ctx, - secp256k1_ecdsa_signature* sig, - const secp256k1_ecdsa_recoverable_signature* sigin -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); - -/** Serialize an ECDSA signature in compact format (64 bytes + recovery id). - * - * Returns: 1 - * Args: ctx: a secp256k1 context object - * Out: output64: a pointer to a 64-byte array of the compact signature (cannot be NULL) - * recid: a pointer to an integer to hold the recovery id (can be NULL). - * In: sig: a pointer to an initialized signature object (cannot be NULL) - */ -SECP256K1_API int secp256k1_ecdsa_recoverable_signature_serialize_compact( - const secp256k1_context* ctx, - unsigned char *output64, - int *recid, - const secp256k1_ecdsa_recoverable_signature* sig -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Create a recoverable ECDSA signature. - * - * Returns: 1: signature created - * 0: the nonce generation function failed, or the private key was invalid. - * Args: ctx: pointer to a context object, initialized for signing (cannot be NULL) - * Out: sig: pointer to an array where the signature will be placed (cannot be NULL) - * In: msg32: the 32-byte message hash being signed (cannot be NULL) - * seckey: pointer to a 32-byte secret key (cannot be NULL) - * noncefp:pointer to a nonce generation function. If NULL, secp256k1_nonce_function_default is used - * ndata: pointer to arbitrary data used by the nonce generation function (can be NULL) - */ -SECP256K1_API int secp256k1_ecdsa_sign_recoverable( - const secp256k1_context* ctx, - secp256k1_ecdsa_recoverable_signature *sig, - const unsigned char *msg32, - const unsigned char *seckey, - secp256k1_nonce_function noncefp, - const void *ndata -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -/** Recover an ECDSA public key from a signature. - * - * Returns: 1: public key successfully recovered (which guarantees a correct signature). - * 0: otherwise. - * Args: ctx: pointer to a context object, initialized for verification (cannot be NULL) - * Out: pubkey: pointer to the recovered public key (cannot be NULL) - * In: sig: pointer to initialized signature that supports pubkey recovery (cannot be NULL) - * msg32: the 32-byte message hash assumed to be signed (cannot be NULL) - */ -SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ecdsa_recover( - const secp256k1_context* ctx, - secp256k1_pubkey *pubkey, - const secp256k1_ecdsa_recoverable_signature *sig, - const unsigned char *msg32 -) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4); - -# ifdef __cplusplus -} -# endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in deleted file mode 100644 index a0d006f1..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/libsecp256k1.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libsecp256k1 -Description: Optimized C library for EC operations on curve secp256k1 -URL: https://github.com/bitcoin-core/secp256k1 -Version: @PACKAGE_VERSION@ -Cflags: -I${includedir} -Libs.private: @SECP_LIBS@ -Libs: -L${libdir} -lsecp256k1 - diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/obj/.gitignore b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/obj/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage deleted file mode 100644 index ab580c5b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/group_prover.sage +++ /dev/null @@ -1,322 +0,0 @@ -# This code supports verifying group implementations which have branches -# or conditional statements (like cmovs), by allowing each execution path -# to independently set assumptions on input or intermediary variables. -# -# The general approach is: -# * A constraint is a tuple of two sets of of symbolic expressions: -# the first of which are required to evaluate to zero, the second of which -# are required to evaluate to nonzero. -# - A constraint is said to be conflicting if any of its nonzero expressions -# is in the ideal with basis the zero expressions (in other words: when the -# zero expressions imply that one of the nonzero expressions are zero). -# * There is a list of laws that describe the intended behaviour, including -# laws for addition and doubling. Each law is called with the symbolic point -# coordinates as arguments, and returns: -# - A constraint describing the assumptions under which it is applicable, -# called "assumeLaw" -# - A constraint describing the requirements of the law, called "require" -# * Implementations are transliterated into functions that operate as well on -# algebraic input points, and are called once per combination of branches -# exectured. Each execution returns: -# - A constraint describing the assumptions this implementation requires -# (such as Z1=1), called "assumeFormula" -# - A constraint describing the assumptions this specific branch requires, -# but which is by construction guaranteed to cover the entire space by -# merging the results from all branches, called "assumeBranch" -# - The result of the computation -# * All combinations of laws with implementation branches are tried, and: -# - If the combination of assumeLaw, assumeFormula, and assumeBranch results -# in a conflict, it means this law does not apply to this branch, and it is -# skipped. -# - For others, we try to prove the require constraints hold, assuming the -# information in assumeLaw + assumeFormula + assumeBranch, and if this does -# not succeed, we fail. -# + To prove an expression is zero, we check whether it belongs to the -# ideal with the assumed zero expressions as basis. This test is exact. -# + To prove an expression is nonzero, we check whether each of its -# factors is contained in the set of nonzero assumptions' factors. -# This test is not exact, so various combinations of original and -# reduced expressions' factors are tried. -# - If we succeed, we print out the assumptions from assumeFormula that -# weren't implied by assumeLaw already. Those from assumeBranch are skipped, -# as we assume that all constraints in it are complementary with each other. -# -# Based on the sage verification scripts used in the Explicit-Formulas Database -# by Tanja Lange and others, see http://hyperelliptic.org/EFD - -class fastfrac: - """Fractions over rings.""" - - def __init__(self,R,top,bot=1): - """Construct a fractional, given a ring, a numerator, and denominator.""" - self.R = R - if parent(top) == ZZ or parent(top) == R: - self.top = R(top) - self.bot = R(bot) - elif top.__class__ == fastfrac: - self.top = top.top - self.bot = top.bot * bot - else: - self.top = R(numerator(top)) - self.bot = R(denominator(top)) * bot - - def iszero(self,I): - """Return whether this fraction is zero given an ideal.""" - return self.top in I and self.bot not in I - - def reduce(self,assumeZero): - zero = self.R.ideal(map(numerator, assumeZero)) - return fastfrac(self.R, zero.reduce(self.top)) / fastfrac(self.R, zero.reduce(self.bot)) - - def __add__(self,other): - """Add two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top + self.bot * other,self.bot) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.bot + self.bot * other.top,self.bot * other.bot) - return NotImplemented - - def __sub__(self,other): - """Subtract two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top - self.bot * other,self.bot) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.bot - self.bot * other.top,self.bot * other.bot) - return NotImplemented - - def __neg__(self): - """Return the negation of a fraction.""" - return fastfrac(self.R,-self.top,self.bot) - - def __mul__(self,other): - """Multiply two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top * other,self.bot) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.top,self.bot * other.bot) - return NotImplemented - - def __rmul__(self,other): - """Multiply something else with a fraction.""" - return self.__mul__(other) - - def __div__(self,other): - """Divide two fractions.""" - if parent(other) == ZZ: - return fastfrac(self.R,self.top,self.bot * other) - if other.__class__ == fastfrac: - return fastfrac(self.R,self.top * other.bot,self.bot * other.top) - return NotImplemented - - def __pow__(self,other): - """Compute a power of a fraction.""" - if parent(other) == ZZ: - if other < 0: - # Negative powers require flipping top and bottom - return fastfrac(self.R,self.bot ^ (-other),self.top ^ (-other)) - else: - return fastfrac(self.R,self.top ^ other,self.bot ^ other) - return NotImplemented - - def __str__(self): - return "fastfrac((" + str(self.top) + ") / (" + str(self.bot) + "))" - def __repr__(self): - return "%s" % self - - def numerator(self): - return self.top - -class constraints: - """A set of constraints, consisting of zero and nonzero expressions. - - Constraints can either be used to express knowledge or a requirement. - - Both the fields zero and nonzero are maps from expressions to description - strings. The expressions that are the keys in zero are required to be zero, - and the expressions that are the keys in nonzero are required to be nonzero. - - Note that (a != 0) and (b != 0) is the same as (a*b != 0), so all keys in - nonzero could be multiplied into a single key. This is often much less - efficient to work with though, so we keep them separate inside the - constraints. This allows higher-level code to do fast checks on the individual - nonzero elements, or combine them if needed for stronger checks. - - We can't multiply the different zero elements, as it would suffice for one of - the factors to be zero, instead of all of them. Instead, the zero elements are - typically combined into an ideal first. - """ - - def __init__(self, **kwargs): - if 'zero' in kwargs: - self.zero = dict(kwargs['zero']) - else: - self.zero = dict() - if 'nonzero' in kwargs: - self.nonzero = dict(kwargs['nonzero']) - else: - self.nonzero = dict() - - def negate(self): - return constraints(zero=self.nonzero, nonzero=self.zero) - - def __add__(self, other): - zero = self.zero.copy() - zero.update(other.zero) - nonzero = self.nonzero.copy() - nonzero.update(other.nonzero) - return constraints(zero=zero, nonzero=nonzero) - - def __str__(self): - return "constraints(zero=%s,nonzero=%s)" % (self.zero, self.nonzero) - - def __repr__(self): - return "%s" % self - - -def conflicts(R, con): - """Check whether any of the passed non-zero assumptions is implied by the zero assumptions""" - zero = R.ideal(map(numerator, con.zero)) - if 1 in zero: - return True - # First a cheap check whether any of the individual nonzero terms conflict on - # their own. - for nonzero in con.nonzero: - if nonzero.iszero(zero): - return True - # It can be the case that entries in the nonzero set do not individually - # conflict with the zero set, but their combination does. For example, knowing - # that either x or y is zero is equivalent to having x*y in the zero set. - # Having x or y individually in the nonzero set is not a conflict, but both - # simultaneously is, so that is the right thing to check for. - if reduce(lambda a,b: a * b, con.nonzero, fastfrac(R, 1)).iszero(zero): - return True - return False - - -def get_nonzero_set(R, assume): - """Calculate a simple set of nonzero expressions""" - zero = R.ideal(map(numerator, assume.zero)) - nonzero = set() - for nz in map(numerator, assume.nonzero): - for (f,n) in nz.factor(): - nonzero.add(f) - rnz = zero.reduce(nz) - for (f,n) in rnz.factor(): - nonzero.add(f) - return nonzero - - -def prove_nonzero(R, exprs, assume): - """Check whether an expression is provably nonzero, given assumptions""" - zero = R.ideal(map(numerator, assume.zero)) - nonzero = get_nonzero_set(R, assume) - expl = set() - ok = True - for expr in exprs: - if numerator(expr) in zero: - return (False, [exprs[expr]]) - allexprs = reduce(lambda a,b: numerator(a)*numerator(b), exprs, 1) - for (f, n) in allexprs.factor(): - if f not in nonzero: - ok = False - if ok: - return (True, None) - ok = True - for (f, n) in zero.reduce(numerator(allexprs)).factor(): - if f not in nonzero: - ok = False - if ok: - return (True, None) - ok = True - for expr in exprs: - for (f,n) in numerator(expr).factor(): - if f not in nonzero: - ok = False - if ok: - return (True, None) - ok = True - for expr in exprs: - for (f,n) in zero.reduce(numerator(expr)).factor(): - if f not in nonzero: - expl.add(exprs[expr]) - if expl: - return (False, list(expl)) - else: - return (True, None) - - -def prove_zero(R, exprs, assume): - """Check whether all of the passed expressions are provably zero, given assumptions""" - r, e = prove_nonzero(R, dict(map(lambda x: (fastfrac(R, x.bot, 1), exprs[x]), exprs)), assume) - if not r: - return (False, map(lambda x: "Possibly zero denominator: %s" % x, e)) - zero = R.ideal(map(numerator, assume.zero)) - nonzero = prod(x for x in assume.nonzero) - expl = [] - for expr in exprs: - if not expr.iszero(zero): - expl.append(exprs[expr]) - if not expl: - return (True, None) - return (False, expl) - - -def describe_extra(R, assume, assumeExtra): - """Describe what assumptions are added, given existing assumptions""" - zerox = assume.zero.copy() - zerox.update(assumeExtra.zero) - zero = R.ideal(map(numerator, assume.zero)) - zeroextra = R.ideal(map(numerator, zerox)) - nonzero = get_nonzero_set(R, assume) - ret = set() - # Iterate over the extra zero expressions - for base in assumeExtra.zero: - if base not in zero: - add = [] - for (f, n) in numerator(base).factor(): - if f not in nonzero: - add += ["%s" % f] - if add: - ret.add((" * ".join(add)) + " = 0 [%s]" % assumeExtra.zero[base]) - # Iterate over the extra nonzero expressions - for nz in assumeExtra.nonzero: - nzr = zeroextra.reduce(numerator(nz)) - if nzr not in zeroextra: - for (f,n) in nzr.factor(): - if zeroextra.reduce(f) not in nonzero: - ret.add("%s != 0" % zeroextra.reduce(f)) - return ", ".join(x for x in ret) - - -def check_symbolic(R, assumeLaw, assumeAssert, assumeBranch, require): - """Check a set of zero and nonzero requirements, given a set of zero and nonzero assumptions""" - assume = assumeLaw + assumeAssert + assumeBranch - - if conflicts(R, assume): - # This formula does not apply - return None - - describe = describe_extra(R, assumeLaw + assumeBranch, assumeAssert) - - ok, msg = prove_zero(R, require.zero, assume) - if not ok: - return "FAIL, %s fails (assuming %s)" % (str(msg), describe) - - res, expl = prove_nonzero(R, require.nonzero, assume) - if not res: - return "FAIL, %s fails (assuming %s)" % (str(expl), describe) - - if describe != "": - return "OK (assuming %s)" % describe - else: - return "OK" - - -def concrete_verify(c): - for k in c.zero: - if k != 0: - return (False, c.zero[k]) - for k in c.nonzero: - if k == 0: - return (False, c.nonzero[k]) - return (True, None) diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage deleted file mode 100644 index a97e732f..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/secp256k1.sage +++ /dev/null @@ -1,306 +0,0 @@ -# Test libsecp256k1' group operation implementations using prover.sage - -import sys - -load("group_prover.sage") -load("weierstrass_prover.sage") - -def formula_secp256k1_gej_double_var(a): - """libsecp256k1's secp256k1_gej_double_var, used by various addition functions""" - rz = a.Z * a.Y - rz = rz * 2 - t1 = a.X^2 - t1 = t1 * 3 - t2 = t1^2 - t3 = a.Y^2 - t3 = t3 * 2 - t4 = t3^2 - t4 = t4 * 2 - t3 = t3 * a.X - rx = t3 - rx = rx * 4 - rx = -rx - rx = rx + t2 - t2 = -t2 - t3 = t3 * 6 - t3 = t3 + t2 - ry = t1 * t3 - t2 = -t4 - ry = ry + t2 - return jacobianpoint(rx, ry, rz) - -def formula_secp256k1_gej_add_var(branch, a, b): - """libsecp256k1's secp256k1_gej_add_var""" - if branch == 0: - return (constraints(), constraints(nonzero={a.Infinity : 'a_infinite'}), b) - if branch == 1: - return (constraints(), constraints(zero={a.Infinity : 'a_finite'}, nonzero={b.Infinity : 'b_infinite'}), a) - z22 = b.Z^2 - z12 = a.Z^2 - u1 = a.X * z22 - u2 = b.X * z12 - s1 = a.Y * z22 - s1 = s1 * b.Z - s2 = b.Y * z12 - s2 = s2 * a.Z - h = -u1 - h = h + u2 - i = -s1 - i = i + s2 - if branch == 2: - r = formula_secp256k1_gej_double_var(a) - return (constraints(), constraints(zero={h : 'h=0', i : 'i=0', a.Infinity : 'a_finite', b.Infinity : 'b_finite'}), r) - if branch == 3: - return (constraints(), constraints(zero={h : 'h=0', a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={i : 'i!=0'}), point_at_infinity()) - i2 = i^2 - h2 = h^2 - h3 = h2 * h - h = h * b.Z - rz = a.Z * h - t = u1 * h2 - rx = t - rx = rx * 2 - rx = rx + h3 - rx = -rx - rx = rx + i2 - ry = -rx - ry = ry + t - ry = ry * i - h3 = h3 * s1 - h3 = -h3 - ry = ry + h3 - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={h : 'h!=0'}), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_ge_var(branch, a, b): - """libsecp256k1's secp256k1_gej_add_ge_var, which assume bz==1""" - if branch == 0: - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(nonzero={a.Infinity : 'a_infinite'}), b) - if branch == 1: - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite'}, nonzero={b.Infinity : 'b_infinite'}), a) - z12 = a.Z^2 - u1 = a.X - u2 = b.X * z12 - s1 = a.Y - s2 = b.Y * z12 - s2 = s2 * a.Z - h = -u1 - h = h + u2 - i = -s1 - i = i + s2 - if (branch == 2): - r = formula_secp256k1_gej_double_var(a) - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0', i : 'i=0'}), r) - if (branch == 3): - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0'}, nonzero={i : 'i!=0'}), point_at_infinity()) - i2 = i^2 - h2 = h^2 - h3 = h * h2 - rz = a.Z * h - t = u1 * h2 - rx = t - rx = rx * 2 - rx = rx + h3 - rx = -rx - rx = rx + i2 - ry = -rx - ry = ry + t - ry = ry * i - h3 = h3 * s1 - h3 = -h3 - ry = ry + h3 - return (constraints(zero={b.Z - 1 : 'b.z=1'}), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={h : 'h!=0'}), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_zinv_var(branch, a, b): - """libsecp256k1's secp256k1_gej_add_zinv_var""" - bzinv = b.Z^(-1) - if branch == 0: - return (constraints(), constraints(nonzero={b.Infinity : 'b_infinite'}), a) - if branch == 1: - bzinv2 = bzinv^2 - bzinv3 = bzinv2 * bzinv - rx = b.X * bzinv2 - ry = b.Y * bzinv3 - rz = 1 - return (constraints(), constraints(zero={b.Infinity : 'b_finite'}, nonzero={a.Infinity : 'a_infinite'}), jacobianpoint(rx, ry, rz)) - azz = a.Z * bzinv - z12 = azz^2 - u1 = a.X - u2 = b.X * z12 - s1 = a.Y - s2 = b.Y * z12 - s2 = s2 * azz - h = -u1 - h = h + u2 - i = -s1 - i = i + s2 - if branch == 2: - r = formula_secp256k1_gej_double_var(a) - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0', i : 'i=0'}), r) - if branch == 3: - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite', h : 'h=0'}, nonzero={i : 'i!=0'}), point_at_infinity()) - i2 = i^2 - h2 = h^2 - h3 = h * h2 - rz = a.Z - rz = rz * h - t = u1 * h2 - rx = t - rx = rx * 2 - rx = rx + h3 - rx = -rx - rx = rx + i2 - ry = -rx - ry = ry + t - ry = ry * i - h3 = h3 * s1 - h3 = -h3 - ry = ry + h3 - return (constraints(), constraints(zero={a.Infinity : 'a_finite', b.Infinity : 'b_finite'}, nonzero={h : 'h!=0'}), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_ge(branch, a, b): - """libsecp256k1's secp256k1_gej_add_ge""" - zeroes = {} - nonzeroes = {} - a_infinity = False - if (branch & 4) != 0: - nonzeroes.update({a.Infinity : 'a_infinite'}) - a_infinity = True - else: - zeroes.update({a.Infinity : 'a_finite'}) - zz = a.Z^2 - u1 = a.X - u2 = b.X * zz - s1 = a.Y - s2 = b.Y * zz - s2 = s2 * a.Z - t = u1 - t = t + u2 - m = s1 - m = m + s2 - rr = t^2 - m_alt = -u2 - tt = u1 * m_alt - rr = rr + tt - degenerate = (branch & 3) == 3 - if (branch & 1) != 0: - zeroes.update({m : 'm_zero'}) - else: - nonzeroes.update({m : 'm_nonzero'}) - if (branch & 2) != 0: - zeroes.update({rr : 'rr_zero'}) - else: - nonzeroes.update({rr : 'rr_nonzero'}) - rr_alt = s1 - rr_alt = rr_alt * 2 - m_alt = m_alt + u1 - if not degenerate: - rr_alt = rr - m_alt = m - n = m_alt^2 - q = n * t - n = n^2 - if degenerate: - n = m - t = rr_alt^2 - rz = a.Z * m_alt - infinity = False - if (branch & 8) != 0: - if not a_infinity: - infinity = True - zeroes.update({rz : 'r.z=0'}) - else: - nonzeroes.update({rz : 'r.z!=0'}) - rz = rz * 2 - q = -q - t = t + q - rx = t - t = t * 2 - t = t + q - t = t * rr_alt - t = t + n - ry = -t - rx = rx * 4 - ry = ry * 4 - if a_infinity: - rx = b.X - ry = b.Y - rz = 1 - if infinity: - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zeroes, nonzero=nonzeroes), point_at_infinity()) - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zeroes, nonzero=nonzeroes), jacobianpoint(rx, ry, rz)) - -def formula_secp256k1_gej_add_ge_old(branch, a, b): - """libsecp256k1's old secp256k1_gej_add_ge, which fails when ay+by=0 but ax!=bx""" - a_infinity = (branch & 1) != 0 - zero = {} - nonzero = {} - if a_infinity: - nonzero.update({a.Infinity : 'a_infinite'}) - else: - zero.update({a.Infinity : 'a_finite'}) - zz = a.Z^2 - u1 = a.X - u2 = b.X * zz - s1 = a.Y - s2 = b.Y * zz - s2 = s2 * a.Z - z = a.Z - t = u1 - t = t + u2 - m = s1 - m = m + s2 - n = m^2 - q = n * t - n = n^2 - rr = t^2 - t = u1 * u2 - t = -t - rr = rr + t - t = rr^2 - rz = m * z - infinity = False - if (branch & 2) != 0: - if not a_infinity: - infinity = True - else: - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(nonzero={z : 'conflict_a'}, zero={z : 'conflict_b'}), point_at_infinity()) - zero.update({rz : 'r.z=0'}) - else: - nonzero.update({rz : 'r.z!=0'}) - rz = rz * (0 if a_infinity else 2) - rx = t - q = -q - rx = rx + q - q = q * 3 - t = t * 2 - t = t + q - t = t * rr - t = t + n - ry = -t - rx = rx * (0 if a_infinity else 4) - ry = ry * (0 if a_infinity else 4) - t = b.X - t = t * (1 if a_infinity else 0) - rx = rx + t - t = b.Y - t = t * (1 if a_infinity else 0) - ry = ry + t - t = (1 if a_infinity else 0) - rz = rz + t - if infinity: - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zero, nonzero=nonzero), point_at_infinity()) - return (constraints(zero={b.Z - 1 : 'b.z=1', b.Infinity : 'b_finite'}), constraints(zero=zero, nonzero=nonzero), jacobianpoint(rx, ry, rz)) - -if __name__ == "__main__": - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_var", 0, 7, 5, formula_secp256k1_gej_add_var) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_ge_var", 0, 7, 5, formula_secp256k1_gej_add_ge_var) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_zinv_var", 0, 7, 5, formula_secp256k1_gej_add_zinv_var) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_ge", 0, 7, 16, formula_secp256k1_gej_add_ge) - check_symbolic_jacobian_weierstrass("secp256k1_gej_add_ge_old [should fail]", 0, 7, 4, formula_secp256k1_gej_add_ge_old) - - if len(sys.argv) >= 2 and sys.argv[1] == "--exhaustive": - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_var", 0, 7, 5, formula_secp256k1_gej_add_var, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_ge_var", 0, 7, 5, formula_secp256k1_gej_add_ge_var, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_zinv_var", 0, 7, 5, formula_secp256k1_gej_add_zinv_var, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_ge", 0, 7, 16, formula_secp256k1_gej_add_ge, 43) - check_exhaustive_jacobian_weierstrass("secp256k1_gej_add_ge_old [should fail]", 0, 7, 4, formula_secp256k1_gej_add_ge_old, 43) diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage deleted file mode 100644 index 03ef2ec9..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/sage/weierstrass_prover.sage +++ /dev/null @@ -1,264 +0,0 @@ -# Prover implementation for Weierstrass curves of the form -# y^2 = x^3 + A * x + B, specifically with a = 0 and b = 7, with group laws -# operating on affine and Jacobian coordinates, including the point at infinity -# represented by a 4th variable in coordinates. - -load("group_prover.sage") - - -class affinepoint: - def __init__(self, x, y, infinity=0): - self.x = x - self.y = y - self.infinity = infinity - def __str__(self): - return "affinepoint(x=%s,y=%s,inf=%s)" % (self.x, self.y, self.infinity) - - -class jacobianpoint: - def __init__(self, x, y, z, infinity=0): - self.X = x - self.Y = y - self.Z = z - self.Infinity = infinity - def __str__(self): - return "jacobianpoint(X=%s,Y=%s,Z=%s,inf=%s)" % (self.X, self.Y, self.Z, self.Infinity) - - -def point_at_infinity(): - return jacobianpoint(1, 1, 1, 1) - - -def negate(p): - if p.__class__ == affinepoint: - return affinepoint(p.x, -p.y) - if p.__class__ == jacobianpoint: - return jacobianpoint(p.X, -p.Y, p.Z) - assert(False) - - -def on_weierstrass_curve(A, B, p): - """Return a set of zero-expressions for an affine point to be on the curve""" - return constraints(zero={p.x^3 + A*p.x + B - p.y^2: 'on_curve'}) - - -def tangential_to_weierstrass_curve(A, B, p12, p3): - """Return a set of zero-expressions for ((x12,y12),(x3,y3)) to be a line that is tangential to the curve at (x12,y12)""" - return constraints(zero={ - (p12.y - p3.y) * (p12.y * 2) - (p12.x^2 * 3 + A) * (p12.x - p3.x): 'tangential_to_curve' - }) - - -def colinear(p1, p2, p3): - """Return a set of zero-expressions for ((x1,y1),(x2,y2),(x3,y3)) to be collinear""" - return constraints(zero={ - (p1.y - p2.y) * (p1.x - p3.x) - (p1.y - p3.y) * (p1.x - p2.x): 'colinear_1', - (p2.y - p3.y) * (p2.x - p1.x) - (p2.y - p1.y) * (p2.x - p3.x): 'colinear_2', - (p3.y - p1.y) * (p3.x - p2.x) - (p3.y - p2.y) * (p3.x - p1.x): 'colinear_3' - }) - - -def good_affine_point(p): - return constraints(nonzero={p.x : 'nonzero_x', p.y : 'nonzero_y'}) - - -def good_jacobian_point(p): - return constraints(nonzero={p.X : 'nonzero_X', p.Y : 'nonzero_Y', p.Z^6 : 'nonzero_Z'}) - - -def good_point(p): - return constraints(nonzero={p.Z^6 : 'nonzero_X'}) - - -def finite(p, *affine_fns): - con = good_point(p) + constraints(zero={p.Infinity : 'finite_point'}) - if p.Z != 0: - return con + reduce(lambda a, b: a + b, (f(affinepoint(p.X / p.Z^2, p.Y / p.Z^3)) for f in affine_fns), con) - else: - return con - -def infinite(p): - return constraints(nonzero={p.Infinity : 'infinite_point'}) - - -def law_jacobian_weierstrass_add(A, B, pa, pb, pA, pB, pC): - """Check whether the passed set of coordinates is a valid Jacobian add, given assumptions""" - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - on_weierstrass_curve(A, B, pb) + - finite(pA) + - finite(pB) + - constraints(nonzero={pa.x - pb.x : 'different_x'})) - require = (finite(pC, lambda pc: on_weierstrass_curve(A, B, pc) + - colinear(pa, pb, negate(pc)))) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_double(A, B, pa, pb, pA, pB, pC): - """Check whether the passed set of coordinates is a valid Jacobian doubling, given assumptions""" - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - on_weierstrass_curve(A, B, pb) + - finite(pA) + - finite(pB) + - constraints(zero={pa.x - pb.x : 'equal_x', pa.y - pb.y : 'equal_y'})) - require = (finite(pC, lambda pc: on_weierstrass_curve(A, B, pc) + - tangential_to_weierstrass_curve(A, B, pa, negate(pc)))) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_opposites(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - on_weierstrass_curve(A, B, pb) + - finite(pA) + - finite(pB) + - constraints(zero={pa.x - pb.x : 'equal_x', pa.y + pb.y : 'opposite_y'})) - require = infinite(pC) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_infinite_a(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pb) + - infinite(pA) + - finite(pB)) - require = finite(pC, lambda pc: constraints(zero={pc.x - pb.x : 'c.x=b.x', pc.y - pb.y : 'c.y=b.y'})) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_infinite_b(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - on_weierstrass_curve(A, B, pa) + - infinite(pB) + - finite(pA)) - require = finite(pC, lambda pc: constraints(zero={pc.x - pa.x : 'c.x=a.x', pc.y - pa.y : 'c.y=a.y'})) - return (assumeLaw, require) - - -def law_jacobian_weierstrass_add_infinite_ab(A, B, pa, pb, pA, pB, pC): - assumeLaw = (good_affine_point(pa) + - good_affine_point(pb) + - good_jacobian_point(pA) + - good_jacobian_point(pB) + - infinite(pA) + - infinite(pB)) - require = infinite(pC) - return (assumeLaw, require) - - -laws_jacobian_weierstrass = { - 'add': law_jacobian_weierstrass_add, - 'double': law_jacobian_weierstrass_double, - 'add_opposite': law_jacobian_weierstrass_add_opposites, - 'add_infinite_a': law_jacobian_weierstrass_add_infinite_a, - 'add_infinite_b': law_jacobian_weierstrass_add_infinite_b, - 'add_infinite_ab': law_jacobian_weierstrass_add_infinite_ab -} - - -def check_exhaustive_jacobian_weierstrass(name, A, B, branches, formula, p): - """Verify an implementation of addition of Jacobian points on a Weierstrass curve, by executing and validating the result for every possible addition in a prime field""" - F = Integers(p) - print "Formula %s on Z%i:" % (name, p) - points = [] - for x in xrange(0, p): - for y in xrange(0, p): - point = affinepoint(F(x), F(y)) - r, e = concrete_verify(on_weierstrass_curve(A, B, point)) - if r: - points.append(point) - - for za in xrange(1, p): - for zb in xrange(1, p): - for pa in points: - for pb in points: - for ia in xrange(2): - for ib in xrange(2): - pA = jacobianpoint(pa.x * F(za)^2, pa.y * F(za)^3, F(za), ia) - pB = jacobianpoint(pb.x * F(zb)^2, pb.y * F(zb)^3, F(zb), ib) - for branch in xrange(0, branches): - assumeAssert, assumeBranch, pC = formula(branch, pA, pB) - pC.X = F(pC.X) - pC.Y = F(pC.Y) - pC.Z = F(pC.Z) - pC.Infinity = F(pC.Infinity) - r, e = concrete_verify(assumeAssert + assumeBranch) - if r: - match = False - for key in laws_jacobian_weierstrass: - assumeLaw, require = laws_jacobian_weierstrass[key](A, B, pa, pb, pA, pB, pC) - r, e = concrete_verify(assumeLaw) - if r: - if match: - print " multiple branches for (%s,%s,%s,%s) + (%s,%s,%s,%s)" % (pA.X, pA.Y, pA.Z, pA.Infinity, pB.X, pB.Y, pB.Z, pB.Infinity) - else: - match = True - r, e = concrete_verify(require) - if not r: - print " failure in branch %i for (%s,%s,%s,%s) + (%s,%s,%s,%s) = (%s,%s,%s,%s): %s" % (branch, pA.X, pA.Y, pA.Z, pA.Infinity, pB.X, pB.Y, pB.Z, pB.Infinity, pC.X, pC.Y, pC.Z, pC.Infinity, e) - print - - -def check_symbolic_function(R, assumeAssert, assumeBranch, f, A, B, pa, pb, pA, pB, pC): - assumeLaw, require = f(A, B, pa, pb, pA, pB, pC) - return check_symbolic(R, assumeLaw, assumeAssert, assumeBranch, require) - -def check_symbolic_jacobian_weierstrass(name, A, B, branches, formula): - """Verify an implementation of addition of Jacobian points on a Weierstrass curve symbolically""" - R. = PolynomialRing(QQ,8,order='invlex') - lift = lambda x: fastfrac(R,x) - ax = lift(ax) - ay = lift(ay) - Az = lift(Az) - bx = lift(bx) - by = lift(by) - Bz = lift(Bz) - Ai = lift(Ai) - Bi = lift(Bi) - - pa = affinepoint(ax, ay, Ai) - pb = affinepoint(bx, by, Bi) - pA = jacobianpoint(ax * Az^2, ay * Az^3, Az, Ai) - pB = jacobianpoint(bx * Bz^2, by * Bz^3, Bz, Bi) - - res = {} - - for key in laws_jacobian_weierstrass: - res[key] = [] - - print ("Formula " + name + ":") - count = 0 - for branch in xrange(branches): - assumeFormula, assumeBranch, pC = formula(branch, pA, pB) - pC.X = lift(pC.X) - pC.Y = lift(pC.Y) - pC.Z = lift(pC.Z) - pC.Infinity = lift(pC.Infinity) - - for key in laws_jacobian_weierstrass: - res[key].append((check_symbolic_function(R, assumeFormula, assumeBranch, laws_jacobian_weierstrass[key], A, B, pa, pb, pA, pB, pC), branch)) - - for key in res: - print " %s:" % key - val = res[key] - for x in val: - if x[0] is not None: - print " branch %i: %s" % (x[1], x[0]) - - print diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s deleted file mode 100644 index 5df561f2..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/asm/field_10x26_arm.s +++ /dev/null @@ -1,919 +0,0 @@ -@ vim: set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab syntax=armasm: -/********************************************************************** - * Copyright (c) 2014 Wladimir J. van der Laan * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ -/* -ARM implementation of field_10x26 inner loops. - -Note: - -- To avoid unnecessary loads and make use of available registers, two - 'passes' have every time been interleaved, with the odd passes accumulating c' and d' - which will be added to c and d respectively in the the even passes - -*/ - - .syntax unified - .arch armv7-a - @ eabi attributes - see readelf -A - .eabi_attribute 8, 1 @ Tag_ARM_ISA_use = yes - .eabi_attribute 9, 0 @ Tag_Thumb_ISA_use = no - .eabi_attribute 10, 0 @ Tag_FP_arch = none - .eabi_attribute 24, 1 @ Tag_ABI_align_needed = 8-byte - .eabi_attribute 25, 1 @ Tag_ABI_align_preserved = 8-byte, except leaf SP - .eabi_attribute 30, 2 @ Tag_ABI_optimization_goals = Agressive Speed - .eabi_attribute 34, 1 @ Tag_CPU_unaligned_access = v6 - .text - - @ Field constants - .set field_R0, 0x3d10 - .set field_R1, 0x400 - .set field_not_M, 0xfc000000 @ ~M = ~0x3ffffff - - .align 2 - .global secp256k1_fe_mul_inner - .type secp256k1_fe_mul_inner, %function - @ Arguments: - @ r0 r Restrict: can overlap with a, not with b - @ r1 a - @ r2 b - @ Stack (total 4+10*4 = 44) - @ sp + #0 saved 'r' pointer - @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 -secp256k1_fe_mul_inner: - stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} - sub sp, sp, #48 @ frame=44 + alignment - str r0, [sp, #0] @ save result address, we need it only at the end - - /****************************************** - * Main computation code. - ****************************************** - - Allocation: - r0,r14,r7,r8 scratch - r1 a (pointer) - r2 b (pointer) - r3:r4 c - r5:r6 d - r11:r12 c' - r9:r10 d' - - Note: do not write to r[] here, it may overlap with a[] - */ - - /* A - interleaved with B */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #9*4] @ b[9] - ldr r0, [r1, #1*4] @ a[1] - umull r5, r6, r7, r8 @ d = a[0] * b[9] - ldr r14, [r2, #8*4] @ b[8] - umull r9, r10, r0, r8 @ d' = a[1] * b[9] - ldr r7, [r1, #2*4] @ a[2] - umlal r5, r6, r0, r14 @ d += a[1] * b[8] - ldr r8, [r2, #7*4] @ b[7] - umlal r9, r10, r7, r14 @ d' += a[2] * b[8] - ldr r0, [r1, #3*4] @ a[3] - umlal r5, r6, r7, r8 @ d += a[2] * b[7] - ldr r14, [r2, #6*4] @ b[6] - umlal r9, r10, r0, r8 @ d' += a[3] * b[7] - ldr r7, [r1, #4*4] @ a[4] - umlal r5, r6, r0, r14 @ d += a[3] * b[6] - ldr r8, [r2, #5*4] @ b[5] - umlal r9, r10, r7, r14 @ d' += a[4] * b[6] - ldr r0, [r1, #5*4] @ a[5] - umlal r5, r6, r7, r8 @ d += a[4] * b[5] - ldr r14, [r2, #4*4] @ b[4] - umlal r9, r10, r0, r8 @ d' += a[5] * b[5] - ldr r7, [r1, #6*4] @ a[6] - umlal r5, r6, r0, r14 @ d += a[5] * b[4] - ldr r8, [r2, #3*4] @ b[3] - umlal r9, r10, r7, r14 @ d' += a[6] * b[4] - ldr r0, [r1, #7*4] @ a[7] - umlal r5, r6, r7, r8 @ d += a[6] * b[3] - ldr r14, [r2, #2*4] @ b[2] - umlal r9, r10, r0, r8 @ d' += a[7] * b[3] - ldr r7, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r14 @ d += a[7] * b[2] - ldr r8, [r2, #1*4] @ b[1] - umlal r9, r10, r7, r14 @ d' += a[8] * b[2] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r8 @ d += a[8] * b[1] - ldr r14, [r2, #0*4] @ b[0] - umlal r9, r10, r0, r8 @ d' += a[9] * b[1] - ldr r7, [r1, #0*4] @ a[0] - umlal r5, r6, r0, r14 @ d += a[9] * b[0] - @ r7,r14 used in B - - bic r0, r5, field_not_M @ t9 = d & M - str r0, [sp, #4 + 4*9] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - /* B */ - umull r3, r4, r7, r14 @ c = a[0] * b[0] - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u0 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u0 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t0 = c & M - str r14, [sp, #4 + 0*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u0 * R1 - umlal r3, r4, r0, r14 - - /* C - interleaved with D */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #2*4] @ b[2] - ldr r14, [r2, #1*4] @ b[1] - umull r11, r12, r7, r8 @ c' = a[0] * b[2] - ldr r0, [r1, #1*4] @ a[1] - umlal r3, r4, r7, r14 @ c += a[0] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r11, r12, r0, r14 @ c' += a[1] * b[1] - ldr r7, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r8 @ c += a[1] * b[0] - ldr r14, [r2, #9*4] @ b[9] - umlal r11, r12, r7, r8 @ c' += a[2] * b[0] - ldr r0, [r1, #3*4] @ a[3] - umlal r5, r6, r7, r14 @ d += a[2] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umull r9, r10, r0, r14 @ d' = a[3] * b[9] - ldr r7, [r1, #4*4] @ a[4] - umlal r5, r6, r0, r8 @ d += a[3] * b[8] - ldr r14, [r2, #7*4] @ b[7] - umlal r9, r10, r7, r8 @ d' += a[4] * b[8] - ldr r0, [r1, #5*4] @ a[5] - umlal r5, r6, r7, r14 @ d += a[4] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r9, r10, r0, r14 @ d' += a[5] * b[7] - ldr r7, [r1, #6*4] @ a[6] - umlal r5, r6, r0, r8 @ d += a[5] * b[6] - ldr r14, [r2, #5*4] @ b[5] - umlal r9, r10, r7, r8 @ d' += a[6] * b[6] - ldr r0, [r1, #7*4] @ a[7] - umlal r5, r6, r7, r14 @ d += a[6] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r9, r10, r0, r14 @ d' += a[7] * b[5] - ldr r7, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r8 @ d += a[7] * b[4] - ldr r14, [r2, #3*4] @ b[3] - umlal r9, r10, r7, r8 @ d' += a[8] * b[4] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r14 @ d += a[8] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r9, r10, r0, r14 @ d' += a[9] * b[3] - umlal r5, r6, r0, r8 @ d += a[9] * b[2] - - bic r0, r5, field_not_M @ u1 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u1 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t1 = c & M - str r14, [sp, #4 + 1*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u1 * R1 - umlal r3, r4, r0, r14 - - /* D */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u2 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u2 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t2 = c & M - str r14, [sp, #4 + 2*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u2 * R1 - umlal r3, r4, r0, r14 - - /* E - interleaved with F */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #4*4] @ b[4] - umull r11, r12, r7, r8 @ c' = a[0] * b[4] - ldr r8, [r2, #3*4] @ b[3] - umlal r3, r4, r7, r8 @ c += a[0] * b[3] - ldr r7, [r1, #1*4] @ a[1] - umlal r11, r12, r7, r8 @ c' += a[1] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r3, r4, r7, r8 @ c += a[1] * b[2] - ldr r7, [r1, #2*4] @ a[2] - umlal r11, r12, r7, r8 @ c' += a[2] * b[2] - ldr r8, [r2, #1*4] @ b[1] - umlal r3, r4, r7, r8 @ c += a[2] * b[1] - ldr r7, [r1, #3*4] @ a[3] - umlal r11, r12, r7, r8 @ c' += a[3] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r3, r4, r7, r8 @ c += a[3] * b[0] - ldr r7, [r1, #4*4] @ a[4] - umlal r11, r12, r7, r8 @ c' += a[4] * b[0] - ldr r8, [r2, #9*4] @ b[9] - umlal r5, r6, r7, r8 @ d += a[4] * b[9] - ldr r7, [r1, #5*4] @ a[5] - umull r9, r10, r7, r8 @ d' = a[5] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umlal r5, r6, r7, r8 @ d += a[5] * b[8] - ldr r7, [r1, #6*4] @ a[6] - umlal r9, r10, r7, r8 @ d' += a[6] * b[8] - ldr r8, [r2, #7*4] @ b[7] - umlal r5, r6, r7, r8 @ d += a[6] * b[7] - ldr r7, [r1, #7*4] @ a[7] - umlal r9, r10, r7, r8 @ d' += a[7] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r5, r6, r7, r8 @ d += a[7] * b[6] - ldr r7, [r1, #8*4] @ a[8] - umlal r9, r10, r7, r8 @ d' += a[8] * b[6] - ldr r8, [r2, #5*4] @ b[5] - umlal r5, r6, r7, r8 @ d += a[8] * b[5] - ldr r7, [r1, #9*4] @ a[9] - umlal r9, r10, r7, r8 @ d' += a[9] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r5, r6, r7, r8 @ d += a[9] * b[4] - - bic r0, r5, field_not_M @ u3 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u3 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t3 = c & M - str r14, [sp, #4 + 3*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u3 * R1 - umlal r3, r4, r0, r14 - - /* F */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u4 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u4 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t4 = c & M - str r14, [sp, #4 + 4*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u4 * R1 - umlal r3, r4, r0, r14 - - /* G - interleaved with H */ - ldr r7, [r1, #0*4] @ a[0] - ldr r8, [r2, #6*4] @ b[6] - ldr r14, [r2, #5*4] @ b[5] - umull r11, r12, r7, r8 @ c' = a[0] * b[6] - ldr r0, [r1, #1*4] @ a[1] - umlal r3, r4, r7, r14 @ c += a[0] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r11, r12, r0, r14 @ c' += a[1] * b[5] - ldr r7, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r8 @ c += a[1] * b[4] - ldr r14, [r2, #3*4] @ b[3] - umlal r11, r12, r7, r8 @ c' += a[2] * b[4] - ldr r0, [r1, #3*4] @ a[3] - umlal r3, r4, r7, r14 @ c += a[2] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r11, r12, r0, r14 @ c' += a[3] * b[3] - ldr r7, [r1, #4*4] @ a[4] - umlal r3, r4, r0, r8 @ c += a[3] * b[2] - ldr r14, [r2, #1*4] @ b[1] - umlal r11, r12, r7, r8 @ c' += a[4] * b[2] - ldr r0, [r1, #5*4] @ a[5] - umlal r3, r4, r7, r14 @ c += a[4] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r11, r12, r0, r14 @ c' += a[5] * b[1] - ldr r7, [r1, #6*4] @ a[6] - umlal r3, r4, r0, r8 @ c += a[5] * b[0] - ldr r14, [r2, #9*4] @ b[9] - umlal r11, r12, r7, r8 @ c' += a[6] * b[0] - ldr r0, [r1, #7*4] @ a[7] - umlal r5, r6, r7, r14 @ d += a[6] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umull r9, r10, r0, r14 @ d' = a[7] * b[9] - ldr r7, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r8 @ d += a[7] * b[8] - ldr r14, [r2, #7*4] @ b[7] - umlal r9, r10, r7, r8 @ d' += a[8] * b[8] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r14 @ d += a[8] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r9, r10, r0, r14 @ d' += a[9] * b[7] - umlal r5, r6, r0, r8 @ d += a[9] * b[6] - - bic r0, r5, field_not_M @ u5 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u5 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t5 = c & M - str r14, [sp, #4 + 5*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u5 * R1 - umlal r3, r4, r0, r14 - - /* H */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u6 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u6 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t6 = c & M - str r14, [sp, #4 + 6*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u6 * R1 - umlal r3, r4, r0, r14 - - /* I - interleaved with J */ - ldr r8, [r2, #8*4] @ b[8] - ldr r7, [r1, #0*4] @ a[0] - ldr r14, [r2, #7*4] @ b[7] - umull r11, r12, r7, r8 @ c' = a[0] * b[8] - ldr r0, [r1, #1*4] @ a[1] - umlal r3, r4, r7, r14 @ c += a[0] * b[7] - ldr r8, [r2, #6*4] @ b[6] - umlal r11, r12, r0, r14 @ c' += a[1] * b[7] - ldr r7, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r8 @ c += a[1] * b[6] - ldr r14, [r2, #5*4] @ b[5] - umlal r11, r12, r7, r8 @ c' += a[2] * b[6] - ldr r0, [r1, #3*4] @ a[3] - umlal r3, r4, r7, r14 @ c += a[2] * b[5] - ldr r8, [r2, #4*4] @ b[4] - umlal r11, r12, r0, r14 @ c' += a[3] * b[5] - ldr r7, [r1, #4*4] @ a[4] - umlal r3, r4, r0, r8 @ c += a[3] * b[4] - ldr r14, [r2, #3*4] @ b[3] - umlal r11, r12, r7, r8 @ c' += a[4] * b[4] - ldr r0, [r1, #5*4] @ a[5] - umlal r3, r4, r7, r14 @ c += a[4] * b[3] - ldr r8, [r2, #2*4] @ b[2] - umlal r11, r12, r0, r14 @ c' += a[5] * b[3] - ldr r7, [r1, #6*4] @ a[6] - umlal r3, r4, r0, r8 @ c += a[5] * b[2] - ldr r14, [r2, #1*4] @ b[1] - umlal r11, r12, r7, r8 @ c' += a[6] * b[2] - ldr r0, [r1, #7*4] @ a[7] - umlal r3, r4, r7, r14 @ c += a[6] * b[1] - ldr r8, [r2, #0*4] @ b[0] - umlal r11, r12, r0, r14 @ c' += a[7] * b[1] - ldr r7, [r1, #8*4] @ a[8] - umlal r3, r4, r0, r8 @ c += a[7] * b[0] - ldr r14, [r2, #9*4] @ b[9] - umlal r11, r12, r7, r8 @ c' += a[8] * b[0] - ldr r0, [r1, #9*4] @ a[9] - umlal r5, r6, r7, r14 @ d += a[8] * b[9] - ldr r8, [r2, #8*4] @ b[8] - umull r9, r10, r0, r14 @ d' = a[9] * b[9] - umlal r5, r6, r0, r8 @ d += a[9] * b[8] - - bic r0, r5, field_not_M @ u7 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u7 * R0 - umlal r3, r4, r0, r14 - - bic r14, r3, field_not_M @ t7 = c & M - str r14, [sp, #4 + 7*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u7 * R1 - umlal r3, r4, r0, r14 - - /* J */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u8 = d & M - str r0, [sp, #4 + 8*4] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u8 * R0 - umlal r3, r4, r0, r14 - - /****************************************** - * compute and write back result - ****************************************** - Allocation: - r0 r - r3:r4 c - r5:r6 d - r7 t0 - r8 t1 - r9 t2 - r11 u8 - r12 t9 - r1,r2,r10,r14 scratch - - Note: do not read from a[] after here, it may overlap with r[] - */ - ldr r0, [sp, #0] - add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 - ldmia r1, {r2,r7,r8,r9,r10,r11,r12} - add r1, r0, #3*4 - stmia r1, {r2,r7,r8,r9,r10} - - bic r2, r3, field_not_M @ r[8] = c & M - str r2, [r0, #8*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u8 * R1 - umlal r3, r4, r11, r14 - movw r14, field_R0 @ c += d * R0 - umlal r3, r4, r5, r14 - adds r3, r3, r12 @ c += t9 - adc r4, r4, #0 - - add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 - ldmia r1, {r7,r8,r9} - - ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) - str r2, [r0, #9*4] - mov r3, r3, lsr #22 @ c >>= 22 - orr r3, r3, r4, asl #10 - mov r4, r4, lsr #22 - movw r14, field_R1 << 4 @ c += d * (R1 << 4) - umlal r3, r4, r5, r14 - - movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) - umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) - adds r5, r5, r7 @ d.lo += t0 - mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) - adc r6, r6, 0 @ d.hi += carry - - bic r2, r5, field_not_M @ r[0] = d & M - str r2, [r0, #0*4] - - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) - umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) - adds r5, r5, r8 @ d.lo += t1 - adc r6, r6, #0 @ d.hi += carry - adds r5, r5, r1 @ d.lo += tmp.lo - mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) - adc r6, r6, r2 @ d.hi += carry + tmp.hi - - bic r2, r5, field_not_M @ r[1] = d & M - str r2, [r0, #1*4] - mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) - orr r5, r5, r6, asl #6 - - add r5, r5, r9 @ d += t2 - str r5, [r0, #2*4] @ r[2] = d - - add sp, sp, #48 - ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} - .size secp256k1_fe_mul_inner, .-secp256k1_fe_mul_inner - - .align 2 - .global secp256k1_fe_sqr_inner - .type secp256k1_fe_sqr_inner, %function - @ Arguments: - @ r0 r Can overlap with a - @ r1 a - @ Stack (total 4+10*4 = 44) - @ sp + #0 saved 'r' pointer - @ sp + #4 + 4*X t0,t1,t2,t3,t4,t5,t6,t7,u8,t9 -secp256k1_fe_sqr_inner: - stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, r14} - sub sp, sp, #48 @ frame=44 + alignment - str r0, [sp, #0] @ save result address, we need it only at the end - /****************************************** - * Main computation code. - ****************************************** - - Allocation: - r0,r14,r2,r7,r8 scratch - r1 a (pointer) - r3:r4 c - r5:r6 d - r11:r12 c' - r9:r10 d' - - Note: do not write to r[] here, it may overlap with a[] - */ - /* A interleaved with B */ - ldr r0, [r1, #1*4] @ a[1]*2 - ldr r7, [r1, #0*4] @ a[0] - mov r0, r0, asl #1 - ldr r14, [r1, #9*4] @ a[9] - umull r3, r4, r7, r7 @ c = a[0] * a[0] - ldr r8, [r1, #8*4] @ a[8] - mov r7, r7, asl #1 - umull r5, r6, r7, r14 @ d = a[0]*2 * a[9] - ldr r7, [r1, #2*4] @ a[2]*2 - umull r9, r10, r0, r14 @ d' = a[1]*2 * a[9] - ldr r14, [r1, #7*4] @ a[7] - umlal r5, r6, r0, r8 @ d += a[1]*2 * a[8] - mov r7, r7, asl #1 - ldr r0, [r1, #3*4] @ a[3]*2 - umlal r9, r10, r7, r8 @ d' += a[2]*2 * a[8] - ldr r8, [r1, #6*4] @ a[6] - umlal r5, r6, r7, r14 @ d += a[2]*2 * a[7] - mov r0, r0, asl #1 - ldr r7, [r1, #4*4] @ a[4]*2 - umlal r9, r10, r0, r14 @ d' += a[3]*2 * a[7] - ldr r14, [r1, #5*4] @ a[5] - mov r7, r7, asl #1 - umlal r5, r6, r0, r8 @ d += a[3]*2 * a[6] - umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[6] - umlal r5, r6, r7, r14 @ d += a[4]*2 * a[5] - umlal r9, r10, r14, r14 @ d' += a[5] * a[5] - - bic r0, r5, field_not_M @ t9 = d & M - str r0, [sp, #4 + 9*4] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - /* B */ - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u0 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u0 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t0 = c & M - str r14, [sp, #4 + 0*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u0 * R1 - umlal r3, r4, r0, r14 - - /* C interleaved with D */ - ldr r0, [r1, #0*4] @ a[0]*2 - ldr r14, [r1, #1*4] @ a[1] - mov r0, r0, asl #1 - ldr r8, [r1, #2*4] @ a[2] - umlal r3, r4, r0, r14 @ c += a[0]*2 * a[1] - mov r7, r8, asl #1 @ a[2]*2 - umull r11, r12, r14, r14 @ c' = a[1] * a[1] - ldr r14, [r1, #9*4] @ a[9] - umlal r11, r12, r0, r8 @ c' += a[0]*2 * a[2] - ldr r0, [r1, #3*4] @ a[3]*2 - ldr r8, [r1, #8*4] @ a[8] - umlal r5, r6, r7, r14 @ d += a[2]*2 * a[9] - mov r0, r0, asl #1 - ldr r7, [r1, #4*4] @ a[4]*2 - umull r9, r10, r0, r14 @ d' = a[3]*2 * a[9] - ldr r14, [r1, #7*4] @ a[7] - umlal r5, r6, r0, r8 @ d += a[3]*2 * a[8] - mov r7, r7, asl #1 - ldr r0, [r1, #5*4] @ a[5]*2 - umlal r9, r10, r7, r8 @ d' += a[4]*2 * a[8] - ldr r8, [r1, #6*4] @ a[6] - mov r0, r0, asl #1 - umlal r5, r6, r7, r14 @ d += a[4]*2 * a[7] - umlal r9, r10, r0, r14 @ d' += a[5]*2 * a[7] - umlal r5, r6, r0, r8 @ d += a[5]*2 * a[6] - umlal r9, r10, r8, r8 @ d' += a[6] * a[6] - - bic r0, r5, field_not_M @ u1 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u1 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t1 = c & M - str r14, [sp, #4 + 1*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u1 * R1 - umlal r3, r4, r0, r14 - - /* D */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u2 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u2 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t2 = c & M - str r14, [sp, #4 + 2*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u2 * R1 - umlal r3, r4, r0, r14 - - /* E interleaved with F */ - ldr r7, [r1, #0*4] @ a[0]*2 - ldr r0, [r1, #1*4] @ a[1]*2 - ldr r14, [r1, #2*4] @ a[2] - mov r7, r7, asl #1 - ldr r8, [r1, #3*4] @ a[3] - ldr r2, [r1, #4*4] - umlal r3, r4, r7, r8 @ c += a[0]*2 * a[3] - mov r0, r0, asl #1 - umull r11, r12, r7, r2 @ c' = a[0]*2 * a[4] - mov r2, r2, asl #1 @ a[4]*2 - umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[3] - ldr r8, [r1, #9*4] @ a[9] - umlal r3, r4, r0, r14 @ c += a[1]*2 * a[2] - ldr r0, [r1, #5*4] @ a[5]*2 - umlal r11, r12, r14, r14 @ c' += a[2] * a[2] - ldr r14, [r1, #8*4] @ a[8] - mov r0, r0, asl #1 - umlal r5, r6, r2, r8 @ d += a[4]*2 * a[9] - ldr r7, [r1, #6*4] @ a[6]*2 - umull r9, r10, r0, r8 @ d' = a[5]*2 * a[9] - mov r7, r7, asl #1 - ldr r8, [r1, #7*4] @ a[7] - umlal r5, r6, r0, r14 @ d += a[5]*2 * a[8] - umlal r9, r10, r7, r14 @ d' += a[6]*2 * a[8] - umlal r5, r6, r7, r8 @ d += a[6]*2 * a[7] - umlal r9, r10, r8, r8 @ d' += a[7] * a[7] - - bic r0, r5, field_not_M @ u3 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u3 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t3 = c & M - str r14, [sp, #4 + 3*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u3 * R1 - umlal r3, r4, r0, r14 - - /* F */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u4 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u4 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t4 = c & M - str r14, [sp, #4 + 4*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u4 * R1 - umlal r3, r4, r0, r14 - - /* G interleaved with H */ - ldr r7, [r1, #0*4] @ a[0]*2 - ldr r0, [r1, #1*4] @ a[1]*2 - mov r7, r7, asl #1 - ldr r8, [r1, #5*4] @ a[5] - ldr r2, [r1, #6*4] @ a[6] - umlal r3, r4, r7, r8 @ c += a[0]*2 * a[5] - ldr r14, [r1, #4*4] @ a[4] - mov r0, r0, asl #1 - umull r11, r12, r7, r2 @ c' = a[0]*2 * a[6] - ldr r7, [r1, #2*4] @ a[2]*2 - umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[5] - mov r7, r7, asl #1 - ldr r8, [r1, #3*4] @ a[3] - umlal r3, r4, r0, r14 @ c += a[1]*2 * a[4] - mov r0, r2, asl #1 @ a[6]*2 - umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[4] - ldr r14, [r1, #9*4] @ a[9] - umlal r3, r4, r7, r8 @ c += a[2]*2 * a[3] - ldr r7, [r1, #7*4] @ a[7]*2 - umlal r11, r12, r8, r8 @ c' += a[3] * a[3] - mov r7, r7, asl #1 - ldr r8, [r1, #8*4] @ a[8] - umlal r5, r6, r0, r14 @ d += a[6]*2 * a[9] - umull r9, r10, r7, r14 @ d' = a[7]*2 * a[9] - umlal r5, r6, r7, r8 @ d += a[7]*2 * a[8] - umlal r9, r10, r8, r8 @ d' += a[8] * a[8] - - bic r0, r5, field_not_M @ u5 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u5 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t5 = c & M - str r14, [sp, #4 + 5*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u5 * R1 - umlal r3, r4, r0, r14 - - /* H */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - adds r5, r5, r9 @ d += d' - adc r6, r6, r10 - - bic r0, r5, field_not_M @ u6 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u6 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t6 = c & M - str r14, [sp, #4 + 6*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u6 * R1 - umlal r3, r4, r0, r14 - - /* I interleaved with J */ - ldr r7, [r1, #0*4] @ a[0]*2 - ldr r0, [r1, #1*4] @ a[1]*2 - mov r7, r7, asl #1 - ldr r8, [r1, #7*4] @ a[7] - ldr r2, [r1, #8*4] @ a[8] - umlal r3, r4, r7, r8 @ c += a[0]*2 * a[7] - ldr r14, [r1, #6*4] @ a[6] - mov r0, r0, asl #1 - umull r11, r12, r7, r2 @ c' = a[0]*2 * a[8] - ldr r7, [r1, #2*4] @ a[2]*2 - umlal r11, r12, r0, r8 @ c' += a[1]*2 * a[7] - ldr r8, [r1, #5*4] @ a[5] - umlal r3, r4, r0, r14 @ c += a[1]*2 * a[6] - ldr r0, [r1, #3*4] @ a[3]*2 - mov r7, r7, asl #1 - umlal r11, r12, r7, r14 @ c' += a[2]*2 * a[6] - ldr r14, [r1, #4*4] @ a[4] - mov r0, r0, asl #1 - umlal r3, r4, r7, r8 @ c += a[2]*2 * a[5] - mov r2, r2, asl #1 @ a[8]*2 - umlal r11, r12, r0, r8 @ c' += a[3]*2 * a[5] - umlal r3, r4, r0, r14 @ c += a[3]*2 * a[4] - umlal r11, r12, r14, r14 @ c' += a[4] * a[4] - ldr r8, [r1, #9*4] @ a[9] - umlal r5, r6, r2, r8 @ d += a[8]*2 * a[9] - @ r8 will be used in J - - bic r0, r5, field_not_M @ u7 = d & M - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u7 * R0 - umlal r3, r4, r0, r14 - bic r14, r3, field_not_M @ t7 = c & M - str r14, [sp, #4 + 7*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u7 * R1 - umlal r3, r4, r0, r14 - - /* J */ - adds r3, r3, r11 @ c += c' - adc r4, r4, r12 - umlal r5, r6, r8, r8 @ d += a[9] * a[9] - - bic r0, r5, field_not_M @ u8 = d & M - str r0, [sp, #4 + 8*4] - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - movw r14, field_R0 @ c += u8 * R0 - umlal r3, r4, r0, r14 - - /****************************************** - * compute and write back result - ****************************************** - Allocation: - r0 r - r3:r4 c - r5:r6 d - r7 t0 - r8 t1 - r9 t2 - r11 u8 - r12 t9 - r1,r2,r10,r14 scratch - - Note: do not read from a[] after here, it may overlap with r[] - */ - ldr r0, [sp, #0] - add r1, sp, #4 + 3*4 @ r[3..7] = t3..7, r11=u8, r12=t9 - ldmia r1, {r2,r7,r8,r9,r10,r11,r12} - add r1, r0, #3*4 - stmia r1, {r2,r7,r8,r9,r10} - - bic r2, r3, field_not_M @ r[8] = c & M - str r2, [r0, #8*4] - mov r3, r3, lsr #26 @ c >>= 26 - orr r3, r3, r4, asl #6 - mov r4, r4, lsr #26 - mov r14, field_R1 @ c += u8 * R1 - umlal r3, r4, r11, r14 - movw r14, field_R0 @ c += d * R0 - umlal r3, r4, r5, r14 - adds r3, r3, r12 @ c += t9 - adc r4, r4, #0 - - add r1, sp, #4 + 0*4 @ r7,r8,r9 = t0,t1,t2 - ldmia r1, {r7,r8,r9} - - ubfx r2, r3, #0, #22 @ r[9] = c & (M >> 4) - str r2, [r0, #9*4] - mov r3, r3, lsr #22 @ c >>= 22 - orr r3, r3, r4, asl #10 - mov r4, r4, lsr #22 - movw r14, field_R1 << 4 @ c += d * (R1 << 4) - umlal r3, r4, r5, r14 - - movw r14, field_R0 >> 4 @ d = c * (R0 >> 4) + t0 (64x64 multiply+add) - umull r5, r6, r3, r14 @ d = c.lo * (R0 >> 4) - adds r5, r5, r7 @ d.lo += t0 - mla r6, r14, r4, r6 @ d.hi += c.hi * (R0 >> 4) - adc r6, r6, 0 @ d.hi += carry - - bic r2, r5, field_not_M @ r[0] = d & M - str r2, [r0, #0*4] - - mov r5, r5, lsr #26 @ d >>= 26 - orr r5, r5, r6, asl #6 - mov r6, r6, lsr #26 - - movw r14, field_R1 >> 4 @ d += c * (R1 >> 4) + t1 (64x64 multiply+add) - umull r1, r2, r3, r14 @ tmp = c.lo * (R1 >> 4) - adds r5, r5, r8 @ d.lo += t1 - adc r6, r6, #0 @ d.hi += carry - adds r5, r5, r1 @ d.lo += tmp.lo - mla r2, r14, r4, r2 @ tmp.hi += c.hi * (R1 >> 4) - adc r6, r6, r2 @ d.hi += carry + tmp.hi - - bic r2, r5, field_not_M @ r[1] = d & M - str r2, [r0, #1*4] - mov r5, r5, lsr #26 @ d >>= 26 (ignore hi) - orr r5, r5, r6, asl #6 - - add r5, r5, r9 @ d += t2 - str r5, [r0, #2*4] @ r[2] = d - - add sp, sp, #48 - ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} - .size secp256k1_fe_sqr_inner, .-secp256k1_fe_sqr_inner - diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h deleted file mode 100644 index c4c16eb7..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/basic-config.h +++ /dev/null @@ -1,32 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_BASIC_CONFIG_ -#define _SECP256K1_BASIC_CONFIG_ - -#ifdef USE_BASIC_CONFIG - -#undef USE_ASM_X86_64 -#undef USE_ENDOMORPHISM -#undef USE_FIELD_10X26 -#undef USE_FIELD_5X52 -#undef USE_FIELD_INV_BUILTIN -#undef USE_FIELD_INV_NUM -#undef USE_NUM_GMP -#undef USE_NUM_NONE -#undef USE_SCALAR_4X64 -#undef USE_SCALAR_8X32 -#undef USE_SCALAR_INV_BUILTIN -#undef USE_SCALAR_INV_NUM - -#define USE_NUM_NONE 1 -#define USE_FIELD_INV_BUILTIN 1 -#define USE_SCALAR_INV_BUILTIN 1 -#define USE_FIELD_10X26 1 -#define USE_SCALAR_8X32 1 - -#endif // USE_BASIC_CONFIG -#endif // _SECP256K1_BASIC_CONFIG_ diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h deleted file mode 100644 index 3a71b4aa..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench.h +++ /dev/null @@ -1,66 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_BENCH_H_ -#define _SECP256K1_BENCH_H_ - -#include -#include -#include "sys/time.h" - -static double gettimedouble(void) { - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_usec * 0.000001 + tv.tv_sec; -} - -void print_number(double x) { - double y = x; - int c = 0; - if (y < 0.0) { - y = -y; - } - while (y < 100.0) { - y *= 10.0; - c++; - } - printf("%.*f", c, x); -} - -void run_benchmark(char *name, void (*benchmark)(void*), void (*setup)(void*), void (*teardown)(void*), void* data, int count, int iter) { - int i; - double min = HUGE_VAL; - double sum = 0.0; - double max = 0.0; - for (i = 0; i < count; i++) { - double begin, total; - if (setup != NULL) { - setup(data); - } - begin = gettimedouble(); - benchmark(data); - total = gettimedouble() - begin; - if (teardown != NULL) { - teardown(data); - } - if (total < min) { - min = total; - } - if (total > max) { - max = total; - } - sum += total; - } - printf("%s: min ", name); - print_number(min * 1000000.0 / iter); - printf("us / avg "); - print_number((sum / count) * 1000000.0 / iter); - printf("us / max "); - print_number(max * 1000000.0 / iter); - printf("us\n"); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c deleted file mode 100644 index cde5e2db..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_ecdh.c +++ /dev/null @@ -1,54 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille, Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include - -#include "include/secp256k1.h" -#include "include/secp256k1_ecdh.h" -#include "util.h" -#include "bench.h" - -typedef struct { - secp256k1_context *ctx; - secp256k1_pubkey point; - unsigned char scalar[32]; -} bench_ecdh_t; - -static void bench_ecdh_setup(void* arg) { - int i; - bench_ecdh_t *data = (bench_ecdh_t*)arg; - const unsigned char point[] = { - 0x03, - 0x54, 0x94, 0xc1, 0x5d, 0x32, 0x09, 0x97, 0x06, - 0xc2, 0x39, 0x5f, 0x94, 0x34, 0x87, 0x45, 0xfd, - 0x75, 0x7c, 0xe3, 0x0e, 0x4e, 0x8c, 0x90, 0xfb, - 0xa2, 0xba, 0xd1, 0x84, 0xf8, 0x83, 0xc6, 0x9f - }; - - /* create a context with no capabilities */ - data->ctx = secp256k1_context_create(SECP256K1_FLAGS_TYPE_CONTEXT); - for (i = 0; i < 32; i++) { - data->scalar[i] = i + 1; - } - CHECK(secp256k1_ec_pubkey_parse(data->ctx, &data->point, point, sizeof(point)) == 1); -} - -static void bench_ecdh(void* arg) { - int i; - unsigned char res[32]; - bench_ecdh_t *data = (bench_ecdh_t*)arg; - - for (i = 0; i < 20000; i++) { - CHECK(secp256k1_ecdh(data->ctx, res, &data->point, data->scalar) == 1); - } -} - -int main(void) { - bench_ecdh_t data; - - run_benchmark("ecdh", bench_ecdh, bench_ecdh_setup, NULL, &data, 10, 20000); - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c deleted file mode 100644 index 0809f77b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_internal.c +++ /dev/null @@ -1,382 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ -#include - -#include "include/secp256k1.h" - -#include "util.h" -#include "hash_impl.h" -#include "num_impl.h" -#include "field_impl.h" -#include "group_impl.h" -#include "scalar_impl.h" -#include "ecmult_const_impl.h" -#include "ecmult_impl.h" -#include "bench.h" -#include "secp256k1.c" - -typedef struct { - secp256k1_scalar scalar_x, scalar_y; - secp256k1_fe fe_x, fe_y; - secp256k1_ge ge_x, ge_y; - secp256k1_gej gej_x, gej_y; - unsigned char data[64]; - int wnaf[256]; -} bench_inv_t; - -void bench_setup(void* arg) { - bench_inv_t *data = (bench_inv_t*)arg; - - static const unsigned char init_x[32] = { - 0x02, 0x03, 0x05, 0x07, 0x0b, 0x0d, 0x11, 0x13, - 0x17, 0x1d, 0x1f, 0x25, 0x29, 0x2b, 0x2f, 0x35, - 0x3b, 0x3d, 0x43, 0x47, 0x49, 0x4f, 0x53, 0x59, - 0x61, 0x65, 0x67, 0x6b, 0x6d, 0x71, 0x7f, 0x83 - }; - - static const unsigned char init_y[32] = { - 0x82, 0x83, 0x85, 0x87, 0x8b, 0x8d, 0x81, 0x83, - 0x97, 0xad, 0xaf, 0xb5, 0xb9, 0xbb, 0xbf, 0xc5, - 0xdb, 0xdd, 0xe3, 0xe7, 0xe9, 0xef, 0xf3, 0xf9, - 0x11, 0x15, 0x17, 0x1b, 0x1d, 0xb1, 0xbf, 0xd3 - }; - - secp256k1_scalar_set_b32(&data->scalar_x, init_x, NULL); - secp256k1_scalar_set_b32(&data->scalar_y, init_y, NULL); - secp256k1_fe_set_b32(&data->fe_x, init_x); - secp256k1_fe_set_b32(&data->fe_y, init_y); - CHECK(secp256k1_ge_set_xo_var(&data->ge_x, &data->fe_x, 0)); - CHECK(secp256k1_ge_set_xo_var(&data->ge_y, &data->fe_y, 1)); - secp256k1_gej_set_ge(&data->gej_x, &data->ge_x); - secp256k1_gej_set_ge(&data->gej_y, &data->ge_y); - memcpy(data->data, init_x, 32); - memcpy(data->data + 32, init_y, 32); -} - -void bench_scalar_add(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_scalar_negate(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_scalar_negate(&data->scalar_x, &data->scalar_x); - } -} - -void bench_scalar_sqr(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_scalar_sqr(&data->scalar_x, &data->scalar_x); - } -} - -void bench_scalar_mul(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_scalar_mul(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -#ifdef USE_ENDOMORPHISM -void bench_scalar_split(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_scalar l, r; - secp256k1_scalar_split_lambda(&l, &r, &data->scalar_x); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} -#endif - -void bench_scalar_inverse(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000; i++) { - secp256k1_scalar_inverse(&data->scalar_x, &data->scalar_x); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_scalar_inverse_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000; i++) { - secp256k1_scalar_inverse_var(&data->scalar_x, &data->scalar_x); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_field_normalize(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_fe_normalize(&data->fe_x); - } -} - -void bench_field_normalize_weak(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 2000000; i++) { - secp256k1_fe_normalize_weak(&data->fe_x); - } -} - -void bench_field_mul(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_fe_mul(&data->fe_x, &data->fe_x, &data->fe_y); - } -} - -void bench_field_sqr(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_fe_sqr(&data->fe_x, &data->fe_x); - } -} - -void bench_field_inverse(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_fe_inv(&data->fe_x, &data->fe_x); - secp256k1_fe_add(&data->fe_x, &data->fe_y); - } -} - -void bench_field_inverse_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_fe_inv_var(&data->fe_x, &data->fe_x); - secp256k1_fe_add(&data->fe_x, &data->fe_y); - } -} - -void bench_field_sqrt(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_fe_sqrt(&data->fe_x, &data->fe_x); - secp256k1_fe_add(&data->fe_x, &data->fe_y); - } -} - -void bench_group_double_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_double_var(&data->gej_x, &data->gej_x, NULL); - } -} - -void bench_group_add_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_add_var(&data->gej_x, &data->gej_x, &data->gej_y, NULL); - } -} - -void bench_group_add_affine(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_add_ge(&data->gej_x, &data->gej_x, &data->ge_y); - } -} - -void bench_group_add_affine_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 200000; i++) { - secp256k1_gej_add_ge_var(&data->gej_x, &data->gej_x, &data->ge_y, NULL); - } -} - -void bench_group_jacobi_var(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_gej_has_quad_y_var(&data->gej_x); - } -} - -void bench_ecmult_wnaf(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_ecmult_wnaf(data->wnaf, 256, &data->scalar_x, WINDOW_A); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - -void bench_wnaf_const(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_wnaf_const(data->wnaf, data->scalar_x, WINDOW_A); - secp256k1_scalar_add(&data->scalar_x, &data->scalar_x, &data->scalar_y); - } -} - - -void bench_sha256(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_sha256_t sha; - - for (i = 0; i < 20000; i++) { - secp256k1_sha256_initialize(&sha); - secp256k1_sha256_write(&sha, data->data, 32); - secp256k1_sha256_finalize(&sha, data->data); - } -} - -void bench_hmac_sha256(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_hmac_sha256_t hmac; - - for (i = 0; i < 20000; i++) { - secp256k1_hmac_sha256_initialize(&hmac, data->data, 32); - secp256k1_hmac_sha256_write(&hmac, data->data, 32); - secp256k1_hmac_sha256_finalize(&hmac, data->data); - } -} - -void bench_rfc6979_hmac_sha256(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_rfc6979_hmac_sha256_t rng; - - for (i = 0; i < 20000; i++) { - secp256k1_rfc6979_hmac_sha256_initialize(&rng, data->data, 64); - secp256k1_rfc6979_hmac_sha256_generate(&rng, data->data, 32); - } -} - -void bench_context_verify(void* arg) { - int i; - (void)arg; - for (i = 0; i < 20; i++) { - secp256k1_context_destroy(secp256k1_context_create(SECP256K1_CONTEXT_VERIFY)); - } -} - -void bench_context_sign(void* arg) { - int i; - (void)arg; - for (i = 0; i < 200; i++) { - secp256k1_context_destroy(secp256k1_context_create(SECP256K1_CONTEXT_SIGN)); - } -} - -#ifndef USE_NUM_NONE -void bench_num_jacobi(void* arg) { - int i; - bench_inv_t *data = (bench_inv_t*)arg; - secp256k1_num nx, norder; - - secp256k1_scalar_get_num(&nx, &data->scalar_x); - secp256k1_scalar_order_get_num(&norder); - secp256k1_scalar_get_num(&norder, &data->scalar_y); - - for (i = 0; i < 200000; i++) { - secp256k1_num_jacobi(&nx, &norder); - } -} -#endif - -int have_flag(int argc, char** argv, char *flag) { - char** argm = argv + argc; - argv++; - if (argv == argm) { - return 1; - } - while (argv != NULL && argv != argm) { - if (strcmp(*argv, flag) == 0) { - return 1; - } - argv++; - } - return 0; -} - -int main(int argc, char **argv) { - bench_inv_t data; - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "add")) run_benchmark("scalar_add", bench_scalar_add, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "negate")) run_benchmark("scalar_negate", bench_scalar_negate, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "sqr")) run_benchmark("scalar_sqr", bench_scalar_sqr, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "mul")) run_benchmark("scalar_mul", bench_scalar_mul, bench_setup, NULL, &data, 10, 200000); -#ifdef USE_ENDOMORPHISM - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "split")) run_benchmark("scalar_split", bench_scalar_split, bench_setup, NULL, &data, 10, 20000); -#endif - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "inverse")) run_benchmark("scalar_inverse", bench_scalar_inverse, bench_setup, NULL, &data, 10, 2000); - if (have_flag(argc, argv, "scalar") || have_flag(argc, argv, "inverse")) run_benchmark("scalar_inverse_var", bench_scalar_inverse_var, bench_setup, NULL, &data, 10, 2000); - - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "normalize")) run_benchmark("field_normalize", bench_field_normalize, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "normalize")) run_benchmark("field_normalize_weak", bench_field_normalize_weak, bench_setup, NULL, &data, 10, 2000000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "sqr")) run_benchmark("field_sqr", bench_field_sqr, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "mul")) run_benchmark("field_mul", bench_field_mul, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "inverse")) run_benchmark("field_inverse", bench_field_inverse, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "inverse")) run_benchmark("field_inverse_var", bench_field_inverse_var, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "field") || have_flag(argc, argv, "sqrt")) run_benchmark("field_sqrt", bench_field_sqrt, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "double")) run_benchmark("group_double_var", bench_group_double_var, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "add")) run_benchmark("group_add_var", bench_group_add_var, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "add")) run_benchmark("group_add_affine", bench_group_add_affine, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "add")) run_benchmark("group_add_affine_var", bench_group_add_affine_var, bench_setup, NULL, &data, 10, 200000); - if (have_flag(argc, argv, "group") || have_flag(argc, argv, "jacobi")) run_benchmark("group_jacobi_var", bench_group_jacobi_var, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "ecmult") || have_flag(argc, argv, "wnaf")) run_benchmark("wnaf_const", bench_wnaf_const, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "ecmult") || have_flag(argc, argv, "wnaf")) run_benchmark("ecmult_wnaf", bench_ecmult_wnaf, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "hash") || have_flag(argc, argv, "sha256")) run_benchmark("hash_sha256", bench_sha256, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "hash") || have_flag(argc, argv, "hmac")) run_benchmark("hash_hmac_sha256", bench_hmac_sha256, bench_setup, NULL, &data, 10, 20000); - if (have_flag(argc, argv, "hash") || have_flag(argc, argv, "rng6979")) run_benchmark("hash_rfc6979_hmac_sha256", bench_rfc6979_hmac_sha256, bench_setup, NULL, &data, 10, 20000); - - if (have_flag(argc, argv, "context") || have_flag(argc, argv, "verify")) run_benchmark("context_verify", bench_context_verify, bench_setup, NULL, &data, 10, 20); - if (have_flag(argc, argv, "context") || have_flag(argc, argv, "sign")) run_benchmark("context_sign", bench_context_sign, bench_setup, NULL, &data, 10, 200); - -#ifndef USE_NUM_NONE - if (have_flag(argc, argv, "num") || have_flag(argc, argv, "jacobi")) run_benchmark("num_jacobi", bench_num_jacobi, bench_setup, NULL, &data, 10, 200000); -#endif - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c deleted file mode 100644 index 6489378c..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_recover.c +++ /dev/null @@ -1,60 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include "include/secp256k1.h" -#include "include/secp256k1_recovery.h" -#include "util.h" -#include "bench.h" - -typedef struct { - secp256k1_context *ctx; - unsigned char msg[32]; - unsigned char sig[64]; -} bench_recover_t; - -void bench_recover(void* arg) { - int i; - bench_recover_t *data = (bench_recover_t*)arg; - secp256k1_pubkey pubkey; - unsigned char pubkeyc[33]; - - for (i = 0; i < 20000; i++) { - int j; - size_t pubkeylen = 33; - secp256k1_ecdsa_recoverable_signature sig; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(data->ctx, &sig, data->sig, i % 2)); - CHECK(secp256k1_ecdsa_recover(data->ctx, &pubkey, &sig, data->msg)); - CHECK(secp256k1_ec_pubkey_serialize(data->ctx, pubkeyc, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED)); - for (j = 0; j < 32; j++) { - data->sig[j + 32] = data->msg[j]; /* Move former message to S. */ - data->msg[j] = data->sig[j]; /* Move former R to message. */ - data->sig[j] = pubkeyc[j + 1]; /* Move recovered pubkey X coordinate to R (which must be a valid X coordinate). */ - } - } -} - -void bench_recover_setup(void* arg) { - int i; - bench_recover_t *data = (bench_recover_t*)arg; - - for (i = 0; i < 32; i++) { - data->msg[i] = 1 + i; - } - for (i = 0; i < 64; i++) { - data->sig[i] = 65 + i; - } -} - -int main(void) { - bench_recover_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); - - run_benchmark("ecdsa_recover", bench_recover, bench_recover_setup, NULL, &data, 10, 20000); - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c deleted file mode 100644 index 5f137dda..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_schnorr_verify.c +++ /dev/null @@ -1,73 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "include/secp256k1.h" -#include "include/secp256k1_schnorr.h" -#include "util.h" -#include "bench.h" - -typedef struct { - unsigned char key[32]; - unsigned char sig[64]; - unsigned char pubkey[33]; - size_t pubkeylen; -} benchmark_schnorr_sig_t; - -typedef struct { - secp256k1_context *ctx; - unsigned char msg[32]; - benchmark_schnorr_sig_t sigs[64]; - int numsigs; -} benchmark_schnorr_verify_t; - -static void benchmark_schnorr_init(void* arg) { - int i, k; - benchmark_schnorr_verify_t* data = (benchmark_schnorr_verify_t*)arg; - - for (i = 0; i < 32; i++) { - data->msg[i] = 1 + i; - } - for (k = 0; k < data->numsigs; k++) { - secp256k1_pubkey pubkey; - for (i = 0; i < 32; i++) { - data->sigs[k].key[i] = 33 + i + k; - } - secp256k1_schnorr_sign(data->ctx, data->sigs[k].sig, data->msg, data->sigs[k].key, NULL, NULL); - data->sigs[k].pubkeylen = 33; - CHECK(secp256k1_ec_pubkey_create(data->ctx, &pubkey, data->sigs[k].key)); - CHECK(secp256k1_ec_pubkey_serialize(data->ctx, data->sigs[k].pubkey, &data->sigs[k].pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED)); - } -} - -static void benchmark_schnorr_verify(void* arg) { - int i; - benchmark_schnorr_verify_t* data = (benchmark_schnorr_verify_t*)arg; - - for (i = 0; i < 20000 / data->numsigs; i++) { - secp256k1_pubkey pubkey; - data->sigs[0].sig[(i >> 8) % 64] ^= (i & 0xFF); - CHECK(secp256k1_ec_pubkey_parse(data->ctx, &pubkey, data->sigs[0].pubkey, data->sigs[0].pubkeylen)); - CHECK(secp256k1_schnorr_verify(data->ctx, data->sigs[0].sig, data->msg, &pubkey) == ((i & 0xFF) == 0)); - data->sigs[0].sig[(i >> 8) % 64] ^= (i & 0xFF); - } -} - - - -int main(void) { - benchmark_schnorr_verify_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - data.numsigs = 1; - run_benchmark("schnorr_verify", benchmark_schnorr_verify, benchmark_schnorr_init, NULL, &data, 10, 20000); - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c deleted file mode 100644 index ed7224d7..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_sign.c +++ /dev/null @@ -1,56 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include "include/secp256k1.h" -#include "util.h" -#include "bench.h" - -typedef struct { - secp256k1_context* ctx; - unsigned char msg[32]; - unsigned char key[32]; -} bench_sign_t; - -static void bench_sign_setup(void* arg) { - int i; - bench_sign_t *data = (bench_sign_t*)arg; - - for (i = 0; i < 32; i++) { - data->msg[i] = i + 1; - } - for (i = 0; i < 32; i++) { - data->key[i] = i + 65; - } -} - -static void bench_sign(void* arg) { - int i; - bench_sign_t *data = (bench_sign_t*)arg; - - unsigned char sig[74]; - for (i = 0; i < 20000; i++) { - size_t siglen = 74; - int j; - secp256k1_ecdsa_signature signature; - CHECK(secp256k1_ecdsa_sign(data->ctx, &signature, data->msg, data->key, NULL, NULL)); - CHECK(secp256k1_ecdsa_signature_serialize_der(data->ctx, sig, &siglen, &signature)); - for (j = 0; j < 32; j++) { - data->msg[j] = sig[j]; - data->key[j] = sig[j + 32]; - } - } -} - -int main(void) { - bench_sign_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - - run_benchmark("ecdsa_sign", bench_sign, bench_sign_setup, NULL, &data, 10, 20000); - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c deleted file mode 100644 index 418defa0..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/bench_verify.c +++ /dev/null @@ -1,112 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include -#include - -#include "include/secp256k1.h" -#include "util.h" -#include "bench.h" - -#ifdef ENABLE_OPENSSL_TESTS -#include -#include -#include -#endif - -typedef struct { - secp256k1_context *ctx; - unsigned char msg[32]; - unsigned char key[32]; - unsigned char sig[72]; - size_t siglen; - unsigned char pubkey[33]; - size_t pubkeylen; -#ifdef ENABLE_OPENSSL_TESTS - EC_GROUP* ec_group; -#endif -} benchmark_verify_t; - -static void benchmark_verify(void* arg) { - int i; - benchmark_verify_t* data = (benchmark_verify_t*)arg; - - for (i = 0; i < 20000; i++) { - secp256k1_pubkey pubkey; - secp256k1_ecdsa_signature sig; - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - CHECK(secp256k1_ec_pubkey_parse(data->ctx, &pubkey, data->pubkey, data->pubkeylen) == 1); - CHECK(secp256k1_ecdsa_signature_parse_der(data->ctx, &sig, data->sig, data->siglen) == 1); - CHECK(secp256k1_ecdsa_verify(data->ctx, &sig, data->msg, &pubkey) == (i == 0)); - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - } -} - -#ifdef ENABLE_OPENSSL_TESTS -static void benchmark_verify_openssl(void* arg) { - int i; - benchmark_verify_t* data = (benchmark_verify_t*)arg; - - for (i = 0; i < 20000; i++) { - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - { - EC_KEY *pkey = EC_KEY_new(); - const unsigned char *pubkey = &data->pubkey[0]; - int result; - - CHECK(pkey != NULL); - result = EC_KEY_set_group(pkey, data->ec_group); - CHECK(result); - result = (o2i_ECPublicKey(&pkey, &pubkey, data->pubkeylen)) != NULL; - CHECK(result); - result = ECDSA_verify(0, &data->msg[0], sizeof(data->msg), &data->sig[0], data->siglen, pkey) == (i == 0); - CHECK(result); - EC_KEY_free(pkey); - } - data->sig[data->siglen - 1] ^= (i & 0xFF); - data->sig[data->siglen - 2] ^= ((i >> 8) & 0xFF); - data->sig[data->siglen - 3] ^= ((i >> 16) & 0xFF); - } -} -#endif - -int main(void) { - int i; - secp256k1_pubkey pubkey; - secp256k1_ecdsa_signature sig; - benchmark_verify_t data; - - data.ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - for (i = 0; i < 32; i++) { - data.msg[i] = 1 + i; - } - for (i = 0; i < 32; i++) { - data.key[i] = 33 + i; - } - data.siglen = 72; - CHECK(secp256k1_ecdsa_sign(data.ctx, &sig, data.msg, data.key, NULL, NULL)); - CHECK(secp256k1_ecdsa_signature_serialize_der(data.ctx, data.sig, &data.siglen, &sig)); - CHECK(secp256k1_ec_pubkey_create(data.ctx, &pubkey, data.key)); - data.pubkeylen = 33; - CHECK(secp256k1_ec_pubkey_serialize(data.ctx, data.pubkey, &data.pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - - run_benchmark("ecdsa_verify", benchmark_verify, NULL, NULL, &data, 10, 20000); -#ifdef ENABLE_OPENSSL_TESTS - data.ec_group = EC_GROUP_new_by_curve_name(NID_secp256k1); - run_benchmark("ecdsa_verify_openssl", benchmark_verify_openssl, NULL, NULL, &data, 10, 20000); - EC_GROUP_free(data.ec_group); -#endif - - secp256k1_context_destroy(data.ctx); - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h deleted file mode 100644 index 54ae101b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa.h +++ /dev/null @@ -1,21 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECDSA_ -#define _SECP256K1_ECDSA_ - -#include - -#include "scalar.h" -#include "group.h" -#include "ecmult.h" - -static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *r, secp256k1_scalar *s, const unsigned char *sig, size_t size); -static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar *r, const secp256k1_scalar *s); -static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const secp256k1_scalar* r, const secp256k1_scalar* s, const secp256k1_ge *pubkey, const secp256k1_scalar *message); -static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h deleted file mode 100644 index 453bb118..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecdsa_impl.h +++ /dev/null @@ -1,315 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - - -#ifndef _SECP256K1_ECDSA_IMPL_H_ -#define _SECP256K1_ECDSA_IMPL_H_ - -#include "scalar.h" -#include "field.h" -#include "group.h" -#include "ecmult.h" -#include "ecmult_gen.h" -#include "ecdsa.h" - -/** Group order for secp256k1 defined as 'n' in "Standards for Efficient Cryptography" (SEC2) 2.7.1 - * sage: for t in xrange(1023, -1, -1): - * .. p = 2**256 - 2**32 - t - * .. if p.is_prime(): - * .. print '%x'%p - * .. break - * 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f' - * sage: a = 0 - * sage: b = 7 - * sage: F = FiniteField (p) - * sage: '%x' % (EllipticCurve ([F (a), F (b)]).order()) - * 'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141' - */ -static const secp256k1_fe secp256k1_ecdsa_const_order_as_fe = SECP256K1_FE_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL, - 0xBAAEDCE6UL, 0xAF48A03BUL, 0xBFD25E8CUL, 0xD0364141UL -); - -/** Difference between field and order, values 'p' and 'n' values defined in - * "Standards for Efficient Cryptography" (SEC2) 2.7.1. - * sage: p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F - * sage: a = 0 - * sage: b = 7 - * sage: F = FiniteField (p) - * sage: '%x' % (p - EllipticCurve ([F (a), F (b)]).order()) - * '14551231950b75fc4402da1722fc9baee' - */ -static const secp256k1_fe secp256k1_ecdsa_const_p_minus_order = SECP256K1_FE_CONST( - 0, 0, 0, 1, 0x45512319UL, 0x50B75FC4UL, 0x402DA172UL, 0x2FC9BAEEUL -); - -static int secp256k1_der_read_len(const unsigned char **sigp, const unsigned char *sigend) { - int lenleft, b1; - size_t ret = 0; - if (*sigp >= sigend) { - return -1; - } - b1 = *((*sigp)++); - if (b1 == 0xFF) { - /* X.690-0207 8.1.3.5.c the value 0xFF shall not be used. */ - return -1; - } - if ((b1 & 0x80) == 0) { - /* X.690-0207 8.1.3.4 short form length octets */ - return b1; - } - if (b1 == 0x80) { - /* Indefinite length is not allowed in DER. */ - return -1; - } - /* X.690-207 8.1.3.5 long form length octets */ - lenleft = b1 & 0x7F; - if (lenleft > sigend - *sigp) { - return -1; - } - if (**sigp == 0) { - /* Not the shortest possible length encoding. */ - return -1; - } - if ((size_t)lenleft > sizeof(size_t)) { - /* The resulting length would exceed the range of a size_t, so - * certainly longer than the passed array size. - */ - return -1; - } - while (lenleft > 0) { - if ((ret >> ((sizeof(size_t) - 1) * 8)) != 0) { - } - ret = (ret << 8) | **sigp; - if (ret + lenleft > (size_t)(sigend - *sigp)) { - /* Result exceeds the length of the passed array. */ - return -1; - } - (*sigp)++; - lenleft--; - } - if (ret < 128) { - /* Not the shortest possible length encoding. */ - return -1; - } - return ret; -} - -static int secp256k1_der_parse_integer(secp256k1_scalar *r, const unsigned char **sig, const unsigned char *sigend) { - int overflow = 0; - unsigned char ra[32] = {0}; - int rlen; - - if (*sig == sigend || **sig != 0x02) { - /* Not a primitive integer (X.690-0207 8.3.1). */ - return 0; - } - (*sig)++; - rlen = secp256k1_der_read_len(sig, sigend); - if (rlen <= 0 || (*sig) + rlen > sigend) { - /* Exceeds bounds or not at least length 1 (X.690-0207 8.3.1). */ - return 0; - } - if (**sig == 0x00 && rlen > 1 && (((*sig)[1]) & 0x80) == 0x00) { - /* Excessive 0x00 padding. */ - return 0; - } - if (**sig == 0xFF && rlen > 1 && (((*sig)[1]) & 0x80) == 0x80) { - /* Excessive 0xFF padding. */ - return 0; - } - if ((**sig & 0x80) == 0x80) { - /* Negative. */ - overflow = 1; - } - while (rlen > 0 && **sig == 0) { - /* Skip leading zero bytes */ - rlen--; - (*sig)++; - } - if (rlen > 32) { - overflow = 1; - } - if (!overflow) { - memcpy(ra + 32 - rlen, *sig, rlen); - secp256k1_scalar_set_b32(r, ra, &overflow); - } - if (overflow) { - secp256k1_scalar_set_int(r, 0); - } - (*sig) += rlen; - return 1; -} - -static int secp256k1_ecdsa_sig_parse(secp256k1_scalar *rr, secp256k1_scalar *rs, const unsigned char *sig, size_t size) { - const unsigned char *sigend = sig + size; - int rlen; - if (sig == sigend || *(sig++) != 0x30) { - /* The encoding doesn't start with a constructed sequence (X.690-0207 8.9.1). */ - return 0; - } - rlen = secp256k1_der_read_len(&sig, sigend); - if (rlen < 0 || sig + rlen > sigend) { - /* Tuple exceeds bounds */ - return 0; - } - if (sig + rlen != sigend) { - /* Garbage after tuple. */ - return 0; - } - - if (!secp256k1_der_parse_integer(rr, &sig, sigend)) { - return 0; - } - if (!secp256k1_der_parse_integer(rs, &sig, sigend)) { - return 0; - } - - if (sig != sigend) { - /* Trailing garbage inside tuple. */ - return 0; - } - - return 1; -} - -static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, size_t *size, const secp256k1_scalar* ar, const secp256k1_scalar* as) { - unsigned char r[33] = {0}, s[33] = {0}; - unsigned char *rp = r, *sp = s; - size_t lenR = 33, lenS = 33; - secp256k1_scalar_get_b32(&r[1], ar); - secp256k1_scalar_get_b32(&s[1], as); - while (lenR > 1 && rp[0] == 0 && rp[1] < 0x80) { lenR--; rp++; } - while (lenS > 1 && sp[0] == 0 && sp[1] < 0x80) { lenS--; sp++; } - if (*size < 6+lenS+lenR) { - *size = 6 + lenS + lenR; - return 0; - } - *size = 6 + lenS + lenR; - sig[0] = 0x30; - sig[1] = 4 + lenS + lenR; - sig[2] = 0x02; - sig[3] = lenR; - memcpy(sig+4, rp, lenR); - sig[4+lenR] = 0x02; - sig[5+lenR] = lenS; - memcpy(sig+lenR+6, sp, lenS); - return 1; -} - -static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context *ctx, const secp256k1_scalar *sigr, const secp256k1_scalar *sigs, const secp256k1_ge *pubkey, const secp256k1_scalar *message) { - unsigned char c[32]; - secp256k1_scalar sn, u1, u2; -#if !defined(EXHAUSTIVE_TEST_ORDER) - secp256k1_fe xr; -#endif - secp256k1_gej pubkeyj; - secp256k1_gej pr; - - if (secp256k1_scalar_is_zero(sigr) || secp256k1_scalar_is_zero(sigs)) { - return 0; - } - - secp256k1_scalar_inverse_var(&sn, sigs); - secp256k1_scalar_mul(&u1, &sn, message); - secp256k1_scalar_mul(&u2, &sn, sigr); - secp256k1_gej_set_ge(&pubkeyj, pubkey); - secp256k1_ecmult(ctx, &pr, &pubkeyj, &u2, &u1); - if (secp256k1_gej_is_infinity(&pr)) { - return 0; - } - -#if defined(EXHAUSTIVE_TEST_ORDER) -{ - secp256k1_scalar computed_r; - secp256k1_ge pr_ge; - secp256k1_ge_set_gej(&pr_ge, &pr); - secp256k1_fe_normalize(&pr_ge.x); - - secp256k1_fe_get_b32(c, &pr_ge.x); - secp256k1_scalar_set_b32(&computed_r, c, NULL); - return secp256k1_scalar_eq(sigr, &computed_r); -} -#else - secp256k1_scalar_get_b32(c, sigr); - secp256k1_fe_set_b32(&xr, c); - - /** We now have the recomputed R point in pr, and its claimed x coordinate (modulo n) - * in xr. Naively, we would extract the x coordinate from pr (requiring a inversion modulo p), - * compute the remainder modulo n, and compare it to xr. However: - * - * xr == X(pr) mod n - * <=> exists h. (xr + h * n < p && xr + h * n == X(pr)) - * [Since 2 * n > p, h can only be 0 or 1] - * <=> (xr == X(pr)) || (xr + n < p && xr + n == X(pr)) - * [In Jacobian coordinates, X(pr) is pr.x / pr.z^2 mod p] - * <=> (xr == pr.x / pr.z^2 mod p) || (xr + n < p && xr + n == pr.x / pr.z^2 mod p) - * [Multiplying both sides of the equations by pr.z^2 mod p] - * <=> (xr * pr.z^2 mod p == pr.x) || (xr + n < p && (xr + n) * pr.z^2 mod p == pr.x) - * - * Thus, we can avoid the inversion, but we have to check both cases separately. - * secp256k1_gej_eq_x implements the (xr * pr.z^2 mod p == pr.x) test. - */ - if (secp256k1_gej_eq_x_var(&xr, &pr)) { - /* xr * pr.z^2 mod p == pr.x, so the signature is valid. */ - return 1; - } - if (secp256k1_fe_cmp_var(&xr, &secp256k1_ecdsa_const_p_minus_order) >= 0) { - /* xr + n >= p, so we can skip testing the second case. */ - return 0; - } - secp256k1_fe_add(&xr, &secp256k1_ecdsa_const_order_as_fe); - if (secp256k1_gej_eq_x_var(&xr, &pr)) { - /* (xr + n) * pr.z^2 mod p == pr.x, so the signature is valid. */ - return 1; - } - return 0; -#endif -} - -static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, secp256k1_scalar *sigr, secp256k1_scalar *sigs, const secp256k1_scalar *seckey, const secp256k1_scalar *message, const secp256k1_scalar *nonce, int *recid) { - unsigned char b[32]; - secp256k1_gej rp; - secp256k1_ge r; - secp256k1_scalar n; - int overflow = 0; - - secp256k1_ecmult_gen(ctx, &rp, nonce); - secp256k1_ge_set_gej(&r, &rp); - secp256k1_fe_normalize(&r.x); - secp256k1_fe_normalize(&r.y); - secp256k1_fe_get_b32(b, &r.x); - secp256k1_scalar_set_b32(sigr, b, &overflow); - /* These two conditions should be checked before calling */ - VERIFY_CHECK(!secp256k1_scalar_is_zero(sigr)); - VERIFY_CHECK(overflow == 0); - - if (recid) { - /* The overflow condition is cryptographically unreachable as hitting it requires finding the discrete log - * of some P where P.x >= order, and only 1 in about 2^127 points meet this criteria. - */ - *recid = (overflow ? 2 : 0) | (secp256k1_fe_is_odd(&r.y) ? 1 : 0); - } - secp256k1_scalar_mul(&n, sigr, seckey); - secp256k1_scalar_add(&n, &n, message); - secp256k1_scalar_inverse(sigs, nonce); - secp256k1_scalar_mul(sigs, sigs, &n); - secp256k1_scalar_clear(&n); - secp256k1_gej_clear(&rp); - secp256k1_ge_clear(&r); - if (secp256k1_scalar_is_zero(sigs)) { - return 0; - } - if (secp256k1_scalar_is_high(sigs)) { - secp256k1_scalar_negate(sigs, sigs); - if (recid) { - *recid ^= 1; - } - } - return 1; -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h deleted file mode 100644 index 42739a3b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey.h +++ /dev/null @@ -1,25 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECKEY_ -#define _SECP256K1_ECKEY_ - -#include - -#include "group.h" -#include "scalar.h" -#include "ecmult.h" -#include "ecmult_gen.h" - -static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size); -static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed); - -static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak); -static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); -static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak); -static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h deleted file mode 100644 index ce38071a..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/eckey_impl.h +++ /dev/null @@ -1,99 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECKEY_IMPL_H_ -#define _SECP256K1_ECKEY_IMPL_H_ - -#include "eckey.h" - -#include "scalar.h" -#include "field.h" -#include "group.h" -#include "ecmult_gen.h" - -static int secp256k1_eckey_pubkey_parse(secp256k1_ge *elem, const unsigned char *pub, size_t size) { - if (size == 33 && (pub[0] == 0x02 || pub[0] == 0x03)) { - secp256k1_fe x; - return secp256k1_fe_set_b32(&x, pub+1) && secp256k1_ge_set_xo_var(elem, &x, pub[0] == 0x03); - } else if (size == 65 && (pub[0] == 0x04 || pub[0] == 0x06 || pub[0] == 0x07)) { - secp256k1_fe x, y; - if (!secp256k1_fe_set_b32(&x, pub+1) || !secp256k1_fe_set_b32(&y, pub+33)) { - return 0; - } - secp256k1_ge_set_xy(elem, &x, &y); - if ((pub[0] == 0x06 || pub[0] == 0x07) && secp256k1_fe_is_odd(&y) != (pub[0] == 0x07)) { - return 0; - } - return secp256k1_ge_is_valid_var(elem); - } else { - return 0; - } -} - -static int secp256k1_eckey_pubkey_serialize(secp256k1_ge *elem, unsigned char *pub, size_t *size, int compressed) { - if (secp256k1_ge_is_infinity(elem)) { - return 0; - } - secp256k1_fe_normalize_var(&elem->x); - secp256k1_fe_normalize_var(&elem->y); - secp256k1_fe_get_b32(&pub[1], &elem->x); - if (compressed) { - *size = 33; - pub[0] = 0x02 | (secp256k1_fe_is_odd(&elem->y) ? 0x01 : 0x00); - } else { - *size = 65; - pub[0] = 0x04; - secp256k1_fe_get_b32(&pub[33], &elem->y); - } - return 1; -} - -static int secp256k1_eckey_privkey_tweak_add(secp256k1_scalar *key, const secp256k1_scalar *tweak) { - secp256k1_scalar_add(key, key, tweak); - if (secp256k1_scalar_is_zero(key)) { - return 0; - } - return 1; -} - -static int secp256k1_eckey_pubkey_tweak_add(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) { - secp256k1_gej pt; - secp256k1_scalar one; - secp256k1_gej_set_ge(&pt, key); - secp256k1_scalar_set_int(&one, 1); - secp256k1_ecmult(ctx, &pt, &pt, &one, tweak); - - if (secp256k1_gej_is_infinity(&pt)) { - return 0; - } - secp256k1_ge_set_gej(key, &pt); - return 1; -} - -static int secp256k1_eckey_privkey_tweak_mul(secp256k1_scalar *key, const secp256k1_scalar *tweak) { - if (secp256k1_scalar_is_zero(tweak)) { - return 0; - } - - secp256k1_scalar_mul(key, key, tweak); - return 1; -} - -static int secp256k1_eckey_pubkey_tweak_mul(const secp256k1_ecmult_context *ctx, secp256k1_ge *key, const secp256k1_scalar *tweak) { - secp256k1_scalar zero; - secp256k1_gej pt; - if (secp256k1_scalar_is_zero(tweak)) { - return 0; - } - - secp256k1_scalar_set_int(&zero, 0); - secp256k1_gej_set_ge(&pt, key); - secp256k1_ecmult(ctx, &pt, &pt, tweak, &zero); - secp256k1_ge_set_gej(key, &pt); - return 1; -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h deleted file mode 100644 index 20484134..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult.h +++ /dev/null @@ -1,31 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_ -#define _SECP256K1_ECMULT_ - -#include "num.h" -#include "group.h" - -typedef struct { - /* For accelerating the computation of a*P + b*G: */ - secp256k1_ge_storage (*pre_g)[]; /* odd multiples of the generator */ -#ifdef USE_ENDOMORPHISM - secp256k1_ge_storage (*pre_g_128)[]; /* odd multiples of 2^128*generator */ -#endif -} secp256k1_ecmult_context; - -static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx); -static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb); -static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, - const secp256k1_ecmult_context *src, const secp256k1_callback *cb); -static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx); -static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx); - -/** Double multiply: R = na*A + ng*G */ -static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h deleted file mode 100644 index 2b009765..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const.h +++ /dev/null @@ -1,15 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_CONST_ -#define _SECP256K1_ECMULT_CONST_ - -#include "scalar.h" -#include "group.h" - -static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *q); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h deleted file mode 100644 index 0db314c4..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_const_impl.h +++ /dev/null @@ -1,239 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Pieter Wuille, Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_CONST_IMPL_ -#define _SECP256K1_ECMULT_CONST_IMPL_ - -#include "scalar.h" -#include "group.h" -#include "ecmult_const.h" -#include "ecmult_impl.h" - -#ifdef USE_ENDOMORPHISM - #define WNAF_BITS 128 -#else - #define WNAF_BITS 256 -#endif -#define WNAF_SIZE(w) ((WNAF_BITS + (w) - 1) / (w)) - -/* This is like `ECMULT_TABLE_GET_GE` but is constant time */ -#define ECMULT_CONST_TABLE_GET_GE(r,pre,n,w) do { \ - int m; \ - int abs_n = (n) * (((n) > 0) * 2 - 1); \ - int idx_n = abs_n / 2; \ - secp256k1_fe neg_y; \ - VERIFY_CHECK(((n) & 1) == 1); \ - VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \ - VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \ - VERIFY_SETUP(secp256k1_fe_clear(&(r)->x)); \ - VERIFY_SETUP(secp256k1_fe_clear(&(r)->y)); \ - for (m = 0; m < ECMULT_TABLE_SIZE(w); m++) { \ - /* This loop is used to avoid secret data in array indices. See - * the comment in ecmult_gen_impl.h for rationale. */ \ - secp256k1_fe_cmov(&(r)->x, &(pre)[m].x, m == idx_n); \ - secp256k1_fe_cmov(&(r)->y, &(pre)[m].y, m == idx_n); \ - } \ - (r)->infinity = 0; \ - secp256k1_fe_negate(&neg_y, &(r)->y, 1); \ - secp256k1_fe_cmov(&(r)->y, &neg_y, (n) != abs_n); \ -} while(0) - - -/** Convert a number to WNAF notation. The number becomes represented by sum(2^{wi} * wnaf[i], i=0..return_val) - * with the following guarantees: - * - each wnaf[i] an odd integer between -(1 << w) and (1 << w) - * - each wnaf[i] is nonzero - * - the number of words set is returned; this is always (WNAF_BITS + w - 1) / w - * - * Adapted from `The Width-w NAF Method Provides Small Memory and Fast Elliptic Scalar - * Multiplications Secure against Side Channel Attacks`, Okeya and Tagaki. M. Joye (Ed.) - * CT-RSA 2003, LNCS 2612, pp. 328-443, 2003. Springer-Verlagy Berlin Heidelberg 2003 - * - * Numbers reference steps of `Algorithm SPA-resistant Width-w NAF with Odd Scalar` on pp. 335 - */ -static int secp256k1_wnaf_const(int *wnaf, secp256k1_scalar s, int w) { - int global_sign; - int skew = 0; - int word = 0; - - /* 1 2 3 */ - int u_last; - int u; - - int flip; - int bit; - secp256k1_scalar neg_s; - int not_neg_one; - /* Note that we cannot handle even numbers by negating them to be odd, as is - * done in other implementations, since if our scalars were specified to have - * width < 256 for performance reasons, their negations would have width 256 - * and we'd lose any performance benefit. Instead, we use a technique from - * Section 4.2 of the Okeya/Tagaki paper, which is to add either 1 (for even) - * or 2 (for odd) to the number we are encoding, returning a skew value indicating - * this, and having the caller compensate after doing the multiplication. */ - - /* Negative numbers will be negated to keep their bit representation below the maximum width */ - flip = secp256k1_scalar_is_high(&s); - /* We add 1 to even numbers, 2 to odd ones, noting that negation flips parity */ - bit = flip ^ !secp256k1_scalar_is_even(&s); - /* We check for negative one, since adding 2 to it will cause an overflow */ - secp256k1_scalar_negate(&neg_s, &s); - not_neg_one = !secp256k1_scalar_is_one(&neg_s); - secp256k1_scalar_cadd_bit(&s, bit, not_neg_one); - /* If we had negative one, flip == 1, s.d[0] == 0, bit == 1, so caller expects - * that we added two to it and flipped it. In fact for -1 these operations are - * identical. We only flipped, but since skewing is required (in the sense that - * the skew must be 1 or 2, never zero) and flipping is not, we need to change - * our flags to claim that we only skewed. */ - global_sign = secp256k1_scalar_cond_negate(&s, flip); - global_sign *= not_neg_one * 2 - 1; - skew = 1 << bit; - - /* 4 */ - u_last = secp256k1_scalar_shr_int(&s, w); - while (word * w < WNAF_BITS) { - int sign; - int even; - - /* 4.1 4.4 */ - u = secp256k1_scalar_shr_int(&s, w); - /* 4.2 */ - even = ((u & 1) == 0); - sign = 2 * (u_last > 0) - 1; - u += sign * even; - u_last -= sign * even * (1 << w); - - /* 4.3, adapted for global sign change */ - wnaf[word++] = u_last * global_sign; - - u_last = u; - } - wnaf[word] = u * global_sign; - - VERIFY_CHECK(secp256k1_scalar_is_zero(&s)); - VERIFY_CHECK(word == WNAF_SIZE(w)); - return skew; -} - - -static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *scalar) { - secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_ge tmpa; - secp256k1_fe Z; - - int skew_1; - int wnaf_1[1 + WNAF_SIZE(WINDOW_A - 1)]; -#ifdef USE_ENDOMORPHISM - secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)]; - int wnaf_lam[1 + WNAF_SIZE(WINDOW_A - 1)]; - int skew_lam; - secp256k1_scalar q_1, q_lam; -#endif - - int i; - secp256k1_scalar sc = *scalar; - - /* build wnaf representation for q. */ -#ifdef USE_ENDOMORPHISM - /* split q into q_1 and q_lam (where q = q_1 + q_lam*lambda, and q_1 and q_lam are ~128 bit) */ - secp256k1_scalar_split_lambda(&q_1, &q_lam, &sc); - skew_1 = secp256k1_wnaf_const(wnaf_1, q_1, WINDOW_A - 1); - skew_lam = secp256k1_wnaf_const(wnaf_lam, q_lam, WINDOW_A - 1); -#else - skew_1 = secp256k1_wnaf_const(wnaf_1, sc, WINDOW_A - 1); -#endif - - /* Calculate odd multiples of a. - * All multiples are brought to the same Z 'denominator', which is stored - * in Z. Due to secp256k1' isomorphism we can do all operations pretending - * that the Z coordinate was 1, use affine addition formulae, and correct - * the Z coordinate of the result once at the end. - */ - secp256k1_gej_set_ge(r, a); - secp256k1_ecmult_odd_multiples_table_globalz_windowa(pre_a, &Z, r); - for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) { - secp256k1_fe_normalize_weak(&pre_a[i].y); - } -#ifdef USE_ENDOMORPHISM - for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) { - secp256k1_ge_mul_lambda(&pre_a_lam[i], &pre_a[i]); - } -#endif - - /* first loop iteration (separated out so we can directly set r, rather - * than having it start at infinity, get doubled several times, then have - * its new value added to it) */ - i = wnaf_1[WNAF_SIZE(WINDOW_A - 1)]; - VERIFY_CHECK(i != 0); - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a, i, WINDOW_A); - secp256k1_gej_set_ge(r, &tmpa); -#ifdef USE_ENDOMORPHISM - i = wnaf_lam[WNAF_SIZE(WINDOW_A - 1)]; - VERIFY_CHECK(i != 0); - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a_lam, i, WINDOW_A); - secp256k1_gej_add_ge(r, r, &tmpa); -#endif - /* remaining loop iterations */ - for (i = WNAF_SIZE(WINDOW_A - 1) - 1; i >= 0; i--) { - int n; - int j; - for (j = 0; j < WINDOW_A - 1; ++j) { - secp256k1_gej_double_nonzero(r, r, NULL); - } - - n = wnaf_1[i]; - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a, n, WINDOW_A); - VERIFY_CHECK(n != 0); - secp256k1_gej_add_ge(r, r, &tmpa); -#ifdef USE_ENDOMORPHISM - n = wnaf_lam[i]; - ECMULT_CONST_TABLE_GET_GE(&tmpa, pre_a_lam, n, WINDOW_A); - VERIFY_CHECK(n != 0); - secp256k1_gej_add_ge(r, r, &tmpa); -#endif - } - - secp256k1_fe_mul(&r->z, &r->z, &Z); - - { - /* Correct for wNAF skew */ - secp256k1_ge correction = *a; - secp256k1_ge_storage correction_1_stor; -#ifdef USE_ENDOMORPHISM - secp256k1_ge_storage correction_lam_stor; -#endif - secp256k1_ge_storage a2_stor; - secp256k1_gej tmpj; - secp256k1_gej_set_ge(&tmpj, &correction); - secp256k1_gej_double_var(&tmpj, &tmpj, NULL); - secp256k1_ge_set_gej(&correction, &tmpj); - secp256k1_ge_to_storage(&correction_1_stor, a); -#ifdef USE_ENDOMORPHISM - secp256k1_ge_to_storage(&correction_lam_stor, a); -#endif - secp256k1_ge_to_storage(&a2_stor, &correction); - - /* For odd numbers this is 2a (so replace it), for even ones a (so no-op) */ - secp256k1_ge_storage_cmov(&correction_1_stor, &a2_stor, skew_1 == 2); -#ifdef USE_ENDOMORPHISM - secp256k1_ge_storage_cmov(&correction_lam_stor, &a2_stor, skew_lam == 2); -#endif - - /* Apply the correction */ - secp256k1_ge_from_storage(&correction, &correction_1_stor); - secp256k1_ge_neg(&correction, &correction); - secp256k1_gej_add_ge(r, r, &correction); - -#ifdef USE_ENDOMORPHISM - secp256k1_ge_from_storage(&correction, &correction_lam_stor); - secp256k1_ge_neg(&correction, &correction); - secp256k1_ge_mul_lambda(&correction, &correction); - secp256k1_gej_add_ge(r, r, &correction); -#endif - } -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h deleted file mode 100644 index eb2cc9ea..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen.h +++ /dev/null @@ -1,43 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_GEN_ -#define _SECP256K1_ECMULT_GEN_ - -#include "scalar.h" -#include "group.h" - -typedef struct { - /* For accelerating the computation of a*G: - * To harden against timing attacks, use the following mechanism: - * * Break up the multiplicand into groups of 4 bits, called n_0, n_1, n_2, ..., n_63. - * * Compute sum(n_i * 16^i * G + U_i, i=0..63), where: - * * U_i = U * 2^i (for i=0..62) - * * U_i = U * (1-2^63) (for i=63) - * where U is a point with no known corresponding scalar. Note that sum(U_i, i=0..63) = 0. - * For each i, and each of the 16 possible values of n_i, (n_i * 16^i * G + U_i) is - * precomputed (call it prec(i, n_i)). The formula now becomes sum(prec(i, n_i), i=0..63). - * None of the resulting prec group elements have a known scalar, and neither do any of - * the intermediate sums while computing a*G. - */ - secp256k1_ge_storage (*prec)[64][16]; /* prec[j][i] = 16^j * i * G + U_i */ - secp256k1_scalar blind; - secp256k1_gej initial; -} secp256k1_ecmult_gen_context; - -static void secp256k1_ecmult_gen_context_init(secp256k1_ecmult_gen_context* ctx); -static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context* ctx, const secp256k1_callback* cb); -static void secp256k1_ecmult_gen_context_clone(secp256k1_ecmult_gen_context *dst, - const secp256k1_ecmult_gen_context* src, const secp256k1_callback* cb); -static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context* ctx); -static int secp256k1_ecmult_gen_context_is_built(const secp256k1_ecmult_gen_context* ctx); - -/** Multiply with the generator: R = a*G */ -static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context* ctx, secp256k1_gej *r, const secp256k1_scalar *a); - -static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const unsigned char *seed32); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h deleted file mode 100644 index 35f25460..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_gen_impl.h +++ /dev/null @@ -1,210 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014, 2015 Pieter Wuille, Gregory Maxwell * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_GEN_IMPL_H_ -#define _SECP256K1_ECMULT_GEN_IMPL_H_ - -#include "scalar.h" -#include "group.h" -#include "ecmult_gen.h" -#include "hash_impl.h" -#ifdef USE_ECMULT_STATIC_PRECOMPUTATION -#include "ecmult_static_context.h" -#endif -static void secp256k1_ecmult_gen_context_init(secp256k1_ecmult_gen_context *ctx) { - ctx->prec = NULL; -} - -static void secp256k1_ecmult_gen_context_build(secp256k1_ecmult_gen_context *ctx, const secp256k1_callback* cb) { -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - secp256k1_ge prec[1024]; - secp256k1_gej gj; - secp256k1_gej nums_gej; - int i, j; -#endif - - if (ctx->prec != NULL) { - return; - } -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - ctx->prec = (secp256k1_ge_storage (*)[64][16])checked_malloc(cb, sizeof(*ctx->prec)); - - /* get the generator */ - secp256k1_gej_set_ge(&gj, &secp256k1_ge_const_g); - - /* Construct a group element with no known corresponding scalar (nothing up my sleeve). */ - { - static const unsigned char nums_b32[33] = "The scalar for this x is unknown"; - secp256k1_fe nums_x; - secp256k1_ge nums_ge; - int r; - r = secp256k1_fe_set_b32(&nums_x, nums_b32); - (void)r; - VERIFY_CHECK(r); - r = secp256k1_ge_set_xo_var(&nums_ge, &nums_x, 0); - (void)r; - VERIFY_CHECK(r); - secp256k1_gej_set_ge(&nums_gej, &nums_ge); - /* Add G to make the bits in x uniformly distributed. */ - secp256k1_gej_add_ge_var(&nums_gej, &nums_gej, &secp256k1_ge_const_g, NULL); - } - - /* compute prec. */ - { - secp256k1_gej precj[1024]; /* Jacobian versions of prec. */ - secp256k1_gej gbase; - secp256k1_gej numsbase; - gbase = gj; /* 16^j * G */ - numsbase = nums_gej; /* 2^j * nums. */ - for (j = 0; j < 64; j++) { - /* Set precj[j*16 .. j*16+15] to (numsbase, numsbase + gbase, ..., numsbase + 15*gbase). */ - precj[j*16] = numsbase; - for (i = 1; i < 16; i++) { - secp256k1_gej_add_var(&precj[j*16 + i], &precj[j*16 + i - 1], &gbase, NULL); - } - /* Multiply gbase by 16. */ - for (i = 0; i < 4; i++) { - secp256k1_gej_double_var(&gbase, &gbase, NULL); - } - /* Multiply numbase by 2. */ - secp256k1_gej_double_var(&numsbase, &numsbase, NULL); - if (j == 62) { - /* In the last iteration, numsbase is (1 - 2^j) * nums instead. */ - secp256k1_gej_neg(&numsbase, &numsbase); - secp256k1_gej_add_var(&numsbase, &numsbase, &nums_gej, NULL); - } - } - secp256k1_ge_set_all_gej_var(prec, precj, 1024, cb); - } - for (j = 0; j < 64; j++) { - for (i = 0; i < 16; i++) { - secp256k1_ge_to_storage(&(*ctx->prec)[j][i], &prec[j*16 + i]); - } - } -#else - (void)cb; - ctx->prec = (secp256k1_ge_storage (*)[64][16])secp256k1_ecmult_static_context; -#endif - secp256k1_ecmult_gen_blind(ctx, NULL); -} - -static int secp256k1_ecmult_gen_context_is_built(const secp256k1_ecmult_gen_context* ctx) { - return ctx->prec != NULL; -} - -static void secp256k1_ecmult_gen_context_clone(secp256k1_ecmult_gen_context *dst, - const secp256k1_ecmult_gen_context *src, const secp256k1_callback* cb) { - if (src->prec == NULL) { - dst->prec = NULL; - } else { -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - dst->prec = (secp256k1_ge_storage (*)[64][16])checked_malloc(cb, sizeof(*dst->prec)); - memcpy(dst->prec, src->prec, sizeof(*dst->prec)); -#else - (void)cb; - dst->prec = src->prec; -#endif - dst->initial = src->initial; - dst->blind = src->blind; - } -} - -static void secp256k1_ecmult_gen_context_clear(secp256k1_ecmult_gen_context *ctx) { -#ifndef USE_ECMULT_STATIC_PRECOMPUTATION - free(ctx->prec); -#endif - secp256k1_scalar_clear(&ctx->blind); - secp256k1_gej_clear(&ctx->initial); - ctx->prec = NULL; -} - -static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context *ctx, secp256k1_gej *r, const secp256k1_scalar *gn) { - secp256k1_ge add; - secp256k1_ge_storage adds; - secp256k1_scalar gnb; - int bits; - int i, j; - memset(&adds, 0, sizeof(adds)); - *r = ctx->initial; - /* Blind scalar/point multiplication by computing (n-b)G + bG instead of nG. */ - secp256k1_scalar_add(&gnb, gn, &ctx->blind); - add.infinity = 0; - for (j = 0; j < 64; j++) { - bits = secp256k1_scalar_get_bits(&gnb, j * 4, 4); - for (i = 0; i < 16; i++) { - /** This uses a conditional move to avoid any secret data in array indexes. - * _Any_ use of secret indexes has been demonstrated to result in timing - * sidechannels, even when the cache-line access patterns are uniform. - * See also: - * "A word of warning", CHES 2013 Rump Session, by Daniel J. Bernstein and Peter Schwabe - * (https://cryptojedi.org/peter/data/chesrump-20130822.pdf) and - * "Cache Attacks and Countermeasures: the Case of AES", RSA 2006, - * by Dag Arne Osvik, Adi Shamir, and Eran Tromer - * (http://www.tau.ac.il/~tromer/papers/cache.pdf) - */ - secp256k1_ge_storage_cmov(&adds, &(*ctx->prec)[j][i], i == bits); - } - secp256k1_ge_from_storage(&add, &adds); - secp256k1_gej_add_ge(r, r, &add); - } - bits = 0; - secp256k1_ge_clear(&add); - secp256k1_scalar_clear(&gnb); -} - -/* Setup blinding values for secp256k1_ecmult_gen. */ -static void secp256k1_ecmult_gen_blind(secp256k1_ecmult_gen_context *ctx, const unsigned char *seed32) { - secp256k1_scalar b; - secp256k1_gej gb; - secp256k1_fe s; - unsigned char nonce32[32]; - secp256k1_rfc6979_hmac_sha256_t rng; - int retry; - unsigned char keydata[64] = {0}; - if (seed32 == NULL) { - /* When seed is NULL, reset the initial point and blinding value. */ - secp256k1_gej_set_ge(&ctx->initial, &secp256k1_ge_const_g); - secp256k1_gej_neg(&ctx->initial, &ctx->initial); - secp256k1_scalar_set_int(&ctx->blind, 1); - } - /* The prior blinding value (if not reset) is chained forward by including it in the hash. */ - secp256k1_scalar_get_b32(nonce32, &ctx->blind); - /** Using a CSPRNG allows a failure free interface, avoids needing large amounts of random data, - * and guards against weak or adversarial seeds. This is a simpler and safer interface than - * asking the caller for blinding values directly and expecting them to retry on failure. - */ - memcpy(keydata, nonce32, 32); - if (seed32 != NULL) { - memcpy(keydata + 32, seed32, 32); - } - secp256k1_rfc6979_hmac_sha256_initialize(&rng, keydata, seed32 ? 64 : 32); - memset(keydata, 0, sizeof(keydata)); - /* Retry for out of range results to achieve uniformity. */ - do { - secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); - retry = !secp256k1_fe_set_b32(&s, nonce32); - retry |= secp256k1_fe_is_zero(&s); - } while (retry); /* This branch true is cryptographically unreachable. Requires sha256_hmac output > Fp. */ - /* Randomize the projection to defend against multiplier sidechannels. */ - secp256k1_gej_rescale(&ctx->initial, &s); - secp256k1_fe_clear(&s); - do { - secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); - secp256k1_scalar_set_b32(&b, nonce32, &retry); - /* A blinding value of 0 works, but would undermine the projection hardening. */ - retry |= secp256k1_scalar_is_zero(&b); - } while (retry); /* This branch true is cryptographically unreachable. Requires sha256_hmac output > order. */ - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - memset(nonce32, 0, 32); - secp256k1_ecmult_gen(ctx, &gb, &b); - secp256k1_scalar_negate(&b, &b); - ctx->blind = b; - ctx->initial = gb; - secp256k1_scalar_clear(&b); - secp256k1_gej_clear(&gb); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h deleted file mode 100644 index 4e40104a..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/ecmult_impl.h +++ /dev/null @@ -1,406 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_ECMULT_IMPL_H_ -#define _SECP256K1_ECMULT_IMPL_H_ - -#include - -#include "group.h" -#include "scalar.h" -#include "ecmult.h" - -#if defined(EXHAUSTIVE_TEST_ORDER) -/* We need to lower these values for exhaustive tests because - * the tables cannot have infinities in them (this breaks the - * affine-isomorphism stuff which tracks z-ratios) */ -# if EXHAUSTIVE_TEST_ORDER > 128 -# define WINDOW_A 5 -# define WINDOW_G 8 -# elif EXHAUSTIVE_TEST_ORDER > 8 -# define WINDOW_A 4 -# define WINDOW_G 4 -# else -# define WINDOW_A 2 -# define WINDOW_G 2 -# endif -#else -/* optimal for 128-bit and 256-bit exponents. */ -#define WINDOW_A 5 -/** larger numbers may result in slightly better performance, at the cost of - exponentially larger precomputed tables. */ -#ifdef USE_ENDOMORPHISM -/** Two tables for window size 15: 1.375 MiB. */ -#define WINDOW_G 15 -#else -/** One table for window size 16: 1.375 MiB. */ -#define WINDOW_G 16 -#endif -#endif - -/** The number of entries a table with precomputed multiples needs to have. */ -#define ECMULT_TABLE_SIZE(w) (1 << ((w)-2)) - -/** Fill a table 'prej' with precomputed odd multiples of a. Prej will contain - * the values [1*a,3*a,...,(2*n-1)*a], so it space for n values. zr[0] will - * contain prej[0].z / a.z. The other zr[i] values = prej[i].z / prej[i-1].z. - * Prej's Z values are undefined, except for the last value. - */ -static void secp256k1_ecmult_odd_multiples_table(int n, secp256k1_gej *prej, secp256k1_fe *zr, const secp256k1_gej *a) { - secp256k1_gej d; - secp256k1_ge a_ge, d_ge; - int i; - - VERIFY_CHECK(!a->infinity); - - secp256k1_gej_double_var(&d, a, NULL); - - /* - * Perform the additions on an isomorphism where 'd' is affine: drop the z coordinate - * of 'd', and scale the 1P starting value's x/y coordinates without changing its z. - */ - d_ge.x = d.x; - d_ge.y = d.y; - d_ge.infinity = 0; - - secp256k1_ge_set_gej_zinv(&a_ge, a, &d.z); - prej[0].x = a_ge.x; - prej[0].y = a_ge.y; - prej[0].z = a->z; - prej[0].infinity = 0; - - zr[0] = d.z; - for (i = 1; i < n; i++) { - secp256k1_gej_add_ge_var(&prej[i], &prej[i-1], &d_ge, &zr[i]); - } - - /* - * Each point in 'prej' has a z coordinate too small by a factor of 'd.z'. Only - * the final point's z coordinate is actually used though, so just update that. - */ - secp256k1_fe_mul(&prej[n-1].z, &prej[n-1].z, &d.z); -} - -/** Fill a table 'pre' with precomputed odd multiples of a. - * - * There are two versions of this function: - * - secp256k1_ecmult_odd_multiples_table_globalz_windowa which brings its - * resulting point set to a single constant Z denominator, stores the X and Y - * coordinates as ge_storage points in pre, and stores the global Z in rz. - * It only operates on tables sized for WINDOW_A wnaf multiples. - * - secp256k1_ecmult_odd_multiples_table_storage_var, which converts its - * resulting point set to actually affine points, and stores those in pre. - * It operates on tables of any size, but uses heap-allocated temporaries. - * - * To compute a*P + b*G, we compute a table for P using the first function, - * and for G using the second (which requires an inverse, but it only needs to - * happen once). - */ -static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a) { - secp256k1_gej prej[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_fe zr[ECMULT_TABLE_SIZE(WINDOW_A)]; - - /* Compute the odd multiples in Jacobian form. */ - secp256k1_ecmult_odd_multiples_table(ECMULT_TABLE_SIZE(WINDOW_A), prej, zr, a); - /* Bring them to the same Z denominator. */ - secp256k1_ge_globalz_set_table_gej(ECMULT_TABLE_SIZE(WINDOW_A), pre, globalz, prej, zr); -} - -static void secp256k1_ecmult_odd_multiples_table_storage_var(int n, secp256k1_ge_storage *pre, const secp256k1_gej *a, const secp256k1_callback *cb) { - secp256k1_gej *prej = (secp256k1_gej*)checked_malloc(cb, sizeof(secp256k1_gej) * n); - secp256k1_ge *prea = (secp256k1_ge*)checked_malloc(cb, sizeof(secp256k1_ge) * n); - secp256k1_fe *zr = (secp256k1_fe*)checked_malloc(cb, sizeof(secp256k1_fe) * n); - int i; - - /* Compute the odd multiples in Jacobian form. */ - secp256k1_ecmult_odd_multiples_table(n, prej, zr, a); - /* Convert them in batch to affine coordinates. */ - secp256k1_ge_set_table_gej_var(prea, prej, zr, n); - /* Convert them to compact storage form. */ - for (i = 0; i < n; i++) { - secp256k1_ge_to_storage(&pre[i], &prea[i]); - } - - free(prea); - free(prej); - free(zr); -} - -/** The following two macro retrieves a particular odd multiple from a table - * of precomputed multiples. */ -#define ECMULT_TABLE_GET_GE(r,pre,n,w) do { \ - VERIFY_CHECK(((n) & 1) == 1); \ - VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \ - VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \ - if ((n) > 0) { \ - *(r) = (pre)[((n)-1)/2]; \ - } else { \ - secp256k1_ge_neg((r), &(pre)[(-(n)-1)/2]); \ - } \ -} while(0) - -#define ECMULT_TABLE_GET_GE_STORAGE(r,pre,n,w) do { \ - VERIFY_CHECK(((n) & 1) == 1); \ - VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \ - VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \ - if ((n) > 0) { \ - secp256k1_ge_from_storage((r), &(pre)[((n)-1)/2]); \ - } else { \ - secp256k1_ge_from_storage((r), &(pre)[(-(n)-1)/2]); \ - secp256k1_ge_neg((r), (r)); \ - } \ -} while(0) - -static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx) { - ctx->pre_g = NULL; -#ifdef USE_ENDOMORPHISM - ctx->pre_g_128 = NULL; -#endif -} - -static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb) { - secp256k1_gej gj; - - if (ctx->pre_g != NULL) { - return; - } - - /* get the generator */ - secp256k1_gej_set_ge(&gj, &secp256k1_ge_const_g); - - ctx->pre_g = (secp256k1_ge_storage (*)[])checked_malloc(cb, sizeof((*ctx->pre_g)[0]) * ECMULT_TABLE_SIZE(WINDOW_G)); - - /* precompute the tables with odd multiples */ - secp256k1_ecmult_odd_multiples_table_storage_var(ECMULT_TABLE_SIZE(WINDOW_G), *ctx->pre_g, &gj, cb); - -#ifdef USE_ENDOMORPHISM - { - secp256k1_gej g_128j; - int i; - - ctx->pre_g_128 = (secp256k1_ge_storage (*)[])checked_malloc(cb, sizeof((*ctx->pre_g_128)[0]) * ECMULT_TABLE_SIZE(WINDOW_G)); - - /* calculate 2^128*generator */ - g_128j = gj; - for (i = 0; i < 128; i++) { - secp256k1_gej_double_var(&g_128j, &g_128j, NULL); - } - secp256k1_ecmult_odd_multiples_table_storage_var(ECMULT_TABLE_SIZE(WINDOW_G), *ctx->pre_g_128, &g_128j, cb); - } -#endif -} - -static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, - const secp256k1_ecmult_context *src, const secp256k1_callback *cb) { - if (src->pre_g == NULL) { - dst->pre_g = NULL; - } else { - size_t size = sizeof((*dst->pre_g)[0]) * ECMULT_TABLE_SIZE(WINDOW_G); - dst->pre_g = (secp256k1_ge_storage (*)[])checked_malloc(cb, size); - memcpy(dst->pre_g, src->pre_g, size); - } -#ifdef USE_ENDOMORPHISM - if (src->pre_g_128 == NULL) { - dst->pre_g_128 = NULL; - } else { - size_t size = sizeof((*dst->pre_g_128)[0]) * ECMULT_TABLE_SIZE(WINDOW_G); - dst->pre_g_128 = (secp256k1_ge_storage (*)[])checked_malloc(cb, size); - memcpy(dst->pre_g_128, src->pre_g_128, size); - } -#endif -} - -static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx) { - return ctx->pre_g != NULL; -} - -static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx) { - free(ctx->pre_g); -#ifdef USE_ENDOMORPHISM - free(ctx->pre_g_128); -#endif - secp256k1_ecmult_context_init(ctx); -} - -/** Convert a number to WNAF notation. The number becomes represented by sum(2^i * wnaf[i], i=0..bits), - * with the following guarantees: - * - each wnaf[i] is either 0, or an odd integer between -(1<<(w-1) - 1) and (1<<(w-1) - 1) - * - two non-zero entries in wnaf are separated by at least w-1 zeroes. - * - the number of set values in wnaf is returned. This number is at most 256, and at most one more - * than the number of bits in the (absolute value) of the input. - */ -static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a, int w) { - secp256k1_scalar s = *a; - int last_set_bit = -1; - int bit = 0; - int sign = 1; - int carry = 0; - - VERIFY_CHECK(wnaf != NULL); - VERIFY_CHECK(0 <= len && len <= 256); - VERIFY_CHECK(a != NULL); - VERIFY_CHECK(2 <= w && w <= 31); - - memset(wnaf, 0, len * sizeof(wnaf[0])); - - if (secp256k1_scalar_get_bits(&s, 255, 1)) { - secp256k1_scalar_negate(&s, &s); - sign = -1; - } - - while (bit < len) { - int now; - int word; - if (secp256k1_scalar_get_bits(&s, bit, 1) == (unsigned int)carry) { - bit++; - continue; - } - - now = w; - if (now > len - bit) { - now = len - bit; - } - - word = secp256k1_scalar_get_bits_var(&s, bit, now) + carry; - - carry = (word >> (w-1)) & 1; - word -= carry << w; - - wnaf[bit] = sign * word; - last_set_bit = bit; - - bit += now; - } -#ifdef VERIFY - CHECK(carry == 0); - while (bit < 256) { - CHECK(secp256k1_scalar_get_bits(&s, bit++, 1) == 0); - } -#endif - return last_set_bit + 1; -} - -static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng) { - secp256k1_ge pre_a[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_ge tmpa; - secp256k1_fe Z; -#ifdef USE_ENDOMORPHISM - secp256k1_ge pre_a_lam[ECMULT_TABLE_SIZE(WINDOW_A)]; - secp256k1_scalar na_1, na_lam; - /* Splitted G factors. */ - secp256k1_scalar ng_1, ng_128; - int wnaf_na_1[130]; - int wnaf_na_lam[130]; - int bits_na_1; - int bits_na_lam; - int wnaf_ng_1[129]; - int bits_ng_1; - int wnaf_ng_128[129]; - int bits_ng_128; -#else - int wnaf_na[256]; - int bits_na; - int wnaf_ng[256]; - int bits_ng; -#endif - int i; - int bits; - -#ifdef USE_ENDOMORPHISM - /* split na into na_1 and na_lam (where na = na_1 + na_lam*lambda, and na_1 and na_lam are ~128 bit) */ - secp256k1_scalar_split_lambda(&na_1, &na_lam, na); - - /* build wnaf representation for na_1 and na_lam. */ - bits_na_1 = secp256k1_ecmult_wnaf(wnaf_na_1, 130, &na_1, WINDOW_A); - bits_na_lam = secp256k1_ecmult_wnaf(wnaf_na_lam, 130, &na_lam, WINDOW_A); - VERIFY_CHECK(bits_na_1 <= 130); - VERIFY_CHECK(bits_na_lam <= 130); - bits = bits_na_1; - if (bits_na_lam > bits) { - bits = bits_na_lam; - } -#else - /* build wnaf representation for na. */ - bits_na = secp256k1_ecmult_wnaf(wnaf_na, 256, na, WINDOW_A); - bits = bits_na; -#endif - - /* Calculate odd multiples of a. - * All multiples are brought to the same Z 'denominator', which is stored - * in Z. Due to secp256k1' isomorphism we can do all operations pretending - * that the Z coordinate was 1, use affine addition formulae, and correct - * the Z coordinate of the result once at the end. - * The exception is the precomputed G table points, which are actually - * affine. Compared to the base used for other points, they have a Z ratio - * of 1/Z, so we can use secp256k1_gej_add_zinv_var, which uses the same - * isomorphism to efficiently add with a known Z inverse. - */ - secp256k1_ecmult_odd_multiples_table_globalz_windowa(pre_a, &Z, a); - -#ifdef USE_ENDOMORPHISM - for (i = 0; i < ECMULT_TABLE_SIZE(WINDOW_A); i++) { - secp256k1_ge_mul_lambda(&pre_a_lam[i], &pre_a[i]); - } - - /* split ng into ng_1 and ng_128 (where gn = gn_1 + gn_128*2^128, and gn_1 and gn_128 are ~128 bit) */ - secp256k1_scalar_split_128(&ng_1, &ng_128, ng); - - /* Build wnaf representation for ng_1 and ng_128 */ - bits_ng_1 = secp256k1_ecmult_wnaf(wnaf_ng_1, 129, &ng_1, WINDOW_G); - bits_ng_128 = secp256k1_ecmult_wnaf(wnaf_ng_128, 129, &ng_128, WINDOW_G); - if (bits_ng_1 > bits) { - bits = bits_ng_1; - } - if (bits_ng_128 > bits) { - bits = bits_ng_128; - } -#else - bits_ng = secp256k1_ecmult_wnaf(wnaf_ng, 256, ng, WINDOW_G); - if (bits_ng > bits) { - bits = bits_ng; - } -#endif - - secp256k1_gej_set_infinity(r); - - for (i = bits - 1; i >= 0; i--) { - int n; - secp256k1_gej_double_var(r, r, NULL); -#ifdef USE_ENDOMORPHISM - if (i < bits_na_1 && (n = wnaf_na_1[i])) { - ECMULT_TABLE_GET_GE(&tmpa, pre_a, n, WINDOW_A); - secp256k1_gej_add_ge_var(r, r, &tmpa, NULL); - } - if (i < bits_na_lam && (n = wnaf_na_lam[i])) { - ECMULT_TABLE_GET_GE(&tmpa, pre_a_lam, n, WINDOW_A); - secp256k1_gej_add_ge_var(r, r, &tmpa, NULL); - } - if (i < bits_ng_1 && (n = wnaf_ng_1[i])) { - ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g, n, WINDOW_G); - secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z); - } - if (i < bits_ng_128 && (n = wnaf_ng_128[i])) { - ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g_128, n, WINDOW_G); - secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z); - } -#else - if (i < bits_na && (n = wnaf_na[i])) { - ECMULT_TABLE_GET_GE(&tmpa, pre_a, n, WINDOW_A); - secp256k1_gej_add_ge_var(r, r, &tmpa, NULL); - } - if (i < bits_ng && (n = wnaf_ng[i])) { - ECMULT_TABLE_GET_GE_STORAGE(&tmpa, *ctx->pre_g, n, WINDOW_G); - secp256k1_gej_add_zinv_var(r, r, &tmpa, &Z); - } -#endif - } - - if (!r->infinity) { - secp256k1_fe_mul(&r->z, &r->z, &Z); - } -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h deleted file mode 100644 index bbb1ee86..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field.h +++ /dev/null @@ -1,132 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_ -#define _SECP256K1_FIELD_ - -/** Field element module. - * - * Field elements can be represented in several ways, but code accessing - * it (and implementations) need to take certain properties into account: - * - Each field element can be normalized or not. - * - Each field element has a magnitude, which represents how far away - * its representation is away from normalization. Normalized elements - * always have a magnitude of 1, but a magnitude of 1 doesn't imply - * normality. - */ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(USE_FIELD_10X26) -#include "field_10x26.h" -#elif defined(USE_FIELD_5X52) -#include "field_5x52.h" -#else -#error "Please select field implementation" -#endif - -#include "util.h" - -/** Normalize a field element. */ -static void secp256k1_fe_normalize(secp256k1_fe *r); - -/** Weakly normalize a field element: reduce it magnitude to 1, but don't fully normalize. */ -static void secp256k1_fe_normalize_weak(secp256k1_fe *r); - -/** Normalize a field element, without constant-time guarantee. */ -static void secp256k1_fe_normalize_var(secp256k1_fe *r); - -/** Verify whether a field element represents zero i.e. would normalize to a zero value. The field - * implementation may optionally normalize the input, but this should not be relied upon. */ -static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r); - -/** Verify whether a field element represents zero i.e. would normalize to a zero value. The field - * implementation may optionally normalize the input, but this should not be relied upon. */ -static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r); - -/** Set a field element equal to a small integer. Resulting field element is normalized. */ -static void secp256k1_fe_set_int(secp256k1_fe *r, int a); - -/** Sets a field element equal to zero, initializing all fields. */ -static void secp256k1_fe_clear(secp256k1_fe *a); - -/** Verify whether a field element is zero. Requires the input to be normalized. */ -static int secp256k1_fe_is_zero(const secp256k1_fe *a); - -/** Check the "oddness" of a field element. Requires the input to be normalized. */ -static int secp256k1_fe_is_odd(const secp256k1_fe *a); - -/** Compare two field elements. Requires magnitude-1 inputs. */ -static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b); - -/** Same as secp256k1_fe_equal, but may be variable time. */ -static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b); - -/** Compare two field elements. Requires both inputs to be normalized */ -static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b); - -/** Set a field element equal to 32-byte big endian value. If successful, the resulting field element is normalized. */ -static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a); - -/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */ -static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a); - -/** Set a field element equal to the additive inverse of another. Takes a maximum magnitude of the input - * as an argument. The magnitude of the output is one higher. */ -static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m); - -/** Multiplies the passed field element with a small integer constant. Multiplies the magnitude by that - * small integer. */ -static void secp256k1_fe_mul_int(secp256k1_fe *r, int a); - -/** Adds a field element to another. The result has the sum of the inputs' magnitudes as magnitude. */ -static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a); - -/** Sets a field element to be the product of two others. Requires the inputs' magnitudes to be at most 8. - * The output magnitude is 1 (but not guaranteed to be normalized). */ -static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b); - -/** Sets a field element to be the square of another. Requires the input's magnitude to be at most 8. - * The output magnitude is 1 (but not guaranteed to be normalized). */ -static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a); - -/** If a has a square root, it is computed in r and 1 is returned. If a does not - * have a square root, the root of its negation is computed and 0 is returned. - * The input's magnitude can be at most 8. The output magnitude is 1 (but not - * guaranteed to be normalized). The result in r will always be a square - * itself. */ -static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a); - -/** Checks whether a field element is a quadratic residue. */ -static int secp256k1_fe_is_quad_var(const secp256k1_fe *a); - -/** Sets a field element to be the (modular) inverse of another. Requires the input's magnitude to be - * at most 8. The output magnitude is 1 (but not guaranteed to be normalized). */ -static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a); - -/** Potentially faster version of secp256k1_fe_inv, without constant-time guarantee. */ -static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a); - -/** Calculate the (modular) inverses of a batch of field elements. Requires the inputs' magnitudes to be - * at most 8. The output magnitudes are 1 (but not guaranteed to be normalized). The inputs and - * outputs must not overlap in memory. */ -static void secp256k1_fe_inv_all_var(secp256k1_fe *r, const secp256k1_fe *a, size_t len); - -/** Convert a field element to the storage type. */ -static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a); - -/** Convert a field element back from the storage type. */ -static void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a); - -/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. */ -static void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag); - -/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. */ -static void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h deleted file mode 100644 index 61ee1e09..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26.h +++ /dev/null @@ -1,47 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_ -#define _SECP256K1_FIELD_REPR_ - -#include - -typedef struct { - /* X = sum(i=0..9, elem[i]*2^26) mod n */ - uint32_t n[10]; -#ifdef VERIFY - int magnitude; - int normalized; -#endif -} secp256k1_fe; - -/* Unpacks a constant into a overlapping multi-limbed FE element. */ -#define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \ - (d0) & 0x3FFFFFFUL, \ - (((uint32_t)d0) >> 26) | (((uint32_t)(d1) & 0xFFFFFUL) << 6), \ - (((uint32_t)d1) >> 20) | (((uint32_t)(d2) & 0x3FFFUL) << 12), \ - (((uint32_t)d2) >> 14) | (((uint32_t)(d3) & 0xFFUL) << 18), \ - (((uint32_t)d3) >> 8) | (((uint32_t)(d4) & 0x3UL) << 24), \ - (((uint32_t)d4) >> 2) & 0x3FFFFFFUL, \ - (((uint32_t)d4) >> 28) | (((uint32_t)(d5) & 0x3FFFFFUL) << 4), \ - (((uint32_t)d5) >> 22) | (((uint32_t)(d6) & 0xFFFFUL) << 10), \ - (((uint32_t)d6) >> 16) | (((uint32_t)(d7) & 0x3FFUL) << 16), \ - (((uint32_t)d7) >> 10) \ -} - -#ifdef VERIFY -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1} -#else -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))} -#endif - -typedef struct { - uint32_t n[8]; -} secp256k1_fe_storage; - -#define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }} -#define SECP256K1_FE_STORAGE_CONST_GET(d) d.n[7], d.n[6], d.n[5], d.n[4],d.n[3], d.n[2], d.n[1], d.n[0] -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h deleted file mode 100644 index 5fb092f1..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_10x26_impl.h +++ /dev/null @@ -1,1140 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_IMPL_H_ -#define _SECP256K1_FIELD_REPR_IMPL_H_ - -#include "util.h" -#include "num.h" -#include "field.h" - -#ifdef VERIFY -static void secp256k1_fe_verify(const secp256k1_fe *a) { - const uint32_t *d = a->n; - int m = a->normalized ? 1 : 2 * a->magnitude, r = 1; - r &= (d[0] <= 0x3FFFFFFUL * m); - r &= (d[1] <= 0x3FFFFFFUL * m); - r &= (d[2] <= 0x3FFFFFFUL * m); - r &= (d[3] <= 0x3FFFFFFUL * m); - r &= (d[4] <= 0x3FFFFFFUL * m); - r &= (d[5] <= 0x3FFFFFFUL * m); - r &= (d[6] <= 0x3FFFFFFUL * m); - r &= (d[7] <= 0x3FFFFFFUL * m); - r &= (d[8] <= 0x3FFFFFFUL * m); - r &= (d[9] <= 0x03FFFFFUL * m); - r &= (a->magnitude >= 0); - r &= (a->magnitude <= 32); - if (a->normalized) { - r &= (a->magnitude <= 1); - if (r && (d[9] == 0x03FFFFFUL)) { - uint32_t mid = d[8] & d[7] & d[6] & d[5] & d[4] & d[3] & d[2]; - if (mid == 0x3FFFFFFUL) { - r &= ((d[1] + 0x40UL + ((d[0] + 0x3D1UL) >> 26)) <= 0x3FFFFFFUL); - } - } - } - VERIFY_CHECK(r == 1); -} -#endif - -static void secp256k1_fe_normalize(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t m; - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; m = t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; m &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; m &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; m &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; m &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; m &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; m &= t8; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t9 >> 22) | ((t9 == 0x03FFFFFUL) & (m == 0x3FFFFFFUL) - & ((t1 + 0x40UL + ((t0 + 0x3D1UL) >> 26)) > 0x3FFFFFFUL)); - - /* Apply the final reduction (for constant-time behaviour, we do it always) */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; - - /* If t9 didn't carry to bit 22 already, then it should have after any final reduction */ - VERIFY_CHECK(t9 >> 22 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t9 &= 0x03FFFFFUL; - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_weak(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9; - -#ifdef VERIFY - r->magnitude = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_var(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t m; - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; m = t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; m &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; m &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; m &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; m &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; m &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; m &= t8; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t9 >> 22) | ((t9 == 0x03FFFFFUL) & (m == 0x3FFFFFFUL) - & ((t1 + 0x40UL + ((t0 + 0x3D1UL) >> 26)) > 0x3FFFFFFUL)); - - if (x) { - t0 += 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; - - /* If t9 didn't carry to bit 22 already, then it should have after any final reduction */ - VERIFY_CHECK(t9 >> 22 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t9 &= 0x03FFFFFUL; - } - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - r->n[5] = t5; r->n[6] = t6; r->n[7] = t7; r->n[8] = t8; r->n[9] = t9; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) { - uint32_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4], - t5 = r->n[5], t6 = r->n[6], t7 = r->n[7], t8 = r->n[8], t9 = r->n[9]; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - uint32_t z0, z1; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - uint32_t x = t9 >> 22; t9 &= 0x03FFFFFUL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; t1 += (x << 6); - t1 += (t0 >> 26); t0 &= 0x3FFFFFFUL; z0 = t0; z1 = t0 ^ 0x3D0UL; - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; z0 |= t1; z1 &= t1 ^ 0x40UL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; z0 |= t3; z1 &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; z0 |= t4; z1 &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; z0 |= t5; z1 &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; z0 |= t6; z1 &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; z0 |= t7; z1 &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; z0 |= t8; z1 &= t8; - z0 |= t9; z1 &= t9 ^ 0x3C00000UL; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - return (z0 == 0) | (z1 == 0x3FFFFFFUL); -} - -static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r) { - uint32_t t0, t1, t2, t3, t4, t5, t6, t7, t8, t9; - uint32_t z0, z1; - uint32_t x; - - t0 = r->n[0]; - t9 = r->n[9]; - - /* Reduce t9 at the start so there will be at most a single carry from the first pass */ - x = t9 >> 22; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x3D1UL; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - z0 = t0 & 0x3FFFFFFUL; - z1 = z0 ^ 0x3D0UL; - - /* Fast return path should catch the majority of cases */ - if ((z0 != 0UL) & (z1 != 0x3FFFFFFUL)) { - return 0; - } - - t1 = r->n[1]; - t2 = r->n[2]; - t3 = r->n[3]; - t4 = r->n[4]; - t5 = r->n[5]; - t6 = r->n[6]; - t7 = r->n[7]; - t8 = r->n[8]; - - t9 &= 0x03FFFFFUL; - t1 += (x << 6); - - t1 += (t0 >> 26); - t2 += (t1 >> 26); t1 &= 0x3FFFFFFUL; z0 |= t1; z1 &= t1 ^ 0x40UL; - t3 += (t2 >> 26); t2 &= 0x3FFFFFFUL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 26); t3 &= 0x3FFFFFFUL; z0 |= t3; z1 &= t3; - t5 += (t4 >> 26); t4 &= 0x3FFFFFFUL; z0 |= t4; z1 &= t4; - t6 += (t5 >> 26); t5 &= 0x3FFFFFFUL; z0 |= t5; z1 &= t5; - t7 += (t6 >> 26); t6 &= 0x3FFFFFFUL; z0 |= t6; z1 &= t6; - t8 += (t7 >> 26); t7 &= 0x3FFFFFFUL; z0 |= t7; z1 &= t7; - t9 += (t8 >> 26); t8 &= 0x3FFFFFFUL; z0 |= t8; z1 &= t8; - z0 |= t9; z1 &= t9 ^ 0x3C00000UL; - - /* ... except for a possible carry at bit 22 of t9 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t9 >> 23 == 0); - - return (z0 == 0) | (z1 == 0x3FFFFFFUL); -} - -SECP256K1_INLINE static void secp256k1_fe_set_int(secp256k1_fe *r, int a) { - r->n[0] = a; - r->n[1] = r->n[2] = r->n[3] = r->n[4] = r->n[5] = r->n[6] = r->n[7] = r->n[8] = r->n[9] = 0; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static int secp256k1_fe_is_zero(const secp256k1_fe *a) { - const uint32_t *t = a->n; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return (t[0] | t[1] | t[2] | t[3] | t[4] | t[5] | t[6] | t[7] | t[8] | t[9]) == 0; -} - -SECP256K1_INLINE static int secp256k1_fe_is_odd(const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return a->n[0] & 1; -} - -SECP256K1_INLINE static void secp256k1_fe_clear(secp256k1_fe *a) { - int i; -#ifdef VERIFY - a->magnitude = 0; - a->normalized = 1; -#endif - for (i=0; i<10; i++) { - a->n[i] = 0; - } -} - -static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - VERIFY_CHECK(b->normalized); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); -#endif - for (i = 9; i >= 0; i--) { - if (a->n[i] > b->n[i]) { - return 1; - } - if (a->n[i] < b->n[i]) { - return -1; - } - } - return 0; -} - -static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a) { - int i; - r->n[0] = r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0; - r->n[5] = r->n[6] = r->n[7] = r->n[8] = r->n[9] = 0; - for (i=0; i<32; i++) { - int j; - for (j=0; j<4; j++) { - int limb = (8*i+2*j)/26; - int shift = (8*i+2*j)%26; - r->n[limb] |= (uint32_t)((a[31-i] >> (2*j)) & 0x3) << shift; - } - } - if (r->n[9] == 0x3FFFFFUL && (r->n[8] & r->n[7] & r->n[6] & r->n[5] & r->n[4] & r->n[3] & r->n[2]) == 0x3FFFFFFUL && (r->n[1] + 0x40UL + ((r->n[0] + 0x3D1UL) >> 26)) > 0x3FFFFFFUL) { - return 0; - } -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif - return 1; -} - -/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */ -static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - for (i=0; i<32; i++) { - int j; - int c = 0; - for (j=0; j<4; j++) { - int limb = (8*i+2*j)/26; - int shift = (8*i+2*j)%26; - c |= ((a->n[limb] >> shift) & 0x3) << (2 * j); - } - r[31-i] = c; - } -} - -SECP256K1_INLINE static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= m); - secp256k1_fe_verify(a); -#endif - r->n[0] = 0x3FFFC2FUL * 2 * (m + 1) - a->n[0]; - r->n[1] = 0x3FFFFBFUL * 2 * (m + 1) - a->n[1]; - r->n[2] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[2]; - r->n[3] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[3]; - r->n[4] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[4]; - r->n[5] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[5]; - r->n[6] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[6]; - r->n[7] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[7]; - r->n[8] = 0x3FFFFFFUL * 2 * (m + 1) - a->n[8]; - r->n[9] = 0x03FFFFFUL * 2 * (m + 1) - a->n[9]; -#ifdef VERIFY - r->magnitude = m + 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_mul_int(secp256k1_fe *r, int a) { - r->n[0] *= a; - r->n[1] *= a; - r->n[2] *= a; - r->n[3] *= a; - r->n[4] *= a; - r->n[5] *= a; - r->n[6] *= a; - r->n[7] *= a; - r->n[8] *= a; - r->n[9] *= a; -#ifdef VERIFY - r->magnitude *= a; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - secp256k1_fe_verify(a); -#endif - r->n[0] += a->n[0]; - r->n[1] += a->n[1]; - r->n[2] += a->n[2]; - r->n[3] += a->n[3]; - r->n[4] += a->n[4]; - r->n[5] += a->n[5]; - r->n[6] += a->n[6]; - r->n[7] += a->n[7]; - r->n[8] += a->n[8]; - r->n[9] += a->n[9]; -#ifdef VERIFY - r->magnitude += a->magnitude; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -#if defined(USE_EXTERNAL_ASM) - -/* External assembler implementation */ -void secp256k1_fe_mul_inner(uint32_t *r, const uint32_t *a, const uint32_t * SECP256K1_RESTRICT b); -void secp256k1_fe_sqr_inner(uint32_t *r, const uint32_t *a); - -#else - -#ifdef VERIFY -#define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0) -#else -#define VERIFY_BITS(x, n) do { } while(0) -#endif - -SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint32_t *r, const uint32_t *a, const uint32_t * SECP256K1_RESTRICT b) { - uint64_t c, d; - uint64_t u0, u1, u2, u3, u4, u5, u6, u7, u8; - uint32_t t9, t1, t0, t2, t3, t4, t5, t6, t7; - const uint32_t M = 0x3FFFFFFUL, R0 = 0x3D10UL, R1 = 0x400UL; - - VERIFY_BITS(a[0], 30); - VERIFY_BITS(a[1], 30); - VERIFY_BITS(a[2], 30); - VERIFY_BITS(a[3], 30); - VERIFY_BITS(a[4], 30); - VERIFY_BITS(a[5], 30); - VERIFY_BITS(a[6], 30); - VERIFY_BITS(a[7], 30); - VERIFY_BITS(a[8], 30); - VERIFY_BITS(a[9], 26); - VERIFY_BITS(b[0], 30); - VERIFY_BITS(b[1], 30); - VERIFY_BITS(b[2], 30); - VERIFY_BITS(b[3], 30); - VERIFY_BITS(b[4], 30); - VERIFY_BITS(b[5], 30); - VERIFY_BITS(b[6], 30); - VERIFY_BITS(b[7], 30); - VERIFY_BITS(b[8], 30); - VERIFY_BITS(b[9], 26); - - /** [... a b c] is a shorthand for ... + a<<52 + b<<26 + c<<0 mod n. - * px is a shorthand for sum(a[i]*b[x-i], i=0..x). - * Note that [x 0 0 0 0 0 0 0 0 0 0] = [x*R1 x*R0]. - */ - - d = (uint64_t)a[0] * b[9] - + (uint64_t)a[1] * b[8] - + (uint64_t)a[2] * b[7] - + (uint64_t)a[3] * b[6] - + (uint64_t)a[4] * b[5] - + (uint64_t)a[5] * b[4] - + (uint64_t)a[6] * b[3] - + (uint64_t)a[7] * b[2] - + (uint64_t)a[8] * b[1] - + (uint64_t)a[9] * b[0]; - /* VERIFY_BITS(d, 64); */ - /* [d 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - t9 = d & M; d >>= 26; - VERIFY_BITS(t9, 26); - VERIFY_BITS(d, 38); - /* [d t9 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - - c = (uint64_t)a[0] * b[0]; - VERIFY_BITS(c, 60); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p9 0 0 0 0 0 0 0 0 p0] */ - d += (uint64_t)a[1] * b[9] - + (uint64_t)a[2] * b[8] - + (uint64_t)a[3] * b[7] - + (uint64_t)a[4] * b[6] - + (uint64_t)a[5] * b[5] - + (uint64_t)a[6] * b[4] - + (uint64_t)a[7] * b[3] - + (uint64_t)a[8] * b[2] - + (uint64_t)a[9] * b[1]; - VERIFY_BITS(d, 63); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - u0 = d & M; d >>= 26; c += u0 * R0; - VERIFY_BITS(u0, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 61); - /* [d u0 t9 0 0 0 0 0 0 0 0 c-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - t0 = c & M; c >>= 26; c += u0 * R1; - VERIFY_BITS(t0, 26); - VERIFY_BITS(c, 37); - /* [d u0 t9 0 0 0 0 0 0 0 c-u0*R1 t0-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - - c += (uint64_t)a[0] * b[1] - + (uint64_t)a[1] * b[0]; - VERIFY_BITS(c, 62); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 p1 p0] */ - d += (uint64_t)a[2] * b[9] - + (uint64_t)a[3] * b[8] - + (uint64_t)a[4] * b[7] - + (uint64_t)a[5] * b[6] - + (uint64_t)a[6] * b[5] - + (uint64_t)a[7] * b[4] - + (uint64_t)a[8] * b[3] - + (uint64_t)a[9] * b[2]; - VERIFY_BITS(d, 63); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - u1 = d & M; d >>= 26; c += u1 * R0; - VERIFY_BITS(u1, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u1 0 t9 0 0 0 0 0 0 0 c-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - t1 = c & M; c >>= 26; c += u1 * R1; - VERIFY_BITS(t1, 26); - VERIFY_BITS(c, 38); - /* [d u1 0 t9 0 0 0 0 0 0 c-u1*R1 t1-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - - c += (uint64_t)a[0] * b[2] - + (uint64_t)a[1] * b[1] - + (uint64_t)a[2] * b[0]; - VERIFY_BITS(c, 62); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - d += (uint64_t)a[3] * b[9] - + (uint64_t)a[4] * b[8] - + (uint64_t)a[5] * b[7] - + (uint64_t)a[6] * b[6] - + (uint64_t)a[7] * b[5] - + (uint64_t)a[8] * b[4] - + (uint64_t)a[9] * b[3]; - VERIFY_BITS(d, 63); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - u2 = d & M; d >>= 26; c += u2 * R0; - VERIFY_BITS(u2, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u2 0 0 t9 0 0 0 0 0 0 c-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - t2 = c & M; c >>= 26; c += u2 * R1; - VERIFY_BITS(t2, 26); - VERIFY_BITS(c, 38); - /* [d u2 0 0 t9 0 0 0 0 0 c-u2*R1 t2-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[3] - + (uint64_t)a[1] * b[2] - + (uint64_t)a[2] * b[1] - + (uint64_t)a[3] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - d += (uint64_t)a[4] * b[9] - + (uint64_t)a[5] * b[8] - + (uint64_t)a[6] * b[7] - + (uint64_t)a[7] * b[6] - + (uint64_t)a[8] * b[5] - + (uint64_t)a[9] * b[4]; - VERIFY_BITS(d, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - u3 = d & M; d >>= 26; c += u3 * R0; - VERIFY_BITS(u3, 26); - VERIFY_BITS(d, 37); - /* VERIFY_BITS(c, 64); */ - /* [d u3 0 0 0 t9 0 0 0 0 0 c-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - t3 = c & M; c >>= 26; c += u3 * R1; - VERIFY_BITS(t3, 26); - VERIFY_BITS(c, 39); - /* [d u3 0 0 0 t9 0 0 0 0 c-u3*R1 t3-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[4] - + (uint64_t)a[1] * b[3] - + (uint64_t)a[2] * b[2] - + (uint64_t)a[3] * b[1] - + (uint64_t)a[4] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[5] * b[9] - + (uint64_t)a[6] * b[8] - + (uint64_t)a[7] * b[7] - + (uint64_t)a[8] * b[6] - + (uint64_t)a[9] * b[5]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - u4 = d & M; d >>= 26; c += u4 * R0; - VERIFY_BITS(u4, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u4 0 0 0 0 t9 0 0 0 0 c-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - t4 = c & M; c >>= 26; c += u4 * R1; - VERIFY_BITS(t4, 26); - VERIFY_BITS(c, 39); - /* [d u4 0 0 0 0 t9 0 0 0 c-u4*R1 t4-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[5] - + (uint64_t)a[1] * b[4] - + (uint64_t)a[2] * b[3] - + (uint64_t)a[3] * b[2] - + (uint64_t)a[4] * b[1] - + (uint64_t)a[5] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[6] * b[9] - + (uint64_t)a[7] * b[8] - + (uint64_t)a[8] * b[7] - + (uint64_t)a[9] * b[6]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - u5 = d & M; d >>= 26; c += u5 * R0; - VERIFY_BITS(u5, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u5 0 0 0 0 0 t9 0 0 0 c-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - t5 = c & M; c >>= 26; c += u5 * R1; - VERIFY_BITS(t5, 26); - VERIFY_BITS(c, 39); - /* [d u5 0 0 0 0 0 t9 0 0 c-u5*R1 t5-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[6] - + (uint64_t)a[1] * b[5] - + (uint64_t)a[2] * b[4] - + (uint64_t)a[3] * b[3] - + (uint64_t)a[4] * b[2] - + (uint64_t)a[5] * b[1] - + (uint64_t)a[6] * b[0]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[7] * b[9] - + (uint64_t)a[8] * b[8] - + (uint64_t)a[9] * b[7]; - VERIFY_BITS(d, 61); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - u6 = d & M; d >>= 26; c += u6 * R0; - VERIFY_BITS(u6, 26); - VERIFY_BITS(d, 35); - /* VERIFY_BITS(c, 64); */ - /* [d u6 0 0 0 0 0 0 t9 0 0 c-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - t6 = c & M; c >>= 26; c += u6 * R1; - VERIFY_BITS(t6, 26); - VERIFY_BITS(c, 39); - /* [d u6 0 0 0 0 0 0 t9 0 c-u6*R1 t6-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[7] - + (uint64_t)a[1] * b[6] - + (uint64_t)a[2] * b[5] - + (uint64_t)a[3] * b[4] - + (uint64_t)a[4] * b[3] - + (uint64_t)a[5] * b[2] - + (uint64_t)a[6] * b[1] - + (uint64_t)a[7] * b[0]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x8000007C00000007ULL); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[8] * b[9] - + (uint64_t)a[9] * b[8]; - VERIFY_BITS(d, 58); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - u7 = d & M; d >>= 26; c += u7 * R0; - VERIFY_BITS(u7, 26); - VERIFY_BITS(d, 32); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x800001703FFFC2F7ULL); - /* [d u7 0 0 0 0 0 0 0 t9 0 c-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - t7 = c & M; c >>= 26; c += u7 * R1; - VERIFY_BITS(t7, 26); - VERIFY_BITS(c, 38); - /* [d u7 0 0 0 0 0 0 0 t9 c-u7*R1 t7-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)a[0] * b[8] - + (uint64_t)a[1] * b[7] - + (uint64_t)a[2] * b[6] - + (uint64_t)a[3] * b[5] - + (uint64_t)a[4] * b[4] - + (uint64_t)a[5] * b[3] - + (uint64_t)a[6] * b[2] - + (uint64_t)a[7] * b[1] - + (uint64_t)a[8] * b[0]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000007B80000008ULL); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[9] * b[9]; - VERIFY_BITS(d, 57); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - u8 = d & M; d >>= 26; c += u8 * R0; - VERIFY_BITS(u8, 26); - VERIFY_BITS(d, 31); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000016FBFFFC2F8ULL); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[3] = t3; - VERIFY_BITS(r[3], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = t4; - VERIFY_BITS(r[4], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[5] = t5; - VERIFY_BITS(r[5], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[6] = t6; - VERIFY_BITS(r[6], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[7] = t7; - VERIFY_BITS(r[7], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[8] = c & M; c >>= 26; c += u8 * R1; - VERIFY_BITS(r[8], 26); - VERIFY_BITS(c, 39); - /* [d u8 0 0 0 0 0 0 0 0 t9+c-u8*R1 r8-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 0 t9+c r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += d * R0 + t9; - VERIFY_BITS(c, 45); - /* [d 0 0 0 0 0 0 0 0 0 c-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[9] = c & (M >> 4); c >>= 22; c += d * (R1 << 4); - VERIFY_BITS(r[9], 22); - VERIFY_BITS(c, 46); - /* [d 0 0 0 0 0 0 0 0 r9+((c-d*R1<<4)<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 -d*R1 r9+(c<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - d = c * (R0 >> 4) + t0; - VERIFY_BITS(d, 56); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 d-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[0] = d & M; d >>= 26; - VERIFY_BITS(r[0], 26); - VERIFY_BITS(d, 30); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1+d r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += c * (R1 >> 4) + t1; - VERIFY_BITS(d, 53); - VERIFY_CHECK(d <= 0x10000003FFFFBFULL); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 d-c*R1>>4 r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9 r8 r7 r6 r5 r4 r3 t2 d r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[1] = d & M; d >>= 26; - VERIFY_BITS(r[1], 26); - VERIFY_BITS(d, 27); - VERIFY_CHECK(d <= 0x4000000ULL); - /* [r9 r8 r7 r6 r5 r4 r3 t2+d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += t2; - VERIFY_BITS(d, 27); - /* [r9 r8 r7 r6 r5 r4 r3 d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = d; - VERIFY_BITS(r[2], 27); - /* [r9 r8 r7 r6 r5 r4 r3 r2 r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} - -SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint32_t *r, const uint32_t *a) { - uint64_t c, d; - uint64_t u0, u1, u2, u3, u4, u5, u6, u7, u8; - uint32_t t9, t0, t1, t2, t3, t4, t5, t6, t7; - const uint32_t M = 0x3FFFFFFUL, R0 = 0x3D10UL, R1 = 0x400UL; - - VERIFY_BITS(a[0], 30); - VERIFY_BITS(a[1], 30); - VERIFY_BITS(a[2], 30); - VERIFY_BITS(a[3], 30); - VERIFY_BITS(a[4], 30); - VERIFY_BITS(a[5], 30); - VERIFY_BITS(a[6], 30); - VERIFY_BITS(a[7], 30); - VERIFY_BITS(a[8], 30); - VERIFY_BITS(a[9], 26); - - /** [... a b c] is a shorthand for ... + a<<52 + b<<26 + c<<0 mod n. - * px is a shorthand for sum(a[i]*a[x-i], i=0..x). - * Note that [x 0 0 0 0 0 0 0 0 0 0] = [x*R1 x*R0]. - */ - - d = (uint64_t)(a[0]*2) * a[9] - + (uint64_t)(a[1]*2) * a[8] - + (uint64_t)(a[2]*2) * a[7] - + (uint64_t)(a[3]*2) * a[6] - + (uint64_t)(a[4]*2) * a[5]; - /* VERIFY_BITS(d, 64); */ - /* [d 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - t9 = d & M; d >>= 26; - VERIFY_BITS(t9, 26); - VERIFY_BITS(d, 38); - /* [d t9 0 0 0 0 0 0 0 0 0] = [p9 0 0 0 0 0 0 0 0 0] */ - - c = (uint64_t)a[0] * a[0]; - VERIFY_BITS(c, 60); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p9 0 0 0 0 0 0 0 0 p0] */ - d += (uint64_t)(a[1]*2) * a[9] - + (uint64_t)(a[2]*2) * a[8] - + (uint64_t)(a[3]*2) * a[7] - + (uint64_t)(a[4]*2) * a[6] - + (uint64_t)a[5] * a[5]; - VERIFY_BITS(d, 63); - /* [d t9 0 0 0 0 0 0 0 0 c] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - u0 = d & M; d >>= 26; c += u0 * R0; - VERIFY_BITS(u0, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 61); - /* [d u0 t9 0 0 0 0 0 0 0 0 c-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - t0 = c & M; c >>= 26; c += u0 * R1; - VERIFY_BITS(t0, 26); - VERIFY_BITS(c, 37); - /* [d u0 t9 0 0 0 0 0 0 0 c-u0*R1 t0-u0*R0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 0 p0] */ - - c += (uint64_t)(a[0]*2) * a[1]; - VERIFY_BITS(c, 62); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p10 p9 0 0 0 0 0 0 0 p1 p0] */ - d += (uint64_t)(a[2]*2) * a[9] - + (uint64_t)(a[3]*2) * a[8] - + (uint64_t)(a[4]*2) * a[7] - + (uint64_t)(a[5]*2) * a[6]; - VERIFY_BITS(d, 63); - /* [d 0 t9 0 0 0 0 0 0 0 c t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - u1 = d & M; d >>= 26; c += u1 * R0; - VERIFY_BITS(u1, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u1 0 t9 0 0 0 0 0 0 0 c-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - t1 = c & M; c >>= 26; c += u1 * R1; - VERIFY_BITS(t1, 26); - VERIFY_BITS(c, 38); - /* [d u1 0 t9 0 0 0 0 0 0 c-u1*R1 t1-u1*R0 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 0 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[2] - + (uint64_t)a[1] * a[1]; - VERIFY_BITS(c, 62); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - d += (uint64_t)(a[3]*2) * a[9] - + (uint64_t)(a[4]*2) * a[8] - + (uint64_t)(a[5]*2) * a[7] - + (uint64_t)a[6] * a[6]; - VERIFY_BITS(d, 63); - /* [d 0 0 t9 0 0 0 0 0 0 c t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - u2 = d & M; d >>= 26; c += u2 * R0; - VERIFY_BITS(u2, 26); - VERIFY_BITS(d, 37); - VERIFY_BITS(c, 63); - /* [d u2 0 0 t9 0 0 0 0 0 0 c-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - t2 = c & M; c >>= 26; c += u2 * R1; - VERIFY_BITS(t2, 26); - VERIFY_BITS(c, 38); - /* [d u2 0 0 t9 0 0 0 0 0 c-u2*R1 t2-u2*R0 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 0 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[3] - + (uint64_t)(a[1]*2) * a[2]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - d += (uint64_t)(a[4]*2) * a[9] - + (uint64_t)(a[5]*2) * a[8] - + (uint64_t)(a[6]*2) * a[7]; - VERIFY_BITS(d, 63); - /* [d 0 0 0 t9 0 0 0 0 0 c t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - u3 = d & M; d >>= 26; c += u3 * R0; - VERIFY_BITS(u3, 26); - VERIFY_BITS(d, 37); - /* VERIFY_BITS(c, 64); */ - /* [d u3 0 0 0 t9 0 0 0 0 0 c-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - t3 = c & M; c >>= 26; c += u3 * R1; - VERIFY_BITS(t3, 26); - VERIFY_BITS(c, 39); - /* [d u3 0 0 0 t9 0 0 0 0 c-u3*R1 t3-u3*R0 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 0 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[4] - + (uint64_t)(a[1]*2) * a[3] - + (uint64_t)a[2] * a[2]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[5]*2) * a[9] - + (uint64_t)(a[6]*2) * a[8] - + (uint64_t)a[7] * a[7]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 t9 0 0 0 0 c t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - u4 = d & M; d >>= 26; c += u4 * R0; - VERIFY_BITS(u4, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u4 0 0 0 0 t9 0 0 0 0 c-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - t4 = c & M; c >>= 26; c += u4 * R1; - VERIFY_BITS(t4, 26); - VERIFY_BITS(c, 39); - /* [d u4 0 0 0 0 t9 0 0 0 c-u4*R1 t4-u4*R0 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 0 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[5] - + (uint64_t)(a[1]*2) * a[4] - + (uint64_t)(a[2]*2) * a[3]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[6]*2) * a[9] - + (uint64_t)(a[7]*2) * a[8]; - VERIFY_BITS(d, 62); - /* [d 0 0 0 0 0 t9 0 0 0 c t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - u5 = d & M; d >>= 26; c += u5 * R0; - VERIFY_BITS(u5, 26); - VERIFY_BITS(d, 36); - /* VERIFY_BITS(c, 64); */ - /* [d u5 0 0 0 0 0 t9 0 0 0 c-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - t5 = c & M; c >>= 26; c += u5 * R1; - VERIFY_BITS(t5, 26); - VERIFY_BITS(c, 39); - /* [d u5 0 0 0 0 0 t9 0 0 c-u5*R1 t5-u5*R0 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 0 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[6] - + (uint64_t)(a[1]*2) * a[5] - + (uint64_t)(a[2]*2) * a[4] - + (uint64_t)a[3] * a[3]; - VERIFY_BITS(c, 63); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[7]*2) * a[9] - + (uint64_t)a[8] * a[8]; - VERIFY_BITS(d, 61); - /* [d 0 0 0 0 0 0 t9 0 0 c t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - u6 = d & M; d >>= 26; c += u6 * R0; - VERIFY_BITS(u6, 26); - VERIFY_BITS(d, 35); - /* VERIFY_BITS(c, 64); */ - /* [d u6 0 0 0 0 0 0 t9 0 0 c-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - t6 = c & M; c >>= 26; c += u6 * R1; - VERIFY_BITS(t6, 26); - VERIFY_BITS(c, 39); - /* [d u6 0 0 0 0 0 0 t9 0 c-u6*R1 t6-u6*R0 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 0 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[7] - + (uint64_t)(a[1]*2) * a[6] - + (uint64_t)(a[2]*2) * a[5] - + (uint64_t)(a[3]*2) * a[4]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x8000007C00000007ULL); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)(a[8]*2) * a[9]; - VERIFY_BITS(d, 58); - /* [d 0 0 0 0 0 0 0 t9 0 c t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - u7 = d & M; d >>= 26; c += u7 * R0; - VERIFY_BITS(u7, 26); - VERIFY_BITS(d, 32); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x800001703FFFC2F7ULL); - /* [d u7 0 0 0 0 0 0 0 t9 0 c-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - t7 = c & M; c >>= 26; c += u7 * R1; - VERIFY_BITS(t7, 26); - VERIFY_BITS(c, 38); - /* [d u7 0 0 0 0 0 0 0 t9 c-u7*R1 t7-u7*R0 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 0 p7 p6 p5 p4 p3 p2 p1 p0] */ - - c += (uint64_t)(a[0]*2) * a[8] - + (uint64_t)(a[1]*2) * a[7] - + (uint64_t)(a[2]*2) * a[6] - + (uint64_t)(a[3]*2) * a[5] - + (uint64_t)a[4] * a[4]; - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000007B80000008ULL); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint64_t)a[9] * a[9]; - VERIFY_BITS(d, 57); - /* [d 0 0 0 0 0 0 0 0 t9 c t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - u8 = d & M; d >>= 26; c += u8 * R0; - VERIFY_BITS(u8, 26); - VERIFY_BITS(d, 31); - /* VERIFY_BITS(c, 64); */ - VERIFY_CHECK(c <= 0x9000016FBFFFC2F8ULL); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 t3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[3] = t3; - VERIFY_BITS(r[3], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 t4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = t4; - VERIFY_BITS(r[4], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 t5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[5] = t5; - VERIFY_BITS(r[5], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 t6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[6] = t6; - VERIFY_BITS(r[6], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 t7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[7] = t7; - VERIFY_BITS(r[7], 26); - /* [d u8 0 0 0 0 0 0 0 0 t9 c-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - r[8] = c & M; c >>= 26; c += u8 * R1; - VERIFY_BITS(r[8], 26); - VERIFY_BITS(c, 39); - /* [d u8 0 0 0 0 0 0 0 0 t9+c-u8*R1 r8-u8*R0 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 0 0 t9+c r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += d * R0 + t9; - VERIFY_BITS(c, 45); - /* [d 0 0 0 0 0 0 0 0 0 c-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[9] = c & (M >> 4); c >>= 22; c += d * (R1 << 4); - VERIFY_BITS(r[9], 22); - VERIFY_BITS(c, 46); - /* [d 0 0 0 0 0 0 0 0 r9+((c-d*R1<<4)<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [d 0 0 0 0 0 0 0 -d*R1 r9+(c<<22)-d*R0 r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 t0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - d = c * (R0 >> 4) + t0; - VERIFY_BITS(d, 56); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1 d-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[0] = d & M; d >>= 26; - VERIFY_BITS(r[0], 26); - VERIFY_BITS(d, 30); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 t1+d r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += c * (R1 >> 4) + t1; - VERIFY_BITS(d, 53); - VERIFY_CHECK(d <= 0x10000003FFFFBFULL); - /* [r9+(c<<22) r8 r7 r6 r5 r4 r3 t2 d-c*R1>>4 r0-c*R0>>4] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - /* [r9 r8 r7 r6 r5 r4 r3 t2 d r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[1] = d & M; d >>= 26; - VERIFY_BITS(r[1], 26); - VERIFY_BITS(d, 27); - VERIFY_CHECK(d <= 0x4000000ULL); - /* [r9 r8 r7 r6 r5 r4 r3 t2+d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - d += t2; - VERIFY_BITS(d, 27); - /* [r9 r8 r7 r6 r5 r4 r3 d r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = d; - VERIFY_BITS(r[2], 27); - /* [r9 r8 r7 r6 r5 r4 r3 r2 r1 r0] = [p18 p17 p16 p15 p14 p13 p12 p11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} -#endif - -static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - VERIFY_CHECK(b->magnitude <= 8); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); - VERIFY_CHECK(r != b); -#endif - secp256k1_fe_mul_inner(r->n, a->n, b->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - secp256k1_fe_verify(a); -#endif - secp256k1_fe_sqr_inner(r->n, a->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag) { - uint32_t mask0, mask1; - mask0 = flag + ~((uint32_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); - r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1); - r->n[5] = (r->n[5] & mask0) | (a->n[5] & mask1); - r->n[6] = (r->n[6] & mask0) | (a->n[6] & mask1); - r->n[7] = (r->n[7] & mask0) | (a->n[7] & mask1); - r->n[8] = (r->n[8] & mask0) | (a->n[8] & mask1); - r->n[9] = (r->n[9] & mask0) | (a->n[9] & mask1); -#ifdef VERIFY - if (a->magnitude > r->magnitude) { - r->magnitude = a->magnitude; - } - r->normalized &= a->normalized; -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag) { - uint32_t mask0, mask1; - mask0 = flag + ~((uint32_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); - r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1); - r->n[5] = (r->n[5] & mask0) | (a->n[5] & mask1); - r->n[6] = (r->n[6] & mask0) | (a->n[6] & mask1); - r->n[7] = (r->n[7] & mask0) | (a->n[7] & mask1); -} - -static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); -#endif - r->n[0] = a->n[0] | a->n[1] << 26; - r->n[1] = a->n[1] >> 6 | a->n[2] << 20; - r->n[2] = a->n[2] >> 12 | a->n[3] << 14; - r->n[3] = a->n[3] >> 18 | a->n[4] << 8; - r->n[4] = a->n[4] >> 24 | a->n[5] << 2 | a->n[6] << 28; - r->n[5] = a->n[6] >> 4 | a->n[7] << 22; - r->n[6] = a->n[7] >> 10 | a->n[8] << 16; - r->n[7] = a->n[8] >> 16 | a->n[9] << 10; -} - -static SECP256K1_INLINE void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a) { - r->n[0] = a->n[0] & 0x3FFFFFFUL; - r->n[1] = a->n[0] >> 26 | ((a->n[1] << 6) & 0x3FFFFFFUL); - r->n[2] = a->n[1] >> 20 | ((a->n[2] << 12) & 0x3FFFFFFUL); - r->n[3] = a->n[2] >> 14 | ((a->n[3] << 18) & 0x3FFFFFFUL); - r->n[4] = a->n[3] >> 8 | ((a->n[4] << 24) & 0x3FFFFFFUL); - r->n[5] = (a->n[4] >> 2) & 0x3FFFFFFUL; - r->n[6] = a->n[4] >> 28 | ((a->n[5] << 4) & 0x3FFFFFFUL); - r->n[7] = a->n[5] >> 22 | ((a->n[6] << 10) & 0x3FFFFFFUL); - r->n[8] = a->n[6] >> 16 | ((a->n[7] << 16) & 0x3FFFFFFUL); - r->n[9] = a->n[7] >> 10; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; -#endif -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h deleted file mode 100644 index 8e69a560..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52.h +++ /dev/null @@ -1,47 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_ -#define _SECP256K1_FIELD_REPR_ - -#include - -typedef struct { - /* X = sum(i=0..4, elem[i]*2^52) mod n */ - uint64_t n[5]; -#ifdef VERIFY - int magnitude; - int normalized; -#endif -} secp256k1_fe; - -/* Unpacks a constant into a overlapping multi-limbed FE element. */ -#define SECP256K1_FE_CONST_INNER(d7, d6, d5, d4, d3, d2, d1, d0) { \ - (d0) | (((uint64_t)(d1) & 0xFFFFFUL) << 32), \ - ((uint64_t)(d1) >> 20) | (((uint64_t)(d2)) << 12) | (((uint64_t)(d3) & 0xFFUL) << 44), \ - ((uint64_t)(d3) >> 8) | (((uint64_t)(d4) & 0xFFFFFFFUL) << 24), \ - ((uint64_t)(d4) >> 28) | (((uint64_t)(d5)) << 4) | (((uint64_t)(d6) & 0xFFFFUL) << 36), \ - ((uint64_t)(d6) >> 16) | (((uint64_t)(d7)) << 16) \ -} - -#ifdef VERIFY -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)), 1, 1} -#else -#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0))} -#endif - -typedef struct { - uint64_t n[4]; -} secp256k1_fe_storage; - -#define SECP256K1_FE_STORAGE_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{ \ - (d0) | (((uint64_t)(d1)) << 32), \ - (d2) | (((uint64_t)(d3)) << 32), \ - (d4) | (((uint64_t)(d5)) << 32), \ - (d6) | (((uint64_t)(d7)) << 32) \ -}} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h deleted file mode 100644 index 98cc004b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_asm_impl.h +++ /dev/null @@ -1,502 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2014 Diederik Huys, Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -/** - * Changelog: - * - March 2013, Diederik Huys: original version - * - November 2014, Pieter Wuille: updated to use Peter Dettman's parallel multiplication algorithm - * - December 2014, Pieter Wuille: converted from YASM to GCC inline assembly - */ - -#ifndef _SECP256K1_FIELD_INNER5X52_IMPL_H_ -#define _SECP256K1_FIELD_INNER5X52_IMPL_H_ - -SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t *a, const uint64_t * SECP256K1_RESTRICT b) { -/** - * Registers: rdx:rax = multiplication accumulator - * r9:r8 = c - * r15:rcx = d - * r10-r14 = a0-a4 - * rbx = b - * rdi = r - * rsi = a / t? - */ - uint64_t tmp1, tmp2, tmp3; -__asm__ __volatile__( - "movq 0(%%rsi),%%r10\n" - "movq 8(%%rsi),%%r11\n" - "movq 16(%%rsi),%%r12\n" - "movq 24(%%rsi),%%r13\n" - "movq 32(%%rsi),%%r14\n" - - /* d += a3 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r13\n" - "movq %%rax,%%rcx\n" - "movq %%rdx,%%r15\n" - /* d += a2 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a1 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d = a0 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c = a4 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r14\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += (c & M) * R */ - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* t3 (tmp1) = d & M */ - "movq %%rcx,%%rsi\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rsi\n" - "movq %%rsi,%q1\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* d += a4 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a2 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a1 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a0 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += c * R */ - "movq %%r8,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* t4 = d & M (%%rsi) */ - "movq %%rcx,%%rsi\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* tx = t4 >> 48 (tmp3) */ - "movq %%rsi,%%rax\n" - "shrq $48,%%rax\n" - "movq %%rax,%q3\n" - /* t4 &= (M >> 4) (tmp2) */ - "movq $0xffffffffffff,%%rax\n" - "andq %%rax,%%rsi\n" - "movq %%rsi,%q2\n" - /* c = a0 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r10\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += a4 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a2 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a1 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* u0 = d & M (%%rsi) */ - "movq %%rcx,%%rsi\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* u0 = (u0 << 4) | tx (%%rsi) */ - "shlq $4,%%rsi\n" - "movq %q3,%%rax\n" - "orq %%rax,%%rsi\n" - /* c += u0 * (R >> 4) */ - "movq $0x1000003d1,%%rax\n" - "mulq %%rsi\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[0] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,0(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += a1 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* c += a0 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d += a4 * b2 */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a2 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c += (d & M) * R */ - "movq %%rcx,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 */ - "shrdq $52,%%r15,%%rcx\n" - "xorq %%r15,%%r15\n" - /* r[1] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,8(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += a2 * b0 */ - "movq 0(%%rbx),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* c += a1 * b1 */ - "movq 8(%%rbx),%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* c += a0 * b2 (last use of %%r10 = a0) */ - "movq 16(%%rbx),%%rax\n" - "mulq %%r10\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* fetch t3 (%%r10, overwrites a0), t4 (%%rsi) */ - "movq %q2,%%rsi\n" - "movq %q1,%%r10\n" - /* d += a4 * b3 */ - "movq 24(%%rbx),%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* d += a3 * b4 */ - "movq 32(%%rbx),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rcx\n" - "adcq %%rdx,%%r15\n" - /* c += (d & M) * R */ - "movq %%rcx,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 (%%rcx only) */ - "shrdq $52,%%r15,%%rcx\n" - /* r[2] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,16(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += t3 */ - "addq %%r10,%%r8\n" - /* c += d * R */ - "movq %%rcx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[3] = c & M */ - "movq %%r8,%%rax\n" - "movq $0xfffffffffffff,%%rdx\n" - "andq %%rdx,%%rax\n" - "movq %%rax,24(%%rdi)\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* c += t4 (%%r8 only) */ - "addq %%rsi,%%r8\n" - /* r[4] = c */ - "movq %%r8,32(%%rdi)\n" -: "+S"(a), "=m"(tmp1), "=m"(tmp2), "=m"(tmp3) -: "b"(b), "D"(r) -: "%rax", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "cc", "memory" -); -} - -SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint64_t *r, const uint64_t *a) { -/** - * Registers: rdx:rax = multiplication accumulator - * r9:r8 = c - * rcx:rbx = d - * r10-r14 = a0-a4 - * r15 = M (0xfffffffffffff) - * rdi = r - * rsi = a / t? - */ - uint64_t tmp1, tmp2, tmp3; -__asm__ __volatile__( - "movq 0(%%rsi),%%r10\n" - "movq 8(%%rsi),%%r11\n" - "movq 16(%%rsi),%%r12\n" - "movq 24(%%rsi),%%r13\n" - "movq 32(%%rsi),%%r14\n" - "movq $0xfffffffffffff,%%r15\n" - - /* d = (a0*2) * a3 */ - "leaq (%%r10,%%r10,1),%%rax\n" - "mulq %%r13\n" - "movq %%rax,%%rbx\n" - "movq %%rdx,%%rcx\n" - /* d += (a1*2) * a2 */ - "leaq (%%r11,%%r11,1),%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c = a4 * a4 */ - "movq %%r14,%%rax\n" - "mulq %%r14\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += (c & M) * R */ - "andq %%r15,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* t3 (tmp1) = d & M */ - "movq %%rbx,%%rsi\n" - "andq %%r15,%%rsi\n" - "movq %%rsi,%q1\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* a4 *= 2 */ - "addq %%r14,%%r14\n" - /* d += a0 * a4 */ - "movq %%r10,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d+= (a1*2) * a3 */ - "leaq (%%r11,%%r11,1),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += a2 * a2 */ - "movq %%r12,%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += c * R */ - "movq %%r8,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* t4 = d & M (%%rsi) */ - "movq %%rbx,%%rsi\n" - "andq %%r15,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* tx = t4 >> 48 (tmp3) */ - "movq %%rsi,%%rax\n" - "shrq $48,%%rax\n" - "movq %%rax,%q3\n" - /* t4 &= (M >> 4) (tmp2) */ - "movq $0xffffffffffff,%%rax\n" - "andq %%rax,%%rsi\n" - "movq %%rsi,%q2\n" - /* c = a0 * a0 */ - "movq %%r10,%%rax\n" - "mulq %%r10\n" - "movq %%rax,%%r8\n" - "movq %%rdx,%%r9\n" - /* d += a1 * a4 */ - "movq %%r11,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += (a2*2) * a3 */ - "leaq (%%r12,%%r12,1),%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* u0 = d & M (%%rsi) */ - "movq %%rbx,%%rsi\n" - "andq %%r15,%%rsi\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* u0 = (u0 << 4) | tx (%%rsi) */ - "shlq $4,%%rsi\n" - "movq %q3,%%rax\n" - "orq %%rax,%%rsi\n" - /* c += u0 * (R >> 4) */ - "movq $0x1000003d1,%%rax\n" - "mulq %%rsi\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[0] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,0(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* a0 *= 2 */ - "addq %%r10,%%r10\n" - /* c += a0 * a1 */ - "movq %%r10,%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d += a2 * a4 */ - "movq %%r12,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* d += a3 * a3 */ - "movq %%r13,%%rax\n" - "mulq %%r13\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c += (d & M) * R */ - "movq %%rbx,%%rax\n" - "andq %%r15,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 */ - "shrdq $52,%%rcx,%%rbx\n" - "xorq %%rcx,%%rcx\n" - /* r[1] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,8(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += a0 * a2 (last use of %%r10) */ - "movq %%r10,%%rax\n" - "mulq %%r12\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* fetch t3 (%%r10, overwrites a0),t4 (%%rsi) */ - "movq %q2,%%rsi\n" - "movq %q1,%%r10\n" - /* c += a1 * a1 */ - "movq %%r11,%%rax\n" - "mulq %%r11\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d += a3 * a4 */ - "movq %%r13,%%rax\n" - "mulq %%r14\n" - "addq %%rax,%%rbx\n" - "adcq %%rdx,%%rcx\n" - /* c += (d & M) * R */ - "movq %%rbx,%%rax\n" - "andq %%r15,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* d >>= 52 (%%rbx only) */ - "shrdq $52,%%rcx,%%rbx\n" - /* r[2] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,16(%%rdi)\n" - /* c >>= 52 */ - "shrdq $52,%%r9,%%r8\n" - "xorq %%r9,%%r9\n" - /* c += t3 */ - "addq %%r10,%%r8\n" - /* c += d * R */ - "movq %%rbx,%%rax\n" - "movq $0x1000003d10,%%rdx\n" - "mulq %%rdx\n" - "addq %%rax,%%r8\n" - "adcq %%rdx,%%r9\n" - /* r[3] = c & M */ - "movq %%r8,%%rax\n" - "andq %%r15,%%rax\n" - "movq %%rax,24(%%rdi)\n" - /* c >>= 52 (%%r8 only) */ - "shrdq $52,%%r9,%%r8\n" - /* c += t4 (%%r8 only) */ - "addq %%rsi,%%r8\n" - /* r[4] = c */ - "movq %%r8,32(%%rdi)\n" -: "+S"(a), "=m"(tmp1), "=m"(tmp2), "=m"(tmp3) -: "D"(r) -: "%rax", "%rbx", "%rcx", "%rdx", "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15", "cc", "memory" -); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h deleted file mode 100644 index dd88f38c..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_impl.h +++ /dev/null @@ -1,451 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_REPR_IMPL_H_ -#define _SECP256K1_FIELD_REPR_IMPL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include "util.h" -#include "num.h" -#include "field.h" - -#if defined(USE_ASM_X86_64) -#include "field_5x52_asm_impl.h" -#else -#include "field_5x52_int128_impl.h" -#endif - -/** Implements arithmetic modulo FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F, - * represented as 5 uint64_t's in base 2^52. The values are allowed to contain >52 each. In particular, - * each FieldElem has a 'magnitude' associated with it. Internally, a magnitude M means each element - * is at most M*(2^53-1), except the most significant one, which is limited to M*(2^49-1). All operations - * accept any input with magnitude at most M, and have different rules for propagating magnitude to their - * output. - */ - -#ifdef VERIFY -static void secp256k1_fe_verify(const secp256k1_fe *a) { - const uint64_t *d = a->n; - int m = a->normalized ? 1 : 2 * a->magnitude, r = 1; - /* secp256k1 'p' value defined in "Standards for Efficient Cryptography" (SEC2) 2.7.1. */ - r &= (d[0] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[1] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[2] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[3] <= 0xFFFFFFFFFFFFFULL * m); - r &= (d[4] <= 0x0FFFFFFFFFFFFULL * m); - r &= (a->magnitude >= 0); - r &= (a->magnitude <= 2048); - if (a->normalized) { - r &= (a->magnitude <= 1); - if (r && (d[4] == 0x0FFFFFFFFFFFFULL) && ((d[3] & d[2] & d[1]) == 0xFFFFFFFFFFFFFULL)) { - r &= (d[0] < 0xFFFFEFFFFFC2FULL); - } - } - VERIFY_CHECK(r == 1); -} -#endif - -static void secp256k1_fe_normalize(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t m; - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; m = t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; m &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; m &= t3; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t4 >> 48) | ((t4 == 0x0FFFFFFFFFFFFULL) & (m == 0xFFFFFFFFFFFFFULL) - & (t0 >= 0xFFFFEFFFFFC2FULL)); - - /* Apply the final reduction (for constant-time behaviour, we do it always) */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; - - /* If t4 didn't carry to bit 48 already, then it should have after any final reduction */ - VERIFY_CHECK(t4 >> 48 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t4 &= 0x0FFFFFFFFFFFFULL; - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_weak(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - -#ifdef VERIFY - r->magnitude = 1; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_normalize_var(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t m; - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; m = t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; m &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; m &= t3; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - /* At most a single final reduction is needed; check if the value is >= the field characteristic */ - x = (t4 >> 48) | ((t4 == 0x0FFFFFFFFFFFFULL) & (m == 0xFFFFFFFFFFFFFULL) - & (t0 >= 0xFFFFEFFFFFC2FULL)); - - if (x) { - t0 += 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; - - /* If t4 didn't carry to bit 48 already, then it should have after any final reduction */ - VERIFY_CHECK(t4 >> 48 == x); - - /* Mask off the possible multiple of 2^256 from the final reduction */ - t4 &= 0x0FFFFFFFFFFFFULL; - } - - r->n[0] = t0; r->n[1] = t1; r->n[2] = t2; r->n[3] = t3; r->n[4] = t4; - -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r) { - uint64_t t0 = r->n[0], t1 = r->n[1], t2 = r->n[2], t3 = r->n[3], t4 = r->n[4]; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - uint64_t z0, z1; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - uint64_t x = t4 >> 48; t4 &= 0x0FFFFFFFFFFFFULL; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - t1 += (t0 >> 52); t0 &= 0xFFFFFFFFFFFFFULL; z0 = t0; z1 = t0 ^ 0x1000003D0ULL; - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; z0 |= t1; z1 &= t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; z0 |= t3; z1 &= t3; - z0 |= t4; z1 &= t4 ^ 0xF000000000000ULL; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - return (z0 == 0) | (z1 == 0xFFFFFFFFFFFFFULL); -} - -static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r) { - uint64_t t0, t1, t2, t3, t4; - uint64_t z0, z1; - uint64_t x; - - t0 = r->n[0]; - t4 = r->n[4]; - - /* Reduce t4 at the start so there will be at most a single carry from the first pass */ - x = t4 >> 48; - - /* The first pass ensures the magnitude is 1, ... */ - t0 += x * 0x1000003D1ULL; - - /* z0 tracks a possible raw value of 0, z1 tracks a possible raw value of P */ - z0 = t0 & 0xFFFFFFFFFFFFFULL; - z1 = z0 ^ 0x1000003D0ULL; - - /* Fast return path should catch the majority of cases */ - if ((z0 != 0ULL) & (z1 != 0xFFFFFFFFFFFFFULL)) { - return 0; - } - - t1 = r->n[1]; - t2 = r->n[2]; - t3 = r->n[3]; - - t4 &= 0x0FFFFFFFFFFFFULL; - - t1 += (t0 >> 52); - t2 += (t1 >> 52); t1 &= 0xFFFFFFFFFFFFFULL; z0 |= t1; z1 &= t1; - t3 += (t2 >> 52); t2 &= 0xFFFFFFFFFFFFFULL; z0 |= t2; z1 &= t2; - t4 += (t3 >> 52); t3 &= 0xFFFFFFFFFFFFFULL; z0 |= t3; z1 &= t3; - z0 |= t4; z1 &= t4 ^ 0xF000000000000ULL; - - /* ... except for a possible carry at bit 48 of t4 (i.e. bit 256 of the field element) */ - VERIFY_CHECK(t4 >> 49 == 0); - - return (z0 == 0) | (z1 == 0xFFFFFFFFFFFFFULL); -} - -SECP256K1_INLINE static void secp256k1_fe_set_int(secp256k1_fe *r, int a) { - r->n[0] = a; - r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static int secp256k1_fe_is_zero(const secp256k1_fe *a) { - const uint64_t *t = a->n; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return (t[0] | t[1] | t[2] | t[3] | t[4]) == 0; -} - -SECP256K1_INLINE static int secp256k1_fe_is_odd(const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - return a->n[0] & 1; -} - -SECP256K1_INLINE static void secp256k1_fe_clear(secp256k1_fe *a) { - int i; -#ifdef VERIFY - a->magnitude = 0; - a->normalized = 1; -#endif - for (i=0; i<5; i++) { - a->n[i] = 0; - } -} - -static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - VERIFY_CHECK(b->normalized); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); -#endif - for (i = 4; i >= 0; i--) { - if (a->n[i] > b->n[i]) { - return 1; - } - if (a->n[i] < b->n[i]) { - return -1; - } - } - return 0; -} - -static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a) { - int i; - r->n[0] = r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0; - for (i=0; i<32; i++) { - int j; - for (j=0; j<2; j++) { - int limb = (8*i+4*j)/52; - int shift = (8*i+4*j)%52; - r->n[limb] |= (uint64_t)((a[31-i] >> (4*j)) & 0xF) << shift; - } - } - if (r->n[4] == 0x0FFFFFFFFFFFFULL && (r->n[3] & r->n[2] & r->n[1]) == 0xFFFFFFFFFFFFFULL && r->n[0] >= 0xFFFFEFFFFFC2FULL) { - return 0; - } -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; - secp256k1_fe_verify(r); -#endif - return 1; -} - -/** Convert a field element to a 32-byte big endian value. Requires the input to be normalized */ -static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a) { - int i; -#ifdef VERIFY - VERIFY_CHECK(a->normalized); - secp256k1_fe_verify(a); -#endif - for (i=0; i<32; i++) { - int j; - int c = 0; - for (j=0; j<2; j++) { - int limb = (8*i+4*j)/52; - int shift = (8*i+4*j)%52; - c |= ((a->n[limb] >> shift) & 0xF) << (4 * j); - } - r[31-i] = c; - } -} - -SECP256K1_INLINE static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= m); - secp256k1_fe_verify(a); -#endif - r->n[0] = 0xFFFFEFFFFFC2FULL * 2 * (m + 1) - a->n[0]; - r->n[1] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[1]; - r->n[2] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[2]; - r->n[3] = 0xFFFFFFFFFFFFFULL * 2 * (m + 1) - a->n[3]; - r->n[4] = 0x0FFFFFFFFFFFFULL * 2 * (m + 1) - a->n[4]; -#ifdef VERIFY - r->magnitude = m + 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_mul_int(secp256k1_fe *r, int a) { - r->n[0] *= a; - r->n[1] *= a; - r->n[2] *= a; - r->n[3] *= a; - r->n[4] *= a; -#ifdef VERIFY - r->magnitude *= a; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -SECP256K1_INLINE static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - secp256k1_fe_verify(a); -#endif - r->n[0] += a->n[0]; - r->n[1] += a->n[1]; - r->n[2] += a->n[2]; - r->n[3] += a->n[3]; - r->n[4] += a->n[4]; -#ifdef VERIFY - r->magnitude += a->magnitude; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - VERIFY_CHECK(b->magnitude <= 8); - secp256k1_fe_verify(a); - secp256k1_fe_verify(b); - VERIFY_CHECK(r != b); -#endif - secp256k1_fe_mul_inner(r->n, a->n, b->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->magnitude <= 8); - secp256k1_fe_verify(a); -#endif - secp256k1_fe_sqr_inner(r->n, a->n); -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 0; - secp256k1_fe_verify(r); -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag) { - uint64_t mask0, mask1; - mask0 = flag + ~((uint64_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); - r->n[4] = (r->n[4] & mask0) | (a->n[4] & mask1); -#ifdef VERIFY - if (a->magnitude > r->magnitude) { - r->magnitude = a->magnitude; - } - r->normalized &= a->normalized; -#endif -} - -static SECP256K1_INLINE void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag) { - uint64_t mask0, mask1; - mask0 = flag + ~((uint64_t)0); - mask1 = ~mask0; - r->n[0] = (r->n[0] & mask0) | (a->n[0] & mask1); - r->n[1] = (r->n[1] & mask0) | (a->n[1] & mask1); - r->n[2] = (r->n[2] & mask0) | (a->n[2] & mask1); - r->n[3] = (r->n[3] & mask0) | (a->n[3] & mask1); -} - -static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a) { -#ifdef VERIFY - VERIFY_CHECK(a->normalized); -#endif - r->n[0] = a->n[0] | a->n[1] << 52; - r->n[1] = a->n[1] >> 12 | a->n[2] << 40; - r->n[2] = a->n[2] >> 24 | a->n[3] << 28; - r->n[3] = a->n[3] >> 36 | a->n[4] << 16; -} - -static SECP256K1_INLINE void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a) { - r->n[0] = a->n[0] & 0xFFFFFFFFFFFFFULL; - r->n[1] = a->n[0] >> 52 | ((a->n[1] << 12) & 0xFFFFFFFFFFFFFULL); - r->n[2] = a->n[1] >> 40 | ((a->n[2] << 24) & 0xFFFFFFFFFFFFFULL); - r->n[3] = a->n[2] >> 28 | ((a->n[3] << 36) & 0xFFFFFFFFFFFFFULL); - r->n[4] = a->n[3] >> 16; -#ifdef VERIFY - r->magnitude = 1; - r->normalized = 1; -#endif -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h deleted file mode 100644 index 0bf22bdd..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_5x52_int128_impl.h +++ /dev/null @@ -1,277 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_INNER5X52_IMPL_H_ -#define _SECP256K1_FIELD_INNER5X52_IMPL_H_ - -#include - -#ifdef VERIFY -#define VERIFY_BITS(x, n) VERIFY_CHECK(((x) >> (n)) == 0) -#else -#define VERIFY_BITS(x, n) do { } while(0) -#endif - -SECP256K1_INLINE static void secp256k1_fe_mul_inner(uint64_t *r, const uint64_t *a, const uint64_t * SECP256K1_RESTRICT b) { - uint128_t c, d; - uint64_t t3, t4, tx, u0; - uint64_t a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4]; - const uint64_t M = 0xFFFFFFFFFFFFFULL, R = 0x1000003D10ULL; - - VERIFY_BITS(a[0], 56); - VERIFY_BITS(a[1], 56); - VERIFY_BITS(a[2], 56); - VERIFY_BITS(a[3], 56); - VERIFY_BITS(a[4], 52); - VERIFY_BITS(b[0], 56); - VERIFY_BITS(b[1], 56); - VERIFY_BITS(b[2], 56); - VERIFY_BITS(b[3], 56); - VERIFY_BITS(b[4], 52); - VERIFY_CHECK(r != b); - - /* [... a b c] is a shorthand for ... + a<<104 + b<<52 + c<<0 mod n. - * px is a shorthand for sum(a[i]*b[x-i], i=0..x). - * Note that [x 0 0 0 0 0] = [x*R]. - */ - - d = (uint128_t)a0 * b[3] - + (uint128_t)a1 * b[2] - + (uint128_t)a2 * b[1] - + (uint128_t)a3 * b[0]; - VERIFY_BITS(d, 114); - /* [d 0 0 0] = [p3 0 0 0] */ - c = (uint128_t)a4 * b[4]; - VERIFY_BITS(c, 112); - /* [c 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - d += (c & M) * R; c >>= 52; - VERIFY_BITS(d, 115); - VERIFY_BITS(c, 60); - /* [c 0 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - t3 = d & M; d >>= 52; - VERIFY_BITS(t3, 52); - VERIFY_BITS(d, 63); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - - d += (uint128_t)a0 * b[4] - + (uint128_t)a1 * b[3] - + (uint128_t)a2 * b[2] - + (uint128_t)a3 * b[1] - + (uint128_t)a4 * b[0]; - VERIFY_BITS(d, 115); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - d += c * R; - VERIFY_BITS(d, 116); - /* [d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - t4 = d & M; d >>= 52; - VERIFY_BITS(t4, 52); - VERIFY_BITS(d, 64); - /* [d t4 t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - tx = (t4 >> 48); t4 &= (M >> 4); - VERIFY_BITS(tx, 4); - VERIFY_BITS(t4, 48); - /* [d t4+(tx<<48) t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - - c = (uint128_t)a0 * b[0]; - VERIFY_BITS(c, 112); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 0 p4 p3 0 0 p0] */ - d += (uint128_t)a1 * b[4] - + (uint128_t)a2 * b[3] - + (uint128_t)a3 * b[2] - + (uint128_t)a4 * b[1]; - VERIFY_BITS(d, 115); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = d & M; d >>= 52; - VERIFY_BITS(u0, 52); - VERIFY_BITS(d, 63); - /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = (u0 << 4) | tx; - VERIFY_BITS(u0, 56); - /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - c += (uint128_t)u0 * (R >> 4); - VERIFY_BITS(c, 115); - /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - r[0] = c & M; c >>= 52; - VERIFY_BITS(r[0], 52); - VERIFY_BITS(c, 61); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 0 p0] */ - - c += (uint128_t)a0 * b[1] - + (uint128_t)a1 * b[0]; - VERIFY_BITS(c, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 p1 p0] */ - d += (uint128_t)a2 * b[4] - + (uint128_t)a3 * b[3] - + (uint128_t)a4 * b[2]; - VERIFY_BITS(d, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - r[1] = c & M; c >>= 52; - VERIFY_BITS(r[1], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - - c += (uint128_t)a0 * b[2] - + (uint128_t)a1 * b[1] - + (uint128_t)a2 * b[0]; - VERIFY_BITS(c, 114); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint128_t)a3 * b[4] - + (uint128_t)a4 * b[3]; - VERIFY_BITS(d, 114); - /* [d 0 0 t4 t3 c t1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - /* [d 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = c & M; c >>= 52; - VERIFY_BITS(r[2], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 0 t4 t3+c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += d * R + t3; - VERIFY_BITS(c, 100); - /* [t4 c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[3] = c & M; c >>= 52; - VERIFY_BITS(r[3], 52); - VERIFY_BITS(c, 48); - /* [t4+c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += t4; - VERIFY_BITS(c, 49); - /* [c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = c; - VERIFY_BITS(r[4], 49); - /* [r4 r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} - -SECP256K1_INLINE static void secp256k1_fe_sqr_inner(uint64_t *r, const uint64_t *a) { - uint128_t c, d; - uint64_t a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4]; - int64_t t3, t4, tx, u0; - const uint64_t M = 0xFFFFFFFFFFFFFULL, R = 0x1000003D10ULL; - - VERIFY_BITS(a[0], 56); - VERIFY_BITS(a[1], 56); - VERIFY_BITS(a[2], 56); - VERIFY_BITS(a[3], 56); - VERIFY_BITS(a[4], 52); - - /** [... a b c] is a shorthand for ... + a<<104 + b<<52 + c<<0 mod n. - * px is a shorthand for sum(a[i]*a[x-i], i=0..x). - * Note that [x 0 0 0 0 0] = [x*R]. - */ - - d = (uint128_t)(a0*2) * a3 - + (uint128_t)(a1*2) * a2; - VERIFY_BITS(d, 114); - /* [d 0 0 0] = [p3 0 0 0] */ - c = (uint128_t)a4 * a4; - VERIFY_BITS(c, 112); - /* [c 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - d += (c & M) * R; c >>= 52; - VERIFY_BITS(d, 115); - VERIFY_BITS(c, 60); - /* [c 0 0 0 0 0 d 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - t3 = d & M; d >>= 52; - VERIFY_BITS(t3, 52); - VERIFY_BITS(d, 63); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 0 p3 0 0 0] */ - - a4 *= 2; - d += (uint128_t)a0 * a4 - + (uint128_t)(a1*2) * a3 - + (uint128_t)a2 * a2; - VERIFY_BITS(d, 115); - /* [c 0 0 0 0 d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - d += c * R; - VERIFY_BITS(d, 116); - /* [d t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - t4 = d & M; d >>= 52; - VERIFY_BITS(t4, 52); - VERIFY_BITS(d, 64); - /* [d t4 t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - tx = (t4 >> 48); t4 &= (M >> 4); - VERIFY_BITS(tx, 4); - VERIFY_BITS(t4, 48); - /* [d t4+(tx<<48) t3 0 0 0] = [p8 0 0 0 p4 p3 0 0 0] */ - - c = (uint128_t)a0 * a0; - VERIFY_BITS(c, 112); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 0 p4 p3 0 0 p0] */ - d += (uint128_t)a1 * a4 - + (uint128_t)(a2*2) * a3; - VERIFY_BITS(d, 114); - /* [d t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = d & M; d >>= 52; - VERIFY_BITS(u0, 52); - VERIFY_BITS(d, 62); - /* [d u0 t4+(tx<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - /* [d 0 t4+(tx<<48)+(u0<<52) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - u0 = (u0 << 4) | tx; - VERIFY_BITS(u0, 56); - /* [d 0 t4+(u0<<48) t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - c += (uint128_t)u0 * (R >> 4); - VERIFY_BITS(c, 113); - /* [d 0 t4 t3 0 0 c] = [p8 0 0 p5 p4 p3 0 0 p0] */ - r[0] = c & M; c >>= 52; - VERIFY_BITS(r[0], 52); - VERIFY_BITS(c, 61); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 0 p0] */ - - a0 *= 2; - c += (uint128_t)a0 * a1; - VERIFY_BITS(c, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 0 p5 p4 p3 0 p1 p0] */ - d += (uint128_t)a2 * a4 - + (uint128_t)a3 * a3; - VERIFY_BITS(d, 114); - /* [d 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 t4 t3 0 c r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - r[1] = c & M; c >>= 52; - VERIFY_BITS(r[1], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 0 p1 p0] */ - - c += (uint128_t)a0 * a2 - + (uint128_t)a1 * a1; - VERIFY_BITS(c, 114); - /* [d 0 0 t4 t3 c r1 r0] = [p8 0 p6 p5 p4 p3 p2 p1 p0] */ - d += (uint128_t)a3 * a4; - VERIFY_BITS(d, 114); - /* [d 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += (d & M) * R; d >>= 52; - VERIFY_BITS(c, 115); - VERIFY_BITS(d, 62); - /* [d 0 0 0 t4 t3 c r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[2] = c & M; c >>= 52; - VERIFY_BITS(r[2], 52); - VERIFY_BITS(c, 63); - /* [d 0 0 0 t4 t3+c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - - c += d * R + t3; - VERIFY_BITS(c, 100); - /* [t4 c r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[3] = c & M; c >>= 52; - VERIFY_BITS(r[3], 52); - VERIFY_BITS(c, 48); - /* [t4+c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - c += t4; - VERIFY_BITS(c, 49); - /* [c r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ - r[4] = c; - VERIFY_BITS(r[4], 49); - /* [r4 r3 r2 r1 r0] = [p8 p7 p6 p5 p4 p3 p2 p1 p0] */ -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h deleted file mode 100644 index 5127b279..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/field_impl.h +++ /dev/null @@ -1,315 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_FIELD_IMPL_H_ -#define _SECP256K1_FIELD_IMPL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include "util.h" - -#if defined(USE_FIELD_10X26) -#include "field_10x26_impl.h" -#elif defined(USE_FIELD_5X52) -#include "field_5x52_impl.h" -#else -#error "Please select field implementation" -#endif - -SECP256K1_INLINE static int secp256k1_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe na; - secp256k1_fe_negate(&na, a, 1); - secp256k1_fe_add(&na, b); - return secp256k1_fe_normalizes_to_zero(&na); -} - -SECP256K1_INLINE static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe na; - secp256k1_fe_negate(&na, a, 1); - secp256k1_fe_add(&na, b); - return secp256k1_fe_normalizes_to_zero_var(&na); -} - -static int secp256k1_fe_sqrt(secp256k1_fe *r, const secp256k1_fe *a) { - /** Given that p is congruent to 3 mod 4, we can compute the square root of - * a mod p as the (p+1)/4'th power of a. - * - * As (p+1)/4 is an even number, it will have the same result for a and for - * (-a). Only one of these two numbers actually has a square root however, - * so we test at the end by squaring and comparing to the input. - * Also because (p+1)/4 is an even number, the computed square root is - * itself always a square (a ** ((p+1)/4) is the square of a ** ((p+1)/8)). - */ - secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1; - int j; - - /** The binary representation of (p + 1)/4 has 3 blocks of 1s, with lengths in - * { 2, 22, 223 }. Use an addition chain to calculate 2^n - 1 for each block: - * 1, [2], 3, 6, 9, 11, [22], 44, 88, 176, 220, [223] - */ - - secp256k1_fe_sqr(&x2, a); - secp256k1_fe_mul(&x2, &x2, a); - - secp256k1_fe_sqr(&x3, &x2); - secp256k1_fe_mul(&x3, &x3, a); - - x6 = x3; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x6, &x6); - } - secp256k1_fe_mul(&x6, &x6, &x3); - - x9 = x6; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x9, &x9); - } - secp256k1_fe_mul(&x9, &x9, &x3); - - x11 = x9; - for (j=0; j<2; j++) { - secp256k1_fe_sqr(&x11, &x11); - } - secp256k1_fe_mul(&x11, &x11, &x2); - - x22 = x11; - for (j=0; j<11; j++) { - secp256k1_fe_sqr(&x22, &x22); - } - secp256k1_fe_mul(&x22, &x22, &x11); - - x44 = x22; - for (j=0; j<22; j++) { - secp256k1_fe_sqr(&x44, &x44); - } - secp256k1_fe_mul(&x44, &x44, &x22); - - x88 = x44; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x88, &x88); - } - secp256k1_fe_mul(&x88, &x88, &x44); - - x176 = x88; - for (j=0; j<88; j++) { - secp256k1_fe_sqr(&x176, &x176); - } - secp256k1_fe_mul(&x176, &x176, &x88); - - x220 = x176; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x220, &x220); - } - secp256k1_fe_mul(&x220, &x220, &x44); - - x223 = x220; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x223, &x223); - } - secp256k1_fe_mul(&x223, &x223, &x3); - - /* The final result is then assembled using a sliding window over the blocks. */ - - t1 = x223; - for (j=0; j<23; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x22); - for (j=0; j<6; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x2); - secp256k1_fe_sqr(&t1, &t1); - secp256k1_fe_sqr(r, &t1); - - /* Check that a square root was actually calculated */ - - secp256k1_fe_sqr(&t1, r); - return secp256k1_fe_equal(&t1, a); -} - -static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a) { - secp256k1_fe x2, x3, x6, x9, x11, x22, x44, x88, x176, x220, x223, t1; - int j; - - /** The binary representation of (p - 2) has 5 blocks of 1s, with lengths in - * { 1, 2, 22, 223 }. Use an addition chain to calculate 2^n - 1 for each block: - * [1], [2], 3, 6, 9, 11, [22], 44, 88, 176, 220, [223] - */ - - secp256k1_fe_sqr(&x2, a); - secp256k1_fe_mul(&x2, &x2, a); - - secp256k1_fe_sqr(&x3, &x2); - secp256k1_fe_mul(&x3, &x3, a); - - x6 = x3; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x6, &x6); - } - secp256k1_fe_mul(&x6, &x6, &x3); - - x9 = x6; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x9, &x9); - } - secp256k1_fe_mul(&x9, &x9, &x3); - - x11 = x9; - for (j=0; j<2; j++) { - secp256k1_fe_sqr(&x11, &x11); - } - secp256k1_fe_mul(&x11, &x11, &x2); - - x22 = x11; - for (j=0; j<11; j++) { - secp256k1_fe_sqr(&x22, &x22); - } - secp256k1_fe_mul(&x22, &x22, &x11); - - x44 = x22; - for (j=0; j<22; j++) { - secp256k1_fe_sqr(&x44, &x44); - } - secp256k1_fe_mul(&x44, &x44, &x22); - - x88 = x44; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x88, &x88); - } - secp256k1_fe_mul(&x88, &x88, &x44); - - x176 = x88; - for (j=0; j<88; j++) { - secp256k1_fe_sqr(&x176, &x176); - } - secp256k1_fe_mul(&x176, &x176, &x88); - - x220 = x176; - for (j=0; j<44; j++) { - secp256k1_fe_sqr(&x220, &x220); - } - secp256k1_fe_mul(&x220, &x220, &x44); - - x223 = x220; - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&x223, &x223); - } - secp256k1_fe_mul(&x223, &x223, &x3); - - /* The final result is then assembled using a sliding window over the blocks. */ - - t1 = x223; - for (j=0; j<23; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x22); - for (j=0; j<5; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, a); - for (j=0; j<3; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(&t1, &t1, &x2); - for (j=0; j<2; j++) { - secp256k1_fe_sqr(&t1, &t1); - } - secp256k1_fe_mul(r, a, &t1); -} - -static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a) { -#if defined(USE_FIELD_INV_BUILTIN) - secp256k1_fe_inv(r, a); -#elif defined(USE_FIELD_INV_NUM) - secp256k1_num n, m; - static const secp256k1_fe negone = SECP256K1_FE_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL, 0xFFFFFC2EUL - ); - /* secp256k1 field prime, value p defined in "Standards for Efficient Cryptography" (SEC2) 2.7.1. */ - static const unsigned char prime[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F - }; - unsigned char b[32]; - int res; - secp256k1_fe c = *a; - secp256k1_fe_normalize_var(&c); - secp256k1_fe_get_b32(b, &c); - secp256k1_num_set_bin(&n, b, 32); - secp256k1_num_set_bin(&m, prime, 32); - secp256k1_num_mod_inverse(&n, &n, &m); - secp256k1_num_get_bin(b, 32, &n); - res = secp256k1_fe_set_b32(r, b); - (void)res; - VERIFY_CHECK(res); - /* Verify the result is the (unique) valid inverse using non-GMP code. */ - secp256k1_fe_mul(&c, &c, r); - secp256k1_fe_add(&c, &negone); - CHECK(secp256k1_fe_normalizes_to_zero_var(&c)); -#else -#error "Please select field inverse implementation" -#endif -} - -static void secp256k1_fe_inv_all_var(secp256k1_fe *r, const secp256k1_fe *a, size_t len) { - secp256k1_fe u; - size_t i; - if (len < 1) { - return; - } - - VERIFY_CHECK((r + len <= a) || (a + len <= r)); - - r[0] = a[0]; - - i = 0; - while (++i < len) { - secp256k1_fe_mul(&r[i], &r[i - 1], &a[i]); - } - - secp256k1_fe_inv_var(&u, &r[--i]); - - while (i > 0) { - size_t j = i--; - secp256k1_fe_mul(&r[j], &r[i], &u); - secp256k1_fe_mul(&u, &u, &a[j]); - } - - r[0] = u; -} - -static int secp256k1_fe_is_quad_var(const secp256k1_fe *a) { -#ifndef USE_NUM_NONE - unsigned char b[32]; - secp256k1_num n; - secp256k1_num m; - /* secp256k1 field prime, value p defined in "Standards for Efficient Cryptography" (SEC2) 2.7.1. */ - static const unsigned char prime[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFC,0x2F - }; - - secp256k1_fe c = *a; - secp256k1_fe_normalize_var(&c); - secp256k1_fe_get_b32(b, &c); - secp256k1_num_set_bin(&n, b, 32); - secp256k1_num_set_bin(&m, prime, 32); - return secp256k1_num_jacobi(&n, &m) >= 0; -#else - secp256k1_fe r; - return secp256k1_fe_sqrt(&r, a); -#endif -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c deleted file mode 100644 index 1835fd49..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/gen_context.c +++ /dev/null @@ -1,74 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014, 2015 Thomas Daede, Cory Fields * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#define USE_BASIC_CONFIG 1 - -#include "basic-config.h" -#include "include/secp256k1.h" -#include "field_impl.h" -#include "scalar_impl.h" -#include "group_impl.h" -#include "ecmult_gen_impl.h" - -static void default_error_callback_fn(const char* str, void* data) { - (void)data; - fprintf(stderr, "[libsecp256k1] internal consistency check failed: %s\n", str); - abort(); -} - -static const secp256k1_callback default_error_callback = { - default_error_callback_fn, - NULL -}; - -int main(int argc, char **argv) { - secp256k1_ecmult_gen_context ctx; - int inner; - int outer; - FILE* fp; - - (void)argc; - (void)argv; - - fp = fopen("src/ecmult_static_context.h","w"); - if (fp == NULL) { - fprintf(stderr, "Could not open src/ecmult_static_context.h for writing!\n"); - return -1; - } - - fprintf(fp, "#ifndef _SECP256K1_ECMULT_STATIC_CONTEXT_\n"); - fprintf(fp, "#define _SECP256K1_ECMULT_STATIC_CONTEXT_\n"); - fprintf(fp, "#include \"group.h\"\n"); - fprintf(fp, "#define SC SECP256K1_GE_STORAGE_CONST\n"); - fprintf(fp, "static const secp256k1_ge_storage secp256k1_ecmult_static_context[64][16] = {\n"); - - secp256k1_ecmult_gen_context_init(&ctx); - secp256k1_ecmult_gen_context_build(&ctx, &default_error_callback); - for(outer = 0; outer != 64; outer++) { - fprintf(fp,"{\n"); - for(inner = 0; inner != 16; inner++) { - fprintf(fp," SC(%uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu, %uu)", SECP256K1_GE_STORAGE_CONST_GET((*ctx.prec)[outer][inner])); - if (inner != 15) { - fprintf(fp,",\n"); - } else { - fprintf(fp,"\n"); - } - } - if (outer != 63) { - fprintf(fp,"},\n"); - } else { - fprintf(fp,"}\n"); - } - } - fprintf(fp,"};\n"); - secp256k1_ecmult_gen_context_clear(&ctx); - - fprintf(fp, "#undef SC\n"); - fprintf(fp, "#endif\n"); - fclose(fp); - - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h deleted file mode 100644 index 4957b248..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group.h +++ /dev/null @@ -1,144 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_GROUP_ -#define _SECP256K1_GROUP_ - -#include "num.h" -#include "field.h" - -/** A group element of the secp256k1 curve, in affine coordinates. */ -typedef struct { - secp256k1_fe x; - secp256k1_fe y; - int infinity; /* whether this represents the point at infinity */ -} secp256k1_ge; - -#define SECP256K1_GE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), 0} -#define SECP256K1_GE_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1} - -/** A group element of the secp256k1 curve, in jacobian coordinates. */ -typedef struct { - secp256k1_fe x; /* actual X: x/z^2 */ - secp256k1_fe y; /* actual Y: y/z^3 */ - secp256k1_fe z; - int infinity; /* whether this represents the point at infinity */ -} secp256k1_gej; - -#define SECP256K1_GEJ_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1), 0} -#define SECP256K1_GEJ_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1} - -typedef struct { - secp256k1_fe_storage x; - secp256k1_fe_storage y; -} secp256k1_ge_storage; - -#define SECP256K1_GE_STORAGE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_STORAGE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_STORAGE_CONST((i),(j),(k),(l),(m),(n),(o),(p))} - -#define SECP256K1_GE_STORAGE_CONST_GET(t) SECP256K1_FE_STORAGE_CONST_GET(t.x), SECP256K1_FE_STORAGE_CONST_GET(t.y) - -/** Set a group element equal to the point with given X and Y coordinates */ -static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y); - -/** Set a group element (affine) equal to the point with the given X coordinate - * and a Y coordinate that is a quadratic residue modulo p. The return value - * is true iff a coordinate with the given X coordinate exists. - */ -static int secp256k1_ge_set_xquad(secp256k1_ge *r, const secp256k1_fe *x); - -/** Set a group element (affine) equal to the point with the given X coordinate, and given oddness - * for Y. Return value indicates whether the result is valid. */ -static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd); - -/** Check whether a group element is the point at infinity. */ -static int secp256k1_ge_is_infinity(const secp256k1_ge *a); - -/** Check whether a group element is valid (i.e., on the curve). */ -static int secp256k1_ge_is_valid_var(const secp256k1_ge *a); - -static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a); - -/** Set a group element equal to another which is given in jacobian coordinates */ -static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a); - -/** Set a batch of group elements equal to the inputs given in jacobian coordinates */ -static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len, const secp256k1_callback *cb); - -/** Set a batch of group elements equal to the inputs given in jacobian - * coordinates (with known z-ratios). zr must contain the known z-ratios such - * that mul(a[i].z, zr[i+1]) == a[i+1].z. zr[0] is ignored. */ -static void secp256k1_ge_set_table_gej_var(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zr, size_t len); - -/** Bring a batch inputs given in jacobian coordinates (with known z-ratios) to - * the same global z "denominator". zr must contain the known z-ratios such - * that mul(a[i].z, zr[i+1]) == a[i+1].z. zr[0] is ignored. The x and y - * coordinates of the result are stored in r, the common z coordinate is - * stored in globalz. */ -static void secp256k1_ge_globalz_set_table_gej(size_t len, secp256k1_ge *r, secp256k1_fe *globalz, const secp256k1_gej *a, const secp256k1_fe *zr); - -/** Set a group element (jacobian) equal to the point at infinity. */ -static void secp256k1_gej_set_infinity(secp256k1_gej *r); - -/** Set a group element (jacobian) equal to another which is given in affine coordinates. */ -static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a); - -/** Compare the X coordinate of a group element (jacobian). */ -static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a); - -/** Set r equal to the inverse of a (i.e., mirrored around the X axis) */ -static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a); - -/** Check whether a group element is the point at infinity. */ -static int secp256k1_gej_is_infinity(const secp256k1_gej *a); - -/** Check whether a group element's y coordinate is a quadratic residue. */ -static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a); - -/** Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0). - * a may not be zero. Constant time. */ -static void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr); - -/** Set r equal to the double of a. If rzr is not-NULL, r->z = a->z * *rzr (where infinity means an implicit z = 0). */ -static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr); - -/** Set r equal to the sum of a and b. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case). */ -static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr); - -/** Set r equal to the sum of a and b (with b given in affine coordinates, and not infinity). */ -static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b); - -/** Set r equal to the sum of a and b (with b given in affine coordinates). This is more efficient - than secp256k1_gej_add_var. It is identical to secp256k1_gej_add_ge but without constant-time - guarantee, and b is allowed to be infinity. If rzr is non-NULL, r->z = a->z * *rzr (a cannot be infinity in that case). */ -static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr); - -/** Set r equal to the sum of a and b (with the inverse of b's Z coordinate passed as bzinv). */ -static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv); - -#ifdef USE_ENDOMORPHISM -/** Set r to be equal to lambda times a, where lambda is chosen in a way such that this is very fast. */ -static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a); -#endif - -/** Clear a secp256k1_gej to prevent leaking sensitive information. */ -static void secp256k1_gej_clear(secp256k1_gej *r); - -/** Clear a secp256k1_ge to prevent leaking sensitive information. */ -static void secp256k1_ge_clear(secp256k1_ge *r); - -/** Convert a group element to the storage type. */ -static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a); - -/** Convert a group element back from the storage type. */ -static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a); - -/** If flag is true, set *r equal to *a; otherwise leave it. Constant-time. */ -static void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag); - -/** Rescale a jacobian point by b which must be non-zero. Constant-time. */ -static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *b); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h deleted file mode 100644 index 7d723532..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/group_impl.h +++ /dev/null @@ -1,700 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_GROUP_IMPL_H_ -#define _SECP256K1_GROUP_IMPL_H_ - -#include "num.h" -#include "field.h" -#include "group.h" - -/* These points can be generated in sage as follows: - * - * 0. Setup a worksheet with the following parameters. - * b = 4 # whatever CURVE_B will be set to - * F = FiniteField (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F) - * C = EllipticCurve ([F (0), F (b)]) - * - * 1. Determine all the small orders available to you. (If there are - * no satisfactory ones, go back and change b.) - * print C.order().factor(limit=1000) - * - * 2. Choose an order as one of the prime factors listed in the above step. - * (You can also multiply some to get a composite order, though the - * tests will crash trying to invert scalars during signing.) We take a - * random point and scale it to drop its order to the desired value. - * There is some probability this won't work; just try again. - * order = 199 - * P = C.random_point() - * P = (int(P.order()) / int(order)) * P - * assert(P.order() == order) - * - * 3. Print the values. You'll need to use a vim macro or something to - * split the hex output into 4-byte chunks. - * print "%x %x" % P.xy() - */ -#if defined(EXHAUSTIVE_TEST_ORDER) -# if EXHAUSTIVE_TEST_ORDER == 199 -const secp256k1_ge secp256k1_ge_const_g = SECP256K1_GE_CONST( - 0xFA7CC9A7, 0x0737F2DB, 0xA749DD39, 0x2B4FB069, - 0x3B017A7D, 0xA808C2F1, 0xFB12940C, 0x9EA66C18, - 0x78AC123A, 0x5ED8AEF3, 0x8732BC91, 0x1F3A2868, - 0x48DF246C, 0x808DAE72, 0xCFE52572, 0x7F0501ED -); - -const int CURVE_B = 4; -# elif EXHAUSTIVE_TEST_ORDER == 13 -const secp256k1_ge secp256k1_ge_const_g = SECP256K1_GE_CONST( - 0xedc60018, 0xa51a786b, 0x2ea91f4d, 0x4c9416c0, - 0x9de54c3b, 0xa1316554, 0x6cf4345c, 0x7277ef15, - 0x54cb1b6b, 0xdc8c1273, 0x087844ea, 0x43f4603e, - 0x0eaf9a43, 0xf6effe55, 0x939f806d, 0x37adf8ac -); -const int CURVE_B = 2; -# else -# error No known generator for the specified exhaustive test group order. -# endif -#else -/** Generator for secp256k1, value 'g' defined in - * "Standards for Efficient Cryptography" (SEC2) 2.7.1. - */ -static const secp256k1_ge secp256k1_ge_const_g = SECP256K1_GE_CONST( - 0x79BE667EUL, 0xF9DCBBACUL, 0x55A06295UL, 0xCE870B07UL, - 0x029BFCDBUL, 0x2DCE28D9UL, 0x59F2815BUL, 0x16F81798UL, - 0x483ADA77UL, 0x26A3C465UL, 0x5DA4FBFCUL, 0x0E1108A8UL, - 0xFD17B448UL, 0xA6855419UL, 0x9C47D08FUL, 0xFB10D4B8UL -); - -const int CURVE_B = 7; -#endif - -static void secp256k1_ge_set_gej_zinv(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zi) { - secp256k1_fe zi2; - secp256k1_fe zi3; - secp256k1_fe_sqr(&zi2, zi); - secp256k1_fe_mul(&zi3, &zi2, zi); - secp256k1_fe_mul(&r->x, &a->x, &zi2); - secp256k1_fe_mul(&r->y, &a->y, &zi3); - r->infinity = a->infinity; -} - -static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y) { - r->infinity = 0; - r->x = *x; - r->y = *y; -} - -static int secp256k1_ge_is_infinity(const secp256k1_ge *a) { - return a->infinity; -} - -static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a) { - *r = *a; - secp256k1_fe_normalize_weak(&r->y); - secp256k1_fe_negate(&r->y, &r->y, 1); -} - -static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a) { - secp256k1_fe z2, z3; - r->infinity = a->infinity; - secp256k1_fe_inv(&a->z, &a->z); - secp256k1_fe_sqr(&z2, &a->z); - secp256k1_fe_mul(&z3, &a->z, &z2); - secp256k1_fe_mul(&a->x, &a->x, &z2); - secp256k1_fe_mul(&a->y, &a->y, &z3); - secp256k1_fe_set_int(&a->z, 1); - r->x = a->x; - r->y = a->y; -} - -static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a) { - secp256k1_fe z2, z3; - r->infinity = a->infinity; - if (a->infinity) { - return; - } - secp256k1_fe_inv_var(&a->z, &a->z); - secp256k1_fe_sqr(&z2, &a->z); - secp256k1_fe_mul(&z3, &a->z, &z2); - secp256k1_fe_mul(&a->x, &a->x, &z2); - secp256k1_fe_mul(&a->y, &a->y, &z3); - secp256k1_fe_set_int(&a->z, 1); - r->x = a->x; - r->y = a->y; -} - -static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len, const secp256k1_callback *cb) { - secp256k1_fe *az; - secp256k1_fe *azi; - size_t i; - size_t count = 0; - az = (secp256k1_fe *)checked_malloc(cb, sizeof(secp256k1_fe) * len); - for (i = 0; i < len; i++) { - if (!a[i].infinity) { - az[count++] = a[i].z; - } - } - - azi = (secp256k1_fe *)checked_malloc(cb, sizeof(secp256k1_fe) * count); - secp256k1_fe_inv_all_var(azi, az, count); - free(az); - - count = 0; - for (i = 0; i < len; i++) { - r[i].infinity = a[i].infinity; - if (!a[i].infinity) { - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &azi[count++]); - } - } - free(azi); -} - -static void secp256k1_ge_set_table_gej_var(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zr, size_t len) { - size_t i = len - 1; - secp256k1_fe zi; - - if (len > 0) { - /* Compute the inverse of the last z coordinate, and use it to compute the last affine output. */ - secp256k1_fe_inv(&zi, &a[i].z); - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &zi); - - /* Work out way backwards, using the z-ratios to scale the x/y values. */ - while (i > 0) { - secp256k1_fe_mul(&zi, &zi, &zr[i]); - i--; - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &zi); - } - } -} - -static void secp256k1_ge_globalz_set_table_gej(size_t len, secp256k1_ge *r, secp256k1_fe *globalz, const secp256k1_gej *a, const secp256k1_fe *zr) { - size_t i = len - 1; - secp256k1_fe zs; - - if (len > 0) { - /* The z of the final point gives us the "global Z" for the table. */ - r[i].x = a[i].x; - r[i].y = a[i].y; - *globalz = a[i].z; - r[i].infinity = 0; - zs = zr[i]; - - /* Work our way backwards, using the z-ratios to scale the x/y values. */ - while (i > 0) { - if (i != len - 1) { - secp256k1_fe_mul(&zs, &zs, &zr[i]); - } - i--; - secp256k1_ge_set_gej_zinv(&r[i], &a[i], &zs); - } - } -} - -static void secp256k1_gej_set_infinity(secp256k1_gej *r) { - r->infinity = 1; - secp256k1_fe_clear(&r->x); - secp256k1_fe_clear(&r->y); - secp256k1_fe_clear(&r->z); -} - -static void secp256k1_gej_clear(secp256k1_gej *r) { - r->infinity = 0; - secp256k1_fe_clear(&r->x); - secp256k1_fe_clear(&r->y); - secp256k1_fe_clear(&r->z); -} - -static void secp256k1_ge_clear(secp256k1_ge *r) { - r->infinity = 0; - secp256k1_fe_clear(&r->x); - secp256k1_fe_clear(&r->y); -} - -static int secp256k1_ge_set_xquad(secp256k1_ge *r, const secp256k1_fe *x) { - secp256k1_fe x2, x3, c; - r->x = *x; - secp256k1_fe_sqr(&x2, x); - secp256k1_fe_mul(&x3, x, &x2); - r->infinity = 0; - secp256k1_fe_set_int(&c, CURVE_B); - secp256k1_fe_add(&c, &x3); - return secp256k1_fe_sqrt(&r->y, &c); -} - -static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd) { - if (!secp256k1_ge_set_xquad(r, x)) { - return 0; - } - secp256k1_fe_normalize_var(&r->y); - if (secp256k1_fe_is_odd(&r->y) != odd) { - secp256k1_fe_negate(&r->y, &r->y, 1); - } - return 1; - -} - -static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a) { - r->infinity = a->infinity; - r->x = a->x; - r->y = a->y; - secp256k1_fe_set_int(&r->z, 1); -} - -static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a) { - secp256k1_fe r, r2; - VERIFY_CHECK(!a->infinity); - secp256k1_fe_sqr(&r, &a->z); secp256k1_fe_mul(&r, &r, x); - r2 = a->x; secp256k1_fe_normalize_weak(&r2); - return secp256k1_fe_equal_var(&r, &r2); -} - -static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a) { - r->infinity = a->infinity; - r->x = a->x; - r->y = a->y; - r->z = a->z; - secp256k1_fe_normalize_weak(&r->y); - secp256k1_fe_negate(&r->y, &r->y, 1); -} - -static int secp256k1_gej_is_infinity(const secp256k1_gej *a) { - return a->infinity; -} - -static int secp256k1_gej_is_valid_var(const secp256k1_gej *a) { - secp256k1_fe y2, x3, z2, z6; - if (a->infinity) { - return 0; - } - /** y^2 = x^3 + 7 - * (Y/Z^3)^2 = (X/Z^2)^3 + 7 - * Y^2 / Z^6 = X^3 / Z^6 + 7 - * Y^2 = X^3 + 7*Z^6 - */ - secp256k1_fe_sqr(&y2, &a->y); - secp256k1_fe_sqr(&x3, &a->x); secp256k1_fe_mul(&x3, &x3, &a->x); - secp256k1_fe_sqr(&z2, &a->z); - secp256k1_fe_sqr(&z6, &z2); secp256k1_fe_mul(&z6, &z6, &z2); - secp256k1_fe_mul_int(&z6, CURVE_B); - secp256k1_fe_add(&x3, &z6); - secp256k1_fe_normalize_weak(&x3); - return secp256k1_fe_equal_var(&y2, &x3); -} - -static int secp256k1_ge_is_valid_var(const secp256k1_ge *a) { - secp256k1_fe y2, x3, c; - if (a->infinity) { - return 0; - } - /* y^2 = x^3 + 7 */ - secp256k1_fe_sqr(&y2, &a->y); - secp256k1_fe_sqr(&x3, &a->x); secp256k1_fe_mul(&x3, &x3, &a->x); - secp256k1_fe_set_int(&c, CURVE_B); - secp256k1_fe_add(&x3, &c); - secp256k1_fe_normalize_weak(&x3); - return secp256k1_fe_equal_var(&y2, &x3); -} - -static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr) { - /* Operations: 3 mul, 4 sqr, 0 normalize, 12 mul_int/add/negate. - * - * Note that there is an implementation described at - * https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l - * which trades a multiply for a square, but in practice this is actually slower, - * mainly because it requires more normalizations. - */ - secp256k1_fe t1,t2,t3,t4; - /** For secp256k1, 2Q is infinity if and only if Q is infinity. This is because if 2Q = infinity, - * Q must equal -Q, or that Q.y == -(Q.y), or Q.y is 0. For a point on y^2 = x^3 + 7 to have - * y=0, x^3 must be -7 mod p. However, -7 has no cube root mod p. - * - * Having said this, if this function receives a point on a sextic twist, e.g. by - * a fault attack, it is possible for y to be 0. This happens for y^2 = x^3 + 6, - * since -6 does have a cube root mod p. For this point, this function will not set - * the infinity flag even though the point doubles to infinity, and the result - * point will be gibberish (z = 0 but infinity = 0). - */ - r->infinity = a->infinity; - if (r->infinity) { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 1); - } - return; - } - - if (rzr != NULL) { - *rzr = a->y; - secp256k1_fe_normalize_weak(rzr); - secp256k1_fe_mul_int(rzr, 2); - } - - secp256k1_fe_mul(&r->z, &a->z, &a->y); - secp256k1_fe_mul_int(&r->z, 2); /* Z' = 2*Y*Z (2) */ - secp256k1_fe_sqr(&t1, &a->x); - secp256k1_fe_mul_int(&t1, 3); /* T1 = 3*X^2 (3) */ - secp256k1_fe_sqr(&t2, &t1); /* T2 = 9*X^4 (1) */ - secp256k1_fe_sqr(&t3, &a->y); - secp256k1_fe_mul_int(&t3, 2); /* T3 = 2*Y^2 (2) */ - secp256k1_fe_sqr(&t4, &t3); - secp256k1_fe_mul_int(&t4, 2); /* T4 = 8*Y^4 (2) */ - secp256k1_fe_mul(&t3, &t3, &a->x); /* T3 = 2*X*Y^2 (1) */ - r->x = t3; - secp256k1_fe_mul_int(&r->x, 4); /* X' = 8*X*Y^2 (4) */ - secp256k1_fe_negate(&r->x, &r->x, 4); /* X' = -8*X*Y^2 (5) */ - secp256k1_fe_add(&r->x, &t2); /* X' = 9*X^4 - 8*X*Y^2 (6) */ - secp256k1_fe_negate(&t2, &t2, 1); /* T2 = -9*X^4 (2) */ - secp256k1_fe_mul_int(&t3, 6); /* T3 = 12*X*Y^2 (6) */ - secp256k1_fe_add(&t3, &t2); /* T3 = 12*X*Y^2 - 9*X^4 (8) */ - secp256k1_fe_mul(&r->y, &t1, &t3); /* Y' = 36*X^3*Y^2 - 27*X^6 (1) */ - secp256k1_fe_negate(&t2, &t4, 2); /* T2 = -8*Y^4 (3) */ - secp256k1_fe_add(&r->y, &t2); /* Y' = 36*X^3*Y^2 - 27*X^6 - 8*Y^4 (4) */ -} - -static SECP256K1_INLINE void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr) { - VERIFY_CHECK(!secp256k1_gej_is_infinity(a)); - secp256k1_gej_double_var(r, a, rzr); -} - -static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr) { - /* Operations: 12 mul, 4 sqr, 2 normalize, 12 mul_int/add/negate */ - secp256k1_fe z22, z12, u1, u2, s1, s2, h, i, i2, h2, h3, t; - - if (a->infinity) { - VERIFY_CHECK(rzr == NULL); - *r = *b; - return; - } - - if (b->infinity) { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 1); - } - *r = *a; - return; - } - - r->infinity = 0; - secp256k1_fe_sqr(&z22, &b->z); - secp256k1_fe_sqr(&z12, &a->z); - secp256k1_fe_mul(&u1, &a->x, &z22); - secp256k1_fe_mul(&u2, &b->x, &z12); - secp256k1_fe_mul(&s1, &a->y, &z22); secp256k1_fe_mul(&s1, &s1, &b->z); - secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &a->z); - secp256k1_fe_negate(&h, &u1, 1); secp256k1_fe_add(&h, &u2); - secp256k1_fe_negate(&i, &s1, 1); secp256k1_fe_add(&i, &s2); - if (secp256k1_fe_normalizes_to_zero_var(&h)) { - if (secp256k1_fe_normalizes_to_zero_var(&i)) { - secp256k1_gej_double_var(r, a, rzr); - } else { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 0); - } - r->infinity = 1; - } - return; - } - secp256k1_fe_sqr(&i2, &i); - secp256k1_fe_sqr(&h2, &h); - secp256k1_fe_mul(&h3, &h, &h2); - secp256k1_fe_mul(&h, &h, &b->z); - if (rzr != NULL) { - *rzr = h; - } - secp256k1_fe_mul(&r->z, &a->z, &h); - secp256k1_fe_mul(&t, &u1, &h2); - r->x = t; secp256k1_fe_mul_int(&r->x, 2); secp256k1_fe_add(&r->x, &h3); secp256k1_fe_negate(&r->x, &r->x, 3); secp256k1_fe_add(&r->x, &i2); - secp256k1_fe_negate(&r->y, &r->x, 5); secp256k1_fe_add(&r->y, &t); secp256k1_fe_mul(&r->y, &r->y, &i); - secp256k1_fe_mul(&h3, &h3, &s1); secp256k1_fe_negate(&h3, &h3, 1); - secp256k1_fe_add(&r->y, &h3); -} - -static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr) { - /* 8 mul, 3 sqr, 4 normalize, 12 mul_int/add/negate */ - secp256k1_fe z12, u1, u2, s1, s2, h, i, i2, h2, h3, t; - if (a->infinity) { - VERIFY_CHECK(rzr == NULL); - secp256k1_gej_set_ge(r, b); - return; - } - if (b->infinity) { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 1); - } - *r = *a; - return; - } - r->infinity = 0; - - secp256k1_fe_sqr(&z12, &a->z); - u1 = a->x; secp256k1_fe_normalize_weak(&u1); - secp256k1_fe_mul(&u2, &b->x, &z12); - s1 = a->y; secp256k1_fe_normalize_weak(&s1); - secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &a->z); - secp256k1_fe_negate(&h, &u1, 1); secp256k1_fe_add(&h, &u2); - secp256k1_fe_negate(&i, &s1, 1); secp256k1_fe_add(&i, &s2); - if (secp256k1_fe_normalizes_to_zero_var(&h)) { - if (secp256k1_fe_normalizes_to_zero_var(&i)) { - secp256k1_gej_double_var(r, a, rzr); - } else { - if (rzr != NULL) { - secp256k1_fe_set_int(rzr, 0); - } - r->infinity = 1; - } - return; - } - secp256k1_fe_sqr(&i2, &i); - secp256k1_fe_sqr(&h2, &h); - secp256k1_fe_mul(&h3, &h, &h2); - if (rzr != NULL) { - *rzr = h; - } - secp256k1_fe_mul(&r->z, &a->z, &h); - secp256k1_fe_mul(&t, &u1, &h2); - r->x = t; secp256k1_fe_mul_int(&r->x, 2); secp256k1_fe_add(&r->x, &h3); secp256k1_fe_negate(&r->x, &r->x, 3); secp256k1_fe_add(&r->x, &i2); - secp256k1_fe_negate(&r->y, &r->x, 5); secp256k1_fe_add(&r->y, &t); secp256k1_fe_mul(&r->y, &r->y, &i); - secp256k1_fe_mul(&h3, &h3, &s1); secp256k1_fe_negate(&h3, &h3, 1); - secp256k1_fe_add(&r->y, &h3); -} - -static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv) { - /* 9 mul, 3 sqr, 4 normalize, 12 mul_int/add/negate */ - secp256k1_fe az, z12, u1, u2, s1, s2, h, i, i2, h2, h3, t; - - if (b->infinity) { - *r = *a; - return; - } - if (a->infinity) { - secp256k1_fe bzinv2, bzinv3; - r->infinity = b->infinity; - secp256k1_fe_sqr(&bzinv2, bzinv); - secp256k1_fe_mul(&bzinv3, &bzinv2, bzinv); - secp256k1_fe_mul(&r->x, &b->x, &bzinv2); - secp256k1_fe_mul(&r->y, &b->y, &bzinv3); - secp256k1_fe_set_int(&r->z, 1); - return; - } - r->infinity = 0; - - /** We need to calculate (rx,ry,rz) = (ax,ay,az) + (bx,by,1/bzinv). Due to - * secp256k1's isomorphism we can multiply the Z coordinates on both sides - * by bzinv, and get: (rx,ry,rz*bzinv) = (ax,ay,az*bzinv) + (bx,by,1). - * This means that (rx,ry,rz) can be calculated as - * (ax,ay,az*bzinv) + (bx,by,1), when not applying the bzinv factor to rz. - * The variable az below holds the modified Z coordinate for a, which is used - * for the computation of rx and ry, but not for rz. - */ - secp256k1_fe_mul(&az, &a->z, bzinv); - - secp256k1_fe_sqr(&z12, &az); - u1 = a->x; secp256k1_fe_normalize_weak(&u1); - secp256k1_fe_mul(&u2, &b->x, &z12); - s1 = a->y; secp256k1_fe_normalize_weak(&s1); - secp256k1_fe_mul(&s2, &b->y, &z12); secp256k1_fe_mul(&s2, &s2, &az); - secp256k1_fe_negate(&h, &u1, 1); secp256k1_fe_add(&h, &u2); - secp256k1_fe_negate(&i, &s1, 1); secp256k1_fe_add(&i, &s2); - if (secp256k1_fe_normalizes_to_zero_var(&h)) { - if (secp256k1_fe_normalizes_to_zero_var(&i)) { - secp256k1_gej_double_var(r, a, NULL); - } else { - r->infinity = 1; - } - return; - } - secp256k1_fe_sqr(&i2, &i); - secp256k1_fe_sqr(&h2, &h); - secp256k1_fe_mul(&h3, &h, &h2); - r->z = a->z; secp256k1_fe_mul(&r->z, &r->z, &h); - secp256k1_fe_mul(&t, &u1, &h2); - r->x = t; secp256k1_fe_mul_int(&r->x, 2); secp256k1_fe_add(&r->x, &h3); secp256k1_fe_negate(&r->x, &r->x, 3); secp256k1_fe_add(&r->x, &i2); - secp256k1_fe_negate(&r->y, &r->x, 5); secp256k1_fe_add(&r->y, &t); secp256k1_fe_mul(&r->y, &r->y, &i); - secp256k1_fe_mul(&h3, &h3, &s1); secp256k1_fe_negate(&h3, &h3, 1); - secp256k1_fe_add(&r->y, &h3); -} - - -static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b) { - /* Operations: 7 mul, 5 sqr, 4 normalize, 21 mul_int/add/negate/cmov */ - static const secp256k1_fe fe_1 = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_fe zz, u1, u2, s1, s2, t, tt, m, n, q, rr; - secp256k1_fe m_alt, rr_alt; - int infinity, degenerate; - VERIFY_CHECK(!b->infinity); - VERIFY_CHECK(a->infinity == 0 || a->infinity == 1); - - /** In: - * Eric Brier and Marc Joye, Weierstrass Elliptic Curves and Side-Channel Attacks. - * In D. Naccache and P. Paillier, Eds., Public Key Cryptography, vol. 2274 of Lecture Notes in Computer Science, pages 335-345. Springer-Verlag, 2002. - * we find as solution for a unified addition/doubling formula: - * lambda = ((x1 + x2)^2 - x1 * x2 + a) / (y1 + y2), with a = 0 for secp256k1's curve equation. - * x3 = lambda^2 - (x1 + x2) - * 2*y3 = lambda * (x1 + x2 - 2 * x3) - (y1 + y2). - * - * Substituting x_i = Xi / Zi^2 and yi = Yi / Zi^3, for i=1,2,3, gives: - * U1 = X1*Z2^2, U2 = X2*Z1^2 - * S1 = Y1*Z2^3, S2 = Y2*Z1^3 - * Z = Z1*Z2 - * T = U1+U2 - * M = S1+S2 - * Q = T*M^2 - * R = T^2-U1*U2 - * X3 = 4*(R^2-Q) - * Y3 = 4*(R*(3*Q-2*R^2)-M^4) - * Z3 = 2*M*Z - * (Note that the paper uses xi = Xi / Zi and yi = Yi / Zi instead.) - * - * This formula has the benefit of being the same for both addition - * of distinct points and doubling. However, it breaks down in the - * case that either point is infinity, or that y1 = -y2. We handle - * these cases in the following ways: - * - * - If b is infinity we simply bail by means of a VERIFY_CHECK. - * - * - If a is infinity, we detect this, and at the end of the - * computation replace the result (which will be meaningless, - * but we compute to be constant-time) with b.x : b.y : 1. - * - * - If a = -b, we have y1 = -y2, which is a degenerate case. - * But here the answer is infinity, so we simply set the - * infinity flag of the result, overriding the computed values - * without even needing to cmov. - * - * - If y1 = -y2 but x1 != x2, which does occur thanks to certain - * properties of our curve (specifically, 1 has nontrivial cube - * roots in our field, and the curve equation has no x coefficient) - * then the answer is not infinity but also not given by the above - * equation. In this case, we cmov in place an alternate expression - * for lambda. Specifically (y1 - y2)/(x1 - x2). Where both these - * expressions for lambda are defined, they are equal, and can be - * obtained from each other by multiplication by (y1 + y2)/(y1 + y2) - * then substitution of x^3 + 7 for y^2 (using the curve equation). - * For all pairs of nonzero points (a, b) at least one is defined, - * so this covers everything. - */ - - secp256k1_fe_sqr(&zz, &a->z); /* z = Z1^2 */ - u1 = a->x; secp256k1_fe_normalize_weak(&u1); /* u1 = U1 = X1*Z2^2 (1) */ - secp256k1_fe_mul(&u2, &b->x, &zz); /* u2 = U2 = X2*Z1^2 (1) */ - s1 = a->y; secp256k1_fe_normalize_weak(&s1); /* s1 = S1 = Y1*Z2^3 (1) */ - secp256k1_fe_mul(&s2, &b->y, &zz); /* s2 = Y2*Z1^2 (1) */ - secp256k1_fe_mul(&s2, &s2, &a->z); /* s2 = S2 = Y2*Z1^3 (1) */ - t = u1; secp256k1_fe_add(&t, &u2); /* t = T = U1+U2 (2) */ - m = s1; secp256k1_fe_add(&m, &s2); /* m = M = S1+S2 (2) */ - secp256k1_fe_sqr(&rr, &t); /* rr = T^2 (1) */ - secp256k1_fe_negate(&m_alt, &u2, 1); /* Malt = -X2*Z1^2 */ - secp256k1_fe_mul(&tt, &u1, &m_alt); /* tt = -U1*U2 (2) */ - secp256k1_fe_add(&rr, &tt); /* rr = R = T^2-U1*U2 (3) */ - /** If lambda = R/M = 0/0 we have a problem (except in the "trivial" - * case that Z = z1z2 = 0, and this is special-cased later on). */ - degenerate = secp256k1_fe_normalizes_to_zero(&m) & - secp256k1_fe_normalizes_to_zero(&rr); - /* This only occurs when y1 == -y2 and x1^3 == x2^3, but x1 != x2. - * This means either x1 == beta*x2 or beta*x1 == x2, where beta is - * a nontrivial cube root of one. In either case, an alternate - * non-indeterminate expression for lambda is (y1 - y2)/(x1 - x2), - * so we set R/M equal to this. */ - rr_alt = s1; - secp256k1_fe_mul_int(&rr_alt, 2); /* rr = Y1*Z2^3 - Y2*Z1^3 (2) */ - secp256k1_fe_add(&m_alt, &u1); /* Malt = X1*Z2^2 - X2*Z1^2 */ - - secp256k1_fe_cmov(&rr_alt, &rr, !degenerate); - secp256k1_fe_cmov(&m_alt, &m, !degenerate); - /* Now Ralt / Malt = lambda and is guaranteed not to be 0/0. - * From here on out Ralt and Malt represent the numerator - * and denominator of lambda; R and M represent the explicit - * expressions x1^2 + x2^2 + x1x2 and y1 + y2. */ - secp256k1_fe_sqr(&n, &m_alt); /* n = Malt^2 (1) */ - secp256k1_fe_mul(&q, &n, &t); /* q = Q = T*Malt^2 (1) */ - /* These two lines use the observation that either M == Malt or M == 0, - * so M^3 * Malt is either Malt^4 (which is computed by squaring), or - * zero (which is "computed" by cmov). So the cost is one squaring - * versus two multiplications. */ - secp256k1_fe_sqr(&n, &n); - secp256k1_fe_cmov(&n, &m, degenerate); /* n = M^3 * Malt (2) */ - secp256k1_fe_sqr(&t, &rr_alt); /* t = Ralt^2 (1) */ - secp256k1_fe_mul(&r->z, &a->z, &m_alt); /* r->z = Malt*Z (1) */ - infinity = secp256k1_fe_normalizes_to_zero(&r->z) * (1 - a->infinity); - secp256k1_fe_mul_int(&r->z, 2); /* r->z = Z3 = 2*Malt*Z (2) */ - secp256k1_fe_negate(&q, &q, 1); /* q = -Q (2) */ - secp256k1_fe_add(&t, &q); /* t = Ralt^2-Q (3) */ - secp256k1_fe_normalize_weak(&t); - r->x = t; /* r->x = Ralt^2-Q (1) */ - secp256k1_fe_mul_int(&t, 2); /* t = 2*x3 (2) */ - secp256k1_fe_add(&t, &q); /* t = 2*x3 - Q: (4) */ - secp256k1_fe_mul(&t, &t, &rr_alt); /* t = Ralt*(2*x3 - Q) (1) */ - secp256k1_fe_add(&t, &n); /* t = Ralt*(2*x3 - Q) + M^3*Malt (3) */ - secp256k1_fe_negate(&r->y, &t, 3); /* r->y = Ralt*(Q - 2x3) - M^3*Malt (4) */ - secp256k1_fe_normalize_weak(&r->y); - secp256k1_fe_mul_int(&r->x, 4); /* r->x = X3 = 4*(Ralt^2-Q) */ - secp256k1_fe_mul_int(&r->y, 4); /* r->y = Y3 = 4*Ralt*(Q - 2x3) - 4*M^3*Malt (4) */ - - /** In case a->infinity == 1, replace r with (b->x, b->y, 1). */ - secp256k1_fe_cmov(&r->x, &b->x, a->infinity); - secp256k1_fe_cmov(&r->y, &b->y, a->infinity); - secp256k1_fe_cmov(&r->z, &fe_1, a->infinity); - r->infinity = infinity; -} - -static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *s) { - /* Operations: 4 mul, 1 sqr */ - secp256k1_fe zz; - VERIFY_CHECK(!secp256k1_fe_is_zero(s)); - secp256k1_fe_sqr(&zz, s); - secp256k1_fe_mul(&r->x, &r->x, &zz); /* r->x *= s^2 */ - secp256k1_fe_mul(&r->y, &r->y, &zz); - secp256k1_fe_mul(&r->y, &r->y, s); /* r->y *= s^3 */ - secp256k1_fe_mul(&r->z, &r->z, s); /* r->z *= s */ -} - -static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a) { - secp256k1_fe x, y; - VERIFY_CHECK(!a->infinity); - x = a->x; - secp256k1_fe_normalize(&x); - y = a->y; - secp256k1_fe_normalize(&y); - secp256k1_fe_to_storage(&r->x, &x); - secp256k1_fe_to_storage(&r->y, &y); -} - -static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a) { - secp256k1_fe_from_storage(&r->x, &a->x); - secp256k1_fe_from_storage(&r->y, &a->y); - r->infinity = 0; -} - -static SECP256K1_INLINE void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag) { - secp256k1_fe_storage_cmov(&r->x, &a->x, flag); - secp256k1_fe_storage_cmov(&r->y, &a->y, flag); -} - -#ifdef USE_ENDOMORPHISM -static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a) { - static const secp256k1_fe beta = SECP256K1_FE_CONST( - 0x7ae96a2bul, 0x657c0710ul, 0x6e64479eul, 0xac3434e9ul, - 0x9cf04975ul, 0x12f58995ul, 0xc1396c28ul, 0x719501eeul - ); - *r = *a; - secp256k1_fe_mul(&r->x, &r->x, &beta); -} -#endif - -static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a) { - secp256k1_fe yz; - - if (a->infinity) { - return 0; - } - - /* We rely on the fact that the Jacobi symbol of 1 / a->z^3 is the same as - * that of a->z. Thus a->y / a->z^3 is a quadratic residue iff a->y * a->z - is */ - secp256k1_fe_mul(&yz, &a->y, &a->z); - return secp256k1_fe_is_quad_var(&yz); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h deleted file mode 100644 index fca98cab..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash.h +++ /dev/null @@ -1,41 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_HASH_ -#define _SECP256K1_HASH_ - -#include -#include - -typedef struct { - uint32_t s[8]; - uint32_t buf[16]; /* In big endian */ - size_t bytes; -} secp256k1_sha256_t; - -static void secp256k1_sha256_initialize(secp256k1_sha256_t *hash); -static void secp256k1_sha256_write(secp256k1_sha256_t *hash, const unsigned char *data, size_t size); -static void secp256k1_sha256_finalize(secp256k1_sha256_t *hash, unsigned char *out32); - -typedef struct { - secp256k1_sha256_t inner, outer; -} secp256k1_hmac_sha256_t; - -static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256_t *hash, const unsigned char *key, size_t size); -static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256_t *hash, const unsigned char *data, size_t size); -static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256_t *hash, unsigned char *out32); - -typedef struct { - unsigned char v[32]; - unsigned char k[32]; - int retry; -} secp256k1_rfc6979_hmac_sha256_t; - -static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256_t *rng, const unsigned char *key, size_t keylen); -static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256_t *rng, unsigned char *out, size_t outlen); -static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256_t *rng); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h deleted file mode 100644 index b47e65f8..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/hash_impl.h +++ /dev/null @@ -1,281 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_HASH_IMPL_H_ -#define _SECP256K1_HASH_IMPL_H_ - -#include "hash.h" - -#include -#include -#include - -#define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) -#define Maj(x,y,z) (((x) & (y)) | ((z) & ((x) | (y)))) -#define Sigma0(x) (((x) >> 2 | (x) << 30) ^ ((x) >> 13 | (x) << 19) ^ ((x) >> 22 | (x) << 10)) -#define Sigma1(x) (((x) >> 6 | (x) << 26) ^ ((x) >> 11 | (x) << 21) ^ ((x) >> 25 | (x) << 7)) -#define sigma0(x) (((x) >> 7 | (x) << 25) ^ ((x) >> 18 | (x) << 14) ^ ((x) >> 3)) -#define sigma1(x) (((x) >> 17 | (x) << 15) ^ ((x) >> 19 | (x) << 13) ^ ((x) >> 10)) - -#define Round(a,b,c,d,e,f,g,h,k,w) do { \ - uint32_t t1 = (h) + Sigma1(e) + Ch((e), (f), (g)) + (k) + (w); \ - uint32_t t2 = Sigma0(a) + Maj((a), (b), (c)); \ - (d) += t1; \ - (h) = t1 + t2; \ -} while(0) - -#ifdef WORDS_BIGENDIAN -#define BE32(x) (x) -#else -#define BE32(p) ((((p) & 0xFF) << 24) | (((p) & 0xFF00) << 8) | (((p) & 0xFF0000) >> 8) | (((p) & 0xFF000000) >> 24)) -#endif - -static void secp256k1_sha256_initialize(secp256k1_sha256_t *hash) { - hash->s[0] = 0x6a09e667ul; - hash->s[1] = 0xbb67ae85ul; - hash->s[2] = 0x3c6ef372ul; - hash->s[3] = 0xa54ff53aul; - hash->s[4] = 0x510e527ful; - hash->s[5] = 0x9b05688cul; - hash->s[6] = 0x1f83d9abul; - hash->s[7] = 0x5be0cd19ul; - hash->bytes = 0; -} - -/** Perform one SHA-256 transformation, processing 16 big endian 32-bit words. */ -static void secp256k1_sha256_transform(uint32_t* s, const uint32_t* chunk) { - uint32_t a = s[0], b = s[1], c = s[2], d = s[3], e = s[4], f = s[5], g = s[6], h = s[7]; - uint32_t w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15; - - Round(a, b, c, d, e, f, g, h, 0x428a2f98, w0 = BE32(chunk[0])); - Round(h, a, b, c, d, e, f, g, 0x71374491, w1 = BE32(chunk[1])); - Round(g, h, a, b, c, d, e, f, 0xb5c0fbcf, w2 = BE32(chunk[2])); - Round(f, g, h, a, b, c, d, e, 0xe9b5dba5, w3 = BE32(chunk[3])); - Round(e, f, g, h, a, b, c, d, 0x3956c25b, w4 = BE32(chunk[4])); - Round(d, e, f, g, h, a, b, c, 0x59f111f1, w5 = BE32(chunk[5])); - Round(c, d, e, f, g, h, a, b, 0x923f82a4, w6 = BE32(chunk[6])); - Round(b, c, d, e, f, g, h, a, 0xab1c5ed5, w7 = BE32(chunk[7])); - Round(a, b, c, d, e, f, g, h, 0xd807aa98, w8 = BE32(chunk[8])); - Round(h, a, b, c, d, e, f, g, 0x12835b01, w9 = BE32(chunk[9])); - Round(g, h, a, b, c, d, e, f, 0x243185be, w10 = BE32(chunk[10])); - Round(f, g, h, a, b, c, d, e, 0x550c7dc3, w11 = BE32(chunk[11])); - Round(e, f, g, h, a, b, c, d, 0x72be5d74, w12 = BE32(chunk[12])); - Round(d, e, f, g, h, a, b, c, 0x80deb1fe, w13 = BE32(chunk[13])); - Round(c, d, e, f, g, h, a, b, 0x9bdc06a7, w14 = BE32(chunk[14])); - Round(b, c, d, e, f, g, h, a, 0xc19bf174, w15 = BE32(chunk[15])); - - Round(a, b, c, d, e, f, g, h, 0xe49b69c1, w0 += sigma1(w14) + w9 + sigma0(w1)); - Round(h, a, b, c, d, e, f, g, 0xefbe4786, w1 += sigma1(w15) + w10 + sigma0(w2)); - Round(g, h, a, b, c, d, e, f, 0x0fc19dc6, w2 += sigma1(w0) + w11 + sigma0(w3)); - Round(f, g, h, a, b, c, d, e, 0x240ca1cc, w3 += sigma1(w1) + w12 + sigma0(w4)); - Round(e, f, g, h, a, b, c, d, 0x2de92c6f, w4 += sigma1(w2) + w13 + sigma0(w5)); - Round(d, e, f, g, h, a, b, c, 0x4a7484aa, w5 += sigma1(w3) + w14 + sigma0(w6)); - Round(c, d, e, f, g, h, a, b, 0x5cb0a9dc, w6 += sigma1(w4) + w15 + sigma0(w7)); - Round(b, c, d, e, f, g, h, a, 0x76f988da, w7 += sigma1(w5) + w0 + sigma0(w8)); - Round(a, b, c, d, e, f, g, h, 0x983e5152, w8 += sigma1(w6) + w1 + sigma0(w9)); - Round(h, a, b, c, d, e, f, g, 0xa831c66d, w9 += sigma1(w7) + w2 + sigma0(w10)); - Round(g, h, a, b, c, d, e, f, 0xb00327c8, w10 += sigma1(w8) + w3 + sigma0(w11)); - Round(f, g, h, a, b, c, d, e, 0xbf597fc7, w11 += sigma1(w9) + w4 + sigma0(w12)); - Round(e, f, g, h, a, b, c, d, 0xc6e00bf3, w12 += sigma1(w10) + w5 + sigma0(w13)); - Round(d, e, f, g, h, a, b, c, 0xd5a79147, w13 += sigma1(w11) + w6 + sigma0(w14)); - Round(c, d, e, f, g, h, a, b, 0x06ca6351, w14 += sigma1(w12) + w7 + sigma0(w15)); - Round(b, c, d, e, f, g, h, a, 0x14292967, w15 += sigma1(w13) + w8 + sigma0(w0)); - - Round(a, b, c, d, e, f, g, h, 0x27b70a85, w0 += sigma1(w14) + w9 + sigma0(w1)); - Round(h, a, b, c, d, e, f, g, 0x2e1b2138, w1 += sigma1(w15) + w10 + sigma0(w2)); - Round(g, h, a, b, c, d, e, f, 0x4d2c6dfc, w2 += sigma1(w0) + w11 + sigma0(w3)); - Round(f, g, h, a, b, c, d, e, 0x53380d13, w3 += sigma1(w1) + w12 + sigma0(w4)); - Round(e, f, g, h, a, b, c, d, 0x650a7354, w4 += sigma1(w2) + w13 + sigma0(w5)); - Round(d, e, f, g, h, a, b, c, 0x766a0abb, w5 += sigma1(w3) + w14 + sigma0(w6)); - Round(c, d, e, f, g, h, a, b, 0x81c2c92e, w6 += sigma1(w4) + w15 + sigma0(w7)); - Round(b, c, d, e, f, g, h, a, 0x92722c85, w7 += sigma1(w5) + w0 + sigma0(w8)); - Round(a, b, c, d, e, f, g, h, 0xa2bfe8a1, w8 += sigma1(w6) + w1 + sigma0(w9)); - Round(h, a, b, c, d, e, f, g, 0xa81a664b, w9 += sigma1(w7) + w2 + sigma0(w10)); - Round(g, h, a, b, c, d, e, f, 0xc24b8b70, w10 += sigma1(w8) + w3 + sigma0(w11)); - Round(f, g, h, a, b, c, d, e, 0xc76c51a3, w11 += sigma1(w9) + w4 + sigma0(w12)); - Round(e, f, g, h, a, b, c, d, 0xd192e819, w12 += sigma1(w10) + w5 + sigma0(w13)); - Round(d, e, f, g, h, a, b, c, 0xd6990624, w13 += sigma1(w11) + w6 + sigma0(w14)); - Round(c, d, e, f, g, h, a, b, 0xf40e3585, w14 += sigma1(w12) + w7 + sigma0(w15)); - Round(b, c, d, e, f, g, h, a, 0x106aa070, w15 += sigma1(w13) + w8 + sigma0(w0)); - - Round(a, b, c, d, e, f, g, h, 0x19a4c116, w0 += sigma1(w14) + w9 + sigma0(w1)); - Round(h, a, b, c, d, e, f, g, 0x1e376c08, w1 += sigma1(w15) + w10 + sigma0(w2)); - Round(g, h, a, b, c, d, e, f, 0x2748774c, w2 += sigma1(w0) + w11 + sigma0(w3)); - Round(f, g, h, a, b, c, d, e, 0x34b0bcb5, w3 += sigma1(w1) + w12 + sigma0(w4)); - Round(e, f, g, h, a, b, c, d, 0x391c0cb3, w4 += sigma1(w2) + w13 + sigma0(w5)); - Round(d, e, f, g, h, a, b, c, 0x4ed8aa4a, w5 += sigma1(w3) + w14 + sigma0(w6)); - Round(c, d, e, f, g, h, a, b, 0x5b9cca4f, w6 += sigma1(w4) + w15 + sigma0(w7)); - Round(b, c, d, e, f, g, h, a, 0x682e6ff3, w7 += sigma1(w5) + w0 + sigma0(w8)); - Round(a, b, c, d, e, f, g, h, 0x748f82ee, w8 += sigma1(w6) + w1 + sigma0(w9)); - Round(h, a, b, c, d, e, f, g, 0x78a5636f, w9 += sigma1(w7) + w2 + sigma0(w10)); - Round(g, h, a, b, c, d, e, f, 0x84c87814, w10 += sigma1(w8) + w3 + sigma0(w11)); - Round(f, g, h, a, b, c, d, e, 0x8cc70208, w11 += sigma1(w9) + w4 + sigma0(w12)); - Round(e, f, g, h, a, b, c, d, 0x90befffa, w12 += sigma1(w10) + w5 + sigma0(w13)); - Round(d, e, f, g, h, a, b, c, 0xa4506ceb, w13 += sigma1(w11) + w6 + sigma0(w14)); - Round(c, d, e, f, g, h, a, b, 0xbef9a3f7, w14 + sigma1(w12) + w7 + sigma0(w15)); - Round(b, c, d, e, f, g, h, a, 0xc67178f2, w15 + sigma1(w13) + w8 + sigma0(w0)); - - s[0] += a; - s[1] += b; - s[2] += c; - s[3] += d; - s[4] += e; - s[5] += f; - s[6] += g; - s[7] += h; -} - -static void secp256k1_sha256_write(secp256k1_sha256_t *hash, const unsigned char *data, size_t len) { - size_t bufsize = hash->bytes & 0x3F; - hash->bytes += len; - while (bufsize + len >= 64) { - /* Fill the buffer, and process it. */ - memcpy(((unsigned char*)hash->buf) + bufsize, data, 64 - bufsize); - data += 64 - bufsize; - len -= 64 - bufsize; - secp256k1_sha256_transform(hash->s, hash->buf); - bufsize = 0; - } - if (len) { - /* Fill the buffer with what remains. */ - memcpy(((unsigned char*)hash->buf) + bufsize, data, len); - } -} - -static void secp256k1_sha256_finalize(secp256k1_sha256_t *hash, unsigned char *out32) { - static const unsigned char pad[64] = {0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; - uint32_t sizedesc[2]; - uint32_t out[8]; - int i = 0; - sizedesc[0] = BE32(hash->bytes >> 29); - sizedesc[1] = BE32(hash->bytes << 3); - secp256k1_sha256_write(hash, pad, 1 + ((119 - (hash->bytes % 64)) % 64)); - secp256k1_sha256_write(hash, (const unsigned char*)sizedesc, 8); - for (i = 0; i < 8; i++) { - out[i] = BE32(hash->s[i]); - hash->s[i] = 0; - } - memcpy(out32, (const unsigned char*)out, 32); -} - -static void secp256k1_hmac_sha256_initialize(secp256k1_hmac_sha256_t *hash, const unsigned char *key, size_t keylen) { - int n; - unsigned char rkey[64]; - if (keylen <= 64) { - memcpy(rkey, key, keylen); - memset(rkey + keylen, 0, 64 - keylen); - } else { - secp256k1_sha256_t sha256; - secp256k1_sha256_initialize(&sha256); - secp256k1_sha256_write(&sha256, key, keylen); - secp256k1_sha256_finalize(&sha256, rkey); - memset(rkey + 32, 0, 32); - } - - secp256k1_sha256_initialize(&hash->outer); - for (n = 0; n < 64; n++) { - rkey[n] ^= 0x5c; - } - secp256k1_sha256_write(&hash->outer, rkey, 64); - - secp256k1_sha256_initialize(&hash->inner); - for (n = 0; n < 64; n++) { - rkey[n] ^= 0x5c ^ 0x36; - } - secp256k1_sha256_write(&hash->inner, rkey, 64); - memset(rkey, 0, 64); -} - -static void secp256k1_hmac_sha256_write(secp256k1_hmac_sha256_t *hash, const unsigned char *data, size_t size) { - secp256k1_sha256_write(&hash->inner, data, size); -} - -static void secp256k1_hmac_sha256_finalize(secp256k1_hmac_sha256_t *hash, unsigned char *out32) { - unsigned char temp[32]; - secp256k1_sha256_finalize(&hash->inner, temp); - secp256k1_sha256_write(&hash->outer, temp, 32); - memset(temp, 0, 32); - secp256k1_sha256_finalize(&hash->outer, out32); -} - - -static void secp256k1_rfc6979_hmac_sha256_initialize(secp256k1_rfc6979_hmac_sha256_t *rng, const unsigned char *key, size_t keylen) { - secp256k1_hmac_sha256_t hmac; - static const unsigned char zero[1] = {0x00}; - static const unsigned char one[1] = {0x01}; - - memset(rng->v, 0x01, 32); /* RFC6979 3.2.b. */ - memset(rng->k, 0x00, 32); /* RFC6979 3.2.c. */ - - /* RFC6979 3.2.d. */ - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_write(&hmac, zero, 1); - secp256k1_hmac_sha256_write(&hmac, key, keylen); - secp256k1_hmac_sha256_finalize(&hmac, rng->k); - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - - /* RFC6979 3.2.f. */ - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_write(&hmac, one, 1); - secp256k1_hmac_sha256_write(&hmac, key, keylen); - secp256k1_hmac_sha256_finalize(&hmac, rng->k); - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - rng->retry = 0; -} - -static void secp256k1_rfc6979_hmac_sha256_generate(secp256k1_rfc6979_hmac_sha256_t *rng, unsigned char *out, size_t outlen) { - /* RFC6979 3.2.h. */ - static const unsigned char zero[1] = {0x00}; - if (rng->retry) { - secp256k1_hmac_sha256_t hmac; - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_write(&hmac, zero, 1); - secp256k1_hmac_sha256_finalize(&hmac, rng->k); - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - } - - while (outlen > 0) { - secp256k1_hmac_sha256_t hmac; - int now = outlen; - secp256k1_hmac_sha256_initialize(&hmac, rng->k, 32); - secp256k1_hmac_sha256_write(&hmac, rng->v, 32); - secp256k1_hmac_sha256_finalize(&hmac, rng->v); - if (now > 32) { - now = 32; - } - memcpy(out, rng->v, now); - out += now; - outlen -= now; - } - - rng->retry = 1; -} - -static void secp256k1_rfc6979_hmac_sha256_finalize(secp256k1_rfc6979_hmac_sha256_t *rng) { - memset(rng->k, 0, 32); - memset(rng->v, 0, 32); - rng->retry = 0; -} - -#undef BE32 -#undef Round -#undef sigma1 -#undef sigma0 -#undef Sigma1 -#undef Sigma0 -#undef Maj -#undef Ch - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java deleted file mode 100644 index 1c67802f..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1.java +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * Copyright 2014-2016 the libsecp256k1 contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.bitcoin; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; - -import java.math.BigInteger; -import com.google.common.base.Preconditions; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import static org.bitcoin.NativeSecp256k1Util.*; - -/** - *

This class holds native methods to handle ECDSA verification.

- * - *

You can find an example library that can be used for this at https://github.com/bitcoin/secp256k1

- * - *

To build secp256k1 for use with bitcoinj, run - * `./configure --enable-jni --enable-experimental --enable-module-ecdh` - * and `make` then copy `.libs/libsecp256k1.so` to your system library path - * or point the JVM to the folder containing it with -Djava.library.path - *

- */ -public class NativeSecp256k1 { - - private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); - private static final Lock r = rwl.readLock(); - private static final Lock w = rwl.writeLock(); - private static ThreadLocal nativeECDSABuffer = new ThreadLocal(); - /** - * Verifies the given secp256k1 signature in native code. - * Calling when enabled == false is undefined (probably library not loaded) - * - * @param data The data which was signed, must be exactly 32 bytes - * @param signature The signature - * @param pub The public key which did the signing - */ - public static boolean verify(byte[] data, byte[] signature, byte[] pub) throws AssertFailException{ - Preconditions.checkArgument(data.length == 32 && signature.length <= 520 && pub.length <= 520); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < 520) { - byteBuff = ByteBuffer.allocateDirect(520); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(data); - byteBuff.put(signature); - byteBuff.put(pub); - - byte[][] retByteArray; - - r.lock(); - try { - return secp256k1_ecdsa_verify(byteBuff, Secp256k1Context.getContext(), signature.length, pub.length) == 1; - } finally { - r.unlock(); - } - } - - /** - * libsecp256k1 Create an ECDSA signature. - * - * @param data Message hash, 32 bytes - * @param key Secret key, 32 bytes - * - * Return values - * @param sig byte array of signature - */ - public static byte[] sign(byte[] data, byte[] sec) throws AssertFailException{ - Preconditions.checkArgument(data.length == 32 && sec.length <= 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < 32 + 32) { - byteBuff = ByteBuffer.allocateDirect(32 + 32); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(data); - byteBuff.put(sec); - - byte[][] retByteArray; - - r.lock(); - try { - retByteArray = secp256k1_ecdsa_sign(byteBuff, Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] sigArr = retByteArray[0]; - int sigLen = new BigInteger(new byte[] { retByteArray[1][0] }).intValue(); - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(sigArr.length, sigLen, "Got bad signature length."); - - return retVal == 0 ? new byte[0] : sigArr; - } - - /** - * libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid - * - * @param seckey ECDSA Secret key, 32 bytes - */ - public static boolean secKeyVerify(byte[] seckey) { - Preconditions.checkArgument(seckey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < seckey.length) { - byteBuff = ByteBuffer.allocateDirect(seckey.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seckey); - - r.lock(); - try { - return secp256k1_ec_seckey_verify(byteBuff,Secp256k1Context.getContext()) == 1; - } finally { - r.unlock(); - } - } - - - /** - * libsecp256k1 Compute Pubkey - computes public key from secret key - * - * @param seckey ECDSA Secret key, 32 bytes - * - * Return values - * @param pubkey ECDSA Public key, 33 or 65 bytes - */ - //TODO add a 'compressed' arg - public static byte[] computePubkey(byte[] seckey) throws AssertFailException{ - Preconditions.checkArgument(seckey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < seckey.length) { - byteBuff = ByteBuffer.allocateDirect(seckey.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seckey); - - byte[][] retByteArray; - - r.lock(); - try { - retByteArray = secp256k1_ec_pubkey_create(byteBuff, Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] pubArr = retByteArray[0]; - int pubLen = new BigInteger(new byte[] { retByteArray[1][0] }).intValue(); - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(pubArr.length, pubLen, "Got bad pubkey length."); - - return retVal == 0 ? new byte[0]: pubArr; - } - - /** - * libsecp256k1 Cleanup - This destroys the secp256k1 context object - * This should be called at the end of the program for proper cleanup of the context. - */ - public static synchronized void cleanup() { - w.lock(); - try { - secp256k1_destroy_context(Secp256k1Context.getContext()); - } finally { - w.unlock(); - } - } - - public static long cloneContext() { - r.lock(); - try { - return secp256k1_ctx_clone(Secp256k1Context.getContext()); - } finally { r.unlock(); } - } - - /** - * libsecp256k1 PrivKey Tweak-Mul - Tweak privkey by multiplying to it - * - * @param tweak some bytes to tweak with - * @param seckey 32-byte seckey - */ - public static byte[] privKeyTweakMul(byte[] privkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(privkey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < privkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(privkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(privkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_privkey_tweak_mul(byteBuff,Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] privArr = retByteArray[0]; - - int privLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(privArr.length, privLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return privArr; - } - - /** - * libsecp256k1 PrivKey Tweak-Add - Tweak privkey by adding to it - * - * @param tweak some bytes to tweak with - * @param seckey 32-byte seckey - */ - public static byte[] privKeyTweakAdd(byte[] privkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(privkey.length == 32); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < privkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(privkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(privkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_privkey_tweak_add(byteBuff,Secp256k1Context.getContext()); - } finally { - r.unlock(); - } - - byte[] privArr = retByteArray[0]; - - int privLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(privArr.length, privLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return privArr; - } - - /** - * libsecp256k1 PubKey Tweak-Add - Tweak pubkey by adding to it - * - * @param tweak some bytes to tweak with - * @param pubkey 32-byte seckey - */ - public static byte[] pubKeyTweakAdd(byte[] pubkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(pubkey.length == 33 || pubkey.length == 65); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < pubkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(pubkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(pubkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_pubkey_tweak_add(byteBuff,Secp256k1Context.getContext(), pubkey.length); - } finally { - r.unlock(); - } - - byte[] pubArr = retByteArray[0]; - - int pubLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(pubArr.length, pubLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return pubArr; - } - - /** - * libsecp256k1 PubKey Tweak-Mul - Tweak pubkey by multiplying to it - * - * @param tweak some bytes to tweak with - * @param pubkey 32-byte seckey - */ - public static byte[] pubKeyTweakMul(byte[] pubkey, byte[] tweak) throws AssertFailException{ - Preconditions.checkArgument(pubkey.length == 33 || pubkey.length == 65); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < pubkey.length + tweak.length) { - byteBuff = ByteBuffer.allocateDirect(pubkey.length + tweak.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(pubkey); - byteBuff.put(tweak); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_pubkey_tweak_mul(byteBuff,Secp256k1Context.getContext(), pubkey.length); - } finally { - r.unlock(); - } - - byte[] pubArr = retByteArray[0]; - - int pubLen = (byte) new BigInteger(new byte[] { retByteArray[1][0] }).intValue() & 0xFF; - int retVal = new BigInteger(new byte[] { retByteArray[1][1] }).intValue(); - - assertEquals(pubArr.length, pubLen, "Got bad pubkey length."); - - assertEquals(retVal, 1, "Failed return value check."); - - return pubArr; - } - - /** - * libsecp256k1 create ECDH secret - constant time ECDH calculation - * - * @param seckey byte array of secret key used in exponentiaion - * @param pubkey byte array of public key used in exponentiaion - */ - public static byte[] createECDHSecret(byte[] seckey, byte[] pubkey) throws AssertFailException{ - Preconditions.checkArgument(seckey.length <= 32 && pubkey.length <= 65); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < 32 + pubkey.length) { - byteBuff = ByteBuffer.allocateDirect(32 + pubkey.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seckey); - byteBuff.put(pubkey); - - byte[][] retByteArray; - r.lock(); - try { - retByteArray = secp256k1_ecdh(byteBuff, Secp256k1Context.getContext(), pubkey.length); - } finally { - r.unlock(); - } - - byte[] resArr = retByteArray[0]; - int retVal = new BigInteger(new byte[] { retByteArray[1][0] }).intValue(); - - assertEquals(resArr.length, 32, "Got bad result length."); - assertEquals(retVal, 1, "Failed return value check."); - - return resArr; - } - - /** - * libsecp256k1 randomize - updates the context randomization - * - * @param seed 32-byte random seed - */ - public static synchronized boolean randomize(byte[] seed) throws AssertFailException{ - Preconditions.checkArgument(seed.length == 32 || seed == null); - - ByteBuffer byteBuff = nativeECDSABuffer.get(); - if (byteBuff == null || byteBuff.capacity() < seed.length) { - byteBuff = ByteBuffer.allocateDirect(seed.length); - byteBuff.order(ByteOrder.nativeOrder()); - nativeECDSABuffer.set(byteBuff); - } - byteBuff.rewind(); - byteBuff.put(seed); - - w.lock(); - try { - return secp256k1_context_randomize(byteBuff, Secp256k1Context.getContext()) == 1; - } finally { - w.unlock(); - } - } - - private static native long secp256k1_ctx_clone(long context); - - private static native int secp256k1_context_randomize(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_privkey_tweak_add(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_privkey_tweak_mul(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_pubkey_tweak_add(ByteBuffer byteBuff, long context, int pubLen); - - private static native byte[][] secp256k1_pubkey_tweak_mul(ByteBuffer byteBuff, long context, int pubLen); - - private static native void secp256k1_destroy_context(long context); - - private static native int secp256k1_ecdsa_verify(ByteBuffer byteBuff, long context, int sigLen, int pubLen); - - private static native byte[][] secp256k1_ecdsa_sign(ByteBuffer byteBuff, long context); - - private static native int secp256k1_ec_seckey_verify(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_ec_pubkey_create(ByteBuffer byteBuff, long context); - - private static native byte[][] secp256k1_ec_pubkey_parse(ByteBuffer byteBuff, long context, int inputLen); - - private static native byte[][] secp256k1_ecdh(ByteBuffer byteBuff, long context, int inputLen); - -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java deleted file mode 100644 index c00d0889..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Test.java +++ /dev/null @@ -1,226 +0,0 @@ -package org.bitcoin; - -import com.google.common.io.BaseEncoding; -import java.util.Arrays; -import java.math.BigInteger; -import javax.xml.bind.DatatypeConverter; -import static org.bitcoin.NativeSecp256k1Util.*; - -/** - * This class holds test cases defined for testing this library. - */ -public class NativeSecp256k1Test { - - //TODO improve comments/add more tests - /** - * This tests verify() for a valid signature - */ - public static void testVerifyPos() throws AssertFailException{ - boolean result = false; - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90".toLowerCase()); //sha256hash of "testing" - byte[] sig = BaseEncoding.base16().lowerCase().decode("3044022079BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F817980220294F14E883B3F525B5367756C2A11EF6CF84B730B36C17CB0C56F0AAB2C98589".toLowerCase()); - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - - result = NativeSecp256k1.verify( data, sig, pub); - assertEquals( result, true , "testVerifyPos"); - } - - /** - * This tests verify() for a non-valid signature - */ - public static void testVerifyNeg() throws AssertFailException{ - boolean result = false; - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A91".toLowerCase()); //sha256hash of "testing" - byte[] sig = BaseEncoding.base16().lowerCase().decode("3044022079BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F817980220294F14E883B3F525B5367756C2A11EF6CF84B730B36C17CB0C56F0AAB2C98589".toLowerCase()); - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - - result = NativeSecp256k1.verify( data, sig, pub); - //System.out.println(" TEST " + new BigInteger(1, resultbytes).toString(16)); - assertEquals( result, false , "testVerifyNeg"); - } - - /** - * This tests secret key verify() for a valid secretkey - */ - public static void testSecKeyVerifyPos() throws AssertFailException{ - boolean result = false; - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - - result = NativeSecp256k1.secKeyVerify( sec ); - //System.out.println(" TEST " + new BigInteger(1, resultbytes).toString(16)); - assertEquals( result, true , "testSecKeyVerifyPos"); - } - - /** - * This tests secret key verify() for a invalid secretkey - */ - public static void testSecKeyVerifyNeg() throws AssertFailException{ - boolean result = false; - byte[] sec = BaseEncoding.base16().lowerCase().decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".toLowerCase()); - - result = NativeSecp256k1.secKeyVerify( sec ); - //System.out.println(" TEST " + new BigInteger(1, resultbytes).toString(16)); - assertEquals( result, false , "testSecKeyVerifyNeg"); - } - - /** - * This tests public key create() for a valid secretkey - */ - public static void testPubKeyCreatePos() throws AssertFailException{ - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.computePubkey( sec); - String pubkeyString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( pubkeyString , "04C591A8FF19AC9C4E4E5793673B83123437E975285E7B442F4EE2654DFFCA5E2D2103ED494718C697AC9AEBCFD19612E224DB46661011863ED2FC54E71861E2A6" , "testPubKeyCreatePos"); - } - - /** - * This tests public key create() for a invalid secretkey - */ - public static void testPubKeyCreateNeg() throws AssertFailException{ - byte[] sec = BaseEncoding.base16().lowerCase().decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.computePubkey( sec); - String pubkeyString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( pubkeyString, "" , "testPubKeyCreateNeg"); - } - - /** - * This tests sign() for a valid secretkey - */ - public static void testSignPos() throws AssertFailException{ - - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90".toLowerCase()); //sha256hash of "testing" - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.sign(data, sec); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString, "30440220182A108E1448DC8F1FB467D06A0F3BB8EA0533584CB954EF8DA112F1D60E39A202201C66F36DA211C087F3AF88B50EDF4F9BDAA6CF5FD6817E74DCA34DB12390C6E9" , "testSignPos"); - } - - /** - * This tests sign() for a invalid secretkey - */ - public static void testSignNeg() throws AssertFailException{ - byte[] data = BaseEncoding.base16().lowerCase().decode("CF80CD8AED482D5D1527D7DC72FCEFF84E6326592848447D2DC0B0E87DFC9A90".toLowerCase()); //sha256hash of "testing" - byte[] sec = BaseEncoding.base16().lowerCase().decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.sign(data, sec); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString, "" , "testSignNeg"); - } - - /** - * This tests private key tweak-add - */ - public static void testPrivKeyTweakAdd_1() throws AssertFailException { - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.privKeyTweakAdd( sec , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "A168571E189E6F9A7E2D657A4B53AE99B909F7E712D1C23CED28093CD57C88F3" , "testPrivKeyAdd_1"); - } - - /** - * This tests private key tweak-mul - */ - public static void testPrivKeyTweakMul_1() throws AssertFailException { - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.privKeyTweakMul( sec , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "97F8184235F101550F3C71C927507651BD3F1CDB4A5A33B8986ACF0DEE20FFFC" , "testPrivKeyMul_1"); - } - - /** - * This tests private key tweak-add uncompressed - */ - public static void testPrivKeyTweakAdd_2() throws AssertFailException { - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.pubKeyTweakAdd( pub , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "0411C6790F4B663CCE607BAAE08C43557EDC1A4D11D88DFCB3D841D0C6A941AF525A268E2A863C148555C48FB5FBA368E88718A46E205FABC3DBA2CCFFAB0796EF" , "testPrivKeyAdd_2"); - } - - /** - * This tests private key tweak-mul uncompressed - */ - public static void testPrivKeyTweakMul_2() throws AssertFailException { - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - byte[] data = BaseEncoding.base16().lowerCase().decode("3982F19BEF1615BCCFBB05E321C10E1D4CBA3DF0E841C2E41EEB6016347653C3".toLowerCase()); //sha256hash of "tweak" - - byte[] resultArr = NativeSecp256k1.pubKeyTweakMul( pub , data ); - String sigString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( sigString , "04E0FE6FE55EBCA626B98A807F6CAF654139E14E5E3698F01A9A658E21DC1D2791EC060D4F412A794D5370F672BC94B722640B5F76914151CFCA6E712CA48CC589" , "testPrivKeyMul_2"); - } - - /** - * This tests seed randomization - */ - public static void testRandomize() throws AssertFailException { - byte[] seed = BaseEncoding.base16().lowerCase().decode("A441B15FE9A3CF56661190A0B93B9DEC7D04127288CC87250967CF3B52894D11".toLowerCase()); //sha256hash of "random" - boolean result = NativeSecp256k1.randomize(seed); - assertEquals( result, true, "testRandomize"); - } - - public static void testCreateECDHSecret() throws AssertFailException{ - - byte[] sec = BaseEncoding.base16().lowerCase().decode("67E56582298859DDAE725F972992A07C6C4FB9F62A8FFF58CE3CA926A1063530".toLowerCase()); - byte[] pub = BaseEncoding.base16().lowerCase().decode("040A629506E1B65CD9D2E0BA9C75DF9C4FED0DB16DC9625ED14397F0AFC836FAE595DC53F8B0EFE61E703075BD9B143BAC75EC0E19F82A2208CAEB32BE53414C40".toLowerCase()); - - byte[] resultArr = NativeSecp256k1.createECDHSecret(sec, pub); - String ecdhString = javax.xml.bind.DatatypeConverter.printHexBinary(resultArr); - assertEquals( ecdhString, "2A2A67007A926E6594AF3EB564FC74005B37A9C8AEF2033C4552051B5C87F043" , "testCreateECDHSecret"); - } - - public static void main(String[] args) throws AssertFailException{ - - - System.out.println("\n libsecp256k1 enabled: " + Secp256k1Context.isEnabled() + "\n"); - - assertEquals( Secp256k1Context.isEnabled(), true, "isEnabled" ); - - //Test verify() success/fail - testVerifyPos(); - testVerifyNeg(); - - //Test secKeyVerify() success/fail - testSecKeyVerifyPos(); - testSecKeyVerifyNeg(); - - //Test computePubkey() success/fail - testPubKeyCreatePos(); - testPubKeyCreateNeg(); - - //Test sign() success/fail - testSignPos(); - testSignNeg(); - - //Test privKeyTweakAdd() 1 - testPrivKeyTweakAdd_1(); - - //Test privKeyTweakMul() 2 - testPrivKeyTweakMul_1(); - - //Test privKeyTweakAdd() 3 - testPrivKeyTweakAdd_2(); - - //Test privKeyTweakMul() 4 - testPrivKeyTweakMul_2(); - - //Test randomize() - testRandomize(); - - //Test ECDH - testCreateECDHSecret(); - - NativeSecp256k1.cleanup(); - - System.out.println(" All tests passed." ); - - } -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java deleted file mode 100644 index 04732ba0..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/NativeSecp256k1Util.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2014-2016 the libsecp256k1 contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.bitcoin; - -public class NativeSecp256k1Util{ - - public static void assertEquals( int val, int val2, String message ) throws AssertFailException{ - if( val != val2 ) - throw new AssertFailException("FAIL: " + message); - } - - public static void assertEquals( boolean val, boolean val2, String message ) throws AssertFailException{ - if( val != val2 ) - throw new AssertFailException("FAIL: " + message); - else - System.out.println("PASS: " + message); - } - - public static void assertEquals( String val, String val2, String message ) throws AssertFailException{ - if( !val.equals(val2) ) - throw new AssertFailException("FAIL: " + message); - else - System.out.println("PASS: " + message); - } - - public static class AssertFailException extends Exception { - public AssertFailException(String message) { - super( message ); - } - } -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java deleted file mode 100644 index 216c986a..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org/bitcoin/Secp256k1Context.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2014-2016 the libsecp256k1 contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.bitcoin; - -/** - * This class holds the context reference used in native methods - * to handle ECDSA operations. - */ -public class Secp256k1Context { - private static final boolean enabled; //true if the library is loaded - private static final long context; //ref to pointer to context obj - - static { //static initializer - boolean isEnabled = true; - long contextRef = -1; - try { - System.loadLibrary("secp256k1"); - contextRef = secp256k1_init_context(); - } catch (UnsatisfiedLinkError e) { - System.out.println("UnsatisfiedLinkError: " + e.toString()); - isEnabled = false; - } - enabled = isEnabled; - context = contextRef; - } - - public static boolean isEnabled() { - return enabled; - } - - public static long getContext() { - if(!enabled) return -1; //sanity check - return context; - } - - private static native long secp256k1_init_context(); -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c deleted file mode 100644 index bcef7b32..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.c +++ /dev/null @@ -1,377 +0,0 @@ -#include -#include -#include -#include "org_bitcoin_NativeSecp256k1.h" -#include "include/secp256k1.h" -#include "include/secp256k1_ecdh.h" -#include "include/secp256k1_recovery.h" - - -SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ctx_1clone - (JNIEnv* env, jclass classObject, jlong ctx_l) -{ - const secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - jlong ctx_clone_l = (uintptr_t) secp256k1_context_clone(ctx); - - (void)classObject;(void)env; - - return ctx_clone_l; - -} - -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1context_1randomize - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - const unsigned char* seed = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - - (void)classObject; - - return secp256k1_context_randomize(ctx, seed); - -} - -SECP256K1_API void JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1destroy_1context - (JNIEnv* env, jclass classObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - secp256k1_context_destroy(ctx); - - (void)classObject;(void)env; -} - -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint siglen, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - - unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* sigdata = { (unsigned char*) (data + 32) }; - const unsigned char* pubdata = { (unsigned char*) (data + siglen + 32) }; - - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pubkey; - - int ret = secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigdata, siglen); - - if( ret ) { - ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pubdata, publen); - - if( ret ) { - ret = secp256k1_ecdsa_verify(ctx, &sig, data, &pubkey); - } - } - - (void)classObject; - - return ret; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1sign - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - unsigned char* secKey = (unsigned char*) (data + 32); - - jobjectArray retArray; - jbyteArray sigArray, intsByteArray; - unsigned char intsarray[2]; - - secp256k1_ecdsa_signature sig[72]; - - int ret = secp256k1_ecdsa_sign(ctx, sig, data, secKey, NULL, NULL ); - - unsigned char outputSer[72]; - size_t outputLen = 72; - - if( ret ) { - int ret2 = secp256k1_ecdsa_signature_serialize_der(ctx,outputSer, &outputLen, sig ); (void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - sigArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, sigArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, sigArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* secKey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - - (void)classObject; - - return secp256k1_ec_seckey_verify(ctx, secKey); -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1create - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - const unsigned char* secKey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - - secp256k1_pubkey pubkey; - - jobjectArray retArray; - jbyteArray pubkeyArray, intsByteArray; - unsigned char intsarray[2]; - - int ret = secp256k1_ec_pubkey_create(ctx, &pubkey, secKey); - - unsigned char outputSer[65]; - size_t outputLen = 65; - - if( ret ) { - int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - pubkeyArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, pubkeyArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, pubkeyArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; - -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1add - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* privkey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (privkey + 32); - - jobjectArray retArray; - jbyteArray privArray, intsByteArray; - unsigned char intsarray[2]; - - int privkeylen = 32; - - int ret = secp256k1_ec_privkey_tweak_add(ctx, privkey, tweak); - - intsarray[0] = privkeylen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - privArray = (*env)->NewByteArray(env, privkeylen); - (*env)->SetByteArrayRegion(env, privArray, 0, privkeylen, (jbyte*)privkey); - (*env)->SetObjectArrayElement(env, retArray, 0, privArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1mul - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* privkey = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (privkey + 32); - - jobjectArray retArray; - jbyteArray privArray, intsByteArray; - unsigned char intsarray[2]; - - int privkeylen = 32; - - int ret = secp256k1_ec_privkey_tweak_mul(ctx, privkey, tweak); - - intsarray[0] = privkeylen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - privArray = (*env)->NewByteArray(env, privkeylen); - (*env)->SetByteArrayRegion(env, privArray, 0, privkeylen, (jbyte*)privkey); - (*env)->SetObjectArrayElement(env, retArray, 0, privArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1add - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; -/* secp256k1_pubkey* pubkey = (secp256k1_pubkey*) (*env)->GetDirectBufferAddress(env, byteBufferObject);*/ - unsigned char* pkey = (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (pkey + publen); - - jobjectArray retArray; - jbyteArray pubArray, intsByteArray; - unsigned char intsarray[2]; - unsigned char outputSer[65]; - size_t outputLen = 65; - - secp256k1_pubkey pubkey; - int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pkey, publen); - - if( ret ) { - ret = secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, tweak); - } - - if( ret ) { - int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - pubArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, pubArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, pubArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1mul - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - unsigned char* pkey = (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* tweak = (unsigned char*) (pkey + publen); - - jobjectArray retArray; - jbyteArray pubArray, intsByteArray; - unsigned char intsarray[2]; - unsigned char outputSer[65]; - size_t outputLen = 65; - - secp256k1_pubkey pubkey; - int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pkey, publen); - - if ( ret ) { - ret = secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, tweak); - } - - if( ret ) { - int ret2 = secp256k1_ec_pubkey_serialize(ctx,outputSer, &outputLen, &pubkey,SECP256K1_EC_UNCOMPRESSED );(void)ret2; - } - - intsarray[0] = outputLen; - intsarray[1] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - pubArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, pubArray, 0, outputLen, (jbyte*)outputSer); - (*env)->SetObjectArrayElement(env, retArray, 0, pubArray); - - intsByteArray = (*env)->NewByteArray(env, 2); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 2, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} - -SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1pubkey_1combine - (JNIEnv * env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint numkeys) -{ - (void)classObject;(void)env;(void)byteBufferObject;(void)ctx_l;(void)numkeys; - - return 0; -} - -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdh - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen) -{ - secp256k1_context *ctx = (secp256k1_context*)(uintptr_t)ctx_l; - const unsigned char* secdata = (*env)->GetDirectBufferAddress(env, byteBufferObject); - const unsigned char* pubdata = (const unsigned char*) (secdata + 32); - - jobjectArray retArray; - jbyteArray outArray, intsByteArray; - unsigned char intsarray[1]; - secp256k1_pubkey pubkey; - unsigned char nonce_res[32]; - size_t outputLen = 32; - - int ret = secp256k1_ec_pubkey_parse(ctx, &pubkey, pubdata, publen); - - if (ret) { - ret = secp256k1_ecdh( - ctx, - nonce_res, - &pubkey, - secdata - ); - } - - intsarray[0] = ret; - - retArray = (*env)->NewObjectArray(env, 2, - (*env)->FindClass(env, "[B"), - (*env)->NewByteArray(env, 1)); - - outArray = (*env)->NewByteArray(env, outputLen); - (*env)->SetByteArrayRegion(env, outArray, 0, 32, (jbyte*)nonce_res); - (*env)->SetObjectArrayElement(env, retArray, 0, outArray); - - intsByteArray = (*env)->NewByteArray(env, 1); - (*env)->SetByteArrayRegion(env, intsByteArray, 0, 1, (jbyte*)intsarray); - (*env)->SetObjectArrayElement(env, retArray, 1, intsByteArray); - - (void)classObject; - - return retArray; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h deleted file mode 100644 index fe613c9e..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_NativeSecp256k1.h +++ /dev/null @@ -1,119 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -#include "include/secp256k1.h" -/* Header for class org_bitcoin_NativeSecp256k1 */ - -#ifndef _Included_org_bitcoin_NativeSecp256k1 -#define _Included_org_bitcoin_NativeSecp256k1 -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ctx_clone - * Signature: (J)J - */ -SECP256K1_API jlong JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ctx_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_context_randomize - * Signature: (Ljava/nio/ByteBuffer;J)I - */ -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1context_1randomize - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_privkey_tweak_add - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1add - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_privkey_tweak_mul - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1privkey_1tweak_1mul - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_pubkey_tweak_add - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1add - (JNIEnv *, jclass, jobject, jlong, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_pubkey_tweak_mul - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1pubkey_1tweak_1mul - (JNIEnv *, jclass, jobject, jlong, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_destroy_context - * Signature: (J)V - */ -SECP256K1_API void JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1destroy_1context - (JNIEnv *, jclass, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ecdsa_verify - * Signature: (Ljava/nio/ByteBuffer;JII)I - */ -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify - (JNIEnv *, jclass, jobject, jlong, jint, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ecdsa_sign - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1sign - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ec_seckey_verify - * Signature: (Ljava/nio/ByteBuffer;J)I - */ -SECP256K1_API jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1seckey_1verify - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ec_pubkey_create - * Signature: (Ljava/nio/ByteBuffer;J)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1create - (JNIEnv *, jclass, jobject, jlong); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ec_pubkey_parse - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ec_1pubkey_1parse - (JNIEnv *, jclass, jobject, jlong, jint); - -/* - * Class: org_bitcoin_NativeSecp256k1 - * Method: secp256k1_ecdh - * Signature: (Ljava/nio/ByteBuffer;JI)[[B - */ -SECP256K1_API jobjectArray JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdh - (JNIEnv* env, jclass classObject, jobject byteBufferObject, jlong ctx_l, jint publen); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c deleted file mode 100644 index a52939e7..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include "org_bitcoin_Secp256k1Context.h" -#include "include/secp256k1.h" - -SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context - (JNIEnv* env, jclass classObject) -{ - secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - (void)classObject;(void)env; - - return (uintptr_t)ctx; -} - diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h deleted file mode 100644 index 0d2bc84b..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/java/org_bitcoin_Secp256k1Context.h +++ /dev/null @@ -1,22 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -#include "include/secp256k1.h" -/* Header for class org_bitcoin_Secp256k1Context */ - -#ifndef _Included_org_bitcoin_Secp256k1Context -#define _Included_org_bitcoin_Secp256k1Context -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_bitcoin_Secp256k1Context - * Method: secp256k1_init_context - * Signature: ()J - */ -SECP256K1_API jlong JNICALL Java_org_bitcoin_Secp256k1Context_secp256k1_1init_1context - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include deleted file mode 100644 index e3088b46..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/Makefile.am.include +++ /dev/null @@ -1,8 +0,0 @@ -include_HEADERS += include/secp256k1_ecdh.h -noinst_HEADERS += src/modules/ecdh/main_impl.h -noinst_HEADERS += src/modules/ecdh/tests_impl.h -if USE_BENCHMARK -noinst_PROGRAMS += bench_ecdh -bench_ecdh_SOURCES = src/bench_ecdh.c -bench_ecdh_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB) -endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h deleted file mode 100644 index 9e30fb73..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/main_impl.h +++ /dev/null @@ -1,54 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_ECDH_MAIN_ -#define _SECP256K1_MODULE_ECDH_MAIN_ - -#include "include/secp256k1_ecdh.h" -#include "ecmult_const_impl.h" - -int secp256k1_ecdh(const secp256k1_context* ctx, unsigned char *result, const secp256k1_pubkey *point, const unsigned char *scalar) { - int ret = 0; - int overflow = 0; - secp256k1_gej res; - secp256k1_ge pt; - secp256k1_scalar s; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(result != NULL); - ARG_CHECK(point != NULL); - ARG_CHECK(scalar != NULL); - - secp256k1_pubkey_load(ctx, &pt, point); - secp256k1_scalar_set_b32(&s, scalar, &overflow); - if (overflow || secp256k1_scalar_is_zero(&s)) { - ret = 0; - } else { - unsigned char x[32]; - unsigned char y[1]; - secp256k1_sha256_t sha; - - secp256k1_ecmult_const(&res, &pt, &s); - secp256k1_ge_set_gej(&pt, &res); - /* Compute a hash of the point in compressed form - * Note we cannot use secp256k1_eckey_pubkey_serialize here since it does not - * expect its output to be secret and has a timing sidechannel. */ - secp256k1_fe_normalize(&pt.x); - secp256k1_fe_normalize(&pt.y); - secp256k1_fe_get_b32(x, &pt.x); - y[0] = 0x02 | secp256k1_fe_is_odd(&pt.y); - - secp256k1_sha256_initialize(&sha); - secp256k1_sha256_write(&sha, y, sizeof(y)); - secp256k1_sha256_write(&sha, x, sizeof(x)); - secp256k1_sha256_finalize(&sha, result); - ret = 1; - } - - secp256k1_scalar_clear(&s); - return ret; -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h deleted file mode 100644 index 85a5d0a9..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/ecdh/tests_impl.h +++ /dev/null @@ -1,105 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_ECDH_TESTS_ -#define _SECP256K1_MODULE_ECDH_TESTS_ - -void test_ecdh_api(void) { - /* Setup context that just counts errors */ - secp256k1_context *tctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - secp256k1_pubkey point; - unsigned char res[32]; - unsigned char s_one[32] = { 0 }; - int32_t ecount = 0; - s_one[31] = 1; - - secp256k1_context_set_error_callback(tctx, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(tctx, counting_illegal_callback_fn, &ecount); - CHECK(secp256k1_ec_pubkey_create(tctx, &point, s_one) == 1); - - /* Check all NULLs are detected */ - CHECK(secp256k1_ecdh(tctx, res, &point, s_one) == 1); - CHECK(ecount == 0); - CHECK(secp256k1_ecdh(tctx, NULL, &point, s_one) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdh(tctx, res, NULL, s_one) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdh(tctx, res, &point, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdh(tctx, res, &point, s_one) == 1); - CHECK(ecount == 3); - - /* Cleanup */ - secp256k1_context_destroy(tctx); -} - -void test_ecdh_generator_basepoint(void) { - unsigned char s_one[32] = { 0 }; - secp256k1_pubkey point[2]; - int i; - - s_one[31] = 1; - /* Check against pubkey creation when the basepoint is the generator */ - for (i = 0; i < 100; ++i) { - secp256k1_sha256_t sha; - unsigned char s_b32[32]; - unsigned char output_ecdh[32]; - unsigned char output_ser[32]; - unsigned char point_ser[33]; - size_t point_ser_len = sizeof(point_ser); - secp256k1_scalar s; - - random_scalar_order(&s); - secp256k1_scalar_get_b32(s_b32, &s); - - /* compute using ECDH function */ - CHECK(secp256k1_ec_pubkey_create(ctx, &point[0], s_one) == 1); - CHECK(secp256k1_ecdh(ctx, output_ecdh, &point[0], s_b32) == 1); - /* compute "explicitly" */ - CHECK(secp256k1_ec_pubkey_create(ctx, &point[1], s_b32) == 1); - CHECK(secp256k1_ec_pubkey_serialize(ctx, point_ser, &point_ser_len, &point[1], SECP256K1_EC_COMPRESSED) == 1); - CHECK(point_ser_len == sizeof(point_ser)); - secp256k1_sha256_initialize(&sha); - secp256k1_sha256_write(&sha, point_ser, point_ser_len); - secp256k1_sha256_finalize(&sha, output_ser); - /* compare */ - CHECK(memcmp(output_ecdh, output_ser, sizeof(output_ser)) == 0); - } -} - -void test_bad_scalar(void) { - unsigned char s_zero[32] = { 0 }; - unsigned char s_overflow[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41 - }; - unsigned char s_rand[32] = { 0 }; - unsigned char output[32]; - secp256k1_scalar rand; - secp256k1_pubkey point; - - /* Create random point */ - random_scalar_order(&rand); - secp256k1_scalar_get_b32(s_rand, &rand); - CHECK(secp256k1_ec_pubkey_create(ctx, &point, s_rand) == 1); - - /* Try to multiply it by bad values */ - CHECK(secp256k1_ecdh(ctx, output, &point, s_zero) == 0); - CHECK(secp256k1_ecdh(ctx, output, &point, s_overflow) == 0); - /* ...and a good one */ - s_overflow[31] -= 1; - CHECK(secp256k1_ecdh(ctx, output, &point, s_overflow) == 1); -} - -void run_ecdh_tests(void) { - test_ecdh_api(); - test_ecdh_generator_basepoint(); - test_bad_scalar(); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include deleted file mode 100644 index bf23c26e..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/Makefile.am.include +++ /dev/null @@ -1,8 +0,0 @@ -include_HEADERS += include/secp256k1_recovery.h -noinst_HEADERS += src/modules/recovery/main_impl.h -noinst_HEADERS += src/modules/recovery/tests_impl.h -if USE_BENCHMARK -noinst_PROGRAMS += bench_recover -bench_recover_SOURCES = src/bench_recover.c -bench_recover_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB) -endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h deleted file mode 100755 index c6fbe239..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/main_impl.h +++ /dev/null @@ -1,193 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_RECOVERY_MAIN_ -#define _SECP256K1_MODULE_RECOVERY_MAIN_ - -#include "include/secp256k1_recovery.h" - -static void secp256k1_ecdsa_recoverable_signature_load(const secp256k1_context* ctx, secp256k1_scalar* r, secp256k1_scalar* s, int* recid, const secp256k1_ecdsa_recoverable_signature* sig) { - (void)ctx; - if (sizeof(secp256k1_scalar) == 32) { - /* When the secp256k1_scalar type is exactly 32 byte, use its - * representation inside secp256k1_ecdsa_signature, as conversion is very fast. - * Note that secp256k1_ecdsa_signature_save must use the same representation. */ - memcpy(r, &sig->data[0], 32); - memcpy(s, &sig->data[32], 32); - } else { - secp256k1_scalar_set_b32(r, &sig->data[0], NULL); - secp256k1_scalar_set_b32(s, &sig->data[32], NULL); - } - *recid = sig->data[64]; -} - -static void secp256k1_ecdsa_recoverable_signature_save(secp256k1_ecdsa_recoverable_signature* sig, const secp256k1_scalar* r, const secp256k1_scalar* s, int recid) { - if (sizeof(secp256k1_scalar) == 32) { - memcpy(&sig->data[0], r, 32); - memcpy(&sig->data[32], s, 32); - } else { - secp256k1_scalar_get_b32(&sig->data[0], r); - secp256k1_scalar_get_b32(&sig->data[32], s); - } - sig->data[64] = recid; -} - -int secp256k1_ecdsa_recoverable_signature_parse_compact(const secp256k1_context* ctx, secp256k1_ecdsa_recoverable_signature* sig, const unsigned char *input64, int recid) { - secp256k1_scalar r, s; - int ret = 1; - int overflow = 0; - - (void)ctx; - ARG_CHECK(sig != NULL); - ARG_CHECK(input64 != NULL); - ARG_CHECK(recid >= 0 && recid <= 3); - - secp256k1_scalar_set_b32(&r, &input64[0], &overflow); - ret &= !overflow; - secp256k1_scalar_set_b32(&s, &input64[32], &overflow); - ret &= !overflow; - if (ret) { - secp256k1_ecdsa_recoverable_signature_save(sig, &r, &s, recid); - } else { - memset(sig, 0, sizeof(*sig)); - } - return ret; -} - -int secp256k1_ecdsa_recoverable_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, int *recid, const secp256k1_ecdsa_recoverable_signature* sig) { - secp256k1_scalar r, s; - - (void)ctx; - ARG_CHECK(output64 != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(recid != NULL); - - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, recid, sig); - secp256k1_scalar_get_b32(&output64[0], &r); - secp256k1_scalar_get_b32(&output64[32], &s); - return 1; -} - -int secp256k1_ecdsa_recoverable_signature_convert(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const secp256k1_ecdsa_recoverable_signature* sigin) { - secp256k1_scalar r, s; - int recid; - - (void)ctx; - ARG_CHECK(sig != NULL); - ARG_CHECK(sigin != NULL); - - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, &recid, sigin); - secp256k1_ecdsa_signature_save(sig, &r, &s); - return 1; -} - -static int secp256k1_ecdsa_sig_recover(const secp256k1_ecmult_context *ctx, const secp256k1_scalar *sigr, const secp256k1_scalar* sigs, secp256k1_ge *pubkey, const secp256k1_scalar *message, int recid) { - unsigned char brx[32]; - secp256k1_fe fx; - secp256k1_ge x; - secp256k1_gej xj; - secp256k1_scalar rn, u1, u2; - secp256k1_gej qj; - int r; - - if (secp256k1_scalar_is_zero(sigr) || secp256k1_scalar_is_zero(sigs)) { - return 0; - } - - secp256k1_scalar_get_b32(brx, sigr); - r = secp256k1_fe_set_b32(&fx, brx); - (void)r; - VERIFY_CHECK(r); /* brx comes from a scalar, so is less than the order; certainly less than p */ - if (recid & 2) { - if (secp256k1_fe_cmp_var(&fx, &secp256k1_ecdsa_const_p_minus_order) >= 0) { - return 0; - } - secp256k1_fe_add(&fx, &secp256k1_ecdsa_const_order_as_fe); - } - if (!secp256k1_ge_set_xo_var(&x, &fx, recid & 1)) { - return 0; - } - secp256k1_gej_set_ge(&xj, &x); - secp256k1_scalar_inverse_var(&rn, sigr); - secp256k1_scalar_mul(&u1, &rn, message); - secp256k1_scalar_negate(&u1, &u1); - secp256k1_scalar_mul(&u2, &rn, sigs); - secp256k1_ecmult(ctx, &qj, &xj, &u2, &u1); - secp256k1_ge_set_gej_var(pubkey, &qj); - return !secp256k1_gej_is_infinity(&qj); -} - -int secp256k1_ecdsa_sign_recoverable(const secp256k1_context* ctx, secp256k1_ecdsa_recoverable_signature *signature, const unsigned char *msg32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) { - secp256k1_scalar r, s; - secp256k1_scalar sec, non, msg; - int recid; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(signature != NULL); - ARG_CHECK(seckey != NULL); - if (noncefp == NULL) { - noncefp = secp256k1_nonce_function_default; - } - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - /* Fail if the secret key is invalid. */ - if (!overflow && !secp256k1_scalar_is_zero(&sec)) { - unsigned char nonce32[32]; - unsigned int count = 0; - secp256k1_scalar_set_b32(&msg, msg32, NULL); - while (1) { - ret = noncefp(nonce32, msg32, seckey, NULL, (void*)noncedata, count); - if (!ret) { - break; - } - secp256k1_scalar_set_b32(&non, nonce32, &overflow); - if (!secp256k1_scalar_is_zero(&non) && !overflow) { - if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, &recid)) { - break; - } - } - count++; - } - memset(nonce32, 0, 32); - secp256k1_scalar_clear(&msg); - secp256k1_scalar_clear(&non); - secp256k1_scalar_clear(&sec); - } - if (ret) { - secp256k1_ecdsa_recoverable_signature_save(signature, &r, &s, recid); - } else { - memset(signature, 0, sizeof(*signature)); - } - return ret; -} - -int secp256k1_ecdsa_recover(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const secp256k1_ecdsa_recoverable_signature *signature, const unsigned char *msg32) { - secp256k1_ge q; - secp256k1_scalar r, s; - secp256k1_scalar m; - int recid; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(signature != NULL); - ARG_CHECK(pubkey != NULL); - - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, &recid, signature); - VERIFY_CHECK(recid >= 0 && recid < 4); /* should have been caught in parse_compact */ - secp256k1_scalar_set_b32(&m, msg32, NULL); - if (secp256k1_ecdsa_sig_recover(&ctx->ecmult_ctx, &r, &s, &q, &m, recid)) { - secp256k1_pubkey_save(pubkey, &q); - return 1; - } else { - memset(pubkey, 0, sizeof(*pubkey)); - return 0; - } -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h deleted file mode 100644 index 765c7dd8..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/modules/recovery/tests_impl.h +++ /dev/null @@ -1,393 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_MODULE_RECOVERY_TESTS_ -#define _SECP256K1_MODULE_RECOVERY_TESTS_ - -static int recovery_test_nonce_function(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - (void) msg32; - (void) key32; - (void) algo16; - (void) data; - - /* On the first run, return 0 to force a second run */ - if (counter == 0) { - memset(nonce32, 0, 32); - return 1; - } - /* On the second run, return an overflow to force a third run */ - if (counter == 1) { - memset(nonce32, 0xff, 32); - return 1; - } - /* On the next run, return a valid nonce, but flip a coin as to whether or not to fail signing. */ - memset(nonce32, 1, 32); - return secp256k1_rand_bits(1); -} - -void test_ecdsa_recovery_api(void) { - /* Setup contexts that just count errors */ - secp256k1_context *none = secp256k1_context_create(SECP256K1_CONTEXT_NONE); - secp256k1_context *sign = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - secp256k1_context *vrfy = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); - secp256k1_context *both = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - secp256k1_pubkey pubkey; - secp256k1_pubkey recpubkey; - secp256k1_ecdsa_signature normal_sig; - secp256k1_ecdsa_recoverable_signature recsig; - unsigned char privkey[32] = { 1 }; - unsigned char message[32] = { 2 }; - int32_t ecount = 0; - int recid = 0; - unsigned char sig[74]; - unsigned char zero_privkey[32] = { 0 }; - unsigned char over_privkey[32] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - - secp256k1_context_set_error_callback(none, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_error_callback(sign, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_error_callback(vrfy, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_error_callback(both, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(none, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(sign, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(vrfy, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(both, counting_illegal_callback_fn, &ecount); - - /* Construct and verify corresponding public key. */ - CHECK(secp256k1_ec_seckey_verify(ctx, privkey) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, privkey) == 1); - - /* Check bad contexts and NULLs for signing */ - ecount = 0; - CHECK(secp256k1_ecdsa_sign_recoverable(none, &recsig, message, privkey, NULL, NULL) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(sign, &recsig, message, privkey, NULL, NULL) == 1); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(vrfy, &recsig, message, privkey, NULL, NULL) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, NULL, NULL) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_sign_recoverable(both, NULL, message, privkey, NULL, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, NULL, privkey, NULL, NULL) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, NULL, NULL, NULL) == 0); - CHECK(ecount == 5); - /* This will fail or succeed randomly, and in either case will not ARG_CHECK failure */ - secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, recovery_test_nonce_function, NULL); - CHECK(ecount == 5); - /* These will all fail, but not in ARG_CHECK way */ - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, zero_privkey, NULL, NULL) == 0); - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, over_privkey, NULL, NULL) == 0); - /* This one will succeed. */ - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, NULL, NULL) == 1); - CHECK(ecount == 5); - - /* Check signing with a goofy nonce function */ - - /* Check bad contexts and NULLs for recovery */ - ecount = 0; - CHECK(secp256k1_ecdsa_recover(none, &recpubkey, &recsig, message) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_recover(sign, &recpubkey, &recsig, message) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recover(vrfy, &recpubkey, &recsig, message) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recover(both, &recpubkey, &recsig, message) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recover(both, NULL, &recsig, message) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_recover(both, &recpubkey, NULL, message) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_recover(both, &recpubkey, &recsig, NULL) == 0); - CHECK(ecount == 5); - - /* Check NULLs for conversion */ - CHECK(secp256k1_ecdsa_sign(both, &normal_sig, message, privkey, NULL, NULL) == 1); - ecount = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_convert(both, NULL, &recsig) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(both, &normal_sig, NULL) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(both, &normal_sig, &recsig) == 1); - - /* Check NULLs for de/serialization */ - CHECK(secp256k1_ecdsa_sign_recoverable(both, &recsig, message, privkey, NULL, NULL) == 1); - ecount = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, NULL, &recid, &recsig) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, sig, NULL, &recsig) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, sig, &recid, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(both, sig, &recid, &recsig) == 1); - - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, NULL, sig, recid) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, NULL, recid) == 0); - CHECK(ecount == 5); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, sig, -1) == 0); - CHECK(ecount == 6); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, sig, 5) == 0); - CHECK(ecount == 7); - /* overflow in signature will fail but not affect ecount */ - memcpy(sig, over_privkey, 32); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(both, &recsig, sig, recid) == 0); - CHECK(ecount == 7); - - /* cleanup */ - secp256k1_context_destroy(none); - secp256k1_context_destroy(sign); - secp256k1_context_destroy(vrfy); - secp256k1_context_destroy(both); -} - -void test_ecdsa_recovery_end_to_end(void) { - unsigned char extra[32] = {0x00}; - unsigned char privkey[32]; - unsigned char message[32]; - secp256k1_ecdsa_signature signature[5]; - secp256k1_ecdsa_recoverable_signature rsignature[5]; - unsigned char sig[74]; - secp256k1_pubkey pubkey; - secp256k1_pubkey recpubkey; - int recid = 0; - - /* Generate a random key and message. */ - { - secp256k1_scalar msg, key; - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_scalar_get_b32(privkey, &key); - secp256k1_scalar_get_b32(message, &msg); - } - - /* Construct and verify corresponding public key. */ - CHECK(secp256k1_ec_seckey_verify(ctx, privkey) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, privkey) == 1); - - /* Serialize/parse compact and verify/recover. */ - extra[0] = 0; - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[0], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &signature[0], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[4], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[1], message, privkey, NULL, extra) == 1); - extra[31] = 1; - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[2], message, privkey, NULL, extra) == 1); - extra[31] = 0; - extra[0] = 1; - CHECK(secp256k1_ecdsa_sign_recoverable(ctx, &rsignature[3], message, privkey, NULL, extra) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx, sig, &recid, &rsignature[4]) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1); - CHECK(memcmp(&signature[4], &signature[0], 64) == 0); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 1); - memset(&rsignature[4], 0, sizeof(rsignature[4])); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 1); - /* Parse compact (with recovery id) and recover. */ - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &recpubkey, &rsignature[4], message) == 1); - CHECK(memcmp(&pubkey, &recpubkey, sizeof(pubkey)) == 0); - /* Serialize/destroy/parse signature and verify again. */ - CHECK(secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx, sig, &recid, &rsignature[4]) == 1); - sig[secp256k1_rand_bits(6)] += 1 + secp256k1_rand_int(255); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsignature[4], sig, recid) == 1); - CHECK(secp256k1_ecdsa_recoverable_signature_convert(ctx, &signature[4], &rsignature[4]) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[4], message, &pubkey) == 0); - /* Recover again */ - CHECK(secp256k1_ecdsa_recover(ctx, &recpubkey, &rsignature[4], message) == 0 || - memcmp(&pubkey, &recpubkey, sizeof(pubkey)) != 0); -} - -/* Tests several edge cases. */ -void test_ecdsa_recovery_edge_cases(void) { - const unsigned char msg32[32] = { - 'T', 'h', 'i', 's', ' ', 'i', 's', ' ', - 'a', ' ', 'v', 'e', 'r', 'y', ' ', 's', - 'e', 'c', 'r', 'e', 't', ' ', 'm', 'e', - 's', 's', 'a', 'g', 'e', '.', '.', '.' - }; - const unsigned char sig64[64] = { - /* Generated by signing the above message with nonce 'This is the nonce we will use...' - * and secret key 0 (which is not valid), resulting in recid 0. */ - 0x67, 0xCB, 0x28, 0x5F, 0x9C, 0xD1, 0x94, 0xE8, - 0x40, 0xD6, 0x29, 0x39, 0x7A, 0xF5, 0x56, 0x96, - 0x62, 0xFD, 0xE4, 0x46, 0x49, 0x99, 0x59, 0x63, - 0x17, 0x9A, 0x7D, 0xD1, 0x7B, 0xD2, 0x35, 0x32, - 0x4B, 0x1B, 0x7D, 0xF3, 0x4C, 0xE1, 0xF6, 0x8E, - 0x69, 0x4F, 0xF6, 0xF1, 0x1A, 0xC7, 0x51, 0xDD, - 0x7D, 0xD7, 0x3E, 0x38, 0x7E, 0xE4, 0xFC, 0x86, - 0x6E, 0x1B, 0xE8, 0xEC, 0xC7, 0xDD, 0x95, 0x57 - }; - secp256k1_pubkey pubkey; - /* signature (r,s) = (4,4), which can be recovered with all 4 recids. */ - const unsigned char sigb64[64] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - }; - secp256k1_pubkey pubkeyb; - secp256k1_ecdsa_recoverable_signature rsig; - secp256k1_ecdsa_signature sig; - int recid; - - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 0)); - CHECK(!secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 1)); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 2)); - CHECK(!secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sig64, 3)); - CHECK(!secp256k1_ecdsa_recover(ctx, &pubkey, &rsig, msg32)); - - for (recid = 0; recid < 4; recid++) { - int i; - int recid2; - /* (4,4) encoded in DER. */ - unsigned char sigbder[8] = {0x30, 0x06, 0x02, 0x01, 0x04, 0x02, 0x01, 0x04}; - unsigned char sigcder_zr[7] = {0x30, 0x05, 0x02, 0x00, 0x02, 0x01, 0x01}; - unsigned char sigcder_zs[7] = {0x30, 0x05, 0x02, 0x01, 0x01, 0x02, 0x00}; - unsigned char sigbderalt1[39] = { - 0x30, 0x25, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x04, - }; - unsigned char sigbderalt2[39] = { - 0x30, 0x25, 0x02, 0x01, 0x04, 0x02, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - }; - unsigned char sigbderalt3[40] = { - 0x30, 0x26, 0x02, 0x21, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x01, 0x04, - }; - unsigned char sigbderalt4[40] = { - 0x30, 0x26, 0x02, 0x01, 0x04, 0x02, 0x21, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, - }; - /* (order + r,4) encoded in DER. */ - unsigned char sigbderlong[40] = { - 0x30, 0x26, 0x02, 0x21, 0x00, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xBA, 0xAE, 0xDC, - 0xE6, 0xAF, 0x48, 0xA0, 0x3B, 0xBF, 0xD2, 0x5E, - 0x8C, 0xD0, 0x36, 0x41, 0x45, 0x02, 0x01, 0x04 - }; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigb64, recid) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyb, &rsig, msg32) == 1); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 1); - for (recid2 = 0; recid2 < 4; recid2++) { - secp256k1_pubkey pubkey2b; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigb64, recid2) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkey2b, &rsig, msg32) == 1); - /* Verifying with (order + r,4) should always fail. */ - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderlong, sizeof(sigbderlong)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - } - /* DER parsing tests. */ - /* Zero length r/s. */ - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder_zr, sizeof(sigcder_zr)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder_zs, sizeof(sigcder_zs)) == 0); - /* Leading zeros. */ - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt1, sizeof(sigbderalt1)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt2, sizeof(sigbderalt2)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt3, sizeof(sigbderalt3)) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt4, sizeof(sigbderalt4)) == 0); - sigbderalt3[4] = 1; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt3, sizeof(sigbderalt3)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - sigbderalt4[7] = 1; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbderalt4, sizeof(sigbderalt4)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - /* Damage signature. */ - sigbder[7]++; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - sigbder[7]--; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, 6) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder) - 1) == 0); - for(i = 0; i < 8; i++) { - int c; - unsigned char orig = sigbder[i]; - /*Try every single-byte change.*/ - for (c = 0; c < 256; c++) { - if (c == orig ) { - continue; - } - sigbder[i] = c; - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigbder, sizeof(sigbder)) == 0 || secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyb) == 0); - } - sigbder[i] = orig; - } - } - - /* Test r/s equal to zero */ - { - /* (1,1) encoded in DER. */ - unsigned char sigcder[8] = {0x30, 0x06, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01}; - unsigned char sigc64[64] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }; - secp256k1_pubkey pubkeyc; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigc64, 0) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyc, &rsig, msg32) == 1); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder, sizeof(sigcder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyc) == 1); - sigcder[4] = 0; - sigc64[31] = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigc64, 0) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyb, &rsig, msg32) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder, sizeof(sigcder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyc) == 0); - sigcder[4] = 1; - sigcder[7] = 0; - sigc64[31] = 1; - sigc64[63] = 0; - CHECK(secp256k1_ecdsa_recoverable_signature_parse_compact(ctx, &rsig, sigc64, 0) == 1); - CHECK(secp256k1_ecdsa_recover(ctx, &pubkeyb, &rsig, msg32) == 0); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, sigcder, sizeof(sigcder)) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg32, &pubkeyc) == 0); - } -} - -void run_recovery_tests(void) { - int i; - for (i = 0; i < count; i++) { - test_ecdsa_recovery_api(); - } - for (i = 0; i < 64*count; i++) { - test_ecdsa_recovery_end_to_end(); - } - test_ecdsa_recovery_edge_cases(); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h deleted file mode 100644 index eff84220..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num.h +++ /dev/null @@ -1,74 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_ -#define _SECP256K1_NUM_ - -#ifndef USE_NUM_NONE - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(USE_NUM_GMP) -#include "num_gmp.h" -#else -#error "Please select num implementation" -#endif - -/** Copy a number. */ -static void secp256k1_num_copy(secp256k1_num *r, const secp256k1_num *a); - -/** Convert a number's absolute value to a binary big-endian string. - * There must be enough place. */ -static void secp256k1_num_get_bin(unsigned char *r, unsigned int rlen, const secp256k1_num *a); - -/** Set a number to the value of a binary big-endian string. */ -static void secp256k1_num_set_bin(secp256k1_num *r, const unsigned char *a, unsigned int alen); - -/** Compute a modular inverse. The input must be less than the modulus. */ -static void secp256k1_num_mod_inverse(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *m); - -/** Compute the jacobi symbol (a|b). b must be positive and odd. */ -static int secp256k1_num_jacobi(const secp256k1_num *a, const secp256k1_num *b); - -/** Compare the absolute value of two numbers. */ -static int secp256k1_num_cmp(const secp256k1_num *a, const secp256k1_num *b); - -/** Test whether two number are equal (including sign). */ -static int secp256k1_num_eq(const secp256k1_num *a, const secp256k1_num *b); - -/** Add two (signed) numbers. */ -static void secp256k1_num_add(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b); - -/** Subtract two (signed) numbers. */ -static void secp256k1_num_sub(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b); - -/** Multiply two (signed) numbers. */ -static void secp256k1_num_mul(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b); - -/** Replace a number by its remainder modulo m. M's sign is ignored. The result is a number between 0 and m-1, - even if r was negative. */ -static void secp256k1_num_mod(secp256k1_num *r, const secp256k1_num *m); - -/** Right-shift the passed number by bits. */ -static void secp256k1_num_shift(secp256k1_num *r, int bits); - -/** Check whether a number is zero. */ -static int secp256k1_num_is_zero(const secp256k1_num *a); - -/** Check whether a number is one. */ -static int secp256k1_num_is_one(const secp256k1_num *a); - -/** Check whether a number is strictly negative. */ -static int secp256k1_num_is_neg(const secp256k1_num *a); - -/** Change a number's sign. */ -static void secp256k1_num_negate(secp256k1_num *r); - -#endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h deleted file mode 100644 index 7dd81308..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp.h +++ /dev/null @@ -1,20 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_REPR_ -#define _SECP256K1_NUM_REPR_ - -#include - -#define NUM_LIMBS ((256+GMP_NUMB_BITS-1)/GMP_NUMB_BITS) - -typedef struct { - mp_limb_t data[2*NUM_LIMBS]; - int neg; - int limbs; -} secp256k1_num; - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h deleted file mode 100644 index 3a46495e..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_gmp_impl.h +++ /dev/null @@ -1,288 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_REPR_IMPL_H_ -#define _SECP256K1_NUM_REPR_IMPL_H_ - -#include -#include -#include - -#include "util.h" -#include "num.h" - -#ifdef VERIFY -static void secp256k1_num_sanity(const secp256k1_num *a) { - VERIFY_CHECK(a->limbs == 1 || (a->limbs > 1 && a->data[a->limbs-1] != 0)); -} -#else -#define secp256k1_num_sanity(a) do { } while(0) -#endif - -static void secp256k1_num_copy(secp256k1_num *r, const secp256k1_num *a) { - *r = *a; -} - -static void secp256k1_num_get_bin(unsigned char *r, unsigned int rlen, const secp256k1_num *a) { - unsigned char tmp[65]; - int len = 0; - int shift = 0; - if (a->limbs>1 || a->data[0] != 0) { - len = mpn_get_str(tmp, 256, (mp_limb_t*)a->data, a->limbs); - } - while (shift < len && tmp[shift] == 0) shift++; - VERIFY_CHECK(len-shift <= (int)rlen); - memset(r, 0, rlen - len + shift); - if (len > shift) { - memcpy(r + rlen - len + shift, tmp + shift, len - shift); - } - memset(tmp, 0, sizeof(tmp)); -} - -static void secp256k1_num_set_bin(secp256k1_num *r, const unsigned char *a, unsigned int alen) { - int len; - VERIFY_CHECK(alen > 0); - VERIFY_CHECK(alen <= 64); - len = mpn_set_str(r->data, a, alen, 256); - if (len == 0) { - r->data[0] = 0; - len = 1; - } - VERIFY_CHECK(len <= NUM_LIMBS*2); - r->limbs = len; - r->neg = 0; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } -} - -static void secp256k1_num_add_abs(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - mp_limb_t c = mpn_add(r->data, a->data, a->limbs, b->data, b->limbs); - r->limbs = a->limbs; - if (c != 0) { - VERIFY_CHECK(r->limbs < 2*NUM_LIMBS); - r->data[r->limbs++] = c; - } -} - -static void secp256k1_num_sub_abs(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - mp_limb_t c = mpn_sub(r->data, a->data, a->limbs, b->data, b->limbs); - (void)c; - VERIFY_CHECK(c == 0); - r->limbs = a->limbs; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } -} - -static void secp256k1_num_mod(secp256k1_num *r, const secp256k1_num *m) { - secp256k1_num_sanity(r); - secp256k1_num_sanity(m); - - if (r->limbs >= m->limbs) { - mp_limb_t t[2*NUM_LIMBS]; - mpn_tdiv_qr(t, r->data, 0, r->data, r->limbs, m->data, m->limbs); - memset(t, 0, sizeof(t)); - r->limbs = m->limbs; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } - } - - if (r->neg && (r->limbs > 1 || r->data[0] != 0)) { - secp256k1_num_sub_abs(r, m, r); - r->neg = 0; - } -} - -static void secp256k1_num_mod_inverse(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *m) { - int i; - mp_limb_t g[NUM_LIMBS+1]; - mp_limb_t u[NUM_LIMBS+1]; - mp_limb_t v[NUM_LIMBS+1]; - mp_size_t sn; - mp_size_t gn; - secp256k1_num_sanity(a); - secp256k1_num_sanity(m); - - /** mpn_gcdext computes: (G,S) = gcdext(U,V), where - * * G = gcd(U,V) - * * G = U*S + V*T - * * U has equal or more limbs than V, and V has no padding - * If we set U to be (a padded version of) a, and V = m: - * G = a*S + m*T - * G = a*S mod m - * Assuming G=1: - * S = 1/a mod m - */ - VERIFY_CHECK(m->limbs <= NUM_LIMBS); - VERIFY_CHECK(m->data[m->limbs-1] != 0); - for (i = 0; i < m->limbs; i++) { - u[i] = (i < a->limbs) ? a->data[i] : 0; - v[i] = m->data[i]; - } - sn = NUM_LIMBS+1; - gn = mpn_gcdext(g, r->data, &sn, u, m->limbs, v, m->limbs); - (void)gn; - VERIFY_CHECK(gn == 1); - VERIFY_CHECK(g[0] == 1); - r->neg = a->neg ^ m->neg; - if (sn < 0) { - mpn_sub(r->data, m->data, m->limbs, r->data, -sn); - r->limbs = m->limbs; - while (r->limbs > 1 && r->data[r->limbs-1]==0) { - r->limbs--; - } - } else { - r->limbs = sn; - } - memset(g, 0, sizeof(g)); - memset(u, 0, sizeof(u)); - memset(v, 0, sizeof(v)); -} - -static int secp256k1_num_jacobi(const secp256k1_num *a, const secp256k1_num *b) { - int ret; - mpz_t ga, gb; - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - VERIFY_CHECK(!b->neg && (b->limbs > 0) && (b->data[0] & 1)); - - mpz_inits(ga, gb, NULL); - - mpz_import(gb, b->limbs, -1, sizeof(mp_limb_t), 0, 0, b->data); - mpz_import(ga, a->limbs, -1, sizeof(mp_limb_t), 0, 0, a->data); - if (a->neg) { - mpz_neg(ga, ga); - } - - ret = mpz_jacobi(ga, gb); - - mpz_clears(ga, gb, NULL); - - return ret; -} - -static int secp256k1_num_is_one(const secp256k1_num *a) { - return (a->limbs == 1 && a->data[0] == 1); -} - -static int secp256k1_num_is_zero(const secp256k1_num *a) { - return (a->limbs == 1 && a->data[0] == 0); -} - -static int secp256k1_num_is_neg(const secp256k1_num *a) { - return (a->limbs > 1 || a->data[0] != 0) && a->neg; -} - -static int secp256k1_num_cmp(const secp256k1_num *a, const secp256k1_num *b) { - if (a->limbs > b->limbs) { - return 1; - } - if (a->limbs < b->limbs) { - return -1; - } - return mpn_cmp(a->data, b->data, a->limbs); -} - -static int secp256k1_num_eq(const secp256k1_num *a, const secp256k1_num *b) { - if (a->limbs > b->limbs) { - return 0; - } - if (a->limbs < b->limbs) { - return 0; - } - if ((a->neg && !secp256k1_num_is_zero(a)) != (b->neg && !secp256k1_num_is_zero(b))) { - return 0; - } - return mpn_cmp(a->data, b->data, a->limbs) == 0; -} - -static void secp256k1_num_subadd(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b, int bneg) { - if (!(b->neg ^ bneg ^ a->neg)) { /* a and b have the same sign */ - r->neg = a->neg; - if (a->limbs >= b->limbs) { - secp256k1_num_add_abs(r, a, b); - } else { - secp256k1_num_add_abs(r, b, a); - } - } else { - if (secp256k1_num_cmp(a, b) > 0) { - r->neg = a->neg; - secp256k1_num_sub_abs(r, a, b); - } else { - r->neg = b->neg ^ bneg; - secp256k1_num_sub_abs(r, b, a); - } - } -} - -static void secp256k1_num_add(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - secp256k1_num_subadd(r, a, b, 0); -} - -static void secp256k1_num_sub(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - secp256k1_num_subadd(r, a, b, 1); -} - -static void secp256k1_num_mul(secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b) { - mp_limb_t tmp[2*NUM_LIMBS+1]; - secp256k1_num_sanity(a); - secp256k1_num_sanity(b); - - VERIFY_CHECK(a->limbs + b->limbs <= 2*NUM_LIMBS+1); - if ((a->limbs==1 && a->data[0]==0) || (b->limbs==1 && b->data[0]==0)) { - r->limbs = 1; - r->neg = 0; - r->data[0] = 0; - return; - } - if (a->limbs >= b->limbs) { - mpn_mul(tmp, a->data, a->limbs, b->data, b->limbs); - } else { - mpn_mul(tmp, b->data, b->limbs, a->data, a->limbs); - } - r->limbs = a->limbs + b->limbs; - if (r->limbs > 1 && tmp[r->limbs - 1]==0) { - r->limbs--; - } - VERIFY_CHECK(r->limbs <= 2*NUM_LIMBS); - mpn_copyi(r->data, tmp, r->limbs); - r->neg = a->neg ^ b->neg; - memset(tmp, 0, sizeof(tmp)); -} - -static void secp256k1_num_shift(secp256k1_num *r, int bits) { - if (bits % GMP_NUMB_BITS) { - /* Shift within limbs. */ - mpn_rshift(r->data, r->data, r->limbs, bits % GMP_NUMB_BITS); - } - if (bits >= GMP_NUMB_BITS) { - int i; - /* Shift full limbs. */ - for (i = 0; i < r->limbs; i++) { - int index = i + (bits / GMP_NUMB_BITS); - if (index < r->limbs && index < 2*NUM_LIMBS) { - r->data[i] = r->data[index]; - } else { - r->data[i] = 0; - } - } - } - while (r->limbs>1 && r->data[r->limbs-1]==0) { - r->limbs--; - } -} - -static void secp256k1_num_negate(secp256k1_num *r) { - r->neg ^= 1; -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h deleted file mode 100644 index 0b0e3a07..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/num_impl.h +++ /dev/null @@ -1,24 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_NUM_IMPL_H_ -#define _SECP256K1_NUM_IMPL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include "num.h" - -#if defined(USE_NUM_GMP) -#include "num_gmp_impl.h" -#elif defined(USE_NUM_NONE) -/* Nothing. */ -#else -#error "Please select num implementation" -#endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h deleted file mode 100644 index 27e9d837..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar.h +++ /dev/null @@ -1,106 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_ -#define _SECP256K1_SCALAR_ - -#include "num.h" - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(EXHAUSTIVE_TEST_ORDER) -#include "scalar_low.h" -#elif defined(USE_SCALAR_4X64) -#include "scalar_4x64.h" -#elif defined(USE_SCALAR_8X32) -#include "scalar_8x32.h" -#else -#error "Please select scalar implementation" -#endif - -/** Clear a scalar to prevent the leak of sensitive data. */ -static void secp256k1_scalar_clear(secp256k1_scalar *r); - -/** Access bits from a scalar. All requested bits must belong to the same 32-bit limb. */ -static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count); - -/** Access bits from a scalar. Not constant time. */ -static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count); - -/** Set a scalar from a big endian byte array. */ -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow); - -/** Set a scalar to an unsigned integer. */ -static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v); - -/** Convert a scalar to a byte array. */ -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a); - -/** Add two scalars together (modulo the group order). Returns whether it overflowed. */ -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b); - -/** Conditionally add a power of two to a scalar. The result is not allowed to overflow. */ -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag); - -/** Multiply two scalars (modulo the group order). */ -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b); - -/** Shift a scalar right by some amount strictly between 0 and 16, returning - * the low bits that were shifted off */ -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n); - -/** Compute the square of a scalar (modulo the group order). */ -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Compute the inverse of a scalar (modulo the group order). */ -static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Compute the inverse of a scalar (modulo the group order), without constant-time guarantee. */ -static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Compute the complement of a scalar (modulo the group order). */ -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a); - -/** Check whether a scalar equals zero. */ -static int secp256k1_scalar_is_zero(const secp256k1_scalar *a); - -/** Check whether a scalar equals one. */ -static int secp256k1_scalar_is_one(const secp256k1_scalar *a); - -/** Check whether a scalar, considered as an nonnegative integer, is even. */ -static int secp256k1_scalar_is_even(const secp256k1_scalar *a); - -/** Check whether a scalar is higher than the group order divided by 2. */ -static int secp256k1_scalar_is_high(const secp256k1_scalar *a); - -/** Conditionally negate a number, in constant time. - * Returns -1 if the number was negated, 1 otherwise */ -static int secp256k1_scalar_cond_negate(secp256k1_scalar *a, int flag); - -#ifndef USE_NUM_NONE -/** Convert a scalar to a number. */ -static void secp256k1_scalar_get_num(secp256k1_num *r, const secp256k1_scalar *a); - -/** Get the order of the group as a number. */ -static void secp256k1_scalar_order_get_num(secp256k1_num *r); -#endif - -/** Compare two scalars. */ -static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b); - -#ifdef USE_ENDOMORPHISM -/** Find r1 and r2 such that r1+r2*2^128 = a. */ -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a); -/** Find r1 and r2 such that r1+r2*lambda = a, and r1 and r2 are maximum 128 bits long (see secp256k1_gej_mul_lambda). */ -static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a); -#endif - -/** Multiply a and b (without taking the modulus!), divide by 2**shift, and round to the nearest integer. Shift must be at least 256. */ -static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h deleted file mode 100644 index cff40603..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64.h +++ /dev/null @@ -1,19 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_ -#define _SECP256K1_SCALAR_REPR_ - -#include - -/** A scalar modulo the group order of the secp256k1 curve. */ -typedef struct { - uint64_t d[4]; -} secp256k1_scalar; - -#define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{((uint64_t)(d1)) << 32 | (d0), ((uint64_t)(d3)) << 32 | (d2), ((uint64_t)(d5)) << 32 | (d4), ((uint64_t)(d7)) << 32 | (d6)}} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h deleted file mode 100644 index 56e7bd82..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_4x64_impl.h +++ /dev/null @@ -1,949 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_IMPL_H_ -#define _SECP256K1_SCALAR_REPR_IMPL_H_ - -/* Limbs of the secp256k1 order. */ -#define SECP256K1_N_0 ((uint64_t)0xBFD25E8CD0364141ULL) -#define SECP256K1_N_1 ((uint64_t)0xBAAEDCE6AF48A03BULL) -#define SECP256K1_N_2 ((uint64_t)0xFFFFFFFFFFFFFFFEULL) -#define SECP256K1_N_3 ((uint64_t)0xFFFFFFFFFFFFFFFFULL) - -/* Limbs of 2^256 minus the secp256k1 order. */ -#define SECP256K1_N_C_0 (~SECP256K1_N_0 + 1) -#define SECP256K1_N_C_1 (~SECP256K1_N_1) -#define SECP256K1_N_C_2 (1) - -/* Limbs of half the secp256k1 order. */ -#define SECP256K1_N_H_0 ((uint64_t)0xDFE92F46681B20A0ULL) -#define SECP256K1_N_H_1 ((uint64_t)0x5D576E7357A4501DULL) -#define SECP256K1_N_H_2 ((uint64_t)0xFFFFFFFFFFFFFFFFULL) -#define SECP256K1_N_H_3 ((uint64_t)0x7FFFFFFFFFFFFFFFULL) - -SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) { - r->d[0] = 0; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) { - r->d[0] = v; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK((offset + count - 1) >> 6 == offset >> 6); - return (a->d[offset >> 6] >> (offset & 0x3F)) & ((((uint64_t)1) << count) - 1); -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK(count < 32); - VERIFY_CHECK(offset + count <= 256); - if ((offset + count - 1) >> 6 == offset >> 6) { - return secp256k1_scalar_get_bits(a, offset, count); - } else { - VERIFY_CHECK((offset >> 6) + 1 < 4); - return ((a->d[offset >> 6] >> (offset & 0x3F)) | (a->d[(offset >> 6) + 1] << (64 - (offset & 0x3F)))) & ((((uint64_t)1) << count) - 1); - } -} - -SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[3] < SECP256K1_N_3); /* No need for a > check. */ - no |= (a->d[2] < SECP256K1_N_2); - yes |= (a->d[2] > SECP256K1_N_2) & ~no; - no |= (a->d[1] < SECP256K1_N_1); - yes |= (a->d[1] > SECP256K1_N_1) & ~no; - yes |= (a->d[0] >= SECP256K1_N_0) & ~no; - return yes; -} - -SECP256K1_INLINE static int secp256k1_scalar_reduce(secp256k1_scalar *r, unsigned int overflow) { - uint128_t t; - VERIFY_CHECK(overflow <= 1); - t = (uint128_t)r->d[0] + overflow * SECP256K1_N_C_0; - r->d[0] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[1] + overflow * SECP256K1_N_C_1; - r->d[1] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[2] + overflow * SECP256K1_N_C_2; - r->d[2] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint64_t)r->d[3]; - r->d[3] = t & 0xFFFFFFFFFFFFFFFFULL; - return overflow; -} - -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - int overflow; - uint128_t t = (uint128_t)a->d[0] + b->d[0]; - r->d[0] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)a->d[1] + b->d[1]; - r->d[1] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)a->d[2] + b->d[2]; - r->d[2] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)a->d[3] + b->d[3]; - r->d[3] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - overflow = t + secp256k1_scalar_check_overflow(r); - VERIFY_CHECK(overflow == 0 || overflow == 1); - secp256k1_scalar_reduce(r, overflow); - return overflow; -} - -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) { - uint128_t t; - VERIFY_CHECK(bit < 256); - bit += ((uint32_t) flag - 1) & 0x100; /* forcing (bit >> 6) > 3 makes this a noop */ - t = (uint128_t)r->d[0] + (((uint64_t)((bit >> 6) == 0)) << (bit & 0x3F)); - r->d[0] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[1] + (((uint64_t)((bit >> 6) == 1)) << (bit & 0x3F)); - r->d[1] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[2] + (((uint64_t)((bit >> 6) == 2)) << (bit & 0x3F)); - r->d[2] = t & 0xFFFFFFFFFFFFFFFFULL; t >>= 64; - t += (uint128_t)r->d[3] + (((uint64_t)((bit >> 6) == 3)) << (bit & 0x3F)); - r->d[3] = t & 0xFFFFFFFFFFFFFFFFULL; -#ifdef VERIFY - VERIFY_CHECK((t >> 64) == 0); - VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0); -#endif -} - -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) { - int over; - r->d[0] = (uint64_t)b32[31] | (uint64_t)b32[30] << 8 | (uint64_t)b32[29] << 16 | (uint64_t)b32[28] << 24 | (uint64_t)b32[27] << 32 | (uint64_t)b32[26] << 40 | (uint64_t)b32[25] << 48 | (uint64_t)b32[24] << 56; - r->d[1] = (uint64_t)b32[23] | (uint64_t)b32[22] << 8 | (uint64_t)b32[21] << 16 | (uint64_t)b32[20] << 24 | (uint64_t)b32[19] << 32 | (uint64_t)b32[18] << 40 | (uint64_t)b32[17] << 48 | (uint64_t)b32[16] << 56; - r->d[2] = (uint64_t)b32[15] | (uint64_t)b32[14] << 8 | (uint64_t)b32[13] << 16 | (uint64_t)b32[12] << 24 | (uint64_t)b32[11] << 32 | (uint64_t)b32[10] << 40 | (uint64_t)b32[9] << 48 | (uint64_t)b32[8] << 56; - r->d[3] = (uint64_t)b32[7] | (uint64_t)b32[6] << 8 | (uint64_t)b32[5] << 16 | (uint64_t)b32[4] << 24 | (uint64_t)b32[3] << 32 | (uint64_t)b32[2] << 40 | (uint64_t)b32[1] << 48 | (uint64_t)b32[0] << 56; - over = secp256k1_scalar_reduce(r, secp256k1_scalar_check_overflow(r)); - if (overflow) { - *overflow = over; - } -} - -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) { - bin[0] = a->d[3] >> 56; bin[1] = a->d[3] >> 48; bin[2] = a->d[3] >> 40; bin[3] = a->d[3] >> 32; bin[4] = a->d[3] >> 24; bin[5] = a->d[3] >> 16; bin[6] = a->d[3] >> 8; bin[7] = a->d[3]; - bin[8] = a->d[2] >> 56; bin[9] = a->d[2] >> 48; bin[10] = a->d[2] >> 40; bin[11] = a->d[2] >> 32; bin[12] = a->d[2] >> 24; bin[13] = a->d[2] >> 16; bin[14] = a->d[2] >> 8; bin[15] = a->d[2]; - bin[16] = a->d[1] >> 56; bin[17] = a->d[1] >> 48; bin[18] = a->d[1] >> 40; bin[19] = a->d[1] >> 32; bin[20] = a->d[1] >> 24; bin[21] = a->d[1] >> 16; bin[22] = a->d[1] >> 8; bin[23] = a->d[1]; - bin[24] = a->d[0] >> 56; bin[25] = a->d[0] >> 48; bin[26] = a->d[0] >> 40; bin[27] = a->d[0] >> 32; bin[28] = a->d[0] >> 24; bin[29] = a->d[0] >> 16; bin[30] = a->d[0] >> 8; bin[31] = a->d[0]; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) { - return (a->d[0] | a->d[1] | a->d[2] | a->d[3]) == 0; -} - -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint64_t nonzero = 0xFFFFFFFFFFFFFFFFULL * (secp256k1_scalar_is_zero(a) == 0); - uint128_t t = (uint128_t)(~a->d[0]) + SECP256K1_N_0 + 1; - r->d[0] = t & nonzero; t >>= 64; - t += (uint128_t)(~a->d[1]) + SECP256K1_N_1; - r->d[1] = t & nonzero; t >>= 64; - t += (uint128_t)(~a->d[2]) + SECP256K1_N_2; - r->d[2] = t & nonzero; t >>= 64; - t += (uint128_t)(~a->d[3]) + SECP256K1_N_3; - r->d[3] = t & nonzero; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) { - return ((a->d[0] ^ 1) | a->d[1] | a->d[2] | a->d[3]) == 0; -} - -static int secp256k1_scalar_is_high(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[3] < SECP256K1_N_H_3); - yes |= (a->d[3] > SECP256K1_N_H_3) & ~no; - no |= (a->d[2] < SECP256K1_N_H_2) & ~yes; /* No need for a > check. */ - no |= (a->d[1] < SECP256K1_N_H_1) & ~yes; - yes |= (a->d[1] > SECP256K1_N_H_1) & ~no; - yes |= (a->d[0] > SECP256K1_N_H_0) & ~no; - return yes; -} - -static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) { - /* If we are flag = 0, mask = 00...00 and this is a no-op; - * if we are flag = 1, mask = 11...11 and this is identical to secp256k1_scalar_negate */ - uint64_t mask = !flag - 1; - uint64_t nonzero = (secp256k1_scalar_is_zero(r) != 0) - 1; - uint128_t t = (uint128_t)(r->d[0] ^ mask) + ((SECP256K1_N_0 + 1) & mask); - r->d[0] = t & nonzero; t >>= 64; - t += (uint128_t)(r->d[1] ^ mask) + (SECP256K1_N_1 & mask); - r->d[1] = t & nonzero; t >>= 64; - t += (uint128_t)(r->d[2] ^ mask) + (SECP256K1_N_2 & mask); - r->d[2] = t & nonzero; t >>= 64; - t += (uint128_t)(r->d[3] ^ mask) + (SECP256K1_N_3 & mask); - r->d[3] = t & nonzero; - return 2 * (mask == 0) - 1; -} - -/* Inspired by the macros in OpenSSL's crypto/bn/asm/x86_64-gcc.c. */ - -/** Add a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd(a,b) { \ - uint64_t tl, th; \ - { \ - uint128_t t = (uint128_t)a * b; \ - th = t >> 64; /* at most 0xFFFFFFFFFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFFFFFFFFFF */ \ - c1 += th; /* overflow is handled on the next line */ \ - c2 += (c1 < th) ? 1 : 0; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK((c1 >= th) || (c2 != 0)); \ -} - -/** Add a*b to the number defined by (c0,c1). c1 must never overflow. */ -#define muladd_fast(a,b) { \ - uint64_t tl, th; \ - { \ - uint128_t t = (uint128_t)a * b; \ - th = t >> 64; /* at most 0xFFFFFFFFFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFFFFFFFFFF */ \ - c1 += th; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK(c1 >= th); \ -} - -/** Add 2*a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd2(a,b) { \ - uint64_t tl, th, th2, tl2; \ - { \ - uint128_t t = (uint128_t)a * b; \ - th = t >> 64; /* at most 0xFFFFFFFFFFFFFFFE */ \ - tl = t; \ - } \ - th2 = th + th; /* at most 0xFFFFFFFFFFFFFFFE (in case th was 0x7FFFFFFFFFFFFFFF) */ \ - c2 += (th2 < th) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((th2 >= th) || (c2 != 0)); \ - tl2 = tl + tl; /* at most 0xFFFFFFFFFFFFFFFE (in case the lowest 63 bits of tl were 0x7FFFFFFFFFFFFFFF) */ \ - th2 += (tl2 < tl) ? 1 : 0; /* at most 0xFFFFFFFFFFFFFFFF */ \ - c0 += tl2; /* overflow is handled on the next line */ \ - th2 += (c0 < tl2) ? 1 : 0; /* second overflow is handled on the next line */ \ - c2 += (c0 < tl2) & (th2 == 0); /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c0 >= tl2) || (th2 != 0) || (c2 != 0)); \ - c1 += th2; /* overflow is handled on the next line */ \ - c2 += (c1 < th2) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 >= th2) || (c2 != 0)); \ -} - -/** Add a to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define sumadd(a) { \ - unsigned int over; \ - c0 += (a); /* overflow is handled on the next line */ \ - over = (c0 < (a)) ? 1 : 0; \ - c1 += over; /* overflow is handled on the next line */ \ - c2 += (c1 < over) ? 1 : 0; /* never overflows by contract */ \ -} - -/** Add a to the number defined by (c0,c1). c1 must never overflow, c2 must be zero. */ -#define sumadd_fast(a) { \ - c0 += (a); /* overflow is handled on the next line */ \ - c1 += (c0 < (a)) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \ - VERIFY_CHECK(c2 == 0); \ -} - -/** Extract the lowest 64 bits of (c0,c1,c2) into n, and left shift the number 64 bits. */ -#define extract(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = c2; \ - c2 = 0; \ -} - -/** Extract the lowest 64 bits of (c0,c1,c2) into n, and left shift the number 64 bits. c2 is required to be zero. */ -#define extract_fast(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = 0; \ - VERIFY_CHECK(c2 == 0); \ -} - -static void secp256k1_scalar_reduce_512(secp256k1_scalar *r, const uint64_t *l) { -#ifdef USE_ASM_X86_64 - /* Reduce 512 bits into 385. */ - uint64_t m0, m1, m2, m3, m4, m5, m6; - uint64_t p0, p1, p2, p3, p4; - uint64_t c; - - __asm__ __volatile__( - /* Preload. */ - "movq 32(%%rsi), %%r11\n" - "movq 40(%%rsi), %%r12\n" - "movq 48(%%rsi), %%r13\n" - "movq 56(%%rsi), %%r14\n" - /* Initialize r8,r9,r10 */ - "movq 0(%%rsi), %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9) += n0 * c0 */ - "movq %8, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* extract m0 */ - "movq %%r8, %q0\n" - "xorq %%r8, %%r8\n" - /* (r9,r10) += l1 */ - "addq 8(%%rsi), %%r9\n" - "adcq $0, %%r10\n" - /* (r9,r10,r8) += n1 * c0 */ - "movq %8, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += n0 * c1 */ - "movq %9, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* extract m1 */ - "movq %%r9, %q1\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += l2 */ - "addq 16(%%rsi), %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += n2 * c0 */ - "movq %8, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += n1 * c1 */ - "movq %9, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += n0 */ - "addq %%r11, %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* extract m2 */ - "movq %%r10, %q2\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += l3 */ - "addq 24(%%rsi), %%r8\n" - "adcq $0, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += n3 * c0 */ - "movq %8, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += n2 * c1 */ - "movq %9, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += n1 */ - "addq %%r12, %%r8\n" - "adcq $0, %%r9\n" - "adcq $0, %%r10\n" - /* extract m3 */ - "movq %%r8, %q3\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += n3 * c1 */ - "movq %9, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += n2 */ - "addq %%r13, %%r9\n" - "adcq $0, %%r10\n" - "adcq $0, %%r8\n" - /* extract m4 */ - "movq %%r9, %q4\n" - /* (r10,r8) += n3 */ - "addq %%r14, %%r10\n" - "adcq $0, %%r8\n" - /* extract m5 */ - "movq %%r10, %q5\n" - /* extract m6 */ - "movq %%r8, %q6\n" - : "=g"(m0), "=g"(m1), "=g"(m2), "=g"(m3), "=g"(m4), "=g"(m5), "=g"(m6) - : "S"(l), "n"(SECP256K1_N_C_0), "n"(SECP256K1_N_C_1) - : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "cc"); - - /* Reduce 385 bits into 258. */ - __asm__ __volatile__( - /* Preload */ - "movq %q9, %%r11\n" - "movq %q10, %%r12\n" - "movq %q11, %%r13\n" - /* Initialize (r8,r9,r10) */ - "movq %q5, %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9) += m4 * c0 */ - "movq %12, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* extract p0 */ - "movq %%r8, %q0\n" - "xorq %%r8, %%r8\n" - /* (r9,r10) += m1 */ - "addq %q6, %%r9\n" - "adcq $0, %%r10\n" - /* (r9,r10,r8) += m5 * c0 */ - "movq %12, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += m4 * c1 */ - "movq %13, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* extract p1 */ - "movq %%r9, %q1\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += m2 */ - "addq %q7, %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += m6 * c0 */ - "movq %12, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += m5 * c1 */ - "movq %13, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += m4 */ - "addq %%r11, %%r10\n" - "adcq $0, %%r8\n" - "adcq $0, %%r9\n" - /* extract p2 */ - "movq %%r10, %q2\n" - /* (r8,r9) += m3 */ - "addq %q8, %%r8\n" - "adcq $0, %%r9\n" - /* (r8,r9) += m6 * c1 */ - "movq %13, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* (r8,r9) += m5 */ - "addq %%r12, %%r8\n" - "adcq $0, %%r9\n" - /* extract p3 */ - "movq %%r8, %q3\n" - /* (r9) += m6 */ - "addq %%r13, %%r9\n" - /* extract p4 */ - "movq %%r9, %q4\n" - : "=&g"(p0), "=&g"(p1), "=&g"(p2), "=g"(p3), "=g"(p4) - : "g"(m0), "g"(m1), "g"(m2), "g"(m3), "g"(m4), "g"(m5), "g"(m6), "n"(SECP256K1_N_C_0), "n"(SECP256K1_N_C_1) - : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "cc"); - - /* Reduce 258 bits into 256. */ - __asm__ __volatile__( - /* Preload */ - "movq %q5, %%r10\n" - /* (rax,rdx) = p4 * c0 */ - "movq %7, %%rax\n" - "mulq %%r10\n" - /* (rax,rdx) += p0 */ - "addq %q1, %%rax\n" - "adcq $0, %%rdx\n" - /* extract r0 */ - "movq %%rax, 0(%q6)\n" - /* Move to (r8,r9) */ - "movq %%rdx, %%r8\n" - "xorq %%r9, %%r9\n" - /* (r8,r9) += p1 */ - "addq %q2, %%r8\n" - "adcq $0, %%r9\n" - /* (r8,r9) += p4 * c1 */ - "movq %8, %%rax\n" - "mulq %%r10\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - /* Extract r1 */ - "movq %%r8, 8(%q6)\n" - "xorq %%r8, %%r8\n" - /* (r9,r8) += p4 */ - "addq %%r10, %%r9\n" - "adcq $0, %%r8\n" - /* (r9,r8) += p2 */ - "addq %q3, %%r9\n" - "adcq $0, %%r8\n" - /* Extract r2 */ - "movq %%r9, 16(%q6)\n" - "xorq %%r9, %%r9\n" - /* (r8,r9) += p3 */ - "addq %q4, %%r8\n" - "adcq $0, %%r9\n" - /* Extract r3 */ - "movq %%r8, 24(%q6)\n" - /* Extract c */ - "movq %%r9, %q0\n" - : "=g"(c) - : "g"(p0), "g"(p1), "g"(p2), "g"(p3), "g"(p4), "D"(r), "n"(SECP256K1_N_C_0), "n"(SECP256K1_N_C_1) - : "rax", "rdx", "r8", "r9", "r10", "cc", "memory"); -#else - uint128_t c; - uint64_t c0, c1, c2; - uint64_t n0 = l[4], n1 = l[5], n2 = l[6], n3 = l[7]; - uint64_t m0, m1, m2, m3, m4, m5; - uint32_t m6; - uint64_t p0, p1, p2, p3; - uint32_t p4; - - /* Reduce 512 bits into 385. */ - /* m[0..6] = l[0..3] + n[0..3] * SECP256K1_N_C. */ - c0 = l[0]; c1 = 0; c2 = 0; - muladd_fast(n0, SECP256K1_N_C_0); - extract_fast(m0); - sumadd_fast(l[1]); - muladd(n1, SECP256K1_N_C_0); - muladd(n0, SECP256K1_N_C_1); - extract(m1); - sumadd(l[2]); - muladd(n2, SECP256K1_N_C_0); - muladd(n1, SECP256K1_N_C_1); - sumadd(n0); - extract(m2); - sumadd(l[3]); - muladd(n3, SECP256K1_N_C_0); - muladd(n2, SECP256K1_N_C_1); - sumadd(n1); - extract(m3); - muladd(n3, SECP256K1_N_C_1); - sumadd(n2); - extract(m4); - sumadd_fast(n3); - extract_fast(m5); - VERIFY_CHECK(c0 <= 1); - m6 = c0; - - /* Reduce 385 bits into 258. */ - /* p[0..4] = m[0..3] + m[4..6] * SECP256K1_N_C. */ - c0 = m0; c1 = 0; c2 = 0; - muladd_fast(m4, SECP256K1_N_C_0); - extract_fast(p0); - sumadd_fast(m1); - muladd(m5, SECP256K1_N_C_0); - muladd(m4, SECP256K1_N_C_1); - extract(p1); - sumadd(m2); - muladd(m6, SECP256K1_N_C_0); - muladd(m5, SECP256K1_N_C_1); - sumadd(m4); - extract(p2); - sumadd_fast(m3); - muladd_fast(m6, SECP256K1_N_C_1); - sumadd_fast(m5); - extract_fast(p3); - p4 = c0 + m6; - VERIFY_CHECK(p4 <= 2); - - /* Reduce 258 bits into 256. */ - /* r[0..3] = p[0..3] + p[4] * SECP256K1_N_C. */ - c = p0 + (uint128_t)SECP256K1_N_C_0 * p4; - r->d[0] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; - c += p1 + (uint128_t)SECP256K1_N_C_1 * p4; - r->d[1] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; - c += p2 + (uint128_t)p4; - r->d[2] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; - c += p3; - r->d[3] = c & 0xFFFFFFFFFFFFFFFFULL; c >>= 64; -#endif - - /* Final reduction of r. */ - secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r)); -} - -static void secp256k1_scalar_mul_512(uint64_t l[8], const secp256k1_scalar *a, const secp256k1_scalar *b) { -#ifdef USE_ASM_X86_64 - const uint64_t *pb = b->d; - __asm__ __volatile__( - /* Preload */ - "movq 0(%%rdi), %%r15\n" - "movq 8(%%rdi), %%rbx\n" - "movq 16(%%rdi), %%rcx\n" - "movq 0(%%rdx), %%r11\n" - "movq 8(%%rdx), %%r12\n" - "movq 16(%%rdx), %%r13\n" - "movq 24(%%rdx), %%r14\n" - /* (rax,rdx) = a0 * b0 */ - "movq %%r15, %%rax\n" - "mulq %%r11\n" - /* Extract l0 */ - "movq %%rax, 0(%%rsi)\n" - /* (r8,r9,r10) = (rdx) */ - "movq %%rdx, %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += a0 * b1 */ - "movq %%r15, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a1 * b0 */ - "movq %%rbx, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l1 */ - "movq %%r8, 8(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += a0 * b2 */ - "movq %%r15, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a1 * b1 */ - "movq %%rbx, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a2 * b0 */ - "movq %%rcx, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l2 */ - "movq %%r9, 16(%%rsi)\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += a0 * b3 */ - "movq %%r15, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* Preload a3 */ - "movq 24(%%rdi), %%r15\n" - /* (r10,r8,r9) += a1 * b2 */ - "movq %%rbx, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += a2 * b1 */ - "movq %%rcx, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += a3 * b0 */ - "movq %%r15, %%rax\n" - "mulq %%r11\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* Extract l3 */ - "movq %%r10, 24(%%rsi)\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += a1 * b3 */ - "movq %%rbx, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a2 * b2 */ - "movq %%rcx, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a3 * b1 */ - "movq %%r15, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l4 */ - "movq %%r8, 32(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += a2 * b3 */ - "movq %%rcx, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a3 * b2 */ - "movq %%r15, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l5 */ - "movq %%r9, 40(%%rsi)\n" - /* (r10,r8) += a3 * b3 */ - "movq %%r15, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - /* Extract l6 */ - "movq %%r10, 48(%%rsi)\n" - /* Extract l7 */ - "movq %%r8, 56(%%rsi)\n" - : "+d"(pb) - : "S"(l), "D"(a->d) - : "rax", "rbx", "rcx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "cc", "memory"); -#else - /* 160 bit accumulator. */ - uint64_t c0 = 0, c1 = 0; - uint32_t c2 = 0; - - /* l[0..7] = a[0..3] * b[0..3]. */ - muladd_fast(a->d[0], b->d[0]); - extract_fast(l[0]); - muladd(a->d[0], b->d[1]); - muladd(a->d[1], b->d[0]); - extract(l[1]); - muladd(a->d[0], b->d[2]); - muladd(a->d[1], b->d[1]); - muladd(a->d[2], b->d[0]); - extract(l[2]); - muladd(a->d[0], b->d[3]); - muladd(a->d[1], b->d[2]); - muladd(a->d[2], b->d[1]); - muladd(a->d[3], b->d[0]); - extract(l[3]); - muladd(a->d[1], b->d[3]); - muladd(a->d[2], b->d[2]); - muladd(a->d[3], b->d[1]); - extract(l[4]); - muladd(a->d[2], b->d[3]); - muladd(a->d[3], b->d[2]); - extract(l[5]); - muladd_fast(a->d[3], b->d[3]); - extract_fast(l[6]); - VERIFY_CHECK(c1 == 0); - l[7] = c0; -#endif -} - -static void secp256k1_scalar_sqr_512(uint64_t l[8], const secp256k1_scalar *a) { -#ifdef USE_ASM_X86_64 - __asm__ __volatile__( - /* Preload */ - "movq 0(%%rdi), %%r11\n" - "movq 8(%%rdi), %%r12\n" - "movq 16(%%rdi), %%r13\n" - "movq 24(%%rdi), %%r14\n" - /* (rax,rdx) = a0 * a0 */ - "movq %%r11, %%rax\n" - "mulq %%r11\n" - /* Extract l0 */ - "movq %%rax, 0(%%rsi)\n" - /* (r8,r9,r10) = (rdx,0) */ - "movq %%rdx, %%r8\n" - "xorq %%r9, %%r9\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += 2 * a0 * a1 */ - "movq %%r11, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l1 */ - "movq %%r8, 8(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += 2 * a0 * a2 */ - "movq %%r11, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* (r9,r10,r8) += a1 * a1 */ - "movq %%r12, %%rax\n" - "mulq %%r12\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l2 */ - "movq %%r9, 16(%%rsi)\n" - "xorq %%r9, %%r9\n" - /* (r10,r8,r9) += 2 * a0 * a3 */ - "movq %%r11, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* (r10,r8,r9) += 2 * a1 * a2 */ - "movq %%r12, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - "adcq $0, %%r9\n" - /* Extract l3 */ - "movq %%r10, 24(%%rsi)\n" - "xorq %%r10, %%r10\n" - /* (r8,r9,r10) += 2 * a1 * a3 */ - "movq %%r12, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* (r8,r9,r10) += a2 * a2 */ - "movq %%r13, %%rax\n" - "mulq %%r13\n" - "addq %%rax, %%r8\n" - "adcq %%rdx, %%r9\n" - "adcq $0, %%r10\n" - /* Extract l4 */ - "movq %%r8, 32(%%rsi)\n" - "xorq %%r8, %%r8\n" - /* (r9,r10,r8) += 2 * a2 * a3 */ - "movq %%r13, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - "addq %%rax, %%r9\n" - "adcq %%rdx, %%r10\n" - "adcq $0, %%r8\n" - /* Extract l5 */ - "movq %%r9, 40(%%rsi)\n" - /* (r10,r8) += a3 * a3 */ - "movq %%r14, %%rax\n" - "mulq %%r14\n" - "addq %%rax, %%r10\n" - "adcq %%rdx, %%r8\n" - /* Extract l6 */ - "movq %%r10, 48(%%rsi)\n" - /* Extract l7 */ - "movq %%r8, 56(%%rsi)\n" - : - : "S"(l), "D"(a->d) - : "rax", "rdx", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "cc", "memory"); -#else - /* 160 bit accumulator. */ - uint64_t c0 = 0, c1 = 0; - uint32_t c2 = 0; - - /* l[0..7] = a[0..3] * b[0..3]. */ - muladd_fast(a->d[0], a->d[0]); - extract_fast(l[0]); - muladd2(a->d[0], a->d[1]); - extract(l[1]); - muladd2(a->d[0], a->d[2]); - muladd(a->d[1], a->d[1]); - extract(l[2]); - muladd2(a->d[0], a->d[3]); - muladd2(a->d[1], a->d[2]); - extract(l[3]); - muladd2(a->d[1], a->d[3]); - muladd(a->d[2], a->d[2]); - extract(l[4]); - muladd2(a->d[2], a->d[3]); - extract(l[5]); - muladd_fast(a->d[3], a->d[3]); - extract_fast(l[6]); - VERIFY_CHECK(c1 == 0); - l[7] = c0; -#endif -} - -#undef sumadd -#undef sumadd_fast -#undef muladd -#undef muladd_fast -#undef muladd2 -#undef extract -#undef extract_fast - -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - uint64_t l[8]; - secp256k1_scalar_mul_512(l, a, b); - secp256k1_scalar_reduce_512(r, l); -} - -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) { - int ret; - VERIFY_CHECK(n > 0); - VERIFY_CHECK(n < 16); - ret = r->d[0] & ((1 << n) - 1); - r->d[0] = (r->d[0] >> n) + (r->d[1] << (64 - n)); - r->d[1] = (r->d[1] >> n) + (r->d[2] << (64 - n)); - r->d[2] = (r->d[2] >> n) + (r->d[3] << (64 - n)); - r->d[3] = (r->d[3] >> n); - return ret; -} - -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint64_t l[8]; - secp256k1_scalar_sqr_512(l, a); - secp256k1_scalar_reduce_512(r, l); -} - -#ifdef USE_ENDOMORPHISM -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - r1->d[0] = a->d[0]; - r1->d[1] = a->d[1]; - r1->d[2] = 0; - r1->d[3] = 0; - r2->d[0] = a->d[2]; - r2->d[1] = a->d[3]; - r2->d[2] = 0; - r2->d[3] = 0; -} -#endif - -SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { - return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3])) == 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) { - uint64_t l[8]; - unsigned int shiftlimbs; - unsigned int shiftlow; - unsigned int shifthigh; - VERIFY_CHECK(shift >= 256); - secp256k1_scalar_mul_512(l, a, b); - shiftlimbs = shift >> 6; - shiftlow = shift & 0x3F; - shifthigh = 64 - shiftlow; - r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[1] = shift < 448 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[2] = shift < 384 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[3] = shift < 320 ? (l[3 + shiftlimbs] >> shiftlow) : 0; - secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 6] >> ((shift - 1) & 0x3f)) & 1); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h deleted file mode 100644 index 1319664f..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32.h +++ /dev/null @@ -1,19 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_ -#define _SECP256K1_SCALAR_REPR_ - -#include - -/** A scalar modulo the group order of the secp256k1 curve. */ -typedef struct { - uint32_t d[8]; -} secp256k1_scalar; - -#define SECP256K1_SCALAR_CONST(d7, d6, d5, d4, d3, d2, d1, d0) {{(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)}} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h deleted file mode 100644 index aae4f35c..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_8x32_impl.h +++ /dev/null @@ -1,721 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_IMPL_H_ -#define _SECP256K1_SCALAR_REPR_IMPL_H_ - -/* Limbs of the secp256k1 order. */ -#define SECP256K1_N_0 ((uint32_t)0xD0364141UL) -#define SECP256K1_N_1 ((uint32_t)0xBFD25E8CUL) -#define SECP256K1_N_2 ((uint32_t)0xAF48A03BUL) -#define SECP256K1_N_3 ((uint32_t)0xBAAEDCE6UL) -#define SECP256K1_N_4 ((uint32_t)0xFFFFFFFEUL) -#define SECP256K1_N_5 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_6 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_7 ((uint32_t)0xFFFFFFFFUL) - -/* Limbs of 2^256 minus the secp256k1 order. */ -#define SECP256K1_N_C_0 (~SECP256K1_N_0 + 1) -#define SECP256K1_N_C_1 (~SECP256K1_N_1) -#define SECP256K1_N_C_2 (~SECP256K1_N_2) -#define SECP256K1_N_C_3 (~SECP256K1_N_3) -#define SECP256K1_N_C_4 (1) - -/* Limbs of half the secp256k1 order. */ -#define SECP256K1_N_H_0 ((uint32_t)0x681B20A0UL) -#define SECP256K1_N_H_1 ((uint32_t)0xDFE92F46UL) -#define SECP256K1_N_H_2 ((uint32_t)0x57A4501DUL) -#define SECP256K1_N_H_3 ((uint32_t)0x5D576E73UL) -#define SECP256K1_N_H_4 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_H_5 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_H_6 ((uint32_t)0xFFFFFFFFUL) -#define SECP256K1_N_H_7 ((uint32_t)0x7FFFFFFFUL) - -SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) { - r->d[0] = 0; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; - r->d[4] = 0; - r->d[5] = 0; - r->d[6] = 0; - r->d[7] = 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) { - r->d[0] = v; - r->d[1] = 0; - r->d[2] = 0; - r->d[3] = 0; - r->d[4] = 0; - r->d[5] = 0; - r->d[6] = 0; - r->d[7] = 0; -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK((offset + count - 1) >> 5 == offset >> 5); - return (a->d[offset >> 5] >> (offset & 0x1F)) & ((1 << count) - 1); -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - VERIFY_CHECK(count < 32); - VERIFY_CHECK(offset + count <= 256); - if ((offset + count - 1) >> 5 == offset >> 5) { - return secp256k1_scalar_get_bits(a, offset, count); - } else { - VERIFY_CHECK((offset >> 5) + 1 < 8); - return ((a->d[offset >> 5] >> (offset & 0x1F)) | (a->d[(offset >> 5) + 1] << (32 - (offset & 0x1F)))) & ((((uint32_t)1) << count) - 1); - } -} - -SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[7] < SECP256K1_N_7); /* No need for a > check. */ - no |= (a->d[6] < SECP256K1_N_6); /* No need for a > check. */ - no |= (a->d[5] < SECP256K1_N_5); /* No need for a > check. */ - no |= (a->d[4] < SECP256K1_N_4); - yes |= (a->d[4] > SECP256K1_N_4) & ~no; - no |= (a->d[3] < SECP256K1_N_3) & ~yes; - yes |= (a->d[3] > SECP256K1_N_3) & ~no; - no |= (a->d[2] < SECP256K1_N_2) & ~yes; - yes |= (a->d[2] > SECP256K1_N_2) & ~no; - no |= (a->d[1] < SECP256K1_N_1) & ~yes; - yes |= (a->d[1] > SECP256K1_N_1) & ~no; - yes |= (a->d[0] >= SECP256K1_N_0) & ~no; - return yes; -} - -SECP256K1_INLINE static int secp256k1_scalar_reduce(secp256k1_scalar *r, uint32_t overflow) { - uint64_t t; - VERIFY_CHECK(overflow <= 1); - t = (uint64_t)r->d[0] + overflow * SECP256K1_N_C_0; - r->d[0] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[1] + overflow * SECP256K1_N_C_1; - r->d[1] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[2] + overflow * SECP256K1_N_C_2; - r->d[2] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[3] + overflow * SECP256K1_N_C_3; - r->d[3] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[4] + overflow * SECP256K1_N_C_4; - r->d[4] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[5]; - r->d[5] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[6]; - r->d[6] = t & 0xFFFFFFFFUL; t >>= 32; - t += (uint64_t)r->d[7]; - r->d[7] = t & 0xFFFFFFFFUL; - return overflow; -} - -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - int overflow; - uint64_t t = (uint64_t)a->d[0] + b->d[0]; - r->d[0] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[1] + b->d[1]; - r->d[1] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[2] + b->d[2]; - r->d[2] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[3] + b->d[3]; - r->d[3] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[4] + b->d[4]; - r->d[4] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[5] + b->d[5]; - r->d[5] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[6] + b->d[6]; - r->d[6] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)a->d[7] + b->d[7]; - r->d[7] = t & 0xFFFFFFFFULL; t >>= 32; - overflow = t + secp256k1_scalar_check_overflow(r); - VERIFY_CHECK(overflow == 0 || overflow == 1); - secp256k1_scalar_reduce(r, overflow); - return overflow; -} - -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) { - uint64_t t; - VERIFY_CHECK(bit < 256); - bit += ((uint32_t) flag - 1) & 0x100; /* forcing (bit >> 5) > 7 makes this a noop */ - t = (uint64_t)r->d[0] + (((uint32_t)((bit >> 5) == 0)) << (bit & 0x1F)); - r->d[0] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[1] + (((uint32_t)((bit >> 5) == 1)) << (bit & 0x1F)); - r->d[1] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[2] + (((uint32_t)((bit >> 5) == 2)) << (bit & 0x1F)); - r->d[2] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[3] + (((uint32_t)((bit >> 5) == 3)) << (bit & 0x1F)); - r->d[3] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[4] + (((uint32_t)((bit >> 5) == 4)) << (bit & 0x1F)); - r->d[4] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[5] + (((uint32_t)((bit >> 5) == 5)) << (bit & 0x1F)); - r->d[5] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[6] + (((uint32_t)((bit >> 5) == 6)) << (bit & 0x1F)); - r->d[6] = t & 0xFFFFFFFFULL; t >>= 32; - t += (uint64_t)r->d[7] + (((uint32_t)((bit >> 5) == 7)) << (bit & 0x1F)); - r->d[7] = t & 0xFFFFFFFFULL; -#ifdef VERIFY - VERIFY_CHECK((t >> 32) == 0); - VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0); -#endif -} - -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) { - int over; - r->d[0] = (uint32_t)b32[31] | (uint32_t)b32[30] << 8 | (uint32_t)b32[29] << 16 | (uint32_t)b32[28] << 24; - r->d[1] = (uint32_t)b32[27] | (uint32_t)b32[26] << 8 | (uint32_t)b32[25] << 16 | (uint32_t)b32[24] << 24; - r->d[2] = (uint32_t)b32[23] | (uint32_t)b32[22] << 8 | (uint32_t)b32[21] << 16 | (uint32_t)b32[20] << 24; - r->d[3] = (uint32_t)b32[19] | (uint32_t)b32[18] << 8 | (uint32_t)b32[17] << 16 | (uint32_t)b32[16] << 24; - r->d[4] = (uint32_t)b32[15] | (uint32_t)b32[14] << 8 | (uint32_t)b32[13] << 16 | (uint32_t)b32[12] << 24; - r->d[5] = (uint32_t)b32[11] | (uint32_t)b32[10] << 8 | (uint32_t)b32[9] << 16 | (uint32_t)b32[8] << 24; - r->d[6] = (uint32_t)b32[7] | (uint32_t)b32[6] << 8 | (uint32_t)b32[5] << 16 | (uint32_t)b32[4] << 24; - r->d[7] = (uint32_t)b32[3] | (uint32_t)b32[2] << 8 | (uint32_t)b32[1] << 16 | (uint32_t)b32[0] << 24; - over = secp256k1_scalar_reduce(r, secp256k1_scalar_check_overflow(r)); - if (overflow) { - *overflow = over; - } -} - -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) { - bin[0] = a->d[7] >> 24; bin[1] = a->d[7] >> 16; bin[2] = a->d[7] >> 8; bin[3] = a->d[7]; - bin[4] = a->d[6] >> 24; bin[5] = a->d[6] >> 16; bin[6] = a->d[6] >> 8; bin[7] = a->d[6]; - bin[8] = a->d[5] >> 24; bin[9] = a->d[5] >> 16; bin[10] = a->d[5] >> 8; bin[11] = a->d[5]; - bin[12] = a->d[4] >> 24; bin[13] = a->d[4] >> 16; bin[14] = a->d[4] >> 8; bin[15] = a->d[4]; - bin[16] = a->d[3] >> 24; bin[17] = a->d[3] >> 16; bin[18] = a->d[3] >> 8; bin[19] = a->d[3]; - bin[20] = a->d[2] >> 24; bin[21] = a->d[2] >> 16; bin[22] = a->d[2] >> 8; bin[23] = a->d[2]; - bin[24] = a->d[1] >> 24; bin[25] = a->d[1] >> 16; bin[26] = a->d[1] >> 8; bin[27] = a->d[1]; - bin[28] = a->d[0] >> 24; bin[29] = a->d[0] >> 16; bin[30] = a->d[0] >> 8; bin[31] = a->d[0]; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) { - return (a->d[0] | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0; -} - -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(a) == 0); - uint64_t t = (uint64_t)(~a->d[0]) + SECP256K1_N_0 + 1; - r->d[0] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[1]) + SECP256K1_N_1; - r->d[1] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[2]) + SECP256K1_N_2; - r->d[2] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[3]) + SECP256K1_N_3; - r->d[3] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[4]) + SECP256K1_N_4; - r->d[4] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[5]) + SECP256K1_N_5; - r->d[5] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[6]) + SECP256K1_N_6; - r->d[6] = t & nonzero; t >>= 32; - t += (uint64_t)(~a->d[7]) + SECP256K1_N_7; - r->d[7] = t & nonzero; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) { - return ((a->d[0] ^ 1) | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0; -} - -static int secp256k1_scalar_is_high(const secp256k1_scalar *a) { - int yes = 0; - int no = 0; - no |= (a->d[7] < SECP256K1_N_H_7); - yes |= (a->d[7] > SECP256K1_N_H_7) & ~no; - no |= (a->d[6] < SECP256K1_N_H_6) & ~yes; /* No need for a > check. */ - no |= (a->d[5] < SECP256K1_N_H_5) & ~yes; /* No need for a > check. */ - no |= (a->d[4] < SECP256K1_N_H_4) & ~yes; /* No need for a > check. */ - no |= (a->d[3] < SECP256K1_N_H_3) & ~yes; - yes |= (a->d[3] > SECP256K1_N_H_3) & ~no; - no |= (a->d[2] < SECP256K1_N_H_2) & ~yes; - yes |= (a->d[2] > SECP256K1_N_H_2) & ~no; - no |= (a->d[1] < SECP256K1_N_H_1) & ~yes; - yes |= (a->d[1] > SECP256K1_N_H_1) & ~no; - yes |= (a->d[0] > SECP256K1_N_H_0) & ~no; - return yes; -} - -static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) { - /* If we are flag = 0, mask = 00...00 and this is a no-op; - * if we are flag = 1, mask = 11...11 and this is identical to secp256k1_scalar_negate */ - uint32_t mask = !flag - 1; - uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(r) == 0); - uint64_t t = (uint64_t)(r->d[0] ^ mask) + ((SECP256K1_N_0 + 1) & mask); - r->d[0] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[1] ^ mask) + (SECP256K1_N_1 & mask); - r->d[1] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[2] ^ mask) + (SECP256K1_N_2 & mask); - r->d[2] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[3] ^ mask) + (SECP256K1_N_3 & mask); - r->d[3] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[4] ^ mask) + (SECP256K1_N_4 & mask); - r->d[4] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[5] ^ mask) + (SECP256K1_N_5 & mask); - r->d[5] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[6] ^ mask) + (SECP256K1_N_6 & mask); - r->d[6] = t & nonzero; t >>= 32; - t += (uint64_t)(r->d[7] ^ mask) + (SECP256K1_N_7 & mask); - r->d[7] = t & nonzero; - return 2 * (mask == 0) - 1; -} - - -/* Inspired by the macros in OpenSSL's crypto/bn/asm/x86_64-gcc.c. */ - -/** Add a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd(a,b) { \ - uint32_t tl, th; \ - { \ - uint64_t t = (uint64_t)a * b; \ - th = t >> 32; /* at most 0xFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \ - c1 += th; /* overflow is handled on the next line */ \ - c2 += (c1 < th) ? 1 : 0; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK((c1 >= th) || (c2 != 0)); \ -} - -/** Add a*b to the number defined by (c0,c1). c1 must never overflow. */ -#define muladd_fast(a,b) { \ - uint32_t tl, th; \ - { \ - uint64_t t = (uint64_t)a * b; \ - th = t >> 32; /* at most 0xFFFFFFFE */ \ - tl = t; \ - } \ - c0 += tl; /* overflow is handled on the next line */ \ - th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \ - c1 += th; /* never overflows by contract (verified in the next line) */ \ - VERIFY_CHECK(c1 >= th); \ -} - -/** Add 2*a*b to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define muladd2(a,b) { \ - uint32_t tl, th, th2, tl2; \ - { \ - uint64_t t = (uint64_t)a * b; \ - th = t >> 32; /* at most 0xFFFFFFFE */ \ - tl = t; \ - } \ - th2 = th + th; /* at most 0xFFFFFFFE (in case th was 0x7FFFFFFF) */ \ - c2 += (th2 < th) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((th2 >= th) || (c2 != 0)); \ - tl2 = tl + tl; /* at most 0xFFFFFFFE (in case the lowest 63 bits of tl were 0x7FFFFFFF) */ \ - th2 += (tl2 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \ - c0 += tl2; /* overflow is handled on the next line */ \ - th2 += (c0 < tl2) ? 1 : 0; /* second overflow is handled on the next line */ \ - c2 += (c0 < tl2) & (th2 == 0); /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c0 >= tl2) || (th2 != 0) || (c2 != 0)); \ - c1 += th2; /* overflow is handled on the next line */ \ - c2 += (c1 < th2) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 >= th2) || (c2 != 0)); \ -} - -/** Add a to the number defined by (c0,c1,c2). c2 must never overflow. */ -#define sumadd(a) { \ - unsigned int over; \ - c0 += (a); /* overflow is handled on the next line */ \ - over = (c0 < (a)) ? 1 : 0; \ - c1 += over; /* overflow is handled on the next line */ \ - c2 += (c1 < over) ? 1 : 0; /* never overflows by contract */ \ -} - -/** Add a to the number defined by (c0,c1). c1 must never overflow, c2 must be zero. */ -#define sumadd_fast(a) { \ - c0 += (a); /* overflow is handled on the next line */ \ - c1 += (c0 < (a)) ? 1 : 0; /* never overflows by contract (verified the next line) */ \ - VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \ - VERIFY_CHECK(c2 == 0); \ -} - -/** Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits. */ -#define extract(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = c2; \ - c2 = 0; \ -} - -/** Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits. c2 is required to be zero. */ -#define extract_fast(n) { \ - (n) = c0; \ - c0 = c1; \ - c1 = 0; \ - VERIFY_CHECK(c2 == 0); \ -} - -static void secp256k1_scalar_reduce_512(secp256k1_scalar *r, const uint32_t *l) { - uint64_t c; - uint32_t n0 = l[8], n1 = l[9], n2 = l[10], n3 = l[11], n4 = l[12], n5 = l[13], n6 = l[14], n7 = l[15]; - uint32_t m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12; - uint32_t p0, p1, p2, p3, p4, p5, p6, p7, p8; - - /* 96 bit accumulator. */ - uint32_t c0, c1, c2; - - /* Reduce 512 bits into 385. */ - /* m[0..12] = l[0..7] + n[0..7] * SECP256K1_N_C. */ - c0 = l[0]; c1 = 0; c2 = 0; - muladd_fast(n0, SECP256K1_N_C_0); - extract_fast(m0); - sumadd_fast(l[1]); - muladd(n1, SECP256K1_N_C_0); - muladd(n0, SECP256K1_N_C_1); - extract(m1); - sumadd(l[2]); - muladd(n2, SECP256K1_N_C_0); - muladd(n1, SECP256K1_N_C_1); - muladd(n0, SECP256K1_N_C_2); - extract(m2); - sumadd(l[3]); - muladd(n3, SECP256K1_N_C_0); - muladd(n2, SECP256K1_N_C_1); - muladd(n1, SECP256K1_N_C_2); - muladd(n0, SECP256K1_N_C_3); - extract(m3); - sumadd(l[4]); - muladd(n4, SECP256K1_N_C_0); - muladd(n3, SECP256K1_N_C_1); - muladd(n2, SECP256K1_N_C_2); - muladd(n1, SECP256K1_N_C_3); - sumadd(n0); - extract(m4); - sumadd(l[5]); - muladd(n5, SECP256K1_N_C_0); - muladd(n4, SECP256K1_N_C_1); - muladd(n3, SECP256K1_N_C_2); - muladd(n2, SECP256K1_N_C_3); - sumadd(n1); - extract(m5); - sumadd(l[6]); - muladd(n6, SECP256K1_N_C_0); - muladd(n5, SECP256K1_N_C_1); - muladd(n4, SECP256K1_N_C_2); - muladd(n3, SECP256K1_N_C_3); - sumadd(n2); - extract(m6); - sumadd(l[7]); - muladd(n7, SECP256K1_N_C_0); - muladd(n6, SECP256K1_N_C_1); - muladd(n5, SECP256K1_N_C_2); - muladd(n4, SECP256K1_N_C_3); - sumadd(n3); - extract(m7); - muladd(n7, SECP256K1_N_C_1); - muladd(n6, SECP256K1_N_C_2); - muladd(n5, SECP256K1_N_C_3); - sumadd(n4); - extract(m8); - muladd(n7, SECP256K1_N_C_2); - muladd(n6, SECP256K1_N_C_3); - sumadd(n5); - extract(m9); - muladd(n7, SECP256K1_N_C_3); - sumadd(n6); - extract(m10); - sumadd_fast(n7); - extract_fast(m11); - VERIFY_CHECK(c0 <= 1); - m12 = c0; - - /* Reduce 385 bits into 258. */ - /* p[0..8] = m[0..7] + m[8..12] * SECP256K1_N_C. */ - c0 = m0; c1 = 0; c2 = 0; - muladd_fast(m8, SECP256K1_N_C_0); - extract_fast(p0); - sumadd_fast(m1); - muladd(m9, SECP256K1_N_C_0); - muladd(m8, SECP256K1_N_C_1); - extract(p1); - sumadd(m2); - muladd(m10, SECP256K1_N_C_0); - muladd(m9, SECP256K1_N_C_1); - muladd(m8, SECP256K1_N_C_2); - extract(p2); - sumadd(m3); - muladd(m11, SECP256K1_N_C_0); - muladd(m10, SECP256K1_N_C_1); - muladd(m9, SECP256K1_N_C_2); - muladd(m8, SECP256K1_N_C_3); - extract(p3); - sumadd(m4); - muladd(m12, SECP256K1_N_C_0); - muladd(m11, SECP256K1_N_C_1); - muladd(m10, SECP256K1_N_C_2); - muladd(m9, SECP256K1_N_C_3); - sumadd(m8); - extract(p4); - sumadd(m5); - muladd(m12, SECP256K1_N_C_1); - muladd(m11, SECP256K1_N_C_2); - muladd(m10, SECP256K1_N_C_3); - sumadd(m9); - extract(p5); - sumadd(m6); - muladd(m12, SECP256K1_N_C_2); - muladd(m11, SECP256K1_N_C_3); - sumadd(m10); - extract(p6); - sumadd_fast(m7); - muladd_fast(m12, SECP256K1_N_C_3); - sumadd_fast(m11); - extract_fast(p7); - p8 = c0 + m12; - VERIFY_CHECK(p8 <= 2); - - /* Reduce 258 bits into 256. */ - /* r[0..7] = p[0..7] + p[8] * SECP256K1_N_C. */ - c = p0 + (uint64_t)SECP256K1_N_C_0 * p8; - r->d[0] = c & 0xFFFFFFFFUL; c >>= 32; - c += p1 + (uint64_t)SECP256K1_N_C_1 * p8; - r->d[1] = c & 0xFFFFFFFFUL; c >>= 32; - c += p2 + (uint64_t)SECP256K1_N_C_2 * p8; - r->d[2] = c & 0xFFFFFFFFUL; c >>= 32; - c += p3 + (uint64_t)SECP256K1_N_C_3 * p8; - r->d[3] = c & 0xFFFFFFFFUL; c >>= 32; - c += p4 + (uint64_t)p8; - r->d[4] = c & 0xFFFFFFFFUL; c >>= 32; - c += p5; - r->d[5] = c & 0xFFFFFFFFUL; c >>= 32; - c += p6; - r->d[6] = c & 0xFFFFFFFFUL; c >>= 32; - c += p7; - r->d[7] = c & 0xFFFFFFFFUL; c >>= 32; - - /* Final reduction of r. */ - secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r)); -} - -static void secp256k1_scalar_mul_512(uint32_t *l, const secp256k1_scalar *a, const secp256k1_scalar *b) { - /* 96 bit accumulator. */ - uint32_t c0 = 0, c1 = 0, c2 = 0; - - /* l[0..15] = a[0..7] * b[0..7]. */ - muladd_fast(a->d[0], b->d[0]); - extract_fast(l[0]); - muladd(a->d[0], b->d[1]); - muladd(a->d[1], b->d[0]); - extract(l[1]); - muladd(a->d[0], b->d[2]); - muladd(a->d[1], b->d[1]); - muladd(a->d[2], b->d[0]); - extract(l[2]); - muladd(a->d[0], b->d[3]); - muladd(a->d[1], b->d[2]); - muladd(a->d[2], b->d[1]); - muladd(a->d[3], b->d[0]); - extract(l[3]); - muladd(a->d[0], b->d[4]); - muladd(a->d[1], b->d[3]); - muladd(a->d[2], b->d[2]); - muladd(a->d[3], b->d[1]); - muladd(a->d[4], b->d[0]); - extract(l[4]); - muladd(a->d[0], b->d[5]); - muladd(a->d[1], b->d[4]); - muladd(a->d[2], b->d[3]); - muladd(a->d[3], b->d[2]); - muladd(a->d[4], b->d[1]); - muladd(a->d[5], b->d[0]); - extract(l[5]); - muladd(a->d[0], b->d[6]); - muladd(a->d[1], b->d[5]); - muladd(a->d[2], b->d[4]); - muladd(a->d[3], b->d[3]); - muladd(a->d[4], b->d[2]); - muladd(a->d[5], b->d[1]); - muladd(a->d[6], b->d[0]); - extract(l[6]); - muladd(a->d[0], b->d[7]); - muladd(a->d[1], b->d[6]); - muladd(a->d[2], b->d[5]); - muladd(a->d[3], b->d[4]); - muladd(a->d[4], b->d[3]); - muladd(a->d[5], b->d[2]); - muladd(a->d[6], b->d[1]); - muladd(a->d[7], b->d[0]); - extract(l[7]); - muladd(a->d[1], b->d[7]); - muladd(a->d[2], b->d[6]); - muladd(a->d[3], b->d[5]); - muladd(a->d[4], b->d[4]); - muladd(a->d[5], b->d[3]); - muladd(a->d[6], b->d[2]); - muladd(a->d[7], b->d[1]); - extract(l[8]); - muladd(a->d[2], b->d[7]); - muladd(a->d[3], b->d[6]); - muladd(a->d[4], b->d[5]); - muladd(a->d[5], b->d[4]); - muladd(a->d[6], b->d[3]); - muladd(a->d[7], b->d[2]); - extract(l[9]); - muladd(a->d[3], b->d[7]); - muladd(a->d[4], b->d[6]); - muladd(a->d[5], b->d[5]); - muladd(a->d[6], b->d[4]); - muladd(a->d[7], b->d[3]); - extract(l[10]); - muladd(a->d[4], b->d[7]); - muladd(a->d[5], b->d[6]); - muladd(a->d[6], b->d[5]); - muladd(a->d[7], b->d[4]); - extract(l[11]); - muladd(a->d[5], b->d[7]); - muladd(a->d[6], b->d[6]); - muladd(a->d[7], b->d[5]); - extract(l[12]); - muladd(a->d[6], b->d[7]); - muladd(a->d[7], b->d[6]); - extract(l[13]); - muladd_fast(a->d[7], b->d[7]); - extract_fast(l[14]); - VERIFY_CHECK(c1 == 0); - l[15] = c0; -} - -static void secp256k1_scalar_sqr_512(uint32_t *l, const secp256k1_scalar *a) { - /* 96 bit accumulator. */ - uint32_t c0 = 0, c1 = 0, c2 = 0; - - /* l[0..15] = a[0..7]^2. */ - muladd_fast(a->d[0], a->d[0]); - extract_fast(l[0]); - muladd2(a->d[0], a->d[1]); - extract(l[1]); - muladd2(a->d[0], a->d[2]); - muladd(a->d[1], a->d[1]); - extract(l[2]); - muladd2(a->d[0], a->d[3]); - muladd2(a->d[1], a->d[2]); - extract(l[3]); - muladd2(a->d[0], a->d[4]); - muladd2(a->d[1], a->d[3]); - muladd(a->d[2], a->d[2]); - extract(l[4]); - muladd2(a->d[0], a->d[5]); - muladd2(a->d[1], a->d[4]); - muladd2(a->d[2], a->d[3]); - extract(l[5]); - muladd2(a->d[0], a->d[6]); - muladd2(a->d[1], a->d[5]); - muladd2(a->d[2], a->d[4]); - muladd(a->d[3], a->d[3]); - extract(l[6]); - muladd2(a->d[0], a->d[7]); - muladd2(a->d[1], a->d[6]); - muladd2(a->d[2], a->d[5]); - muladd2(a->d[3], a->d[4]); - extract(l[7]); - muladd2(a->d[1], a->d[7]); - muladd2(a->d[2], a->d[6]); - muladd2(a->d[3], a->d[5]); - muladd(a->d[4], a->d[4]); - extract(l[8]); - muladd2(a->d[2], a->d[7]); - muladd2(a->d[3], a->d[6]); - muladd2(a->d[4], a->d[5]); - extract(l[9]); - muladd2(a->d[3], a->d[7]); - muladd2(a->d[4], a->d[6]); - muladd(a->d[5], a->d[5]); - extract(l[10]); - muladd2(a->d[4], a->d[7]); - muladd2(a->d[5], a->d[6]); - extract(l[11]); - muladd2(a->d[5], a->d[7]); - muladd(a->d[6], a->d[6]); - extract(l[12]); - muladd2(a->d[6], a->d[7]); - extract(l[13]); - muladd_fast(a->d[7], a->d[7]); - extract_fast(l[14]); - VERIFY_CHECK(c1 == 0); - l[15] = c0; -} - -#undef sumadd -#undef sumadd_fast -#undef muladd -#undef muladd_fast -#undef muladd2 -#undef extract -#undef extract_fast - -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - uint32_t l[16]; - secp256k1_scalar_mul_512(l, a, b); - secp256k1_scalar_reduce_512(r, l); -} - -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) { - int ret; - VERIFY_CHECK(n > 0); - VERIFY_CHECK(n < 16); - ret = r->d[0] & ((1 << n) - 1); - r->d[0] = (r->d[0] >> n) + (r->d[1] << (32 - n)); - r->d[1] = (r->d[1] >> n) + (r->d[2] << (32 - n)); - r->d[2] = (r->d[2] >> n) + (r->d[3] << (32 - n)); - r->d[3] = (r->d[3] >> n) + (r->d[4] << (32 - n)); - r->d[4] = (r->d[4] >> n) + (r->d[5] << (32 - n)); - r->d[5] = (r->d[5] >> n) + (r->d[6] << (32 - n)); - r->d[6] = (r->d[6] >> n) + (r->d[7] << (32 - n)); - r->d[7] = (r->d[7] >> n); - return ret; -} - -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { - uint32_t l[16]; - secp256k1_scalar_sqr_512(l, a); - secp256k1_scalar_reduce_512(r, l); -} - -#ifdef USE_ENDOMORPHISM -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - r1->d[0] = a->d[0]; - r1->d[1] = a->d[1]; - r1->d[2] = a->d[2]; - r1->d[3] = a->d[3]; - r1->d[4] = 0; - r1->d[5] = 0; - r1->d[6] = 0; - r1->d[7] = 0; - r2->d[0] = a->d[4]; - r2->d[1] = a->d[5]; - r2->d[2] = a->d[6]; - r2->d[3] = a->d[7]; - r2->d[4] = 0; - r2->d[5] = 0; - r2->d[6] = 0; - r2->d[7] = 0; -} -#endif - -SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { - return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3]) | (a->d[4] ^ b->d[4]) | (a->d[5] ^ b->d[5]) | (a->d[6] ^ b->d[6]) | (a->d[7] ^ b->d[7])) == 0; -} - -SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) { - uint32_t l[16]; - unsigned int shiftlimbs; - unsigned int shiftlow; - unsigned int shifthigh; - VERIFY_CHECK(shift >= 256); - secp256k1_scalar_mul_512(l, a, b); - shiftlimbs = shift >> 5; - shiftlow = shift & 0x1F; - shifthigh = 32 - shiftlow; - r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 480 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[1] = shift < 480 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[2] = shift < 448 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 416 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[3] = shift < 416 ? (l[3 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[4 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[4] = shift < 384 ? (l[4 + shiftlimbs] >> shiftlow | (shift < 352 && shiftlow ? (l[5 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[5] = shift < 352 ? (l[5 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[6 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[6] = shift < 320 ? (l[6 + shiftlimbs] >> shiftlow | (shift < 288 && shiftlow ? (l[7 + shiftlimbs] << shifthigh) : 0)) : 0; - r->d[7] = shift < 288 ? (l[7 + shiftlimbs] >> shiftlow) : 0; - secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 5] >> ((shift - 1) & 0x1f)) & 1); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h deleted file mode 100644 index f5b23764..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_impl.h +++ /dev/null @@ -1,370 +0,0 @@ -/********************************************************************** - * Copyright (c) 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_IMPL_H_ -#define _SECP256K1_SCALAR_IMPL_H_ - -#include "group.h" -#include "scalar.h" - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#if defined(EXHAUSTIVE_TEST_ORDER) -#include "scalar_low_impl.h" -#elif defined(USE_SCALAR_4X64) -#include "scalar_4x64_impl.h" -#elif defined(USE_SCALAR_8X32) -#include "scalar_8x32_impl.h" -#else -#error "Please select scalar implementation" -#endif - -#ifndef USE_NUM_NONE -static void secp256k1_scalar_get_num(secp256k1_num *r, const secp256k1_scalar *a) { - unsigned char c[32]; - secp256k1_scalar_get_b32(c, a); - secp256k1_num_set_bin(r, c, 32); -} - -/** secp256k1 curve order, see secp256k1_ecdsa_const_order_as_fe in ecdsa_impl.h */ -static void secp256k1_scalar_order_get_num(secp256k1_num *r) { -#if defined(EXHAUSTIVE_TEST_ORDER) - static const unsigned char order[32] = { - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,EXHAUSTIVE_TEST_ORDER - }; -#else - static const unsigned char order[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, - 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, - 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x41 - }; -#endif - secp256k1_num_set_bin(r, order, 32); -} -#endif - -static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *x) { -#if defined(EXHAUSTIVE_TEST_ORDER) - int i; - *r = 0; - for (i = 0; i < EXHAUSTIVE_TEST_ORDER; i++) - if ((i * *x) % EXHAUSTIVE_TEST_ORDER == 1) - *r = i; - /* If this VERIFY_CHECK triggers we were given a noninvertible scalar (and thus - * have a composite group order; fix it in exhaustive_tests.c). */ - VERIFY_CHECK(*r != 0); -} -#else - secp256k1_scalar *t; - int i; - /* First compute x ^ (2^N - 1) for some values of N. */ - secp256k1_scalar x2, x3, x4, x6, x7, x8, x15, x30, x60, x120, x127; - - secp256k1_scalar_sqr(&x2, x); - secp256k1_scalar_mul(&x2, &x2, x); - - secp256k1_scalar_sqr(&x3, &x2); - secp256k1_scalar_mul(&x3, &x3, x); - - secp256k1_scalar_sqr(&x4, &x3); - secp256k1_scalar_mul(&x4, &x4, x); - - secp256k1_scalar_sqr(&x6, &x4); - secp256k1_scalar_sqr(&x6, &x6); - secp256k1_scalar_mul(&x6, &x6, &x2); - - secp256k1_scalar_sqr(&x7, &x6); - secp256k1_scalar_mul(&x7, &x7, x); - - secp256k1_scalar_sqr(&x8, &x7); - secp256k1_scalar_mul(&x8, &x8, x); - - secp256k1_scalar_sqr(&x15, &x8); - for (i = 0; i < 6; i++) { - secp256k1_scalar_sqr(&x15, &x15); - } - secp256k1_scalar_mul(&x15, &x15, &x7); - - secp256k1_scalar_sqr(&x30, &x15); - for (i = 0; i < 14; i++) { - secp256k1_scalar_sqr(&x30, &x30); - } - secp256k1_scalar_mul(&x30, &x30, &x15); - - secp256k1_scalar_sqr(&x60, &x30); - for (i = 0; i < 29; i++) { - secp256k1_scalar_sqr(&x60, &x60); - } - secp256k1_scalar_mul(&x60, &x60, &x30); - - secp256k1_scalar_sqr(&x120, &x60); - for (i = 0; i < 59; i++) { - secp256k1_scalar_sqr(&x120, &x120); - } - secp256k1_scalar_mul(&x120, &x120, &x60); - - secp256k1_scalar_sqr(&x127, &x120); - for (i = 0; i < 6; i++) { - secp256k1_scalar_sqr(&x127, &x127); - } - secp256k1_scalar_mul(&x127, &x127, &x7); - - /* Then accumulate the final result (t starts at x127). */ - t = &x127; - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 3; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 5; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 4; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 5; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x4); /* 1111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 4; i++) { /* 000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 10; i++) { /* 0000000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 4; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x3); /* 111 */ - for (i = 0; i < 9; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x8); /* 11111111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 5; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x4); /* 1111 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 5; i++) { /* 000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 4; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 2; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 8; i++) { /* 000000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 3; i++) { /* 0 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, &x2); /* 11 */ - for (i = 0; i < 3; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 6; i++) { /* 00000 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(t, t, x); /* 1 */ - for (i = 0; i < 8; i++) { /* 00 */ - secp256k1_scalar_sqr(t, t); - } - secp256k1_scalar_mul(r, t, &x6); /* 111111 */ -} - -SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) { - return !(a->d[0] & 1); -} -#endif - -static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *x) { -#if defined(USE_SCALAR_INV_BUILTIN) - secp256k1_scalar_inverse(r, x); -#elif defined(USE_SCALAR_INV_NUM) - unsigned char b[32]; - secp256k1_num n, m; - secp256k1_scalar t = *x; - secp256k1_scalar_get_b32(b, &t); - secp256k1_num_set_bin(&n, b, 32); - secp256k1_scalar_order_get_num(&m); - secp256k1_num_mod_inverse(&n, &n, &m); - secp256k1_num_get_bin(b, 32, &n); - secp256k1_scalar_set_b32(r, b, NULL); - /* Verify that the inverse was computed correctly, without GMP code. */ - secp256k1_scalar_mul(&t, &t, r); - CHECK(secp256k1_scalar_is_one(&t)); -#else -#error "Please select scalar inverse implementation" -#endif -} - -#ifdef USE_ENDOMORPHISM -#if defined(EXHAUSTIVE_TEST_ORDER) -/** - * Find k1 and k2 given k, such that k1 + k2 * lambda == k mod n; unlike in the - * full case we don't bother making k1 and k2 be small, we just want them to be - * nontrivial to get full test coverage for the exhaustive tests. We therefore - * (arbitrarily) set k2 = k + 5 and k1 = k - k2 * lambda. - */ -static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - *r2 = (*a + 5) % EXHAUSTIVE_TEST_ORDER; - *r1 = (*a + (EXHAUSTIVE_TEST_ORDER - *r2) * EXHAUSTIVE_TEST_LAMBDA) % EXHAUSTIVE_TEST_ORDER; -} -#else -/** - * The Secp256k1 curve has an endomorphism, where lambda * (x, y) = (beta * x, y), where - * lambda is {0x53,0x63,0xad,0x4c,0xc0,0x5c,0x30,0xe0,0xa5,0x26,0x1c,0x02,0x88,0x12,0x64,0x5a, - * 0x12,0x2e,0x22,0xea,0x20,0x81,0x66,0x78,0xdf,0x02,0x96,0x7c,0x1b,0x23,0xbd,0x72} - * - * "Guide to Elliptic Curve Cryptography" (Hankerson, Menezes, Vanstone) gives an algorithm - * (algorithm 3.74) to find k1 and k2 given k, such that k1 + k2 * lambda == k mod n, and k1 - * and k2 have a small size. - * It relies on constants a1, b1, a2, b2. These constants for the value of lambda above are: - * - * - a1 = {0x30,0x86,0xd2,0x21,0xa7,0xd4,0x6b,0xcd,0xe8,0x6c,0x90,0xe4,0x92,0x84,0xeb,0x15} - * - b1 = -{0xe4,0x43,0x7e,0xd6,0x01,0x0e,0x88,0x28,0x6f,0x54,0x7f,0xa9,0x0a,0xbf,0xe4,0xc3} - * - a2 = {0x01,0x14,0xca,0x50,0xf7,0xa8,0xe2,0xf3,0xf6,0x57,0xc1,0x10,0x8d,0x9d,0x44,0xcf,0xd8} - * - b2 = {0x30,0x86,0xd2,0x21,0xa7,0xd4,0x6b,0xcd,0xe8,0x6c,0x90,0xe4,0x92,0x84,0xeb,0x15} - * - * The algorithm then computes c1 = round(b1 * k / n) and c2 = round(b2 * k / n), and gives - * k1 = k - (c1*a1 + c2*a2) and k2 = -(c1*b1 + c2*b2). Instead, we use modular arithmetic, and - * compute k1 as k - k2 * lambda, avoiding the need for constants a1 and a2. - * - * g1, g2 are precomputed constants used to replace division with a rounded multiplication - * when decomposing the scalar for an endomorphism-based point multiplication. - * - * The possibility of using precomputed estimates is mentioned in "Guide to Elliptic Curve - * Cryptography" (Hankerson, Menezes, Vanstone) in section 3.5. - * - * The derivation is described in the paper "Efficient Software Implementation of Public-Key - * Cryptography on Sensor Networks Using the MSP430X Microcontroller" (Gouvea, Oliveira, Lopez), - * Section 4.3 (here we use a somewhat higher-precision estimate): - * d = a1*b2 - b1*a2 - * g1 = round((2^272)*b2/d) - * g2 = round((2^272)*b1/d) - * - * (Note that 'd' is also equal to the curve order here because [a1,b1] and [a2,b2] are found - * as outputs of the Extended Euclidean Algorithm on inputs 'order' and 'lambda'). - * - * The function below splits a in r1 and r2, such that r1 + lambda * r2 == a (mod order). - */ - -static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - secp256k1_scalar c1, c2; - static const secp256k1_scalar minus_lambda = SECP256K1_SCALAR_CONST( - 0xAC9C52B3UL, 0x3FA3CF1FUL, 0x5AD9E3FDUL, 0x77ED9BA4UL, - 0xA880B9FCUL, 0x8EC739C2UL, 0xE0CFC810UL, 0xB51283CFUL - ); - static const secp256k1_scalar minus_b1 = SECP256K1_SCALAR_CONST( - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0xE4437ED6UL, 0x010E8828UL, 0x6F547FA9UL, 0x0ABFE4C3UL - ); - static const secp256k1_scalar minus_b2 = SECP256K1_SCALAR_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFEUL, - 0x8A280AC5UL, 0x0774346DUL, 0xD765CDA8UL, 0x3DB1562CUL - ); - static const secp256k1_scalar g1 = SECP256K1_SCALAR_CONST( - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00003086UL, - 0xD221A7D4UL, 0x6BCDE86CUL, 0x90E49284UL, 0xEB153DABUL - ); - static const secp256k1_scalar g2 = SECP256K1_SCALAR_CONST( - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x0000E443UL, - 0x7ED6010EUL, 0x88286F54UL, 0x7FA90ABFUL, 0xE4C42212UL - ); - VERIFY_CHECK(r1 != a); - VERIFY_CHECK(r2 != a); - /* these _var calls are constant time since the shift amount is constant */ - secp256k1_scalar_mul_shift_var(&c1, a, &g1, 272); - secp256k1_scalar_mul_shift_var(&c2, a, &g2, 272); - secp256k1_scalar_mul(&c1, &c1, &minus_b1); - secp256k1_scalar_mul(&c2, &c2, &minus_b2); - secp256k1_scalar_add(r2, &c1, &c2); - secp256k1_scalar_mul(r1, r2, &minus_lambda); - secp256k1_scalar_add(r1, r1, a); -} -#endif -#endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h deleted file mode 100644 index 5574c44c..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low.h +++ /dev/null @@ -1,15 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_ -#define _SECP256K1_SCALAR_REPR_ - -#include - -/** A scalar modulo the group order of the secp256k1 curve. */ -typedef uint32_t secp256k1_scalar; - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h deleted file mode 100644 index 4f94441f..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/scalar_low_impl.h +++ /dev/null @@ -1,114 +0,0 @@ -/********************************************************************** - * Copyright (c) 2015 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_SCALAR_REPR_IMPL_H_ -#define _SECP256K1_SCALAR_REPR_IMPL_H_ - -#include "scalar.h" - -#include - -SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) { - return !(*a & 1); -} - -SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) { *r = 0; } -SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) { *r = v; } - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - if (offset < 32) - return ((*a >> offset) & ((((uint32_t)1) << count) - 1)); - else - return 0; -} - -SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) { - return secp256k1_scalar_get_bits(a, offset, count); -} - -SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) { return *a >= EXHAUSTIVE_TEST_ORDER; } - -static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - *r = (*a + *b) % EXHAUSTIVE_TEST_ORDER; - return *r < *b; -} - -static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) { - if (flag && bit < 32) - *r += (1 << bit); -#ifdef VERIFY - VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0); -#endif -} - -static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) { - const int base = 0x100 % EXHAUSTIVE_TEST_ORDER; - int i; - *r = 0; - for (i = 0; i < 32; i++) { - *r = ((*r * base) + b32[i]) % EXHAUSTIVE_TEST_ORDER; - } - /* just deny overflow, it basically always happens */ - if (overflow) *overflow = 0; -} - -static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) { - memset(bin, 0, 32); - bin[28] = *a >> 24; bin[29] = *a >> 16; bin[30] = *a >> 8; bin[31] = *a; -} - -SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) { - return *a == 0; -} - -static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) { - if (*a == 0) { - *r = 0; - } else { - *r = EXHAUSTIVE_TEST_ORDER - *a; - } -} - -SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) { - return *a == 1; -} - -static int secp256k1_scalar_is_high(const secp256k1_scalar *a) { - return *a > EXHAUSTIVE_TEST_ORDER / 2; -} - -static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) { - if (flag) secp256k1_scalar_negate(r, r); - return flag ? -1 : 1; -} - -static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) { - *r = (*a * *b) % EXHAUSTIVE_TEST_ORDER; -} - -static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) { - int ret; - VERIFY_CHECK(n > 0); - VERIFY_CHECK(n < 16); - ret = *r & ((1 << n) - 1); - *r >>= n; - return ret; -} - -static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) { - *r = (*a * *a) % EXHAUSTIVE_TEST_ORDER; -} - -static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) { - *r1 = *a; - *r2 = 0; -} - -SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) { - return *a == *b; -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c deleted file mode 100755 index 7d637bfa..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/secp256k1.c +++ /dev/null @@ -1,559 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#include "include/secp256k1.h" - -#include "util.h" -#include "num_impl.h" -#include "field_impl.h" -#include "scalar_impl.h" -#include "group_impl.h" -#include "ecmult_impl.h" -#include "ecmult_const_impl.h" -#include "ecmult_gen_impl.h" -#include "ecdsa_impl.h" -#include "eckey_impl.h" -#include "hash_impl.h" - -#define ARG_CHECK(cond) do { \ - if (EXPECT(!(cond), 0)) { \ - secp256k1_callback_call(&ctx->illegal_callback, #cond); \ - return 0; \ - } \ -} while(0) - -static void default_illegal_callback_fn(const char* str, void* data) { - fprintf(stderr, "[libsecp256k1] illegal argument: %s\n", str); - abort(); -} - -static const secp256k1_callback default_illegal_callback = { - default_illegal_callback_fn, - NULL -}; - -static void default_error_callback_fn(const char* str, void* data) { - fprintf(stderr, "[libsecp256k1] internal consistency check failed: %s\n", str); - abort(); -} - -static const secp256k1_callback default_error_callback = { - default_error_callback_fn, - NULL -}; - - -struct secp256k1_context_struct { - secp256k1_ecmult_context ecmult_ctx; - secp256k1_ecmult_gen_context ecmult_gen_ctx; - secp256k1_callback illegal_callback; - secp256k1_callback error_callback; -}; - -secp256k1_context* secp256k1_context_create(unsigned int flags) { - secp256k1_context* ret = (secp256k1_context*)checked_malloc(&default_error_callback, sizeof(secp256k1_context)); - ret->illegal_callback = default_illegal_callback; - ret->error_callback = default_error_callback; - - if (EXPECT((flags & SECP256K1_FLAGS_TYPE_MASK) != SECP256K1_FLAGS_TYPE_CONTEXT, 0)) { - secp256k1_callback_call(&ret->illegal_callback, - "Invalid flags"); - free(ret); - return NULL; - } - - secp256k1_ecmult_context_init(&ret->ecmult_ctx); - secp256k1_ecmult_gen_context_init(&ret->ecmult_gen_ctx); - - if (flags & SECP256K1_FLAGS_BIT_CONTEXT_SIGN) { - secp256k1_ecmult_gen_context_build(&ret->ecmult_gen_ctx, &ret->error_callback); - } - if (flags & SECP256K1_FLAGS_BIT_CONTEXT_VERIFY) { - secp256k1_ecmult_context_build(&ret->ecmult_ctx, &ret->error_callback); - } - - return ret; -} - -secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) { - secp256k1_context* ret = (secp256k1_context*)checked_malloc(&ctx->error_callback, sizeof(secp256k1_context)); - ret->illegal_callback = ctx->illegal_callback; - ret->error_callback = ctx->error_callback; - secp256k1_ecmult_context_clone(&ret->ecmult_ctx, &ctx->ecmult_ctx, &ctx->error_callback); - secp256k1_ecmult_gen_context_clone(&ret->ecmult_gen_ctx, &ctx->ecmult_gen_ctx, &ctx->error_callback); - return ret; -} - -void secp256k1_context_destroy(secp256k1_context* ctx) { - if (ctx != NULL) { - secp256k1_ecmult_context_clear(&ctx->ecmult_ctx); - secp256k1_ecmult_gen_context_clear(&ctx->ecmult_gen_ctx); - - free(ctx); - } -} - -void secp256k1_context_set_illegal_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) { - if (fun == NULL) { - fun = default_illegal_callback_fn; - } - ctx->illegal_callback.fn = fun; - ctx->illegal_callback.data = data; -} - -void secp256k1_context_set_error_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) { - if (fun == NULL) { - fun = default_error_callback_fn; - } - ctx->error_callback.fn = fun; - ctx->error_callback.data = data; -} - -static int secp256k1_pubkey_load(const secp256k1_context* ctx, secp256k1_ge* ge, const secp256k1_pubkey* pubkey) { - if (sizeof(secp256k1_ge_storage) == 64) { - /* When the secp256k1_ge_storage type is exactly 64 byte, use its - * representation inside secp256k1_pubkey, as conversion is very fast. - * Note that secp256k1_pubkey_save must use the same representation. */ - secp256k1_ge_storage s; - memcpy(&s, &pubkey->data[0], 64); - secp256k1_ge_from_storage(ge, &s); - } else { - /* Otherwise, fall back to 32-byte big endian for X and Y. */ - secp256k1_fe x, y; - secp256k1_fe_set_b32(&x, pubkey->data); - secp256k1_fe_set_b32(&y, pubkey->data + 32); - secp256k1_ge_set_xy(ge, &x, &y); - } - ARG_CHECK(!secp256k1_fe_is_zero(&ge->x)); - return 1; -} - -static void secp256k1_pubkey_save(secp256k1_pubkey* pubkey, secp256k1_ge* ge) { - if (sizeof(secp256k1_ge_storage) == 64) { - secp256k1_ge_storage s; - secp256k1_ge_to_storage(&s, ge); - memcpy(&pubkey->data[0], &s, 64); - } else { - VERIFY_CHECK(!secp256k1_ge_is_infinity(ge)); - secp256k1_fe_normalize_var(&ge->x); - secp256k1_fe_normalize_var(&ge->y); - secp256k1_fe_get_b32(pubkey->data, &ge->x); - secp256k1_fe_get_b32(pubkey->data + 32, &ge->y); - } -} - -int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pubkey, const unsigned char *input, size_t inputlen) { - secp256k1_ge Q; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(pubkey != NULL); - memset(pubkey, 0, sizeof(*pubkey)); - ARG_CHECK(input != NULL); - if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) { - return 0; - } - secp256k1_pubkey_save(pubkey, &Q); - secp256k1_ge_clear(&Q); - return 1; -} - -int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_pubkey* pubkey, unsigned int flags) { - secp256k1_ge Q; - size_t len; - int ret = 0; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(outputlen != NULL); - ARG_CHECK(*outputlen >= ((flags & SECP256K1_FLAGS_BIT_COMPRESSION) ? 33 : 65)); - len = *outputlen; - *outputlen = 0; - ARG_CHECK(output != NULL); - memset(output, 0, len); - ARG_CHECK(pubkey != NULL); - ARG_CHECK((flags & SECP256K1_FLAGS_TYPE_MASK) == SECP256K1_FLAGS_TYPE_COMPRESSION); - if (secp256k1_pubkey_load(ctx, &Q, pubkey)) { - ret = secp256k1_eckey_pubkey_serialize(&Q, output, &len, flags & SECP256K1_FLAGS_BIT_COMPRESSION); - if (ret) { - *outputlen = len; - } - } - return ret; -} - -static void secp256k1_ecdsa_signature_load(const secp256k1_context* ctx, secp256k1_scalar* r, secp256k1_scalar* s, const secp256k1_ecdsa_signature* sig) { - (void)ctx; - if (sizeof(secp256k1_scalar) == 32) { - /* When the secp256k1_scalar type is exactly 32 byte, use its - * representation inside secp256k1_ecdsa_signature, as conversion is very fast. - * Note that secp256k1_ecdsa_signature_save must use the same representation. */ - memcpy(r, &sig->data[0], 32); - memcpy(s, &sig->data[32], 32); - } else { - secp256k1_scalar_set_b32(r, &sig->data[0], NULL); - secp256k1_scalar_set_b32(s, &sig->data[32], NULL); - } -} - -static void secp256k1_ecdsa_signature_save(secp256k1_ecdsa_signature* sig, const secp256k1_scalar* r, const secp256k1_scalar* s) { - if (sizeof(secp256k1_scalar) == 32) { - memcpy(&sig->data[0], r, 32); - memcpy(&sig->data[32], s, 32); - } else { - secp256k1_scalar_get_b32(&sig->data[0], r); - secp256k1_scalar_get_b32(&sig->data[32], s); - } -} - -int secp256k1_ecdsa_signature_parse_der(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) { - secp256k1_scalar r, s; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(input != NULL); - - if (secp256k1_ecdsa_sig_parse(&r, &s, input, inputlen)) { - secp256k1_ecdsa_signature_save(sig, &r, &s); - return 1; - } else { - memset(sig, 0, sizeof(*sig)); - return 0; - } -} - -int secp256k1_ecdsa_signature_parse_compact(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input64) { - secp256k1_scalar r, s; - int ret = 1; - int overflow = 0; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(input64 != NULL); - - secp256k1_scalar_set_b32(&r, &input64[0], &overflow); - ret &= !overflow; - secp256k1_scalar_set_b32(&s, &input64[32], &overflow); - ret &= !overflow; - if (ret) { - secp256k1_ecdsa_signature_save(sig, &r, &s); - } else { - memset(sig, 0, sizeof(*sig)); - } - return ret; -} - -int secp256k1_ecdsa_signature_serialize_der(const secp256k1_context* ctx, unsigned char *output, size_t *outputlen, const secp256k1_ecdsa_signature* sig) { - secp256k1_scalar r, s; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(output != NULL); - ARG_CHECK(outputlen != NULL); - ARG_CHECK(sig != NULL); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, sig); - return secp256k1_ecdsa_sig_serialize(output, outputlen, &r, &s); -} - -int secp256k1_ecdsa_signature_serialize_compact(const secp256k1_context* ctx, unsigned char *output64, const secp256k1_ecdsa_signature* sig) { - secp256k1_scalar r, s; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(output64 != NULL); - ARG_CHECK(sig != NULL); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, sig); - secp256k1_scalar_get_b32(&output64[0], &r); - secp256k1_scalar_get_b32(&output64[32], &s); - return 1; -} - -int secp256k1_ecdsa_signature_normalize(const secp256k1_context* ctx, secp256k1_ecdsa_signature *sigout, const secp256k1_ecdsa_signature *sigin) { - secp256k1_scalar r, s; - int ret = 0; - - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(sigin != NULL); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, sigin); - ret = secp256k1_scalar_is_high(&s); - if (sigout != NULL) { - if (ret) { - secp256k1_scalar_negate(&s, &s); - } - secp256k1_ecdsa_signature_save(sigout, &r, &s); - } - - return ret; -} - -int secp256k1_ecdsa_verify(const secp256k1_context* ctx, const secp256k1_ecdsa_signature *sig, const unsigned char *msg32, const secp256k1_pubkey *pubkey) { - secp256k1_ge q; - secp256k1_scalar r, s; - secp256k1_scalar m; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(sig != NULL); - ARG_CHECK(pubkey != NULL); - - secp256k1_scalar_set_b32(&m, msg32, NULL); - secp256k1_ecdsa_signature_load(ctx, &r, &s, sig); - return (!secp256k1_scalar_is_high(&s) && - secp256k1_pubkey_load(ctx, &q, pubkey) && - secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &r, &s, &q, &m)); -} - -static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - unsigned char keydata[112]; - int keylen = 64; - secp256k1_rfc6979_hmac_sha256_t rng; - unsigned int i; - /* We feed a byte array to the PRNG as input, consisting of: - * - the private key (32 bytes) and message (32 bytes), see RFC 6979 3.2d. - * - optionally 32 extra bytes of data, see RFC 6979 3.6 Additional Data. - * - optionally 16 extra bytes with the algorithm name. - * Because the arguments have distinct fixed lengths it is not possible for - * different argument mixtures to emulate each other and result in the same - * nonces. - */ - memcpy(keydata, key32, 32); - memcpy(keydata + 32, msg32, 32); - if (data != NULL) { - memcpy(keydata + 64, data, 32); - keylen = 96; - } - if (algo16 != NULL) { - memcpy(keydata + keylen, algo16, 16); - keylen += 16; - } - secp256k1_rfc6979_hmac_sha256_initialize(&rng, keydata, keylen); - memset(keydata, 0, sizeof(keydata)); - for (i = 0; i <= counter; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, nonce32, 32); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - return 1; -} - -const secp256k1_nonce_function secp256k1_nonce_function_rfc6979 = nonce_function_rfc6979; -const secp256k1_nonce_function secp256k1_nonce_function_default = nonce_function_rfc6979; - -int secp256k1_ecdsa_sign(const secp256k1_context* ctx, secp256k1_ecdsa_signature *signature, const unsigned char *msg32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) { - secp256k1_scalar r, s; - secp256k1_scalar sec, non, msg; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - ARG_CHECK(msg32 != NULL); - ARG_CHECK(signature != NULL); - ARG_CHECK(seckey != NULL); - if (noncefp == NULL) { - noncefp = secp256k1_nonce_function_default; - } - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - /* Fail if the secret key is invalid. */ - if (!overflow && !secp256k1_scalar_is_zero(&sec)) { - unsigned char nonce32[32]; - unsigned int count = 0; - secp256k1_scalar_set_b32(&msg, msg32, NULL); - while (1) { - ret = noncefp(nonce32, msg32, seckey, NULL, (void*)noncedata, count); - if (!ret) { - break; - } - secp256k1_scalar_set_b32(&non, nonce32, &overflow); - if (!overflow && !secp256k1_scalar_is_zero(&non)) { - if (secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, &r, &s, &sec, &msg, &non, NULL)) { - break; - } - } - count++; - } - memset(nonce32, 0, 32); - secp256k1_scalar_clear(&msg); - secp256k1_scalar_clear(&non); - secp256k1_scalar_clear(&sec); - } - if (ret) { - secp256k1_ecdsa_signature_save(signature, &r, &s); - } else { - memset(signature, 0, sizeof(*signature)); - } - return ret; -} - -int secp256k1_ec_seckey_verify(const secp256k1_context* ctx, const unsigned char *seckey) { - secp256k1_scalar sec; - int ret; - int overflow; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(seckey != NULL); - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - ret = !overflow && !secp256k1_scalar_is_zero(&sec); - secp256k1_scalar_clear(&sec); - return ret; -} - -int secp256k1_ec_pubkey_create(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *seckey) { - secp256k1_gej pj; - secp256k1_ge p; - secp256k1_scalar sec; - int overflow; - int ret = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(pubkey != NULL); - memset(pubkey, 0, sizeof(*pubkey)); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - ARG_CHECK(seckey != NULL); - - secp256k1_scalar_set_b32(&sec, seckey, &overflow); - ret = (!overflow) & (!secp256k1_scalar_is_zero(&sec)); - if (ret) { - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pj, &sec); - secp256k1_ge_set_gej(&p, &pj); - secp256k1_pubkey_save(pubkey, &p); - } - secp256k1_scalar_clear(&sec); - return ret; -} - -int secp256k1_ec_privkey_tweak_add(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak) { - secp256k1_scalar term; - secp256k1_scalar sec; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(seckey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&term, tweak, &overflow); - secp256k1_scalar_set_b32(&sec, seckey, NULL); - - ret = !overflow && secp256k1_eckey_privkey_tweak_add(&sec, &term); - memset(seckey, 0, 32); - if (ret) { - secp256k1_scalar_get_b32(seckey, &sec); - } - - secp256k1_scalar_clear(&sec); - secp256k1_scalar_clear(&term); - return ret; -} - -int secp256k1_ec_pubkey_tweak_add(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak) { - secp256k1_ge p; - secp256k1_scalar term; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(pubkey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&term, tweak, &overflow); - ret = !overflow && secp256k1_pubkey_load(ctx, &p, pubkey); - memset(pubkey, 0, sizeof(*pubkey)); - if (ret) { - if (secp256k1_eckey_pubkey_tweak_add(&ctx->ecmult_ctx, &p, &term)) { - secp256k1_pubkey_save(pubkey, &p); - } else { - ret = 0; - } - } - - return ret; -} - -int secp256k1_ec_privkey_tweak_mul(const secp256k1_context* ctx, unsigned char *seckey, const unsigned char *tweak) { - secp256k1_scalar factor; - secp256k1_scalar sec; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(seckey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&factor, tweak, &overflow); - secp256k1_scalar_set_b32(&sec, seckey, NULL); - ret = !overflow && secp256k1_eckey_privkey_tweak_mul(&sec, &factor); - memset(seckey, 0, 32); - if (ret) { - secp256k1_scalar_get_b32(seckey, &sec); - } - - secp256k1_scalar_clear(&sec); - secp256k1_scalar_clear(&factor); - return ret; -} - -int secp256k1_ec_pubkey_tweak_mul(const secp256k1_context* ctx, secp256k1_pubkey *pubkey, const unsigned char *tweak) { - secp256k1_ge p; - secp256k1_scalar factor; - int ret = 0; - int overflow = 0; - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_context_is_built(&ctx->ecmult_ctx)); - ARG_CHECK(pubkey != NULL); - ARG_CHECK(tweak != NULL); - - secp256k1_scalar_set_b32(&factor, tweak, &overflow); - ret = !overflow && secp256k1_pubkey_load(ctx, &p, pubkey); - memset(pubkey, 0, sizeof(*pubkey)); - if (ret) { - if (secp256k1_eckey_pubkey_tweak_mul(&ctx->ecmult_ctx, &p, &factor)) { - secp256k1_pubkey_save(pubkey, &p); - } else { - ret = 0; - } - } - - return ret; -} - -int secp256k1_context_randomize(secp256k1_context* ctx, const unsigned char *seed32) { - VERIFY_CHECK(ctx != NULL); - ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, seed32); - return 1; -} - -int secp256k1_ec_pubkey_combine(const secp256k1_context* ctx, secp256k1_pubkey *pubnonce, const secp256k1_pubkey * const *pubnonces, size_t n) { - size_t i; - secp256k1_gej Qj; - secp256k1_ge Q; - - ARG_CHECK(pubnonce != NULL); - memset(pubnonce, 0, sizeof(*pubnonce)); - ARG_CHECK(n >= 1); - ARG_CHECK(pubnonces != NULL); - - secp256k1_gej_set_infinity(&Qj); - - for (i = 0; i < n; i++) { - secp256k1_pubkey_load(ctx, &Q, pubnonces[i]); - secp256k1_gej_add_ge(&Qj, &Qj, &Q); - } - if (secp256k1_gej_is_infinity(&Qj)) { - return 0; - } - secp256k1_ge_set_gej(&Q, &Qj); - secp256k1_pubkey_save(pubnonce, &Q); - return 1; -} - -#ifdef ENABLE_MODULE_ECDH -# include "modules/ecdh/main_impl.h" -#endif - -#ifdef ENABLE_MODULE_SCHNORR -# include "modules/schnorr/main_impl.h" -#endif - -#ifdef ENABLE_MODULE_RECOVERY -# include "modules/recovery/main_impl.h" -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h deleted file mode 100644 index f8efa93c..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand.h +++ /dev/null @@ -1,38 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_TESTRAND_H_ -#define _SECP256K1_TESTRAND_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -/* A non-cryptographic RNG used only for test infrastructure. */ - -/** Seed the pseudorandom number generator for testing. */ -SECP256K1_INLINE static void secp256k1_rand_seed(const unsigned char *seed16); - -/** Generate a pseudorandom number in the range [0..2**32-1]. */ -static uint32_t secp256k1_rand32(void); - -/** Generate a pseudorandom number in the range [0..2**bits-1]. Bits must be 1 or - * more. */ -static uint32_t secp256k1_rand_bits(int bits); - -/** Generate a pseudorandom number in the range [0..range-1]. */ -static uint32_t secp256k1_rand_int(uint32_t range); - -/** Generate a pseudorandom 32-byte array. */ -static void secp256k1_rand256(unsigned char *b32); - -/** Generate a pseudorandom 32-byte array with long sequences of zero and one bits. */ -static void secp256k1_rand256_test(unsigned char *b32); - -/** Generate pseudorandom bytes with long sequences of zero and one bits. */ -static void secp256k1_rand_bytes_test(unsigned char *bytes, size_t len); - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h deleted file mode 100644 index 15c7b9f1..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/testrand_impl.h +++ /dev/null @@ -1,110 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013-2015 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_TESTRAND_IMPL_H_ -#define _SECP256K1_TESTRAND_IMPL_H_ - -#include -#include - -#include "testrand.h" -#include "hash.h" - -static secp256k1_rfc6979_hmac_sha256_t secp256k1_test_rng; -static uint32_t secp256k1_test_rng_precomputed[8]; -static int secp256k1_test_rng_precomputed_used = 8; -static uint64_t secp256k1_test_rng_integer; -static int secp256k1_test_rng_integer_bits_left = 0; - -SECP256K1_INLINE static void secp256k1_rand_seed(const unsigned char *seed16) { - secp256k1_rfc6979_hmac_sha256_initialize(&secp256k1_test_rng, seed16, 16); -} - -SECP256K1_INLINE static uint32_t secp256k1_rand32(void) { - if (secp256k1_test_rng_precomputed_used == 8) { - secp256k1_rfc6979_hmac_sha256_generate(&secp256k1_test_rng, (unsigned char*)(&secp256k1_test_rng_precomputed[0]), sizeof(secp256k1_test_rng_precomputed)); - secp256k1_test_rng_precomputed_used = 0; - } - return secp256k1_test_rng_precomputed[secp256k1_test_rng_precomputed_used++]; -} - -static uint32_t secp256k1_rand_bits(int bits) { - uint32_t ret; - if (secp256k1_test_rng_integer_bits_left < bits) { - secp256k1_test_rng_integer |= (((uint64_t)secp256k1_rand32()) << secp256k1_test_rng_integer_bits_left); - secp256k1_test_rng_integer_bits_left += 32; - } - ret = secp256k1_test_rng_integer; - secp256k1_test_rng_integer >>= bits; - secp256k1_test_rng_integer_bits_left -= bits; - ret &= ((~((uint32_t)0)) >> (32 - bits)); - return ret; -} - -static uint32_t secp256k1_rand_int(uint32_t range) { - /* We want a uniform integer between 0 and range-1, inclusive. - * B is the smallest number such that range <= 2**B. - * two mechanisms implemented here: - * - generate B bits numbers until one below range is found, and return it - * - find the largest multiple M of range that is <= 2**(B+A), generate B+A - * bits numbers until one below M is found, and return it modulo range - * The second mechanism consumes A more bits of entropy in every iteration, - * but may need fewer iterations due to M being closer to 2**(B+A) then - * range is to 2**B. The array below (indexed by B) contains a 0 when the - * first mechanism is to be used, and the number A otherwise. - */ - static const int addbits[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0}; - uint32_t trange, mult; - int bits = 0; - if (range <= 1) { - return 0; - } - trange = range - 1; - while (trange > 0) { - trange >>= 1; - bits++; - } - if (addbits[bits]) { - bits = bits + addbits[bits]; - mult = ((~((uint32_t)0)) >> (32 - bits)) / range; - trange = range * mult; - } else { - trange = range; - mult = 1; - } - while(1) { - uint32_t x = secp256k1_rand_bits(bits); - if (x < trange) { - return (mult == 1) ? x : (x % range); - } - } -} - -static void secp256k1_rand256(unsigned char *b32) { - secp256k1_rfc6979_hmac_sha256_generate(&secp256k1_test_rng, b32, 32); -} - -static void secp256k1_rand_bytes_test(unsigned char *bytes, size_t len) { - size_t bits = 0; - memset(bytes, 0, len); - while (bits < len * 8) { - int now; - uint32_t val; - now = 1 + (secp256k1_rand_bits(6) * secp256k1_rand_bits(5) + 16) / 31; - val = secp256k1_rand_bits(1); - while (now > 0 && bits < len * 8) { - bytes[bits / 8] |= val << (bits % 8); - now--; - bits++; - } - } -} - -static void secp256k1_rand256_test(unsigned char *b32) { - secp256k1_rand_bytes_test(b32, 32); -} - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c deleted file mode 100644 index 9ae7d302..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests.c +++ /dev/null @@ -1,4525 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014, 2015 Pieter Wuille, Gregory Maxwell * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include -#include - -#include - -#include "secp256k1.c" -#include "include/secp256k1.h" -#include "testrand_impl.h" - -#ifdef ENABLE_OPENSSL_TESTS -#include "openssl/bn.h" -#include "openssl/ec.h" -#include "openssl/ecdsa.h" -#include "openssl/obj_mac.h" -#endif - -#include "contrib/lax_der_parsing.c" -#include "contrib/lax_der_privatekey_parsing.c" - -#if !defined(VG_CHECK) -# if defined(VALGRIND) -# include -# define VG_UNDEF(x,y) VALGRIND_MAKE_MEM_UNDEFINED((x),(y)) -# define VG_CHECK(x,y) VALGRIND_CHECK_MEM_IS_DEFINED((x),(y)) -# else -# define VG_UNDEF(x,y) -# define VG_CHECK(x,y) -# endif -#endif - -static int count = 64; -static secp256k1_context *ctx = NULL; - -static void counting_illegal_callback_fn(const char* str, void* data) { - /* Dummy callback function that just counts. */ - int32_t *p; - (void)str; - p = data; - (*p)++; -} - -static void uncounting_illegal_callback_fn(const char* str, void* data) { - /* Dummy callback function that just counts (backwards). */ - int32_t *p; - (void)str; - p = data; - (*p)--; -} - -void random_field_element_test(secp256k1_fe *fe) { - do { - unsigned char b32[32]; - secp256k1_rand256_test(b32); - if (secp256k1_fe_set_b32(fe, b32)) { - break; - } - } while(1); -} - -void random_field_element_magnitude(secp256k1_fe *fe) { - secp256k1_fe zero; - int n = secp256k1_rand_int(9); - secp256k1_fe_normalize(fe); - if (n == 0) { - return; - } - secp256k1_fe_clear(&zero); - secp256k1_fe_negate(&zero, &zero, 0); - secp256k1_fe_mul_int(&zero, n - 1); - secp256k1_fe_add(fe, &zero); - VERIFY_CHECK(fe->magnitude == n); -} - -void random_group_element_test(secp256k1_ge *ge) { - secp256k1_fe fe; - do { - random_field_element_test(&fe); - if (secp256k1_ge_set_xo_var(ge, &fe, secp256k1_rand_bits(1))) { - secp256k1_fe_normalize(&ge->y); - break; - } - } while(1); -} - -void random_group_element_jacobian_test(secp256k1_gej *gej, const secp256k1_ge *ge) { - secp256k1_fe z2, z3; - do { - random_field_element_test(&gej->z); - if (!secp256k1_fe_is_zero(&gej->z)) { - break; - } - } while(1); - secp256k1_fe_sqr(&z2, &gej->z); - secp256k1_fe_mul(&z3, &z2, &gej->z); - secp256k1_fe_mul(&gej->x, &ge->x, &z2); - secp256k1_fe_mul(&gej->y, &ge->y, &z3); - gej->infinity = ge->infinity; -} - -void random_scalar_order_test(secp256k1_scalar *num) { - do { - unsigned char b32[32]; - int overflow = 0; - secp256k1_rand256_test(b32); - secp256k1_scalar_set_b32(num, b32, &overflow); - if (overflow || secp256k1_scalar_is_zero(num)) { - continue; - } - break; - } while(1); -} - -void random_scalar_order(secp256k1_scalar *num) { - do { - unsigned char b32[32]; - int overflow = 0; - secp256k1_rand256(b32); - secp256k1_scalar_set_b32(num, b32, &overflow); - if (overflow || secp256k1_scalar_is_zero(num)) { - continue; - } - break; - } while(1); -} - -void run_context_tests(void) { - secp256k1_pubkey pubkey; - secp256k1_ecdsa_signature sig; - unsigned char ctmp[32]; - int32_t ecount; - int32_t ecount2; - secp256k1_context *none = secp256k1_context_create(SECP256K1_CONTEXT_NONE); - secp256k1_context *sign = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); - secp256k1_context *vrfy = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY); - secp256k1_context *both = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - secp256k1_gej pubj; - secp256k1_ge pub; - secp256k1_scalar msg, key, nonce; - secp256k1_scalar sigr, sigs; - - ecount = 0; - ecount2 = 10; - secp256k1_context_set_illegal_callback(vrfy, counting_illegal_callback_fn, &ecount); - secp256k1_context_set_illegal_callback(sign, counting_illegal_callback_fn, &ecount2); - secp256k1_context_set_error_callback(sign, counting_illegal_callback_fn, NULL); - CHECK(vrfy->error_callback.fn != sign->error_callback.fn); - - /*** clone and destroy all of them to make sure cloning was complete ***/ - { - secp256k1_context *ctx_tmp; - - ctx_tmp = none; none = secp256k1_context_clone(none); secp256k1_context_destroy(ctx_tmp); - ctx_tmp = sign; sign = secp256k1_context_clone(sign); secp256k1_context_destroy(ctx_tmp); - ctx_tmp = vrfy; vrfy = secp256k1_context_clone(vrfy); secp256k1_context_destroy(ctx_tmp); - ctx_tmp = both; both = secp256k1_context_clone(both); secp256k1_context_destroy(ctx_tmp); - } - - /* Verify that the error callback makes it across the clone. */ - CHECK(vrfy->error_callback.fn != sign->error_callback.fn); - /* And that it resets back to default. */ - secp256k1_context_set_error_callback(sign, NULL, NULL); - CHECK(vrfy->error_callback.fn == sign->error_callback.fn); - - /*** attempt to use them ***/ - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_ecmult_gen(&both->ecmult_gen_ctx, &pubj, &key); - secp256k1_ge_set_gej(&pub, &pubj); - - /* Verify context-type checking illegal-argument errors. */ - memset(ctmp, 1, 32); - CHECK(secp256k1_ec_pubkey_create(vrfy, &pubkey, ctmp) == 0); - CHECK(ecount == 1); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(sign, &pubkey, ctmp) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ecdsa_sign(vrfy, &sig, ctmp, ctmp, NULL, NULL) == 0); - CHECK(ecount == 2); - VG_UNDEF(&sig, sizeof(sig)); - CHECK(secp256k1_ecdsa_sign(sign, &sig, ctmp, ctmp, NULL, NULL) == 1); - VG_CHECK(&sig, sizeof(sig)); - CHECK(ecount2 == 10); - CHECK(secp256k1_ecdsa_verify(sign, &sig, ctmp, &pubkey) == 0); - CHECK(ecount2 == 11); - CHECK(secp256k1_ecdsa_verify(vrfy, &sig, ctmp, &pubkey) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ec_pubkey_tweak_add(sign, &pubkey, ctmp) == 0); - CHECK(ecount2 == 12); - CHECK(secp256k1_ec_pubkey_tweak_add(vrfy, &pubkey, ctmp) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_ec_pubkey_tweak_mul(sign, &pubkey, ctmp) == 0); - CHECK(ecount2 == 13); - CHECK(secp256k1_ec_pubkey_tweak_mul(vrfy, &pubkey, ctmp) == 1); - CHECK(ecount == 2); - CHECK(secp256k1_context_randomize(vrfy, ctmp) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_context_randomize(sign, NULL) == 1); - CHECK(ecount2 == 13); - secp256k1_context_set_illegal_callback(vrfy, NULL, NULL); - secp256k1_context_set_illegal_callback(sign, NULL, NULL); - - /* This shouldn't leak memory, due to already-set tests. */ - secp256k1_ecmult_gen_context_build(&sign->ecmult_gen_ctx, NULL); - secp256k1_ecmult_context_build(&vrfy->ecmult_ctx, NULL); - - /* obtain a working nonce */ - do { - random_scalar_order_test(&nonce); - } while(!secp256k1_ecdsa_sig_sign(&both->ecmult_gen_ctx, &sigr, &sigs, &key, &msg, &nonce, NULL)); - - /* try signing */ - CHECK(secp256k1_ecdsa_sig_sign(&sign->ecmult_gen_ctx, &sigr, &sigs, &key, &msg, &nonce, NULL)); - CHECK(secp256k1_ecdsa_sig_sign(&both->ecmult_gen_ctx, &sigr, &sigs, &key, &msg, &nonce, NULL)); - - /* try verifying */ - CHECK(secp256k1_ecdsa_sig_verify(&vrfy->ecmult_ctx, &sigr, &sigs, &pub, &msg)); - CHECK(secp256k1_ecdsa_sig_verify(&both->ecmult_ctx, &sigr, &sigs, &pub, &msg)); - - /* cleanup */ - secp256k1_context_destroy(none); - secp256k1_context_destroy(sign); - secp256k1_context_destroy(vrfy); - secp256k1_context_destroy(both); - /* Defined as no-op. */ - secp256k1_context_destroy(NULL); -} - -/***** HASH TESTS *****/ - -void run_sha256_tests(void) { - static const char *inputs[8] = { - "", "abc", "message digest", "secure hash algorithm", "SHA256 is considered to be safe", - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - "For this sample, this 63-byte string will be used as input data", - "This is exactly 64 bytes long, not counting the terminating byte" - }; - static const unsigned char outputs[8][32] = { - {0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}, - {0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad}, - {0xf7, 0x84, 0x6f, 0x55, 0xcf, 0x23, 0xe1, 0x4e, 0xeb, 0xea, 0xb5, 0xb4, 0xe1, 0x55, 0x0c, 0xad, 0x5b, 0x50, 0x9e, 0x33, 0x48, 0xfb, 0xc4, 0xef, 0xa3, 0xa1, 0x41, 0x3d, 0x39, 0x3c, 0xb6, 0x50}, - {0xf3, 0x0c, 0xeb, 0x2b, 0xb2, 0x82, 0x9e, 0x79, 0xe4, 0xca, 0x97, 0x53, 0xd3, 0x5a, 0x8e, 0xcc, 0x00, 0x26, 0x2d, 0x16, 0x4c, 0xc0, 0x77, 0x08, 0x02, 0x95, 0x38, 0x1c, 0xbd, 0x64, 0x3f, 0x0d}, - {0x68, 0x19, 0xd9, 0x15, 0xc7, 0x3f, 0x4d, 0x1e, 0x77, 0xe4, 0xe1, 0xb5, 0x2d, 0x1f, 0xa0, 0xf9, 0xcf, 0x9b, 0xea, 0xea, 0xd3, 0x93, 0x9f, 0x15, 0x87, 0x4b, 0xd9, 0x88, 0xe2, 0xa2, 0x36, 0x30}, - {0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1}, - {0xf0, 0x8a, 0x78, 0xcb, 0xba, 0xee, 0x08, 0x2b, 0x05, 0x2a, 0xe0, 0x70, 0x8f, 0x32, 0xfa, 0x1e, 0x50, 0xc5, 0xc4, 0x21, 0xaa, 0x77, 0x2b, 0xa5, 0xdb, 0xb4, 0x06, 0xa2, 0xea, 0x6b, 0xe3, 0x42}, - {0xab, 0x64, 0xef, 0xf7, 0xe8, 0x8e, 0x2e, 0x46, 0x16, 0x5e, 0x29, 0xf2, 0xbc, 0xe4, 0x18, 0x26, 0xbd, 0x4c, 0x7b, 0x35, 0x52, 0xf6, 0xb3, 0x82, 0xa9, 0xe7, 0xd3, 0xaf, 0x47, 0xc2, 0x45, 0xf8} - }; - int i; - for (i = 0; i < 8; i++) { - unsigned char out[32]; - secp256k1_sha256_t hasher; - secp256k1_sha256_initialize(&hasher); - secp256k1_sha256_write(&hasher, (const unsigned char*)(inputs[i]), strlen(inputs[i])); - secp256k1_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - if (strlen(inputs[i]) > 0) { - int split = secp256k1_rand_int(strlen(inputs[i])); - secp256k1_sha256_initialize(&hasher); - secp256k1_sha256_write(&hasher, (const unsigned char*)(inputs[i]), split); - secp256k1_sha256_write(&hasher, (const unsigned char*)(inputs[i] + split), strlen(inputs[i]) - split); - secp256k1_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - } - } -} - -void run_hmac_sha256_tests(void) { - static const char *keys[6] = { - "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b", - "\x4a\x65\x66\x65", - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19", - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", - "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa" - }; - static const char *inputs[6] = { - "\x48\x69\x20\x54\x68\x65\x72\x65", - "\x77\x68\x61\x74\x20\x64\x6f\x20\x79\x61\x20\x77\x61\x6e\x74\x20\x66\x6f\x72\x20\x6e\x6f\x74\x68\x69\x6e\x67\x3f", - "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd", - "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd", - "\x54\x65\x73\x74\x20\x55\x73\x69\x6e\x67\x20\x4c\x61\x72\x67\x65\x72\x20\x54\x68\x61\x6e\x20\x42\x6c\x6f\x63\x6b\x2d\x53\x69\x7a\x65\x20\x4b\x65\x79\x20\x2d\x20\x48\x61\x73\x68\x20\x4b\x65\x79\x20\x46\x69\x72\x73\x74", - "\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x74\x65\x73\x74\x20\x75\x73\x69\x6e\x67\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65\x20\x6b\x65\x79\x20\x61\x6e\x64\x20\x61\x20\x6c\x61\x72\x67\x65\x72\x20\x74\x68\x61\x6e\x20\x62\x6c\x6f\x63\x6b\x2d\x73\x69\x7a\x65\x20\x64\x61\x74\x61\x2e\x20\x54\x68\x65\x20\x6b\x65\x79\x20\x6e\x65\x65\x64\x73\x20\x74\x6f\x20\x62\x65\x20\x68\x61\x73\x68\x65\x64\x20\x62\x65\x66\x6f\x72\x65\x20\x62\x65\x69\x6e\x67\x20\x75\x73\x65\x64\x20\x62\x79\x20\x74\x68\x65\x20\x48\x4d\x41\x43\x20\x61\x6c\x67\x6f\x72\x69\x74\x68\x6d\x2e" - }; - static const unsigned char outputs[6][32] = { - {0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b, 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7}, - {0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83, 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43}, - {0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46, 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7, 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8, 0xc1, 0x22, 0xd9, 0x63, 0x55, 0x14, 0xce, 0xd5, 0x65, 0xfe}, - {0x82, 0x55, 0x8a, 0x38, 0x9a, 0x44, 0x3c, 0x0e, 0xa4, 0xcc, 0x81, 0x98, 0x99, 0xf2, 0x08, 0x3a, 0x85, 0xf0, 0xfa, 0xa3, 0xe5, 0x78, 0xf8, 0x07, 0x7a, 0x2e, 0x3f, 0xf4, 0x67, 0x29, 0x66, 0x5b}, - {0x60, 0xe4, 0x31, 0x59, 0x1e, 0xe0, 0xb6, 0x7f, 0x0d, 0x8a, 0x26, 0xaa, 0xcb, 0xf5, 0xb7, 0x7f, 0x8e, 0x0b, 0xc6, 0x21, 0x37, 0x28, 0xc5, 0x14, 0x05, 0x46, 0x04, 0x0f, 0x0e, 0xe3, 0x7f, 0x54}, - {0x9b, 0x09, 0xff, 0xa7, 0x1b, 0x94, 0x2f, 0xcb, 0x27, 0x63, 0x5f, 0xbc, 0xd5, 0xb0, 0xe9, 0x44, 0xbf, 0xdc, 0x63, 0x64, 0x4f, 0x07, 0x13, 0x93, 0x8a, 0x7f, 0x51, 0x53, 0x5c, 0x3a, 0x35, 0xe2} - }; - int i; - for (i = 0; i < 6; i++) { - secp256k1_hmac_sha256_t hasher; - unsigned char out[32]; - secp256k1_hmac_sha256_initialize(&hasher, (const unsigned char*)(keys[i]), strlen(keys[i])); - secp256k1_hmac_sha256_write(&hasher, (const unsigned char*)(inputs[i]), strlen(inputs[i])); - secp256k1_hmac_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - if (strlen(inputs[i]) > 0) { - int split = secp256k1_rand_int(strlen(inputs[i])); - secp256k1_hmac_sha256_initialize(&hasher, (const unsigned char*)(keys[i]), strlen(keys[i])); - secp256k1_hmac_sha256_write(&hasher, (const unsigned char*)(inputs[i]), split); - secp256k1_hmac_sha256_write(&hasher, (const unsigned char*)(inputs[i] + split), strlen(inputs[i]) - split); - secp256k1_hmac_sha256_finalize(&hasher, out); - CHECK(memcmp(out, outputs[i], 32) == 0); - } - } -} - -void run_rfc6979_hmac_sha256_tests(void) { - static const unsigned char key1[65] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x4b, 0xf5, 0x12, 0x2f, 0x34, 0x45, 0x54, 0xc5, 0x3b, 0xde, 0x2e, 0xbb, 0x8c, 0xd2, 0xb7, 0xe3, 0xd1, 0x60, 0x0a, 0xd6, 0x31, 0xc3, 0x85, 0xa5, 0xd7, 0xcc, 0xe2, 0x3c, 0x77, 0x85, 0x45, 0x9a, 0}; - static const unsigned char out1[3][32] = { - {0x4f, 0xe2, 0x95, 0x25, 0xb2, 0x08, 0x68, 0x09, 0x15, 0x9a, 0xcd, 0xf0, 0x50, 0x6e, 0xfb, 0x86, 0xb0, 0xec, 0x93, 0x2c, 0x7b, 0xa4, 0x42, 0x56, 0xab, 0x32, 0x1e, 0x42, 0x1e, 0x67, 0xe9, 0xfb}, - {0x2b, 0xf0, 0xff, 0xf1, 0xd3, 0xc3, 0x78, 0xa2, 0x2d, 0xc5, 0xde, 0x1d, 0x85, 0x65, 0x22, 0x32, 0x5c, 0x65, 0xb5, 0x04, 0x49, 0x1a, 0x0c, 0xbd, 0x01, 0xcb, 0x8f, 0x3a, 0xa6, 0x7f, 0xfd, 0x4a}, - {0xf5, 0x28, 0xb4, 0x10, 0xcb, 0x54, 0x1f, 0x77, 0x00, 0x0d, 0x7a, 0xfb, 0x6c, 0x5b, 0x53, 0xc5, 0xc4, 0x71, 0xea, 0xb4, 0x3e, 0x46, 0x6d, 0x9a, 0xc5, 0x19, 0x0c, 0x39, 0xc8, 0x2f, 0xd8, 0x2e} - }; - - static const unsigned char key2[64] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}; - static const unsigned char out2[3][32] = { - {0x9c, 0x23, 0x6c, 0x16, 0x5b, 0x82, 0xae, 0x0c, 0xd5, 0x90, 0x65, 0x9e, 0x10, 0x0b, 0x6b, 0xab, 0x30, 0x36, 0xe7, 0xba, 0x8b, 0x06, 0x74, 0x9b, 0xaf, 0x69, 0x81, 0xe1, 0x6f, 0x1a, 0x2b, 0x95}, - {0xdf, 0x47, 0x10, 0x61, 0x62, 0x5b, 0xc0, 0xea, 0x14, 0xb6, 0x82, 0xfe, 0xee, 0x2c, 0x9c, 0x02, 0xf2, 0x35, 0xda, 0x04, 0x20, 0x4c, 0x1d, 0x62, 0xa1, 0x53, 0x6c, 0x6e, 0x17, 0xae, 0xd7, 0xa9}, - {0x75, 0x97, 0x88, 0x7c, 0xbd, 0x76, 0x32, 0x1f, 0x32, 0xe3, 0x04, 0x40, 0x67, 0x9a, 0x22, 0xcf, 0x7f, 0x8d, 0x9d, 0x2e, 0xac, 0x39, 0x0e, 0x58, 0x1f, 0xea, 0x09, 0x1c, 0xe2, 0x02, 0xba, 0x94} - }; - - secp256k1_rfc6979_hmac_sha256_t rng; - unsigned char out[32]; - int i; - - secp256k1_rfc6979_hmac_sha256_initialize(&rng, key1, 64); - for (i = 0; i < 3; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, out, 32); - CHECK(memcmp(out, out1[i], 32) == 0); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - - secp256k1_rfc6979_hmac_sha256_initialize(&rng, key1, 65); - for (i = 0; i < 3; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, out, 32); - CHECK(memcmp(out, out1[i], 32) != 0); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); - - secp256k1_rfc6979_hmac_sha256_initialize(&rng, key2, 64); - for (i = 0; i < 3; i++) { - secp256k1_rfc6979_hmac_sha256_generate(&rng, out, 32); - CHECK(memcmp(out, out2[i], 32) == 0); - } - secp256k1_rfc6979_hmac_sha256_finalize(&rng); -} - -/***** RANDOM TESTS *****/ - -void test_rand_bits(int rand32, int bits) { - /* (1-1/2^B)^rounds[B] < 1/10^9, so rounds is the number of iterations to - * get a false negative chance below once in a billion */ - static const unsigned int rounds[7] = {1, 30, 73, 156, 322, 653, 1316}; - /* We try multiplying the results with various odd numbers, which shouldn't - * influence the uniform distribution modulo a power of 2. */ - static const uint32_t mults[6] = {1, 3, 21, 289, 0x9999, 0x80402011}; - /* We only select up to 6 bits from the output to analyse */ - unsigned int usebits = bits > 6 ? 6 : bits; - unsigned int maxshift = bits - usebits; - /* For each of the maxshift+1 usebits-bit sequences inside a bits-bit - number, track all observed outcomes, one per bit in a uint64_t. */ - uint64_t x[6][27] = {{0}}; - unsigned int i, shift, m; - /* Multiply the output of all rand calls with the odd number m, which - should not change the uniformity of its distribution. */ - for (i = 0; i < rounds[usebits]; i++) { - uint32_t r = (rand32 ? secp256k1_rand32() : secp256k1_rand_bits(bits)); - CHECK((((uint64_t)r) >> bits) == 0); - for (m = 0; m < sizeof(mults) / sizeof(mults[0]); m++) { - uint32_t rm = r * mults[m]; - for (shift = 0; shift <= maxshift; shift++) { - x[m][shift] |= (((uint64_t)1) << ((rm >> shift) & ((1 << usebits) - 1))); - } - } - } - for (m = 0; m < sizeof(mults) / sizeof(mults[0]); m++) { - for (shift = 0; shift <= maxshift; shift++) { - /* Test that the lower usebits bits of x[shift] are 1 */ - CHECK(((~x[m][shift]) << (64 - (1 << usebits))) == 0); - } - } -} - -/* Subrange must be a whole divisor of range, and at most 64 */ -void test_rand_int(uint32_t range, uint32_t subrange) { - /* (1-1/subrange)^rounds < 1/10^9 */ - int rounds = (subrange * 2073) / 100; - int i; - uint64_t x = 0; - CHECK((range % subrange) == 0); - for (i = 0; i < rounds; i++) { - uint32_t r = secp256k1_rand_int(range); - CHECK(r < range); - r = r % subrange; - x |= (((uint64_t)1) << r); - } - /* Test that the lower subrange bits of x are 1. */ - CHECK(((~x) << (64 - subrange)) == 0); -} - -void run_rand_bits(void) { - size_t b; - test_rand_bits(1, 32); - for (b = 1; b <= 32; b++) { - test_rand_bits(0, b); - } -} - -void run_rand_int(void) { - static const uint32_t ms[] = {1, 3, 17, 1000, 13771, 999999, 33554432}; - static const uint32_t ss[] = {1, 3, 6, 9, 13, 31, 64}; - unsigned int m, s; - for (m = 0; m < sizeof(ms) / sizeof(ms[0]); m++) { - for (s = 0; s < sizeof(ss) / sizeof(ss[0]); s++) { - test_rand_int(ms[m] * ss[s], ss[s]); - } - } -} - -/***** NUM TESTS *****/ - -#ifndef USE_NUM_NONE -void random_num_negate(secp256k1_num *num) { - if (secp256k1_rand_bits(1)) { - secp256k1_num_negate(num); - } -} - -void random_num_order_test(secp256k1_num *num) { - secp256k1_scalar sc; - random_scalar_order_test(&sc); - secp256k1_scalar_get_num(num, &sc); -} - -void random_num_order(secp256k1_num *num) { - secp256k1_scalar sc; - random_scalar_order(&sc); - secp256k1_scalar_get_num(num, &sc); -} - -void test_num_negate(void) { - secp256k1_num n1; - secp256k1_num n2; - random_num_order_test(&n1); /* n1 = R */ - random_num_negate(&n1); - secp256k1_num_copy(&n2, &n1); /* n2 = R */ - secp256k1_num_sub(&n1, &n2, &n1); /* n1 = n2-n1 = 0 */ - CHECK(secp256k1_num_is_zero(&n1)); - secp256k1_num_copy(&n1, &n2); /* n1 = R */ - secp256k1_num_negate(&n1); /* n1 = -R */ - CHECK(!secp256k1_num_is_zero(&n1)); - secp256k1_num_add(&n1, &n2, &n1); /* n1 = n2+n1 = 0 */ - CHECK(secp256k1_num_is_zero(&n1)); - secp256k1_num_copy(&n1, &n2); /* n1 = R */ - secp256k1_num_negate(&n1); /* n1 = -R */ - CHECK(secp256k1_num_is_neg(&n1) != secp256k1_num_is_neg(&n2)); - secp256k1_num_negate(&n1); /* n1 = R */ - CHECK(secp256k1_num_eq(&n1, &n2)); -} - -void test_num_add_sub(void) { - int i; - secp256k1_scalar s; - secp256k1_num n1; - secp256k1_num n2; - secp256k1_num n1p2, n2p1, n1m2, n2m1; - random_num_order_test(&n1); /* n1 = R1 */ - if (secp256k1_rand_bits(1)) { - random_num_negate(&n1); - } - random_num_order_test(&n2); /* n2 = R2 */ - if (secp256k1_rand_bits(1)) { - random_num_negate(&n2); - } - secp256k1_num_add(&n1p2, &n1, &n2); /* n1p2 = R1 + R2 */ - secp256k1_num_add(&n2p1, &n2, &n1); /* n2p1 = R2 + R1 */ - secp256k1_num_sub(&n1m2, &n1, &n2); /* n1m2 = R1 - R2 */ - secp256k1_num_sub(&n2m1, &n2, &n1); /* n2m1 = R2 - R1 */ - CHECK(secp256k1_num_eq(&n1p2, &n2p1)); - CHECK(!secp256k1_num_eq(&n1p2, &n1m2)); - secp256k1_num_negate(&n2m1); /* n2m1 = -R2 + R1 */ - CHECK(secp256k1_num_eq(&n2m1, &n1m2)); - CHECK(!secp256k1_num_eq(&n2m1, &n1)); - secp256k1_num_add(&n2m1, &n2m1, &n2); /* n2m1 = -R2 + R1 + R2 = R1 */ - CHECK(secp256k1_num_eq(&n2m1, &n1)); - CHECK(!secp256k1_num_eq(&n2p1, &n1)); - secp256k1_num_sub(&n2p1, &n2p1, &n2); /* n2p1 = R2 + R1 - R2 = R1 */ - CHECK(secp256k1_num_eq(&n2p1, &n1)); - - /* check is_one */ - secp256k1_scalar_set_int(&s, 1); - secp256k1_scalar_get_num(&n1, &s); - CHECK(secp256k1_num_is_one(&n1)); - /* check that 2^n + 1 is never 1 */ - secp256k1_scalar_get_num(&n2, &s); - for (i = 0; i < 250; ++i) { - secp256k1_num_add(&n1, &n1, &n1); /* n1 *= 2 */ - secp256k1_num_add(&n1p2, &n1, &n2); /* n1p2 = n1 + 1 */ - CHECK(!secp256k1_num_is_one(&n1p2)); - } -} - -void test_num_mod(void) { - int i; - secp256k1_scalar s; - secp256k1_num order, n; - - /* check that 0 mod anything is 0 */ - random_scalar_order_test(&s); - secp256k1_scalar_get_num(&order, &s); - secp256k1_scalar_set_int(&s, 0); - secp256k1_scalar_get_num(&n, &s); - secp256k1_num_mod(&n, &order); - CHECK(secp256k1_num_is_zero(&n)); - - /* check that anything mod 1 is 0 */ - secp256k1_scalar_set_int(&s, 1); - secp256k1_scalar_get_num(&order, &s); - secp256k1_scalar_get_num(&n, &s); - secp256k1_num_mod(&n, &order); - CHECK(secp256k1_num_is_zero(&n)); - - /* check that increasing the number past 2^256 does not break this */ - random_scalar_order_test(&s); - secp256k1_scalar_get_num(&n, &s); - /* multiply by 2^8, which'll test this case with high probability */ - for (i = 0; i < 8; ++i) { - secp256k1_num_add(&n, &n, &n); - } - secp256k1_num_mod(&n, &order); - CHECK(secp256k1_num_is_zero(&n)); -} - -void test_num_jacobi(void) { - secp256k1_scalar sqr; - secp256k1_scalar small; - secp256k1_scalar five; /* five is not a quadratic residue */ - secp256k1_num order, n; - int i; - /* squares mod 5 are 1, 4 */ - const int jacobi5[10] = { 0, 1, -1, -1, 1, 0, 1, -1, -1, 1 }; - - /* check some small values with 5 as the order */ - secp256k1_scalar_set_int(&five, 5); - secp256k1_scalar_get_num(&order, &five); - for (i = 0; i < 10; ++i) { - secp256k1_scalar_set_int(&small, i); - secp256k1_scalar_get_num(&n, &small); - CHECK(secp256k1_num_jacobi(&n, &order) == jacobi5[i]); - } - - /** test large values with 5 as group order */ - secp256k1_scalar_get_num(&order, &five); - /* we first need a scalar which is not a multiple of 5 */ - do { - secp256k1_num fiven; - random_scalar_order_test(&sqr); - secp256k1_scalar_get_num(&fiven, &five); - secp256k1_scalar_get_num(&n, &sqr); - secp256k1_num_mod(&n, &fiven); - } while (secp256k1_num_is_zero(&n)); - /* next force it to be a residue. 2 is a nonresidue mod 5 so we can - * just multiply by two, i.e. add the number to itself */ - if (secp256k1_num_jacobi(&n, &order) == -1) { - secp256k1_num_add(&n, &n, &n); - } - - /* test residue */ - CHECK(secp256k1_num_jacobi(&n, &order) == 1); - /* test nonresidue */ - secp256k1_num_add(&n, &n, &n); - CHECK(secp256k1_num_jacobi(&n, &order) == -1); - - /** test with secp group order as order */ - secp256k1_scalar_order_get_num(&order); - random_scalar_order_test(&sqr); - secp256k1_scalar_sqr(&sqr, &sqr); - /* test residue */ - secp256k1_scalar_get_num(&n, &sqr); - CHECK(secp256k1_num_jacobi(&n, &order) == 1); - /* test nonresidue */ - secp256k1_scalar_mul(&sqr, &sqr, &five); - secp256k1_scalar_get_num(&n, &sqr); - CHECK(secp256k1_num_jacobi(&n, &order) == -1); - /* test multiple of the order*/ - CHECK(secp256k1_num_jacobi(&order, &order) == 0); - - /* check one less than the order */ - secp256k1_scalar_set_int(&small, 1); - secp256k1_scalar_get_num(&n, &small); - secp256k1_num_sub(&n, &order, &n); - CHECK(secp256k1_num_jacobi(&n, &order) == 1); /* sage confirms this is 1 */ -} - -void run_num_smalltests(void) { - int i; - for (i = 0; i < 100*count; i++) { - test_num_negate(); - test_num_add_sub(); - test_num_mod(); - test_num_jacobi(); - } -} -#endif - -/***** SCALAR TESTS *****/ - -void scalar_test(void) { - secp256k1_scalar s; - secp256k1_scalar s1; - secp256k1_scalar s2; -#ifndef USE_NUM_NONE - secp256k1_num snum, s1num, s2num; - secp256k1_num order, half_order; -#endif - unsigned char c[32]; - - /* Set 's' to a random scalar, with value 'snum'. */ - random_scalar_order_test(&s); - - /* Set 's1' to a random scalar, with value 's1num'. */ - random_scalar_order_test(&s1); - - /* Set 's2' to a random scalar, with value 'snum2', and byte array representation 'c'. */ - random_scalar_order_test(&s2); - secp256k1_scalar_get_b32(c, &s2); - -#ifndef USE_NUM_NONE - secp256k1_scalar_get_num(&snum, &s); - secp256k1_scalar_get_num(&s1num, &s1); - secp256k1_scalar_get_num(&s2num, &s2); - - secp256k1_scalar_order_get_num(&order); - half_order = order; - secp256k1_num_shift(&half_order, 1); -#endif - - { - int i; - /* Test that fetching groups of 4 bits from a scalar and recursing n(i)=16*n(i-1)+p(i) reconstructs it. */ - secp256k1_scalar n; - secp256k1_scalar_set_int(&n, 0); - for (i = 0; i < 256; i += 4) { - secp256k1_scalar t; - int j; - secp256k1_scalar_set_int(&t, secp256k1_scalar_get_bits(&s, 256 - 4 - i, 4)); - for (j = 0; j < 4; j++) { - secp256k1_scalar_add(&n, &n, &n); - } - secp256k1_scalar_add(&n, &n, &t); - } - CHECK(secp256k1_scalar_eq(&n, &s)); - } - - { - /* Test that fetching groups of randomly-sized bits from a scalar and recursing n(i)=b*n(i-1)+p(i) reconstructs it. */ - secp256k1_scalar n; - int i = 0; - secp256k1_scalar_set_int(&n, 0); - while (i < 256) { - secp256k1_scalar t; - int j; - int now = secp256k1_rand_int(15) + 1; - if (now + i > 256) { - now = 256 - i; - } - secp256k1_scalar_set_int(&t, secp256k1_scalar_get_bits_var(&s, 256 - now - i, now)); - for (j = 0; j < now; j++) { - secp256k1_scalar_add(&n, &n, &n); - } - secp256k1_scalar_add(&n, &n, &t); - i += now; - } - CHECK(secp256k1_scalar_eq(&n, &s)); - } - -#ifndef USE_NUM_NONE - { - /* Test that adding the scalars together is equal to adding their numbers together modulo the order. */ - secp256k1_num rnum; - secp256k1_num r2num; - secp256k1_scalar r; - secp256k1_num_add(&rnum, &snum, &s2num); - secp256k1_num_mod(&rnum, &order); - secp256k1_scalar_add(&r, &s, &s2); - secp256k1_scalar_get_num(&r2num, &r); - CHECK(secp256k1_num_eq(&rnum, &r2num)); - } - - { - /* Test that multiplying the scalars is equal to multiplying their numbers modulo the order. */ - secp256k1_scalar r; - secp256k1_num r2num; - secp256k1_num rnum; - secp256k1_num_mul(&rnum, &snum, &s2num); - secp256k1_num_mod(&rnum, &order); - secp256k1_scalar_mul(&r, &s, &s2); - secp256k1_scalar_get_num(&r2num, &r); - CHECK(secp256k1_num_eq(&rnum, &r2num)); - /* The result can only be zero if at least one of the factors was zero. */ - CHECK(secp256k1_scalar_is_zero(&r) == (secp256k1_scalar_is_zero(&s) || secp256k1_scalar_is_zero(&s2))); - /* The results can only be equal to one of the factors if that factor was zero, or the other factor was one. */ - CHECK(secp256k1_num_eq(&rnum, &snum) == (secp256k1_scalar_is_zero(&s) || secp256k1_scalar_is_one(&s2))); - CHECK(secp256k1_num_eq(&rnum, &s2num) == (secp256k1_scalar_is_zero(&s2) || secp256k1_scalar_is_one(&s))); - } - - { - secp256k1_scalar neg; - secp256k1_num negnum; - secp256k1_num negnum2; - /* Check that comparison with zero matches comparison with zero on the number. */ - CHECK(secp256k1_num_is_zero(&snum) == secp256k1_scalar_is_zero(&s)); - /* Check that comparison with the half order is equal to testing for high scalar. */ - CHECK(secp256k1_scalar_is_high(&s) == (secp256k1_num_cmp(&snum, &half_order) > 0)); - secp256k1_scalar_negate(&neg, &s); - secp256k1_num_sub(&negnum, &order, &snum); - secp256k1_num_mod(&negnum, &order); - /* Check that comparison with the half order is equal to testing for high scalar after negation. */ - CHECK(secp256k1_scalar_is_high(&neg) == (secp256k1_num_cmp(&negnum, &half_order) > 0)); - /* Negating should change the high property, unless the value was already zero. */ - CHECK((secp256k1_scalar_is_high(&s) == secp256k1_scalar_is_high(&neg)) == secp256k1_scalar_is_zero(&s)); - secp256k1_scalar_get_num(&negnum2, &neg); - /* Negating a scalar should be equal to (order - n) mod order on the number. */ - CHECK(secp256k1_num_eq(&negnum, &negnum2)); - secp256k1_scalar_add(&neg, &neg, &s); - /* Adding a number to its negation should result in zero. */ - CHECK(secp256k1_scalar_is_zero(&neg)); - secp256k1_scalar_negate(&neg, &neg); - /* Negating zero should still result in zero. */ - CHECK(secp256k1_scalar_is_zero(&neg)); - } - - { - /* Test secp256k1_scalar_mul_shift_var. */ - secp256k1_scalar r; - secp256k1_num one; - secp256k1_num rnum; - secp256k1_num rnum2; - unsigned char cone[1] = {0x01}; - unsigned int shift = 256 + secp256k1_rand_int(257); - secp256k1_scalar_mul_shift_var(&r, &s1, &s2, shift); - secp256k1_num_mul(&rnum, &s1num, &s2num); - secp256k1_num_shift(&rnum, shift - 1); - secp256k1_num_set_bin(&one, cone, 1); - secp256k1_num_add(&rnum, &rnum, &one); - secp256k1_num_shift(&rnum, 1); - secp256k1_scalar_get_num(&rnum2, &r); - CHECK(secp256k1_num_eq(&rnum, &rnum2)); - } - - { - /* test secp256k1_scalar_shr_int */ - secp256k1_scalar r; - int i; - random_scalar_order_test(&r); - for (i = 0; i < 100; ++i) { - int low; - int shift = 1 + secp256k1_rand_int(15); - int expected = r.d[0] % (1 << shift); - low = secp256k1_scalar_shr_int(&r, shift); - CHECK(expected == low); - } - } -#endif - - { - /* Test that scalar inverses are equal to the inverse of their number modulo the order. */ - if (!secp256k1_scalar_is_zero(&s)) { - secp256k1_scalar inv; -#ifndef USE_NUM_NONE - secp256k1_num invnum; - secp256k1_num invnum2; -#endif - secp256k1_scalar_inverse(&inv, &s); -#ifndef USE_NUM_NONE - secp256k1_num_mod_inverse(&invnum, &snum, &order); - secp256k1_scalar_get_num(&invnum2, &inv); - CHECK(secp256k1_num_eq(&invnum, &invnum2)); -#endif - secp256k1_scalar_mul(&inv, &inv, &s); - /* Multiplying a scalar with its inverse must result in one. */ - CHECK(secp256k1_scalar_is_one(&inv)); - secp256k1_scalar_inverse(&inv, &inv); - /* Inverting one must result in one. */ - CHECK(secp256k1_scalar_is_one(&inv)); -#ifndef USE_NUM_NONE - secp256k1_scalar_get_num(&invnum, &inv); - CHECK(secp256k1_num_is_one(&invnum)); -#endif - } - } - - { - /* Test commutativity of add. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_add(&r1, &s1, &s2); - secp256k1_scalar_add(&r2, &s2, &s1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - secp256k1_scalar r1, r2; - secp256k1_scalar b; - int i; - /* Test add_bit. */ - int bit = secp256k1_rand_bits(8); - secp256k1_scalar_set_int(&b, 1); - CHECK(secp256k1_scalar_is_one(&b)); - for (i = 0; i < bit; i++) { - secp256k1_scalar_add(&b, &b, &b); - } - r1 = s1; - r2 = s1; - if (!secp256k1_scalar_add(&r1, &r1, &b)) { - /* No overflow happened. */ - secp256k1_scalar_cadd_bit(&r2, bit, 1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - /* cadd is a noop when flag is zero */ - secp256k1_scalar_cadd_bit(&r2, bit, 0); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - } - - { - /* Test commutativity of mul. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_mul(&r1, &s1, &s2); - secp256k1_scalar_mul(&r2, &s2, &s1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test associativity of add. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_add(&r1, &s1, &s2); - secp256k1_scalar_add(&r1, &r1, &s); - secp256k1_scalar_add(&r2, &s2, &s); - secp256k1_scalar_add(&r2, &s1, &r2); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test associativity of mul. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_mul(&r1, &s1, &s2); - secp256k1_scalar_mul(&r1, &r1, &s); - secp256k1_scalar_mul(&r2, &s2, &s); - secp256k1_scalar_mul(&r2, &s1, &r2); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test distributitivity of mul over add. */ - secp256k1_scalar r1, r2, t; - secp256k1_scalar_add(&r1, &s1, &s2); - secp256k1_scalar_mul(&r1, &r1, &s); - secp256k1_scalar_mul(&r2, &s1, &s); - secp256k1_scalar_mul(&t, &s2, &s); - secp256k1_scalar_add(&r2, &r2, &t); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test square. */ - secp256k1_scalar r1, r2; - secp256k1_scalar_sqr(&r1, &s1); - secp256k1_scalar_mul(&r2, &s1, &s1); - CHECK(secp256k1_scalar_eq(&r1, &r2)); - } - - { - /* Test multiplicative identity. */ - secp256k1_scalar r1, v1; - secp256k1_scalar_set_int(&v1,1); - secp256k1_scalar_mul(&r1, &s1, &v1); - CHECK(secp256k1_scalar_eq(&r1, &s1)); - } - - { - /* Test additive identity. */ - secp256k1_scalar r1, v0; - secp256k1_scalar_set_int(&v0,0); - secp256k1_scalar_add(&r1, &s1, &v0); - CHECK(secp256k1_scalar_eq(&r1, &s1)); - } - - { - /* Test zero product property. */ - secp256k1_scalar r1, v0; - secp256k1_scalar_set_int(&v0,0); - secp256k1_scalar_mul(&r1, &s1, &v0); - CHECK(secp256k1_scalar_eq(&r1, &v0)); - } - -} - -void run_scalar_tests(void) { - int i; - for (i = 0; i < 128 * count; i++) { - scalar_test(); - } - - { - /* (-1)+1 should be zero. */ - secp256k1_scalar s, o; - secp256k1_scalar_set_int(&s, 1); - CHECK(secp256k1_scalar_is_one(&s)); - secp256k1_scalar_negate(&o, &s); - secp256k1_scalar_add(&o, &o, &s); - CHECK(secp256k1_scalar_is_zero(&o)); - secp256k1_scalar_negate(&o, &o); - CHECK(secp256k1_scalar_is_zero(&o)); - } - -#ifndef USE_NUM_NONE - { - /* A scalar with value of the curve order should be 0. */ - secp256k1_num order; - secp256k1_scalar zero; - unsigned char bin[32]; - int overflow = 0; - secp256k1_scalar_order_get_num(&order); - secp256k1_num_get_bin(bin, 32, &order); - secp256k1_scalar_set_b32(&zero, bin, &overflow); - CHECK(overflow == 1); - CHECK(secp256k1_scalar_is_zero(&zero)); - } -#endif - - { - /* Does check_overflow check catch all ones? */ - static const secp256k1_scalar overflowed = SECP256K1_SCALAR_CONST( - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, - 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL - ); - CHECK(secp256k1_scalar_check_overflow(&overflowed)); - } - - { - /* Static test vectors. - * These were reduced from ~10^12 random vectors based on comparison-decision - * and edge-case coverage on 32-bit and 64-bit implementations. - * The responses were generated with Sage 5.9. - */ - secp256k1_scalar x; - secp256k1_scalar y; - secp256k1_scalar z; - secp256k1_scalar zz; - secp256k1_scalar one; - secp256k1_scalar r1; - secp256k1_scalar r2; -#if defined(USE_SCALAR_INV_NUM) - secp256k1_scalar zzv; -#endif - int overflow; - unsigned char chal[33][2][32] = { - {{0xff, 0xff, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, - 0xff, 0xff, 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff}}, - {{0xef, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x80, 0xff}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0x3f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x00}, - {0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x1e, 0xf8, 0xff, 0xff, 0xff, 0xfd, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, - 0x00, 0x00, 0x00, 0xf8, 0xff, 0x03, 0x00, 0xe0, - 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, - 0xf3, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x1c, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, - 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x00, 0x80, 0xff, 0xff, 0x3f, - 0x00, 0xfe, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0x00, 0x0f, 0xfc, 0x9f, - 0xff, 0xff, 0xff, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0x0f, 0xfc, 0xff, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x00, 0x00, 0xf8, 0xff, 0x0f, 0xc0, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x07, 0x80, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xf7, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0x00, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf0}, - {0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0x00, 0xf8, 0xff, 0x03, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x03, 0xc0, 0xff, 0x0f, 0xfc, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, - 0xff, 0x01, 0x00, 0x00, 0x00, 0x3f, 0x00, 0xc0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0x8f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x7f, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x03, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x80, 0xff, 0x7f}, - {0xff, 0xcf, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, - 0xbf, 0xff, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, - 0xff, 0xff, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0x01, 0xfc, 0xff, 0x01, 0x00, 0xfe, 0xff}, - {0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x7f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf0, 0xff, 0xff, - 0xe0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0xfc, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x3f, - 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x0f, 0x7e, 0x00, 0x00}}, - {{0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfe, 0x07, 0x00}, - {0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xfb, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60}}, - {{0xff, 0x01, 0x00, 0xff, 0xff, 0xff, 0x0f, 0x00, - 0x80, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00}}, - {{0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, - 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0xff, 0xff, 0xcf, 0xff, 0x1f, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x7e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00}, - {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xff, 0x7f, 0x00, 0x80, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x80, - 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x7f, 0xf8, 0xff, 0xff, 0x1f, 0x00, 0xfe}}, - {{0xff, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0xff, - 0xff, 0x03, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0x01, 0x80, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xc0, - 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff}}, - {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x7e, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00, - 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, - 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - {0xff, 0x01, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}, - {{0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, - 0xff, 0xff, 0x3f, 0x00, 0xf8, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x3f, 0x00, 0x00, 0xc0, 0xf1, 0x7f, 0x00}}, - {{0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0x00}, - {0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, - 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, - 0x00, 0x00, 0xfc, 0xff, 0xff, 0x01, 0xff, 0xff}}, - {{0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0x00, 0x00, 0x80, 0xff, 0x03, 0xe0, 0x01, - 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xfc, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}, - {0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xff, 0xff, 0xf0, 0x07, 0x00, 0x3c, 0x80, - 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x07, 0xe0, 0xff, 0x00, 0x00, 0x00}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, - 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0xf8, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80}, - {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x80, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x7f, 0xfe, 0xff, 0x1f, - 0x00, 0xfe, 0xff, 0x03, 0x00, 0x00, 0xfe, 0xff}}, - {{0xff, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x83, - 0xff, 0xff, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, - 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xf0}, - {0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, - 0xf8, 0x07, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xc7, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff}}, - {{0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0x03, 0xfb, - 0xfa, 0x8a, 0x7d, 0xdf, 0x13, 0x86, 0xe2, 0x03}, - {0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0x82, 0xc9, 0xfa, 0xb0, 0x68, 0x04, 0xa0, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0x03, 0xfb, - 0xfa, 0x8a, 0x7d, 0xdf, 0x13, 0x86, 0xe2, 0x03}} - }; - unsigned char res[33][2][32] = { - {{0x0c, 0x3b, 0x0a, 0xca, 0x8d, 0x1a, 0x2f, 0xb9, - 0x8a, 0x7b, 0x53, 0x5a, 0x1f, 0xc5, 0x22, 0xa1, - 0x07, 0x2a, 0x48, 0xea, 0x02, 0xeb, 0xb3, 0xd6, - 0x20, 0x1e, 0x86, 0xd0, 0x95, 0xf6, 0x92, 0x35}, - {0xdc, 0x90, 0x7a, 0x07, 0x2e, 0x1e, 0x44, 0x6d, - 0xf8, 0x15, 0x24, 0x5b, 0x5a, 0x96, 0x37, 0x9c, - 0x37, 0x7b, 0x0d, 0xac, 0x1b, 0x65, 0x58, 0x49, - 0x43, 0xb7, 0x31, 0xbb, 0xa7, 0xf4, 0x97, 0x15}}, - {{0xf1, 0xf7, 0x3a, 0x50, 0xe6, 0x10, 0xba, 0x22, - 0x43, 0x4d, 0x1f, 0x1f, 0x7c, 0x27, 0xca, 0x9c, - 0xb8, 0xb6, 0xa0, 0xfc, 0xd8, 0xc0, 0x05, 0x2f, - 0xf7, 0x08, 0xe1, 0x76, 0xdd, 0xd0, 0x80, 0xc8}, - {0xe3, 0x80, 0x80, 0xb8, 0xdb, 0xe3, 0xa9, 0x77, - 0x00, 0xb0, 0xf5, 0x2e, 0x27, 0xe2, 0x68, 0xc4, - 0x88, 0xe8, 0x04, 0xc1, 0x12, 0xbf, 0x78, 0x59, - 0xe6, 0xa9, 0x7c, 0xe1, 0x81, 0xdd, 0xb9, 0xd5}}, - {{0x96, 0xe2, 0xee, 0x01, 0xa6, 0x80, 0x31, 0xef, - 0x5c, 0xd0, 0x19, 0xb4, 0x7d, 0x5f, 0x79, 0xab, - 0xa1, 0x97, 0xd3, 0x7e, 0x33, 0xbb, 0x86, 0x55, - 0x60, 0x20, 0x10, 0x0d, 0x94, 0x2d, 0x11, 0x7c}, - {0xcc, 0xab, 0xe0, 0xe8, 0x98, 0x65, 0x12, 0x96, - 0x38, 0x5a, 0x1a, 0xf2, 0x85, 0x23, 0x59, 0x5f, - 0xf9, 0xf3, 0xc2, 0x81, 0x70, 0x92, 0x65, 0x12, - 0x9c, 0x65, 0x1e, 0x96, 0x00, 0xef, 0xe7, 0x63}}, - {{0xac, 0x1e, 0x62, 0xc2, 0x59, 0xfc, 0x4e, 0x5c, - 0x83, 0xb0, 0xd0, 0x6f, 0xce, 0x19, 0xf6, 0xbf, - 0xa4, 0xb0, 0xe0, 0x53, 0x66, 0x1f, 0xbf, 0xc9, - 0x33, 0x47, 0x37, 0xa9, 0x3d, 0x5d, 0xb0, 0x48}, - {0x86, 0xb9, 0x2a, 0x7f, 0x8e, 0xa8, 0x60, 0x42, - 0x26, 0x6d, 0x6e, 0x1c, 0xa2, 0xec, 0xe0, 0xe5, - 0x3e, 0x0a, 0x33, 0xbb, 0x61, 0x4c, 0x9f, 0x3c, - 0xd1, 0xdf, 0x49, 0x33, 0xcd, 0x72, 0x78, 0x18}}, - {{0xf7, 0xd3, 0xcd, 0x49, 0x5c, 0x13, 0x22, 0xfb, - 0x2e, 0xb2, 0x2f, 0x27, 0xf5, 0x8a, 0x5d, 0x74, - 0xc1, 0x58, 0xc5, 0xc2, 0x2d, 0x9f, 0x52, 0xc6, - 0x63, 0x9f, 0xba, 0x05, 0x76, 0x45, 0x7a, 0x63}, - {0x8a, 0xfa, 0x55, 0x4d, 0xdd, 0xa3, 0xb2, 0xc3, - 0x44, 0xfd, 0xec, 0x72, 0xde, 0xef, 0xc0, 0x99, - 0xf5, 0x9f, 0xe2, 0x52, 0xb4, 0x05, 0x32, 0x58, - 0x57, 0xc1, 0x8f, 0xea, 0xc3, 0x24, 0x5b, 0x94}}, - {{0x05, 0x83, 0xee, 0xdd, 0x64, 0xf0, 0x14, 0x3b, - 0xa0, 0x14, 0x4a, 0x3a, 0x41, 0x82, 0x7c, 0xa7, - 0x2c, 0xaa, 0xb1, 0x76, 0xbb, 0x59, 0x64, 0x5f, - 0x52, 0xad, 0x25, 0x29, 0x9d, 0x8f, 0x0b, 0xb0}, - {0x7e, 0xe3, 0x7c, 0xca, 0xcd, 0x4f, 0xb0, 0x6d, - 0x7a, 0xb2, 0x3e, 0xa0, 0x08, 0xb9, 0xa8, 0x2d, - 0xc2, 0xf4, 0x99, 0x66, 0xcc, 0xac, 0xd8, 0xb9, - 0x72, 0x2a, 0x4a, 0x3e, 0x0f, 0x7b, 0xbf, 0xf4}}, - {{0x8c, 0x9c, 0x78, 0x2b, 0x39, 0x61, 0x7e, 0xf7, - 0x65, 0x37, 0x66, 0x09, 0x38, 0xb9, 0x6f, 0x70, - 0x78, 0x87, 0xff, 0xcf, 0x93, 0xca, 0x85, 0x06, - 0x44, 0x84, 0xa7, 0xfe, 0xd3, 0xa4, 0xe3, 0x7e}, - {0xa2, 0x56, 0x49, 0x23, 0x54, 0xa5, 0x50, 0xe9, - 0x5f, 0xf0, 0x4d, 0xe7, 0xdc, 0x38, 0x32, 0x79, - 0x4f, 0x1c, 0xb7, 0xe4, 0xbb, 0xf8, 0xbb, 0x2e, - 0x40, 0x41, 0x4b, 0xcc, 0xe3, 0x1e, 0x16, 0x36}}, - {{0x0c, 0x1e, 0xd7, 0x09, 0x25, 0x40, 0x97, 0xcb, - 0x5c, 0x46, 0xa8, 0xda, 0xef, 0x25, 0xd5, 0xe5, - 0x92, 0x4d, 0xcf, 0xa3, 0xc4, 0x5d, 0x35, 0x4a, - 0xe4, 0x61, 0x92, 0xf3, 0xbf, 0x0e, 0xcd, 0xbe}, - {0xe4, 0xaf, 0x0a, 0xb3, 0x30, 0x8b, 0x9b, 0x48, - 0x49, 0x43, 0xc7, 0x64, 0x60, 0x4a, 0x2b, 0x9e, - 0x95, 0x5f, 0x56, 0xe8, 0x35, 0xdc, 0xeb, 0xdc, - 0xc7, 0xc4, 0xfe, 0x30, 0x40, 0xc7, 0xbf, 0xa4}}, - {{0xd4, 0xa0, 0xf5, 0x81, 0x49, 0x6b, 0xb6, 0x8b, - 0x0a, 0x69, 0xf9, 0xfe, 0xa8, 0x32, 0xe5, 0xe0, - 0xa5, 0xcd, 0x02, 0x53, 0xf9, 0x2c, 0xe3, 0x53, - 0x83, 0x36, 0xc6, 0x02, 0xb5, 0xeb, 0x64, 0xb8}, - {0x1d, 0x42, 0xb9, 0xf9, 0xe9, 0xe3, 0x93, 0x2c, - 0x4c, 0xee, 0x6c, 0x5a, 0x47, 0x9e, 0x62, 0x01, - 0x6b, 0x04, 0xfe, 0xa4, 0x30, 0x2b, 0x0d, 0x4f, - 0x71, 0x10, 0xd3, 0x55, 0xca, 0xf3, 0x5e, 0x80}}, - {{0x77, 0x05, 0xf6, 0x0c, 0x15, 0x9b, 0x45, 0xe7, - 0xb9, 0x11, 0xb8, 0xf5, 0xd6, 0xda, 0x73, 0x0c, - 0xda, 0x92, 0xea, 0xd0, 0x9d, 0xd0, 0x18, 0x92, - 0xce, 0x9a, 0xaa, 0xee, 0x0f, 0xef, 0xde, 0x30}, - {0xf1, 0xf1, 0xd6, 0x9b, 0x51, 0xd7, 0x77, 0x62, - 0x52, 0x10, 0xb8, 0x7a, 0x84, 0x9d, 0x15, 0x4e, - 0x07, 0xdc, 0x1e, 0x75, 0x0d, 0x0c, 0x3b, 0xdb, - 0x74, 0x58, 0x62, 0x02, 0x90, 0x54, 0x8b, 0x43}}, - {{0xa6, 0xfe, 0x0b, 0x87, 0x80, 0x43, 0x67, 0x25, - 0x57, 0x5d, 0xec, 0x40, 0x50, 0x08, 0xd5, 0x5d, - 0x43, 0xd7, 0xe0, 0xaa, 0xe0, 0x13, 0xb6, 0xb0, - 0xc0, 0xd4, 0xe5, 0x0d, 0x45, 0x83, 0xd6, 0x13}, - {0x40, 0x45, 0x0a, 0x92, 0x31, 0xea, 0x8c, 0x60, - 0x8c, 0x1f, 0xd8, 0x76, 0x45, 0xb9, 0x29, 0x00, - 0x26, 0x32, 0xd8, 0xa6, 0x96, 0x88, 0xe2, 0xc4, - 0x8b, 0xdb, 0x7f, 0x17, 0x87, 0xcc, 0xc8, 0xf2}}, - {{0xc2, 0x56, 0xe2, 0xb6, 0x1a, 0x81, 0xe7, 0x31, - 0x63, 0x2e, 0xbb, 0x0d, 0x2f, 0x81, 0x67, 0xd4, - 0x22, 0xe2, 0x38, 0x02, 0x25, 0x97, 0xc7, 0x88, - 0x6e, 0xdf, 0xbe, 0x2a, 0xa5, 0x73, 0x63, 0xaa}, - {0x50, 0x45, 0xe2, 0xc3, 0xbd, 0x89, 0xfc, 0x57, - 0xbd, 0x3c, 0xa3, 0x98, 0x7e, 0x7f, 0x36, 0x38, - 0x92, 0x39, 0x1f, 0x0f, 0x81, 0x1a, 0x06, 0x51, - 0x1f, 0x8d, 0x6a, 0xff, 0x47, 0x16, 0x06, 0x9c}}, - {{0x33, 0x95, 0xa2, 0x6f, 0x27, 0x5f, 0x9c, 0x9c, - 0x64, 0x45, 0xcb, 0xd1, 0x3c, 0xee, 0x5e, 0x5f, - 0x48, 0xa6, 0xaf, 0xe3, 0x79, 0xcf, 0xb1, 0xe2, - 0xbf, 0x55, 0x0e, 0xa2, 0x3b, 0x62, 0xf0, 0xe4}, - {0x14, 0xe8, 0x06, 0xe3, 0xbe, 0x7e, 0x67, 0x01, - 0xc5, 0x21, 0x67, 0xd8, 0x54, 0xb5, 0x7f, 0xa4, - 0xf9, 0x75, 0x70, 0x1c, 0xfd, 0x79, 0xdb, 0x86, - 0xad, 0x37, 0x85, 0x83, 0x56, 0x4e, 0xf0, 0xbf}}, - {{0xbc, 0xa6, 0xe0, 0x56, 0x4e, 0xef, 0xfa, 0xf5, - 0x1d, 0x5d, 0x3f, 0x2a, 0x5b, 0x19, 0xab, 0x51, - 0xc5, 0x8b, 0xdd, 0x98, 0x28, 0x35, 0x2f, 0xc3, - 0x81, 0x4f, 0x5c, 0xe5, 0x70, 0xb9, 0xeb, 0x62}, - {0xc4, 0x6d, 0x26, 0xb0, 0x17, 0x6b, 0xfe, 0x6c, - 0x12, 0xf8, 0xe7, 0xc1, 0xf5, 0x2f, 0xfa, 0x91, - 0x13, 0x27, 0xbd, 0x73, 0xcc, 0x33, 0x31, 0x1c, - 0x39, 0xe3, 0x27, 0x6a, 0x95, 0xcf, 0xc5, 0xfb}}, - {{0x30, 0xb2, 0x99, 0x84, 0xf0, 0x18, 0x2a, 0x6e, - 0x1e, 0x27, 0xed, 0xa2, 0x29, 0x99, 0x41, 0x56, - 0xe8, 0xd4, 0x0d, 0xef, 0x99, 0x9c, 0xf3, 0x58, - 0x29, 0x55, 0x1a, 0xc0, 0x68, 0xd6, 0x74, 0xa4}, - {0x07, 0x9c, 0xe7, 0xec, 0xf5, 0x36, 0x73, 0x41, - 0xa3, 0x1c, 0xe5, 0x93, 0x97, 0x6a, 0xfd, 0xf7, - 0x53, 0x18, 0xab, 0xaf, 0xeb, 0x85, 0xbd, 0x92, - 0x90, 0xab, 0x3c, 0xbf, 0x30, 0x82, 0xad, 0xf6}}, - {{0xc6, 0x87, 0x8a, 0x2a, 0xea, 0xc0, 0xa9, 0xec, - 0x6d, 0xd3, 0xdc, 0x32, 0x23, 0xce, 0x62, 0x19, - 0xa4, 0x7e, 0xa8, 0xdd, 0x1c, 0x33, 0xae, 0xd3, - 0x4f, 0x62, 0x9f, 0x52, 0xe7, 0x65, 0x46, 0xf4}, - {0x97, 0x51, 0x27, 0x67, 0x2d, 0xa2, 0x82, 0x87, - 0x98, 0xd3, 0xb6, 0x14, 0x7f, 0x51, 0xd3, 0x9a, - 0x0b, 0xd0, 0x76, 0x81, 0xb2, 0x4f, 0x58, 0x92, - 0xa4, 0x86, 0xa1, 0xa7, 0x09, 0x1d, 0xef, 0x9b}}, - {{0xb3, 0x0f, 0x2b, 0x69, 0x0d, 0x06, 0x90, 0x64, - 0xbd, 0x43, 0x4c, 0x10, 0xe8, 0x98, 0x1c, 0xa3, - 0xe1, 0x68, 0xe9, 0x79, 0x6c, 0x29, 0x51, 0x3f, - 0x41, 0xdc, 0xdf, 0x1f, 0xf3, 0x60, 0xbe, 0x33}, - {0xa1, 0x5f, 0xf7, 0x1d, 0xb4, 0x3e, 0x9b, 0x3c, - 0xe7, 0xbd, 0xb6, 0x06, 0xd5, 0x60, 0x06, 0x6d, - 0x50, 0xd2, 0xf4, 0x1a, 0x31, 0x08, 0xf2, 0xea, - 0x8e, 0xef, 0x5f, 0x7d, 0xb6, 0xd0, 0xc0, 0x27}}, - {{0x62, 0x9a, 0xd9, 0xbb, 0x38, 0x36, 0xce, 0xf7, - 0x5d, 0x2f, 0x13, 0xec, 0xc8, 0x2d, 0x02, 0x8a, - 0x2e, 0x72, 0xf0, 0xe5, 0x15, 0x9d, 0x72, 0xae, - 0xfc, 0xb3, 0x4f, 0x02, 0xea, 0xe1, 0x09, 0xfe}, - {0x00, 0x00, 0x00, 0x00, 0xfa, 0x0a, 0x3d, 0xbc, - 0xad, 0x16, 0x0c, 0xb6, 0xe7, 0x7c, 0x8b, 0x39, - 0x9a, 0x43, 0xbb, 0xe3, 0xc2, 0x55, 0x15, 0x14, - 0x75, 0xac, 0x90, 0x9b, 0x7f, 0x9a, 0x92, 0x00}}, - {{0x8b, 0xac, 0x70, 0x86, 0x29, 0x8f, 0x00, 0x23, - 0x7b, 0x45, 0x30, 0xaa, 0xb8, 0x4c, 0xc7, 0x8d, - 0x4e, 0x47, 0x85, 0xc6, 0x19, 0xe3, 0x96, 0xc2, - 0x9a, 0xa0, 0x12, 0xed, 0x6f, 0xd7, 0x76, 0x16}, - {0x45, 0xaf, 0x7e, 0x33, 0xc7, 0x7f, 0x10, 0x6c, - 0x7c, 0x9f, 0x29, 0xc1, 0xa8, 0x7e, 0x15, 0x84, - 0xe7, 0x7d, 0xc0, 0x6d, 0xab, 0x71, 0x5d, 0xd0, - 0x6b, 0x9f, 0x97, 0xab, 0xcb, 0x51, 0x0c, 0x9f}}, - {{0x9e, 0xc3, 0x92, 0xb4, 0x04, 0x9f, 0xc8, 0xbb, - 0xdd, 0x9e, 0xc6, 0x05, 0xfd, 0x65, 0xec, 0x94, - 0x7f, 0x2c, 0x16, 0xc4, 0x40, 0xac, 0x63, 0x7b, - 0x7d, 0xb8, 0x0c, 0xe4, 0x5b, 0xe3, 0xa7, 0x0e}, - {0x43, 0xf4, 0x44, 0xe8, 0xcc, 0xc8, 0xd4, 0x54, - 0x33, 0x37, 0x50, 0xf2, 0x87, 0x42, 0x2e, 0x00, - 0x49, 0x60, 0x62, 0x02, 0xfd, 0x1a, 0x7c, 0xdb, - 0x29, 0x6c, 0x6d, 0x54, 0x53, 0x08, 0xd1, 0xc8}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}, - {{0x27, 0x59, 0xc7, 0x35, 0x60, 0x71, 0xa6, 0xf1, - 0x79, 0xa5, 0xfd, 0x79, 0x16, 0xf3, 0x41, 0xf0, - 0x57, 0xb4, 0x02, 0x97, 0x32, 0xe7, 0xde, 0x59, - 0xe2, 0x2d, 0x9b, 0x11, 0xea, 0x2c, 0x35, 0x92}, - {0x27, 0x59, 0xc7, 0x35, 0x60, 0x71, 0xa6, 0xf1, - 0x79, 0xa5, 0xfd, 0x79, 0x16, 0xf3, 0x41, 0xf0, - 0x57, 0xb4, 0x02, 0x97, 0x32, 0xe7, 0xde, 0x59, - 0xe2, 0x2d, 0x9b, 0x11, 0xea, 0x2c, 0x35, 0x92}}, - {{0x28, 0x56, 0xac, 0x0e, 0x4f, 0x98, 0x09, 0xf0, - 0x49, 0xfa, 0x7f, 0x84, 0xac, 0x7e, 0x50, 0x5b, - 0x17, 0x43, 0x14, 0x89, 0x9c, 0x53, 0xa8, 0x94, - 0x30, 0xf2, 0x11, 0x4d, 0x92, 0x14, 0x27, 0xe8}, - {0x39, 0x7a, 0x84, 0x56, 0x79, 0x9d, 0xec, 0x26, - 0x2c, 0x53, 0xc1, 0x94, 0xc9, 0x8d, 0x9e, 0x9d, - 0x32, 0x1f, 0xdd, 0x84, 0x04, 0xe8, 0xe2, 0x0a, - 0x6b, 0xbe, 0xbb, 0x42, 0x40, 0x67, 0x30, 0x6c}}, - {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x45, 0x51, 0x23, 0x19, 0x50, 0xb7, 0x5f, 0xc4, - 0x40, 0x2d, 0xa1, 0x73, 0x2f, 0xc9, 0xbe, 0xbd}, - {0x27, 0x59, 0xc7, 0x35, 0x60, 0x71, 0xa6, 0xf1, - 0x79, 0xa5, 0xfd, 0x79, 0x16, 0xf3, 0x41, 0xf0, - 0x57, 0xb4, 0x02, 0x97, 0x32, 0xe7, 0xde, 0x59, - 0xe2, 0x2d, 0x9b, 0x11, 0xea, 0x2c, 0x35, 0x92}}, - {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}}, - {{0x1c, 0xc4, 0xf7, 0xda, 0x0f, 0x65, 0xca, 0x39, - 0x70, 0x52, 0x92, 0x8e, 0xc3, 0xc8, 0x15, 0xea, - 0x7f, 0x10, 0x9e, 0x77, 0x4b, 0x6e, 0x2d, 0xdf, - 0xe8, 0x30, 0x9d, 0xda, 0xe8, 0x9a, 0x65, 0xae}, - {0x02, 0xb0, 0x16, 0xb1, 0x1d, 0xc8, 0x57, 0x7b, - 0xa2, 0x3a, 0xa2, 0xa3, 0x38, 0x5c, 0x8f, 0xeb, - 0x66, 0x37, 0x91, 0xa8, 0x5f, 0xef, 0x04, 0xf6, - 0x59, 0x75, 0xe1, 0xee, 0x92, 0xf6, 0x0e, 0x30}}, - {{0x8d, 0x76, 0x14, 0xa4, 0x14, 0x06, 0x9f, 0x9a, - 0xdf, 0x4a, 0x85, 0xa7, 0x6b, 0xbf, 0x29, 0x6f, - 0xbc, 0x34, 0x87, 0x5d, 0xeb, 0xbb, 0x2e, 0xa9, - 0xc9, 0x1f, 0x58, 0xd6, 0x9a, 0x82, 0xa0, 0x56}, - {0xd4, 0xb9, 0xdb, 0x88, 0x1d, 0x04, 0xe9, 0x93, - 0x8d, 0x3f, 0x20, 0xd5, 0x86, 0xa8, 0x83, 0x07, - 0xdb, 0x09, 0xd8, 0x22, 0x1f, 0x7f, 0xf1, 0x71, - 0xc8, 0xe7, 0x5d, 0x47, 0xaf, 0x8b, 0x72, 0xe9}}, - {{0x83, 0xb9, 0x39, 0xb2, 0xa4, 0xdf, 0x46, 0x87, - 0xc2, 0xb8, 0xf1, 0xe6, 0x4c, 0xd1, 0xe2, 0xa9, - 0xe4, 0x70, 0x30, 0x34, 0xbc, 0x52, 0x7c, 0x55, - 0xa6, 0xec, 0x80, 0xa4, 0xe5, 0xd2, 0xdc, 0x73}, - {0x08, 0xf1, 0x03, 0xcf, 0x16, 0x73, 0xe8, 0x7d, - 0xb6, 0x7e, 0x9b, 0xc0, 0xb4, 0xc2, 0xa5, 0x86, - 0x02, 0x77, 0xd5, 0x27, 0x86, 0xa5, 0x15, 0xfb, - 0xae, 0x9b, 0x8c, 0xa9, 0xf9, 0xf8, 0xa8, 0x4a}}, - {{0x8b, 0x00, 0x49, 0xdb, 0xfa, 0xf0, 0x1b, 0xa2, - 0xed, 0x8a, 0x9a, 0x7a, 0x36, 0x78, 0x4a, 0xc7, - 0xf7, 0xad, 0x39, 0xd0, 0x6c, 0x65, 0x7a, 0x41, - 0xce, 0xd6, 0xd6, 0x4c, 0x20, 0x21, 0x6b, 0xc7}, - {0xc6, 0xca, 0x78, 0x1d, 0x32, 0x6c, 0x6c, 0x06, - 0x91, 0xf2, 0x1a, 0xe8, 0x43, 0x16, 0xea, 0x04, - 0x3c, 0x1f, 0x07, 0x85, 0xf7, 0x09, 0x22, 0x08, - 0xba, 0x13, 0xfd, 0x78, 0x1e, 0x3f, 0x6f, 0x62}}, - {{0x25, 0x9b, 0x7c, 0xb0, 0xac, 0x72, 0x6f, 0xb2, - 0xe3, 0x53, 0x84, 0x7a, 0x1a, 0x9a, 0x98, 0x9b, - 0x44, 0xd3, 0x59, 0xd0, 0x8e, 0x57, 0x41, 0x40, - 0x78, 0xa7, 0x30, 0x2f, 0x4c, 0x9c, 0xb9, 0x68}, - {0xb7, 0x75, 0x03, 0x63, 0x61, 0xc2, 0x48, 0x6e, - 0x12, 0x3d, 0xbf, 0x4b, 0x27, 0xdf, 0xb1, 0x7a, - 0xff, 0x4e, 0x31, 0x07, 0x83, 0xf4, 0x62, 0x5b, - 0x19, 0xa5, 0xac, 0xa0, 0x32, 0x58, 0x0d, 0xa7}}, - {{0x43, 0x4f, 0x10, 0xa4, 0xca, 0xdb, 0x38, 0x67, - 0xfa, 0xae, 0x96, 0xb5, 0x6d, 0x97, 0xff, 0x1f, - 0xb6, 0x83, 0x43, 0xd3, 0xa0, 0x2d, 0x70, 0x7a, - 0x64, 0x05, 0x4c, 0xa7, 0xc1, 0xa5, 0x21, 0x51}, - {0xe4, 0xf1, 0x23, 0x84, 0xe1, 0xb5, 0x9d, 0xf2, - 0xb8, 0x73, 0x8b, 0x45, 0x2b, 0x35, 0x46, 0x38, - 0x10, 0x2b, 0x50, 0xf8, 0x8b, 0x35, 0xcd, 0x34, - 0xc8, 0x0e, 0xf6, 0xdb, 0x09, 0x35, 0xf0, 0xda}}, - {{0xdb, 0x21, 0x5c, 0x8d, 0x83, 0x1d, 0xb3, 0x34, - 0xc7, 0x0e, 0x43, 0xa1, 0x58, 0x79, 0x67, 0x13, - 0x1e, 0x86, 0x5d, 0x89, 0x63, 0xe6, 0x0a, 0x46, - 0x5c, 0x02, 0x97, 0x1b, 0x62, 0x43, 0x86, 0xf5}, - {0xdb, 0x21, 0x5c, 0x8d, 0x83, 0x1d, 0xb3, 0x34, - 0xc7, 0x0e, 0x43, 0xa1, 0x58, 0x79, 0x67, 0x13, - 0x1e, 0x86, 0x5d, 0x89, 0x63, 0xe6, 0x0a, 0x46, - 0x5c, 0x02, 0x97, 0x1b, 0x62, 0x43, 0x86, 0xf5}} - }; - secp256k1_scalar_set_int(&one, 1); - for (i = 0; i < 33; i++) { - secp256k1_scalar_set_b32(&x, chal[i][0], &overflow); - CHECK(!overflow); - secp256k1_scalar_set_b32(&y, chal[i][1], &overflow); - CHECK(!overflow); - secp256k1_scalar_set_b32(&r1, res[i][0], &overflow); - CHECK(!overflow); - secp256k1_scalar_set_b32(&r2, res[i][1], &overflow); - CHECK(!overflow); - secp256k1_scalar_mul(&z, &x, &y); - CHECK(!secp256k1_scalar_check_overflow(&z)); - CHECK(secp256k1_scalar_eq(&r1, &z)); - if (!secp256k1_scalar_is_zero(&y)) { - secp256k1_scalar_inverse(&zz, &y); - CHECK(!secp256k1_scalar_check_overflow(&zz)); -#if defined(USE_SCALAR_INV_NUM) - secp256k1_scalar_inverse_var(&zzv, &y); - CHECK(secp256k1_scalar_eq(&zzv, &zz)); -#endif - secp256k1_scalar_mul(&z, &z, &zz); - CHECK(!secp256k1_scalar_check_overflow(&z)); - CHECK(secp256k1_scalar_eq(&x, &z)); - secp256k1_scalar_mul(&zz, &zz, &y); - CHECK(!secp256k1_scalar_check_overflow(&zz)); - CHECK(secp256k1_scalar_eq(&one, &zz)); - } - secp256k1_scalar_mul(&z, &x, &x); - CHECK(!secp256k1_scalar_check_overflow(&z)); - secp256k1_scalar_sqr(&zz, &x); - CHECK(!secp256k1_scalar_check_overflow(&zz)); - CHECK(secp256k1_scalar_eq(&zz, &z)); - CHECK(secp256k1_scalar_eq(&r2, &zz)); - } - } -} - -/***** FIELD TESTS *****/ - -void random_fe(secp256k1_fe *x) { - unsigned char bin[32]; - do { - secp256k1_rand256(bin); - if (secp256k1_fe_set_b32(x, bin)) { - return; - } - } while(1); -} - -void random_fe_test(secp256k1_fe *x) { - unsigned char bin[32]; - do { - secp256k1_rand256_test(bin); - if (secp256k1_fe_set_b32(x, bin)) { - return; - } - } while(1); -} - -void random_fe_non_zero(secp256k1_fe *nz) { - int tries = 10; - while (--tries >= 0) { - random_fe(nz); - secp256k1_fe_normalize(nz); - if (!secp256k1_fe_is_zero(nz)) { - break; - } - } - /* Infinitesimal probability of spurious failure here */ - CHECK(tries >= 0); -} - -void random_fe_non_square(secp256k1_fe *ns) { - secp256k1_fe r; - random_fe_non_zero(ns); - if (secp256k1_fe_sqrt(&r, ns)) { - secp256k1_fe_negate(ns, ns, 1); - } -} - -int check_fe_equal(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe an = *a; - secp256k1_fe bn = *b; - secp256k1_fe_normalize_weak(&an); - secp256k1_fe_normalize_var(&bn); - return secp256k1_fe_equal_var(&an, &bn); -} - -int check_fe_inverse(const secp256k1_fe *a, const secp256k1_fe *ai) { - secp256k1_fe x; - secp256k1_fe one = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_fe_mul(&x, a, ai); - return check_fe_equal(&x, &one); -} - -void run_field_convert(void) { - static const unsigned char b32[32] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, - 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40 - }; - static const secp256k1_fe_storage fes = SECP256K1_FE_STORAGE_CONST( - 0x00010203UL, 0x04050607UL, 0x11121314UL, 0x15161718UL, - 0x22232425UL, 0x26272829UL, 0x33343536UL, 0x37383940UL - ); - static const secp256k1_fe fe = SECP256K1_FE_CONST( - 0x00010203UL, 0x04050607UL, 0x11121314UL, 0x15161718UL, - 0x22232425UL, 0x26272829UL, 0x33343536UL, 0x37383940UL - ); - secp256k1_fe fe2; - unsigned char b322[32]; - secp256k1_fe_storage fes2; - /* Check conversions to fe. */ - CHECK(secp256k1_fe_set_b32(&fe2, b32)); - CHECK(secp256k1_fe_equal_var(&fe, &fe2)); - secp256k1_fe_from_storage(&fe2, &fes); - CHECK(secp256k1_fe_equal_var(&fe, &fe2)); - /* Check conversion from fe. */ - secp256k1_fe_get_b32(b322, &fe); - CHECK(memcmp(b322, b32, 32) == 0); - secp256k1_fe_to_storage(&fes2, &fe); - CHECK(memcmp(&fes2, &fes, sizeof(fes)) == 0); -} - -int fe_memcmp(const secp256k1_fe *a, const secp256k1_fe *b) { - secp256k1_fe t = *b; -#ifdef VERIFY - t.magnitude = a->magnitude; - t.normalized = a->normalized; -#endif - return memcmp(a, &t, sizeof(secp256k1_fe)); -} - -void run_field_misc(void) { - secp256k1_fe x; - secp256k1_fe y; - secp256k1_fe z; - secp256k1_fe q; - secp256k1_fe fe5 = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 5); - int i, j; - for (i = 0; i < 5*count; i++) { - secp256k1_fe_storage xs, ys, zs; - random_fe(&x); - random_fe_non_zero(&y); - /* Test the fe equality and comparison operations. */ - CHECK(secp256k1_fe_cmp_var(&x, &x) == 0); - CHECK(secp256k1_fe_equal_var(&x, &x)); - z = x; - secp256k1_fe_add(&z,&y); - /* Test fe conditional move; z is not normalized here. */ - q = x; - secp256k1_fe_cmov(&x, &z, 0); - VERIFY_CHECK(!x.normalized && x.magnitude == z.magnitude); - secp256k1_fe_cmov(&x, &x, 1); - CHECK(fe_memcmp(&x, &z) != 0); - CHECK(fe_memcmp(&x, &q) == 0); - secp256k1_fe_cmov(&q, &z, 1); - VERIFY_CHECK(!q.normalized && q.magnitude == z.magnitude); - CHECK(fe_memcmp(&q, &z) == 0); - secp256k1_fe_normalize_var(&x); - secp256k1_fe_normalize_var(&z); - CHECK(!secp256k1_fe_equal_var(&x, &z)); - secp256k1_fe_normalize_var(&q); - secp256k1_fe_cmov(&q, &z, (i&1)); - VERIFY_CHECK(q.normalized && q.magnitude == 1); - for (j = 0; j < 6; j++) { - secp256k1_fe_negate(&z, &z, j+1); - secp256k1_fe_normalize_var(&q); - secp256k1_fe_cmov(&q, &z, (j&1)); - VERIFY_CHECK(!q.normalized && q.magnitude == (j+2)); - } - secp256k1_fe_normalize_var(&z); - /* Test storage conversion and conditional moves. */ - secp256k1_fe_to_storage(&xs, &x); - secp256k1_fe_to_storage(&ys, &y); - secp256k1_fe_to_storage(&zs, &z); - secp256k1_fe_storage_cmov(&zs, &xs, 0); - secp256k1_fe_storage_cmov(&zs, &zs, 1); - CHECK(memcmp(&xs, &zs, sizeof(xs)) != 0); - secp256k1_fe_storage_cmov(&ys, &xs, 1); - CHECK(memcmp(&xs, &ys, sizeof(xs)) == 0); - secp256k1_fe_from_storage(&x, &xs); - secp256k1_fe_from_storage(&y, &ys); - secp256k1_fe_from_storage(&z, &zs); - /* Test that mul_int, mul, and add agree. */ - secp256k1_fe_add(&y, &x); - secp256k1_fe_add(&y, &x); - z = x; - secp256k1_fe_mul_int(&z, 3); - CHECK(check_fe_equal(&y, &z)); - secp256k1_fe_add(&y, &x); - secp256k1_fe_add(&z, &x); - CHECK(check_fe_equal(&z, &y)); - z = x; - secp256k1_fe_mul_int(&z, 5); - secp256k1_fe_mul(&q, &x, &fe5); - CHECK(check_fe_equal(&z, &q)); - secp256k1_fe_negate(&x, &x, 1); - secp256k1_fe_add(&z, &x); - secp256k1_fe_add(&q, &x); - CHECK(check_fe_equal(&y, &z)); - CHECK(check_fe_equal(&q, &y)); - } -} - -void run_field_inv(void) { - secp256k1_fe x, xi, xii; - int i; - for (i = 0; i < 10*count; i++) { - random_fe_non_zero(&x); - secp256k1_fe_inv(&xi, &x); - CHECK(check_fe_inverse(&x, &xi)); - secp256k1_fe_inv(&xii, &xi); - CHECK(check_fe_equal(&x, &xii)); - } -} - -void run_field_inv_var(void) { - secp256k1_fe x, xi, xii; - int i; - for (i = 0; i < 10*count; i++) { - random_fe_non_zero(&x); - secp256k1_fe_inv_var(&xi, &x); - CHECK(check_fe_inverse(&x, &xi)); - secp256k1_fe_inv_var(&xii, &xi); - CHECK(check_fe_equal(&x, &xii)); - } -} - -void run_field_inv_all_var(void) { - secp256k1_fe x[16], xi[16], xii[16]; - int i; - /* Check it's safe to call for 0 elements */ - secp256k1_fe_inv_all_var(xi, x, 0); - for (i = 0; i < count; i++) { - size_t j; - size_t len = secp256k1_rand_int(15) + 1; - for (j = 0; j < len; j++) { - random_fe_non_zero(&x[j]); - } - secp256k1_fe_inv_all_var(xi, x, len); - for (j = 0; j < len; j++) { - CHECK(check_fe_inverse(&x[j], &xi[j])); - } - secp256k1_fe_inv_all_var(xii, xi, len); - for (j = 0; j < len; j++) { - CHECK(check_fe_equal(&x[j], &xii[j])); - } - } -} - -void run_sqr(void) { - secp256k1_fe x, s; - - { - int i; - secp256k1_fe_set_int(&x, 1); - secp256k1_fe_negate(&x, &x, 1); - - for (i = 1; i <= 512; ++i) { - secp256k1_fe_mul_int(&x, 2); - secp256k1_fe_normalize(&x); - secp256k1_fe_sqr(&s, &x); - } - } -} - -void test_sqrt(const secp256k1_fe *a, const secp256k1_fe *k) { - secp256k1_fe r1, r2; - int v = secp256k1_fe_sqrt(&r1, a); - CHECK((v == 0) == (k == NULL)); - - if (k != NULL) { - /* Check that the returned root is +/- the given known answer */ - secp256k1_fe_negate(&r2, &r1, 1); - secp256k1_fe_add(&r1, k); secp256k1_fe_add(&r2, k); - secp256k1_fe_normalize(&r1); secp256k1_fe_normalize(&r2); - CHECK(secp256k1_fe_is_zero(&r1) || secp256k1_fe_is_zero(&r2)); - } -} - -void run_sqrt(void) { - secp256k1_fe ns, x, s, t; - int i; - - /* Check sqrt(0) is 0 */ - secp256k1_fe_set_int(&x, 0); - secp256k1_fe_sqr(&s, &x); - test_sqrt(&s, &x); - - /* Check sqrt of small squares (and their negatives) */ - for (i = 1; i <= 100; i++) { - secp256k1_fe_set_int(&x, i); - secp256k1_fe_sqr(&s, &x); - test_sqrt(&s, &x); - secp256k1_fe_negate(&t, &s, 1); - test_sqrt(&t, NULL); - } - - /* Consistency checks for large random values */ - for (i = 0; i < 10; i++) { - int j; - random_fe_non_square(&ns); - for (j = 0; j < count; j++) { - random_fe(&x); - secp256k1_fe_sqr(&s, &x); - test_sqrt(&s, &x); - secp256k1_fe_negate(&t, &s, 1); - test_sqrt(&t, NULL); - secp256k1_fe_mul(&t, &s, &ns); - test_sqrt(&t, NULL); - } - } -} - -/***** GROUP TESTS *****/ - -void ge_equals_ge(const secp256k1_ge *a, const secp256k1_ge *b) { - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - CHECK(secp256k1_fe_equal_var(&a->x, &b->x)); - CHECK(secp256k1_fe_equal_var(&a->y, &b->y)); -} - -/* This compares jacobian points including their Z, not just their geometric meaning. */ -int gej_xyz_equals_gej(const secp256k1_gej *a, const secp256k1_gej *b) { - secp256k1_gej a2; - secp256k1_gej b2; - int ret = 1; - ret &= a->infinity == b->infinity; - if (ret && !a->infinity) { - a2 = *a; - b2 = *b; - secp256k1_fe_normalize(&a2.x); - secp256k1_fe_normalize(&a2.y); - secp256k1_fe_normalize(&a2.z); - secp256k1_fe_normalize(&b2.x); - secp256k1_fe_normalize(&b2.y); - secp256k1_fe_normalize(&b2.z); - ret &= secp256k1_fe_cmp_var(&a2.x, &b2.x) == 0; - ret &= secp256k1_fe_cmp_var(&a2.y, &b2.y) == 0; - ret &= secp256k1_fe_cmp_var(&a2.z, &b2.z) == 0; - } - return ret; -} - -void ge_equals_gej(const secp256k1_ge *a, const secp256k1_gej *b) { - secp256k1_fe z2s; - secp256k1_fe u1, u2, s1, s2; - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - /* Check a.x * b.z^2 == b.x && a.y * b.z^3 == b.y, to avoid inverses. */ - secp256k1_fe_sqr(&z2s, &b->z); - secp256k1_fe_mul(&u1, &a->x, &z2s); - u2 = b->x; secp256k1_fe_normalize_weak(&u2); - secp256k1_fe_mul(&s1, &a->y, &z2s); secp256k1_fe_mul(&s1, &s1, &b->z); - s2 = b->y; secp256k1_fe_normalize_weak(&s2); - CHECK(secp256k1_fe_equal_var(&u1, &u2)); - CHECK(secp256k1_fe_equal_var(&s1, &s2)); -} - -void test_ge(void) { - int i, i1; -#ifdef USE_ENDOMORPHISM - int runs = 6; -#else - int runs = 4; -#endif - /* Points: (infinity, p1, p1, -p1, -p1, p2, p2, -p2, -p2, p3, p3, -p3, -p3, p4, p4, -p4, -p4). - * The second in each pair of identical points uses a random Z coordinate in the Jacobian form. - * All magnitudes are randomized. - * All 17*17 combinations of points are added to each other, using all applicable methods. - * - * When the endomorphism code is compiled in, p5 = lambda*p1 and p6 = lambda^2*p1 are added as well. - */ - secp256k1_ge *ge = (secp256k1_ge *)malloc(sizeof(secp256k1_ge) * (1 + 4 * runs)); - secp256k1_gej *gej = (secp256k1_gej *)malloc(sizeof(secp256k1_gej) * (1 + 4 * runs)); - secp256k1_fe *zinv = (secp256k1_fe *)malloc(sizeof(secp256k1_fe) * (1 + 4 * runs)); - secp256k1_fe zf; - secp256k1_fe zfi2, zfi3; - - secp256k1_gej_set_infinity(&gej[0]); - secp256k1_ge_clear(&ge[0]); - secp256k1_ge_set_gej_var(&ge[0], &gej[0]); - for (i = 0; i < runs; i++) { - int j; - secp256k1_ge g; - random_group_element_test(&g); -#ifdef USE_ENDOMORPHISM - if (i >= runs - 2) { - secp256k1_ge_mul_lambda(&g, &ge[1]); - } - if (i >= runs - 1) { - secp256k1_ge_mul_lambda(&g, &g); - } -#endif - ge[1 + 4 * i] = g; - ge[2 + 4 * i] = g; - secp256k1_ge_neg(&ge[3 + 4 * i], &g); - secp256k1_ge_neg(&ge[4 + 4 * i], &g); - secp256k1_gej_set_ge(&gej[1 + 4 * i], &ge[1 + 4 * i]); - random_group_element_jacobian_test(&gej[2 + 4 * i], &ge[2 + 4 * i]); - secp256k1_gej_set_ge(&gej[3 + 4 * i], &ge[3 + 4 * i]); - random_group_element_jacobian_test(&gej[4 + 4 * i], &ge[4 + 4 * i]); - for (j = 0; j < 4; j++) { - random_field_element_magnitude(&ge[1 + j + 4 * i].x); - random_field_element_magnitude(&ge[1 + j + 4 * i].y); - random_field_element_magnitude(&gej[1 + j + 4 * i].x); - random_field_element_magnitude(&gej[1 + j + 4 * i].y); - random_field_element_magnitude(&gej[1 + j + 4 * i].z); - } - } - - /* Compute z inverses. */ - { - secp256k1_fe *zs = malloc(sizeof(secp256k1_fe) * (1 + 4 * runs)); - for (i = 0; i < 4 * runs + 1; i++) { - if (i == 0) { - /* The point at infinity does not have a meaningful z inverse. Any should do. */ - do { - random_field_element_test(&zs[i]); - } while(secp256k1_fe_is_zero(&zs[i])); - } else { - zs[i] = gej[i].z; - } - } - secp256k1_fe_inv_all_var(zinv, zs, 4 * runs + 1); - free(zs); - } - - /* Generate random zf, and zfi2 = 1/zf^2, zfi3 = 1/zf^3 */ - do { - random_field_element_test(&zf); - } while(secp256k1_fe_is_zero(&zf)); - random_field_element_magnitude(&zf); - secp256k1_fe_inv_var(&zfi3, &zf); - secp256k1_fe_sqr(&zfi2, &zfi3); - secp256k1_fe_mul(&zfi3, &zfi3, &zfi2); - - for (i1 = 0; i1 < 1 + 4 * runs; i1++) { - int i2; - for (i2 = 0; i2 < 1 + 4 * runs; i2++) { - /* Compute reference result using gej + gej (var). */ - secp256k1_gej refj, resj; - secp256k1_ge ref; - secp256k1_fe zr; - secp256k1_gej_add_var(&refj, &gej[i1], &gej[i2], secp256k1_gej_is_infinity(&gej[i1]) ? NULL : &zr); - /* Check Z ratio. */ - if (!secp256k1_gej_is_infinity(&gej[i1]) && !secp256k1_gej_is_infinity(&refj)) { - secp256k1_fe zrz; secp256k1_fe_mul(&zrz, &zr, &gej[i1].z); - CHECK(secp256k1_fe_equal_var(&zrz, &refj.z)); - } - secp256k1_ge_set_gej_var(&ref, &refj); - - /* Test gej + ge with Z ratio result (var). */ - secp256k1_gej_add_ge_var(&resj, &gej[i1], &ge[i2], secp256k1_gej_is_infinity(&gej[i1]) ? NULL : &zr); - ge_equals_gej(&ref, &resj); - if (!secp256k1_gej_is_infinity(&gej[i1]) && !secp256k1_gej_is_infinity(&resj)) { - secp256k1_fe zrz; secp256k1_fe_mul(&zrz, &zr, &gej[i1].z); - CHECK(secp256k1_fe_equal_var(&zrz, &resj.z)); - } - - /* Test gej + ge (var, with additional Z factor). */ - { - secp256k1_ge ge2_zfi = ge[i2]; /* the second term with x and y rescaled for z = 1/zf */ - secp256k1_fe_mul(&ge2_zfi.x, &ge2_zfi.x, &zfi2); - secp256k1_fe_mul(&ge2_zfi.y, &ge2_zfi.y, &zfi3); - random_field_element_magnitude(&ge2_zfi.x); - random_field_element_magnitude(&ge2_zfi.y); - secp256k1_gej_add_zinv_var(&resj, &gej[i1], &ge2_zfi, &zf); - ge_equals_gej(&ref, &resj); - } - - /* Test gej + ge (const). */ - if (i2 != 0) { - /* secp256k1_gej_add_ge does not support its second argument being infinity. */ - secp256k1_gej_add_ge(&resj, &gej[i1], &ge[i2]); - ge_equals_gej(&ref, &resj); - } - - /* Test doubling (var). */ - if ((i1 == 0 && i2 == 0) || ((i1 + 3)/4 == (i2 + 3)/4 && ((i1 + 3)%4)/2 == ((i2 + 3)%4)/2)) { - secp256k1_fe zr2; - /* Normal doubling with Z ratio result. */ - secp256k1_gej_double_var(&resj, &gej[i1], &zr2); - ge_equals_gej(&ref, &resj); - /* Check Z ratio. */ - secp256k1_fe_mul(&zr2, &zr2, &gej[i1].z); - CHECK(secp256k1_fe_equal_var(&zr2, &resj.z)); - /* Normal doubling. */ - secp256k1_gej_double_var(&resj, &gej[i2], NULL); - ge_equals_gej(&ref, &resj); - } - - /* Test adding opposites. */ - if ((i1 == 0 && i2 == 0) || ((i1 + 3)/4 == (i2 + 3)/4 && ((i1 + 3)%4)/2 != ((i2 + 3)%4)/2)) { - CHECK(secp256k1_ge_is_infinity(&ref)); - } - - /* Test adding infinity. */ - if (i1 == 0) { - CHECK(secp256k1_ge_is_infinity(&ge[i1])); - CHECK(secp256k1_gej_is_infinity(&gej[i1])); - ge_equals_gej(&ref, &gej[i2]); - } - if (i2 == 0) { - CHECK(secp256k1_ge_is_infinity(&ge[i2])); - CHECK(secp256k1_gej_is_infinity(&gej[i2])); - ge_equals_gej(&ref, &gej[i1]); - } - } - } - - /* Test adding all points together in random order equals infinity. */ - { - secp256k1_gej sum = SECP256K1_GEJ_CONST_INFINITY; - secp256k1_gej *gej_shuffled = (secp256k1_gej *)malloc((4 * runs + 1) * sizeof(secp256k1_gej)); - for (i = 0; i < 4 * runs + 1; i++) { - gej_shuffled[i] = gej[i]; - } - for (i = 0; i < 4 * runs + 1; i++) { - int swap = i + secp256k1_rand_int(4 * runs + 1 - i); - if (swap != i) { - secp256k1_gej t = gej_shuffled[i]; - gej_shuffled[i] = gej_shuffled[swap]; - gej_shuffled[swap] = t; - } - } - for (i = 0; i < 4 * runs + 1; i++) { - secp256k1_gej_add_var(&sum, &sum, &gej_shuffled[i], NULL); - } - CHECK(secp256k1_gej_is_infinity(&sum)); - free(gej_shuffled); - } - - /* Test batch gej -> ge conversion with and without known z ratios. */ - { - secp256k1_fe *zr = (secp256k1_fe *)malloc((4 * runs + 1) * sizeof(secp256k1_fe)); - secp256k1_ge *ge_set_table = (secp256k1_ge *)malloc((4 * runs + 1) * sizeof(secp256k1_ge)); - secp256k1_ge *ge_set_all = (secp256k1_ge *)malloc((4 * runs + 1) * sizeof(secp256k1_ge)); - for (i = 0; i < 4 * runs + 1; i++) { - /* Compute gej[i + 1].z / gez[i].z (with gej[n].z taken to be 1). */ - if (i < 4 * runs) { - secp256k1_fe_mul(&zr[i + 1], &zinv[i], &gej[i + 1].z); - } - } - secp256k1_ge_set_table_gej_var(ge_set_table, gej, zr, 4 * runs + 1); - secp256k1_ge_set_all_gej_var(ge_set_all, gej, 4 * runs + 1, &ctx->error_callback); - for (i = 0; i < 4 * runs + 1; i++) { - secp256k1_fe s; - random_fe_non_zero(&s); - secp256k1_gej_rescale(&gej[i], &s); - ge_equals_gej(&ge_set_table[i], &gej[i]); - ge_equals_gej(&ge_set_all[i], &gej[i]); - } - free(ge_set_table); - free(ge_set_all); - free(zr); - } - - free(ge); - free(gej); - free(zinv); -} - -void test_add_neg_y_diff_x(void) { - /* The point of this test is to check that we can add two points - * whose y-coordinates are negatives of each other but whose x - * coordinates differ. If the x-coordinates were the same, these - * points would be negatives of each other and their sum is - * infinity. This is cool because it "covers up" any degeneracy - * in the addition algorithm that would cause the xy coordinates - * of the sum to be wrong (since infinity has no xy coordinates). - * HOWEVER, if the x-coordinates are different, infinity is the - * wrong answer, and such degeneracies are exposed. This is the - * root of https://github.com/bitcoin-core/secp256k1/issues/257 - * which this test is a regression test for. - * - * These points were generated in sage as - * # secp256k1 params - * F = FiniteField (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F) - * C = EllipticCurve ([F (0), F (7)]) - * G = C.lift_x(0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798) - * N = FiniteField(G.order()) - * - * # endomorphism values (lambda is 1^{1/3} in N, beta is 1^{1/3} in F) - * x = polygen(N) - * lam = (1 - x^3).roots()[1][0] - * - * # random "bad pair" - * P = C.random_element() - * Q = -int(lam) * P - * print " P: %x %x" % P.xy() - * print " Q: %x %x" % Q.xy() - * print "P + Q: %x %x" % (P + Q).xy() - */ - secp256k1_gej aj = SECP256K1_GEJ_CONST( - 0x8d24cd95, 0x0a355af1, 0x3c543505, 0x44238d30, - 0x0643d79f, 0x05a59614, 0x2f8ec030, 0xd58977cb, - 0x001e337a, 0x38093dcd, 0x6c0f386d, 0x0b1293a8, - 0x4d72c879, 0xd7681924, 0x44e6d2f3, 0x9190117d - ); - secp256k1_gej bj = SECP256K1_GEJ_CONST( - 0xc7b74206, 0x1f788cd9, 0xabd0937d, 0x164a0d86, - 0x95f6ff75, 0xf19a4ce9, 0xd013bd7b, 0xbf92d2a7, - 0xffe1cc85, 0xc7f6c232, 0x93f0c792, 0xf4ed6c57, - 0xb28d3786, 0x2897e6db, 0xbb192d0b, 0x6e6feab2 - ); - secp256k1_gej sumj = SECP256K1_GEJ_CONST( - 0x671a63c0, 0x3efdad4c, 0x389a7798, 0x24356027, - 0xb3d69010, 0x278625c3, 0x5c86d390, 0x184a8f7a, - 0x5f6409c2, 0x2ce01f2b, 0x511fd375, 0x25071d08, - 0xda651801, 0x70e95caf, 0x8f0d893c, 0xbed8fbbe - ); - secp256k1_ge b; - secp256k1_gej resj; - secp256k1_ge res; - secp256k1_ge_set_gej(&b, &bj); - - secp256k1_gej_add_var(&resj, &aj, &bj, NULL); - secp256k1_ge_set_gej(&res, &resj); - ge_equals_gej(&res, &sumj); - - secp256k1_gej_add_ge(&resj, &aj, &b); - secp256k1_ge_set_gej(&res, &resj); - ge_equals_gej(&res, &sumj); - - secp256k1_gej_add_ge_var(&resj, &aj, &b, NULL); - secp256k1_ge_set_gej(&res, &resj); - ge_equals_gej(&res, &sumj); -} - -void run_ge(void) { - int i; - for (i = 0; i < count * 32; i++) { - test_ge(); - } - test_add_neg_y_diff_x(); -} - -void test_ec_combine(void) { - secp256k1_scalar sum = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - secp256k1_pubkey data[6]; - const secp256k1_pubkey* d[6]; - secp256k1_pubkey sd; - secp256k1_pubkey sd2; - secp256k1_gej Qj; - secp256k1_ge Q; - int i; - for (i = 1; i <= 6; i++) { - secp256k1_scalar s; - random_scalar_order_test(&s); - secp256k1_scalar_add(&sum, &sum, &s); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &Qj, &s); - secp256k1_ge_set_gej(&Q, &Qj); - secp256k1_pubkey_save(&data[i - 1], &Q); - d[i - 1] = &data[i - 1]; - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &Qj, &sum); - secp256k1_ge_set_gej(&Q, &Qj); - secp256k1_pubkey_save(&sd, &Q); - CHECK(secp256k1_ec_pubkey_combine(ctx, &sd2, d, i) == 1); - CHECK(memcmp(&sd, &sd2, sizeof(sd)) == 0); - } -} - -void run_ec_combine(void) { - int i; - for (i = 0; i < count * 8; i++) { - test_ec_combine(); - } -} - -void test_group_decompress(const secp256k1_fe* x) { - /* The input itself, normalized. */ - secp256k1_fe fex = *x; - secp256k1_fe fez; - /* Results of set_xquad_var, set_xo_var(..., 0), set_xo_var(..., 1). */ - secp256k1_ge ge_quad, ge_even, ge_odd; - secp256k1_gej gej_quad; - /* Return values of the above calls. */ - int res_quad, res_even, res_odd; - - secp256k1_fe_normalize_var(&fex); - - res_quad = secp256k1_ge_set_xquad(&ge_quad, &fex); - res_even = secp256k1_ge_set_xo_var(&ge_even, &fex, 0); - res_odd = secp256k1_ge_set_xo_var(&ge_odd, &fex, 1); - - CHECK(res_quad == res_even); - CHECK(res_quad == res_odd); - - if (res_quad) { - secp256k1_fe_normalize_var(&ge_quad.x); - secp256k1_fe_normalize_var(&ge_odd.x); - secp256k1_fe_normalize_var(&ge_even.x); - secp256k1_fe_normalize_var(&ge_quad.y); - secp256k1_fe_normalize_var(&ge_odd.y); - secp256k1_fe_normalize_var(&ge_even.y); - - /* No infinity allowed. */ - CHECK(!ge_quad.infinity); - CHECK(!ge_even.infinity); - CHECK(!ge_odd.infinity); - - /* Check that the x coordinates check out. */ - CHECK(secp256k1_fe_equal_var(&ge_quad.x, x)); - CHECK(secp256k1_fe_equal_var(&ge_even.x, x)); - CHECK(secp256k1_fe_equal_var(&ge_odd.x, x)); - - /* Check that the Y coordinate result in ge_quad is a square. */ - CHECK(secp256k1_fe_is_quad_var(&ge_quad.y)); - - /* Check odd/even Y in ge_odd, ge_even. */ - CHECK(secp256k1_fe_is_odd(&ge_odd.y)); - CHECK(!secp256k1_fe_is_odd(&ge_even.y)); - - /* Check secp256k1_gej_has_quad_y_var. */ - secp256k1_gej_set_ge(&gej_quad, &ge_quad); - CHECK(secp256k1_gej_has_quad_y_var(&gej_quad)); - do { - random_fe_test(&fez); - } while (secp256k1_fe_is_zero(&fez)); - secp256k1_gej_rescale(&gej_quad, &fez); - CHECK(secp256k1_gej_has_quad_y_var(&gej_quad)); - secp256k1_gej_neg(&gej_quad, &gej_quad); - CHECK(!secp256k1_gej_has_quad_y_var(&gej_quad)); - do { - random_fe_test(&fez); - } while (secp256k1_fe_is_zero(&fez)); - secp256k1_gej_rescale(&gej_quad, &fez); - CHECK(!secp256k1_gej_has_quad_y_var(&gej_quad)); - secp256k1_gej_neg(&gej_quad, &gej_quad); - CHECK(secp256k1_gej_has_quad_y_var(&gej_quad)); - } -} - -void run_group_decompress(void) { - int i; - for (i = 0; i < count * 4; i++) { - secp256k1_fe fe; - random_fe_test(&fe); - test_group_decompress(&fe); - } -} - -/***** ECMULT TESTS *****/ - -void run_ecmult_chain(void) { - /* random starting point A (on the curve) */ - secp256k1_gej a = SECP256K1_GEJ_CONST( - 0x8b30bbe9, 0xae2a9906, 0x96b22f67, 0x0709dff3, - 0x727fd8bc, 0x04d3362c, 0x6c7bf458, 0xe2846004, - 0xa357ae91, 0x5c4a6528, 0x1309edf2, 0x0504740f, - 0x0eb33439, 0x90216b4f, 0x81063cb6, 0x5f2f7e0f - ); - /* two random initial factors xn and gn */ - secp256k1_scalar xn = SECP256K1_SCALAR_CONST( - 0x84cc5452, 0xf7fde1ed, 0xb4d38a8c, 0xe9b1b84c, - 0xcef31f14, 0x6e569be9, 0x705d357a, 0x42985407 - ); - secp256k1_scalar gn = SECP256K1_SCALAR_CONST( - 0xa1e58d22, 0x553dcd42, 0xb2398062, 0x5d4c57a9, - 0x6e9323d4, 0x2b3152e5, 0xca2c3990, 0xedc7c9de - ); - /* two small multipliers to be applied to xn and gn in every iteration: */ - static const secp256k1_scalar xf = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0x1337); - static const secp256k1_scalar gf = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0x7113); - /* accumulators with the resulting coefficients to A and G */ - secp256k1_scalar ae = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_scalar ge = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - /* actual points */ - secp256k1_gej x; - secp256k1_gej x2; - int i; - - /* the point being computed */ - x = a; - for (i = 0; i < 200*count; i++) { - /* in each iteration, compute X = xn*X + gn*G; */ - secp256k1_ecmult(&ctx->ecmult_ctx, &x, &x, &xn, &gn); - /* also compute ae and ge: the actual accumulated factors for A and G */ - /* if X was (ae*A+ge*G), xn*X + gn*G results in (xn*ae*A + (xn*ge+gn)*G) */ - secp256k1_scalar_mul(&ae, &ae, &xn); - secp256k1_scalar_mul(&ge, &ge, &xn); - secp256k1_scalar_add(&ge, &ge, &gn); - /* modify xn and gn */ - secp256k1_scalar_mul(&xn, &xn, &xf); - secp256k1_scalar_mul(&gn, &gn, &gf); - - /* verify */ - if (i == 19999) { - /* expected result after 19999 iterations */ - secp256k1_gej rp = SECP256K1_GEJ_CONST( - 0xD6E96687, 0xF9B10D09, 0x2A6F3543, 0x9D86CEBE, - 0xA4535D0D, 0x409F5358, 0x6440BD74, 0xB933E830, - 0xB95CBCA2, 0xC77DA786, 0x539BE8FD, 0x53354D2D, - 0x3B4F566A, 0xE6580454, 0x07ED6015, 0xEE1B2A88 - ); - - secp256k1_gej_neg(&rp, &rp); - secp256k1_gej_add_var(&rp, &rp, &x, NULL); - CHECK(secp256k1_gej_is_infinity(&rp)); - } - } - /* redo the computation, but directly with the resulting ae and ge coefficients: */ - secp256k1_ecmult(&ctx->ecmult_ctx, &x2, &a, &ae, &ge); - secp256k1_gej_neg(&x2, &x2); - secp256k1_gej_add_var(&x2, &x2, &x, NULL); - CHECK(secp256k1_gej_is_infinity(&x2)); -} - -void test_point_times_order(const secp256k1_gej *point) { - /* X * (point + G) + (order-X) * (pointer + G) = 0 */ - secp256k1_scalar x; - secp256k1_scalar nx; - secp256k1_scalar zero = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - secp256k1_scalar one = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_gej res1, res2; - secp256k1_ge res3; - unsigned char pub[65]; - size_t psize = 65; - random_scalar_order_test(&x); - secp256k1_scalar_negate(&nx, &x); - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &x, &x); /* calc res1 = x * point + x * G; */ - secp256k1_ecmult(&ctx->ecmult_ctx, &res2, point, &nx, &nx); /* calc res2 = (order - x) * point + (order - x) * G; */ - secp256k1_gej_add_var(&res1, &res1, &res2, NULL); - CHECK(secp256k1_gej_is_infinity(&res1)); - CHECK(secp256k1_gej_is_valid_var(&res1) == 0); - secp256k1_ge_set_gej(&res3, &res1); - CHECK(secp256k1_ge_is_infinity(&res3)); - CHECK(secp256k1_ge_is_valid_var(&res3) == 0); - CHECK(secp256k1_eckey_pubkey_serialize(&res3, pub, &psize, 0) == 0); - psize = 65; - CHECK(secp256k1_eckey_pubkey_serialize(&res3, pub, &psize, 1) == 0); - /* check zero/one edge cases */ - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &zero, &zero); - secp256k1_ge_set_gej(&res3, &res1); - CHECK(secp256k1_ge_is_infinity(&res3)); - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &one, &zero); - secp256k1_ge_set_gej(&res3, &res1); - ge_equals_gej(&res3, point); - secp256k1_ecmult(&ctx->ecmult_ctx, &res1, point, &zero, &one); - secp256k1_ge_set_gej(&res3, &res1); - ge_equals_ge(&res3, &secp256k1_ge_const_g); -} - -void run_point_times_order(void) { - int i; - secp256k1_fe x = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 2); - static const secp256k1_fe xr = SECP256K1_FE_CONST( - 0x7603CB59, 0xB0EF6C63, 0xFE608479, 0x2A0C378C, - 0xDB3233A8, 0x0F8A9A09, 0xA877DEAD, 0x31B38C45 - ); - for (i = 0; i < 500; i++) { - secp256k1_ge p; - if (secp256k1_ge_set_xo_var(&p, &x, 1)) { - secp256k1_gej j; - CHECK(secp256k1_ge_is_valid_var(&p)); - secp256k1_gej_set_ge(&j, &p); - CHECK(secp256k1_gej_is_valid_var(&j)); - test_point_times_order(&j); - } - secp256k1_fe_sqr(&x, &x); - } - secp256k1_fe_normalize_var(&x); - CHECK(secp256k1_fe_equal_var(&x, &xr)); -} - -void ecmult_const_random_mult(void) { - /* random starting point A (on the curve) */ - secp256k1_ge a = SECP256K1_GE_CONST( - 0x6d986544, 0x57ff52b8, 0xcf1b8126, 0x5b802a5b, - 0xa97f9263, 0xb1e88044, 0x93351325, 0x91bc450a, - 0x535c59f7, 0x325e5d2b, 0xc391fbe8, 0x3c12787c, - 0x337e4a98, 0xe82a9011, 0x0123ba37, 0xdd769c7d - ); - /* random initial factor xn */ - secp256k1_scalar xn = SECP256K1_SCALAR_CONST( - 0x649d4f77, 0xc4242df7, 0x7f2079c9, 0x14530327, - 0xa31b876a, 0xd2d8ce2a, 0x2236d5c6, 0xd7b2029b - ); - /* expected xn * A (from sage) */ - secp256k1_ge expected_b = SECP256K1_GE_CONST( - 0x23773684, 0x4d209dc7, 0x098a786f, 0x20d06fcd, - 0x070a38bf, 0xc11ac651, 0x03004319, 0x1e2a8786, - 0xed8c3b8e, 0xc06dd57b, 0xd06ea66e, 0x45492b0f, - 0xb84e4e1b, 0xfb77e21f, 0x96baae2a, 0x63dec956 - ); - secp256k1_gej b; - secp256k1_ecmult_const(&b, &a, &xn); - - CHECK(secp256k1_ge_is_valid_var(&a)); - ge_equals_gej(&expected_b, &b); -} - -void ecmult_const_commutativity(void) { - secp256k1_scalar a; - secp256k1_scalar b; - secp256k1_gej res1; - secp256k1_gej res2; - secp256k1_ge mid1; - secp256k1_ge mid2; - random_scalar_order_test(&a); - random_scalar_order_test(&b); - - secp256k1_ecmult_const(&res1, &secp256k1_ge_const_g, &a); - secp256k1_ecmult_const(&res2, &secp256k1_ge_const_g, &b); - secp256k1_ge_set_gej(&mid1, &res1); - secp256k1_ge_set_gej(&mid2, &res2); - secp256k1_ecmult_const(&res1, &mid1, &b); - secp256k1_ecmult_const(&res2, &mid2, &a); - secp256k1_ge_set_gej(&mid1, &res1); - secp256k1_ge_set_gej(&mid2, &res2); - ge_equals_ge(&mid1, &mid2); -} - -void ecmult_const_mult_zero_one(void) { - secp256k1_scalar zero = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 0); - secp256k1_scalar one = SECP256K1_SCALAR_CONST(0, 0, 0, 0, 0, 0, 0, 1); - secp256k1_scalar negone; - secp256k1_gej res1; - secp256k1_ge res2; - secp256k1_ge point; - secp256k1_scalar_negate(&negone, &one); - - random_group_element_test(&point); - secp256k1_ecmult_const(&res1, &point, &zero); - secp256k1_ge_set_gej(&res2, &res1); - CHECK(secp256k1_ge_is_infinity(&res2)); - secp256k1_ecmult_const(&res1, &point, &one); - secp256k1_ge_set_gej(&res2, &res1); - ge_equals_ge(&res2, &point); - secp256k1_ecmult_const(&res1, &point, &negone); - secp256k1_gej_neg(&res1, &res1); - secp256k1_ge_set_gej(&res2, &res1); - ge_equals_ge(&res2, &point); -} - -void ecmult_const_chain_multiply(void) { - /* Check known result (randomly generated test problem from sage) */ - const secp256k1_scalar scalar = SECP256K1_SCALAR_CONST( - 0x4968d524, 0x2abf9b7a, 0x466abbcf, 0x34b11b6d, - 0xcd83d307, 0x827bed62, 0x05fad0ce, 0x18fae63b - ); - const secp256k1_gej expected_point = SECP256K1_GEJ_CONST( - 0x5494c15d, 0x32099706, 0xc2395f94, 0x348745fd, - 0x757ce30e, 0x4e8c90fb, 0xa2bad184, 0xf883c69f, - 0x5d195d20, 0xe191bf7f, 0x1be3e55f, 0x56a80196, - 0x6071ad01, 0xf1462f66, 0xc997fa94, 0xdb858435 - ); - secp256k1_gej point; - secp256k1_ge res; - int i; - - secp256k1_gej_set_ge(&point, &secp256k1_ge_const_g); - for (i = 0; i < 100; ++i) { - secp256k1_ge tmp; - secp256k1_ge_set_gej(&tmp, &point); - secp256k1_ecmult_const(&point, &tmp, &scalar); - } - secp256k1_ge_set_gej(&res, &point); - ge_equals_gej(&res, &expected_point); -} - -void run_ecmult_const_tests(void) { - ecmult_const_mult_zero_one(); - ecmult_const_random_mult(); - ecmult_const_commutativity(); - ecmult_const_chain_multiply(); -} - -void test_wnaf(const secp256k1_scalar *number, int w) { - secp256k1_scalar x, two, t; - int wnaf[256]; - int zeroes = -1; - int i; - int bits; - secp256k1_scalar_set_int(&x, 0); - secp256k1_scalar_set_int(&two, 2); - bits = secp256k1_ecmult_wnaf(wnaf, 256, number, w); - CHECK(bits <= 256); - for (i = bits-1; i >= 0; i--) { - int v = wnaf[i]; - secp256k1_scalar_mul(&x, &x, &two); - if (v) { - CHECK(zeroes == -1 || zeroes >= w-1); /* check that distance between non-zero elements is at least w-1 */ - zeroes=0; - CHECK((v & 1) == 1); /* check non-zero elements are odd */ - CHECK(v <= (1 << (w-1)) - 1); /* check range below */ - CHECK(v >= -(1 << (w-1)) - 1); /* check range above */ - } else { - CHECK(zeroes != -1); /* check that no unnecessary zero padding exists */ - zeroes++; - } - if (v >= 0) { - secp256k1_scalar_set_int(&t, v); - } else { - secp256k1_scalar_set_int(&t, -v); - secp256k1_scalar_negate(&t, &t); - } - secp256k1_scalar_add(&x, &x, &t); - } - CHECK(secp256k1_scalar_eq(&x, number)); /* check that wnaf represents number */ -} - -void test_constant_wnaf_negate(const secp256k1_scalar *number) { - secp256k1_scalar neg1 = *number; - secp256k1_scalar neg2 = *number; - int sign1 = 1; - int sign2 = 1; - - if (!secp256k1_scalar_get_bits(&neg1, 0, 1)) { - secp256k1_scalar_negate(&neg1, &neg1); - sign1 = -1; - } - sign2 = secp256k1_scalar_cond_negate(&neg2, secp256k1_scalar_is_even(&neg2)); - CHECK(sign1 == sign2); - CHECK(secp256k1_scalar_eq(&neg1, &neg2)); -} - -void test_constant_wnaf(const secp256k1_scalar *number, int w) { - secp256k1_scalar x, shift; - int wnaf[256] = {0}; - int i; - int skew; - secp256k1_scalar num = *number; - - secp256k1_scalar_set_int(&x, 0); - secp256k1_scalar_set_int(&shift, 1 << w); - /* With USE_ENDOMORPHISM on we only consider 128-bit numbers */ -#ifdef USE_ENDOMORPHISM - for (i = 0; i < 16; ++i) { - secp256k1_scalar_shr_int(&num, 8); - } -#endif - skew = secp256k1_wnaf_const(wnaf, num, w); - - for (i = WNAF_SIZE(w); i >= 0; --i) { - secp256k1_scalar t; - int v = wnaf[i]; - CHECK(v != 0); /* check nonzero */ - CHECK(v & 1); /* check parity */ - CHECK(v > -(1 << w)); /* check range above */ - CHECK(v < (1 << w)); /* check range below */ - - secp256k1_scalar_mul(&x, &x, &shift); - if (v >= 0) { - secp256k1_scalar_set_int(&t, v); - } else { - secp256k1_scalar_set_int(&t, -v); - secp256k1_scalar_negate(&t, &t); - } - secp256k1_scalar_add(&x, &x, &t); - } - /* Skew num because when encoding numbers as odd we use an offset */ - secp256k1_scalar_cadd_bit(&num, skew == 2, 1); - CHECK(secp256k1_scalar_eq(&x, &num)); -} - -void run_wnaf(void) { - int i; - secp256k1_scalar n = {{0}}; - - /* Sanity check: 1 and 2 are the smallest odd and even numbers and should - * have easier-to-diagnose failure modes */ - n.d[0] = 1; - test_constant_wnaf(&n, 4); - n.d[0] = 2; - test_constant_wnaf(&n, 4); - /* Random tests */ - for (i = 0; i < count; i++) { - random_scalar_order(&n); - test_wnaf(&n, 4+(i%10)); - test_constant_wnaf_negate(&n); - test_constant_wnaf(&n, 4 + (i % 10)); - } - secp256k1_scalar_set_int(&n, 0); - CHECK(secp256k1_scalar_cond_negate(&n, 1) == -1); - CHECK(secp256k1_scalar_is_zero(&n)); - CHECK(secp256k1_scalar_cond_negate(&n, 0) == 1); - CHECK(secp256k1_scalar_is_zero(&n)); -} - -void test_ecmult_constants(void) { - /* Test ecmult_gen() for [0..36) and [order-36..0). */ - secp256k1_scalar x; - secp256k1_gej r; - secp256k1_ge ng; - int i; - int j; - secp256k1_ge_neg(&ng, &secp256k1_ge_const_g); - for (i = 0; i < 36; i++ ) { - secp256k1_scalar_set_int(&x, i); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &r, &x); - for (j = 0; j < i; j++) { - if (j == i - 1) { - ge_equals_gej(&secp256k1_ge_const_g, &r); - } - secp256k1_gej_add_ge(&r, &r, &ng); - } - CHECK(secp256k1_gej_is_infinity(&r)); - } - for (i = 1; i <= 36; i++ ) { - secp256k1_scalar_set_int(&x, i); - secp256k1_scalar_negate(&x, &x); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &r, &x); - for (j = 0; j < i; j++) { - if (j == i - 1) { - ge_equals_gej(&ng, &r); - } - secp256k1_gej_add_ge(&r, &r, &secp256k1_ge_const_g); - } - CHECK(secp256k1_gej_is_infinity(&r)); - } -} - -void run_ecmult_constants(void) { - test_ecmult_constants(); -} - -void test_ecmult_gen_blind(void) { - /* Test ecmult_gen() blinding and confirm that the blinding changes, the affine points match, and the z's don't match. */ - secp256k1_scalar key; - secp256k1_scalar b; - unsigned char seed32[32]; - secp256k1_gej pgej; - secp256k1_gej pgej2; - secp256k1_gej i; - secp256k1_ge pge; - random_scalar_order_test(&key); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pgej, &key); - secp256k1_rand256(seed32); - b = ctx->ecmult_gen_ctx.blind; - i = ctx->ecmult_gen_ctx.initial; - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, seed32); - CHECK(!secp256k1_scalar_eq(&b, &ctx->ecmult_gen_ctx.blind)); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pgej2, &key); - CHECK(!gej_xyz_equals_gej(&pgej, &pgej2)); - CHECK(!gej_xyz_equals_gej(&i, &ctx->ecmult_gen_ctx.initial)); - secp256k1_ge_set_gej(&pge, &pgej); - ge_equals_gej(&pge, &pgej2); -} - -void test_ecmult_gen_blind_reset(void) { - /* Test ecmult_gen() blinding reset and confirm that the blinding is consistent. */ - secp256k1_scalar b; - secp256k1_gej initial; - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, 0); - b = ctx->ecmult_gen_ctx.blind; - initial = ctx->ecmult_gen_ctx.initial; - secp256k1_ecmult_gen_blind(&ctx->ecmult_gen_ctx, 0); - CHECK(secp256k1_scalar_eq(&b, &ctx->ecmult_gen_ctx.blind)); - CHECK(gej_xyz_equals_gej(&initial, &ctx->ecmult_gen_ctx.initial)); -} - -void run_ecmult_gen_blind(void) { - int i; - test_ecmult_gen_blind_reset(); - for (i = 0; i < 10; i++) { - test_ecmult_gen_blind(); - } -} - -#ifdef USE_ENDOMORPHISM -/***** ENDOMORPHISH TESTS *****/ -void test_scalar_split(void) { - secp256k1_scalar full; - secp256k1_scalar s1, slam; - const unsigned char zero[32] = {0}; - unsigned char tmp[32]; - - random_scalar_order_test(&full); - secp256k1_scalar_split_lambda(&s1, &slam, &full); - - /* check that both are <= 128 bits in size */ - if (secp256k1_scalar_is_high(&s1)) { - secp256k1_scalar_negate(&s1, &s1); - } - if (secp256k1_scalar_is_high(&slam)) { - secp256k1_scalar_negate(&slam, &slam); - } - - secp256k1_scalar_get_b32(tmp, &s1); - CHECK(memcmp(zero, tmp, 16) == 0); - secp256k1_scalar_get_b32(tmp, &slam); - CHECK(memcmp(zero, tmp, 16) == 0); -} - -void run_endomorphism_tests(void) { - test_scalar_split(); -} -#endif - -void ec_pubkey_parse_pointtest(const unsigned char *input, int xvalid, int yvalid) { - unsigned char pubkeyc[65]; - secp256k1_pubkey pubkey; - secp256k1_ge ge; - size_t pubkeyclen; - int32_t ecount; - ecount = 0; - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - for (pubkeyclen = 3; pubkeyclen <= 65; pubkeyclen++) { - /* Smaller sizes are tested exhaustively elsewhere. */ - int32_t i; - memcpy(&pubkeyc[1], input, 64); - VG_UNDEF(&pubkeyc[pubkeyclen], 65 - pubkeyclen); - for (i = 0; i < 256; i++) { - /* Try all type bytes. */ - int xpass; - int ypass; - int ysign; - pubkeyc[0] = i; - /* What sign does this point have? */ - ysign = (input[63] & 1) + 2; - /* For the current type (i) do we expect parsing to work? Handled all of compressed/uncompressed/hybrid. */ - xpass = xvalid && (pubkeyclen == 33) && ((i & 254) == 2); - /* Do we expect a parse and re-serialize as uncompressed to give a matching y? */ - ypass = xvalid && yvalid && ((i & 4) == ((pubkeyclen == 65) << 2)) && - ((i == 4) || ((i & 251) == ysign)) && ((pubkeyclen == 33) || (pubkeyclen == 65)); - if (xpass || ypass) { - /* These cases must parse. */ - unsigned char pubkeyo[65]; - size_t outl; - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - ecount = 0; - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, pubkeyclen) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - outl = 65; - VG_UNDEF(pubkeyo, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, pubkeyo, &outl, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - VG_CHECK(pubkeyo, outl); - CHECK(outl == 33); - CHECK(memcmp(&pubkeyo[1], &pubkeyc[1], 32) == 0); - CHECK((pubkeyclen != 33) || (pubkeyo[0] == pubkeyc[0])); - if (ypass) { - /* This test isn't always done because we decode with alternative signs, so the y won't match. */ - CHECK(pubkeyo[0] == ysign); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 1); - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - secp256k1_pubkey_save(&pubkey, &ge); - VG_CHECK(&pubkey, sizeof(pubkey)); - outl = 65; - VG_UNDEF(pubkeyo, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, pubkeyo, &outl, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 1); - VG_CHECK(pubkeyo, outl); - CHECK(outl == 65); - CHECK(pubkeyo[0] == 4); - CHECK(memcmp(&pubkeyo[1], input, 64) == 0); - } - CHECK(ecount == 0); - } else { - /* These cases must fail to parse. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, pubkeyclen) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - } - } - } - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); -} - -void run_ec_pubkey_parse_test(void) { -#define SECP256K1_EC_PARSE_TEST_NVALID (12) - const unsigned char valid[SECP256K1_EC_PARSE_TEST_NVALID][64] = { - { - /* Point with leading and trailing zeros in x and y serialization. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x52, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x64, 0xef, 0xa1, 0x7b, 0x77, 0x61, 0xe1, 0xe4, 0x27, 0x06, 0x98, 0x9f, 0xb4, 0x83, - 0xb8, 0xd2, 0xd4, 0x9b, 0xf7, 0x8f, 0xae, 0x98, 0x03, 0xf0, 0x99, 0xb8, 0x34, 0xed, 0xeb, 0x00 - }, - { - /* Point with x equal to a 3rd root of unity.*/ - 0x7a, 0xe9, 0x6a, 0x2b, 0x65, 0x7c, 0x07, 0x10, 0x6e, 0x64, 0x47, 0x9e, 0xac, 0x34, 0x34, 0xe9, - 0x9c, 0xf0, 0x49, 0x75, 0x12, 0xf5, 0x89, 0x95, 0xc1, 0x39, 0x6c, 0x28, 0x71, 0x95, 0x01, 0xee, - 0x42, 0x18, 0xf2, 0x0a, 0xe6, 0xc6, 0x46, 0xb3, 0x63, 0xdb, 0x68, 0x60, 0x58, 0x22, 0xfb, 0x14, - 0x26, 0x4c, 0xa8, 0xd2, 0x58, 0x7f, 0xdd, 0x6f, 0xbc, 0x75, 0x0d, 0x58, 0x7e, 0x76, 0xa7, 0xee, - }, - { - /* Point with largest x. (1/2) */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2c, - 0x0e, 0x99, 0x4b, 0x14, 0xea, 0x72, 0xf8, 0xc3, 0xeb, 0x95, 0xc7, 0x1e, 0xf6, 0x92, 0x57, 0x5e, - 0x77, 0x50, 0x58, 0x33, 0x2d, 0x7e, 0x52, 0xd0, 0x99, 0x5c, 0xf8, 0x03, 0x88, 0x71, 0xb6, 0x7d, - }, - { - /* Point with largest x. (2/2) */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2c, - 0xf1, 0x66, 0xb4, 0xeb, 0x15, 0x8d, 0x07, 0x3c, 0x14, 0x6a, 0x38, 0xe1, 0x09, 0x6d, 0xa8, 0xa1, - 0x88, 0xaf, 0xa7, 0xcc, 0xd2, 0x81, 0xad, 0x2f, 0x66, 0xa3, 0x07, 0xfb, 0x77, 0x8e, 0x45, 0xb2, - }, - { - /* Point with smallest x. (1/2) */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x42, 0x18, 0xf2, 0x0a, 0xe6, 0xc6, 0x46, 0xb3, 0x63, 0xdb, 0x68, 0x60, 0x58, 0x22, 0xfb, 0x14, - 0x26, 0x4c, 0xa8, 0xd2, 0x58, 0x7f, 0xdd, 0x6f, 0xbc, 0x75, 0x0d, 0x58, 0x7e, 0x76, 0xa7, 0xee, - }, - { - /* Point with smallest x. (2/2) */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0xbd, 0xe7, 0x0d, 0xf5, 0x19, 0x39, 0xb9, 0x4c, 0x9c, 0x24, 0x97, 0x9f, 0xa7, 0xdd, 0x04, 0xeb, - 0xd9, 0xb3, 0x57, 0x2d, 0xa7, 0x80, 0x22, 0x90, 0x43, 0x8a, 0xf2, 0xa6, 0x81, 0x89, 0x54, 0x41, - }, - { - /* Point with largest y. (1/3) */ - 0x1f, 0xe1, 0xe5, 0xef, 0x3f, 0xce, 0xb5, 0xc1, 0x35, 0xab, 0x77, 0x41, 0x33, 0x3c, 0xe5, 0xa6, - 0xe8, 0x0d, 0x68, 0x16, 0x76, 0x53, 0xf6, 0xb2, 0xb2, 0x4b, 0xcb, 0xcf, 0xaa, 0xaf, 0xf5, 0x07, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - }, - { - /* Point with largest y. (2/3) */ - 0xcb, 0xb0, 0xde, 0xab, 0x12, 0x57, 0x54, 0xf1, 0xfd, 0xb2, 0x03, 0x8b, 0x04, 0x34, 0xed, 0x9c, - 0xb3, 0xfb, 0x53, 0xab, 0x73, 0x53, 0x91, 0x12, 0x99, 0x94, 0xa5, 0x35, 0xd9, 0x25, 0xf6, 0x73, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - }, - { - /* Point with largest y. (3/3) */ - 0x14, 0x6d, 0x3b, 0x65, 0xad, 0xd9, 0xf5, 0x4c, 0xcc, 0xa2, 0x85, 0x33, 0xc8, 0x8e, 0x2c, 0xbc, - 0x63, 0xf7, 0x44, 0x3e, 0x16, 0x58, 0x78, 0x3a, 0xb4, 0x1f, 0x8e, 0xf9, 0x7c, 0x2a, 0x10, 0xb5, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - }, - { - /* Point with smallest y. (1/3) */ - 0x1f, 0xe1, 0xe5, 0xef, 0x3f, 0xce, 0xb5, 0xc1, 0x35, 0xab, 0x77, 0x41, 0x33, 0x3c, 0xe5, 0xa6, - 0xe8, 0x0d, 0x68, 0x16, 0x76, 0x53, 0xf6, 0xb2, 0xb2, 0x4b, 0xcb, 0xcf, 0xaa, 0xaf, 0xf5, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }, - { - /* Point with smallest y. (2/3) */ - 0xcb, 0xb0, 0xde, 0xab, 0x12, 0x57, 0x54, 0xf1, 0xfd, 0xb2, 0x03, 0x8b, 0x04, 0x34, 0xed, 0x9c, - 0xb3, 0xfb, 0x53, 0xab, 0x73, 0x53, 0x91, 0x12, 0x99, 0x94, 0xa5, 0x35, 0xd9, 0x25, 0xf6, 0x73, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }, - { - /* Point with smallest y. (3/3) */ - 0x14, 0x6d, 0x3b, 0x65, 0xad, 0xd9, 0xf5, 0x4c, 0xcc, 0xa2, 0x85, 0x33, 0xc8, 0x8e, 0x2c, 0xbc, - 0x63, 0xf7, 0x44, 0x3e, 0x16, 0x58, 0x78, 0x3a, 0xb4, 0x1f, 0x8e, 0xf9, 0x7c, 0x2a, 0x10, 0xb5, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 - } - }; -#define SECP256K1_EC_PARSE_TEST_NXVALID (4) - const unsigned char onlyxvalid[SECP256K1_EC_PARSE_TEST_NXVALID][64] = { - { - /* Valid if y overflow ignored (y = 1 mod p). (1/3) */ - 0x1f, 0xe1, 0xe5, 0xef, 0x3f, 0xce, 0xb5, 0xc1, 0x35, 0xab, 0x77, 0x41, 0x33, 0x3c, 0xe5, 0xa6, - 0xe8, 0x0d, 0x68, 0x16, 0x76, 0x53, 0xf6, 0xb2, 0xb2, 0x4b, 0xcb, 0xcf, 0xaa, 0xaf, 0xf5, 0x07, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - }, - { - /* Valid if y overflow ignored (y = 1 mod p). (2/3) */ - 0xcb, 0xb0, 0xde, 0xab, 0x12, 0x57, 0x54, 0xf1, 0xfd, 0xb2, 0x03, 0x8b, 0x04, 0x34, 0xed, 0x9c, - 0xb3, 0xfb, 0x53, 0xab, 0x73, 0x53, 0x91, 0x12, 0x99, 0x94, 0xa5, 0x35, 0xd9, 0x25, 0xf6, 0x73, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - }, - { - /* Valid if y overflow ignored (y = 1 mod p). (3/3)*/ - 0x14, 0x6d, 0x3b, 0x65, 0xad, 0xd9, 0xf5, 0x4c, 0xcc, 0xa2, 0x85, 0x33, 0xc8, 0x8e, 0x2c, 0xbc, - 0x63, 0xf7, 0x44, 0x3e, 0x16, 0x58, 0x78, 0x3a, 0xb4, 0x1f, 0x8e, 0xf9, 0x7c, 0x2a, 0x10, 0xb5, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - }, - { - /* x on curve, y is from y^2 = x^3 + 8. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 - } - }; -#define SECP256K1_EC_PARSE_TEST_NINVALID (7) - const unsigned char invalid[SECP256K1_EC_PARSE_TEST_NINVALID][64] = { - { - /* x is third root of -8, y is -1 * (x^3+7); also on the curve for y^2 = x^3 + 9. */ - 0x0a, 0x2d, 0x2b, 0xa9, 0x35, 0x07, 0xf1, 0xdf, 0x23, 0x37, 0x70, 0xc2, 0xa7, 0x97, 0x96, 0x2c, - 0xc6, 0x1f, 0x6d, 0x15, 0xda, 0x14, 0xec, 0xd4, 0x7d, 0x8d, 0x27, 0xae, 0x1c, 0xd5, 0xf8, 0x53, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }, - { - /* Valid if x overflow ignored (x = 1 mod p). */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - 0x42, 0x18, 0xf2, 0x0a, 0xe6, 0xc6, 0x46, 0xb3, 0x63, 0xdb, 0x68, 0x60, 0x58, 0x22, 0xfb, 0x14, - 0x26, 0x4c, 0xa8, 0xd2, 0x58, 0x7f, 0xdd, 0x6f, 0xbc, 0x75, 0x0d, 0x58, 0x7e, 0x76, 0xa7, 0xee, - }, - { - /* Valid if x overflow ignored (x = 1 mod p). */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x30, - 0xbd, 0xe7, 0x0d, 0xf5, 0x19, 0x39, 0xb9, 0x4c, 0x9c, 0x24, 0x97, 0x9f, 0xa7, 0xdd, 0x04, 0xeb, - 0xd9, 0xb3, 0x57, 0x2d, 0xa7, 0x80, 0x22, 0x90, 0x43, 0x8a, 0xf2, 0xa6, 0x81, 0x89, 0x54, 0x41, - }, - { - /* x is -1, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 5. */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - 0xf4, 0x84, 0x14, 0x5c, 0xb0, 0x14, 0x9b, 0x82, 0x5d, 0xff, 0x41, 0x2f, 0xa0, 0x52, 0xa8, 0x3f, - 0xcb, 0x72, 0xdb, 0x61, 0xd5, 0x6f, 0x37, 0x70, 0xce, 0x06, 0x6b, 0x73, 0x49, 0xa2, 0xaa, 0x28, - }, - { - /* x is -1, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 5. */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2e, - 0x0b, 0x7b, 0xeb, 0xa3, 0x4f, 0xeb, 0x64, 0x7d, 0xa2, 0x00, 0xbe, 0xd0, 0x5f, 0xad, 0x57, 0xc0, - 0x34, 0x8d, 0x24, 0x9e, 0x2a, 0x90, 0xc8, 0x8f, 0x31, 0xf9, 0x94, 0x8b, 0xb6, 0x5d, 0x52, 0x07, - }, - { - /* x is zero, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 7. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x8f, 0x53, 0x7e, 0xef, 0xdf, 0xc1, 0x60, 0x6a, 0x07, 0x27, 0xcd, 0x69, 0xb4, 0xa7, 0x33, 0x3d, - 0x38, 0xed, 0x44, 0xe3, 0x93, 0x2a, 0x71, 0x79, 0xee, 0xcb, 0x4b, 0x6f, 0xba, 0x93, 0x60, 0xdc, - }, - { - /* x is zero, y is the result of the sqrt ladder; also on the curve for y^2 = x^3 - 7. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x70, 0xac, 0x81, 0x10, 0x20, 0x3e, 0x9f, 0x95, 0xf8, 0xd8, 0x32, 0x96, 0x4b, 0x58, 0xcc, 0xc2, - 0xc7, 0x12, 0xbb, 0x1c, 0x6c, 0xd5, 0x8e, 0x86, 0x11, 0x34, 0xb4, 0x8f, 0x45, 0x6c, 0x9b, 0x53 - } - }; - const unsigned char pubkeyc[66] = { - /* Serialization of G. */ - 0x04, 0x79, 0xBE, 0x66, 0x7E, 0xF9, 0xDC, 0xBB, 0xAC, 0x55, 0xA0, 0x62, 0x95, 0xCE, 0x87, 0x0B, - 0x07, 0x02, 0x9B, 0xFC, 0xDB, 0x2D, 0xCE, 0x28, 0xD9, 0x59, 0xF2, 0x81, 0x5B, 0x16, 0xF8, 0x17, - 0x98, 0x48, 0x3A, 0xDA, 0x77, 0x26, 0xA3, 0xC4, 0x65, 0x5D, 0xA4, 0xFB, 0xFC, 0x0E, 0x11, 0x08, - 0xA8, 0xFD, 0x17, 0xB4, 0x48, 0xA6, 0x85, 0x54, 0x19, 0x9C, 0x47, 0xD0, 0x8F, 0xFB, 0x10, 0xD4, - 0xB8, 0x00 - }; - unsigned char sout[65]; - unsigned char shortkey[2]; - secp256k1_ge ge; - secp256k1_pubkey pubkey; - size_t len; - int32_t i; - int32_t ecount; - int32_t ecount2; - ecount = 0; - /* Nothing should be reading this far into pubkeyc. */ - VG_UNDEF(&pubkeyc[65], 1); - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - /* Zero length claimed, fail, zeroize, no illegal arg error. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(shortkey, 2); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, shortkey, 0) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* Length one claimed, fail, zeroize, no illegal arg error. */ - for (i = 0; i < 256 ; i++) { - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - shortkey[0] = i; - VG_UNDEF(&shortkey[1], 1); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, shortkey, 1) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - } - /* Length two claimed, fail, zeroize, no illegal arg error. */ - for (i = 0; i < 65536 ; i++) { - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - shortkey[0] = i & 255; - shortkey[1] = i >> 8; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, shortkey, 2) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - } - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - /* 33 bytes claimed on otherwise valid input starting with 0x04, fail, zeroize output, no illegal arg error. */ - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 33) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* NULL pubkey, illegal arg error. Pubkey isn't rewritten before this step, since it's NULL into the parser. */ - CHECK(secp256k1_ec_pubkey_parse(ctx, NULL, pubkeyc, 65) == 0); - CHECK(ecount == 2); - /* NULL input string. Illegal arg and zeroize output. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, NULL, 65) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 1); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 2); - /* 64 bytes claimed on input starting with 0x04, fail, zeroize output, no illegal arg error. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 64) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* 66 bytes claimed, fail, zeroize output, no illegal arg error. */ - memset(&pubkey, 0xfe, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 66) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 0); - CHECK(ecount == 1); - /* Valid parse. */ - memset(&pubkey, 0, sizeof(pubkey)); - ecount = 0; - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, 65) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(ecount == 0); - VG_UNDEF(&ge, sizeof(ge)); - CHECK(secp256k1_pubkey_load(ctx, &ge, &pubkey) == 1); - VG_CHECK(&ge.x, sizeof(ge.x)); - VG_CHECK(&ge.y, sizeof(ge.y)); - VG_CHECK(&ge.infinity, sizeof(ge.infinity)); - ge_equals_ge(&secp256k1_ge_const_g, &ge); - CHECK(ecount == 0); - /* secp256k1_ec_pubkey_serialize illegal args. */ - ecount = 0; - len = 65; - CHECK(secp256k1_ec_pubkey_serialize(ctx, NULL, &len, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 0); - CHECK(ecount == 1); - CHECK(len == 0); - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, NULL, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 0); - CHECK(ecount == 2); - len = 65; - VG_UNDEF(sout, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, &len, NULL, SECP256K1_EC_UNCOMPRESSED) == 0); - VG_CHECK(sout, 65); - CHECK(ecount == 3); - CHECK(len == 0); - len = 65; - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, &len, &pubkey, ~0) == 0); - CHECK(ecount == 4); - CHECK(len == 0); - len = 65; - VG_UNDEF(sout, 65); - CHECK(secp256k1_ec_pubkey_serialize(ctx, sout, &len, &pubkey, SECP256K1_EC_UNCOMPRESSED) == 1); - VG_CHECK(sout, 65); - CHECK(ecount == 4); - CHECK(len == 65); - /* Multiple illegal args. Should still set arg error only once. */ - ecount = 0; - ecount2 = 11; - CHECK(secp256k1_ec_pubkey_parse(ctx, NULL, NULL, 65) == 0); - CHECK(ecount == 1); - /* Does the illegal arg callback actually change the behavior? */ - secp256k1_context_set_illegal_callback(ctx, uncounting_illegal_callback_fn, &ecount2); - CHECK(secp256k1_ec_pubkey_parse(ctx, NULL, NULL, 65) == 0); - CHECK(ecount == 1); - CHECK(ecount2 == 10); - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); - /* Try a bunch of prefabbed points with all possible encodings. */ - for (i = 0; i < SECP256K1_EC_PARSE_TEST_NVALID; i++) { - ec_pubkey_parse_pointtest(valid[i], 1, 1); - } - for (i = 0; i < SECP256K1_EC_PARSE_TEST_NXVALID; i++) { - ec_pubkey_parse_pointtest(onlyxvalid[i], 1, 0); - } - for (i = 0; i < SECP256K1_EC_PARSE_TEST_NINVALID; i++) { - ec_pubkey_parse_pointtest(invalid[i], 0, 0); - } -} - -void run_eckey_edge_case_test(void) { - const unsigned char orderc[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41 - }; - const unsigned char zeros[sizeof(secp256k1_pubkey)] = {0x00}; - unsigned char ctmp[33]; - unsigned char ctmp2[33]; - secp256k1_pubkey pubkey; - secp256k1_pubkey pubkey2; - secp256k1_pubkey pubkey_one; - secp256k1_pubkey pubkey_negone; - const secp256k1_pubkey *pubkeys[3]; - size_t len; - int32_t ecount; - /* Group order is too large, reject. */ - CHECK(secp256k1_ec_seckey_verify(ctx, orderc) == 0); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, orderc) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* Maximum value is too large, reject. */ - memset(ctmp, 255, 32); - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 0); - memset(&pubkey, 1, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* Zero is too small, reject. */ - memset(ctmp, 0, 32); - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 0); - memset(&pubkey, 1, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* One must be accepted. */ - ctmp[31] = 0x01; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 1); - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - pubkey_one = pubkey; - /* Group order + 1 is too large, reject. */ - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x42; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 0); - memset(&pubkey, 1, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 0); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* -1 must be accepted. */ - ctmp[31] = 0x40; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 1); - memset(&pubkey, 0, sizeof(pubkey)); - VG_UNDEF(&pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, ctmp) == 1); - VG_CHECK(&pubkey, sizeof(pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - pubkey_negone = pubkey; - /* Tweak of zero leaves the value changed. */ - memset(ctmp2, 0, 32); - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp, ctmp2) == 1); - CHECK(memcmp(orderc, ctmp, 31) == 0 && ctmp[31] == 0x40); - memcpy(&pubkey2, &pubkey, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - /* Multiply tweak of zero zeroizes the output. */ - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, ctmp, ctmp2) == 0); - CHECK(memcmp(zeros, ctmp, 32) == 0); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, ctmp2) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - /* Overflowing key tweak zeroizes. */ - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x40; - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp, orderc) == 0); - CHECK(memcmp(zeros, ctmp, 32) == 0); - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x40; - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, ctmp, orderc) == 0); - CHECK(memcmp(zeros, ctmp, 32) == 0); - memcpy(ctmp, orderc, 32); - ctmp[31] = 0x40; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, orderc) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, orderc) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - /* Private key tweaks results in a key of zero. */ - ctmp2[31] = 1; - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp2, ctmp) == 0); - CHECK(memcmp(zeros, ctmp2, 32) == 0); - ctmp2[31] = 1; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - /* Tweak computation wraps and results in a key of 1. */ - ctmp2[31] = 2; - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp2, ctmp) == 1); - CHECK(memcmp(ctmp2, zeros, 31) == 0 && ctmp2[31] == 1); - ctmp2[31] = 2; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 1); - ctmp2[31] = 1; - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey2, ctmp2) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - /* Tweak mul * 2 = 1+1. */ - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 1); - ctmp2[31] = 2; - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey2, ctmp2) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - /* Test argument errors. */ - ecount = 0; - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - CHECK(ecount == 0); - /* Zeroize pubkey on parse error. */ - memset(&pubkey, 0, 32); - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(memcmp(&pubkey, zeros, sizeof(pubkey)) == 0); - memcpy(&pubkey, &pubkey2, sizeof(pubkey)); - memset(&pubkey2, 0, 32); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey2, ctmp2) == 0); - CHECK(ecount == 2); - CHECK(memcmp(&pubkey2, zeros, sizeof(pubkey2)) == 0); - /* Plain argument errors. */ - ecount = 0; - CHECK(secp256k1_ec_seckey_verify(ctx, ctmp) == 1); - CHECK(ecount == 0); - CHECK(secp256k1_ec_seckey_verify(ctx, NULL) == 0); - CHECK(ecount == 1); - ecount = 0; - memset(ctmp2, 0, 32); - ctmp2[31] = 4; - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - memset(ctmp2, 0, 32); - ctmp2[31] = 4; - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - memset(ctmp2, 0, 32); - CHECK(secp256k1_ec_privkey_tweak_add(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_privkey_tweak_add(ctx, ctmp, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - memset(ctmp2, 0, 32); - ctmp2[31] = 1; - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, NULL, ctmp2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_privkey_tweak_mul(ctx, ctmp, NULL) == 0); - CHECK(ecount == 2); - ecount = 0; - CHECK(secp256k1_ec_pubkey_create(ctx, NULL, ctmp) == 0); - CHECK(ecount == 1); - memset(&pubkey, 1, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 2); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - /* secp256k1_ec_pubkey_combine tests. */ - ecount = 0; - pubkeys[0] = &pubkey_one; - VG_UNDEF(&pubkeys[0], sizeof(secp256k1_pubkey *)); - VG_UNDEF(&pubkeys[1], sizeof(secp256k1_pubkey *)); - VG_UNDEF(&pubkeys[2], sizeof(secp256k1_pubkey *)); - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 0) == 0); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ec_pubkey_combine(ctx, NULL, pubkeys, 1) == 0); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 2); - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, NULL, 1) == 0); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 3); - pubkeys[0] = &pubkey_negone; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 1) == 1); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - CHECK(ecount == 3); - len = 33; - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp, &len, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp2, &len, &pubkey_negone, SECP256K1_EC_COMPRESSED) == 1); - CHECK(memcmp(ctmp, ctmp2, 33) == 0); - /* Result is infinity. */ - pubkeys[0] = &pubkey_one; - pubkeys[1] = &pubkey_negone; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 2) == 0); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) == 0); - CHECK(ecount == 3); - /* Passes through infinity but comes out one. */ - pubkeys[2] = &pubkey_one; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 3) == 1); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - CHECK(ecount == 3); - len = 33; - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp, &len, &pubkey, SECP256K1_EC_COMPRESSED) == 1); - CHECK(secp256k1_ec_pubkey_serialize(ctx, ctmp2, &len, &pubkey_one, SECP256K1_EC_COMPRESSED) == 1); - CHECK(memcmp(ctmp, ctmp2, 33) == 0); - /* Adds to two. */ - pubkeys[1] = &pubkey_one; - memset(&pubkey, 255, sizeof(secp256k1_pubkey)); - VG_UNDEF(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(secp256k1_ec_pubkey_combine(ctx, &pubkey, pubkeys, 2) == 1); - VG_CHECK(&pubkey, sizeof(secp256k1_pubkey)); - CHECK(memcmp(&pubkey, zeros, sizeof(secp256k1_pubkey)) > 0); - CHECK(ecount == 3); - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); -} - -void random_sign(secp256k1_scalar *sigr, secp256k1_scalar *sigs, const secp256k1_scalar *key, const secp256k1_scalar *msg, int *recid) { - secp256k1_scalar nonce; - do { - random_scalar_order_test(&nonce); - } while(!secp256k1_ecdsa_sig_sign(&ctx->ecmult_gen_ctx, sigr, sigs, key, msg, &nonce, recid)); -} - -void test_ecdsa_sign_verify(void) { - secp256k1_gej pubj; - secp256k1_ge pub; - secp256k1_scalar one; - secp256k1_scalar msg, key; - secp256k1_scalar sigr, sigs; - int recid; - int getrec; - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pubj, &key); - secp256k1_ge_set_gej(&pub, &pubj); - getrec = secp256k1_rand_bits(1); - random_sign(&sigr, &sigs, &key, &msg, getrec?&recid:NULL); - if (getrec) { - CHECK(recid >= 0 && recid < 4); - } - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &pub, &msg)); - secp256k1_scalar_set_int(&one, 1); - secp256k1_scalar_add(&msg, &msg, &one); - CHECK(!secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &pub, &msg)); -} - -void run_ecdsa_sign_verify(void) { - int i; - for (i = 0; i < 10*count; i++) { - test_ecdsa_sign_verify(); - } -} - -/** Dummy nonce generation function that just uses a precomputed nonce, and fails if it is not accepted. Use only for testing. */ -static int precomputed_nonce_function(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - (void)msg32; - (void)key32; - (void)algo16; - memcpy(nonce32, data, 32); - return (counter == 0); -} - -static int nonce_function_test_fail(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - /* Dummy nonce generator that has a fatal error on the first counter value. */ - if (counter == 0) { - return 0; - } - return nonce_function_rfc6979(nonce32, msg32, key32, algo16, data, counter - 1); -} - -static int nonce_function_test_retry(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { - /* Dummy nonce generator that produces unacceptable nonces for the first several counter values. */ - if (counter < 3) { - memset(nonce32, counter==0 ? 0 : 255, 32); - if (counter == 2) { - nonce32[31]--; - } - return 1; - } - if (counter < 5) { - static const unsigned char order[] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, - 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, - 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x41 - }; - memcpy(nonce32, order, 32); - if (counter == 4) { - nonce32[31]++; - } - return 1; - } - /* Retry rate of 6979 is negligible esp. as we only call this in deterministic tests. */ - /* If someone does fine a case where it retries for secp256k1, we'd like to know. */ - if (counter > 5) { - return 0; - } - return nonce_function_rfc6979(nonce32, msg32, key32, algo16, data, counter - 5); -} - -int is_empty_signature(const secp256k1_ecdsa_signature *sig) { - static const unsigned char res[sizeof(secp256k1_ecdsa_signature)] = {0}; - return memcmp(sig, res, sizeof(secp256k1_ecdsa_signature)) == 0; -} - -void test_ecdsa_end_to_end(void) { - unsigned char extra[32] = {0x00}; - unsigned char privkey[32]; - unsigned char message[32]; - unsigned char privkey2[32]; - secp256k1_ecdsa_signature signature[6]; - secp256k1_scalar r, s; - unsigned char sig[74]; - size_t siglen = 74; - unsigned char pubkeyc[65]; - size_t pubkeyclen = 65; - secp256k1_pubkey pubkey; - unsigned char seckey[300]; - size_t seckeylen = 300; - - /* Generate a random key and message. */ - { - secp256k1_scalar msg, key; - random_scalar_order_test(&msg); - random_scalar_order_test(&key); - secp256k1_scalar_get_b32(privkey, &key); - secp256k1_scalar_get_b32(message, &msg); - } - - /* Construct and verify corresponding public key. */ - CHECK(secp256k1_ec_seckey_verify(ctx, privkey) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, privkey) == 1); - - /* Verify exporting and importing public key. */ - CHECK(secp256k1_ec_pubkey_serialize(ctx, pubkeyc, &pubkeyclen, &pubkey, secp256k1_rand_bits(1) == 1 ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED)); - memset(&pubkey, 0, sizeof(pubkey)); - CHECK(secp256k1_ec_pubkey_parse(ctx, &pubkey, pubkeyc, pubkeyclen) == 1); - - /* Verify private key import and export. */ - CHECK(ec_privkey_export_der(ctx, seckey, &seckeylen, privkey, secp256k1_rand_bits(1) == 1)); - CHECK(ec_privkey_import_der(ctx, privkey2, seckey, seckeylen) == 1); - CHECK(memcmp(privkey, privkey2, 32) == 0); - - /* Optionally tweak the keys using addition. */ - if (secp256k1_rand_int(3) == 0) { - int ret1; - int ret2; - unsigned char rnd[32]; - secp256k1_pubkey pubkey2; - secp256k1_rand256_test(rnd); - ret1 = secp256k1_ec_privkey_tweak_add(ctx, privkey, rnd); - ret2 = secp256k1_ec_pubkey_tweak_add(ctx, &pubkey, rnd); - CHECK(ret1 == ret2); - if (ret1 == 0) { - return; - } - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey2, privkey) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - } - - /* Optionally tweak the keys using multiplication. */ - if (secp256k1_rand_int(3) == 0) { - int ret1; - int ret2; - unsigned char rnd[32]; - secp256k1_pubkey pubkey2; - secp256k1_rand256_test(rnd); - ret1 = secp256k1_ec_privkey_tweak_mul(ctx, privkey, rnd); - ret2 = secp256k1_ec_pubkey_tweak_mul(ctx, &pubkey, rnd); - CHECK(ret1 == ret2); - if (ret1 == 0) { - return; - } - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey2, privkey) == 1); - CHECK(memcmp(&pubkey, &pubkey2, sizeof(pubkey)) == 0); - } - - /* Sign. */ - CHECK(secp256k1_ecdsa_sign(ctx, &signature[0], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &signature[4], message, privkey, NULL, NULL) == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &signature[1], message, privkey, NULL, extra) == 1); - extra[31] = 1; - CHECK(secp256k1_ecdsa_sign(ctx, &signature[2], message, privkey, NULL, extra) == 1); - extra[31] = 0; - extra[0] = 1; - CHECK(secp256k1_ecdsa_sign(ctx, &signature[3], message, privkey, NULL, extra) == 1); - CHECK(memcmp(&signature[0], &signature[4], sizeof(signature[0])) == 0); - CHECK(memcmp(&signature[0], &signature[1], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[0], &signature[2], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[0], &signature[3], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[1], &signature[2], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[1], &signature[3], sizeof(signature[0])) != 0); - CHECK(memcmp(&signature[2], &signature[3], sizeof(signature[0])) != 0); - /* Verify. */ - CHECK(secp256k1_ecdsa_verify(ctx, &signature[0], message, &pubkey) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[1], message, &pubkey) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[2], message, &pubkey) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[3], message, &pubkey) == 1); - /* Test lower-S form, malleate, verify and fail, test again, malleate again */ - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[0])); - secp256k1_ecdsa_signature_load(ctx, &r, &s, &signature[0]); - secp256k1_scalar_negate(&s, &s); - secp256k1_ecdsa_signature_save(&signature[5], &r, &s); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[5], message, &pubkey) == 0); - CHECK(secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[5])); - CHECK(secp256k1_ecdsa_signature_normalize(ctx, &signature[5], &signature[5])); - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[5])); - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, &signature[5], &signature[5])); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[5], message, &pubkey) == 1); - secp256k1_scalar_negate(&s, &s); - secp256k1_ecdsa_signature_save(&signature[5], &r, &s); - CHECK(!secp256k1_ecdsa_signature_normalize(ctx, NULL, &signature[5])); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[5], message, &pubkey) == 1); - CHECK(memcmp(&signature[5], &signature[0], 64) == 0); - - /* Serialize/parse DER and verify again */ - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, sig, &siglen, &signature[0]) == 1); - memset(&signature[0], 0, sizeof(signature[0])); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &signature[0], sig, siglen) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, &signature[0], message, &pubkey) == 1); - /* Serialize/destroy/parse DER and verify again. */ - siglen = 74; - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, sig, &siglen, &signature[0]) == 1); - sig[secp256k1_rand_int(siglen)] += 1 + secp256k1_rand_int(255); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &signature[0], sig, siglen) == 0 || - secp256k1_ecdsa_verify(ctx, &signature[0], message, &pubkey) == 0); -} - -void test_random_pubkeys(void) { - secp256k1_ge elem; - secp256k1_ge elem2; - unsigned char in[65]; - /* Generate some randomly sized pubkeys. */ - size_t len = secp256k1_rand_bits(2) == 0 ? 65 : 33; - if (secp256k1_rand_bits(2) == 0) { - len = secp256k1_rand_bits(6); - } - if (len == 65) { - in[0] = secp256k1_rand_bits(1) ? 4 : (secp256k1_rand_bits(1) ? 6 : 7); - } else { - in[0] = secp256k1_rand_bits(1) ? 2 : 3; - } - if (secp256k1_rand_bits(3) == 0) { - in[0] = secp256k1_rand_bits(8); - } - if (len > 1) { - secp256k1_rand256(&in[1]); - } - if (len > 33) { - secp256k1_rand256(&in[33]); - } - if (secp256k1_eckey_pubkey_parse(&elem, in, len)) { - unsigned char out[65]; - unsigned char firstb; - int res; - size_t size = len; - firstb = in[0]; - /* If the pubkey can be parsed, it should round-trip... */ - CHECK(secp256k1_eckey_pubkey_serialize(&elem, out, &size, len == 33)); - CHECK(size == len); - CHECK(memcmp(&in[1], &out[1], len-1) == 0); - /* ... except for the type of hybrid inputs. */ - if ((in[0] != 6) && (in[0] != 7)) { - CHECK(in[0] == out[0]); - } - size = 65; - CHECK(secp256k1_eckey_pubkey_serialize(&elem, in, &size, 0)); - CHECK(size == 65); - CHECK(secp256k1_eckey_pubkey_parse(&elem2, in, size)); - ge_equals_ge(&elem,&elem2); - /* Check that the X9.62 hybrid type is checked. */ - in[0] = secp256k1_rand_bits(1) ? 6 : 7; - res = secp256k1_eckey_pubkey_parse(&elem2, in, size); - if (firstb == 2 || firstb == 3) { - if (in[0] == firstb + 4) { - CHECK(res); - } else { - CHECK(!res); - } - } - if (res) { - ge_equals_ge(&elem,&elem2); - CHECK(secp256k1_eckey_pubkey_serialize(&elem, out, &size, 0)); - CHECK(memcmp(&in[1], &out[1], 64) == 0); - } - } -} - -void run_random_pubkeys(void) { - int i; - for (i = 0; i < 10*count; i++) { - test_random_pubkeys(); - } -} - -void run_ecdsa_end_to_end(void) { - int i; - for (i = 0; i < 64*count; i++) { - test_ecdsa_end_to_end(); - } -} - -int test_ecdsa_der_parse(const unsigned char *sig, size_t siglen, int certainly_der, int certainly_not_der) { - static const unsigned char zeroes[32] = {0}; -#ifdef ENABLE_OPENSSL_TESTS - static const unsigned char max_scalar[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x40 - }; -#endif - - int ret = 0; - - secp256k1_ecdsa_signature sig_der; - unsigned char roundtrip_der[2048]; - unsigned char compact_der[64]; - size_t len_der = 2048; - int parsed_der = 0, valid_der = 0, roundtrips_der = 0; - - secp256k1_ecdsa_signature sig_der_lax; - unsigned char roundtrip_der_lax[2048]; - unsigned char compact_der_lax[64]; - size_t len_der_lax = 2048; - int parsed_der_lax = 0, valid_der_lax = 0, roundtrips_der_lax = 0; - -#ifdef ENABLE_OPENSSL_TESTS - ECDSA_SIG *sig_openssl; - const unsigned char *sigptr; - unsigned char roundtrip_openssl[2048]; - int len_openssl = 2048; - int parsed_openssl, valid_openssl = 0, roundtrips_openssl = 0; -#endif - - parsed_der = secp256k1_ecdsa_signature_parse_der(ctx, &sig_der, sig, siglen); - if (parsed_der) { - ret |= (!secp256k1_ecdsa_signature_serialize_compact(ctx, compact_der, &sig_der)) << 0; - valid_der = (memcmp(compact_der, zeroes, 32) != 0) && (memcmp(compact_der + 32, zeroes, 32) != 0); - } - if (valid_der) { - ret |= (!secp256k1_ecdsa_signature_serialize_der(ctx, roundtrip_der, &len_der, &sig_der)) << 1; - roundtrips_der = (len_der == siglen) && memcmp(roundtrip_der, sig, siglen) == 0; - } - - parsed_der_lax = ecdsa_signature_parse_der_lax(ctx, &sig_der_lax, sig, siglen); - if (parsed_der_lax) { - ret |= (!secp256k1_ecdsa_signature_serialize_compact(ctx, compact_der_lax, &sig_der_lax)) << 10; - valid_der_lax = (memcmp(compact_der_lax, zeroes, 32) != 0) && (memcmp(compact_der_lax + 32, zeroes, 32) != 0); - } - if (valid_der_lax) { - ret |= (!secp256k1_ecdsa_signature_serialize_der(ctx, roundtrip_der_lax, &len_der_lax, &sig_der_lax)) << 11; - roundtrips_der_lax = (len_der_lax == siglen) && memcmp(roundtrip_der_lax, sig, siglen) == 0; - } - - if (certainly_der) { - ret |= (!parsed_der) << 2; - } - if (certainly_not_der) { - ret |= (parsed_der) << 17; - } - if (valid_der) { - ret |= (!roundtrips_der) << 3; - } - - if (valid_der) { - ret |= (!roundtrips_der_lax) << 12; - ret |= (len_der != len_der_lax) << 13; - ret |= (memcmp(roundtrip_der_lax, roundtrip_der, len_der) != 0) << 14; - } - ret |= (roundtrips_der != roundtrips_der_lax) << 15; - if (parsed_der) { - ret |= (!parsed_der_lax) << 16; - } - -#ifdef ENABLE_OPENSSL_TESTS - sig_openssl = ECDSA_SIG_new(); - sigptr = sig; - parsed_openssl = (d2i_ECDSA_SIG(&sig_openssl, &sigptr, siglen) != NULL); - if (parsed_openssl) { - valid_openssl = !BN_is_negative(sig_openssl->r) && !BN_is_negative(sig_openssl->s) && BN_num_bits(sig_openssl->r) > 0 && BN_num_bits(sig_openssl->r) <= 256 && BN_num_bits(sig_openssl->s) > 0 && BN_num_bits(sig_openssl->s) <= 256; - if (valid_openssl) { - unsigned char tmp[32] = {0}; - BN_bn2bin(sig_openssl->r, tmp + 32 - BN_num_bytes(sig_openssl->r)); - valid_openssl = memcmp(tmp, max_scalar, 32) < 0; - } - if (valid_openssl) { - unsigned char tmp[32] = {0}; - BN_bn2bin(sig_openssl->s, tmp + 32 - BN_num_bytes(sig_openssl->s)); - valid_openssl = memcmp(tmp, max_scalar, 32) < 0; - } - } - len_openssl = i2d_ECDSA_SIG(sig_openssl, NULL); - if (len_openssl <= 2048) { - unsigned char *ptr = roundtrip_openssl; - CHECK(i2d_ECDSA_SIG(sig_openssl, &ptr) == len_openssl); - roundtrips_openssl = valid_openssl && ((size_t)len_openssl == siglen) && (memcmp(roundtrip_openssl, sig, siglen) == 0); - } else { - len_openssl = 0; - } - ECDSA_SIG_free(sig_openssl); - - ret |= (parsed_der && !parsed_openssl) << 4; - ret |= (valid_der && !valid_openssl) << 5; - ret |= (roundtrips_openssl && !parsed_der) << 6; - ret |= (roundtrips_der != roundtrips_openssl) << 7; - if (roundtrips_openssl) { - ret |= (len_der != (size_t)len_openssl) << 8; - ret |= (memcmp(roundtrip_der, roundtrip_openssl, len_der) != 0) << 9; - } -#endif - return ret; -} - -static void assign_big_endian(unsigned char *ptr, size_t ptrlen, uint32_t val) { - size_t i; - for (i = 0; i < ptrlen; i++) { - int shift = ptrlen - 1 - i; - if (shift >= 4) { - ptr[i] = 0; - } else { - ptr[i] = (val >> shift) & 0xFF; - } - } -} - -static void damage_array(unsigned char *sig, size_t *len) { - int pos; - int action = secp256k1_rand_bits(3); - if (action < 1 && *len > 3) { - /* Delete a byte. */ - pos = secp256k1_rand_int(*len); - memmove(sig + pos, sig + pos + 1, *len - pos - 1); - (*len)--; - return; - } else if (action < 2 && *len < 2048) { - /* Insert a byte. */ - pos = secp256k1_rand_int(1 + *len); - memmove(sig + pos + 1, sig + pos, *len - pos); - sig[pos] = secp256k1_rand_bits(8); - (*len)++; - return; - } else if (action < 4) { - /* Modify a byte. */ - sig[secp256k1_rand_int(*len)] += 1 + secp256k1_rand_int(255); - return; - } else { /* action < 8 */ - /* Modify a bit. */ - sig[secp256k1_rand_int(*len)] ^= 1 << secp256k1_rand_bits(3); - return; - } -} - -static void random_ber_signature(unsigned char *sig, size_t *len, int* certainly_der, int* certainly_not_der) { - int der; - int nlow[2], nlen[2], nlenlen[2], nhbit[2], nhbyte[2], nzlen[2]; - size_t tlen, elen, glen; - int indet; - int n; - - *len = 0; - der = secp256k1_rand_bits(2) == 0; - *certainly_der = der; - *certainly_not_der = 0; - indet = der ? 0 : secp256k1_rand_int(10) == 0; - - for (n = 0; n < 2; n++) { - /* We generate two classes of numbers: nlow==1 "low" ones (up to 32 bytes), nlow==0 "high" ones (32 bytes with 129 top bits set, or larger than 32 bytes) */ - nlow[n] = der ? 1 : (secp256k1_rand_bits(3) != 0); - /* The length of the number in bytes (the first byte of which will always be nonzero) */ - nlen[n] = nlow[n] ? secp256k1_rand_int(33) : 32 + secp256k1_rand_int(200) * secp256k1_rand_int(8) / 8; - CHECK(nlen[n] <= 232); - /* The top bit of the number. */ - nhbit[n] = (nlow[n] == 0 && nlen[n] == 32) ? 1 : (nlen[n] == 0 ? 0 : secp256k1_rand_bits(1)); - /* The top byte of the number (after the potential hardcoded 16 0xFF characters for "high" 32 bytes numbers) */ - nhbyte[n] = nlen[n] == 0 ? 0 : (nhbit[n] ? 128 + secp256k1_rand_bits(7) : 1 + secp256k1_rand_int(127)); - /* The number of zero bytes in front of the number (which is 0 or 1 in case of DER, otherwise we extend up to 300 bytes) */ - nzlen[n] = der ? ((nlen[n] == 0 || nhbit[n]) ? 1 : 0) : (nlow[n] ? secp256k1_rand_int(3) : secp256k1_rand_int(300 - nlen[n]) * secp256k1_rand_int(8) / 8); - if (nzlen[n] > ((nlen[n] == 0 || nhbit[n]) ? 1 : 0)) { - *certainly_not_der = 1; - } - CHECK(nlen[n] + nzlen[n] <= 300); - /* The length of the length descriptor for the number. 0 means short encoding, anything else is long encoding. */ - nlenlen[n] = nlen[n] + nzlen[n] < 128 ? 0 : (nlen[n] + nzlen[n] < 256 ? 1 : 2); - if (!der) { - /* nlenlen[n] max 127 bytes */ - int add = secp256k1_rand_int(127 - nlenlen[n]) * secp256k1_rand_int(16) * secp256k1_rand_int(16) / 256; - nlenlen[n] += add; - if (add != 0) { - *certainly_not_der = 1; - } - } - CHECK(nlen[n] + nzlen[n] + nlenlen[n] <= 427); - } - - /* The total length of the data to go, so far */ - tlen = 2 + nlenlen[0] + nlen[0] + nzlen[0] + 2 + nlenlen[1] + nlen[1] + nzlen[1]; - CHECK(tlen <= 856); - - /* The length of the garbage inside the tuple. */ - elen = (der || indet) ? 0 : secp256k1_rand_int(980 - tlen) * secp256k1_rand_int(8) / 8; - if (elen != 0) { - *certainly_not_der = 1; - } - tlen += elen; - CHECK(tlen <= 980); - - /* The length of the garbage after the end of the tuple. */ - glen = der ? 0 : secp256k1_rand_int(990 - tlen) * secp256k1_rand_int(8) / 8; - if (glen != 0) { - *certainly_not_der = 1; - } - CHECK(tlen + glen <= 990); - - /* Write the tuple header. */ - sig[(*len)++] = 0x30; - if (indet) { - /* Indeterminate length */ - sig[(*len)++] = 0x80; - *certainly_not_der = 1; - } else { - int tlenlen = tlen < 128 ? 0 : (tlen < 256 ? 1 : 2); - if (!der) { - int add = secp256k1_rand_int(127 - tlenlen) * secp256k1_rand_int(16) * secp256k1_rand_int(16) / 256; - tlenlen += add; - if (add != 0) { - *certainly_not_der = 1; - } - } - if (tlenlen == 0) { - /* Short length notation */ - sig[(*len)++] = tlen; - } else { - /* Long length notation */ - sig[(*len)++] = 128 + tlenlen; - assign_big_endian(sig + *len, tlenlen, tlen); - *len += tlenlen; - } - tlen += tlenlen; - } - tlen += 2; - CHECK(tlen + glen <= 1119); - - for (n = 0; n < 2; n++) { - /* Write the integer header. */ - sig[(*len)++] = 0x02; - if (nlenlen[n] == 0) { - /* Short length notation */ - sig[(*len)++] = nlen[n] + nzlen[n]; - } else { - /* Long length notation. */ - sig[(*len)++] = 128 + nlenlen[n]; - assign_big_endian(sig + *len, nlenlen[n], nlen[n] + nzlen[n]); - *len += nlenlen[n]; - } - /* Write zero padding */ - while (nzlen[n] > 0) { - sig[(*len)++] = 0x00; - nzlen[n]--; - } - if (nlen[n] == 32 && !nlow[n]) { - /* Special extra 16 0xFF bytes in "high" 32-byte numbers */ - int i; - for (i = 0; i < 16; i++) { - sig[(*len)++] = 0xFF; - } - nlen[n] -= 16; - } - /* Write first byte of number */ - if (nlen[n] > 0) { - sig[(*len)++] = nhbyte[n]; - nlen[n]--; - } - /* Generate remaining random bytes of number */ - secp256k1_rand_bytes_test(sig + *len, nlen[n]); - *len += nlen[n]; - nlen[n] = 0; - } - - /* Generate random garbage inside tuple. */ - secp256k1_rand_bytes_test(sig + *len, elen); - *len += elen; - - /* Generate end-of-contents bytes. */ - if (indet) { - sig[(*len)++] = 0; - sig[(*len)++] = 0; - tlen += 2; - } - CHECK(tlen + glen <= 1121); - - /* Generate random garbage outside tuple. */ - secp256k1_rand_bytes_test(sig + *len, glen); - *len += glen; - tlen += glen; - CHECK(tlen <= 1121); - CHECK(tlen == *len); -} - -void run_ecdsa_der_parse(void) { - int i,j; - for (i = 0; i < 200 * count; i++) { - unsigned char buffer[2048]; - size_t buflen = 0; - int certainly_der = 0; - int certainly_not_der = 0; - random_ber_signature(buffer, &buflen, &certainly_der, &certainly_not_der); - CHECK(buflen <= 2048); - for (j = 0; j < 16; j++) { - int ret = 0; - if (j > 0) { - damage_array(buffer, &buflen); - /* We don't know anything anymore about the DERness of the result */ - certainly_der = 0; - certainly_not_der = 0; - } - ret = test_ecdsa_der_parse(buffer, buflen, certainly_der, certainly_not_der); - if (ret != 0) { - size_t k; - fprintf(stderr, "Failure %x on ", ret); - for (k = 0; k < buflen; k++) { - fprintf(stderr, "%02x ", buffer[k]); - } - fprintf(stderr, "\n"); - } - CHECK(ret == 0); - } - } -} - -/* Tests several edge cases. */ -void test_ecdsa_edge_cases(void) { - int t; - secp256k1_ecdsa_signature sig; - - /* Test the case where ECDSA recomputes a point that is infinity. */ - { - secp256k1_gej keyj; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_negate(&ss, &ss); - secp256k1_scalar_inverse(&ss, &ss); - secp256k1_scalar_set_int(&sr, 1); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &keyj, &sr); - secp256k1_ge_set_gej(&key, &keyj); - msg = ss; - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Verify signature with r of zero fails. */ - { - const unsigned char pubkey_mods_zero[33] = { - 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, - 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, - 0x41 - }; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_set_int(&msg, 0); - secp256k1_scalar_set_int(&sr, 0); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey_mods_zero, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Verify signature with s of zero fails. */ - { - const unsigned char pubkey[33] = { - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01 - }; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 0); - secp256k1_scalar_set_int(&msg, 0); - secp256k1_scalar_set_int(&sr, 1); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Verify signature with message 0 passes. */ - { - const unsigned char pubkey[33] = { - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02 - }; - const unsigned char pubkey2[33] = { - 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, - 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, - 0x43 - }; - secp256k1_ge key; - secp256k1_ge key2; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 2); - secp256k1_scalar_set_int(&msg, 0); - secp256k1_scalar_set_int(&sr, 2); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_eckey_pubkey_parse(&key2, pubkey2, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_negate(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_set_int(&ss, 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 0); - } - - /* Verify signature with message 1 passes. */ - { - const unsigned char pubkey[33] = { - 0x02, 0x14, 0x4e, 0x5a, 0x58, 0xef, 0x5b, 0x22, - 0x6f, 0xd2, 0xe2, 0x07, 0x6a, 0x77, 0xcf, 0x05, - 0xb4, 0x1d, 0xe7, 0x4a, 0x30, 0x98, 0x27, 0x8c, - 0x93, 0xe6, 0xe6, 0x3c, 0x0b, 0xc4, 0x73, 0x76, - 0x25 - }; - const unsigned char pubkey2[33] = { - 0x02, 0x8a, 0xd5, 0x37, 0xed, 0x73, 0xd9, 0x40, - 0x1d, 0xa0, 0x33, 0xd2, 0xdc, 0xf0, 0xaf, 0xae, - 0x34, 0xcf, 0x5f, 0x96, 0x4c, 0x73, 0x28, 0x0f, - 0x92, 0xc0, 0xf6, 0x9d, 0xd9, 0xb2, 0x09, 0x10, - 0x62 - }; - const unsigned char csr[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x45, 0x51, 0x23, 0x19, 0x50, 0xb7, 0x5f, 0xc4, - 0x40, 0x2d, 0xa1, 0x72, 0x2f, 0xc9, 0xba, 0xeb - }; - secp256k1_ge key; - secp256k1_ge key2; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_set_int(&msg, 1); - secp256k1_scalar_set_b32(&sr, csr, NULL); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_eckey_pubkey_parse(&key2, pubkey2, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_negate(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 1); - secp256k1_scalar_set_int(&ss, 2); - secp256k1_scalar_inverse_var(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key2, &msg) == 0); - } - - /* Verify signature with message -1 passes. */ - { - const unsigned char pubkey[33] = { - 0x03, 0xaf, 0x97, 0xff, 0x7d, 0x3a, 0xf6, 0xa0, - 0x02, 0x94, 0xbd, 0x9f, 0x4b, 0x2e, 0xd7, 0x52, - 0x28, 0xdb, 0x49, 0x2a, 0x65, 0xcb, 0x1e, 0x27, - 0x57, 0x9c, 0xba, 0x74, 0x20, 0xd5, 0x1d, 0x20, - 0xf1 - }; - const unsigned char csr[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x45, 0x51, 0x23, 0x19, 0x50, 0xb7, 0x5f, 0xc4, - 0x40, 0x2d, 0xa1, 0x72, 0x2f, 0xc9, 0xba, 0xee - }; - secp256k1_ge key; - secp256k1_scalar msg; - secp256k1_scalar sr, ss; - secp256k1_scalar_set_int(&ss, 1); - secp256k1_scalar_set_int(&msg, 1); - secp256k1_scalar_negate(&msg, &msg); - secp256k1_scalar_set_b32(&sr, csr, NULL); - CHECK(secp256k1_eckey_pubkey_parse(&key, pubkey, 33)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - secp256k1_scalar_negate(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 1); - secp256k1_scalar_set_int(&ss, 3); - secp256k1_scalar_inverse_var(&ss, &ss); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sr, &ss, &key, &msg) == 0); - } - - /* Signature where s would be zero. */ - { - secp256k1_pubkey pubkey; - size_t siglen; - int32_t ecount; - unsigned char signature[72]; - static const unsigned char nonce[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }; - static const unsigned char nonce2[32] = { - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE, - 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B, - 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x40 - }; - const unsigned char key[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - }; - unsigned char msg[32] = { - 0x86, 0x41, 0x99, 0x81, 0x06, 0x23, 0x44, 0x53, - 0xaa, 0x5f, 0x9d, 0x6a, 0x31, 0x78, 0xf4, 0xf7, - 0xb8, 0x12, 0xe0, 0x0b, 0x81, 0x7a, 0x77, 0x62, - 0x65, 0xdf, 0xdd, 0x31, 0xb9, 0x3e, 0x29, 0xa9, - }; - ecount = 0; - secp256k1_context_set_illegal_callback(ctx, counting_illegal_callback_fn, &ecount); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce) == 0); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce2) == 0); - msg[31] = 0xaa; - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce) == 1); - CHECK(ecount == 0); - CHECK(secp256k1_ecdsa_sign(ctx, NULL, msg, key, precomputed_nonce_function, nonce2) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, NULL, key, precomputed_nonce_function, nonce2) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, NULL, precomputed_nonce_function, nonce2) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, precomputed_nonce_function, nonce2) == 1); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, key) == 1); - CHECK(secp256k1_ecdsa_verify(ctx, NULL, msg, &pubkey) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, NULL, &pubkey) == 0); - CHECK(ecount == 5); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg, NULL) == 0); - CHECK(ecount == 6); - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg, &pubkey) == 1); - CHECK(ecount == 6); - CHECK(secp256k1_ec_pubkey_create(ctx, &pubkey, NULL) == 0); - CHECK(ecount == 7); - /* That pubkeyload fails via an ARGCHECK is a little odd but makes sense because pubkeys are an opaque data type. */ - CHECK(secp256k1_ecdsa_verify(ctx, &sig, msg, &pubkey) == 0); - CHECK(ecount == 8); - siglen = 72; - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, NULL, &siglen, &sig) == 0); - CHECK(ecount == 9); - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, NULL, &sig) == 0); - CHECK(ecount == 10); - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, &siglen, NULL) == 0); - CHECK(ecount == 11); - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, &siglen, &sig) == 1); - CHECK(ecount == 11); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, NULL, signature, siglen) == 0); - CHECK(ecount == 12); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, NULL, siglen) == 0); - CHECK(ecount == 13); - CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &sig, signature, siglen) == 1); - CHECK(ecount == 13); - siglen = 10; - /* Too little room for a signature does not fail via ARGCHECK. */ - CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, signature, &siglen, &sig) == 0); - CHECK(ecount == 13); - ecount = 0; - CHECK(secp256k1_ecdsa_signature_normalize(ctx, NULL, NULL) == 0); - CHECK(ecount == 1); - CHECK(secp256k1_ecdsa_signature_serialize_compact(ctx, NULL, &sig) == 0); - CHECK(ecount == 2); - CHECK(secp256k1_ecdsa_signature_serialize_compact(ctx, signature, NULL) == 0); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_signature_serialize_compact(ctx, signature, &sig) == 1); - CHECK(ecount == 3); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, NULL, signature) == 0); - CHECK(ecount == 4); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, &sig, NULL) == 0); - CHECK(ecount == 5); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, &sig, signature) == 1); - CHECK(ecount == 5); - memset(signature, 255, 64); - CHECK(secp256k1_ecdsa_signature_parse_compact(ctx, &sig, signature) == 0); - CHECK(ecount == 5); - secp256k1_context_set_illegal_callback(ctx, NULL, NULL); - } - - /* Nonce function corner cases. */ - for (t = 0; t < 2; t++) { - static const unsigned char zero[32] = {0x00}; - int i; - unsigned char key[32]; - unsigned char msg[32]; - secp256k1_ecdsa_signature sig2; - secp256k1_scalar sr[512], ss; - const unsigned char *extra; - extra = t == 0 ? NULL : zero; - memset(msg, 0, 32); - msg[31] = 1; - /* High key results in signature failure. */ - memset(key, 0xFF, 32); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, NULL, extra) == 0); - CHECK(is_empty_signature(&sig)); - /* Zero key results in signature failure. */ - memset(key, 0, 32); - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, NULL, extra) == 0); - CHECK(is_empty_signature(&sig)); - /* Nonce function failure results in signature failure. */ - key[31] = 1; - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, nonce_function_test_fail, extra) == 0); - CHECK(is_empty_signature(&sig)); - /* The retry loop successfully makes its way to the first good value. */ - CHECK(secp256k1_ecdsa_sign(ctx, &sig, msg, key, nonce_function_test_retry, extra) == 1); - CHECK(!is_empty_signature(&sig)); - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, nonce_function_rfc6979, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - CHECK(memcmp(&sig, &sig2, sizeof(sig)) == 0); - /* The default nonce function is deterministic. */ - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, NULL, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - CHECK(memcmp(&sig, &sig2, sizeof(sig)) == 0); - /* The default nonce function changes output with different messages. */ - for(i = 0; i < 256; i++) { - int j; - msg[0] = i; - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, NULL, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - secp256k1_ecdsa_signature_load(ctx, &sr[i], &ss, &sig2); - for (j = 0; j < i; j++) { - CHECK(!secp256k1_scalar_eq(&sr[i], &sr[j])); - } - } - msg[0] = 0; - msg[31] = 2; - /* The default nonce function changes output with different keys. */ - for(i = 256; i < 512; i++) { - int j; - key[0] = i - 256; - CHECK(secp256k1_ecdsa_sign(ctx, &sig2, msg, key, NULL, extra) == 1); - CHECK(!is_empty_signature(&sig2)); - secp256k1_ecdsa_signature_load(ctx, &sr[i], &ss, &sig2); - for (j = 0; j < i; j++) { - CHECK(!secp256k1_scalar_eq(&sr[i], &sr[j])); - } - } - key[0] = 0; - } - - { - /* Check that optional nonce arguments do not have equivalent effect. */ - const unsigned char zeros[32] = {0}; - unsigned char nonce[32]; - unsigned char nonce2[32]; - unsigned char nonce3[32]; - unsigned char nonce4[32]; - VG_UNDEF(nonce,32); - VG_UNDEF(nonce2,32); - VG_UNDEF(nonce3,32); - VG_UNDEF(nonce4,32); - CHECK(nonce_function_rfc6979(nonce, zeros, zeros, NULL, NULL, 0) == 1); - VG_CHECK(nonce,32); - CHECK(nonce_function_rfc6979(nonce2, zeros, zeros, zeros, NULL, 0) == 1); - VG_CHECK(nonce2,32); - CHECK(nonce_function_rfc6979(nonce3, zeros, zeros, NULL, (void *)zeros, 0) == 1); - VG_CHECK(nonce3,32); - CHECK(nonce_function_rfc6979(nonce4, zeros, zeros, zeros, (void *)zeros, 0) == 1); - VG_CHECK(nonce4,32); - CHECK(memcmp(nonce, nonce2, 32) != 0); - CHECK(memcmp(nonce, nonce3, 32) != 0); - CHECK(memcmp(nonce, nonce4, 32) != 0); - CHECK(memcmp(nonce2, nonce3, 32) != 0); - CHECK(memcmp(nonce2, nonce4, 32) != 0); - CHECK(memcmp(nonce3, nonce4, 32) != 0); - } - - - /* Privkey export where pubkey is the point at infinity. */ - { - unsigned char privkey[300]; - unsigned char seckey[32] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, - 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, - 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, - }; - size_t outlen = 300; - CHECK(!ec_privkey_export_der(ctx, privkey, &outlen, seckey, 0)); - outlen = 300; - CHECK(!ec_privkey_export_der(ctx, privkey, &outlen, seckey, 1)); - } -} - -void run_ecdsa_edge_cases(void) { - test_ecdsa_edge_cases(); -} - -#ifdef ENABLE_OPENSSL_TESTS -EC_KEY *get_openssl_key(const unsigned char *key32) { - unsigned char privkey[300]; - size_t privkeylen; - const unsigned char* pbegin = privkey; - int compr = secp256k1_rand_bits(1); - EC_KEY *ec_key = EC_KEY_new_by_curve_name(NID_secp256k1); - CHECK(ec_privkey_export_der(ctx, privkey, &privkeylen, key32, compr)); - CHECK(d2i_ECPrivateKey(&ec_key, &pbegin, privkeylen)); - CHECK(EC_KEY_check_key(ec_key)); - return ec_key; -} - -void test_ecdsa_openssl(void) { - secp256k1_gej qj; - secp256k1_ge q; - secp256k1_scalar sigr, sigs; - secp256k1_scalar one; - secp256k1_scalar msg2; - secp256k1_scalar key, msg; - EC_KEY *ec_key; - unsigned int sigsize = 80; - size_t secp_sigsize = 80; - unsigned char message[32]; - unsigned char signature[80]; - unsigned char key32[32]; - secp256k1_rand256_test(message); - secp256k1_scalar_set_b32(&msg, message, NULL); - random_scalar_order_test(&key); - secp256k1_scalar_get_b32(key32, &key); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &qj, &key); - secp256k1_ge_set_gej(&q, &qj); - ec_key = get_openssl_key(key32); - CHECK(ec_key != NULL); - CHECK(ECDSA_sign(0, message, sizeof(message), signature, &sigsize, ec_key)); - CHECK(secp256k1_ecdsa_sig_parse(&sigr, &sigs, signature, sigsize)); - CHECK(secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &q, &msg)); - secp256k1_scalar_set_int(&one, 1); - secp256k1_scalar_add(&msg2, &msg, &one); - CHECK(!secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &sigr, &sigs, &q, &msg2)); - - random_sign(&sigr, &sigs, &key, &msg, NULL); - CHECK(secp256k1_ecdsa_sig_serialize(signature, &secp_sigsize, &sigr, &sigs)); - CHECK(ECDSA_verify(0, message, sizeof(message), signature, secp_sigsize, ec_key) == 1); - - EC_KEY_free(ec_key); -} - -void run_ecdsa_openssl(void) { - int i; - for (i = 0; i < 10*count; i++) { - test_ecdsa_openssl(); - } -} -#endif - -#ifdef ENABLE_MODULE_ECDH -# include "modules/ecdh/tests_impl.h" -#endif - -#ifdef ENABLE_MODULE_SCHNORR -# include "modules/schnorr/tests_impl.h" -#endif - -#ifdef ENABLE_MODULE_RECOVERY -# include "modules/recovery/tests_impl.h" -#endif - -int main(int argc, char **argv) { - unsigned char seed16[16] = {0}; - unsigned char run32[32] = {0}; - /* find iteration count */ - if (argc > 1) { - count = strtol(argv[1], NULL, 0); - } - - /* find random seed */ - if (argc > 2) { - int pos = 0; - const char* ch = argv[2]; - while (pos < 16 && ch[0] != 0 && ch[1] != 0) { - unsigned short sh; - if (sscanf(ch, "%2hx", &sh)) { - seed16[pos] = sh; - } else { - break; - } - ch += 2; - pos++; - } - } else { - FILE *frand = fopen("/dev/urandom", "r"); - if ((frand == NULL) || !fread(&seed16, sizeof(seed16), 1, frand)) { - uint64_t t = time(NULL) * (uint64_t)1337; - seed16[0] ^= t; - seed16[1] ^= t >> 8; - seed16[2] ^= t >> 16; - seed16[3] ^= t >> 24; - seed16[4] ^= t >> 32; - seed16[5] ^= t >> 40; - seed16[6] ^= t >> 48; - seed16[7] ^= t >> 56; - } - fclose(frand); - } - secp256k1_rand_seed(seed16); - - printf("test count = %i\n", count); - printf("random seed = %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", seed16[0], seed16[1], seed16[2], seed16[3], seed16[4], seed16[5], seed16[6], seed16[7], seed16[8], seed16[9], seed16[10], seed16[11], seed16[12], seed16[13], seed16[14], seed16[15]); - - /* initialize */ - run_context_tests(); - ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - if (secp256k1_rand_bits(1)) { - secp256k1_rand256(run32); - CHECK(secp256k1_context_randomize(ctx, secp256k1_rand_bits(1) ? run32 : NULL)); - } - - run_rand_bits(); - run_rand_int(); - - run_sha256_tests(); - run_hmac_sha256_tests(); - run_rfc6979_hmac_sha256_tests(); - -#ifndef USE_NUM_NONE - /* num tests */ - run_num_smalltests(); -#endif - - /* scalar tests */ - run_scalar_tests(); - - /* field tests */ - run_field_inv(); - run_field_inv_var(); - run_field_inv_all_var(); - run_field_misc(); - run_field_convert(); - run_sqr(); - run_sqrt(); - - /* group tests */ - run_ge(); - run_group_decompress(); - - /* ecmult tests */ - run_wnaf(); - run_point_times_order(); - run_ecmult_chain(); - run_ecmult_constants(); - run_ecmult_gen_blind(); - run_ecmult_const_tests(); - run_ec_combine(); - - /* endomorphism tests */ -#ifdef USE_ENDOMORPHISM - run_endomorphism_tests(); -#endif - - /* EC point parser test */ - run_ec_pubkey_parse_test(); - - /* EC key edge cases */ - run_eckey_edge_case_test(); - -#ifdef ENABLE_MODULE_ECDH - /* ecdh tests */ - run_ecdh_tests(); -#endif - - /* ecdsa tests */ - run_random_pubkeys(); - run_ecdsa_der_parse(); - run_ecdsa_sign_verify(); - run_ecdsa_end_to_end(); - run_ecdsa_edge_cases(); -#ifdef ENABLE_OPENSSL_TESTS - run_ecdsa_openssl(); -#endif - -#ifdef ENABLE_MODULE_SCHNORR - /* Schnorr tests */ - run_schnorr_tests(); -#endif - -#ifdef ENABLE_MODULE_RECOVERY - /* ECDSA pubkey recovery tests */ - run_recovery_tests(); -#endif - - secp256k1_rand256(run32); - printf("random run = %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", run32[0], run32[1], run32[2], run32[3], run32[4], run32[5], run32[6], run32[7], run32[8], run32[9], run32[10], run32[11], run32[12], run32[13], run32[14], run32[15]); - - /* shutdown */ - secp256k1_context_destroy(ctx); - - printf("no problems found\n"); - return 0; -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c deleted file mode 100644 index b040bb07..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/tests_exhaustive.c +++ /dev/null @@ -1,470 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2016 Andrew Poelstra * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include -#include - -#include - -#undef USE_ECMULT_STATIC_PRECOMPUTATION - -#ifndef EXHAUSTIVE_TEST_ORDER -/* see group_impl.h for allowable values */ -#define EXHAUSTIVE_TEST_ORDER 13 -#define EXHAUSTIVE_TEST_LAMBDA 9 /* cube root of 1 mod 13 */ -#endif - -#include "include/secp256k1.h" -#include "group.h" -#include "secp256k1.c" -#include "testrand_impl.h" - -#ifdef ENABLE_MODULE_RECOVERY -#include "src/modules/recovery/main_impl.h" -#include "include/secp256k1_recovery.h" -#endif - -/** stolen from tests.c */ -void ge_equals_ge(const secp256k1_ge *a, const secp256k1_ge *b) { - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - CHECK(secp256k1_fe_equal_var(&a->x, &b->x)); - CHECK(secp256k1_fe_equal_var(&a->y, &b->y)); -} - -void ge_equals_gej(const secp256k1_ge *a, const secp256k1_gej *b) { - secp256k1_fe z2s; - secp256k1_fe u1, u2, s1, s2; - CHECK(a->infinity == b->infinity); - if (a->infinity) { - return; - } - /* Check a.x * b.z^2 == b.x && a.y * b.z^3 == b.y, to avoid inverses. */ - secp256k1_fe_sqr(&z2s, &b->z); - secp256k1_fe_mul(&u1, &a->x, &z2s); - u2 = b->x; secp256k1_fe_normalize_weak(&u2); - secp256k1_fe_mul(&s1, &a->y, &z2s); secp256k1_fe_mul(&s1, &s1, &b->z); - s2 = b->y; secp256k1_fe_normalize_weak(&s2); - CHECK(secp256k1_fe_equal_var(&u1, &u2)); - CHECK(secp256k1_fe_equal_var(&s1, &s2)); -} - -void random_fe(secp256k1_fe *x) { - unsigned char bin[32]; - do { - secp256k1_rand256(bin); - if (secp256k1_fe_set_b32(x, bin)) { - return; - } - } while(1); -} -/** END stolen from tests.c */ - -int secp256k1_nonce_function_smallint(unsigned char *nonce32, const unsigned char *msg32, - const unsigned char *key32, const unsigned char *algo16, - void *data, unsigned int attempt) { - secp256k1_scalar s; - int *idata = data; - (void)msg32; - (void)key32; - (void)algo16; - /* Some nonces cannot be used because they'd cause s and/or r to be zero. - * The signing function has retry logic here that just re-calls the nonce - * function with an increased `attempt`. So if attempt > 0 this means we - * need to change the nonce to avoid an infinite loop. */ - if (attempt > 0) { - *idata = (*idata + 1) % EXHAUSTIVE_TEST_ORDER; - } - secp256k1_scalar_set_int(&s, *idata); - secp256k1_scalar_get_b32(nonce32, &s); - return 1; -} - -#ifdef USE_ENDOMORPHISM -void test_exhaustive_endomorphism(const secp256k1_ge *group, int order) { - int i; - for (i = 0; i < order; i++) { - secp256k1_ge res; - secp256k1_ge_mul_lambda(&res, &group[i]); - ge_equals_ge(&group[i * EXHAUSTIVE_TEST_LAMBDA % EXHAUSTIVE_TEST_ORDER], &res); - } -} -#endif - -void test_exhaustive_addition(const secp256k1_ge *group, const secp256k1_gej *groupj, int order) { - int i, j; - - /* Sanity-check (and check infinity functions) */ - CHECK(secp256k1_ge_is_infinity(&group[0])); - CHECK(secp256k1_gej_is_infinity(&groupj[0])); - for (i = 1; i < order; i++) { - CHECK(!secp256k1_ge_is_infinity(&group[i])); - CHECK(!secp256k1_gej_is_infinity(&groupj[i])); - } - - /* Check all addition formulae */ - for (j = 0; j < order; j++) { - secp256k1_fe fe_inv; - secp256k1_fe_inv(&fe_inv, &groupj[j].z); - for (i = 0; i < order; i++) { - secp256k1_ge zless_gej; - secp256k1_gej tmp; - /* add_var */ - secp256k1_gej_add_var(&tmp, &groupj[i], &groupj[j], NULL); - ge_equals_gej(&group[(i + j) % order], &tmp); - /* add_ge */ - if (j > 0) { - secp256k1_gej_add_ge(&tmp, &groupj[i], &group[j]); - ge_equals_gej(&group[(i + j) % order], &tmp); - } - /* add_ge_var */ - secp256k1_gej_add_ge_var(&tmp, &groupj[i], &group[j], NULL); - ge_equals_gej(&group[(i + j) % order], &tmp); - /* add_zinv_var */ - zless_gej.infinity = groupj[j].infinity; - zless_gej.x = groupj[j].x; - zless_gej.y = groupj[j].y; - secp256k1_gej_add_zinv_var(&tmp, &groupj[i], &zless_gej, &fe_inv); - ge_equals_gej(&group[(i + j) % order], &tmp); - } - } - - /* Check doubling */ - for (i = 0; i < order; i++) { - secp256k1_gej tmp; - if (i > 0) { - secp256k1_gej_double_nonzero(&tmp, &groupj[i], NULL); - ge_equals_gej(&group[(2 * i) % order], &tmp); - } - secp256k1_gej_double_var(&tmp, &groupj[i], NULL); - ge_equals_gej(&group[(2 * i) % order], &tmp); - } - - /* Check negation */ - for (i = 1; i < order; i++) { - secp256k1_ge tmp; - secp256k1_gej tmpj; - secp256k1_ge_neg(&tmp, &group[i]); - ge_equals_ge(&group[order - i], &tmp); - secp256k1_gej_neg(&tmpj, &groupj[i]); - ge_equals_gej(&group[order - i], &tmpj); - } -} - -void test_exhaustive_ecmult(const secp256k1_context *ctx, const secp256k1_ge *group, const secp256k1_gej *groupj, int order) { - int i, j, r_log; - for (r_log = 1; r_log < order; r_log++) { - for (j = 0; j < order; j++) { - for (i = 0; i < order; i++) { - secp256k1_gej tmp; - secp256k1_scalar na, ng; - secp256k1_scalar_set_int(&na, i); - secp256k1_scalar_set_int(&ng, j); - - secp256k1_ecmult(&ctx->ecmult_ctx, &tmp, &groupj[r_log], &na, &ng); - ge_equals_gej(&group[(i * r_log + j) % order], &tmp); - - if (i > 0) { - secp256k1_ecmult_const(&tmp, &group[i], &ng); - ge_equals_gej(&group[(i * j) % order], &tmp); - } - } - } - } -} - -void r_from_k(secp256k1_scalar *r, const secp256k1_ge *group, int k) { - secp256k1_fe x; - unsigned char x_bin[32]; - k %= EXHAUSTIVE_TEST_ORDER; - x = group[k].x; - secp256k1_fe_normalize(&x); - secp256k1_fe_get_b32(x_bin, &x); - secp256k1_scalar_set_b32(r, x_bin, NULL); -} - -void test_exhaustive_verify(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - int s, r, msg, key; - for (s = 1; s < order; s++) { - for (r = 1; r < order; r++) { - for (msg = 1; msg < order; msg++) { - for (key = 1; key < order; key++) { - secp256k1_ge nonconst_ge; - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pk; - secp256k1_scalar sk_s, msg_s, r_s, s_s; - secp256k1_scalar s_times_k_s, msg_plus_r_times_sk_s; - int k, should_verify; - unsigned char msg32[32]; - - secp256k1_scalar_set_int(&s_s, s); - secp256k1_scalar_set_int(&r_s, r); - secp256k1_scalar_set_int(&msg_s, msg); - secp256k1_scalar_set_int(&sk_s, key); - - /* Verify by hand */ - /* Run through every k value that gives us this r and check that *one* works. - * Note there could be none, there could be multiple, ECDSA is weird. */ - should_verify = 0; - for (k = 0; k < order; k++) { - secp256k1_scalar check_x_s; - r_from_k(&check_x_s, group, k); - if (r_s == check_x_s) { - secp256k1_scalar_set_int(&s_times_k_s, k); - secp256k1_scalar_mul(&s_times_k_s, &s_times_k_s, &s_s); - secp256k1_scalar_mul(&msg_plus_r_times_sk_s, &r_s, &sk_s); - secp256k1_scalar_add(&msg_plus_r_times_sk_s, &msg_plus_r_times_sk_s, &msg_s); - should_verify |= secp256k1_scalar_eq(&s_times_k_s, &msg_plus_r_times_sk_s); - } - } - /* nb we have a "high s" rule */ - should_verify &= !secp256k1_scalar_is_high(&s_s); - - /* Verify by calling verify */ - secp256k1_ecdsa_signature_save(&sig, &r_s, &s_s); - memcpy(&nonconst_ge, &group[sk_s], sizeof(nonconst_ge)); - secp256k1_pubkey_save(&pk, &nonconst_ge); - secp256k1_scalar_get_b32(msg32, &msg_s); - CHECK(should_verify == - secp256k1_ecdsa_verify(ctx, &sig, msg32, &pk)); - } - } - } - } -} - -void test_exhaustive_sign(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - int i, j, k; - - /* Loop */ - for (i = 1; i < order; i++) { /* message */ - for (j = 1; j < order; j++) { /* key */ - for (k = 1; k < order; k++) { /* nonce */ - const int starting_k = k; - secp256k1_ecdsa_signature sig; - secp256k1_scalar sk, msg, r, s, expected_r; - unsigned char sk32[32], msg32[32]; - secp256k1_scalar_set_int(&msg, i); - secp256k1_scalar_set_int(&sk, j); - secp256k1_scalar_get_b32(sk32, &sk); - secp256k1_scalar_get_b32(msg32, &msg); - - secp256k1_ecdsa_sign(ctx, &sig, msg32, sk32, secp256k1_nonce_function_smallint, &k); - - secp256k1_ecdsa_signature_load(ctx, &r, &s, &sig); - /* Note that we compute expected_r *after* signing -- this is important - * because our nonce-computing function function might change k during - * signing. */ - r_from_k(&expected_r, group, k); - CHECK(r == expected_r); - CHECK((k * s) % order == (i + r * j) % order || - (k * (EXHAUSTIVE_TEST_ORDER - s)) % order == (i + r * j) % order); - - /* Overflow means we've tried every possible nonce */ - if (k < starting_k) { - break; - } - } - } - } - - /* We would like to verify zero-knowledge here by counting how often every - * possible (s, r) tuple appears, but because the group order is larger - * than the field order, when coercing the x-values to scalar values, some - * appear more often than others, so we are actually not zero-knowledge. - * (This effect also appears in the real code, but the difference is on the - * order of 1/2^128th the field order, so the deviation is not useful to a - * computationally bounded attacker.) - */ -} - -#ifdef ENABLE_MODULE_RECOVERY -void test_exhaustive_recovery_sign(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - int i, j, k; - - /* Loop */ - for (i = 1; i < order; i++) { /* message */ - for (j = 1; j < order; j++) { /* key */ - for (k = 1; k < order; k++) { /* nonce */ - const int starting_k = k; - secp256k1_fe r_dot_y_normalized; - secp256k1_ecdsa_recoverable_signature rsig; - secp256k1_ecdsa_signature sig; - secp256k1_scalar sk, msg, r, s, expected_r; - unsigned char sk32[32], msg32[32]; - int expected_recid; - int recid; - secp256k1_scalar_set_int(&msg, i); - secp256k1_scalar_set_int(&sk, j); - secp256k1_scalar_get_b32(sk32, &sk); - secp256k1_scalar_get_b32(msg32, &msg); - - secp256k1_ecdsa_sign_recoverable(ctx, &rsig, msg32, sk32, secp256k1_nonce_function_smallint, &k); - - /* Check directly */ - secp256k1_ecdsa_recoverable_signature_load(ctx, &r, &s, &recid, &rsig); - r_from_k(&expected_r, group, k); - CHECK(r == expected_r); - CHECK((k * s) % order == (i + r * j) % order || - (k * (EXHAUSTIVE_TEST_ORDER - s)) % order == (i + r * j) % order); - /* In computing the recid, there is an overflow condition that is disabled in - * scalar_low_impl.h `secp256k1_scalar_set_b32` because almost every r.y value - * will exceed the group order, and our signing code always holds out for r - * values that don't overflow, so with a proper overflow check the tests would - * loop indefinitely. */ - r_dot_y_normalized = group[k].y; - secp256k1_fe_normalize(&r_dot_y_normalized); - /* Also the recovery id is flipped depending if we hit the low-s branch */ - if ((k * s) % order == (i + r * j) % order) { - expected_recid = secp256k1_fe_is_odd(&r_dot_y_normalized) ? 1 : 0; - } else { - expected_recid = secp256k1_fe_is_odd(&r_dot_y_normalized) ? 0 : 1; - } - CHECK(recid == expected_recid); - - /* Convert to a standard sig then check */ - secp256k1_ecdsa_recoverable_signature_convert(ctx, &sig, &rsig); - secp256k1_ecdsa_signature_load(ctx, &r, &s, &sig); - /* Note that we compute expected_r *after* signing -- this is important - * because our nonce-computing function function might change k during - * signing. */ - r_from_k(&expected_r, group, k); - CHECK(r == expected_r); - CHECK((k * s) % order == (i + r * j) % order || - (k * (EXHAUSTIVE_TEST_ORDER - s)) % order == (i + r * j) % order); - - /* Overflow means we've tried every possible nonce */ - if (k < starting_k) { - break; - } - } - } - } -} - -void test_exhaustive_recovery_verify(const secp256k1_context *ctx, const secp256k1_ge *group, int order) { - /* This is essentially a copy of test_exhaustive_verify, with recovery added */ - int s, r, msg, key; - for (s = 1; s < order; s++) { - for (r = 1; r < order; r++) { - for (msg = 1; msg < order; msg++) { - for (key = 1; key < order; key++) { - secp256k1_ge nonconst_ge; - secp256k1_ecdsa_recoverable_signature rsig; - secp256k1_ecdsa_signature sig; - secp256k1_pubkey pk; - secp256k1_scalar sk_s, msg_s, r_s, s_s; - secp256k1_scalar s_times_k_s, msg_plus_r_times_sk_s; - int recid = 0; - int k, should_verify; - unsigned char msg32[32]; - - secp256k1_scalar_set_int(&s_s, s); - secp256k1_scalar_set_int(&r_s, r); - secp256k1_scalar_set_int(&msg_s, msg); - secp256k1_scalar_set_int(&sk_s, key); - secp256k1_scalar_get_b32(msg32, &msg_s); - - /* Verify by hand */ - /* Run through every k value that gives us this r and check that *one* works. - * Note there could be none, there could be multiple, ECDSA is weird. */ - should_verify = 0; - for (k = 0; k < order; k++) { - secp256k1_scalar check_x_s; - r_from_k(&check_x_s, group, k); - if (r_s == check_x_s) { - secp256k1_scalar_set_int(&s_times_k_s, k); - secp256k1_scalar_mul(&s_times_k_s, &s_times_k_s, &s_s); - secp256k1_scalar_mul(&msg_plus_r_times_sk_s, &r_s, &sk_s); - secp256k1_scalar_add(&msg_plus_r_times_sk_s, &msg_plus_r_times_sk_s, &msg_s); - should_verify |= secp256k1_scalar_eq(&s_times_k_s, &msg_plus_r_times_sk_s); - } - } - /* nb we have a "high s" rule */ - should_verify &= !secp256k1_scalar_is_high(&s_s); - - /* We would like to try recovering the pubkey and checking that it matches, - * but pubkey recovery is impossible in the exhaustive tests (the reason - * being that there are 12 nonzero r values, 12 nonzero points, and no - * overlap between the sets, so there are no valid signatures). */ - - /* Verify by converting to a standard signature and calling verify */ - secp256k1_ecdsa_recoverable_signature_save(&rsig, &r_s, &s_s, recid); - secp256k1_ecdsa_recoverable_signature_convert(ctx, &sig, &rsig); - memcpy(&nonconst_ge, &group[sk_s], sizeof(nonconst_ge)); - secp256k1_pubkey_save(&pk, &nonconst_ge); - CHECK(should_verify == - secp256k1_ecdsa_verify(ctx, &sig, msg32, &pk)); - } - } - } - } -} -#endif - -int main(void) { - int i; - secp256k1_gej groupj[EXHAUSTIVE_TEST_ORDER]; - secp256k1_ge group[EXHAUSTIVE_TEST_ORDER]; - - /* Build context */ - secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN | SECP256K1_CONTEXT_VERIFY); - - /* TODO set z = 1, then do num_tests runs with random z values */ - - /* Generate the entire group */ - secp256k1_gej_set_infinity(&groupj[0]); - secp256k1_ge_set_gej(&group[0], &groupj[0]); - for (i = 1; i < EXHAUSTIVE_TEST_ORDER; i++) { - /* Set a different random z-value for each Jacobian point */ - secp256k1_fe z; - random_fe(&z); - - secp256k1_gej_add_ge(&groupj[i], &groupj[i - 1], &secp256k1_ge_const_g); - secp256k1_ge_set_gej(&group[i], &groupj[i]); - secp256k1_gej_rescale(&groupj[i], &z); - - /* Verify against ecmult_gen */ - { - secp256k1_scalar scalar_i; - secp256k1_gej generatedj; - secp256k1_ge generated; - - secp256k1_scalar_set_int(&scalar_i, i); - secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &generatedj, &scalar_i); - secp256k1_ge_set_gej(&generated, &generatedj); - - CHECK(group[i].infinity == 0); - CHECK(generated.infinity == 0); - CHECK(secp256k1_fe_equal_var(&generated.x, &group[i].x)); - CHECK(secp256k1_fe_equal_var(&generated.y, &group[i].y)); - } - } - - /* Run the tests */ -#ifdef USE_ENDOMORPHISM - test_exhaustive_endomorphism(group, EXHAUSTIVE_TEST_ORDER); -#endif - test_exhaustive_addition(group, groupj, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_ecmult(ctx, group, groupj, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_sign(ctx, group, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_verify(ctx, group, EXHAUSTIVE_TEST_ORDER); - -#ifdef ENABLE_MODULE_RECOVERY - test_exhaustive_recovery_sign(ctx, group, EXHAUSTIVE_TEST_ORDER); - test_exhaustive_recovery_verify(ctx, group, EXHAUSTIVE_TEST_ORDER); -#endif - - secp256k1_context_destroy(ctx); - return 0; -} - diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h deleted file mode 100644 index 4092a86c..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/libsecp256k1/src/util.h +++ /dev/null @@ -1,113 +0,0 @@ -/********************************************************************** - * Copyright (c) 2013, 2014 Pieter Wuille * - * Distributed under the MIT software license, see the accompanying * - * file COPYING or http://www.opensource.org/licenses/mit-license.php.* - **********************************************************************/ - -#ifndef _SECP256K1_UTIL_H_ -#define _SECP256K1_UTIL_H_ - -#if defined HAVE_CONFIG_H -#include "libsecp256k1-config.h" -#endif - -#include -#include -#include - -typedef struct { - void (*fn)(const char *text, void* data); - const void* data; -} secp256k1_callback; - -static SECP256K1_INLINE void secp256k1_callback_call(const secp256k1_callback * const cb, const char * const text) { - cb->fn(text, (void*)cb->data); -} - -#ifdef DETERMINISTIC -#define TEST_FAILURE(msg) do { \ - fprintf(stderr, "%s\n", msg); \ - abort(); \ -} while(0); -#else -#define TEST_FAILURE(msg) do { \ - fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, msg); \ - abort(); \ -} while(0) -#endif - -#ifdef HAVE_BUILTIN_EXPECT -#define EXPECT(x,c) __builtin_expect((x),(c)) -#else -#define EXPECT(x,c) (x) -#endif - -#ifdef DETERMINISTIC -#define CHECK(cond) do { \ - if (EXPECT(!(cond), 0)) { \ - TEST_FAILURE("test condition failed"); \ - } \ -} while(0) -#else -#define CHECK(cond) do { \ - if (EXPECT(!(cond), 0)) { \ - TEST_FAILURE("test condition failed: " #cond); \ - } \ -} while(0) -#endif - -/* Like assert(), but when VERIFY is defined, and side-effect safe. */ -#if defined(COVERAGE) -#define VERIFY_CHECK(check) -#define VERIFY_SETUP(stmt) -#elif defined(VERIFY) -#define VERIFY_CHECK CHECK -#define VERIFY_SETUP(stmt) do { stmt; } while(0) -#else -#define VERIFY_CHECK(cond) do { (void)(cond); } while(0) -#define VERIFY_SETUP(stmt) -#endif - -static SECP256K1_INLINE void *checked_malloc(const secp256k1_callback* cb, size_t size) { - void *ret = malloc(size); - if (ret == NULL) { - secp256k1_callback_call(cb, "Out of memory"); - } - return ret; -} - -/* Macro for restrict, when available and not in a VERIFY build. */ -#if defined(SECP256K1_BUILD) && defined(VERIFY) -# define SECP256K1_RESTRICT -#else -# if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) ) -# if SECP256K1_GNUC_PREREQ(3,0) -# define SECP256K1_RESTRICT __restrict__ -# elif (defined(_MSC_VER) && _MSC_VER >= 1400) -# define SECP256K1_RESTRICT __restrict -# else -# define SECP256K1_RESTRICT -# endif -# else -# define SECP256K1_RESTRICT restrict -# endif -#endif - -#if defined(_WIN32) -# define I64FORMAT "I64d" -# define I64uFORMAT "I64u" -#else -# define I64FORMAT "lld" -# define I64uFORMAT "llu" -#endif - -#if defined(HAVE___INT128) -# if defined(__GNUC__) -# define SECP256K1_GNUC_EXT __extension__ -# else -# define SECP256K1_GNUC_EXT -# endif -SECP256K1_GNUC_EXT typedef unsigned __int128 uint128_t; -#endif - -#endif diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/panic_cb.go b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/panic_cb.go deleted file mode 100644 index 6d59a1d2..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/panic_cb.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be found in -// the LICENSE file. - -package secp256k1 - -import "C" -import "unsafe" - -// Callbacks for converting libsecp256k1 internal faults into -// recoverable Go panics. - -//export secp256k1GoPanicIllegal -func secp256k1GoPanicIllegal(msg *C.char, data unsafe.Pointer) { - panic("illegal argument: " + C.GoString(msg)) -} - -//export secp256k1GoPanicError -func secp256k1GoPanicError(msg *C.char, data unsafe.Pointer) { - panic("internal error: " + C.GoString(msg)) -} diff --git a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/secp256.go b/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/secp256.go deleted file mode 100644 index 35d0eef3..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/internal/secp256k1/secp256.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2015 Jeffrey Wilcke, Felix Lange, Gustav Simonsson. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be found in -// the LICENSE file. - -// Package secp256k1 wraps the bitcoin secp256k1 C library. -package secp256k1 - -/* -#cgo CFLAGS: -I./libsecp256k1 -#cgo CFLAGS: -I./libsecp256k1/src/ -#define USE_NUM_NONE -#define USE_FIELD_10X26 -#define USE_FIELD_INV_BUILTIN -#define USE_SCALAR_8X32 -#define USE_SCALAR_INV_BUILTIN -#define NDEBUG -#include "./libsecp256k1/src/secp256k1.c" -#include "./libsecp256k1/src/modules/recovery/main_impl.h" -#include "ext.h" - -typedef void (*callbackFunc) (const char* msg, void* data); -extern void secp256k1GoPanicIllegal(const char* msg, void* data); -extern void secp256k1GoPanicError(const char* msg, void* data); -*/ -import "C" - -import ( - "errors" - "math/big" - "unsafe" -) - -var context *C.secp256k1_context - -func init() { - // around 20 ms on a modern CPU. - context = C.secp256k1_context_create_sign_verify() - C.secp256k1_context_set_illegal_callback(context, C.callbackFunc(C.secp256k1GoPanicIllegal), nil) - C.secp256k1_context_set_error_callback(context, C.callbackFunc(C.secp256k1GoPanicError), nil) -} - -var ( - ErrInvalidMsgLen = errors.New("invalid message length, need 32 bytes") - ErrInvalidSignatureLen = errors.New("invalid signature length") - ErrInvalidRecoveryID = errors.New("invalid signature recovery id") - ErrInvalidKey = errors.New("invalid private key") - ErrInvalidPubkey = errors.New("invalid public key") - ErrSignFailed = errors.New("signing failed") - ErrRecoverFailed = errors.New("recovery failed") -) - -// Sign creates a recoverable ECDSA signature. -// The produced signature is in the 65-byte [R || S || V] format where V is 0 or 1. -// -// The caller is responsible for ensuring that msg cannot be chosen -// directly by an attacker. It is usually preferable to use a cryptographic -// hash function on any input before handing it to this function. -func Sign(msg []byte, seckey []byte) ([]byte, error) { - if len(msg) != 32 { - return nil, ErrInvalidMsgLen - } - if len(seckey) != 32 { - return nil, ErrInvalidKey - } - seckeydata := (*C.uchar)(unsafe.Pointer(&seckey[0])) - if C.secp256k1_ec_seckey_verify(context, seckeydata) != 1 { - return nil, ErrInvalidKey - } - - var ( - msgdata = (*C.uchar)(unsafe.Pointer(&msg[0])) - noncefunc = C.secp256k1_nonce_function_rfc6979 - sigstruct C.secp256k1_ecdsa_recoverable_signature - ) - if C.secp256k1_ecdsa_sign_recoverable(context, &sigstruct, msgdata, seckeydata, noncefunc, nil) == 0 { - return nil, ErrSignFailed - } - - var ( - sig = make([]byte, 65) - sigdata = (*C.uchar)(unsafe.Pointer(&sig[0])) - recid C.int - ) - C.secp256k1_ecdsa_recoverable_signature_serialize_compact(context, sigdata, &recid, &sigstruct) - sig[64] = byte(recid) // add back recid to get 65 bytes sig - return sig, nil -} - -// RecoverPubkey returns the public key of the signer. -// msg must be the 32-byte hash of the message to be signed. -// sig must be a 65-byte compact ECDSA signature containing the -// recovery id as the last element. -func RecoverPubkey(msg []byte, sig []byte) ([]byte, error) { - if len(msg) != 32 { - return nil, ErrInvalidMsgLen - } - if err := checkSignature(sig); err != nil { - return nil, err - } - - var ( - pubkey = make([]byte, 65) - sigdata = (*C.uchar)(unsafe.Pointer(&sig[0])) - msgdata = (*C.uchar)(unsafe.Pointer(&msg[0])) - ) - if C.secp256k1_ext_ecdsa_recover(context, (*C.uchar)(unsafe.Pointer(&pubkey[0])), sigdata, msgdata) == 0 { - return nil, ErrRecoverFailed - } - return pubkey, nil -} - -// VerifySignature checks that the given pubkey created signature over message. -// The signature should be in [R || S] format. -func VerifySignature(pubkey, msg, signature []byte) bool { - if len(msg) != 32 || len(signature) != 64 || len(pubkey) == 0 { - return false - } - sigdata := (*C.uchar)(unsafe.Pointer(&signature[0])) - msgdata := (*C.uchar)(unsafe.Pointer(&msg[0])) - keydata := (*C.uchar)(unsafe.Pointer(&pubkey[0])) - return C.secp256k1_ext_ecdsa_verify(context, sigdata, msgdata, keydata, C.size_t(len(pubkey))) != 0 -} - -// DecompressPubkey parses a public key in the 33-byte compressed format. -// It returns non-nil coordinates if the public key is valid. -func DecompressPubkey(pubkey []byte) (x, y *big.Int) { - if len(pubkey) != 33 { - return nil, nil - } - var ( - pubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0])) - pubkeylen = C.size_t(len(pubkey)) - out = make([]byte, 65) - outdata = (*C.uchar)(unsafe.Pointer(&out[0])) - outlen = C.size_t(len(out)) - ) - if C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 { - return nil, nil - } - return new(big.Int).SetBytes(out[1:33]), new(big.Int).SetBytes(out[33:]) -} - -// CompressPubkey encodes a public key to 33-byte compressed format. -func CompressPubkey(x, y *big.Int) []byte { - var ( - pubkey = S256().Marshal(x, y) - pubkeydata = (*C.uchar)(unsafe.Pointer(&pubkey[0])) - pubkeylen = C.size_t(len(pubkey)) - out = make([]byte, 33) - outdata = (*C.uchar)(unsafe.Pointer(&out[0])) - outlen = C.size_t(len(out)) - ) - if C.secp256k1_ext_reencode_pubkey(context, outdata, outlen, pubkeydata, pubkeylen) == 0 { - panic("libsecp256k1 error") - } - return out -} - -func checkSignature(sig []byte) error { - if len(sig) != 65 { - return ErrInvalidSignatureLen - } - if sig[64] >= 4 { - return ErrInvalidRecoveryID - } - return nil -} diff --git a/core-sdk/common/crypto/keys/secp256k1/keys.pb.go b/core-sdk/common/crypto/keys/secp256k1/keys.pb.go deleted file mode 100644 index 037d57e1..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/keys.pb.go +++ /dev/null @@ -1,499 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/secp256k1/keys.proto - -package secp256k1 - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// PubKey defines a secp256k1 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -type PubKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_e0835e68ebdcb224, []int{0} -} -func (m *PubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey.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 *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(m, src) -} -func (m *PubKey) XXX_Size() int { - return m.Size() -} -func (m *PubKey) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey proto.InternalMessageInfo - -func (m *PubKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -// PrivKey defines a secp256k1 private key. -type PrivKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PrivKey) Reset() { *m = PrivKey{} } -func (m *PrivKey) String() string { return proto.CompactTextString(m) } -func (*PrivKey) ProtoMessage() {} -func (*PrivKey) Descriptor() ([]byte, []int) { - return fileDescriptor_e0835e68ebdcb224, []int{1} -} -func (m *PrivKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PrivKey.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 *PrivKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrivKey.Merge(m, src) -} -func (m *PrivKey) XXX_Size() int { - return m.Size() -} -func (m *PrivKey) XXX_DiscardUnknown() { - xxx_messageInfo_PrivKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PrivKey proto.InternalMessageInfo - -func (m *PrivKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func init() { - proto.RegisterType((*PubKey)(nil), "cosmos.crypto.secp256k1.PubKey") - proto.RegisterType((*PrivKey)(nil), "cosmos.crypto.secp256k1.PrivKey") -} - -func init() { - proto.RegisterFile("cosmos/crypto/secp256k1/keys.proto", fileDescriptor_e0835e68ebdcb224) -} - -var fileDescriptor_e0835e68ebdcb224 = []byte{ - // 196 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x2f, 0x4e, 0x4d, 0x2e, 0x30, 0x32, - 0x35, 0xcb, 0x36, 0xd4, 0xcf, 0x4e, 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, - 0x87, 0xa8, 0xd1, 0x83, 0xa8, 0xd1, 0x83, 0xab, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, - 0xd1, 0x07, 0xb1, 0x20, 0xca, 0x95, 0x14, 0xb8, 0xd8, 0x02, 0x4a, 0x93, 0xbc, 0x53, 0x2b, 0x85, - 0x04, 0xb8, 0x98, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82, 0x40, 0x4c, 0x2b, - 0x96, 0x19, 0x0b, 0xe4, 0x19, 0x94, 0xa4, 0xb9, 0xd8, 0x03, 0x8a, 0x32, 0xcb, 0xb0, 0x2a, 0x71, - 0x0a, 0x3c, 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, 0xf3, 0xf4, 0xcc, 0x92, - 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xcc, 0xa2, 0xcc, 0xe2, 0xbc, 0xd4, 0x12, 0x30, - 0x9d, 0x51, 0x9a, 0xa4, 0x5b, 0x9c, 0x92, 0xad, 0x9b, 0x9e, 0x0f, 0xf3, 0x06, 0xc8, 0xf1, 0x08, - 0xbf, 0x24, 0xb1, 0x81, 0x1d, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x79, 0x9f, 0x4f, 0xad, - 0xed, 0x00, 0x00, 0x00, -} - -func (m *PubKey) 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 *PubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PrivKey) 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 *PrivKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { - offset -= sovKeys(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func (m *PrivKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func sovKeys(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKeys(x uint64) (n int) { - return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PubKey) 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 ErrIntOverflowKeys - } - 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: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrivKey) 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 ErrIntOverflowKeys - } - 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: PrivKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrivKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKeys(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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrInvalidLengthKeys - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKeys - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKeys - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1.go deleted file mode 100644 index ac735b19..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1.go +++ /dev/null @@ -1,205 +0,0 @@ -package secp256k1 - -import ( - "bytes" - "crypto/sha256" - "crypto/subtle" - "fmt" - "io" - "math/big" - - secp256k1 "github.com/btcsuite/btcd/btcec" - "golang.org/x/crypto/ripemd160" // nolint: staticcheck // necessary for Bitcoin address format - - "github.com/irisnet/core-sdk-go/common/codec" - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" - - "github.com/tendermint/tendermint/crypto" -) - -var _ cryptotypes.PrivKey = &PrivKey{} -var _ codec.AminoMarshaler = &PrivKey{} - -const ( - PrivKeySize = 32 - keyType = "secp256k1" - PrivKeyName = "tendermint/PrivKeySecp256k1" - PubKeyName = "tendermint/PubKeySecp256k1" -) - -// Bytes returns the byte representation of the Private Key. -func (privKey *PrivKey) Bytes() []byte { - return privKey.Key -} - -// PubKey performs the point-scalar multiplication from the privKey on the -// generator point to get the pubkey. -func (privKey *PrivKey) PubKey() crypto.PubKey { - _, pubkeyObject := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey.Key) - pk := pubkeyObject.SerializeCompressed() - return &PubKey{Key: pk} -} - -// Equals - you probably don't need to use this. -// Runs in constant time based on length of the -func (privKey *PrivKey) Equals(other crypto.PrivKey) bool { - return privKey.Type() == other.Type() && subtle.ConstantTimeCompare(privKey.Bytes(), other.Bytes()) == 1 -} - -func (privKey *PrivKey) Type() string { - return keyType -} - -// MarshalAmino overrides Amino binary marshalling. -func (privKey PrivKey) MarshalAmino() ([]byte, error) { - return privKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PrivKeySize { - return fmt.Errorf("invalid privkey size") - } - privKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return privKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { - return privKey.UnmarshalAmino(bz) -} - -// GenPrivKey generates a new ECDSA private key on curve secp256k1 private key. -// It uses OS randomness to generate the private key. -func GenPrivKey() *PrivKey { - return &PrivKey{Key: genPrivKey(crypto.CReader())} -} - -// genPrivKey generates a new secp256k1 private key using the provided reader. -func genPrivKey(rand io.Reader) []byte { - var privKeyBytes [PrivKeySize]byte - d := new(big.Int) - for { - privKeyBytes = [PrivKeySize]byte{} - _, err := io.ReadFull(rand, privKeyBytes[:]) - if err != nil { - panic(err) - } - - d.SetBytes(privKeyBytes[:]) - // break if we found a valid point (i.e. > 0 and < N == curverOrder) - isValidFieldElement := 0 < d.Sign() && d.Cmp(secp256k1.S256().N) < 0 - if isValidFieldElement { - break - } - } - - return privKeyBytes[:] -} - -var one = new(big.Int).SetInt64(1) - -// GenPrivKeyFromSecret hashes the secret with SHA2, and uses -// that 32 byte output to create the private key. -// -// It makes sure the private key is a valid field element by setting: -// -// c = sha256(secret) -// k = (c mod (n − 1)) + 1, where n = curve order. -// -// NOTE: secret should be the output of a KDF like bcrypt, -// if it's derived from user input. -func GenPrivKeyFromSecret(secret []byte) *PrivKey { - secHash := sha256.Sum256(secret) - // to guarantee that we have a valid field element, we use the approach of: - // "Suite B Implementer’s Guide to FIPS 186-3", A.2.1 - // https://apps.nsa.gov/iaarchive/library/ia-guidance/ia-solutions-for-classified/algorithm-guidance/suite-b-implementers-guide-to-fips-186-3-ecdsa.cfm - // see also https://github.com/golang/go/blob/0380c9ad38843d523d9c9804fe300cb7edd7cd3c/src/crypto/ecdsa/ecdsa.go#L89-L101 - fe := new(big.Int).SetBytes(secHash[:]) - n := new(big.Int).Sub(secp256k1.S256().N, one) - fe.Mod(fe, n) - fe.Add(fe, one) - - feB := fe.Bytes() - privKey32 := make([]byte, PrivKeySize) - // copy feB over to fixed 32 byte privKey32 and pad (if necessary) - copy(privKey32[32-len(feB):32], feB) - - return &PrivKey{Key: privKey32} -} - -//------------------------------------- - -var _ cryptotypes.PubKey = &PubKey{} -var _ codec.AminoMarshaler = &PubKey{} - -// PubKeySize is comprised of 32 bytes for one field element -// (the x-coordinate), plus one byte for the parity of the y-coordinate. -const PubKeySize = 33 - -// Address returns a Bitcoin style addresses: RIPEMD160(SHA256(pubkey)) -func (pubKey *PubKey) Address() crypto.Address { - if len(pubKey.Key) != PubKeySize { - panic("length of pubkey is incorrect") - } - - hasherSHA256 := sha256.New() - _, _ = hasherSHA256.Write(pubKey.Key) // does not error - sha := hasherSHA256.Sum(nil) - - hasherRIPEMD160 := ripemd160.New() - _, _ = hasherRIPEMD160.Write(sha) // does not error - return crypto.Address(hasherRIPEMD160.Sum(nil)) -} - -// Bytes returns the pubkey byte format. -func (pubKey *PubKey) Bytes() []byte { - return pubKey.Key -} - -func (pubKey *PubKey) String() string { - return fmt.Sprintf("PubKeySecp256k1{%X}", pubKey.Key) -} - -func (pubKey *PubKey) Type() string { - return keyType -} - -func (pubKey *PubKey) Equals(other crypto.PubKey) bool { - return pubKey.Type() == other.Type() && bytes.Equal(pubKey.Bytes(), other.Bytes()) -} - -// MarshalAmino overrides Amino binary marshalling. -func (pubKey PubKey) MarshalAmino() ([]byte, error) { - return pubKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PubKeySize { - return fmt.Errorf("invalid pubkey size") - } - pubKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return pubKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { - return pubKey.UnmarshalAmino(bz) -} diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go deleted file mode 100644 index 0a36a664..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build libsecp256k1 - -package secp256k1 - -import ( - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1/internal/secp256k1" -) - -// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg. -func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) { - rsv, err := secp256k1.Sign(crypto.Sha256(msg), privKey.Key) - if err != nil { - return nil, err - } - // we do not need v in r||s||v: - rs := rsv[:len(rsv)-1] - return rs, nil -} - -func (pubKey *PrivKey) VerifySignature(msg []byte, sig []byte) bool { - return secp256k1.VerifySignature(pubKey.Key, crypto.Sha256(msg), sig) -} diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo_test.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo_test.go deleted file mode 100644 index bfaa76ca..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1_cgo_test.go +++ /dev/null @@ -1,40 +0,0 @@ -// +build libsecp256k1 - -package secp256k1 - -import ( - "testing" - - "github.com/magiconair/properties/assert" - - "github.com/stretchr/testify/require" -) - -func TestPrivKeySecp256k1SignVerify(t *testing.T) { - msg := []byte("A.1.2 ECC Key Pair Generation by Testing Candidates") - priv := GenPrivKey() - tests := []struct { - name string - privKey *PrivKey - wantSignErr bool - wantVerifyPasses bool - }{ - {name: "valid sign-verify round", privKey: priv, wantSignErr: false, wantVerifyPasses: true}, - {name: "invalid private key", privKey: &*PrivKey{Key: [32]byte{}}, wantSignErr: true, wantVerifyPasses: false}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := tt.privKey.Sign(msg) - if tt.wantSignErr { - require.Error(t, err) - t.Logf("Got error: %s", err) - return - } - require.NoError(t, err) - require.NotNil(t, got) - - pub := tt.privKey.PubKey() - assert.Equal(t, tt.wantVerifyPasses, pub.VerifyBytes(msg, got)) - }) - } -} diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1_internal_test.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1_internal_test.go deleted file mode 100644 index 3103413f..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1_internal_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package secp256k1 - -import ( - "bytes" - "math/big" - "testing" - - "github.com/stretchr/testify/require" - - underlyingSecp256k1 "github.com/btcsuite/btcd/btcec" -) - -func Test_genPrivKey(t *testing.T) { - - empty := make([]byte, 32) - oneB := big.NewInt(1).Bytes() - onePadded := make([]byte, 32) - copy(onePadded[32-len(oneB):32], oneB) - t.Logf("one padded: %v, len=%v", onePadded, len(onePadded)) - - validOne := append(empty, onePadded...) - tests := []struct { - name string - notSoRand []byte - shouldPanic bool - }{ - {"empty bytes (panics because 1st 32 bytes are zero and 0 is not a valid field element)", empty, true}, - {"curve order: N", underlyingSecp256k1.S256().N.Bytes(), true}, - {"valid because 0 < 1 < N", validOne, false}, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - if tt.shouldPanic { - require.Panics(t, func() { - genPrivKey(bytes.NewReader(tt.notSoRand)) - }) - return - } - got := genPrivKey(bytes.NewReader(tt.notSoRand)) - fe := new(big.Int).SetBytes(got[:]) - require.True(t, fe.Cmp(underlyingSecp256k1.S256().N) < 0) - require.True(t, fe.Sign() > 0) - }) - } -} diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo.go deleted file mode 100644 index 2d605447..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo.go +++ /dev/null @@ -1,70 +0,0 @@ -// +build !libsecp256k1 - -package secp256k1 - -import ( - "math/big" - - secp256k1 "github.com/btcsuite/btcd/btcec" - - "github.com/tendermint/tendermint/crypto" -) - -// used to reject malleable signatures -// see: -// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93 -// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/crypto.go#L39 -var secp256k1halfN = new(big.Int).Rsh(secp256k1.S256().N, 1) - -// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg. -// The returned signature will be of the form R || S (in lower-S form). -func (privKey *PrivKey) Sign(msg []byte) ([]byte, error) { - priv, _ := secp256k1.PrivKeyFromBytes(secp256k1.S256(), privKey.Key) - sig, err := priv.Sign(crypto.Sha256(msg)) - if err != nil { - return nil, err - } - sigBytes := serializeSig(sig) - return sigBytes, nil -} - -// VerifyBytes verifies a signature of the form R || S. -// It rejects signatures which are not in lower-S form. -func (pubKey *PubKey) VerifySignature(msg []byte, sigStr []byte) bool { - if len(sigStr) != 64 { - return false - } - pub, err := secp256k1.ParsePubKey(pubKey.Key, secp256k1.S256()) - if err != nil { - return false - } - // parse the signature: - signature := signatureFromBytes(sigStr) - // Reject malleable signatures. libsecp256k1 does this check but btcec doesn't. - // see: https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93 - if signature.S.Cmp(secp256k1halfN) > 0 { - return false - } - return signature.Verify(crypto.Sha256(msg), pub) -} - -// Read Signature struct from R || S. Caller needs to ensure -// that len(sigStr) == 64. -func signatureFromBytes(sigStr []byte) *secp256k1.Signature { - return &secp256k1.Signature{ - R: new(big.Int).SetBytes(sigStr[:32]), - S: new(big.Int).SetBytes(sigStr[32:64]), - } -} - -// Serialize signature to R || S. -// R, S are padded to 32 bytes respectively. -func serializeSig(sig *secp256k1.Signature) []byte { - rBytes := sig.R.Bytes() - sBytes := sig.S.Bytes() - sigBytes := make([]byte, 64) - // 0 pad the byte arrays from the left if they aren't big enough. - copy(sigBytes[32-len(rBytes):32], rBytes) - copy(sigBytes[64-len(sBytes):64], sBytes) - return sigBytes -} diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo_test.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo_test.go deleted file mode 100644 index 4c2c856e..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1_nocgo_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// +build !libsecp256k1 - -package secp256k1 - -import ( - "testing" - - secp256k1 "github.com/btcsuite/btcd/btcec" - "github.com/stretchr/testify/require" -) - -// Ensure that signature verification works, and that -// non-canonical signatures fail. -// Note: run with CGO_ENABLED=0 or go test -tags !cgo. -func TestSignatureVerificationAndRejectUpperS(t *testing.T) { - msg := []byte("We have lingered long enough on the shores of the cosmic ocean.") - for i := 0; i < 500; i++ { - priv := GenPrivKey() - sigStr, err := priv.Sign(msg) - require.NoError(t, err) - sig := signatureFromBytes(sigStr) - require.False(t, sig.S.Cmp(secp256k1halfN) > 0) - - pub := priv.PubKey() - require.True(t, pub.VerifySignature(msg, sigStr)) - - // malleate: - sig.S.Sub(secp256k1.S256().CurveParams.N, sig.S) - require.True(t, sig.S.Cmp(secp256k1halfN) > 0) - malSigStr := serializeSig(sig) - - require.False(t, pub.VerifySignature(msg, malSigStr), - "VerifyBytes incorrect with malleated & invalid S. sig=%v, key=%v", - sig, - priv, - ) - } -} diff --git a/core-sdk/common/crypto/keys/secp256k1/secp256k1_test.go b/core-sdk/common/crypto/keys/secp256k1/secp256k1_test.go deleted file mode 100644 index 5bad2b79..00000000 --- a/core-sdk/common/crypto/keys/secp256k1/secp256k1_test.go +++ /dev/null @@ -1,251 +0,0 @@ -package secp256k1_test - -import ( - "encoding/base64" - "encoding/hex" - "math/big" - "testing" - - "github.com/btcsuite/btcutil/base58" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/sr25519" - - underlyingSecp256k1 "github.com/btcsuite/btcd/btcec" - - "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1" - cryptotypes "github.com/irisnet/core-sdk-go/common/crypto/types" -) - -type keyData struct { - priv string - pub string - addr string -} - -var secpDataTable = []keyData{ - { - priv: "a96e62ed3955e65be32703f12d87b6b5cf26039ecfa948dc5107a495418e5330", - pub: "02950e1cdfcb133d6024109fd489f734eeb4502418e538c28481f22bce276f248c", - addr: "1CKZ9Nx4zgds8tU7nJHotKSDr4a9bYJCa3", - }, -} - -func TestPubKeySecp256k1Address(t *testing.T) { - for _, d := range secpDataTable { - privB, _ := hex.DecodeString(d.priv) - pubB, _ := hex.DecodeString(d.pub) - addrBbz, _, _ := base58.CheckDecode(d.addr) - addrB := crypto.Address(addrBbz) - - var priv secp256k1.PrivKey = secp256k1.PrivKey{Key: privB} - - pubKey := priv.PubKey() - pubT, _ := pubKey.(*secp256k1.PubKey) - - addr := pubKey.Address() - assert.Equal(t, pubT, &secp256k1.PubKey{Key: pubB}, "Expected pub keys to match") - assert.Equal(t, addr, addrB, "Expected addresses to match") - } -} - -func TestSignAndValidateSecp256k1(t *testing.T) { - privKey := secp256k1.GenPrivKey() - pubKey := privKey.PubKey() - - msg := crypto.CRandBytes(128) - sig, err := privKey.Sign(msg) - require.Nil(t, err) - - assert.True(t, pubKey.VerifySignature(msg, sig)) - - // Mutate the signature, just one bit. - sig[3] ^= byte(0x01) - - assert.False(t, pubKey.VerifySignature(msg, sig)) -} - -// This test is intended to justify the removal of calls to the underlying library -// in creating the privkey. -func TestSecp256k1LoadPrivkeyAndSerializeIsIdentity(t *testing.T) { - numberOfTests := 256 - for i := 0; i < numberOfTests; i++ { - // Seed the test case with some random bytes - privKeyBytes := [32]byte{} - copy(privKeyBytes[:], crypto.CRandBytes(32)) - - // This function creates a private and public key in the underlying libraries format. - // The private key is basically calling new(big.Int).SetBytes(pk), which removes leading zero bytes - priv, _ := underlyingSecp256k1.PrivKeyFromBytes(underlyingSecp256k1.S256(), privKeyBytes[:]) - // this takes the bytes returned by `(big int).Bytes()`, and if the length is less than 32 bytes, - // pads the bytes from the left with zero bytes. Therefore these two functions composed - // result in the identity function on privKeyBytes, hence the following equality check - // always returning true. - serializedBytes := priv.Serialize() - require.Equal(t, privKeyBytes[:], serializedBytes) - } -} - -func TestGenPrivKeyFromSecret(t *testing.T) { - // curve oder N - N := underlyingSecp256k1.S256().N - tests := []struct { - name string - secret []byte - }{ - {"empty secret", []byte{}}, - { - "some long secret", - []byte("We live in a society exquisitely dependent on science and technology, " + - "in which hardly anyone knows anything about science and technology."), - }, - {"another seed used in cosmos tests #1", []byte{0}}, - {"another seed used in cosmos tests #2", []byte("mySecret")}, - {"another seed used in cosmos tests #3", []byte("")}, - } - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - gotPrivKey := secp256k1.GenPrivKeyFromSecret(tt.secret) - require.NotNil(t, gotPrivKey) - // interpret as a big.Int and make sure it is a valid field element: - fe := new(big.Int).SetBytes(gotPrivKey.Key[:]) - require.True(t, fe.Cmp(N) < 0) - require.True(t, fe.Sign() > 0) - }) - } -} - -func TestPubKeyEquals(t *testing.T) { - secp256K1PubKey := secp256k1.GenPrivKey().PubKey().(*secp256k1.PubKey) - - testCases := []struct { - msg string - pubKey cryptotypes.PubKey - other crypto.PubKey - expectEq bool - }{ - { - "different bytes", - secp256K1PubKey, - secp256k1.GenPrivKey().PubKey(), - false, - }, - { - "equals", - secp256K1PubKey, - &secp256k1.PubKey{ - Key: secp256K1PubKey.Key, - }, - true, - }, - { - "different types", - secp256K1PubKey, - sr25519.GenPrivKey().PubKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.pubKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestPrivKeyEquals(t *testing.T) { - secp256K1PrivKey := secp256k1.GenPrivKey() - - testCases := []struct { - msg string - privKey cryptotypes.PrivKey - other crypto.PrivKey - expectEq bool - }{ - { - "different bytes", - secp256K1PrivKey, - secp256k1.GenPrivKey(), - false, - }, - { - "equals", - secp256K1PrivKey, - &secp256k1.PrivKey{ - Key: secp256K1PrivKey.Key, - }, - true, - }, - { - "different types", - secp256K1PrivKey, - sr25519.GenPrivKey(), - false, - }, - } - - for _, tc := range testCases { - t.Run(tc.msg, func(t *testing.T) { - eq := tc.privKey.Equals(tc.other) - require.Equal(t, eq, tc.expectEq) - }) - } -} - -func TestMarshalAmino(t *testing.T) { - aminoCdc := codec.NewLegacyAmino() - privKey := secp256k1.GenPrivKey() - pubKey := privKey.PubKey().(*secp256k1.PubKey) - - testCases := []struct { - desc string - msg codec.AminoMarshaler - typ interface{} - expBinary []byte - expJSON string - }{ - { - "secp256k1 private key", - privKey, - &secp256k1.PrivKey{}, - append([]byte{32}, privKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(privKey.Bytes()) + "\"", - }, - { - "secp256k1 public key", - pubKey, - &secp256k1.PubKey{}, - append([]byte{33}, pubKey.Bytes()...), // Length-prefixed. - "\"" + base64.StdEncoding.EncodeToString(pubKey.Bytes()) + "\"", - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - // Do a round trip of encoding/decoding binary. - bz, err := aminoCdc.MarshalBinaryBare(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expBinary, bz) - - err = aminoCdc.UnmarshalBinaryBare(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - - // Do a round trip of encoding/decoding JSON. - bz, err = aminoCdc.MarshalJSON(tc.msg) - require.NoError(t, err) - require.Equal(t, tc.expJSON, string(bz)) - - err = aminoCdc.UnmarshalJSON(bz, tc.typ) - require.NoError(t, err) - - require.Equal(t, tc.msg, tc.typ) - }) - } -} diff --git a/core-sdk/common/crypto/keys/sm2/gm_sm2.go b/core-sdk/common/crypto/keys/sm2/gm_sm2.go deleted file mode 100644 index cdddec8c..00000000 --- a/core-sdk/common/crypto/keys/sm2/gm_sm2.go +++ /dev/null @@ -1,103 +0,0 @@ -package sm2 - -import ( - "bytes" - "crypto/rand" - "fmt" - "log" - - "github.com/tjfoc/gmsm/sm2" -) - -//Generate key pair -func GenerateKey() *sm2.PrivateKey { - //rand.Reader - privateKey, err := sm2.GenerateKey(rand.Reader) // 生成密钥对 - if err != nil { - log.Fatal(err) - } - return privateKey -} - -//Gets the public key from the private key -func GetPublickey(privateKey *sm2.PrivateKey) *sm2.PublicKey { - return &privateKey.PublicKey -} - -//SM2 public key encryption -func PublicKeyEncrypt(publicKey *sm2.PublicKey, msg []byte) []byte { - ciphertxt, err := publicKey.EncryptAsn1(msg, rand.Reader) //sm2公钥加密 - if err != nil { - log.Fatal(err) - } - //fmt.Printf("加密结果:%x\n", ciphertxt) - return ciphertxt -} - -//SM2 Private key decrypt -func PrivateKeyDecrypt(privateKey *sm2.PrivateKey, ciphertxt []byte) (plaintext []byte) { - plaintext, err := privateKey.DecryptAsn1(ciphertxt) //sm2私钥解密 - if err != nil { - log.Fatal(err) - } - //if !bytes.Equal(msg, plaintext) { - // //log.Fatal("原文不匹配") - //} - return plaintext -} - -//Text matching: compares decrypted information with original text -//msg: original text -//plaintext: Decrypted plaintext -func TextMatch(msg, plaintext []byte) bool { - return bytes.Equal(msg, plaintext) -} - -//PrivateKey Sign -func PrivateKeySign(privateKey *sm2.PrivateKey, msg []byte) ([]byte, error) { - sign, err := privateKey.Sign(rand.Reader, msg, nil) //sm2私钥签名 - if err != nil { - log.Fatal(err) - } - return sign, err -} - -// PublicKey Verify -func PublicKeyVerify(publicKey *sm2.PublicKey, msg, sign []byte) bool { - isok := publicKey.Verify(msg, sign) //sm2公钥验签 - //fmt.Printf("Verified: %v\n", isok) - return isok -} - -func Sm2() { - privateKey, err := sm2.GenerateKey(rand.Reader) // 生成密钥对 - if err != nil { - log.Fatal(err) - } - fmt.Println("privateKey", privateKey) - publicKey := &privateKey.PublicKey //从私钥中获取公钥 - fmt.Println("publicKey ", publicKey) - - msg := []byte("Tongji Fintech Research Institute") - - ciphertxt, err := publicKey.EncryptAsn1(msg, rand.Reader) //sm2公钥加密 - if err != nil { - log.Fatal(err) - } - fmt.Printf("加密结果:%x\n", ciphertxt) - - plaintext, err := privateKey.DecryptAsn1(ciphertxt) //sm2私钥解密 - if err != nil { - log.Fatal(err) - } - if !bytes.Equal(msg, plaintext) { - log.Fatal("原文不匹配") - } - - sign, err := privateKey.Sign(rand.Reader, msg, nil) //sm2私钥签名 - if err != nil { - log.Fatal(err) - } - isok := publicKey.Verify(msg, sign) //sm2公钥验签 - fmt.Printf("Verified: %v\n", isok) -} diff --git a/core-sdk/common/crypto/keys/sm2/gm_sm2_test.go b/core-sdk/common/crypto/keys/sm2/gm_sm2_test.go deleted file mode 100644 index a66276a9..00000000 --- a/core-sdk/common/crypto/keys/sm2/gm_sm2_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package sm2 - -import ( - "fmt" - "testing" -) - -func TestSm2(t *testing.T) { - Sm2() -} - -func TestGenerateKey(t *testing.T) { - priv := GenerateKey() - - fmt.Println(priv.Public()) - fmt.Println(GetPublickey(priv)) -} diff --git a/core-sdk/common/crypto/keys/sm2/keys.pb.go b/core-sdk/common/crypto/keys/sm2/keys.pb.go deleted file mode 100644 index d20317ba..00000000 --- a/core-sdk/common/crypto/keys/sm2/keys.pb.go +++ /dev/null @@ -1,497 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/sm2/keys.proto - -package sm2 - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// PubKey defines a secp256k1 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -type PubKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_5b7c2a655929c3c2, []int{0} -} -func (m *PubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKey.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 *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(m, src) -} -func (m *PubKey) XXX_Size() int { - return m.Size() -} -func (m *PubKey) XXX_DiscardUnknown() { - xxx_messageInfo_PubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKey proto.InternalMessageInfo - -func (m *PubKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -// PrivKey defines a secp256k1 private key. -type PrivKey struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` -} - -func (m *PrivKey) Reset() { *m = PrivKey{} } -func (m *PrivKey) String() string { return proto.CompactTextString(m) } -func (*PrivKey) ProtoMessage() {} -func (*PrivKey) Descriptor() ([]byte, []int) { - return fileDescriptor_5b7c2a655929c3c2, []int{1} -} -func (m *PrivKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PrivKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PrivKey.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 *PrivKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PrivKey.Merge(m, src) -} -func (m *PrivKey) XXX_Size() int { - return m.Size() -} -func (m *PrivKey) XXX_DiscardUnknown() { - xxx_messageInfo_PrivKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PrivKey proto.InternalMessageInfo - -func (m *PrivKey) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func init() { - proto.RegisterType((*PubKey)(nil), "cosmos.crypto.sm2.PubKey") - proto.RegisterType((*PrivKey)(nil), "cosmos.crypto.sm2.PrivKey") -} - -func init() { proto.RegisterFile("cosmos/crypto/sm2/keys.proto", fileDescriptor_5b7c2a655929c3c2) } - -var fileDescriptor_5b7c2a655929c3c2 = []byte{ - // 194 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0xd7, 0x2f, 0xce, 0x35, 0xd2, 0xcf, 0x4e, - 0xad, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x84, 0xc8, 0xea, 0x41, 0x64, 0xf5, - 0x8a, 0x73, 0x8d, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xb2, 0xfa, 0x20, 0x16, 0x44, 0xa1, - 0x92, 0x02, 0x17, 0x5b, 0x40, 0x69, 0x92, 0x77, 0x6a, 0xa5, 0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, - 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4f, 0x10, 0x88, 0x69, 0xc5, 0x32, 0x63, 0x81, 0x3c, 0x83, - 0x92, 0x34, 0x17, 0x7b, 0x40, 0x51, 0x66, 0x19, 0x56, 0x25, 0x4e, 0xde, 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, 0x65, 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, - 0x9f, 0xab, 0x9f, 0x94, 0x99, 0x98, 0x97, 0x95, 0x99, 0x9a, 0x98, 0xa9, 0x9f, 0x59, 0x94, 0x59, - 0x92, 0xa8, 0x5b, 0x9c, 0x92, 0xad, 0x9b, 0x9e, 0x0f, 0x73, 0x3a, 0xc8, 0xd9, 0x20, 0xf7, 0x27, - 0xb1, 0x81, 0x9d, 0x64, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x18, 0xb2, 0xc8, 0x79, 0xdb, 0x00, - 0x00, 0x00, -} - -func (m *PubKey) 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 *PubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PrivKey) 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 *PrivKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PrivKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKeys(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintKeys(dAtA []byte, offset int, v uint64) int { - offset -= sovKeys(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func (m *PrivKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKeys(uint64(l)) - } - return n -} - -func sovKeys(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKeys(x uint64) (n int) { - return sovKeys(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PubKey) 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 ErrIntOverflowKeys - } - 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: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PrivKey) 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 ErrIntOverflowKeys - } - 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: PrivKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PrivKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKeys - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKeys - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKeys - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKeys(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKeys - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKeys(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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrIntOverflowKeys - } - 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, ErrInvalidLengthKeys - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKeys - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKeys - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKeys = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKeys = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKeys = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/common/crypto/keys/sm2/sm2.go b/core-sdk/common/crypto/keys/sm2/sm2.go deleted file mode 100644 index 1a2f6af2..00000000 --- a/core-sdk/common/crypto/keys/sm2/sm2.go +++ /dev/null @@ -1,217 +0,0 @@ -package sm2 - -import ( - "crypto/rand" - "crypto/sha256" - "crypto/subtle" - "fmt" - "io" - "math/big" - - "github.com/pkg/errors" - - "github.com/tjfoc/gmsm/sm2" - - "github.com/tendermint/tendermint/crypto" - tmsm2 "github.com/tendermint/tendermint/crypto/sm2" - "github.com/tendermint/tendermint/crypto/tmhash" -) - -const ( - PrivKeyName = "cosmos/PrivKeySm2" - PubKeyName = "cosmos/PubKeySm2" - - PrivKeySize = 32 - PubKeySize = 33 - SignatureSize = 64 - - keyType = "sm2" -) - -// -------------------------------------------------------- -func (privKey PrivKey) Type() string { - return keyType -} - -// MarshalAmino overrides Amino binary marshalling. -func (privKey PrivKey) MarshalAmino() ([]byte, error) { - return privKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (privKey *PrivKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PrivKeySize { - return fmt.Errorf("invalid privkey size") - } - privKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (privKey PrivKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return privKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (privKey *PrivKey) UnmarshalAminoJSON(bz []byte) error { - return privKey.UnmarshalAmino(bz) -} - -func (privKey PrivKey) Bytes() []byte { - return privKey.Key -} - -func (privKey PrivKey) Sign(msg []byte) ([]byte, error) { - priv := privKey.GetPrivateKey() - r, s, err := sm2.Sm2Sign(priv, msg, nil, rand.Reader) - if err != nil { - return nil, err - } - R := r.Bytes() - S := s.Bytes() - sig := make([]byte, 64) - copy(sig[32-len(R):32], R[:]) - copy(sig[64-len(S):64], S[:]) - - return sig, nil -} - -func (privKey PrivKey) PubKey() crypto.PubKey { - priv := privKey.GetPrivateKey() - compPubkey := sm2.Compress(&priv.PublicKey) - - pubkeyBytes := make([]byte, PubKeySize) - copy(pubkeyBytes, compPubkey) - - return &PubKey{Key: pubkeyBytes} -} - -func (privKey PrivKey) Equals(other crypto.PrivKey) bool { - if privKey.Type() != other.Type() { - return false - } - - return subtle.ConstantTimeCompare(privKey.Bytes(), other.Bytes()) == 1 -} - -func (privKey PrivKey) GetPrivateKey() *sm2.PrivateKey { - k := new(big.Int).SetBytes(privKey.Key[:32]) - c := sm2.P256Sm2() - priv := new(sm2.PrivateKey) - priv.PublicKey.Curve = c - priv.D = k - priv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k.Bytes()) - - return priv -} - -func GenPrivKey() PrivKey { - return genPrivKey(crypto.CReader()) -} - -func genPrivKey(rand io.Reader) PrivKey { - seed := make([]byte, 32) - if _, err := io.ReadFull(rand, seed); err != nil { - panic(err) - } - - privKey, err := sm2.GenerateKey(rand) - if err != nil { - panic(err) - } - - privKeyBytes := make([]byte, PrivKeySize) - copy(privKeyBytes, privKey.D.Bytes()) - - return PrivKey{Key: privKeyBytes} -} - -func GenPrivKeyFromSecret(secret []byte) PrivKey { - one := new(big.Int).SetInt64(1) - secHash := sha256.Sum256(secret) - - k := new(big.Int).SetBytes(secHash[:]) - n := new(big.Int).Sub(sm2.P256Sm2().Params().N, one) - k.Mod(k, n) - k.Add(k, one) - - return PrivKey{Key: k.Bytes()} -} - -// -------------------------------------------------------- - -func (pubKey PubKey) Address() crypto.Address { - if len(pubKey.Key) != PubKeySize { - panic("pubkey is incorrect size") - } - return crypto.Address(tmhash.SumTruncated(pubKey.Key)) -} - -func (pubKey PubKey) Bytes() []byte { - return pubKey.Key -} - -func (pubKey *PubKey) VerifySignature(msg []byte, sig []byte) bool { - if len(sig) != SignatureSize { - return false - } - - publicKey := sm2.Decompress(pubKey.Key) - r := new(big.Int).SetBytes(sig[:32]) - s := new(big.Int).SetBytes(sig[32:]) - - return sm2.Sm2Verify(publicKey, msg, nil, r, s) -} - -func (pubKey PubKey) String() string { - return fmt.Sprintf("PubKeySm2{%X}", pubKey.Key) -} - -func (pubKey *PubKey) Type() string { - return keyType -} - -func (pubKey PubKey) Equals(other crypto.PubKey) bool { - if pubKey.Type() != other.Type() { - return false - } - - return subtle.ConstantTimeCompare(pubKey.Bytes(), other.Bytes()) == 1 -} - -// MarshalAmino overrides Amino binary marshalling. -func (pubKey PubKey) MarshalAmino() ([]byte, error) { - return pubKey.Key, nil -} - -// UnmarshalAmino overrides Amino binary marshalling. -func (pubKey *PubKey) UnmarshalAmino(bz []byte) error { - if len(bz) != PubKeySize { - return errors.New("invalid pubkey size") - } - pubKey.Key = bz - - return nil -} - -// MarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey PubKey) MarshalAminoJSON() ([]byte, error) { - // When we marshal to Amino JSON, we don't marshal the "key" field itself, - // just its contents (i.e. the key bytes). - return pubKey.MarshalAmino() -} - -// UnmarshalAminoJSON overrides Amino JSON marshalling. -func (pubKey *PubKey) UnmarshalAminoJSON(bz []byte) error { - return pubKey.UnmarshalAmino(bz) -} - -// AsTmPubKey converts our own PubKey into a Tendermint ED25519 pubkey. -func (pubKey *PubKey) AsTmPubKey() crypto.PubKey { - var pubkey tmsm2.PubKeySm2 - copy(pubkey[:], pubKey.Key) - return pubkey -} diff --git a/core-sdk/common/crypto/types/compact_bit_array.go b/core-sdk/common/crypto/types/compact_bit_array.go deleted file mode 100644 index 7c7188f6..00000000 --- a/core-sdk/common/crypto/types/compact_bit_array.go +++ /dev/null @@ -1,248 +0,0 @@ -package types - -import ( - "bytes" - "encoding/binary" - "errors" - "fmt" - "regexp" - "strings" -) - -// CompactBitArray is an implementation of a space efficient bit array. -// This is used to ensure that the encoded data takes up a minimal amount of -// space after amino encoding. -// This is not thread safe, and is not intended for concurrent usage. - -// NewCompactBitArray returns a new compact bit array. -// It returns nil if the number of bits is zero. -func NewCompactBitArray(bits int) *CompactBitArray { - if bits <= 0 { - return nil - } - return &CompactBitArray{ - ExtraBitsStored: uint32(bits % 8), - Elems: make([]byte, (bits+7)/8), - } -} - -// Count returns the number of bits in the bitarray -func (bA *CompactBitArray) Count() int { - if bA == nil { - return 0 - } else if bA.ExtraBitsStored == uint32(0) { - return len(bA.Elems) * 8 - } - - return (len(bA.Elems)-1)*8 + int(bA.ExtraBitsStored) -} - -// GetIndex returns the bit at index i within the bit array. -// The behavior is undefined if i >= bA.Count() -func (bA *CompactBitArray) GetIndex(i int) bool { - if bA == nil { - return false - } - if i >= bA.Count() { - return false - } - - return bA.Elems[i>>3]&(uint8(1)< 0 -} - -// SetIndex sets the bit at index i within the bit array. -// The behavior is undefined if i >= bA.Count() -func (bA *CompactBitArray) SetIndex(i int, v bool) bool { - if bA == nil { - return false - } - - if i >= bA.Count() { - return false - } - - if v { - bA.Elems[i>>3] |= (uint8(1) << uint8(7-(i%8))) - } else { - bA.Elems[i>>3] &= ^(uint8(1) << uint8(7-(i%8))) - } - - return true -} - -// NumTrueBitsBefore returns the number of bits set to true before the -// given index. e.g. if bA = _XX__XX, NumOfTrueBitsBefore(4) = 2, since -// there are two bits set to true before index 4. -func (bA *CompactBitArray) NumTrueBitsBefore(index int) int { - numTrueValues := 0 - for i := 0; i < index; i++ { - if bA.GetIndex(i) { - numTrueValues++ - } - } - - return numTrueValues -} - -// Copy returns a copy of the provided bit array. -func (bA *CompactBitArray) Copy() *CompactBitArray { - if bA == nil { - return nil - } - - c := make([]byte, len(bA.Elems)) - copy(c, bA.Elems) - - return &CompactBitArray{ - ExtraBitsStored: bA.ExtraBitsStored, - Elems: c, - } -} - -// String returns a string representation of CompactBitArray: BA{}, -// where is a sequence of 'x' (1) and '_' (0). -// The includes spaces and newlines to help people. -// For a simple sequence of 'x' and '_' characters with no spaces or newlines, -// see the MarshalJSON() method. -// Example: "BA{_x_}" or "nil-BitArray" for nil. -func (bA *CompactBitArray) String() string { return bA.StringIndented("") } - -// StringIndented returns the same thing as String(), but applies the indent -// at every 10th bit, and twice at every 50th bit. -func (bA *CompactBitArray) StringIndented(indent string) string { - if bA == nil { - return "nil-BitArray" - } - lines := []string{} - bits := "" - size := bA.Count() - for i := 0; i < size; i++ { - if bA.GetIndex(i) { - bits += "x" - } else { - bits += "_" - } - - if i%100 == 99 { - lines = append(lines, bits) - bits = "" - } - - if i%10 == 9 { - bits += indent - } - - if i%50 == 49 { - bits += indent - } - } - - if len(bits) > 0 { - lines = append(lines, bits) - } - - return fmt.Sprintf("BA{%v:%v}", size, strings.Join(lines, indent)) -} - -// MarshalJSON implements json.Marshaler interface by marshaling bit array -// using a custom format: a string of '-' or 'x' where 'x' denotes the 1 bit. -func (bA *CompactBitArray) MarshalJSON() ([]byte, error) { - if bA == nil { - return []byte("null"), nil - } - - bits := `"` - size := bA.Count() - for i := 0; i < size; i++ { - if bA.GetIndex(i) { - bits += `x` - } else { - bits += `_` - } - } - - bits += `"` - - return []byte(bits), nil -} - -var bitArrayJSONRegexp = regexp.MustCompile(`\A"([_x]*)"\z`) - -// UnmarshalJSON implements json.Unmarshaler interface by unmarshaling a custom -// JSON description. -func (bA *CompactBitArray) UnmarshalJSON(bz []byte) error { - b := string(bz) - if b == "null" { - // This is required e.g. for encoding/json when decoding - // into a pointer with pre-allocated BitArray. - bA.ExtraBitsStored = 0 - bA.Elems = nil - - return nil - } - - match := bitArrayJSONRegexp.FindStringSubmatch(b) - if match == nil { - return fmt.Errorf("bitArray in JSON should be a string of format %q but got %s", bitArrayJSONRegexp.String(), b) - } - - bits := match[1] - - // Construct new CompactBitArray and copy over. - numBits := len(bits) - bA2 := NewCompactBitArray(numBits) - for i := 0; i < numBits; i++ { - if bits[i] == 'x' { - bA2.SetIndex(i, true) - } - } - *bA = *bA2 - - return nil -} - -// CompactMarshal is a space efficient encoding for CompactBitArray. -// It is not amino compatible. -func (bA *CompactBitArray) CompactMarshal() []byte { - size := bA.Count() - if size <= 0 { - return []byte("null") - } - - bz := make([]byte, 0, size/8) - // length prefix number of bits, not number of bytes. This difference - // takes 3-4 bits in encoding, as opposed to instead encoding the number of - // bytes (saving 3-4 bits) and including the offset as a full byte. - bz = appendUvarint(bz, uint64(size)) - bz = append(bz, bA.Elems...) - - return bz -} - -// CompactUnmarshal is a space efficient decoding for CompactBitArray. -// It is not amino compatible. -func CompactUnmarshal(bz []byte) (*CompactBitArray, error) { - if len(bz) < 2 { - return nil, errors.New("compact bit array: invalid compact unmarshal size") - } else if bytes.Equal(bz, []byte("null")) { - return NewCompactBitArray(0), nil - } - - size, n := binary.Uvarint(bz) - bz = bz[n:] - - if len(bz) != int(size+7)/8 { - return nil, errors.New("compact bit array: invalid compact unmarshal size") - } - - bA := &CompactBitArray{uint32(size % 8), bz} - - return bA, nil -} - -func appendUvarint(b []byte, x uint64) []byte { - var a [binary.MaxVarintLen64]byte - n := binary.PutUvarint(a[:], x) - - return append(b, a[:n]...) -} diff --git a/core-sdk/common/crypto/types/multisig.pb.go b/core-sdk/common/crypto/types/multisig.pb.go deleted file mode 100644 index 5d6a5397..00000000 --- a/core-sdk/common/crypto/types/multisig.pb.go +++ /dev/null @@ -1,551 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/crypto/multisig/v1beta1/multisig.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. -// See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers -// signed and with which modes. -type MultiSignature struct { - Signatures [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *MultiSignature) Reset() { *m = MultiSignature{} } -func (m *MultiSignature) String() string { return proto.CompactTextString(m) } -func (*MultiSignature) ProtoMessage() {} -func (*MultiSignature) Descriptor() ([]byte, []int) { - return fileDescriptor_1177bdf7025769be, []int{0} -} -func (m *MultiSignature) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MultiSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MultiSignature.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 *MultiSignature) XXX_Merge(src proto.Message) { - xxx_messageInfo_MultiSignature.Merge(m, src) -} -func (m *MultiSignature) XXX_Size() int { - return m.Size() -} -func (m *MultiSignature) XXX_DiscardUnknown() { - xxx_messageInfo_MultiSignature.DiscardUnknown(m) -} - -var xxx_messageInfo_MultiSignature proto.InternalMessageInfo - -func (m *MultiSignature) GetSignatures() [][]byte { - if m != nil { - return m.Signatures - } - return nil -} - -// CompactBitArray is an implementation of a space efficient bit array. -// This is used to ensure that the encoded data takes up a minimal amount of -// space after proto encoding. -// This is not thread safe, and is not intended for concurrent usage. -type CompactBitArray struct { - ExtraBitsStored uint32 `protobuf:"varint,1,opt,name=extra_bits_stored,json=extraBitsStored,proto3" json:"extra_bits_stored,omitempty"` - Elems []byte `protobuf:"bytes,2,opt,name=elems,proto3" json:"elems,omitempty"` -} - -func (m *CompactBitArray) Reset() { *m = CompactBitArray{} } -func (*CompactBitArray) ProtoMessage() {} -func (*CompactBitArray) Descriptor() ([]byte, []int) { - return fileDescriptor_1177bdf7025769be, []int{1} -} -func (m *CompactBitArray) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompactBitArray) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompactBitArray.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 *CompactBitArray) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompactBitArray.Merge(m, src) -} -func (m *CompactBitArray) XXX_Size() int { - return m.Size() -} -func (m *CompactBitArray) XXX_DiscardUnknown() { - xxx_messageInfo_CompactBitArray.DiscardUnknown(m) -} - -var xxx_messageInfo_CompactBitArray proto.InternalMessageInfo - -func (m *CompactBitArray) GetExtraBitsStored() uint32 { - if m != nil { - return m.ExtraBitsStored - } - return 0 -} - -func (m *CompactBitArray) GetElems() []byte { - if m != nil { - return m.Elems - } - return nil -} - -func init() { - proto.RegisterType((*MultiSignature)(nil), "cosmos.crypto.multisig.v1beta1.MultiSignature") - proto.RegisterType((*CompactBitArray)(nil), "cosmos.crypto.multisig.v1beta1.CompactBitArray") -} - -func init() { - proto.RegisterFile("cosmos/crypto/multisig/v1beta1/multisig.proto", fileDescriptor_1177bdf7025769be) -} - -var fileDescriptor_1177bdf7025769be = []byte{ - // 277 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x31, 0x4f, 0x83, 0x40, - 0x14, 0xc7, 0x39, 0xad, 0x0e, 0x97, 0x6a, 0x23, 0xe9, 0x40, 0x1c, 0xae, 0xa4, 0x13, 0x31, 0x01, - 0xd2, 0x98, 0x38, 0x74, 0x13, 0x17, 0x17, 0x17, 0x3a, 0xe9, 0xd2, 0x00, 0xbd, 0x5c, 0x2f, 0x96, - 0x3e, 0x72, 0xef, 0x61, 0xe4, 0x5b, 0x38, 0x3a, 0xea, 0xb7, 0x71, 0x64, 0x74, 0x34, 0xf0, 0x45, - 0x4c, 0xc1, 0x36, 0x4e, 0x77, 0xff, 0xdf, 0xff, 0xf7, 0x86, 0xf7, 0xb8, 0x9f, 0x01, 0xe6, 0x80, - 0x61, 0x66, 0xaa, 0x82, 0x20, 0xcc, 0xcb, 0x0d, 0x69, 0xd4, 0x2a, 0x7c, 0x99, 0xa5, 0x92, 0x92, - 0xd9, 0x01, 0x04, 0x85, 0x01, 0x02, 0x5b, 0xf4, 0x7a, 0xd0, 0xeb, 0xc1, 0xa1, 0xfd, 0xd3, 0x2f, - 0xc7, 0x0a, 0x14, 0x74, 0x6a, 0xb8, 0xfb, 0xf5, 0x53, 0xd3, 0x1b, 0x7e, 0xfe, 0xb0, 0x33, 0x17, - 0x5a, 0x6d, 0x13, 0x2a, 0x8d, 0xb4, 0x05, 0xe7, 0xb8, 0x0f, 0xe8, 0x30, 0xf7, 0xd8, 0x1b, 0xc6, - 0xff, 0xc8, 0x7c, 0x50, 0x7f, 0x4e, 0xd8, 0xf4, 0x91, 0x8f, 0xee, 0x20, 0x2f, 0x92, 0x8c, 0x22, - 0x4d, 0xb7, 0xc6, 0x24, 0x95, 0x7d, 0xc5, 0x2f, 0xe4, 0x2b, 0x99, 0x64, 0x99, 0x6a, 0xc2, 0x25, - 0x12, 0x18, 0xb9, 0x72, 0x98, 0xcb, 0xbc, 0xb3, 0x78, 0xd4, 0x15, 0x91, 0x26, 0x5c, 0x74, 0xd8, - 0x1e, 0xf3, 0x13, 0xb9, 0x91, 0x39, 0x3a, 0x47, 0x2e, 0xf3, 0x86, 0x71, 0x1f, 0xe6, 0x83, 0xf7, - 0x8f, 0x89, 0x15, 0xdd, 0x7f, 0x35, 0x82, 0xd5, 0x8d, 0x60, 0x3f, 0x8d, 0x60, 0x6f, 0xad, 0xb0, - 0xea, 0x56, 0x58, 0xdf, 0xad, 0xb0, 0x9e, 0x02, 0xa5, 0x69, 0x5d, 0xa6, 0x41, 0x06, 0x79, 0xa8, - 0x8d, 0xc6, 0xad, 0xa4, 0xee, 0x5d, 0x97, 0xa9, 0x8f, 0xab, 0x67, 0x5f, 0xc1, 0xfe, 0x58, 0x54, - 0x15, 0x12, 0xd3, 0xd3, 0x6e, 0xc7, 0xeb, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xa4, 0xef, - 0x9a, 0x4a, 0x01, 0x00, 0x00, -} - -func (m *MultiSignature) 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 *MultiSignature) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MultiSignature) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Signatures[iNdEx]) - copy(dAtA[i:], m.Signatures[iNdEx]) - i = encodeVarintMultisig(dAtA, i, uint64(len(m.Signatures[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *CompactBitArray) 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 *CompactBitArray) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompactBitArray) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Elems) > 0 { - i -= len(m.Elems) - copy(dAtA[i:], m.Elems) - i = encodeVarintMultisig(dAtA, i, uint64(len(m.Elems))) - i-- - dAtA[i] = 0x12 - } - if m.ExtraBitsStored != 0 { - i = encodeVarintMultisig(dAtA, i, uint64(m.ExtraBitsStored)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintMultisig(dAtA []byte, offset int, v uint64) int { - offset -= sovMultisig(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MultiSignature) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - l = len(b) - n += 1 + l + sovMultisig(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CompactBitArray) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ExtraBitsStored != 0 { - n += 1 + sovMultisig(uint64(m.ExtraBitsStored)) - } - l = len(m.Elems) - if l > 0 { - n += 1 + l + sovMultisig(uint64(l)) - } - return n -} - -func sovMultisig(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMultisig(x uint64) (n int) { - return sovMultisig(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MultiSignature) 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 ErrIntOverflowMultisig - } - 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: MultiSignature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MultiSignature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMultisig - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMultisig - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMultisig - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, make([]byte, postIndex-iNdEx)) - copy(m.Signatures[len(m.Signatures)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMultisig(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMultisig - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompactBitArray) 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 ErrIntOverflowMultisig - } - 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: CompactBitArray: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompactBitArray: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtraBitsStored", wireType) - } - m.ExtraBitsStored = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMultisig - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExtraBitsStored |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Elems", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMultisig - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMultisig - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMultisig - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Elems = append(m.Elems[:0], dAtA[iNdEx:postIndex]...) - if m.Elems == nil { - m.Elems = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMultisig(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMultisig - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMultisig(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, ErrIntOverflowMultisig - } - 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, ErrIntOverflowMultisig - } - 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, ErrIntOverflowMultisig - } - 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, ErrInvalidLengthMultisig - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMultisig - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMultisig - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMultisig = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMultisig = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMultisig = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/common/crypto/types/multisig/multisignature.go b/core-sdk/common/crypto/types/multisig/multisignature.go deleted file mode 100644 index 5470165e..00000000 --- a/core-sdk/common/crypto/types/multisig/multisignature.go +++ /dev/null @@ -1,90 +0,0 @@ -package multisig - -import ( - "fmt" - "strings" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/common/crypto/types" - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// AminoMultisignature is used to represent amino multi-signatures for StdTx's. -// It is assumed that all signatures were made with SIGN_MODE_LEGACY_AMINO_JSON. -// Sigs is a list of signatures, sorted by corresponding index. -type AminoMultisignature struct { - BitArray *types.CompactBitArray - Sigs [][]byte -} - -// NewMultisig returns a new MultiSignatureData -func NewMultisig(n int) *signing.MultiSignatureData { - return &signing.MultiSignatureData{ - BitArray: types.NewCompactBitArray(n), - Signatures: make([]signing.SignatureData, 0, n), - } -} - -// GetIndex returns the index of pk in keys. Returns -1 if not found -func getIndex(pk crypto.PubKey, keys []crypto.PubKey) int { - for i := 0; i < len(keys); i++ { - if pk.Equals(keys[i]) { - return i - } - } - return -1 -} - -// AddSignature adds a signature to the multisig, at the corresponding index. -// If the signature already exists, replace it. -func AddSignature(mSig *signing.MultiSignatureData, sig signing.SignatureData, index int) { - newSigIndex := mSig.BitArray.NumTrueBitsBefore(index) - // Signature already exists, just replace the value there - if mSig.BitArray.GetIndex(index) { - mSig.Signatures[newSigIndex] = sig - return - } - mSig.BitArray.SetIndex(index, true) - // Optimization if the index is the greatest index - if newSigIndex == len(mSig.Signatures) { - mSig.Signatures = append(mSig.Signatures, sig) - return - } - // Expand slice by one with a dummy element, move all elements after i - // over by one, then place the new signature in that gap. - mSig.Signatures = append(mSig.Signatures, &signing.SingleSignatureData{}) - copy(mSig.Signatures[newSigIndex+1:], mSig.Signatures[newSigIndex:]) - mSig.Signatures[newSigIndex] = sig -} - -// AddSignatureFromPubKey adds a signature to the multisig, at the index in -// keys corresponding to the provided pubkey. -func AddSignatureFromPubKey(mSig *signing.MultiSignatureData, sig signing.SignatureData, pubkey crypto.PubKey, keys []crypto.PubKey) error { - if mSig == nil { - return fmt.Errorf("value of mSig is nil %v", mSig) - } - if sig == nil { - return fmt.Errorf("value of sig is nil %v", sig) - } - - if pubkey == nil || keys == nil { - return fmt.Errorf("pubkey or keys can't be nil %v %v", pubkey, keys) - } - index := getIndex(pubkey, keys) - if index == -1 { - keysStr := make([]string, len(keys)) - for i, k := range keys { - keysStr[i] = fmt.Sprintf("%X", k.Bytes()) - } - - return fmt.Errorf("provided key %X doesn't exist in pubkeys: \n%s", pubkey.Bytes(), strings.Join(keysStr, "\n")) - } - - AddSignature(mSig, sig, index) - return nil -} - -func AddSignatureV2(mSig *signing.MultiSignatureData, sig signing.SignatureV2, keys []crypto.PubKey) error { - return AddSignatureFromPubKey(mSig, sig.Data, sig.PubKey, keys) -} diff --git a/core-sdk/common/crypto/types/multisig/pubkey.go b/core-sdk/common/crypto/types/multisig/pubkey.go deleted file mode 100644 index 3ee96c0a..00000000 --- a/core-sdk/common/crypto/types/multisig/pubkey.go +++ /dev/null @@ -1,28 +0,0 @@ -package multisig - -import ( - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// PubKey defines a type which supports multi-signature verification via MultiSignatureData -// which supports multiple SignMode's. -type PubKey interface { - crypto.PubKey - - // VerifyMultisignature verifies the provide multi-signature represented by MultiSignatureData - // using getSignBytes to retrieve the sign bytes to verify against for the provided mode. - VerifyMultisignature(getSignBytes GetSignBytesFunc, sig *signing.MultiSignatureData) error - - // GetPubKeys returns the crypto.PubKey's nested within the multi-sig PubKey - GetPubKeys() []crypto.PubKey - - // GetThreshold returns the threshold number of signatures that must be obtained to verify a signature. - GetThreshold() uint -} - -// GetSignBytesFunc defines a function type which returns sign bytes for a given SignMode or an error. -// It will generally be implemented as a closure which wraps whatever signable object signatures are -// being verified against. -type GetSignBytesFunc func(mode signing.SignMode) ([]byte, error) diff --git a/core-sdk/common/crypto/types/types.go b/core-sdk/common/crypto/types/types.go deleted file mode 100644 index bce35d71..00000000 --- a/core-sdk/common/crypto/types/types.go +++ /dev/null @@ -1,30 +0,0 @@ -package types - -import ( - proto "github.com/gogo/protobuf/proto" - tmcrypto "github.com/tendermint/tendermint/crypto" -) - -// PubKey interface extends proto.Message -// and tendermint crypto.PubKey -type PubKey interface { - proto.Message - tmcrypto.PubKey -} - -// PrivKey interface extends proto.Message -// and tendermint crypto.PrivKey -type PrivKey interface { - proto.Message - tmcrypto.PrivKey -} - -type ( - Address = tmcrypto.Address -) - -// IntoTmPubKey allows our own PubKey types be converted into Tendermint's -// pubkey types. -type IntoTmPubKey interface { - AsTmPubKey() tmcrypto.PubKey -} diff --git a/core-sdk/common/log/logger.go b/core-sdk/common/log/logger.go deleted file mode 100644 index ddfcb358..00000000 --- a/core-sdk/common/log/logger.go +++ /dev/null @@ -1,113 +0,0 @@ -package log - -import ( - "io" - "os" - "strings" - - "github.com/sirupsen/logrus" - "github.com/tendermint/tendermint/libs/log" -) - -var ( - _ log.Logger = LogrusLogger{} - _ log.Logger = entry{} -) - -type LogrusLogger struct { - logger *logrus.Logger -} - -func NewDefaultLogger() LogrusLogger { - logger := logrus.New() - - logger.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) - logger.SetOutput(os.Stdout) - logger.SetLevel(logrus.InfoLevel) - return LogrusLogger{ - logger: logger, - } -} - -func NewLogger(cfg Config) LogrusLogger { - logger := logrus.New() - - switch cfg.Format { - case FormatText: - logger.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) - case FormatJSON: - logger.SetFormatter(&logrus.JSONFormatter{}) - } - - switch strings.ToLower(cfg.Level) { - case DebugLevel: - logger.SetLevel(logrus.DebugLevel) - case InfoLevel: - logger.SetLevel(logrus.InfoLevel) - case WarnLevel: - logger.SetLevel(logrus.WarnLevel) - case ErrorLevel: - logger.SetLevel(logrus.ErrorLevel) - } - - logger.SetOutput(os.Stdout) - return LogrusLogger{ - logger: logger, - } -} - -func (l *LogrusLogger) SetOutput(output io.Writer) { - l.logger.SetOutput(os.Stdout) -} - -func (l LogrusLogger) Debug(msg string, keyvals ...interface{}) { - l.logger.WithFields(argsToFields(keyvals...)).Debug(msg) -} - -func (l LogrusLogger) Info(msg string, keyvals ...interface{}) { - l.logger.WithFields(argsToFields(keyvals...)).Info(msg) -} - -func (l LogrusLogger) Error(msg string, keyvals ...interface{}) { - l.logger.WithFields(argsToFields(keyvals...)).Error(msg) -} - -func (l LogrusLogger) With(keyvals ...interface{}) log.Logger { - return entry{ - l.logger.WithFields(argsToFields(keyvals...)), - } -} - -type entry struct { - *logrus.Entry -} - -func (e entry) Debug(msg string, keyvals ...interface{}) { - e.Entry.WithFields(argsToFields(keyvals...)).Debug(msg) -} - -func (e entry) Info(msg string, keyvals ...interface{}) { - e.Entry.WithFields(argsToFields(keyvals...)).Info(msg) -} - -func (e entry) Error(msg string, keyvals ...interface{}) { - e.Entry.WithFields(argsToFields(keyvals...)).Error(msg) -} - -func (e entry) With(keyvals ...interface{}) log.Logger { - return entry{ - e.WithFields(argsToFields(keyvals...)), - } -} - -func argsToFields(keyvals ...interface{}) logrus.Fields { - var fields = make(logrus.Fields) - if len(keyvals)%2 != 0 { - return fields - } - - for i := 0; i < len(keyvals); i += 2 { - fields[keyvals[i].(string)] = keyvals[i+1] - } - return fields -} diff --git a/core-sdk/common/log/logger_test.go b/core-sdk/common/log/logger_test.go deleted file mode 100644 index c5e08bf5..00000000 --- a/core-sdk/common/log/logger_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package log - -import ( - "testing" -) - -func TestNewLogger(t *testing.T) { - log1 := NewLogger(Config{ - Format: "json", - Level: "info", - }) - - log1.Info("Hello World", "foo", "bar") - log1.Info("Hello World", "foo1", "bar") - log1.Info("Hello World", "foo2", "bar") - log1.Info("Hello World", "foo3", "bar") -} - -func TestNewLoggerInfo(t *testing.T) { - - logger := NewLogger(Config{ - Format: FormatText, - Level: InfoLevel, - }) - logger.Info("Hello World", "foo", "bar") -} - -func TestInitLogrus(t *testing.T) { - //InitLogrus("./","test_log",30,24) -} diff --git a/core-sdk/common/log/type.go b/core-sdk/common/log/type.go deleted file mode 100644 index f4f52f57..00000000 --- a/core-sdk/common/log/type.go +++ /dev/null @@ -1,16 +0,0 @@ -package log - -const ( - DebugLevel = "debug" - InfoLevel = "info" - WarnLevel = "warn" - ErrorLevel = "error" - - FormatText = "text" - FormatJSON = "json" -) - -type Config struct { - Format string `json:"format" yaml:"format" ` - Level string `json:"level" yaml:"level"` -} diff --git a/core-sdk/common/uuid/codec.go b/core-sdk/common/uuid/codec.go deleted file mode 100644 index d7ddf2de..00000000 --- a/core-sdk/common/uuid/codec.go +++ /dev/null @@ -1,186 +0,0 @@ -// reference: https://github.com/binance-chain/go-sdk/blob/master/common/uuid/codec.go -package uuid - -import ( - "bytes" - "encoding/hex" - "fmt" -) - -// FromBytes returns UUID converted from raw byte slice input. -// It will return error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (u UUID, err error) { - err = u.UnmarshalBinary(input) - return -} - -// FromBytesOrNil returns UUID converted from raw byte slice input. -// Same behavior as FromBytes, but returns a Nil UUID on error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -// FromString returns UUID parsed from string input. -// Input is expected in a form accepted by UnmarshalText. -func FromString(input string) (u UUID, err error) { - err = u.UnmarshalText([]byte(input)) - return -} - -// FromStringOrNil returns UUID parsed from string input. -// Same behavior as FromString, but returns a Nil UUID on error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. -func (u UUID) MarshalText() (text []byte, err error) { - text = []byte(u.String()) - return -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -// "6ba7b8109dad11d180b400c04fd430c8" -// ABNF for supported UUID text representation follows: -// uuid := canonical | hashlike | braced | urn -// plain := canonical | hashlike -// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct -// hashlike := 12hexoct -// braced := '{' plain '}' -// urn := URN ':' UUID-NID ':' plain -// URN := 'urn' -// UUID-NID := 'uuid' -// 12hexoct := 6hexoct 6hexoct -// 6hexoct := 4hexoct 2hexoct -// 4hexoct := 2hexoct 2hexoct -// 2hexoct := hexoct hexoct -// hexoct := hexdig hexdig -// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | -// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | -// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' -func (u *UUID) UnmarshalText(text []byte) (err error) { - switch len(text) { - case 32: - return u.decodeHashLike(text) - case 36: - return u.decodeCanonical(text) - case 38: - return u.decodeBraced(text) - case 41: - fallthrough - case 45: - return u.decodeURN(text) - default: - return fmt.Errorf("uuid: incorrect UUID length: %s", text) - } -} - -// decodeCanonical decodes UUID string in format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8". -func (u *UUID) decodeCanonical(t []byte) (err error) { - if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - src := t[:] - dst := u[:] - - for i, byteGroup := range byteGroups { - if i > 0 { - src = src[1:] // skip dash - } - _, err = hex.Decode(dst[:byteGroup/2], src[:byteGroup]) - if err != nil { - return - } - src = src[byteGroup:] - dst = dst[byteGroup/2:] - } - - return -} - -// decodeHashLike decodes UUID string in format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeHashLike(t []byte) (err error) { - src := t[:] - dst := u[:] - - if _, err = hex.Decode(dst, src); err != nil { - return err - } - return -} - -// decodeBraced decodes UUID string in format -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" or in format -// "{6ba7b8109dad11d180b400c04fd430c8}". -func (u *UUID) decodeBraced(t []byte) (err error) { - l := len(t) - - if t[0] != '{' || t[l-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - return u.decodePlain(t[1 : l-1]) -} - -// decodeURN decodes UUID string in format -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in format -// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeURN(t []byte) (err error) { - total := len(t) - - urn_uuid_prefix := t[:9] - - if !bytes.Equal(urn_uuid_prefix, urnPrefix) { - return fmt.Errorf("uuid: incorrect UUID format: %s", t) - } - - return u.decodePlain(t[9:total]) -} - -// decodePlain decodes UUID string in canonical format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodePlain(t []byte) (err error) { - switch len(t) { - case 32: - return u.decodeHashLike(t) - case 36: - return u.decodeCanonical(t) - default: - return fmt.Errorf("uuid: incorrrect UUID length: %s", t) - } -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() (data []byte, err error) { - data = u.Bytes() - return -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) (err error) { - if len(data) != Size { - err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - return - } - copy(u[:], data) - - return -} diff --git a/core-sdk/common/uuid/generator.go b/core-sdk/common/uuid/generator.go deleted file mode 100644 index 43c1f833..00000000 --- a/core-sdk/common/uuid/generator.go +++ /dev/null @@ -1,245 +0,0 @@ -// reference: https://github.com/binance-chain/go-sdk/blob/master/common/uuid/generator.go -package uuid - -import ( - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "encoding/binary" - "fmt" - "hash" - "io" - "net" - "os" - "sync" - "time" -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -type epochFunc func() time.Time -type hwAddrFunc func() (net.HardwareAddr, error) - -var ( - global = newRFC4122Generator() - - posixUID = uint32(os.Getuid()) - posixGID = uint32(os.Getgid()) -) - -// NewV1 returns UUID based on current timestamp and MAC address. -func NewV1() (UUID, error) { - return global.NewV1() -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func NewV2(domain byte) (UUID, error) { - return global.NewV2(domain) -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - return global.NewV3(ns, name) -} - -// NewV4 returns random generated UUID. -func NewV4() (UUID, error) { - return global.NewV4() -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - return global.NewV5(ns, name) -} - -// Generator provides interface for generating UUIDs. -type Generator interface { - NewV1() (UUID, error) - NewV2(domain byte) (UUID, error) - NewV3(ns UUID, name string) UUID - NewV4() (UUID, error) - NewV5(ns UUID, name string) UUID -} - -// Default generator implementation. -type rfc4122Generator struct { - clockSequenceOnce sync.Once - hardwareAddrOnce sync.Once - storageMutex sync.Mutex - - rand io.Reader - - epochFunc epochFunc - hwAddrFunc hwAddrFunc - lastTime uint64 - clockSequence uint16 - hardwareAddr [6]byte -} - -func newRFC4122Generator() Generator { - return &rfc4122Generator{ - epochFunc: time.Now, - hwAddrFunc: defaultHWAddrFunc, - rand: rand.Reader, - } -} - -// NewV1 returns UUID based on current timestamp and MAC address. -func (g *rfc4122Generator) NewV1() (UUID, error) { - u := UUID{} - - timeNow, clockSeq, err := g.getClockSequence() - if err != nil { - return Nil, err - } - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - hardwareAddr, err := g.getHardwareAddr() - if err != nil { - return Nil, err - } - copy(u[10:], hardwareAddr) - - u.SetVersion(V1) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func (g *rfc4122Generator) NewV2(domain byte) (UUID, error) { - u, err := g.NewV1() - if err != nil { - return Nil, err - } - - switch domain { - case DomainPerson: - binary.BigEndian.PutUint32(u[:], posixUID) - case DomainGroup: - binary.BigEndian.PutUint32(u[:], posixGID) - } - - u[9] = domain - - u.SetVersion(V2) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func (g *rfc4122Generator) NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(V3) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV4 returns random generated UUID. -func (g *rfc4122Generator) NewV4() (UUID, error) { - u := UUID{} - if _, err := io.ReadFull(g.rand, u[:]); err != nil { - return Nil, err - } - u.SetVersion(V4) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func (g *rfc4122Generator) NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(V5) - u.SetVariant(VariantRFC4122) - - return u -} - -// Returns epoch and clock sequence. -func (g *rfc4122Generator) getClockSequence() (uint64, uint16, error) { - var err error - g.clockSequenceOnce.Do(func() { - buf := make([]byte, 2) - if _, err = io.ReadFull(g.rand, buf); err != nil { - return - } - g.clockSequence = binary.BigEndian.Uint16(buf) - }) - if err != nil { - return 0, 0, err - } - - g.storageMutex.Lock() - defer g.storageMutex.Unlock() - - timeNow := g.getEpoch() - // Clock didn't change since last UUID generation. - // Should increase clock sequence. - if timeNow <= g.lastTime { - g.clockSequence++ - } - g.lastTime = timeNow - - return timeNow, g.clockSequence, nil -} - -// Returns hardware address. -func (g *rfc4122Generator) getHardwareAddr() ([]byte, error) { - var err error - g.hardwareAddrOnce.Do(func() { - if hwAddr, err := g.hwAddrFunc(); err == nil { - copy(g.hardwareAddr[:], hwAddr) - return - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence. - if _, err = io.ReadFull(g.rand, g.hardwareAddr[:]); err != nil { - return - } - // Set multicast bit as recommended by RFC 4122 - g.hardwareAddr[0] |= 0x01 - }) - if err != nil { - return []byte{}, err - } - return g.hardwareAddr[:], nil -} - -// Returns difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and current time. -func (g *rfc4122Generator) getEpoch() uint64 { - return epochStart + uint64(g.epochFunc().UnixNano()/100) -} - -// Returns UUID based on hashing of namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - _, _ = h.Write(ns[:]) - _, _ = h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} - -// Returns hardware address. -func defaultHWAddrFunc() (net.HardwareAddr, error) { - ifaces, err := net.Interfaces() - if err != nil { - return []byte{}, err - } - for _, iface := range ifaces { - if len(iface.HardwareAddr) >= 6 { - return iface.HardwareAddr, nil - } - } - return []byte{}, fmt.Errorf("uuid: no HW address found") -} diff --git a/core-sdk/common/uuid/uuid.go b/core-sdk/common/uuid/uuid.go deleted file mode 100644 index 142fd666..00000000 --- a/core-sdk/common/uuid/uuid.go +++ /dev/null @@ -1,138 +0,0 @@ -//Package uuid reference: https://github.com/binance-chain/go-sdk/blob/master/common/uuid/uuid.go -package uuid - -import ( - "bytes" - "encoding/hex" -) - -// Size of a UUID in bytes. -const Size = 16 - -// UUID representation compliant with specification -// described in RFC 4122. -type UUID [Size]byte - -// UUID versions -const ( - _ byte = iota - V1 - V2 - V3 - V4 - V5 -) - -// UUID layout variants. -const ( - VariantNCS byte = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// String parse helpers. -var ( - urnPrefix = []byte("urn:uuid:") - byteGroups = []int{8, 4, 4, 4, 12} -) - -// Nil is special form of UUID that is specified to have all -// 128 bits set to zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) -) - -// Equal returns true if u1 and u2 equals, otherwise returns false. -func Equal(u1 UUID, u2 UUID) bool { - return bytes.Equal(u1[:], u2[:]) -} - -// Version returns algorithm version used to generate UUID. -func (u UUID) Version() byte { - return u[6] >> 4 -} - -// Variant returns UUID layout variant. -func (u UUID) Variant() byte { - switch { - case (u[8] >> 7) == 0x00: - return VariantNCS - case (u[8] >> 6) == 0x02: - return VariantRFC4122 - case (u[8] >> 5) == 0x06: - return VariantMicrosoft - case (u[8] >> 5) == 0x07: - fallthrough - default: - return VariantFuture - } -} - -// Bytes returns bytes slice representation of UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Returns canonical string representation of UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := make([]byte, 36) - - hex.Encode(buf[0:8], u[0:4]) - buf[8] = '-' - hex.Encode(buf[9:13], u[4:6]) - buf[13] = '-' - hex.Encode(buf[14:18], u[6:8]) - buf[18] = '-' - hex.Encode(buf[19:23], u[8:10]) - buf[23] = '-' - hex.Encode(buf[24:], u[10:]) - - return string(buf) -} - -// SetVersion sets version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets variant bits. -func (u *UUID) SetVariant(v byte) { - switch v { - case VariantNCS: - u[8] = u[8]&(0xff>>1) | (0x00 << 7) - case VariantRFC4122: - u[8] = u[8]&(0xff>>2) | (0x02 << 6) - case VariantMicrosoft: - u[8] = u[8]&(0xff>>3) | (0x06 << 5) - case VariantFuture: - fallthrough - default: - u[8] = u[8]&(0xff>>3) | (0x07 << 5) - } -} - -// Must is a helper that wraps a call to a function returning (UUID, error) -// and panics if the error is non-nil. It is intended for use in variable -// initializations such as -// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")); -func Must(u UUID, err error) UUID { - if err != nil { - panic(err) - } - return u -} diff --git a/core-sdk/go.mod b/core-sdk/go.mod deleted file mode 100644 index 3612cdbb..00000000 --- a/core-sdk/go.mod +++ /dev/null @@ -1,37 +0,0 @@ -module github.com/irisnet/core-sdk-go - -go 1.16 - -require ( - github.com/avast/retry-go v3.0.0+incompatible - github.com/bluele/gcache v0.0.2 - github.com/btcsuite/btcd v0.21.0-beta - github.com/btcsuite/btcutil v1.0.2 - github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d - github.com/gogo/protobuf v1.3.3 - github.com/golang/protobuf v1.4.3 - github.com/magiconair/properties v1.8.1 - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect - github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect - github.com/pkg/errors v0.9.1 - github.com/prometheus/common v0.14.0 - github.com/regen-network/cosmos-proto v0.3.1 - github.com/sirupsen/logrus v1.6.0 - github.com/stretchr/testify v1.7.0 - github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 - github.com/tendermint/go-amino v0.16.0 - github.com/tendermint/tendermint v0.34.11 - github.com/tendermint/tm-db v0.6.4 - github.com/tjfoc/gmsm v1.4.0 - golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 - google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 - google.golang.org/grpc v1.37.0 - google.golang.org/protobuf v1.25.0 - gopkg.in/yaml.v2 v2.3.0 - -) - -replace ( - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4 - github.com/tendermint/tendermint => github.com/bianjieai/tendermint v0.34.1-irita-210113 -) diff --git a/core-sdk/go.sum b/core-sdk/go.sum deleted file mode 100644 index 675c2268..00000000 --- a/core-sdk/go.sum +++ /dev/null @@ -1,741 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= -github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= -github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= -github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= -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/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= -github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -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= -github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= -github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bianjieai/tendermint v0.34.1-irita-210113 h1:p0sDVhwIBScHlJta4zoO5dDbhjBmVKknaM+pwibmi1g= -github.com/bianjieai/tendermint v0.34.1-irita-210113/go.mod h1:NJCKYDQ5I18NZSqS98EVpkdBKILvc+potW7xkV/5BUA= -github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= -github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw= -github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= -github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= -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/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/confio/ics23/go v0.6.3/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= -github.com/cosmos/iavl v0.15.0-rc5/go.mod h1:WqoPL9yPTQ85QBMT45OOUzPxG/U/JcJoN7uMjgxke/I= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/dgraph-io/badger/v2 v2.2007.2 h1:EjjK0KqwaFMlPin1ajhP943VPENHJdEz1KLIegjaI3k= -github.com/dgraph-io/badger/v2 v2.2007.2/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de h1:t0UHb5vdojIDUqktM6+xJAfScFBsVpXZmqC9dsgJmeA= -github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= -github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ= -github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y= -github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0 h1:dXFJfIHVvUcpSgDOV+Ne6t7jXri8Tfv2uOLHUZ2XNuo= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= -github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -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/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= -github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs= -github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= -github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= -github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -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 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= -github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= -github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ= -github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= -github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= -github.com/regen-network/protobuf v1.3.2-alpha.regen.4 h1:c9jEnU+xm6vqyrQe3M94UFWqiXxRIKKnqBOh2EACmBE= -github.com/regen-network/protobuf v1.3.2-alpha.regen.4/go.mod h1:/J8/bR1T/NXyIdQDLUaq15LjNE83nRzkyrLAMcPewig= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= -github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= -github.com/sasha-s/go-deadlock v0.2.0 h1:lMqc+fUb7RrFS3gQLtoQsJ7/6TV/pAIFvBsqX73DK8Y= -github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa/go.mod h1:oJyF+mSPHbB5mVY2iO9KV3pTt/QbIkGaO8gQ2WrDbP4= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= -github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -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/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= -github.com/tendermint/tm-db v0.6.4 h1:3N2jlnYQkXNQclQwd/eKV/NzlqPlfK21cpRRIx80XXQ= -github.com/tendermint/tm-db v0.6.4/go.mod h1:dptYhIpJ2M5kUuenLr+Yyf3zQOv1SgBZcl8/BmWlMBw= -github.com/tjfoc/gmsm v1.4.0 h1:8nbaiZG+iVdh+fXVw0DZoZZa7a4TGm3Qab+xdrdzj8s= -github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -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/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0= -go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -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/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -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= -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= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= -golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -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-20180826012351-8a410e7b638d/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= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb h1:mUVeFHoDKis5nxCAzoAi7E8Ghb86EXh/RK6wtvJIqRY= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200110213125-a7a6caa82ab2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20201111145450-ac7456db90a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 h1:Rt0FRalMgdSlXAVJvX4pr65KfqaxHXSLkSJRD9pw6g0= -google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= -gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/core-sdk/integration_test/bank_test.go b/core-sdk/integration_test/bank_test.go deleted file mode 100644 index 5f94658f..00000000 --- a/core-sdk/integration_test/bank_test.go +++ /dev/null @@ -1,185 +0,0 @@ -package integration_test - -import ( - "encoding/json" - "fmt" - "math/rand" - "sync" - "time" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/core-sdk-go/bank" - "github.com/irisnet/core-sdk-go/types" -) - -func (s IntegrationTestSuite) TestBank() { - cases := []SubTest{ - { - "TestQueryAccount", - queryAccount, - }, - { - "TestSend", - send, - }, - { - "TestMultiSend", - multiSend, - }, - { - "TestSimulate", - simulate, - }, - { - "TestSendWitchSpecAccountInfo", - sendWitchSpecAccountInfo, - }, - } - - for _, t := range cases { - s.Run(t.testName, func() { t.testCase(s) }) - } -} - -func queryAccount(s IntegrationTestSuite) { - account, err := s.Bank.QueryAccount(s.Account().Address.String()) - s.NoError(err) - s.NotEmpty(account) - bz, _ := json.Marshal(account) - fmt.Println(string(bz)) -} - -func send(s IntegrationTestSuite) { - coins, err := types.ParseDecCoins("10iris") - s.NoError(err) - to := s.GetRandAccount().Address.String() - - ch := make(chan int) - s.Bank.SubscribeSendTx(s.Account().Address.String(), to, func(send bank.EventDataMsgSend) { - ch <- 1 - }) - - baseTx := types.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Memo: "TEST", - Mode: types.Commit, - Password: s.Account().Password, - SimulateAndExecute: false, - GasAdjustment: 1.5, - } - - res, err := s.Bank.Send(to, coins, baseTx) - s.NoError(err) - s.NotEmpty(res.Hash) - time.Sleep(1 * time.Second) - - resp, err := s.Manager().QueryTx(res.Hash) - s.NoError(err) - s.Equal(resp.Result.Code, uint32(0)) - s.Equal(resp.Height, res.Height) - - <-ch -} - -func multiSend(s IntegrationTestSuite) { - baseTx := types.BaseTx{ - From: s.Account().Name, - Gas: 2000000, - Memo: "test", - Mode: types.Commit, - Password: s.Account().Password, - } - - coins, err := types.ParseDecCoins("1000iris") - s.NoError(err) - - accNum := 11 - acc := make([]string, accNum) - receipts := make([]bank.Receipt, accNum) - for i := 0; i < accNum; i++ { - acc[i] = s.RandStringOfLength(10) - addr, _, err := s.Add(acc[i], "1234567890") - - s.NoError(err) - s.NotEmpty(addr) - - receipts[i] = bank.Receipt{ - Address: addr, - Amount: coins, - } - } - - _, err = s.Bank.MultiSend(bank.MultiSendRequest{Receipts: receipts}, baseTx) - s.NoError(err) - - coins, err = types.ParseDecCoins("1iris") - s.NoError(err) - to := s.GetRandAccount().Address.String() - begin := time.Now() - var wait sync.WaitGroup - for i := 1; i < 5; i++ { - wait.Add(1) - index := rand.Intn(accNum) - go func() { - defer wait.Done() - _, err := s.Bank.Send(to, coins, types.BaseTx{ - From: acc[index], - Gas: 200000, - Memo: "test", - Mode: types.Commit, - Password: "1234567890", - }) - s.NoError(err) - }() - } - wait.Wait() - end := time.Now() - fmt.Printf("total senconds:%s\n", end.Sub(begin).String()) -} - -func simulate(s IntegrationTestSuite) { - coins, err := types.ParseDecCoins("10iris") - s.NoError(err) - to := s.GetRandAccount().Address.String() - baseTx := types.BaseTx{ - From: s.Account().Name, - Password: s.Account().Password, - Gas: 200000, - Memo: "test", - Mode: types.Commit, - SimulateAndExecute: true, - } - - result, err := s.Bank.Send(to, coins, baseTx) - s.NoError(err) - s.Greater(result.GasWanted, int64(0)) - fmt.Println(result) -} - -func sendWitchSpecAccountInfo(s IntegrationTestSuite) { - for i := 0; i < 10; i++ { - coins, err := types.ParseDecCoins("10iris") - baseTx := types.BaseTx{ - From: s.Account().Name, - Gas: 200000, - Fee: coins, - Memo: "TEST", - Mode: types.Commit, - Password: s.Account().Password, - } - - curAccount, err := s.Bank.QueryAccount(s.Account().Address.String()) - require.NoError(s.T(), err) - - accountNumber := curAccount.AccountNumber - sequence := curAccount.Sequence - randomAddr := s.GetRandAccount().Address.String() - amount, _ := types.ParseDecCoins("10iris") - - res, err := s.Bank.SendWitchSpecAccountInfo(randomAddr, sequence, accountNumber, amount, baseTx) - require.NoError(s.T(), err) - require.NotEmpty(s.T(), res.Hash) - } -} diff --git a/core-sdk/integration_test/integration_test.go b/core-sdk/integration_test/integration_test.go deleted file mode 100644 index d5623e10..00000000 --- a/core-sdk/integration_test/integration_test.go +++ /dev/null @@ -1,178 +0,0 @@ -package integration_test - -import ( - "io/ioutil" - "math/rand" - "os" - "path/filepath" - "testing" - "time" - - "github.com/stretchr/testify/suite" - - sdk "github.com/irisnet/core-sdk-go" - "github.com/irisnet/core-sdk-go/common/crypto" - "github.com/irisnet/core-sdk-go/common/log" - "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/store" -) - -const ( - nodeURI = "tcp://localhost:26657" - grpcAddr = "localhost:9090" - chainID = "test" - charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - addr = "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx" -) - -type IntegrationTestSuite struct { - suite.Suite - sdk.Client - r *rand.Rand - rootAccount MockAccount - randAccounts []MockAccount -} - -type SubTest struct { - testName string - testCase func(s IntegrationTestSuite) -} - -// MockAccount define a account for test -type MockAccount struct { - Name, Password string - Address types.AccAddress -} - -func TestSuite(t *testing.T) { - suite.Run(t, new(IntegrationTestSuite)) -} - -func (s *IntegrationTestSuite) SetupSuite() { - bech32AddressPrefix := types.AddrPrefixCfg{ - Bech32AddressPrefix: map[string]string{ - "account_addr": "aaaa", - "validator_addr": "aaaa", - "consensus_addr": "aaaa", - "account_pub": "aaaa", - "validator_pub": "aaaa", - "consensus_pub": "aaaa"}, - } - options := []types.Option{ - types.KeyDAOOption(store.NewMemory(nil)), - types.TimeoutOption(10), - types.TokenManagerOption(TokenManager{}), - types.KeyManagerOption(crypto.NewKeyManager()), - types.Bech32AddressPrefixOption(bech32AddressPrefix), - } - cfg, err := types.NewClientConfig(nodeURI, grpcAddr, chainID, options...) - if err != nil { - panic(err) - } - - s.Client = sdk.NewClient(cfg) - s.r = rand.New(rand.NewSource(time.Now().UnixNano())) - s.rootAccount = MockAccount{ - Name: "validator", - Password: "1234567890", - Address: types.MustAccAddressFromBech32(addr), - } - s.SetLogger(log.NewLogger(log.Config{ - Format: log.FormatJSON, - Level: log.DebugLevel, - })) - s.initAccount() -} - -func (s *IntegrationTestSuite) initAccount() { - _, err := s.Import( - s.Account().Name, - s.Account().Password, - string(getPrivKeyArmor()), - ) - if err != nil { - panic(err) - } - - //var receipts bank.Receipts - for i := 0; i < 5; i++ { - name := s.RandStringOfLength(10) - pwd := s.RandStringOfLength(16) - address, _, err := s.Add(name, "11111111") - if err != nil { - panic("generate test account failed") - } - - s.randAccounts = append(s.randAccounts, MockAccount{ - Name: name, - Password: pwd, - Address: types.MustAccAddressFromBech32(address), - }) - } -} - -// RandStringOfLength return a random string -func (s *IntegrationTestSuite) RandStringOfLength(l int) string { - var result []byte - bytes := []byte(charset) - for i := 0; i < l; i++ { - result = append(result, bytes[s.r.Intn(len(bytes))]) - } - return string(result) -} - -// GetRandAccount return a random test account -func (s *IntegrationTestSuite) GetRandAccount() MockAccount { - return s.randAccounts[s.r.Intn(len(s.randAccounts))] -} - -// Account return a test account -func (s *IntegrationTestSuite) Account() MockAccount { - return s.rootAccount -} - -func getPrivKeyArmor() []byte { - path, err := os.Getwd() - if err != nil { - panic(err) - } - path = filepath.Dir(path) - path = filepath.Join(path, "integration_test/scripts/priv.key") - bz, err := ioutil.ReadFile(path) - if err != nil { - panic(err) - } - return bz -} - -type TokenManager struct{} - -func (TokenManager TokenManager) QueryToken(denom string) (types.Token, error) { - return types.Token{}, nil -} - -func (TokenManager TokenManager) SaveTokens(tokens ...types.Token) { - return -} - -func (TokenManager TokenManager) ToMinCoin(coins ...types.DecCoin) (types.Coins, types.Error) { - for i := range coins { - if coins[i].Denom == "iris" { - coins[i].Denom = "uiris" - coins[i].Amount = coins[i].Amount.MulInt(types.NewIntWithDecimal(1, 6)) - } - } - ucoins, _ := types.DecCoins(coins).TruncateDecimal() - return ucoins, nil -} - -func (TokenManager TokenManager) ToMainCoin(coins ...types.Coin) (types.DecCoins, types.Error) { - decCoins := make(types.DecCoins, len(coins), 0) - for _, coin := range coins { - if coin.Denom == "uiris" { - amtount := types.NewDecFromInt(coin.Amount).Mul(types.NewDecWithPrec(1, 6)) - decCoins = append(decCoins, types.NewDecCoinFromDec("iris", amtount)) - } - } - return decCoins, nil -} diff --git a/core-sdk/integration_test/scripts/Dockerfile b/core-sdk/integration_test/scripts/Dockerfile deleted file mode 100644 index e5962c2e..00000000 --- a/core-sdk/integration_test/scripts/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM irisnet/irishub:latest - -COPY . /scripts - -RUN sh /scripts/setup.sh - -EXPOSE 26657 -EXPOSE 9090 - -CMD iris start \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/build.sh b/core-sdk/integration_test/scripts/build.sh deleted file mode 100755 index bbadf696..00000000 --- a/core-sdk/integration_test/scripts/build.sh +++ /dev/null @@ -1 +0,0 @@ -docker build -t irishub-sdk-go . \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/clean.sh b/core-sdk/integration_test/scripts/clean.sh deleted file mode 100755 index 6d6b3604..00000000 --- a/core-sdk/integration_test/scripts/clean.sh +++ /dev/null @@ -1,2 +0,0 @@ -docker stop irishub-sdk-go-test -docker rmi irishub-sdk-go \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/node/config/app.toml b/core-sdk/integration_test/scripts/node/config/app.toml deleted file mode 100644 index 2d320877..00000000 --- a/core-sdk/integration_test/scripts/node/config/app.toml +++ /dev/null @@ -1,151 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -############################################################################### -### Base Configuration ### -############################################################################### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "0.000006uiris" - -# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals -# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals -# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval' -pruning = "default" - -# These are applied if and only if the pruning strategy is custom. -pruning-interval = "0" -pruning-keep-every = "0" -pruning-keep-recent = "0" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: Commitment of state will be attempted on the corresponding block. -halt-time = 0 - -# MinRetainBlocks defines the minimum block height offset from the current -# block being committed, such that all blocks past this offset are pruned -# from Tendermint. It is used as part of the process of determining the -# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates -# that no blocks should be pruned. -# -# This configuration value is only responsible for pruning Tendermint blocks. -# It has no bearing on application state pruning which is determined by the -# "pruning-*" configurations. -# -# Note: Tendermint block pruning is dependant on this parameter in conunction -# with the unbonding (safety threshold) period, state pruning and state sync -# snapshot parameters to determine the correct minimum value of -# ResponseCommit.RetainHeight. -min-retain-blocks = 0 - -# InterBlockCache enables inter-block caching. -inter-block-cache = true - -# IndexEvents defines the set of events in the form {eventType}.{attributeKey}, -# which informs Tendermint what to index. If empty, all events will be indexed. -# -# Example: -# ["message.sender", "message.recipient"] -index-events = [] - -############################################################################### -### Telemetry Configuration ### -############################################################################### - -[telemetry] - -# Prefixed with keys to separate services. -service-name = "" - -# Enabled enables the application telemetry functionality. When enabled, -# an in-memory sink is also enabled by default. Operators may also enabled -# other sinks such as Prometheus. -enabled = false - -# Enable prefixing gauge values with hostname. -enable-hostname = false - -# Enable adding hostname to labels. -enable-hostname-label = false - -# Enable adding service to labels. -enable-service-label = false - -# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. -prometheus-retention-time = 0 - -# GlobalLabels defines a global set of name/value label tuples applied to all -# metrics emitted using the wrapper functions defined in telemetry package. -# -# Example: -# [["chain_id", "cosmoshub-1"]] -global-labels = [] - -############################################################################### -### API Configuration ### -############################################################################### - -[api] - -# Enable defines if the API server should be enabled. -enable = true - -# Swagger defines if swagger documentation should automatically be registered. -swagger = false - -# Address defines the API server to listen on. -address = "tcp://0.0.0.0:1317" - -# MaxOpenConnections defines the number of maximum open connections. -max-open-connections = 1000 - -# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). -rpc-read-timeout = 10 - -# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). -rpc-write-timeout = 0 - -# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). -rpc-max-body-bytes = 1000000 - -# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). -enabled-unsafe-cors = false - -############################################################################### -### gRPC Configuration ### -############################################################################### - -[grpc] - -# Enable defines if the gRPC server should be enabled. -enable = true - -# Address defines the gRPC server address to bind to. -address = "0.0.0.0:9090" - -############################################################################### -### State Sync Configuration ### -############################################################################### - -# State sync snapshots allow other nodes to rapidly join the network without replaying historical -# blocks, instead downloading and applying a snapshot of the application state at a given height. -[state-sync] - -# snapshot-interval specifies the block interval at which local state sync snapshots are -# taken (0 to disable). Must be a multiple of pruning-keep-every. -snapshot-interval = 0 - -# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). -snapshot-keep-recent = 2 diff --git a/core-sdk/integration_test/scripts/node/config/config.toml b/core-sdk/integration_test/scripts/node/config/config.toml deleted file mode 100644 index 1daf37a6..00000000 --- a/core-sdk/integration_test/scripts/node/config/config.toml +++ /dev/null @@ -1,392 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or -# relative to the home directory (e.g. "data"). The home directory is -# "$HOME/.tendermint" by default, but could be changed via $TMHOME env variable -# or --home cmd flag. - -####################################################################### -### Main Base Config Options ### -####################################################################### - -# TCP or UNIX socket address of the ABCI application, -# or the name of an ABCI application compiled in with the Tendermint binary -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "node0" - -# If this node is many blocks behind the tip of the chain, FastSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -fast_sync = true - -# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb -# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) -# - pure go -# - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -# * rocksdb (uses github.com/tecbot/gorocksdb) -# - EXPERIMENTAL -# - requires gcc -# - use rocksdb build tag (go build -tags rocksdb) -# * badgerdb (uses github.com/dgraph-io/badger) -# - EXPERIMENTAL -# - use badgerdb build tag (go build -tags badgerdb) -db_backend = "goleveldb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "info" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_key_file = "config/priv_validator_key.json" - -# Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "data/priv_validator_state.json" - -# TCP or UNIX socket address for Tendermint to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -node_key_file = "config/node_key.json" - -# Mechanism to connect to the ABCI application: socket | grpc -abci = "socket" - -# If true, query the ABCI app on connecting to a new peer -# so the app can decide if we should keep the connection or not -filter_peers = false - -####################################################################### -### Advanced Configuration Options ### -####################################################################### - -####################################################### -### RPC Server Configuration Options ### -####################################################### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://0.0.0.0:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = [] - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = ["HEAD", "GET", "POST"] - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"] - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -# Maximum number of unique clientIDs that can /subscribe -# If you're using /broadcast_tx_commit, set to the estimated maximum number -# of broadcast_tx_commit calls per block. -max_subscription_clients = 100 - -# Maximum number of unique queries a given client can /subscribe to -# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to -# the estimated # maximum number of broadcast_tx_commit calls per block. -max_subscriptions_per_client = 5 - -# How long to wait for a tx to be committed during /broadcast_tx_commit. -# WARNING: Using a value larger than 10s will result in increasing the -# global HTTP write timeout, which applies to all connections and endpoints. -# See https://github.com/tendermint/tendermint/issues/3435 -timeout_broadcast_tx_commit = "10s" - -# Maximum size of request body, in bytes -max_body_bytes = 1000000 - -# Maximum size of request header, in bytes -max_header_bytes = 1048576 - -# The path to a file containing certificate that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# If the certificate is signed by a certificate authority, -# the certFile should be the concatenation of the server's certificate, any intermediates, -# and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_cert_file = "" - -# The path to a file containing matching private key that is used to create the HTTPS server. -# Might be either absolute path or path related to Tendermint's config directory. -# NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server. -# Otherwise, HTTP server is run. -tls_key_file = "" - -# pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "localhost:6060" - -####################################################### -### P2P Configuration Options ### -####################################################### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "" - -# UPNP port forwarding -upnp = false - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# List of node IDs, to which a connection will be (re)established ignoring any existing limits -unconditional_peer_ids = "" - -# Maximum pause when redialing a persistent peer (if zero, exponential backoff is used) -persistent_peers_max_dial_period = "0s" - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be sent, in bytes/second -send_rate = 5120000 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = false - -# Peer connection configuration. -dial_timeout = "3s" -handshake_timeout = "20s" - -####################################################### -### Mempool Configuration Option ### -####################################################### -[mempool] - -broadcast = true -recheck = true -wal_dir = "" - -# Maximum number of transactions in the mempool -size = 5000 - -# Limit the total size of all txs in the mempool. -# This only accounts for raw transactions (e.g. given 1MB transactions and -# max_txs_bytes=5MB, mempool will only accept 5 transactions). -max_txs_bytes = 1073741824 - -# Size of the cache (used to filter transactions we saw earlier) in transactions -cache_size = 10000 - -# Do not remove invalid transactions from the cache (default: false) -# Set to true if it's not possible for any invalid transaction to become valid -# again in the future. -keep-invalid-txs-in-cache = false - -# Maximum size of a single transaction. -# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}. -max_tx_bytes = 1048576 - -# Maximum size of a batch of transactions to send to a peer -# Including space needed by encoding (one varint per transaction). -# XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796 -max_batch_bytes = 0 - -####################################################### -### State Sync Configuration Options ### -####################################################### -[statesync] -# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine -# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in -# the network to take and serve state machine snapshots. State sync is not attempted if the node -# has any local state (LastBlockHeight > 0). The node will have a truncated block history, -# starting from the height of the snapshot. -enable = false - -# RPC servers (comma-separated) for light client verification of the synced state machine and -# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding -# header hash obtained from a trusted source, and a period during which validators can be trusted. -# -# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2 -# weeks) during which they can be financially punished (slashed) for misbehavior. -rpc_servers = "" -trust_hash = "" -trust_height = 0 -trust_period = "168h0m0s" - -# Time to spend discovering snapshots before initiating a restore. -discovery_time = "15s" - -# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp). -# Will create a new, randomly named directory within, and remove it when done. -temp_dir = "" - -####################################################### -### Fast Sync Configuration Connections ### -####################################################### -[fastsync] - -# Fast Sync version to use: -# 1) "v0" (default) - the legacy fast sync implementation -# 2) "v1" - refactor of v0 version for better testability -# 2) "v2" - complete redesign of v0, optimized for testability & readability -version = "v0" - -####################################################### -### Consensus Configuration Options ### -####################################################### -[consensus] - -wal_file = "data/cs.wal/wal" - -# How long we wait for a proposal block before prevoting nil -timeout_propose = "3s" -# How much timeout_propose increases with each round -timeout_propose_delta = "500ms" -# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil) -timeout_prevote = "1s" -# How much the timeout_prevote increases with each round -timeout_prevote_delta = "500ms" -# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil) -timeout_precommit = "1s" -# How much the timeout_precommit increases with each round -timeout_precommit_delta = "500ms" -# How long we wait after committing a block, before starting on the new -# height (this gives us a chance to receive some more precommits, even -# though we already have +2/3). -timeout_commit = "1s" - -# How many blocks to look back to check existence of the node's consensus votes before joining consensus -# When non-zero, the node will panic upon restart -# if the same consensus key was used to sign {double_sign_check_height} last blocks. -# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic. -double_sign_check_height = 0 - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -####################################################### -### Transaction Indexer Configuration Options ### -####################################################### -[tx_index] - -# What indexer to use for transactions -# -# The application will set which txs to index. In some cases a node operator will be able -# to decide which txs to index based on configuration set in the application. -# -# Options: -# 1) "null" -# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed. -indexer = "kv" - -####################################################### -### Instrumentation Configuration Options ### -####################################################### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "tendermint" diff --git a/core-sdk/integration_test/scripts/node/config/genesis.json b/core-sdk/integration_test/scripts/node/config/genesis.json deleted file mode 100644 index 1816f52a..00000000 --- a/core-sdk/integration_test/scripts/node/config/genesis.json +++ /dev/null @@ -1,343 +0,0 @@ -{ - "genesis_time": "2021-04-29T07:03:47.75703Z", - "chain_id": "test", - "initial_height": "1", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "-1", - "time_iota_ms": "1000" - }, - "evidence": { - "max_age_num_blocks": "100000", - "max_age_duration": "172800000000000", - "max_bytes": "1048576" - }, - "validator": { - "pub_key_types": [ - "ed25519" - ] - }, - "version": {} - }, - "app_hash": "", - "app_state": { - "auth": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" - }, - "accounts": [ - { - "@type": "/cosmos.auth.v1beta1.BaseAccount", - "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "pub_key": null, - "account_number": "0", - "sequence": "0" - } - ] - }, - "bank": { - "params": { - "send_enabled": [], - "default_send_enabled": true - }, - "balances": [ - { - "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "coins": [ - { - "denom": "uiris", - "amount": "2000000000000000" - } - ] - } - ], - "supply": [], - "denom_metadata": [] - }, - "capability": { - "index": "1", - "owners": [] - }, - "coinswap": { - "params": { - "fee": "0.003000000000000000" - }, - "standard_denom": "uiris" - }, - "crisis": { - "constant_fee": { - "denom": "uiris", - "amount": "1000" - } - }, - "distribution": { - "params": { - "community_tax": "0.020000000000000000", - "base_proposer_reward": "0.010000000000000000", - "bonus_proposer_reward": "0.040000000000000000", - "withdraw_addr_enabled": true - }, - "fee_pool": { - "community_pool": [] - }, - "delegator_withdraw_infos": [], - "previous_proposer": "", - "outstanding_rewards": [], - "validator_accumulated_commissions": [], - "validator_historical_rewards": [], - "validator_current_rewards": [], - "delegator_starting_infos": [], - "validator_slash_events": [] - }, - "evidence": { - "evidence": [] - }, - "genutil": { - "gen_txs": [ - { - "body": { - "messages": [ - { - "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", - "description": { - "moniker": "node0", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "validator_address": "iva1w9lvhwlvkwqvg08q84n2k4nn896u9pqxsqxkzp", - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "CJ6CJOrPeR0LhGNMJGRDUPiDrjCDVyPmRBRdZWp8kDg=" - }, - "value": { - "denom": "uiris", - "amount": "100000000" - } - } - ], - "memo": "a55eb068ac6f0fb991746b37a2a1bddba4da605a@10.1.4.123:26656", - "timeout_height": "0", - "extension_options": [], - "non_critical_extension_options": [] - }, - "auth_info": { - "signer_infos": [ - { - "public_key": { - "@type": "/cosmos.crypto.secp256k1.PubKey", - "key": "A+KPcrEkUOSKIW1RZwvNrtenvsKGKYkokDUP2lwnqAje" - }, - "mode_info": { - "single": { - "mode": "SIGN_MODE_DIRECT" - } - }, - "sequence": "0" - } - ], - "fee": { - "amount": [], - "gas_limit": "200000", - "payer": "", - "granter": "" - } - }, - "signatures": [ - "LQrLc4uGfaNTw9jCzYdUSpoGMiWAB5LA89WtClCDiTt7xHQITzFYugIInjPlT53H4ycgIzD2324qIaYUnk2AZQ==" - ] - } - ] - }, - "gov": { - "starting_proposal_id": "1", - "deposits": [], - "votes": [], - "proposals": [], - "deposit_params": { - "min_deposit": [ - { - "denom": "uiris", - "amount": "10000000" - } - ], - "max_deposit_period": "10s" - }, - "voting_params": { - "voting_period": "10s" - }, - "tally_params": { - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto_threshold": "0.334000000000000000" - } - }, - "guardian": { - "supers": [ - { - "description": "genesis", - "account_type": "GENESIS", - "address": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx", - "added_by": "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx" - } - ] - }, - "htlc": { - "params": { - "asset_params": [] - }, - "htlcs": [], - "supplies": [], - "previous_block_time": "1970-01-01T00:00:01Z" - }, - "ibc": { - "client_genesis": { - "clients": [], - "clients_consensus": [], - "clients_metadata": [], - "params": { - "allowed_clients": [ - "06-solomachine", - "07-tendermint" - ] - }, - "create_localhost": false, - "next_client_sequence": "0" - }, - "connection_genesis": { - "connections": [], - "client_connection_paths": [], - "next_connection_sequence": "0" - }, - "channel_genesis": { - "channels": [], - "acknowledgements": [], - "commitments": [], - "receipts": [], - "send_sequences": [], - "recv_sequences": [], - "ack_sequences": [], - "next_channel_sequence": "0" - } - }, - "mint": { - "minter": { - "last_update": "1970-01-01T00:00:00Z", - "inflation_base": "2000000000000000" - }, - "params": { - "mint_denom": "uiris", - "inflation": "0.040000000000000000" - } - }, - "nft": { - "collections": [] - }, - "oracle": { - "entries": [] - }, - "params": null, - "random": { - "pending_random_requests": {} - }, - "record": { - "records": [] - }, - "service": { - "params": { - "max_request_timeout": "100", - "min_deposit_multiple": "1000", - "min_deposit": [ - { - "denom": "uiris", - "amount": "5000" - } - ], - "service_fee_tax": "0.050000000000000000", - "slash_fraction": "0.001000000000000000", - "complaint_retrospect": "1296000s", - "arbitration_time_limit": "432000s", - "tx_size_limit": "4000", - "base_denom": "uiris", - "restricted_service_fee_denom": false - }, - "definitions": [], - "bindings": [], - "withdraw_addresses": {}, - "request_contexts": {} - }, - "slashing": { - "params": { - "signed_blocks_window": "100", - "min_signed_per_window": "0.500000000000000000", - "downtime_jail_duration": "600s", - "slash_fraction_double_sign": "0.050000000000000000", - "slash_fraction_downtime": "0.010000000000000000" - }, - "signing_infos": [], - "missed_blocks": [] - }, - "staking": { - "params": { - "unbonding_time": "10s", - "max_validators": 100, - "max_entries": 7, - "historical_entries": 10000, - "bond_denom": "uiris" - }, - "last_total_power": "0", - "last_validator_powers": [], - "validators": [], - "delegations": [], - "unbonding_delegations": [], - "redelegations": [], - "exported": false - }, - "token": { - "params": { - "token_tax_rate": "0.400000000000000000", - "issue_token_base_fee": { - "denom": "iris", - "amount": "60000" - }, - "mint_token_fee_ratio": "0.100000000000000000" - }, - "tokens": [ - { - "symbol": "iris", - "name": "Irishub staking token", - "scale": 6, - "min_unit": "uiris", - "initial_supply": "2000000000", - "max_supply": "10000000000", - "mintable": true, - "owner": "iaa183rfa8tvtp6ax7jr7dfaf7ywv870sykxxykejp" - } - ], - "burned_coins": [] - }, - "transfer": { - "port_id": "transfer", - "denom_traces": [], - "params": { - "send_enabled": true, - "receive_enabled": true - } - }, - "upgrade": {}, - "vesting": {} - } -} \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/node/config/node_key.json b/core-sdk/integration_test/scripts/node/config/node_key.json deleted file mode 100644 index 3e61faba..00000000 --- a/core-sdk/integration_test/scripts/node/config/node_key.json +++ /dev/null @@ -1 +0,0 @@ -{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"Dyjc0bX/HiIXv+5rsZWvBwLqvI5fD5nitDC49L/H0PnPoRChRIMgaPqNbXA3cWbZHujkATDwGmgfcHjaBZ6BUw=="}} \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/node/config/priv_validator_key.json b/core-sdk/integration_test/scripts/node/config/priv_validator_key.json deleted file mode 100644 index aab96264..00000000 --- a/core-sdk/integration_test/scripts/node/config/priv_validator_key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "address": "2FDA2E2186D90D9EFEB88C33749F2E4027EC3EC1", - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "CJ6CJOrPeR0LhGNMJGRDUPiDrjCDVyPmRBRdZWp8kDg=" - }, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "JcFps8b5GHiiev3qg9tczfjRE+livjjT0nfSnWbqjU8InoIk6s95HQuEY0wkZENQ+IOuMINXI+ZEFF1lanyQOA==" - } -} \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/node/data/priv_validator_state.json b/core-sdk/integration_test/scripts/node/data/priv_validator_state.json deleted file mode 100644 index 48f3b67e..00000000 --- a/core-sdk/integration_test/scripts/node/data/priv_validator_state.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "height": "0", - "round": 0, - "step": 0 -} \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/priv.key b/core-sdk/integration_test/scripts/priv.key deleted file mode 100644 index 20cd8b85..00000000 --- a/core-sdk/integration_test/scripts/priv.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN TENDERMINT PRIVATE KEY----- -kdf: bcrypt -salt: 298F51F7478AD9129407D92E3159D7E5 -type: secp256k1 - -Ek9wCZKdEvCu8hrIPr58cUyGHM12b5G6/EIdtWnXlmD9sRifgHt2pfNMD60+W85W -eiSls9IG9KtFM0vjcGWE+lkkxIVo0pBPlhi5NC4= -=jD+4 ------END TENDERMINT PRIVATE KEY----- \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/setup.sh b/core-sdk/integration_test/scripts/setup.sh deleted file mode 100755 index bf73d002..00000000 --- a/core-sdk/integration_test/scripts/setup.sh +++ /dev/null @@ -1 +0,0 @@ - cp -r ./scripts/node/ ~/.iris \ No newline at end of file diff --git a/core-sdk/integration_test/scripts/start.sh b/core-sdk/integration_test/scripts/start.sh deleted file mode 100755 index db2a81cb..00000000 --- a/core-sdk/integration_test/scripts/start.sh +++ /dev/null @@ -1 +0,0 @@ -docker run -d -it --rm -p 26657:26657 -p 9090:9090 --name irishub-sdk-go-test irishub-sdk-go \ No newline at end of file diff --git a/core-sdk/proto/cosmos/auth/v1beta1/auth.proto b/core-sdk/proto/cosmos/auth/v1beta1/auth.proto deleted file mode 100644 index 1df1a42a..00000000 --- a/core-sdk/proto/cosmos/auth/v1beta1/auth.proto +++ /dev/null @@ -1,49 +0,0 @@ -syntax = "proto3"; -package cosmos.auth.v1beta1; - -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/types/auth"; - -// BaseAccount defines a base account type. It contains all the necessary fields -// for basic account functionality. Any custom account type should extend this -// type for additional functionality (e.g. vesting). -message BaseAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = false; - - option (cosmos_proto.implements_interface) = "AccountI"; - - string address = 1; - google.protobuf.Any pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; - uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""]; - uint64 sequence = 4; -} - -// ModuleAccount defines an account for modules that holds coins on a pool. -message ModuleAccount { - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - option (cosmos_proto.implements_interface) = "ModuleAccountI"; - - BaseAccount base_account = 1 [(gogoproto.embed) = true, (gogoproto.moretags) = "yaml:\"base_account\""]; - string name = 2; - repeated string permissions = 3; -} - -// Params defines the parameters for the auth module. -message Params { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - - uint64 max_memo_characters = 1 [(gogoproto.moretags) = "yaml:\"max_memo_characters\""]; - uint64 tx_sig_limit = 2 [(gogoproto.moretags) = "yaml:\"tx_sig_limit\""]; - uint64 tx_size_cost_per_byte = 3 [(gogoproto.moretags) = "yaml:\"tx_size_cost_per_byte\""]; - uint64 sig_verify_cost_ed25519 = 4 - [(gogoproto.customname) = "SigVerifyCostED25519", (gogoproto.moretags) = "yaml:\"sig_verify_cost_ed25519\""]; - uint64 sig_verify_cost_secp256k1 = 5 - [(gogoproto.customname) = "SigVerifyCostSecp256k1", (gogoproto.moretags) = "yaml:\"sig_verify_cost_secp256k1\""]; -} diff --git a/core-sdk/proto/cosmos/auth/v1beta1/query.proto b/core-sdk/proto/cosmos/auth/v1beta1/query.proto deleted file mode 100644 index 2fdc62fe..00000000 --- a/core-sdk/proto/cosmos/auth/v1beta1/query.proto +++ /dev/null @@ -1,47 +0,0 @@ -syntax = "proto3"; -package cosmos.auth.v1beta1; - -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; -import "google/api/annotations.proto"; -import "cosmos/auth/v1beta1/auth.proto"; -import "cosmos_proto/cosmos.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/types/auth"; - -// Query defines the gRPC querier service. -service Query { - // Account returns account details based on address. - rpc Account(QueryAccountRequest) returns (QueryAccountResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/accounts/{address}"; - } - - // Params queries all parameters. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/auth/v1beta1/params"; - } -} - -// QueryAccountRequest is the request type for the Query/Account RPC method. -message QueryAccountRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address defines the address to query for. - string address = 1; -} - -// QueryAccountResponse is the response type for the Query/Account RPC method. -message QueryAccountResponse { - // account defines the account of the corresponding address. - google.protobuf.Any account = 1 [(cosmos_proto.accepts_interface) = "AccountI"]; -} - -// 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 defines the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/core-sdk/proto/cosmos/bank/v1beta1/bank.proto b/core-sdk/proto/cosmos/bank/v1beta1/bank.proto deleted file mode 100644 index 06214ff6..00000000 --- a/core-sdk/proto/cosmos/bank/v1beta1/bank.proto +++ /dev/null @@ -1,85 +0,0 @@ -syntax = "proto3"; -package cosmos.bank.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/bank"; - -// Params defines the parameters for the bank module. -message Params { - option (gogoproto.goproto_stringer) = false; - repeated SendEnabled send_enabled = 1 [(gogoproto.moretags) = "yaml:\"send_enabled,omitempty\""]; - bool default_send_enabled = 2 [(gogoproto.moretags) = "yaml:\"default_send_enabled,omitempty\""]; -} - -// SendEnabled maps coin denom to a send_enabled status (whether a denom is -// sendable). -message SendEnabled { - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - string denom = 1; - bool enabled = 2; -} - -// Input models transaction input. -message Input { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string address = 1; - repeated cosmos.base.v1beta1.Coin coins = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; -} - -// Output models transaction outputs. -message Output { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string address = 1; - repeated cosmos.base.v1beta1.Coin coins = 2 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; -} - -// Supply represents a struct that passively keeps track of the total supply -// amounts in the network. -message Supply { - option (gogoproto.equal) = true; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - option (cosmos_proto.implements_interface) = "*github.com/irisnet/core-sdk-go/modules/bank/exported.SupplyI"; - - repeated cosmos.base.v1beta1.Coin total = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; -} - -// DenomUnit represents a struct that describes a given -// denomination unit of the basic token. -message DenomUnit { - // denom represents the string name of the given denom unit (e.g uatom). - string denom = 1; - // exponent represents power of 10 exponent that one must - // raise the base_denom to in order to equal the given DenomUnit's denom - // 1 denom = 1^exponent base_denom - // (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with - // exponent = 6, thus: 1 atom = 10^6 uatom). - uint32 exponent = 2; - // aliases is a list of string aliases for the given denom - repeated string aliases = 3; -} - -// Metadata represents a struct that describes -// a basic token. -message Metadata { - string description = 1; - // denom_units represents the list of DenomUnit's for a given coin - repeated DenomUnit denom_units = 2; - // base represents the base denom (should be the DenomUnit with exponent = 0). - string base = 3; - // display indicates the suggested denom that should be - // displayed in clients. - string display = 4; -} diff --git a/core-sdk/proto/cosmos/bank/v1beta1/query.proto b/core-sdk/proto/cosmos/bank/v1beta1/query.proto deleted file mode 100644 index 84baabd0..00000000 --- a/core-sdk/proto/cosmos/bank/v1beta1/query.proto +++ /dev/null @@ -1,111 +0,0 @@ -syntax = "proto3"; -package cosmos.bank.v1beta1; - -import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/bank/v1beta1/bank.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/bank"; - -// Query defines the gRPC querier service. -service Query { - // Balance queries the balance of a single coin for a single account. - rpc Balance(QueryBalanceRequest) returns (QueryBalanceResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}/{denom}"; - } - - // AllBalances queries the balance of all coins for a single account. - rpc AllBalances(QueryAllBalancesRequest) returns (QueryAllBalancesResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/balances/{address}"; - } - - // TotalSupply queries the total supply of all coins. - rpc TotalSupply(QueryTotalSupplyRequest) returns (QueryTotalSupplyResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply"; - } - - // SupplyOf queries the supply of a single coin. - rpc SupplyOf(QuerySupplyOfRequest) returns (QuerySupplyOfResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/supply/{denom}"; - } - - // Params queries the parameters of x/bank module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/bank/v1beta1/params"; - } -} - -// QueryBalanceRequest is the request type for the Query/Balance RPC method. -message QueryBalanceRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the address to query balances for. - string address = 1; - - // denom is the coin denom to query balances for. - string denom = 2; -} - -// QueryBalanceResponse is the response type for the Query/Balance RPC method. -message QueryBalanceResponse { - // balance is the balance of the coin. - cosmos.base.v1beta1.Coin balance = 1; -} - -// QueryBalanceRequest is the request type for the Query/AllBalances RPC method. -message QueryAllBalancesRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // address is the address to query balances for. - string address = 1; - - // pagination defines an optional pagination for the request. - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} - -// QueryAllBalancesResponse is the response type for the Query/AllBalances RPC -// method. -message QueryAllBalancesResponse { - // balances is the balances of all the coins. - repeated cosmos.base.v1beta1.Coin balances = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; - - // pagination defines the pagination in the response. - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC -// method. -message QueryTotalSupplyRequest {} - -// QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC -// method -message QueryTotalSupplyResponse { - // supply is the supply of the coins - repeated cosmos.base.v1beta1.Coin supply = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; -} - -// QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. -message QuerySupplyOfRequest { - // denom is the coin denom to query balances for. - string denom = 1; -} - -// QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. -message QuerySupplyOfResponse { - // amount is the supply of the coin. - cosmos.base.v1beta1.Coin amount = 1 [(gogoproto.nullable) = false]; -} - -// QueryParamsRequest defines the request type for querying x/bank parameters. -message QueryParamsRequest {} - -// QueryParamsResponse defines the response type for querying x/bank parameters. -message QueryParamsResponse { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/core-sdk/proto/cosmos/bank/v1beta1/tx.proto b/core-sdk/proto/cosmos/bank/v1beta1/tx.proto deleted file mode 100644 index 2b130d6e..00000000 --- a/core-sdk/proto/cosmos/bank/v1beta1/tx.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; -package cosmos.bank.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/bank/v1beta1/bank.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/bank"; - -// MsgSend represents a message to send coins from one account to another. -message MsgSend { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - string from_address = 1 [(gogoproto.moretags) = "yaml:\"from_address\""]; - string to_address = 2 [(gogoproto.moretags) = "yaml:\"to_address\""]; - repeated cosmos.base.v1beta1.Coin amount = 3 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; -} - -// MsgMultiSend represents an arbitrary multi-in, multi-out send message. -message MsgMultiSend { - option (gogoproto.equal) = false; - - repeated Input inputs = 1 [(gogoproto.nullable) = false]; - repeated Output outputs = 2 [(gogoproto.nullable) = false]; -} diff --git a/core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto b/core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto deleted file mode 100644 index 7ddc4350..00000000 --- a/core-sdk/proto/cosmos/base/abci/v1beta1/abci.proto +++ /dev/null @@ -1,137 +0,0 @@ -syntax = "proto3"; -package cosmos.base.abci.v1beta1; - -import "gogoproto/gogo.proto"; -import "tendermint/abci/types.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/types"; -option (gogoproto.goproto_stringer_all) = false; - -// TxResponse defines a structure containing relevant tx data and metadata. The -// tags are stringified and the log is JSON decoded. -message TxResponse { - option (gogoproto.goproto_getters) = false; - // The block height - int64 height = 1; - // The transaction hash. - string txhash = 2 [(gogoproto.customname) = "TxHash"]; - // Namespace for the Code - string codespace = 3; - // Response code. - uint32 code = 4; - // Result bytes, if any. - string data = 5; - // The output of the application's logger (raw string). May be - // non-deterministic. - string raw_log = 6; - // The output of the application's logger (typed). May be non-deterministic. - repeated ABCIMessageLog logs = 7 [(gogoproto.castrepeated) = "ABCIMessageLogs", (gogoproto.nullable) = false]; - // Additional information. May be non-deterministic. - string info = 8; - // Amount of gas requested for transaction. - int64 gas_wanted = 9; - // Amount of gas consumed by transaction. - int64 gas_used = 10; - // The request transaction bytes. - google.protobuf.Any tx = 11; - // Time of the previous block. For heights > 1, it's the weighted median of - // the timestamps of the valid votes in the block.LastCommit. For height == 1, - // it's genesis time. - string timestamp = 12; -} - -// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. -message ABCIMessageLog { - option (gogoproto.stringer) = true; - - uint32 msg_index = 1; - string log = 2; - - // Events contains a slice of Event objects that were emitted during some - // execution. - repeated StringEvent events = 3 [(gogoproto.castrepeated) = "StringEvents", (gogoproto.nullable) = false]; -} - -// StringEvent defines en Event object wrapper where all the attributes -// contain key/value pairs that are strings instead of raw bytes. -message StringEvent { - option (gogoproto.stringer) = true; - - string type = 1; - repeated Attribute attributes = 2 [(gogoproto.nullable) = false]; -} - -// Attribute defines an attribute wrapper where the key and value are -// strings instead of raw bytes. -message Attribute { - string key = 1; - string value = 2; -} - -// GasInfo defines tx execution gas context. -message GasInfo { - // GasWanted is the maximum units of work we allow this tx to perform. - uint64 gas_wanted = 1 [(gogoproto.moretags) = "yaml:\"gas_wanted\""]; - - // GasUsed is the amount of gas actually consumed. - uint64 gas_used = 2 [(gogoproto.moretags) = "yaml:\"gas_used\""]; -} - -// Result is the union of ResponseFormat and ResponseCheckTx. -message Result { - option (gogoproto.goproto_getters) = false; - - // Data is any data returned from message or handler execution. It MUST be - // length prefixed in order to separate data from multiple message executions. - bytes data = 1; - - // Log contains the log information from message or handler execution. - string log = 2; - - // Events contains a slice of Event objects that were emitted during message - // or handler execution. - repeated tendermint.abci.Event events = 3 [(gogoproto.nullable) = false]; -} - -// SimulationResponse defines the response generated when a transaction is -// successfully simulated. -message SimulationResponse { - GasInfo gas_info = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; - Result result = 2; -} - -// MsgData defines the data returned in a Result object during message -// execution. -message MsgData { - option (gogoproto.stringer) = true; - - string msg_type = 1; - bytes data = 2; -} - -// TxMsgData defines a list of MsgData. A transaction will have a MsgData object -// for each message. -message TxMsgData { - option (gogoproto.stringer) = true; - - repeated MsgData data = 1; -} - -// SearchTxsResult defines a structure for querying txs pageable -message SearchTxsResult { - option (gogoproto.stringer) = true; - - // Count of all txs - uint64 total_count = 1 [(gogoproto.moretags) = "yaml:\"total_count\"", (gogoproto.jsontag) = "total_count"]; - // Count of txs in current page - uint64 count = 2; - // Index of current page, start from 1 - uint64 page_number = 3 [(gogoproto.moretags) = "yaml:\"page_number\"", (gogoproto.jsontag) = "page_number"]; - // Count of total pages - uint64 page_total = 4 [(gogoproto.moretags) = "yaml:\"page_total\"", (gogoproto.jsontag) = "page_total"]; - // Max count txs per page - uint64 limit = 5; - // List of txs in current page - repeated TxResponse txs = 6; -} diff --git a/core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto b/core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto deleted file mode 100644 index 0e7a4691..00000000 --- a/core-sdk/proto/cosmos/base/kv/v1beta1/kv.proto +++ /dev/null @@ -1,17 +0,0 @@ -syntax = "proto3"; -package cosmos.base.kv.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/types/kv"; - -// Pairs defines a repeated slice of Pair objects. -message Pairs { - repeated Pair pairs = 1 [(gogoproto.nullable) = false]; -} - -// Pair defines a key/value bytes tuple. -message Pair { - bytes key = 1; - bytes value = 2; -} diff --git a/core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto b/core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto deleted file mode 100644 index 592782ee..00000000 --- a/core-sdk/proto/cosmos/base/query/v1beta1/pagination.proto +++ /dev/null @@ -1,50 +0,0 @@ -syntax = "proto3"; -package cosmos.base.query.v1beta1; - -option go_package = "github.com/irisnet/core-sdk-go/types/query"; - -// PageRequest is to be embedded in gRPC request messages for efficient -// pagination. Ex: -// -// message SomeRequest { -// Foo some_parameter = 1; -// PageRequest pagination = 2; -// } -message PageRequest { - // key is a value returned in PageResponse.next_key to begin - // querying the next page most efficiently. Only one of offset or key - // should be set. - bytes key = 1; - - // offset is a numeric offset that can be used when key is unavailable. - // It is less efficient than using key. Only one of offset or key should - // be set. - uint64 offset = 2; - - // limit is the total number of results to be returned in the result page. - // If left empty it will default to a value to be set by each app. - uint64 limit = 3; - - // count_total is set to true to indicate that the result set should include - // a count of the total number of items available for pagination in UIs. - // count_total is only respected when offset is used. It is ignored when key - // is set. - bool count_total = 4; -} - -// PageResponse is to be embedded in gRPC response messages where the -// corresponding request message has used PageRequest. -// -// message SomeResponse { -// repeated Bar results = 1; -// PageResponse page = 2; -// } -message PageResponse { - // next_key is the key to be passed to PageRequest.key to - // query the next page most efficiently - bytes next_key = 1; - - // total is total number of results available if PageRequest.count_total - // was set, its value is undefined otherwise - uint64 total = 2; -} diff --git a/core-sdk/proto/cosmos/base/v1beta1/coin.proto b/core-sdk/proto/cosmos/base/v1beta1/coin.proto deleted file mode 100644 index 624e562e..00000000 --- a/core-sdk/proto/cosmos/base/v1beta1/coin.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; -package cosmos.base.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/types"; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = false; - -// Coin defines a token with a denomination and an amount. -// -// NOTE: The amount field is an Int which implements the custom method -// signatures required by gogoproto. -message Coin { - option (gogoproto.equal) = true; - - string denom = 1; - string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; -} - -// DecCoin defines a token with a denomination and a decimal amount. -// -// NOTE: The amount field is an Dec which implements the custom method -// signatures required by gogoproto. -message DecCoin { - option (gogoproto.equal) = true; - - string denom = 1; - string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; -} - -// IntProto defines a Protobuf wrapper around an Int object. -message IntProto { - string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; -} - -// DecProto defines a Protobuf wrapper around a Dec object. -message DecProto { - string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; -} diff --git a/core-sdk/proto/cosmos/crypto/ed25519/keys.proto b/core-sdk/proto/cosmos/crypto/ed25519/keys.proto deleted file mode 100644 index 2d997102..00000000 --- a/core-sdk/proto/cosmos/crypto/ed25519/keys.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.ed25519; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/common/crypto/keys/ed25519"; - -// PubKey defines a ed25519 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -message PubKey { - option (gogoproto.goproto_stringer) = false; - - bytes key = 1; -} - -// PrivKey defines a ed25519 private key. -message PrivKey { - bytes key = 1; -} diff --git a/core-sdk/proto/cosmos/crypto/multisig/keys.proto b/core-sdk/proto/cosmos/crypto/multisig/keys.proto deleted file mode 100644 index a389783c..00000000 --- a/core-sdk/proto/cosmos/crypto/multisig/keys.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.multisig; - -import "gogoproto/gogo.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/common/crypto/keys/multisig"; - -// LegacyAminoPubKey specifies a public key type -// which nests multiple public keys and a threshold, -// it uses legacy amino address rules. -message LegacyAminoPubKey { - option (gogoproto.goproto_getters) = false; - - uint32 threshold = 1 [(gogoproto.moretags) = "yaml:\"threshold\""]; - repeated google.protobuf.Any public_keys = 2 - [(gogoproto.customname) = "PubKeys", (gogoproto.moretags) = "yaml:\"pubkeys\""]; -} diff --git a/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto b/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto deleted file mode 100644 index e14b42ce..00000000 --- a/core-sdk/proto/cosmos/crypto/multisig/v1beta1/multisig.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.multisig.v1beta1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/common/crypto/types"; - -// MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. -// See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers -// signed and with which modes. -message MultiSignature { - option (gogoproto.goproto_unrecognized) = true; - repeated bytes signatures = 1; -} - -// CompactBitArray is an implementation of a space efficient bit array. -// This is used to ensure that the encoded data takes up a minimal amount of -// space after proto encoding. -// This is not thread safe, and is not intended for concurrent usage. -message CompactBitArray { - option (gogoproto.goproto_stringer) = false; - - uint32 extra_bits_stored = 1; - bytes elems = 2; -} diff --git a/core-sdk/proto/cosmos/crypto/secp256k1/keys.proto b/core-sdk/proto/cosmos/crypto/secp256k1/keys.proto deleted file mode 100644 index d6e51b40..00000000 --- a/core-sdk/proto/cosmos/crypto/secp256k1/keys.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package cosmos.crypto.secp256k1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/common/crypto/keys/secp256k1"; - -// PubKey defines a secp256k1 public key -// Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte -// if the y-coordinate is the lexicographically largest of the two associated with -// the x-coordinate. Otherwise the first byte is a 0x03. -// This prefix is followed with the x-coordinate. -message PubKey { - option (gogoproto.goproto_stringer) = false; - - bytes key = 1; -} - -// PrivKey defines a secp256k1 private key. -message PrivKey { - bytes key = 1; -} diff --git a/core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto b/core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto deleted file mode 100644 index 48fe9914..00000000 --- a/core-sdk/proto/cosmos/tx/signing/v1beta1/signing.proto +++ /dev/null @@ -1,79 +0,0 @@ -syntax = "proto3"; -package cosmos.tx.signing.v1beta1; - -import "cosmos/crypto/multisig/v1beta1/multisig.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/types/tx/signing"; - -// SignMode represents a signing mode with its own security guarantees. -enum SignMode { - // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - // rejected - SIGN_MODE_UNSPECIFIED = 0; - - // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - // verified with raw bytes from Tx - SIGN_MODE_DIRECT = 1; - - // SIGN_MODE_TEXTUAL is a future signing mode that will verify some - // human-readable textual representation on top of the binary representation - // from SIGN_MODE_DIRECT - SIGN_MODE_TEXTUAL = 2; - - // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - // Amino JSON and will be removed in the future - SIGN_MODE_LEGACY_AMINO_JSON = 127; -} - -// SignatureDescriptors wraps multiple SignatureDescriptor's. -message SignatureDescriptors { - // signatures are the signature descriptors - repeated SignatureDescriptor signatures = 1; -} - -// SignatureDescriptor is a convenience type which represents the full data for -// a signature including the public key of the signer, signing modes and the -// signature itself. It is primarily used for coordinating signatures between -// clients. -message SignatureDescriptor { - // public_key is the public key of the signer - google.protobuf.Any public_key = 1; - - Data data = 2; - - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. - uint64 sequence = 3; - - // Data represents signature data - message Data { - // sum is the oneof that specifies whether this represents single or multi-signature data - oneof sum { - // single represents a single signer - Single single = 1; - - // multi represents a multisig signer - Multi multi = 2; - } - - // Single is the signature data for a single signer - message Single { - // mode is the signing mode of the single signer - SignMode mode = 1; - - // signature is the raw signature bytes - bytes signature = 2; - } - - // Multi is the signature data for a multisig public key - message Multi { - // bitarray specifies which keys within the multisig are signing - cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; - - // signatures is the signatures of the multi-signature - repeated Data signatures = 2; - } - } -} diff --git a/core-sdk/proto/cosmos/tx/v1beta1/tx.proto b/core-sdk/proto/cosmos/tx/v1beta1/tx.proto deleted file mode 100644 index 5f63d20c..00000000 --- a/core-sdk/proto/cosmos/tx/v1beta1/tx.proto +++ /dev/null @@ -1,182 +0,0 @@ -syntax = "proto3"; -package cosmos.tx.v1beta1; - -import "gogoproto/gogo.proto"; -import "cosmos/crypto/multisig/v1beta1/multisig.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "cosmos/tx/signing/v1beta1/signing.proto"; -import "google/protobuf/any.proto"; - -option go_package = "github.com/irisnet/core-sdk-go/types/tx"; - -// Tx is the standard type used for broadcasting transactions. -message Tx { - // body is the processable content of the transaction - TxBody body = 1; - - // auth_info is the authorization related content of the transaction, - // specifically signers, signer modes and fee - AuthInfo auth_info = 2; - - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - repeated bytes signatures = 3; -} - -// TxRaw is a variant of Tx that pins the signer's exact binary representation -// of body and auth_info. This is used for signing, broadcasting and -// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and -// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used -// as the transaction ID. -message TxRaw { - // body_bytes is a protobuf serialization of a TxBody that matches the - // representation in SignDoc. - bytes body_bytes = 1; - - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in SignDoc. - bytes auth_info_bytes = 2; - - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - repeated bytes signatures = 3; -} - -// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. -message SignDoc { - // body_bytes is protobuf serialization of a TxBody that matches the - // representation in TxRaw. - bytes body_bytes = 1; - - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in TxRaw. - bytes auth_info_bytes = 2; - - // chain_id is the unique identifier of the chain this transaction targets. - // It prevents signed transactions from being used on another chain by an - // attacker - string chain_id = 3; - - // account_number is the account number of the account in state - uint64 account_number = 4; -} - -// TxBody is the body of a transaction that all signers sign over. -message TxBody { - // messages is a list of messages to be executed. The required signers of - // those messages define the number and order of elements in AuthInfo's - // signer_infos and Tx's signatures. Each required signer address is added to - // the list only the first time it occurs. - // - // By convention, the first required signer (usually from the first message) - // is referred to as the primary signer and pays the fee for the whole - // transaction. - repeated google.protobuf.Any messages = 1; - - // memo is any arbitrary memo to be added to the transaction - string memo = 2; - - // timeout is the block height after which this transaction will not - // be processed by the chain - uint64 timeout_height = 3; - - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, the transaction will be rejected - repeated google.protobuf.Any extension_options = 1023; - - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, they will be ignored - repeated google.protobuf.Any non_critical_extension_options = 2047; -} - -// AuthInfo describes the fee and signer modes that are used to sign a -// transaction. -message AuthInfo { - // signer_infos defines the signing modes for the required signers. The number - // and order of elements must match the required signers from TxBody's - // messages. The first element is the primary signer and the one which pays - // the fee. - repeated SignerInfo signer_infos = 1; - - // Fee is the fee and gas limit for the transaction. The first signer is the - // primary signer and the one which pays the fee. The fee can be calculated - // based on the cost of evaluating the body and doing signature verification - // of the signers. This can be estimated via simulation. - Fee fee = 2; -} - -// SignerInfo describes the public key and signing mode of a single top-level -// signer. -message SignerInfo { - // public_key is the public key of the signer. It is optional for accounts - // that already exist in state. If unset, the verifier can use the required \ - // signer address for this position and lookup the public key. - google.protobuf.Any public_key = 1; - - // mode_info describes the signing mode of the signer and is a nested - // structure to support nested multisig pubkey's - ModeInfo mode_info = 2; - - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to - // prevent replay attacks. - uint64 sequence = 3; -} - -// ModeInfo describes the signing mode of a single or nested multisig signer. -message ModeInfo { - // sum is the oneof that specifies whether this represents a single or nested - // multisig signer - oneof sum { - // single represents a single signer - Single single = 1; - - // multi represents a nested multisig signer - Multi multi = 2; - } - - // Single is the mode info for a single signer. It is structured as a message - // to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the - // future - message Single { - // mode is the signing mode of the single signer - cosmos.tx.signing.v1beta1.SignMode mode = 1; - } - - // Multi is the mode info for a multisig public key - message Multi { - // bitarray specifies which keys within the multisig are signing - cosmos.crypto.multisig.v1beta1.CompactBitArray bitarray = 1; - - // mode_infos is the corresponding modes of the signers of the multisig - // which could include nested multisig public keys - repeated ModeInfo mode_infos = 2; - } -} - -// Fee includes the amount of coins paid in fees and the maximum -// gas to be used by the transaction. The ratio yields an effective "gasprice", -// which must be above some miminum to be accepted into the mempool. -message Fee { - // amount is the amount of coins to be paid as a fee - repeated cosmos.base.v1beta1.Coin amount = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/irisnet/core-sdk-go/types.Coins"]; - - // gas_limit is the maximum gas that can be used in transaction processing - // before an out of gas error occurs - uint64 gas_limit = 2; - - // if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - // the payer must be a tx signer (and thus have signed this field in AuthInfo). - // setting this field does *not* change the ordering of required signers for the transaction. - string payer = 3; - - // if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - // to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - // not support fee grants, this will fail - string granter = 4; -} diff --git a/core-sdk/readme.md b/core-sdk/readme.md deleted file mode 100644 index 26b8df93..00000000 --- a/core-sdk/readme.md +++ /dev/null @@ -1,15 +0,0 @@ -# core-sdk -irishub-core-sdk - - -The Core-SDK contains the following core functions - -- Auth module; - -- Bank module; - -- Keys module; - - Keys requires an interface designed to support SM2 (for the federation chain IRITA) - - At present, Keys is mainly the entrance, and the actual logic is in Crypto -- base_client. go - diff --git a/core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go b/core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go deleted file mode 100644 index a8c7021c..00000000 --- a/core-sdk/third_party/github.com/confio/ics23/go/proofs.pb.go +++ /dev/null @@ -1,4590 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: confio/proofs.proto - -package _go - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/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 - -type HashOp int32 - -const ( - // NO_HASH is the default if no data passed. Note this is an illegal argument some places. - HashOp_NO_HASH HashOp = 0 - HashOp_SHA256 HashOp = 1 - HashOp_SHA512 HashOp = 2 - HashOp_KECCAK HashOp = 3 - HashOp_RIPEMD160 HashOp = 4 - HashOp_BITCOIN HashOp = 5 -) - -var HashOp_name = map[int32]string{ - 0: "NO_HASH", - 1: "SHA256", - 2: "SHA512", - 3: "KECCAK", - 4: "RIPEMD160", - 5: "BITCOIN", -} - -var HashOp_value = map[string]int32{ - "NO_HASH": 0, - "SHA256": 1, - "SHA512": 2, - "KECCAK": 3, - "RIPEMD160": 4, - "BITCOIN": 5, -} - -func (x HashOp) String() string { - return proto.EnumName(HashOp_name, int32(x)) -} - -func (HashOp) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{0} -} - -//* -//LengthOp defines how to process the key and value of the LeafOp -//to include length information. After encoding the length with the given -//algorithm, the length will be prepended to the key and value bytes. -//(Each one with it's own encoded length) -type LengthOp int32 - -const ( - // NO_PREFIX don't include any length info - LengthOp_NO_PREFIX LengthOp = 0 - // VAR_PROTO uses protobuf (and go-amino) varint encoding of the length - LengthOp_VAR_PROTO LengthOp = 1 - // VAR_RLP uses rlp int encoding of the length - LengthOp_VAR_RLP LengthOp = 2 - // FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer - LengthOp_FIXED32_BIG LengthOp = 3 - // FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer - LengthOp_FIXED32_LITTLE LengthOp = 4 - // FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer - LengthOp_FIXED64_BIG LengthOp = 5 - // FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer - LengthOp_FIXED64_LITTLE LengthOp = 6 - // REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) - LengthOp_REQUIRE_32_BYTES LengthOp = 7 - // REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) - LengthOp_REQUIRE_64_BYTES LengthOp = 8 -) - -var LengthOp_name = map[int32]string{ - 0: "NO_PREFIX", - 1: "VAR_PROTO", - 2: "VAR_RLP", - 3: "FIXED32_BIG", - 4: "FIXED32_LITTLE", - 5: "FIXED64_BIG", - 6: "FIXED64_LITTLE", - 7: "REQUIRE_32_BYTES", - 8: "REQUIRE_64_BYTES", -} - -var LengthOp_value = map[string]int32{ - "NO_PREFIX": 0, - "VAR_PROTO": 1, - "VAR_RLP": 2, - "FIXED32_BIG": 3, - "FIXED32_LITTLE": 4, - "FIXED64_BIG": 5, - "FIXED64_LITTLE": 6, - "REQUIRE_32_BYTES": 7, - "REQUIRE_64_BYTES": 8, -} - -func (x LengthOp) String() string { - return proto.EnumName(LengthOp_name, int32(x)) -} - -func (LengthOp) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{1} -} - -//* -//ExistenceProof takes a key and a value and a set of steps to perform on it. -//The result of peforming all these steps will provide a "root hash", which can -//be compared to the value in a header. -// -//Since it is computationally infeasible to produce a hash collission for any of the used -//cryptographic hash functions, if someone can provide a series of operations to transform -//a given key and value into a root hash that matches some trusted root, these key and values -//must be in the referenced merkle tree. -// -//The only possible issue is maliablity in LeafOp, such as providing extra prefix data, -//which should be controlled by a spec. Eg. with lengthOp as NONE, -//prefix = FOO, key = BAR, value = CHOICE -//and -//prefix = F, key = OOBAR, value = CHOICE -//would produce the same value. -// -//With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field -//in the ProofSpec is valuable to prevent this mutability. And why all trees should -//length-prefix the data before hashing it. -type ExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Leaf *LeafOp `protobuf:"bytes,3,opt,name=leaf,proto3" json:"leaf,omitempty"` - Path []*InnerOp `protobuf:"bytes,4,rep,name=path,proto3" json:"path,omitempty"` -} - -func (m *ExistenceProof) Reset() { *m = ExistenceProof{} } -func (m *ExistenceProof) String() string { return proto.CompactTextString(m) } -func (*ExistenceProof) ProtoMessage() {} -func (*ExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{0} -} -func (m *ExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExistenceProof.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 *ExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExistenceProof.Merge(m, src) -} -func (m *ExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *ExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_ExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_ExistenceProof proto.InternalMessageInfo - -func (m *ExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *ExistenceProof) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *ExistenceProof) GetLeaf() *LeafOp { - if m != nil { - return m.Leaf - } - return nil -} - -func (m *ExistenceProof) GetPath() []*InnerOp { - if m != nil { - return m.Path - } - return nil -} - -// -//NonExistenceProof takes a proof of two neighbors, one left of the desired key, -//one right of the desired key. If both proofs are valid AND they are neighbors, -//then there is no valid proof for the given key. -type NonExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Left *ExistenceProof `protobuf:"bytes,2,opt,name=left,proto3" json:"left,omitempty"` - Right *ExistenceProof `protobuf:"bytes,3,opt,name=right,proto3" json:"right,omitempty"` -} - -func (m *NonExistenceProof) Reset() { *m = NonExistenceProof{} } -func (m *NonExistenceProof) String() string { return proto.CompactTextString(m) } -func (*NonExistenceProof) ProtoMessage() {} -func (*NonExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{1} -} -func (m *NonExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *NonExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NonExistenceProof.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 *NonExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_NonExistenceProof.Merge(m, src) -} -func (m *NonExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *NonExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_NonExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_NonExistenceProof proto.InternalMessageInfo - -func (m *NonExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *NonExistenceProof) GetLeft() *ExistenceProof { - if m != nil { - return m.Left - } - return nil -} - -func (m *NonExistenceProof) GetRight() *ExistenceProof { - if m != nil { - return m.Right - } - return nil -} - -// -//CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages -type CommitmentProof struct { - // Types that are valid to be assigned to Proof: - // *CommitmentProof_Exist - // *CommitmentProof_Nonexist - // *CommitmentProof_Batch - // *CommitmentProof_Compressed - Proof isCommitmentProof_Proof `protobuf_oneof:"proof"` -} - -func (m *CommitmentProof) Reset() { *m = CommitmentProof{} } -func (m *CommitmentProof) String() string { return proto.CompactTextString(m) } -func (*CommitmentProof) ProtoMessage() {} -func (*CommitmentProof) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{2} -} -func (m *CommitmentProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CommitmentProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CommitmentProof.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 *CommitmentProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommitmentProof.Merge(m, src) -} -func (m *CommitmentProof) XXX_Size() int { - return m.Size() -} -func (m *CommitmentProof) XXX_DiscardUnknown() { - xxx_messageInfo_CommitmentProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CommitmentProof proto.InternalMessageInfo - -type isCommitmentProof_Proof interface { - isCommitmentProof_Proof() - MarshalTo([]byte) (int, error) - Size() int -} - -type CommitmentProof_Exist struct { - Exist *ExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` -} -type CommitmentProof_Nonexist struct { - Nonexist *NonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` -} -type CommitmentProof_Batch struct { - Batch *BatchProof `protobuf:"bytes,3,opt,name=batch,proto3,oneof" json:"batch,omitempty"` -} -type CommitmentProof_Compressed struct { - Compressed *CompressedBatchProof `protobuf:"bytes,4,opt,name=compressed,proto3,oneof" json:"compressed,omitempty"` -} - -func (*CommitmentProof_Exist) isCommitmentProof_Proof() {} -func (*CommitmentProof_Nonexist) isCommitmentProof_Proof() {} -func (*CommitmentProof_Batch) isCommitmentProof_Proof() {} -func (*CommitmentProof_Compressed) isCommitmentProof_Proof() {} - -func (m *CommitmentProof) GetProof() isCommitmentProof_Proof { - if m != nil { - return m.Proof - } - return nil -} - -func (m *CommitmentProof) GetExist() *ExistenceProof { - if x, ok := m.GetProof().(*CommitmentProof_Exist); ok { - return x.Exist - } - return nil -} - -func (m *CommitmentProof) GetNonexist() *NonExistenceProof { - if x, ok := m.GetProof().(*CommitmentProof_Nonexist); ok { - return x.Nonexist - } - return nil -} - -func (m *CommitmentProof) GetBatch() *BatchProof { - if x, ok := m.GetProof().(*CommitmentProof_Batch); ok { - return x.Batch - } - return nil -} - -func (m *CommitmentProof) GetCompressed() *CompressedBatchProof { - if x, ok := m.GetProof().(*CommitmentProof_Compressed); ok { - return x.Compressed - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*CommitmentProof) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*CommitmentProof_Exist)(nil), - (*CommitmentProof_Nonexist)(nil), - (*CommitmentProof_Batch)(nil), - (*CommitmentProof_Compressed)(nil), - } -} - -//* -//LeafOp represents the raw key-value data we wish to prove, and -//must be flexible to represent the internal transformation from -//the original key-value pairs into the basis hash, for many existing -//merkle trees. -// -//key and value are passed in. So that the signature of this operation is: -//leafOp(key, value) -> output -// -//To process this, first prehash the keys and values if needed (ANY means no hash in this case): -//hkey = prehashKey(key) -//hvalue = prehashValue(value) -// -//Then combine the bytes, and hash it -//output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) -type LeafOp struct { - Hash HashOp `protobuf:"varint,1,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` - PrehashKey HashOp `protobuf:"varint,2,opt,name=prehash_key,json=prehashKey,proto3,enum=ics23.HashOp" json:"prehash_key,omitempty"` - PrehashValue HashOp `protobuf:"varint,3,opt,name=prehash_value,json=prehashValue,proto3,enum=ics23.HashOp" json:"prehash_value,omitempty"` - Length LengthOp `protobuf:"varint,4,opt,name=length,proto3,enum=ics23.LengthOp" json:"length,omitempty"` - // prefix is a fixed bytes that may optionally be included at the beginning to differentiate - // a leaf node from an inner node. - Prefix []byte `protobuf:"bytes,5,opt,name=prefix,proto3" json:"prefix,omitempty"` -} - -func (m *LeafOp) Reset() { *m = LeafOp{} } -func (m *LeafOp) String() string { return proto.CompactTextString(m) } -func (*LeafOp) ProtoMessage() {} -func (*LeafOp) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{3} -} -func (m *LeafOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LeafOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LeafOp.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 *LeafOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_LeafOp.Merge(m, src) -} -func (m *LeafOp) XXX_Size() int { - return m.Size() -} -func (m *LeafOp) XXX_DiscardUnknown() { - xxx_messageInfo_LeafOp.DiscardUnknown(m) -} - -var xxx_messageInfo_LeafOp proto.InternalMessageInfo - -func (m *LeafOp) GetHash() HashOp { - if m != nil { - return m.Hash - } - return HashOp_NO_HASH -} - -func (m *LeafOp) GetPrehashKey() HashOp { - if m != nil { - return m.PrehashKey - } - return HashOp_NO_HASH -} - -func (m *LeafOp) GetPrehashValue() HashOp { - if m != nil { - return m.PrehashValue - } - return HashOp_NO_HASH -} - -func (m *LeafOp) GetLength() LengthOp { - if m != nil { - return m.Length - } - return LengthOp_NO_PREFIX -} - -func (m *LeafOp) GetPrefix() []byte { - if m != nil { - return m.Prefix - } - return nil -} - -//* -//InnerOp represents a merkle-proof step that is not a leaf. -//It represents concatenating two children and hashing them to provide the next result. -// -//The result of the previous step is passed in, so the signature of this op is: -//innerOp(child) -> output -// -//The result of applying InnerOp should be: -//output = op.hash(op.prefix || child || op.suffix) -// -//where the || operator is concatenation of binary data, -//and child is the result of hashing all the tree below this step. -// -//Any special data, like prepending child with the length, or prepending the entire operation with -//some value to differentiate from leaf nodes, should be included in prefix and suffix. -//If either of prefix or suffix is empty, we just treat it as an empty string -type InnerOp struct { - Hash HashOp `protobuf:"varint,1,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` - Prefix []byte `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` - Suffix []byte `protobuf:"bytes,3,opt,name=suffix,proto3" json:"suffix,omitempty"` -} - -func (m *InnerOp) Reset() { *m = InnerOp{} } -func (m *InnerOp) String() string { return proto.CompactTextString(m) } -func (*InnerOp) ProtoMessage() {} -func (*InnerOp) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{4} -} -func (m *InnerOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InnerOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InnerOp.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 *InnerOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_InnerOp.Merge(m, src) -} -func (m *InnerOp) XXX_Size() int { - return m.Size() -} -func (m *InnerOp) XXX_DiscardUnknown() { - xxx_messageInfo_InnerOp.DiscardUnknown(m) -} - -var xxx_messageInfo_InnerOp proto.InternalMessageInfo - -func (m *InnerOp) GetHash() HashOp { - if m != nil { - return m.Hash - } - return HashOp_NO_HASH -} - -func (m *InnerOp) GetPrefix() []byte { - if m != nil { - return m.Prefix - } - return nil -} - -func (m *InnerOp) GetSuffix() []byte { - if m != nil { - return m.Suffix - } - return nil -} - -//* -//ProofSpec defines what the expected parameters are for a given proof type. -//This can be stored in the client and used to validate any incoming proofs. -// -//verify(ProofSpec, Proof) -> Proof | Error -// -//As demonstrated in tests, if we don't fix the algorithm used to calculate the -//LeafHash for a given tree, there are many possible key-value pairs that can -//generate a given hash (by interpretting the preimage differently). -//We need this for proper security, requires client knows a priori what -//tree format server uses. But not in code, rather a configuration object. -type ProofSpec struct { - // any field in the ExistenceProof must be the same as in this spec. - // except Prefix, which is just the first bytes of prefix (spec can be longer) - LeafSpec *LeafOp `protobuf:"bytes,1,opt,name=leaf_spec,json=leafSpec,proto3" json:"leaf_spec,omitempty"` - InnerSpec *InnerSpec `protobuf:"bytes,2,opt,name=inner_spec,json=innerSpec,proto3" json:"inner_spec,omitempty"` - // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) - MaxDepth int32 `protobuf:"varint,3,opt,name=max_depth,json=maxDepth,proto3" json:"max_depth,omitempty"` - // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) - MinDepth int32 `protobuf:"varint,4,opt,name=min_depth,json=minDepth,proto3" json:"min_depth,omitempty"` -} - -func (m *ProofSpec) Reset() { *m = ProofSpec{} } -func (m *ProofSpec) String() string { return proto.CompactTextString(m) } -func (*ProofSpec) ProtoMessage() {} -func (*ProofSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{5} -} -func (m *ProofSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProofSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProofSpec.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 *ProofSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProofSpec.Merge(m, src) -} -func (m *ProofSpec) XXX_Size() int { - return m.Size() -} -func (m *ProofSpec) XXX_DiscardUnknown() { - xxx_messageInfo_ProofSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_ProofSpec proto.InternalMessageInfo - -func (m *ProofSpec) GetLeafSpec() *LeafOp { - if m != nil { - return m.LeafSpec - } - return nil -} - -func (m *ProofSpec) GetInnerSpec() *InnerSpec { - if m != nil { - return m.InnerSpec - } - return nil -} - -func (m *ProofSpec) GetMaxDepth() int32 { - if m != nil { - return m.MaxDepth - } - return 0 -} - -func (m *ProofSpec) GetMinDepth() int32 { - if m != nil { - return m.MinDepth - } - return 0 -} - -// -//InnerSpec contains all store-specific structure info to determine if two proofs from a -//given store are neighbors. -// -//This enables: -// -//isLeftMost(spec: InnerSpec, op: InnerOp) -//isRightMost(spec: InnerSpec, op: InnerOp) -//isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) -type InnerSpec struct { - // Child order is the ordering of the children node, must count from 0 - // iavl tree is [0, 1] (left then right) - // merk is [0, 2, 1] (left, right, here) - ChildOrder []int32 `protobuf:"varint,1,rep,packed,name=child_order,json=childOrder,proto3" json:"child_order,omitempty"` - ChildSize int32 `protobuf:"varint,2,opt,name=child_size,json=childSize,proto3" json:"child_size,omitempty"` - MinPrefixLength int32 `protobuf:"varint,3,opt,name=min_prefix_length,json=minPrefixLength,proto3" json:"min_prefix_length,omitempty"` - MaxPrefixLength int32 `protobuf:"varint,4,opt,name=max_prefix_length,json=maxPrefixLength,proto3" json:"max_prefix_length,omitempty"` - // empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) - EmptyChild []byte `protobuf:"bytes,5,opt,name=empty_child,json=emptyChild,proto3" json:"empty_child,omitempty"` - // hash is the algorithm that must be used for each InnerOp - Hash HashOp `protobuf:"varint,6,opt,name=hash,proto3,enum=ics23.HashOp" json:"hash,omitempty"` -} - -func (m *InnerSpec) Reset() { *m = InnerSpec{} } -func (m *InnerSpec) String() string { return proto.CompactTextString(m) } -func (*InnerSpec) ProtoMessage() {} -func (*InnerSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{6} -} -func (m *InnerSpec) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InnerSpec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InnerSpec.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 *InnerSpec) XXX_Merge(src proto.Message) { - xxx_messageInfo_InnerSpec.Merge(m, src) -} -func (m *InnerSpec) XXX_Size() int { - return m.Size() -} -func (m *InnerSpec) XXX_DiscardUnknown() { - xxx_messageInfo_InnerSpec.DiscardUnknown(m) -} - -var xxx_messageInfo_InnerSpec proto.InternalMessageInfo - -func (m *InnerSpec) GetChildOrder() []int32 { - if m != nil { - return m.ChildOrder - } - return nil -} - -func (m *InnerSpec) GetChildSize() int32 { - if m != nil { - return m.ChildSize - } - return 0 -} - -func (m *InnerSpec) GetMinPrefixLength() int32 { - if m != nil { - return m.MinPrefixLength - } - return 0 -} - -func (m *InnerSpec) GetMaxPrefixLength() int32 { - if m != nil { - return m.MaxPrefixLength - } - return 0 -} - -func (m *InnerSpec) GetEmptyChild() []byte { - if m != nil { - return m.EmptyChild - } - return nil -} - -func (m *InnerSpec) GetHash() HashOp { - if m != nil { - return m.Hash - } - return HashOp_NO_HASH -} - -// -//BatchProof is a group of multiple proof types than can be compressed -type BatchProof struct { - Entries []*BatchEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (m *BatchProof) Reset() { *m = BatchProof{} } -func (m *BatchProof) String() string { return proto.CompactTextString(m) } -func (*BatchProof) ProtoMessage() {} -func (*BatchProof) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{7} -} -func (m *BatchProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BatchProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BatchProof.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 *BatchProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchProof.Merge(m, src) -} -func (m *BatchProof) XXX_Size() int { - return m.Size() -} -func (m *BatchProof) XXX_DiscardUnknown() { - xxx_messageInfo_BatchProof.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchProof proto.InternalMessageInfo - -func (m *BatchProof) GetEntries() []*BatchEntry { - if m != nil { - return m.Entries - } - return nil -} - -// Use BatchEntry not CommitmentProof, to avoid recursion -type BatchEntry struct { - // Types that are valid to be assigned to Proof: - // *BatchEntry_Exist - // *BatchEntry_Nonexist - Proof isBatchEntry_Proof `protobuf_oneof:"proof"` -} - -func (m *BatchEntry) Reset() { *m = BatchEntry{} } -func (m *BatchEntry) String() string { return proto.CompactTextString(m) } -func (*BatchEntry) ProtoMessage() {} -func (*BatchEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{8} -} -func (m *BatchEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BatchEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BatchEntry.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 *BatchEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchEntry.Merge(m, src) -} -func (m *BatchEntry) XXX_Size() int { - return m.Size() -} -func (m *BatchEntry) XXX_DiscardUnknown() { - xxx_messageInfo_BatchEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchEntry proto.InternalMessageInfo - -type isBatchEntry_Proof interface { - isBatchEntry_Proof() - MarshalTo([]byte) (int, error) - Size() int -} - -type BatchEntry_Exist struct { - Exist *ExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` -} -type BatchEntry_Nonexist struct { - Nonexist *NonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` -} - -func (*BatchEntry_Exist) isBatchEntry_Proof() {} -func (*BatchEntry_Nonexist) isBatchEntry_Proof() {} - -func (m *BatchEntry) GetProof() isBatchEntry_Proof { - if m != nil { - return m.Proof - } - return nil -} - -func (m *BatchEntry) GetExist() *ExistenceProof { - if x, ok := m.GetProof().(*BatchEntry_Exist); ok { - return x.Exist - } - return nil -} - -func (m *BatchEntry) GetNonexist() *NonExistenceProof { - if x, ok := m.GetProof().(*BatchEntry_Nonexist); ok { - return x.Nonexist - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*BatchEntry) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*BatchEntry_Exist)(nil), - (*BatchEntry_Nonexist)(nil), - } -} - -type CompressedBatchProof struct { - Entries []*CompressedBatchEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` - LookupInners []*InnerOp `protobuf:"bytes,2,rep,name=lookup_inners,json=lookupInners,proto3" json:"lookup_inners,omitempty"` -} - -func (m *CompressedBatchProof) Reset() { *m = CompressedBatchProof{} } -func (m *CompressedBatchProof) String() string { return proto.CompactTextString(m) } -func (*CompressedBatchProof) ProtoMessage() {} -func (*CompressedBatchProof) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{9} -} -func (m *CompressedBatchProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedBatchProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedBatchProof.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 *CompressedBatchProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedBatchProof.Merge(m, src) -} -func (m *CompressedBatchProof) XXX_Size() int { - return m.Size() -} -func (m *CompressedBatchProof) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedBatchProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedBatchProof proto.InternalMessageInfo - -func (m *CompressedBatchProof) GetEntries() []*CompressedBatchEntry { - if m != nil { - return m.Entries - } - return nil -} - -func (m *CompressedBatchProof) GetLookupInners() []*InnerOp { - if m != nil { - return m.LookupInners - } - return nil -} - -// Use BatchEntry not CommitmentProof, to avoid recursion -type CompressedBatchEntry struct { - // Types that are valid to be assigned to Proof: - // *CompressedBatchEntry_Exist - // *CompressedBatchEntry_Nonexist - Proof isCompressedBatchEntry_Proof `protobuf_oneof:"proof"` -} - -func (m *CompressedBatchEntry) Reset() { *m = CompressedBatchEntry{} } -func (m *CompressedBatchEntry) String() string { return proto.CompactTextString(m) } -func (*CompressedBatchEntry) ProtoMessage() {} -func (*CompressedBatchEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{10} -} -func (m *CompressedBatchEntry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedBatchEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedBatchEntry.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 *CompressedBatchEntry) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedBatchEntry.Merge(m, src) -} -func (m *CompressedBatchEntry) XXX_Size() int { - return m.Size() -} -func (m *CompressedBatchEntry) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedBatchEntry.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedBatchEntry proto.InternalMessageInfo - -type isCompressedBatchEntry_Proof interface { - isCompressedBatchEntry_Proof() - MarshalTo([]byte) (int, error) - Size() int -} - -type CompressedBatchEntry_Exist struct { - Exist *CompressedExistenceProof `protobuf:"bytes,1,opt,name=exist,proto3,oneof" json:"exist,omitempty"` -} -type CompressedBatchEntry_Nonexist struct { - Nonexist *CompressedNonExistenceProof `protobuf:"bytes,2,opt,name=nonexist,proto3,oneof" json:"nonexist,omitempty"` -} - -func (*CompressedBatchEntry_Exist) isCompressedBatchEntry_Proof() {} -func (*CompressedBatchEntry_Nonexist) isCompressedBatchEntry_Proof() {} - -func (m *CompressedBatchEntry) GetProof() isCompressedBatchEntry_Proof { - if m != nil { - return m.Proof - } - return nil -} - -func (m *CompressedBatchEntry) GetExist() *CompressedExistenceProof { - if x, ok := m.GetProof().(*CompressedBatchEntry_Exist); ok { - return x.Exist - } - return nil -} - -func (m *CompressedBatchEntry) GetNonexist() *CompressedNonExistenceProof { - if x, ok := m.GetProof().(*CompressedBatchEntry_Nonexist); ok { - return x.Nonexist - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*CompressedBatchEntry) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*CompressedBatchEntry_Exist)(nil), - (*CompressedBatchEntry_Nonexist)(nil), - } -} - -type CompressedExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Leaf *LeafOp `protobuf:"bytes,3,opt,name=leaf,proto3" json:"leaf,omitempty"` - // these are indexes into the lookup_inners table in CompressedBatchProof - Path []int32 `protobuf:"varint,4,rep,packed,name=path,proto3" json:"path,omitempty"` -} - -func (m *CompressedExistenceProof) Reset() { *m = CompressedExistenceProof{} } -func (m *CompressedExistenceProof) String() string { return proto.CompactTextString(m) } -func (*CompressedExistenceProof) ProtoMessage() {} -func (*CompressedExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{11} -} -func (m *CompressedExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedExistenceProof.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 *CompressedExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedExistenceProof.Merge(m, src) -} -func (m *CompressedExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *CompressedExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedExistenceProof proto.InternalMessageInfo - -func (m *CompressedExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *CompressedExistenceProof) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func (m *CompressedExistenceProof) GetLeaf() *LeafOp { - if m != nil { - return m.Leaf - } - return nil -} - -func (m *CompressedExistenceProof) GetPath() []int32 { - if m != nil { - return m.Path - } - return nil -} - -type CompressedNonExistenceProof struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Left *CompressedExistenceProof `protobuf:"bytes,2,opt,name=left,proto3" json:"left,omitempty"` - Right *CompressedExistenceProof `protobuf:"bytes,3,opt,name=right,proto3" json:"right,omitempty"` -} - -func (m *CompressedNonExistenceProof) Reset() { *m = CompressedNonExistenceProof{} } -func (m *CompressedNonExistenceProof) String() string { return proto.CompactTextString(m) } -func (*CompressedNonExistenceProof) ProtoMessage() {} -func (*CompressedNonExistenceProof) Descriptor() ([]byte, []int) { - return fileDescriptor_b2da35c4bc0b23b9, []int{12} -} -func (m *CompressedNonExistenceProof) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CompressedNonExistenceProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CompressedNonExistenceProof.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 *CompressedNonExistenceProof) XXX_Merge(src proto.Message) { - xxx_messageInfo_CompressedNonExistenceProof.Merge(m, src) -} -func (m *CompressedNonExistenceProof) XXX_Size() int { - return m.Size() -} -func (m *CompressedNonExistenceProof) XXX_DiscardUnknown() { - xxx_messageInfo_CompressedNonExistenceProof.DiscardUnknown(m) -} - -var xxx_messageInfo_CompressedNonExistenceProof proto.InternalMessageInfo - -func (m *CompressedNonExistenceProof) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *CompressedNonExistenceProof) GetLeft() *CompressedExistenceProof { - if m != nil { - return m.Left - } - return nil -} - -func (m *CompressedNonExistenceProof) GetRight() *CompressedExistenceProof { - if m != nil { - return m.Right - } - return nil -} - -func init() { - proto.RegisterEnum("ics23.HashOp", HashOp_name, HashOp_value) - proto.RegisterEnum("ics23.LengthOp", LengthOp_name, LengthOp_value) - proto.RegisterType((*ExistenceProof)(nil), "ics23.ExistenceProof") - proto.RegisterType((*NonExistenceProof)(nil), "ics23.NonExistenceProof") - proto.RegisterType((*CommitmentProof)(nil), "ics23.CommitmentProof") - proto.RegisterType((*LeafOp)(nil), "ics23.LeafOp") - proto.RegisterType((*InnerOp)(nil), "ics23.InnerOp") - proto.RegisterType((*ProofSpec)(nil), "ics23.ProofSpec") - proto.RegisterType((*InnerSpec)(nil), "ics23.InnerSpec") - proto.RegisterType((*BatchProof)(nil), "ics23.BatchProof") - proto.RegisterType((*BatchEntry)(nil), "ics23.BatchEntry") - proto.RegisterType((*CompressedBatchProof)(nil), "ics23.CompressedBatchProof") - proto.RegisterType((*CompressedBatchEntry)(nil), "ics23.CompressedBatchEntry") - proto.RegisterType((*CompressedExistenceProof)(nil), "ics23.CompressedExistenceProof") - proto.RegisterType((*CompressedNonExistenceProof)(nil), "ics23.CompressedNonExistenceProof") -} - -func init() { proto.RegisterFile("confio/proofs.proto", fileDescriptor_b2da35c4bc0b23b9) } - -var fileDescriptor_b2da35c4bc0b23b9 = []byte{ - // 961 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x96, 0x4b, 0x6f, 0xeb, 0x44, - 0x14, 0xc7, 0xe3, 0x24, 0xce, 0xe3, 0xa4, 0x0f, 0x77, 0x28, 0xc8, 0xa2, 0x22, 0x2d, 0xde, 0xd0, - 0xdb, 0x2b, 0x52, 0x6e, 0xd2, 0x06, 0xb1, 0x40, 0xa2, 0x49, 0x7d, 0x89, 0xd5, 0xd2, 0x84, 0x49, - 0xee, 0xd5, 0x05, 0x21, 0x59, 0xae, 0x3b, 0x69, 0xac, 0x1b, 0x3f, 0x64, 0xbb, 0x28, 0xb9, 0x02, - 0x21, 0xf1, 0x09, 0x58, 0xc3, 0x8e, 0x2d, 0x5f, 0x84, 0x65, 0x97, 0x2c, 0x51, 0xbb, 0x60, 0xc1, - 0x97, 0x40, 0xf3, 0x88, 0x9b, 0x34, 0x09, 0xed, 0x02, 0xb1, 0x9b, 0xf9, 0x9f, 0xdf, 0x99, 0x39, - 0x73, 0xce, 0x19, 0x8f, 0xe1, 0x2d, 0xdb, 0xf7, 0xfa, 0x8e, 0xbf, 0x1f, 0x84, 0xbe, 0xdf, 0x8f, - 0x2a, 0x41, 0xe8, 0xc7, 0x3e, 0x92, 0x1d, 0x3b, 0xaa, 0xd6, 0xb4, 0x1f, 0x60, 0x4d, 0x1f, 0x39, - 0x51, 0x4c, 0x3c, 0x9b, 0x74, 0xa8, 0x1d, 0x29, 0x90, 0x79, 0x4d, 0xc6, 0xaa, 0xb4, 0x23, 0xed, - 0xae, 0x60, 0x3a, 0x44, 0x9b, 0x20, 0x7f, 0x6b, 0x0d, 0xaf, 0x88, 0x9a, 0x66, 0x1a, 0x9f, 0xa0, - 0xf7, 0x21, 0x3b, 0x24, 0x56, 0x5f, 0xcd, 0xec, 0x48, 0xbb, 0xa5, 0xea, 0x6a, 0x85, 0xad, 0x57, - 0x39, 0x25, 0x56, 0xbf, 0x1d, 0x60, 0x66, 0x42, 0x1a, 0x64, 0x03, 0x2b, 0x1e, 0xa8, 0xd9, 0x9d, - 0xcc, 0x6e, 0xa9, 0xba, 0x26, 0x10, 0xc3, 0xf3, 0x48, 0x48, 0x19, 0x6a, 0xd3, 0xbe, 0x87, 0x8d, - 0x33, 0xdf, 0x7b, 0x30, 0x86, 0x27, 0x74, 0xb7, 0x7e, 0xcc, 0x42, 0x28, 0x55, 0xdf, 0x16, 0x4b, - 0xcd, 0xba, 0x61, 0x86, 0xa0, 0xa7, 0x20, 0x87, 0xce, 0xe5, 0x20, 0x16, 0x91, 0x2d, 0x61, 0x39, - 0xa3, 0xfd, 0x2d, 0xc1, 0x7a, 0xd3, 0x77, 0x5d, 0x27, 0x76, 0x89, 0x17, 0xf3, 0xdd, 0x3f, 0x04, - 0x99, 0x50, 0x98, 0xed, 0xbf, 0x6c, 0x81, 0x56, 0x0a, 0x73, 0x0a, 0xd5, 0xa1, 0xe0, 0xf9, 0x1e, - 0xf7, 0xe0, 0xe1, 0xa9, 0xc2, 0x63, 0xee, 0x60, 0xad, 0x14, 0x4e, 0x58, 0xf4, 0x04, 0xe4, 0x73, - 0x2b, 0xb6, 0x07, 0x22, 0xce, 0x0d, 0xe1, 0xd4, 0xa0, 0x5a, 0xb2, 0x05, 0x23, 0xd0, 0xa7, 0x00, - 0xb6, 0xef, 0x06, 0x21, 0x89, 0x22, 0x72, 0xa1, 0x66, 0x19, 0xbf, 0x25, 0xf8, 0x66, 0x62, 0x98, - 0xf1, 0x9c, 0x72, 0x68, 0xe4, 0x41, 0x66, 0xb5, 0xd7, 0xae, 0x25, 0xc8, 0xf1, 0x0a, 0xd1, 0xf2, - 0x0d, 0xac, 0x68, 0xc0, 0xce, 0xb8, 0x96, 0x94, 0xaf, 0x65, 0x45, 0x03, 0x5a, 0x1a, 0x6a, 0x42, - 0x15, 0x28, 0x05, 0x21, 0xa1, 0x43, 0x93, 0x56, 0x23, 0xbd, 0x88, 0x04, 0x41, 0x9c, 0x90, 0x31, - 0xaa, 0xc2, 0xea, 0x84, 0xe7, 0xfd, 0x92, 0x59, 0xe4, 0xb1, 0x22, 0x98, 0x97, 0xac, 0x8b, 0x3e, - 0x80, 0xdc, 0x90, 0x78, 0x97, 0xac, 0x49, 0x28, 0xbc, 0x9e, 0xf4, 0x11, 0x15, 0xdb, 0x01, 0x16, - 0x66, 0xf4, 0x0e, 0xe4, 0x82, 0x90, 0xf4, 0x9d, 0x91, 0x2a, 0xb3, 0xae, 0x10, 0x33, 0xed, 0x1b, - 0xc8, 0x8b, 0x86, 0x7a, 0xcc, 0x91, 0xee, 0x56, 0x49, 0x4f, 0xaf, 0x42, 0xf5, 0xe8, 0xaa, 0x4f, - 0xf5, 0x0c, 0xd7, 0xf9, 0x4c, 0xfb, 0x55, 0x82, 0x22, 0xcb, 0x68, 0x37, 0x20, 0x36, 0xda, 0x83, - 0x22, 0xed, 0x6b, 0x33, 0x0a, 0x88, 0x2d, 0x9a, 0xe3, 0x5e, 0xdf, 0x17, 0xa8, 0x9d, 0xb1, 0xfb, - 0x00, 0x0e, 0x8d, 0x8b, 0xc3, 0xbc, 0x2f, 0x94, 0xe9, 0x1b, 0x40, 0x29, 0x5c, 0x74, 0x26, 0x43, - 0xb4, 0x05, 0x45, 0xd7, 0x1a, 0x99, 0x17, 0x24, 0x88, 0x79, 0x4b, 0xc8, 0xb8, 0xe0, 0x5a, 0xa3, - 0x63, 0x3a, 0x67, 0x46, 0xc7, 0x13, 0xc6, 0xac, 0x30, 0x3a, 0x1e, 0x33, 0x6a, 0x7f, 0x49, 0x50, - 0x4c, 0x96, 0x44, 0xdb, 0x50, 0xb2, 0x07, 0xce, 0xf0, 0xc2, 0xf4, 0xc3, 0x0b, 0x12, 0xaa, 0xd2, - 0x4e, 0x66, 0x57, 0xc6, 0xc0, 0xa4, 0x36, 0x55, 0xd0, 0x7b, 0xc0, 0x67, 0x66, 0xe4, 0xbc, 0xe1, - 0x77, 0x5a, 0xc6, 0x45, 0xa6, 0x74, 0x9d, 0x37, 0x04, 0xed, 0xc1, 0x06, 0xdd, 0x8a, 0x27, 0xc6, - 0x14, 0xc5, 0xe1, 0xf1, 0xac, 0xbb, 0x8e, 0xd7, 0x61, 0x3a, 0x2f, 0x0f, 0x63, 0xad, 0xd1, 0x3d, - 0x36, 0x2b, 0x58, 0x6b, 0x34, 0xc3, 0x6e, 0x43, 0x89, 0xb8, 0x41, 0x3c, 0x36, 0xd9, 0x56, 0xa2, - 0x8a, 0xc0, 0xa4, 0x26, 0x55, 0x92, 0xf2, 0xe5, 0x96, 0x96, 0x4f, 0xfb, 0x04, 0xe0, 0xae, 0xc9, - 0xd1, 0x53, 0xc8, 0x13, 0x2f, 0x0e, 0x1d, 0x12, 0xb1, 0x53, 0xde, 0xbb, 0x42, 0xba, 0x17, 0x87, - 0x63, 0x3c, 0x21, 0xb4, 0xef, 0x84, 0x2b, 0x93, 0xff, 0xa7, 0x2b, 0x7e, 0x77, 0xf1, 0x7e, 0x94, - 0x60, 0x73, 0xd1, 0x45, 0x45, 0x87, 0xf7, 0xcf, 0xb0, 0xe4, 0x5a, 0xcf, 0x9e, 0x06, 0xd5, 0x60, - 0x75, 0xe8, 0xfb, 0xaf, 0xaf, 0x02, 0x93, 0x35, 0x50, 0xa4, 0xa6, 0x17, 0x7e, 0x62, 0x57, 0x38, - 0xc4, 0xa6, 0x91, 0xf6, 0xf3, 0x7c, 0x10, 0x3c, 0x1b, 0x1f, 0xcf, 0x66, 0x63, 0x7b, 0x2e, 0x84, - 0x65, 0x79, 0xf9, 0x6c, 0x2e, 0x2f, 0xda, 0x9c, 0xef, 0x23, 0x33, 0x34, 0x06, 0x75, 0xd9, 0x7e, - 0xff, 0xe5, 0x93, 0x84, 0xa6, 0x9e, 0x24, 0x59, 0x3c, 0x41, 0xbf, 0x48, 0xb0, 0xf5, 0x2f, 0xf1, - 0x2e, 0xd8, 0xbe, 0x36, 0xf3, 0x1a, 0x3d, 0x94, 0x2f, 0xf1, 0x2e, 0x1d, 0xce, 0xbe, 0x4b, 0x0f, - 0x7a, 0x71, 0x7a, 0xef, 0x05, 0xe4, 0xf8, 0x1d, 0x40, 0x25, 0xc8, 0x9f, 0xb5, 0xcd, 0xd6, 0x51, - 0xb7, 0xa5, 0xa4, 0x10, 0x40, 0xae, 0xdb, 0x3a, 0xaa, 0x1e, 0xd6, 0x15, 0x49, 0x8c, 0x0f, 0x9f, - 0x55, 0x95, 0x34, 0x1d, 0x9f, 0xe8, 0xcd, 0xe6, 0xd1, 0x89, 0x92, 0x41, 0xab, 0x50, 0xc4, 0x46, - 0x47, 0xff, 0xe2, 0xf8, 0x59, 0xfd, 0x23, 0x25, 0x4b, 0xfd, 0x1b, 0x46, 0xaf, 0xd9, 0x36, 0xce, - 0x14, 0x79, 0xef, 0x37, 0x09, 0x0a, 0x93, 0x8f, 0x2c, 0x05, 0xcf, 0xda, 0x66, 0x07, 0xeb, 0xcf, - 0x8d, 0x57, 0x4a, 0x8a, 0x4e, 0x5f, 0x1e, 0x61, 0xb3, 0x83, 0xdb, 0xbd, 0xb6, 0x22, 0x51, 0x3f, - 0x3a, 0xc5, 0xa7, 0x1d, 0x25, 0x8d, 0xd6, 0xa1, 0xf4, 0xdc, 0x78, 0xa5, 0x1f, 0xd7, 0xaa, 0x66, - 0xc3, 0xf8, 0x5c, 0xc9, 0x20, 0x04, 0x6b, 0x13, 0xe1, 0xd4, 0xe8, 0xf5, 0x4e, 0x75, 0x25, 0x9b, - 0x40, 0xf5, 0x03, 0x06, 0xc9, 0x09, 0x54, 0x3f, 0x98, 0x40, 0x39, 0xb4, 0x09, 0x0a, 0xd6, 0xbf, - 0x7c, 0x61, 0x60, 0xdd, 0xa4, 0x8b, 0x7d, 0xd5, 0xd3, 0xbb, 0x4a, 0x7e, 0x5a, 0xa5, 0xde, 0x4c, - 0x2d, 0x34, 0x0e, 0x7e, 0xbf, 0x29, 0x4b, 0xd7, 0x37, 0x65, 0xe9, 0xcf, 0x9b, 0xb2, 0xf4, 0xd3, - 0x6d, 0x39, 0x75, 0x7d, 0x5b, 0x4e, 0xfd, 0x71, 0x5b, 0x4e, 0x7d, 0xfd, 0xee, 0xa5, 0x13, 0x0f, - 0xae, 0xce, 0x2b, 0xb6, 0xef, 0xee, 0x8b, 0xff, 0x1c, 0x96, 0xd7, 0xfd, 0x4b, 0xff, 0x3c, 0xc7, - 0x7e, 0x75, 0x6a, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x80, 0x96, 0x1f, 0xf6, 0x01, 0x09, 0x00, - 0x00, -} - -func (m *ExistenceProof) 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 *ExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Path) > 0 { - for iNdEx := len(m.Path) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Path[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if m.Leaf != nil { - { - size, err := m.Leaf.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *NonExistenceProof) 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 *NonExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *NonExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Right != nil { - { - size, err := m.Right.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Left != nil { - { - size, err := m.Left.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CommitmentProof) 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 *CommitmentProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size := m.Proof.Size() - i -= size - if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *CommitmentProof_Exist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Exist != nil { - { - size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *CommitmentProof_Nonexist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Nonexist != nil { - { - size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *CommitmentProof_Batch) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Batch) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Batch != nil { - { - size, err := m.Batch.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *CommitmentProof_Compressed) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CommitmentProof_Compressed) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Compressed != nil { - { - size, err := m.Compressed.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *LeafOp) 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 *LeafOp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LeafOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Prefix) > 0 { - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Prefix))) - i-- - dAtA[i] = 0x2a - } - if m.Length != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Length)) - i-- - dAtA[i] = 0x20 - } - if m.PrehashValue != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.PrehashValue)) - i-- - dAtA[i] = 0x18 - } - if m.PrehashKey != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.PrehashKey)) - i-- - dAtA[i] = 0x10 - } - if m.Hash != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *InnerOp) 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 *InnerOp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InnerOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Suffix) > 0 { - i -= len(m.Suffix) - copy(dAtA[i:], m.Suffix) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Suffix))) - i-- - dAtA[i] = 0x1a - } - if len(m.Prefix) > 0 { - i -= len(m.Prefix) - copy(dAtA[i:], m.Prefix) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Prefix))) - i-- - dAtA[i] = 0x12 - } - if m.Hash != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ProofSpec) 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 *ProofSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProofSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MinDepth != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MinDepth)) - i-- - dAtA[i] = 0x20 - } - if m.MaxDepth != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MaxDepth)) - i-- - dAtA[i] = 0x18 - } - if m.InnerSpec != nil { - { - size, err := m.InnerSpec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.LeafSpec != nil { - { - size, err := m.LeafSpec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *InnerSpec) 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 *InnerSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InnerSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Hash != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.Hash)) - i-- - dAtA[i] = 0x30 - } - if len(m.EmptyChild) > 0 { - i -= len(m.EmptyChild) - copy(dAtA[i:], m.EmptyChild) - i = encodeVarintProofs(dAtA, i, uint64(len(m.EmptyChild))) - i-- - dAtA[i] = 0x2a - } - if m.MaxPrefixLength != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MaxPrefixLength)) - i-- - dAtA[i] = 0x20 - } - if m.MinPrefixLength != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.MinPrefixLength)) - i-- - dAtA[i] = 0x18 - } - if m.ChildSize != 0 { - i = encodeVarintProofs(dAtA, i, uint64(m.ChildSize)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChildOrder) > 0 { - dAtA11 := make([]byte, len(m.ChildOrder)*10) - var j10 int - for _, num1 := range m.ChildOrder { - num := uint64(num1) - for num >= 1<<7 { - dAtA11[j10] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j10++ - } - dAtA11[j10] = uint8(num) - j10++ - } - i -= j10 - copy(dAtA[i:], dAtA11[:j10]) - i = encodeVarintProofs(dAtA, i, uint64(j10)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *BatchProof) 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 *BatchProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *BatchEntry) 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 *BatchEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size := m.Proof.Size() - i -= size - if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *BatchEntry_Exist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchEntry_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Exist != nil { - { - size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *BatchEntry_Nonexist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchEntry_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Nonexist != nil { - { - size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *CompressedBatchProof) 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 *CompressedBatchProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.LookupInners) > 0 { - for iNdEx := len(m.LookupInners) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LookupInners[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Entries) > 0 { - for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *CompressedBatchEntry) 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 *CompressedBatchEntry) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Proof != nil { - { - size := m.Proof.Size() - i -= size - if _, err := m.Proof.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *CompressedBatchEntry_Exist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchEntry_Exist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Exist != nil { - { - size, err := m.Exist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *CompressedBatchEntry_Nonexist) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedBatchEntry_Nonexist) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Nonexist != nil { - { - size, err := m.Nonexist.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *CompressedExistenceProof) 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 *CompressedExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Path) > 0 { - dAtA17 := make([]byte, len(m.Path)*10) - var j16 int - for _, num1 := range m.Path { - num := uint64(num1) - for num >= 1<<7 { - dAtA17[j16] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j16++ - } - dAtA17[j16] = uint8(num) - j16++ - } - i -= j16 - copy(dAtA[i:], dAtA17[:j16]) - i = encodeVarintProofs(dAtA, i, uint64(j16)) - i-- - dAtA[i] = 0x22 - } - if m.Leaf != nil { - { - size, err := m.Leaf.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *CompressedNonExistenceProof) 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 *CompressedNonExistenceProof) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CompressedNonExistenceProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Right != nil { - { - size, err := m.Right.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Left != nil { - { - size, err := m.Left.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProofs(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintProofs(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintProofs(dAtA []byte, offset int, v uint64) int { - offset -= sovProofs(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Leaf != nil { - l = m.Leaf.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if len(m.Path) > 0 { - for _, e := range m.Path { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - return n -} - -func (m *NonExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Left != nil { - l = m.Left.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.Right != nil { - l = m.Right.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func (m *CommitmentProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proof != nil { - n += m.Proof.Size() - } - return n -} - -func (m *CommitmentProof_Exist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exist != nil { - l = m.Exist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CommitmentProof_Nonexist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Nonexist != nil { - l = m.Nonexist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CommitmentProof_Batch) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Batch != nil { - l = m.Batch.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CommitmentProof_Compressed) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Compressed != nil { - l = m.Compressed.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *LeafOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Hash != 0 { - n += 1 + sovProofs(uint64(m.Hash)) - } - if m.PrehashKey != 0 { - n += 1 + sovProofs(uint64(m.PrehashKey)) - } - if m.PrehashValue != 0 { - n += 1 + sovProofs(uint64(m.PrehashValue)) - } - if m.Length != 0 { - n += 1 + sovProofs(uint64(m.Length)) - } - l = len(m.Prefix) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func (m *InnerOp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Hash != 0 { - n += 1 + sovProofs(uint64(m.Hash)) - } - l = len(m.Prefix) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - l = len(m.Suffix) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func (m *ProofSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LeafSpec != nil { - l = m.LeafSpec.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.InnerSpec != nil { - l = m.InnerSpec.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.MaxDepth != 0 { - n += 1 + sovProofs(uint64(m.MaxDepth)) - } - if m.MinDepth != 0 { - n += 1 + sovProofs(uint64(m.MinDepth)) - } - return n -} - -func (m *InnerSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ChildOrder) > 0 { - l = 0 - for _, e := range m.ChildOrder { - l += sovProofs(uint64(e)) - } - n += 1 + sovProofs(uint64(l)) + l - } - if m.ChildSize != 0 { - n += 1 + sovProofs(uint64(m.ChildSize)) - } - if m.MinPrefixLength != 0 { - n += 1 + sovProofs(uint64(m.MinPrefixLength)) - } - if m.MaxPrefixLength != 0 { - n += 1 + sovProofs(uint64(m.MaxPrefixLength)) - } - l = len(m.EmptyChild) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Hash != 0 { - n += 1 + sovProofs(uint64(m.Hash)) - } - return n -} - -func (m *BatchProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - return n -} - -func (m *BatchEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proof != nil { - n += m.Proof.Size() - } - return n -} - -func (m *BatchEntry_Exist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exist != nil { - l = m.Exist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *BatchEntry_Nonexist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Nonexist != nil { - l = m.Nonexist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CompressedBatchProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - if len(m.LookupInners) > 0 { - for _, e := range m.LookupInners { - l = e.Size() - n += 1 + l + sovProofs(uint64(l)) - } - } - return n -} - -func (m *CompressedBatchEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Proof != nil { - n += m.Proof.Size() - } - return n -} - -func (m *CompressedBatchEntry_Exist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Exist != nil { - l = m.Exist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CompressedBatchEntry_Nonexist) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Nonexist != nil { - l = m.Nonexist.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} -func (m *CompressedExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Leaf != nil { - l = m.Leaf.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if len(m.Path) > 0 { - l = 0 - for _, e := range m.Path { - l += sovProofs(uint64(e)) - } - n += 1 + sovProofs(uint64(l)) + l - } - return n -} - -func (m *CompressedNonExistenceProof) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovProofs(uint64(l)) - } - if m.Left != nil { - l = m.Left.Size() - n += 1 + l + sovProofs(uint64(l)) - } - if m.Right != nil { - l = m.Right.Size() - n += 1 + l + sovProofs(uint64(l)) - } - return n -} - -func sovProofs(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProofs(x uint64) (n int) { - return sovProofs(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ExistenceProof) 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 ErrIntOverflowProofs - } - 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: ExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leaf", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Leaf == nil { - m.Leaf = &LeafOp{} - } - if err := m.Leaf.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Path = append(m.Path, &InnerOp{}) - if err := m.Path[len(m.Path)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NonExistenceProof) 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 ErrIntOverflowProofs - } - 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: NonExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NonExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Left == nil { - m.Left = &ExistenceProof{} - } - if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Right == nil { - m.Right = &ExistenceProof{} - } - if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommitmentProof) 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 ErrIntOverflowProofs - } - 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: CommitmentProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommitmentProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Exist{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &NonExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Nonexist{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Batch", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &BatchProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Batch{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Compressed", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &CompressedBatchProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CommitmentProof_Compressed{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LeafOp) 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 ErrIntOverflowProofs - } - 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: LeafOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LeafOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrehashKey", wireType) - } - m.PrehashKey = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PrehashKey |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PrehashValue", wireType) - } - m.PrehashValue = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PrehashValue |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= LengthOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = append(m.Prefix[:0], dAtA[iNdEx:postIndex]...) - if m.Prefix == nil { - m.Prefix = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InnerOp) 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 ErrIntOverflowProofs - } - 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: InnerOp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InnerOp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Prefix = append(m.Prefix[:0], dAtA[iNdEx:postIndex]...) - if m.Prefix == nil { - m.Prefix = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Suffix", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Suffix = append(m.Suffix[:0], dAtA[iNdEx:postIndex]...) - if m.Suffix == nil { - m.Suffix = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProofSpec) 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 ErrIntOverflowProofs - } - 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: ProofSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProofSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LeafSpec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LeafSpec == nil { - m.LeafSpec = &LeafOp{} - } - if err := m.LeafSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InnerSpec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.InnerSpec == nil { - m.InnerSpec = &InnerSpec{} - } - if err := m.InnerSpec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxDepth", wireType) - } - m.MaxDepth = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxDepth |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDepth", wireType) - } - m.MinDepth = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinDepth |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InnerSpec) 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 ErrIntOverflowProofs - } - 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: InnerSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InnerSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ChildOrder = append(m.ChildOrder, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.ChildOrder) == 0 { - m.ChildOrder = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ChildOrder = append(m.ChildOrder, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ChildOrder", wireType) - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChildSize", wireType) - } - m.ChildSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChildSize |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinPrefixLength", wireType) - } - m.MinPrefixLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinPrefixLength |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxPrefixLength", wireType) - } - m.MaxPrefixLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxPrefixLength |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EmptyChild", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.EmptyChild = append(m.EmptyChild[:0], dAtA[iNdEx:postIndex]...) - if m.EmptyChild == nil { - m.EmptyChild = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - m.Hash = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Hash |= HashOp(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchProof) 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 ErrIntOverflowProofs - } - 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: BatchProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, &BatchEntry{}) - if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BatchEntry) 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 ErrIntOverflowProofs - } - 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: BatchEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &BatchEntry_Exist{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &NonExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &BatchEntry_Nonexist{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedBatchProof) 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 ErrIntOverflowProofs - } - 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: CompressedBatchProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedBatchProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Entries = append(m.Entries, &CompressedBatchEntry{}) - if err := m.Entries[len(m.Entries)-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 LookupInners", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LookupInners = append(m.LookupInners, &InnerOp{}) - if err := m.LookupInners[len(m.LookupInners)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedBatchEntry) 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 ErrIntOverflowProofs - } - 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: CompressedBatchEntry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedBatchEntry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Exist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &CompressedExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CompressedBatchEntry_Exist{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonexist", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &CompressedNonExistenceProof{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Proof = &CompressedBatchEntry_Nonexist{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedExistenceProof) 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 ErrIntOverflowProofs - } - 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: CompressedExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Leaf", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Leaf == nil { - m.Leaf = &LeafOp{} - } - if err := m.Leaf.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType == 0 { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Path = append(m.Path, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.Path) == 0 { - m.Path = make([]int32, 0, elementCount) - } - for iNdEx < postIndex { - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Path = append(m.Path, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) - } - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CompressedNonExistenceProof) 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 ErrIntOverflowProofs - } - 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: CompressedNonExistenceProof: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CompressedNonExistenceProof: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Left == nil { - m.Left = &CompressedExistenceProof{} - } - if err := m.Left.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProofs - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProofs - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProofs - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Right == nil { - m.Right = &CompressedExistenceProof{} - } - if err := m.Right.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProofs(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthProofs - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProofs(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, ErrIntOverflowProofs - } - 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, ErrIntOverflowProofs - } - 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, ErrIntOverflowProofs - } - 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, ErrInvalidLengthProofs - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupProofs - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthProofs - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthProofs = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProofs = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupProofs = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go b/core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go deleted file mode 100644 index f079a53b..00000000 --- a/core-sdk/third_party/github.com/gogo/protobuf/gogoproto/gogo.pb.go +++ /dev/null @@ -1,888 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: gogoproto/gogo.proto - -package gogoproto - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - math "math" -) - -// 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 - -var E_GoprotoEnumPrefix = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62001, - Name: "gogoproto.goproto_enum_prefix", - Tag: "varint,62001,opt,name=goproto_enum_prefix", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoEnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62021, - Name: "gogoproto.goproto_enum_stringer", - Tag: "varint,62021,opt,name=goproto_enum_stringer", - Filename: "gogoproto/gogo.proto", -} - -var E_EnumStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62022, - Name: "gogoproto.enum_stringer", - Tag: "varint,62022,opt,name=enum_stringer", - Filename: "gogoproto/gogo.proto", -} - -var E_EnumCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*string)(nil), - Field: 62023, - Name: "gogoproto.enum_customname", - Tag: "bytes,62023,opt,name=enum_customname", - Filename: "gogoproto/gogo.proto", -} - -var E_Enumdecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 62024, - Name: "gogoproto.enumdecl", - Tag: "varint,62024,opt,name=enumdecl", - Filename: "gogoproto/gogo.proto", -} - -var E_EnumvalueCustomname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.EnumValueOptions)(nil), - ExtensionType: (*string)(nil), - Field: 66001, - Name: "gogoproto.enumvalue_customname", - Tag: "bytes,66001,opt,name=enumvalue_customname", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoGettersAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63001, - Name: "gogoproto.goproto_getters_all", - Tag: "varint,63001,opt,name=goproto_getters_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoEnumPrefixAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63002, - Name: "gogoproto.goproto_enum_prefix_all", - Tag: "varint,63002,opt,name=goproto_enum_prefix_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63003, - Name: "gogoproto.goproto_stringer_all", - Tag: "varint,63003,opt,name=goproto_stringer_all", - Filename: "gogoproto/gogo.proto", -} - -var E_VerboseEqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63004, - Name: "gogoproto.verbose_equal_all", - Tag: "varint,63004,opt,name=verbose_equal_all", - Filename: "gogoproto/gogo.proto", -} - -var E_FaceAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63005, - Name: "gogoproto.face_all", - Tag: "varint,63005,opt,name=face_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GostringAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63006, - Name: "gogoproto.gostring_all", - Tag: "varint,63006,opt,name=gostring_all", - Filename: "gogoproto/gogo.proto", -} - -var E_PopulateAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63007, - Name: "gogoproto.populate_all", - Tag: "varint,63007,opt,name=populate_all", - Filename: "gogoproto/gogo.proto", -} - -var E_StringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63008, - Name: "gogoproto.stringer_all", - Tag: "varint,63008,opt,name=stringer_all", - Filename: "gogoproto/gogo.proto", -} - -var E_OnlyoneAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63009, - Name: "gogoproto.onlyone_all", - Tag: "varint,63009,opt,name=onlyone_all", - Filename: "gogoproto/gogo.proto", -} - -var E_EqualAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63013, - Name: "gogoproto.equal_all", - Tag: "varint,63013,opt,name=equal_all", - Filename: "gogoproto/gogo.proto", -} - -var E_DescriptionAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63014, - Name: "gogoproto.description_all", - Tag: "varint,63014,opt,name=description_all", - Filename: "gogoproto/gogo.proto", -} - -var E_TestgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63015, - Name: "gogoproto.testgen_all", - Tag: "varint,63015,opt,name=testgen_all", - Filename: "gogoproto/gogo.proto", -} - -var E_BenchgenAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63016, - Name: "gogoproto.benchgen_all", - Tag: "varint,63016,opt,name=benchgen_all", - Filename: "gogoproto/gogo.proto", -} - -var E_MarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63017, - Name: "gogoproto.marshaler_all", - Tag: "varint,63017,opt,name=marshaler_all", - Filename: "gogoproto/gogo.proto", -} - -var E_UnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63018, - Name: "gogoproto.unmarshaler_all", - Tag: "varint,63018,opt,name=unmarshaler_all", - Filename: "gogoproto/gogo.proto", -} - -var E_StableMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63019, - Name: "gogoproto.stable_marshaler_all", - Tag: "varint,63019,opt,name=stable_marshaler_all", - Filename: "gogoproto/gogo.proto", -} - -var E_SizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63020, - Name: "gogoproto.sizer_all", - Tag: "varint,63020,opt,name=sizer_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoEnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63021, - Name: "gogoproto.goproto_enum_stringer_all", - Tag: "varint,63021,opt,name=goproto_enum_stringer_all", - Filename: "gogoproto/gogo.proto", -} - -var E_EnumStringerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63022, - Name: "gogoproto.enum_stringer_all", - Tag: "varint,63022,opt,name=enum_stringer_all", - Filename: "gogoproto/gogo.proto", -} - -var E_UnsafeMarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63023, - Name: "gogoproto.unsafe_marshaler_all", - Tag: "varint,63023,opt,name=unsafe_marshaler_all", - Filename: "gogoproto/gogo.proto", -} - -var E_UnsafeUnmarshalerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63024, - Name: "gogoproto.unsafe_unmarshaler_all", - Tag: "varint,63024,opt,name=unsafe_unmarshaler_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoExtensionsMapAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63025, - Name: "gogoproto.goproto_extensions_map_all", - Tag: "varint,63025,opt,name=goproto_extensions_map_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoUnrecognizedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63026, - Name: "gogoproto.goproto_unrecognized_all", - Tag: "varint,63026,opt,name=goproto_unrecognized_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GogoprotoImport = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63027, - Name: "gogoproto.gogoproto_import", - Tag: "varint,63027,opt,name=gogoproto_import", - Filename: "gogoproto/gogo.proto", -} - -var E_ProtosizerAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63028, - Name: "gogoproto.protosizer_all", - Tag: "varint,63028,opt,name=protosizer_all", - Filename: "gogoproto/gogo.proto", -} - -var E_CompareAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63029, - Name: "gogoproto.compare_all", - Tag: "varint,63029,opt,name=compare_all", - Filename: "gogoproto/gogo.proto", -} - -var E_TypedeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63030, - Name: "gogoproto.typedecl_all", - Tag: "varint,63030,opt,name=typedecl_all", - Filename: "gogoproto/gogo.proto", -} - -var E_EnumdeclAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63031, - Name: "gogoproto.enumdecl_all", - Tag: "varint,63031,opt,name=enumdecl_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoRegistration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63032, - Name: "gogoproto.goproto_registration", - Tag: "varint,63032,opt,name=goproto_registration", - Filename: "gogoproto/gogo.proto", -} - -var E_MessagenameAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63033, - Name: "gogoproto.messagename_all", - Tag: "varint,63033,opt,name=messagename_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoSizecacheAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63034, - Name: "gogoproto.goproto_sizecache_all", - Tag: "varint,63034,opt,name=goproto_sizecache_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoUnkeyedAll = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FileOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 63035, - Name: "gogoproto.goproto_unkeyed_all", - Tag: "varint,63035,opt,name=goproto_unkeyed_all", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoGetters = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64001, - Name: "gogoproto.goproto_getters", - Tag: "varint,64001,opt,name=goproto_getters", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoStringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64003, - Name: "gogoproto.goproto_stringer", - Tag: "varint,64003,opt,name=goproto_stringer", - Filename: "gogoproto/gogo.proto", -} - -var E_VerboseEqual = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64004, - Name: "gogoproto.verbose_equal", - Tag: "varint,64004,opt,name=verbose_equal", - Filename: "gogoproto/gogo.proto", -} - -var E_Face = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64005, - Name: "gogoproto.face", - Tag: "varint,64005,opt,name=face", - Filename: "gogoproto/gogo.proto", -} - -var E_Gostring = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64006, - Name: "gogoproto.gostring", - Tag: "varint,64006,opt,name=gostring", - Filename: "gogoproto/gogo.proto", -} - -var E_Populate = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64007, - Name: "gogoproto.populate", - Tag: "varint,64007,opt,name=populate", - Filename: "gogoproto/gogo.proto", -} - -var E_Stringer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 67008, - Name: "gogoproto.stringer", - Tag: "varint,67008,opt,name=stringer", - Filename: "gogoproto/gogo.proto", -} - -var E_Onlyone = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64009, - Name: "gogoproto.onlyone", - Tag: "varint,64009,opt,name=onlyone", - Filename: "gogoproto/gogo.proto", -} - -var E_Equal = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64013, - Name: "gogoproto.equal", - Tag: "varint,64013,opt,name=equal", - Filename: "gogoproto/gogo.proto", -} - -var E_Description = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64014, - Name: "gogoproto.description", - Tag: "varint,64014,opt,name=description", - Filename: "gogoproto/gogo.proto", -} - -var E_Testgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64015, - Name: "gogoproto.testgen", - Tag: "varint,64015,opt,name=testgen", - Filename: "gogoproto/gogo.proto", -} - -var E_Benchgen = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64016, - Name: "gogoproto.benchgen", - Tag: "varint,64016,opt,name=benchgen", - Filename: "gogoproto/gogo.proto", -} - -var E_Marshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64017, - Name: "gogoproto.marshaler", - Tag: "varint,64017,opt,name=marshaler", - Filename: "gogoproto/gogo.proto", -} - -var E_Unmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64018, - Name: "gogoproto.unmarshaler", - Tag: "varint,64018,opt,name=unmarshaler", - Filename: "gogoproto/gogo.proto", -} - -var E_StableMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64019, - Name: "gogoproto.stable_marshaler", - Tag: "varint,64019,opt,name=stable_marshaler", - Filename: "gogoproto/gogo.proto", -} - -var E_Sizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64020, - Name: "gogoproto.sizer", - Tag: "varint,64020,opt,name=sizer", - Filename: "gogoproto/gogo.proto", -} - -var E_UnsafeMarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64023, - Name: "gogoproto.unsafe_marshaler", - Tag: "varint,64023,opt,name=unsafe_marshaler", - Filename: "gogoproto/gogo.proto", -} - -var E_UnsafeUnmarshaler = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64024, - Name: "gogoproto.unsafe_unmarshaler", - Tag: "varint,64024,opt,name=unsafe_unmarshaler", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoExtensionsMap = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64025, - Name: "gogoproto.goproto_extensions_map", - Tag: "varint,64025,opt,name=goproto_extensions_map", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoUnrecognized = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64026, - Name: "gogoproto.goproto_unrecognized", - Tag: "varint,64026,opt,name=goproto_unrecognized", - Filename: "gogoproto/gogo.proto", -} - -var E_Protosizer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64028, - Name: "gogoproto.protosizer", - Tag: "varint,64028,opt,name=protosizer", - Filename: "gogoproto/gogo.proto", -} - -var E_Compare = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64029, - Name: "gogoproto.compare", - Tag: "varint,64029,opt,name=compare", - Filename: "gogoproto/gogo.proto", -} - -var E_Typedecl = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64030, - Name: "gogoproto.typedecl", - Tag: "varint,64030,opt,name=typedecl", - Filename: "gogoproto/gogo.proto", -} - -var E_Messagename = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64033, - Name: "gogoproto.messagename", - Tag: "varint,64033,opt,name=messagename", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoSizecache = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64034, - Name: "gogoproto.goproto_sizecache", - Tag: "varint,64034,opt,name=goproto_sizecache", - Filename: "gogoproto/gogo.proto", -} - -var E_GoprotoUnkeyed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 64035, - Name: "gogoproto.goproto_unkeyed", - Tag: "varint,64035,opt,name=goproto_unkeyed", - Filename: "gogoproto/gogo.proto", -} - -var E_Nullable = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65001, - Name: "gogoproto.nullable", - Tag: "varint,65001,opt,name=nullable", - Filename: "gogoproto/gogo.proto", -} - -var E_Embed = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65002, - Name: "gogoproto.embed", - Tag: "varint,65002,opt,name=embed", - Filename: "gogoproto/gogo.proto", -} - -var E_Customtype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65003, - Name: "gogoproto.customtype", - Tag: "bytes,65003,opt,name=customtype", - Filename: "gogoproto/gogo.proto", -} - -var E_Customname = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65004, - Name: "gogoproto.customname", - Tag: "bytes,65004,opt,name=customname", - Filename: "gogoproto/gogo.proto", -} - -var E_Jsontag = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65005, - Name: "gogoproto.jsontag", - Tag: "bytes,65005,opt,name=jsontag", - Filename: "gogoproto/gogo.proto", -} - -var E_Moretags = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65006, - Name: "gogoproto.moretags", - Tag: "bytes,65006,opt,name=moretags", - Filename: "gogoproto/gogo.proto", -} - -var E_Casttype = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65007, - Name: "gogoproto.casttype", - Tag: "bytes,65007,opt,name=casttype", - Filename: "gogoproto/gogo.proto", -} - -var E_Castkey = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65008, - Name: "gogoproto.castkey", - Tag: "bytes,65008,opt,name=castkey", - Filename: "gogoproto/gogo.proto", -} - -var E_Castvalue = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65009, - Name: "gogoproto.castvalue", - Tag: "bytes,65009,opt,name=castvalue", - Filename: "gogoproto/gogo.proto", -} - -var E_Stdtime = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65010, - Name: "gogoproto.stdtime", - Tag: "varint,65010,opt,name=stdtime", - Filename: "gogoproto/gogo.proto", -} - -var E_Stdduration = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65011, - Name: "gogoproto.stdduration", - Tag: "varint,65011,opt,name=stdduration", - Filename: "gogoproto/gogo.proto", -} - -var E_Wktpointer = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*bool)(nil), - Field: 65012, - Name: "gogoproto.wktpointer", - Tag: "varint,65012,opt,name=wktpointer", - Filename: "gogoproto/gogo.proto", -} - -var E_Castrepeated = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 65013, - Name: "gogoproto.castrepeated", - Tag: "bytes,65013,opt,name=castrepeated", - Filename: "gogoproto/gogo.proto", -} - -func init() { - proto.RegisterExtension(E_GoprotoEnumPrefix) - proto.RegisterExtension(E_GoprotoEnumStringer) - proto.RegisterExtension(E_EnumStringer) - proto.RegisterExtension(E_EnumCustomname) - proto.RegisterExtension(E_Enumdecl) - proto.RegisterExtension(E_EnumvalueCustomname) - proto.RegisterExtension(E_GoprotoGettersAll) - proto.RegisterExtension(E_GoprotoEnumPrefixAll) - proto.RegisterExtension(E_GoprotoStringerAll) - proto.RegisterExtension(E_VerboseEqualAll) - proto.RegisterExtension(E_FaceAll) - proto.RegisterExtension(E_GostringAll) - proto.RegisterExtension(E_PopulateAll) - proto.RegisterExtension(E_StringerAll) - proto.RegisterExtension(E_OnlyoneAll) - proto.RegisterExtension(E_EqualAll) - proto.RegisterExtension(E_DescriptionAll) - proto.RegisterExtension(E_TestgenAll) - proto.RegisterExtension(E_BenchgenAll) - proto.RegisterExtension(E_MarshalerAll) - proto.RegisterExtension(E_UnmarshalerAll) - proto.RegisterExtension(E_StableMarshalerAll) - proto.RegisterExtension(E_SizerAll) - proto.RegisterExtension(E_GoprotoEnumStringerAll) - proto.RegisterExtension(E_EnumStringerAll) - proto.RegisterExtension(E_UnsafeMarshalerAll) - proto.RegisterExtension(E_UnsafeUnmarshalerAll) - proto.RegisterExtension(E_GoprotoExtensionsMapAll) - proto.RegisterExtension(E_GoprotoUnrecognizedAll) - proto.RegisterExtension(E_GogoprotoImport) - proto.RegisterExtension(E_ProtosizerAll) - proto.RegisterExtension(E_CompareAll) - proto.RegisterExtension(E_TypedeclAll) - proto.RegisterExtension(E_EnumdeclAll) - proto.RegisterExtension(E_GoprotoRegistration) - proto.RegisterExtension(E_MessagenameAll) - proto.RegisterExtension(E_GoprotoSizecacheAll) - proto.RegisterExtension(E_GoprotoUnkeyedAll) - proto.RegisterExtension(E_GoprotoGetters) - proto.RegisterExtension(E_GoprotoStringer) - proto.RegisterExtension(E_VerboseEqual) - proto.RegisterExtension(E_Face) - proto.RegisterExtension(E_Gostring) - proto.RegisterExtension(E_Populate) - proto.RegisterExtension(E_Stringer) - proto.RegisterExtension(E_Onlyone) - proto.RegisterExtension(E_Equal) - proto.RegisterExtension(E_Description) - proto.RegisterExtension(E_Testgen) - proto.RegisterExtension(E_Benchgen) - proto.RegisterExtension(E_Marshaler) - proto.RegisterExtension(E_Unmarshaler) - proto.RegisterExtension(E_StableMarshaler) - proto.RegisterExtension(E_Sizer) - proto.RegisterExtension(E_UnsafeMarshaler) - proto.RegisterExtension(E_UnsafeUnmarshaler) - proto.RegisterExtension(E_GoprotoExtensionsMap) - proto.RegisterExtension(E_GoprotoUnrecognized) - proto.RegisterExtension(E_Protosizer) - proto.RegisterExtension(E_Compare) - proto.RegisterExtension(E_Typedecl) - proto.RegisterExtension(E_Messagename) - proto.RegisterExtension(E_GoprotoSizecache) - proto.RegisterExtension(E_GoprotoUnkeyed) - proto.RegisterExtension(E_Nullable) - proto.RegisterExtension(E_Embed) - proto.RegisterExtension(E_Customtype) - proto.RegisterExtension(E_Customname) - proto.RegisterExtension(E_Jsontag) - proto.RegisterExtension(E_Moretags) - proto.RegisterExtension(E_Casttype) - proto.RegisterExtension(E_Castkey) - proto.RegisterExtension(E_Castvalue) - proto.RegisterExtension(E_Stdtime) - proto.RegisterExtension(E_Stdduration) - proto.RegisterExtension(E_Wktpointer) - proto.RegisterExtension(E_Castrepeated) -} - -func init() { proto.RegisterFile("gogoproto/gogo.proto", fileDescriptor_c586470e9b64aee7) } - -var fileDescriptor_c586470e9b64aee7 = []byte{ - // 1382 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x98, 0x49, 0x6c, 0x1c, 0x45, - 0x17, 0x80, 0x63, 0xfd, 0x89, 0x62, 0x97, 0xed, 0x38, 0x5e, 0xfe, 0x10, 0x22, 0x30, 0x81, 0x13, - 0x27, 0xe7, 0x14, 0xa1, 0x94, 0x15, 0x45, 0x8e, 0xe5, 0x58, 0x41, 0x24, 0x18, 0x27, 0x0e, 0x9b, - 0xd0, 0xa8, 0x67, 0xa6, 0xdc, 0x6e, 0xd2, 0xdd, 0xd5, 0x74, 0x57, 0x87, 0x38, 0x37, 0x14, 0x16, - 0x21, 0x04, 0x84, 0x45, 0x82, 0x84, 0x24, 0x10, 0x10, 0xfb, 0x1a, 0xf6, 0xe5, 0xc2, 0x05, 0xc8, - 0x31, 0xdc, 0x38, 0xa2, 0x98, 0x0b, 0x60, 0x76, 0x73, 0xf2, 0x05, 0xbd, 0xee, 0xf7, 0x7a, 0xaa, - 0xdb, 0x23, 0x55, 0xcd, 0x6d, 0x3c, 0xae, 0xef, 0x73, 0xf5, 0x7b, 0x55, 0xef, 0x3d, 0x37, 0x1b, - 0x71, 0xa5, 0x2b, 0xa3, 0x58, 0x2a, 0xb9, 0x03, 0x3e, 0x8d, 0x65, 0x1f, 0x87, 0x7a, 0x8a, 0x6f, - 0xb7, 0x6d, 0x77, 0xa5, 0x74, 0x7d, 0xb1, 0x23, 0xfb, 0xa9, 0x9e, 0xce, 0xef, 0x68, 0x8a, 0xa4, - 0x11, 0x7b, 0x91, 0x92, 0x71, 0xbe, 0x98, 0x1f, 0x64, 0xc3, 0xb8, 0xb8, 0x26, 0xc2, 0x34, 0xa8, - 0x45, 0xb1, 0x98, 0xf7, 0x8e, 0x0f, 0x5d, 0x33, 0x96, 0x93, 0x63, 0x44, 0x8e, 0x4d, 0x85, 0x69, - 0x70, 0x6b, 0xa4, 0x3c, 0x19, 0x26, 0x5b, 0x2f, 0xfe, 0xf4, 0xbf, 0xed, 0x5d, 0x37, 0x76, 0xcf, - 0x0e, 0x22, 0x0a, 0xbf, 0x9b, 0xc9, 0x40, 0x3e, 0xcb, 0xfe, 0x5f, 0xf2, 0x25, 0x2a, 0xf6, 0x42, - 0x57, 0xc4, 0x06, 0xe3, 0x37, 0x68, 0x1c, 0xd6, 0x8c, 0x87, 0x10, 0xe5, 0x93, 0xac, 0xbf, 0x13, - 0xd7, 0xb7, 0xe8, 0xea, 0x13, 0xba, 0x64, 0x9a, 0x0d, 0x64, 0x92, 0x46, 0x9a, 0x28, 0x19, 0x84, - 0x4e, 0x20, 0x0c, 0x9a, 0xef, 0x32, 0x4d, 0xcf, 0xec, 0x26, 0xc0, 0x26, 0x0b, 0x8a, 0x73, 0xd6, - 0x0d, 0xdf, 0x34, 0x45, 0xc3, 0x37, 0x18, 0x2e, 0xe1, 0x46, 0x8a, 0xf5, 0xfc, 0x08, 0x1b, 0x81, - 0xcf, 0xc7, 0x1c, 0x3f, 0x15, 0xfa, 0x4e, 0xae, 0x6f, 0xeb, 0x39, 0x02, 0xcb, 0x48, 0xf6, 0xfd, - 0xc9, 0xf5, 0xd9, 0x76, 0x86, 0x0b, 0x81, 0xb6, 0x27, 0x2d, 0x8b, 0xae, 0x50, 0x4a, 0xc4, 0x49, - 0xcd, 0xf1, 0xdb, 0x6d, 0x6f, 0x9f, 0xe7, 0x17, 0xc6, 0xd3, 0xcb, 0xe5, 0x2c, 0x4e, 0xe7, 0xe4, - 0x84, 0xef, 0xf3, 0x39, 0x76, 0x55, 0x9b, 0x53, 0x61, 0xe1, 0x3c, 0x83, 0xce, 0x91, 0x35, 0x27, - 0x03, 0xb4, 0x33, 0x8c, 0xbe, 0x2f, 0x72, 0x69, 0xe1, 0x7c, 0x01, 0x9d, 0x43, 0xc8, 0x52, 0x4a, - 0xc1, 0x78, 0x33, 0x1b, 0x3c, 0x26, 0xe2, 0xba, 0x4c, 0x44, 0x4d, 0xdc, 0x97, 0x3a, 0xbe, 0x85, - 0xee, 0x2c, 0xea, 0x06, 0x10, 0x9c, 0x02, 0x0e, 0x5c, 0xbb, 0x58, 0xf7, 0xbc, 0xd3, 0x10, 0x16, - 0x8a, 0x73, 0xa8, 0xd8, 0x08, 0xeb, 0x01, 0x9d, 0x60, 0x7d, 0xae, 0xcc, 0x1f, 0xc9, 0x02, 0x3f, - 0x8f, 0x78, 0x2f, 0x31, 0xa8, 0x88, 0x64, 0x94, 0xfa, 0x8e, 0xb2, 0xd9, 0xc1, 0x8b, 0xa4, 0x20, - 0x06, 0x15, 0x1d, 0x84, 0xf5, 0x25, 0x52, 0x24, 0x5a, 0x3c, 0xf7, 0xb0, 0x5e, 0x19, 0xfa, 0x8b, - 0x32, 0xb4, 0xd9, 0xc4, 0x05, 0x34, 0x30, 0x44, 0x40, 0x30, 0xce, 0x7a, 0x6c, 0x13, 0xf1, 0xea, - 0x32, 0x5d, 0x0f, 0xca, 0xc0, 0x34, 0x1b, 0xa0, 0x02, 0xe5, 0xc9, 0xd0, 0x42, 0xf1, 0x1a, 0x2a, - 0x36, 0x69, 0x18, 0x3e, 0x86, 0x12, 0x89, 0x72, 0x85, 0x8d, 0xe4, 0x75, 0x7a, 0x0c, 0x44, 0x30, - 0x94, 0x75, 0x11, 0x36, 0x16, 0xec, 0x0c, 0x6f, 0x50, 0x28, 0x89, 0x01, 0xc5, 0x24, 0xeb, 0x0f, - 0x9c, 0x38, 0x59, 0x70, 0x7c, 0xab, 0x74, 0xbc, 0x89, 0x8e, 0xbe, 0x02, 0xc2, 0x88, 0xa4, 0x61, - 0x27, 0x9a, 0xb7, 0x28, 0x22, 0x1a, 0x86, 0x57, 0x2f, 0x51, 0x4e, 0xdd, 0x17, 0xb5, 0x4e, 0x6c, - 0x6f, 0xd3, 0xd5, 0xcb, 0xd9, 0x03, 0xba, 0x71, 0x9c, 0xf5, 0x24, 0xde, 0x09, 0x2b, 0xcd, 0x3b, - 0x94, 0xe9, 0x0c, 0x00, 0xf8, 0x4e, 0x76, 0x75, 0xdb, 0x36, 0x61, 0x21, 0x7b, 0x17, 0x65, 0x5b, - 0xda, 0xb4, 0x0a, 0x2c, 0x09, 0x9d, 0x2a, 0xdf, 0xa3, 0x92, 0x20, 0x2a, 0xae, 0x19, 0x36, 0x92, - 0x86, 0x89, 0x33, 0xdf, 0x59, 0xd4, 0xde, 0xa7, 0xa8, 0xe5, 0x6c, 0x29, 0x6a, 0x87, 0xd9, 0x16, - 0x34, 0x76, 0x96, 0xd7, 0x0f, 0xa8, 0xb0, 0xe6, 0xf4, 0x5c, 0x39, 0xbb, 0x77, 0xb3, 0x6d, 0x45, - 0x38, 0x8f, 0x2b, 0x11, 0x26, 0xc0, 0xd4, 0x02, 0x27, 0xb2, 0x30, 0x5f, 0x44, 0x33, 0x55, 0xfc, - 0xa9, 0x42, 0x70, 0xc0, 0x89, 0x40, 0x7e, 0x07, 0xdb, 0x4a, 0xf2, 0x34, 0x8c, 0x45, 0x43, 0xba, - 0xa1, 0x77, 0x42, 0x34, 0x2d, 0xd4, 0x1f, 0x56, 0x52, 0x35, 0xa7, 0xe1, 0x60, 0xde, 0xcf, 0x36, - 0x17, 0xb3, 0x4a, 0xcd, 0x0b, 0x22, 0x19, 0x2b, 0x83, 0xf1, 0x23, 0xca, 0x54, 0xc1, 0xed, 0xcf, - 0x30, 0x3e, 0xc5, 0x36, 0x65, 0x3f, 0xda, 0x1e, 0xc9, 0x8f, 0x51, 0xd4, 0xdf, 0xa2, 0xb0, 0x70, - 0x34, 0x64, 0x10, 0x39, 0xb1, 0x4d, 0xfd, 0xfb, 0x84, 0x0a, 0x07, 0x22, 0x58, 0x38, 0xd4, 0x62, - 0x24, 0xa0, 0xdb, 0x5b, 0x18, 0x3e, 0xa5, 0xc2, 0x41, 0x0c, 0x2a, 0x68, 0x60, 0xb0, 0x50, 0x7c, - 0x46, 0x0a, 0x62, 0x40, 0x71, 0x5b, 0xab, 0xd1, 0xc6, 0xc2, 0xf5, 0x12, 0x15, 0x3b, 0xb0, 0xda, - 0xa0, 0xfa, 0x7c, 0xb9, 0x3c, 0x84, 0xcd, 0x6a, 0x28, 0x54, 0xa2, 0x40, 0x24, 0x89, 0xe3, 0x0a, - 0x98, 0x38, 0x2c, 0x36, 0xf6, 0x05, 0x55, 0x22, 0x0d, 0x83, 0xbd, 0x69, 0x13, 0x22, 0x84, 0xbd, - 0xe1, 0x34, 0x16, 0x6c, 0x74, 0x5f, 0x56, 0x36, 0x77, 0x88, 0x58, 0x70, 0x6a, 0xf3, 0x4f, 0x1a, - 0x1e, 0x15, 0x8b, 0x56, 0xa7, 0xf3, 0xab, 0xca, 0xfc, 0x33, 0x97, 0x93, 0x79, 0x0d, 0x19, 0xa8, - 0xcc, 0x53, 0x43, 0xd7, 0xad, 0x71, 0x1d, 0xc8, 0x9f, 0x8b, 0x74, 0x0f, 0xac, 0xe0, 0xf3, 0x96, - 0xc7, 0x29, 0x7e, 0x0b, 0x1c, 0xf2, 0xf2, 0xd0, 0x63, 0x96, 0x9d, 0x5c, 0x29, 0xce, 0x79, 0x69, - 0xe6, 0xe1, 0xfb, 0x58, 0x7f, 0x69, 0xe0, 0x31, 0xab, 0x1e, 0x44, 0x55, 0x9f, 0x3e, 0xef, 0xf0, - 0x9d, 0x6c, 0x3d, 0x0c, 0x2f, 0x66, 0xfc, 0x21, 0xc4, 0xb3, 0xe5, 0x7c, 0x37, 0xeb, 0xa6, 0xa1, - 0xc5, 0x8c, 0x3e, 0x8c, 0x68, 0x81, 0x00, 0x4e, 0x03, 0x8b, 0x19, 0x7f, 0x84, 0x70, 0x42, 0x00, - 0xb7, 0x0f, 0xe1, 0xd7, 0x8f, 0xad, 0xc7, 0xa6, 0x43, 0xb1, 0x1b, 0x67, 0x1b, 0x71, 0x52, 0x31, - 0xd3, 0x8f, 0xe2, 0x1f, 0x27, 0x82, 0xdf, 0xc4, 0x36, 0x58, 0x06, 0xfc, 0x71, 0x44, 0xf3, 0xf5, - 0x7c, 0x92, 0xf5, 0x6a, 0xd3, 0x89, 0x19, 0x7f, 0x02, 0x71, 0x9d, 0x82, 0xad, 0xe3, 0x74, 0x62, - 0x16, 0x3c, 0x49, 0x5b, 0x47, 0x02, 0xc2, 0x46, 0x83, 0x89, 0x99, 0x3e, 0x45, 0x51, 0x27, 0x84, - 0xef, 0x61, 0x3d, 0x45, 0xb3, 0x31, 0xf3, 0x4f, 0x21, 0xdf, 0x62, 0x20, 0x02, 0x5a, 0xb3, 0x33, - 0x2b, 0x9e, 0xa6, 0x08, 0x68, 0x14, 0x5c, 0xa3, 0xea, 0x00, 0x63, 0x36, 0x3d, 0x43, 0xd7, 0xa8, - 0x32, 0xbf, 0x40, 0x36, 0xb3, 0x9a, 0x6f, 0x56, 0x3c, 0x4b, 0xd9, 0xcc, 0xd6, 0xc3, 0x36, 0xaa, - 0x13, 0x81, 0xd9, 0xf1, 0x1c, 0x6d, 0xa3, 0x32, 0x10, 0xf0, 0x19, 0x36, 0xb4, 0x76, 0x1a, 0x30, - 0xfb, 0x9e, 0x47, 0xdf, 0xe0, 0x9a, 0x61, 0x80, 0xdf, 0xce, 0xb6, 0xb4, 0x9f, 0x04, 0xcc, 0xd6, - 0xd3, 0x2b, 0x95, 0xff, 0xdd, 0xf4, 0x41, 0x80, 0x1f, 0x6e, 0xb5, 0x14, 0x7d, 0x0a, 0x30, 0x6b, - 0xcf, 0xac, 0x94, 0x0b, 0xb7, 0x3e, 0x04, 0xf0, 0x09, 0xc6, 0x5a, 0x0d, 0xd8, 0xec, 0x3a, 0x8b, - 0x2e, 0x0d, 0x82, 0xab, 0x81, 0xfd, 0xd7, 0xcc, 0x9f, 0xa3, 0xab, 0x81, 0x04, 0x5c, 0x0d, 0x6a, - 0xbd, 0x66, 0xfa, 0x3c, 0x5d, 0x0d, 0x42, 0xe0, 0x64, 0x6b, 0xdd, 0xcd, 0x6c, 0xb8, 0x40, 0x27, - 0x5b, 0xa3, 0xf8, 0x41, 0x36, 0xb8, 0xa6, 0x21, 0x9a, 0x55, 0x2f, 0xa3, 0x6a, 0x73, 0xb5, 0x1f, - 0xea, 0xcd, 0x0b, 0x9b, 0xa1, 0xd9, 0xf6, 0x4a, 0xa5, 0x79, 0x61, 0x2f, 0xe4, 0xe3, 0xac, 0x3b, - 0x4c, 0x7d, 0x1f, 0x2e, 0xcf, 0xd0, 0xb5, 0x6d, 0xba, 0xa9, 0xf0, 0x9b, 0xa4, 0xf8, 0x79, 0x15, - 0xa3, 0x43, 0x00, 0xdf, 0xc9, 0x36, 0x88, 0xa0, 0x2e, 0x9a, 0x26, 0xf2, 0x97, 0x55, 0x2a, 0x98, - 0xb0, 0x9a, 0xef, 0x61, 0x2c, 0x7f, 0x35, 0x02, 0x61, 0x36, 0xb1, 0xbf, 0xae, 0xe6, 0x6f, 0x69, - 0x34, 0xa4, 0x25, 0xc8, 0x92, 0x62, 0x10, 0x2c, 0x97, 0x05, 0x59, 0x46, 0x76, 0xb1, 0x8d, 0xf7, - 0x26, 0x32, 0x54, 0x8e, 0x6b, 0xa2, 0x7f, 0x43, 0x9a, 0xd6, 0x43, 0xc0, 0x02, 0x19, 0x0b, 0xe5, - 0xb8, 0x89, 0x89, 0xfd, 0x1d, 0xd9, 0x02, 0x00, 0xb8, 0xe1, 0x24, 0xca, 0xe6, 0xb9, 0xff, 0x20, - 0x98, 0x00, 0xd8, 0x34, 0x7c, 0x3e, 0x2a, 0x16, 0x4d, 0xec, 0x9f, 0xb4, 0x69, 0x5c, 0xcf, 0x77, - 0xb3, 0x1e, 0xf8, 0x98, 0xbd, 0x55, 0x32, 0xc1, 0x7f, 0x21, 0xdc, 0x22, 0xe0, 0x2f, 0x27, 0xaa, - 0xa9, 0x3c, 0x73, 0xb0, 0xff, 0xc6, 0x4c, 0xd3, 0x7a, 0x3e, 0xc1, 0x7a, 0x13, 0xd5, 0x6c, 0xa6, - 0x38, 0x9f, 0x1a, 0xf0, 0x7f, 0x56, 0x8b, 0x57, 0x16, 0x05, 0x03, 0xd9, 0xbe, 0xff, 0xa8, 0x8a, - 0xa4, 0x17, 0x2a, 0x11, 0x9b, 0x0c, 0x2b, 0x68, 0xd0, 0x10, 0x3e, 0xc9, 0xfa, 0xe0, 0x59, 0x62, - 0x11, 0x09, 0x47, 0x99, 0x4f, 0xeb, 0xbf, 0x18, 0x80, 0x12, 0xb4, 0xf7, 0x9e, 0x4b, 0x57, 0x46, - 0xbb, 0x2e, 0x5f, 0x19, 0xed, 0xfa, 0xf1, 0xca, 0x68, 0xd7, 0xa9, 0xa5, 0xd1, 0x75, 0x97, 0x97, - 0x46, 0xd7, 0xfd, 0xb0, 0x34, 0xba, 0x8e, 0x0d, 0x37, 0x64, 0x50, 0x35, 0xee, 0x65, 0xd3, 0x72, - 0x5a, 0xce, 0x64, 0x45, 0xec, 0xae, 0x1b, 0x5c, 0x4f, 0x2d, 0xa4, 0xf5, 0xb1, 0x86, 0x0c, 0xb2, - 0xd7, 0xb8, 0xad, 0xb7, 0xb5, 0xc5, 0x3f, 0x39, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xbe, - 0x0f, 0x06, 0xea, 0x15, 0x00, 0x00, -} diff --git a/core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go b/core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go deleted file mode 100644 index e42516d2..00000000 --- a/core-sdk/third_party/github.com/regen-network/cosmos-proto/cosmos.pb.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos_proto/cosmos.proto - -package cosmos_proto - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" - math "math" -) - -// 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 - -var E_InterfaceType = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*string)(nil), - Field: 93001, - Name: "cosmos_proto.interface_type", - Tag: "bytes,93001,opt,name=interface_type", - Filename: "cosmos_proto/cosmos.proto", -} - -var E_ImplementsInterface = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.MessageOptions)(nil), - ExtensionType: (*string)(nil), - Field: 93002, - Name: "cosmos_proto.implements_interface", - Tag: "bytes,93002,opt,name=implements_interface", - Filename: "cosmos_proto/cosmos.proto", -} - -var E_AcceptsInterface = &proto.ExtensionDesc{ - ExtendedType: (*descriptor.FieldOptions)(nil), - ExtensionType: (*string)(nil), - Field: 93001, - Name: "cosmos_proto.accepts_interface", - Tag: "bytes,93001,opt,name=accepts_interface", - Filename: "cosmos_proto/cosmos.proto", -} - -func init() { - proto.RegisterExtension(E_InterfaceType) - proto.RegisterExtension(E_ImplementsInterface) - proto.RegisterExtension(E_AcceptsInterface) -} - -func init() { proto.RegisterFile("cosmos_proto/cosmos.proto", fileDescriptor_706f3b7c96e3f128) } - -var fileDescriptor_706f3b7c96e3f128 = []byte{ - // 250 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0x8e, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x87, 0x70, 0xf4, 0xc0, 0x1c, 0x21, 0x1e, - 0x64, 0x29, 0x29, 0x85, 0xf4, 0xfc, 0xfc, 0xf4, 0x9c, 0x54, 0x7d, 0x30, 0x2f, 0xa9, 0x34, 0x4d, - 0x3f, 0x25, 0xb5, 0x38, 0xb9, 0x28, 0xb3, 0xa0, 0x24, 0xbf, 0x08, 0xa2, 0xde, 0xca, 0x83, 0x8b, - 0x2f, 0x33, 0xaf, 0x24, 0xb5, 0x28, 0x2d, 0x31, 0x39, 0x35, 0xbe, 0xa4, 0xb2, 0x20, 0x55, 0x48, - 0x5e, 0x0f, 0xa2, 0x49, 0x0f, 0xa6, 0x49, 0xcf, 0x37, 0xb5, 0xb8, 0x38, 0x31, 0x3d, 0xd5, 0xbf, - 0xa0, 0x24, 0x33, 0x3f, 0xaf, 0x58, 0xe2, 0xe4, 0x35, 0x56, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x5e, - 0xb8, 0xc6, 0x90, 0xca, 0x82, 0x54, 0xab, 0x10, 0x2e, 0x91, 0xcc, 0xdc, 0x82, 0x9c, 0xd4, 0xdc, - 0xd4, 0xbc, 0x92, 0xe2, 0x78, 0xb8, 0x1c, 0x61, 0xf3, 0x4e, 0x41, 0xcd, 0x13, 0x46, 0x68, 0xf7, - 0x84, 0xe9, 0xb6, 0xf2, 0xe1, 0x12, 0x4c, 0x4c, 0x4e, 0x4e, 0x2d, 0x40, 0x31, 0x52, 0x16, 0xc3, - 0x48, 0xb7, 0xcc, 0xd4, 0x9c, 0x14, 0x74, 0x07, 0x0a, 0x40, 0x75, 0xc2, 0x4d, 0x73, 0xb2, 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, 0xd5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, - 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xa2, 0xd4, 0xf4, 0xd4, 0x3c, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, - 0xfc, 0xa2, 0x6c, 0x68, 0xf0, 0xea, 0x42, 0xac, 0x62, 0x03, 0x53, 0xc6, 0x80, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x2a, 0xa4, 0xbe, 0x80, 0x82, 0x01, 0x00, 0x00, -} diff --git a/core-sdk/third_party/proto/confio/proofs.proto b/core-sdk/third_party/proto/confio/proofs.proto deleted file mode 100644 index da43503e..00000000 --- a/core-sdk/third_party/proto/confio/proofs.proto +++ /dev/null @@ -1,234 +0,0 @@ -syntax = "proto3"; - -package ics23; -option go_package = "github.com/confio/ics23/go"; - -enum HashOp { - // NO_HASH is the default if no data passed. Note this is an illegal argument some places. - NO_HASH = 0; - SHA256 = 1; - SHA512 = 2; - KECCAK = 3; - RIPEMD160 = 4; - BITCOIN = 5; // ripemd160(sha256(x)) -} - -/** -LengthOp defines how to process the key and value of the LeafOp -to include length information. After encoding the length with the given -algorithm, the length will be prepended to the key and value bytes. -(Each one with it's own encoded length) -*/ -enum LengthOp { - // NO_PREFIX don't include any length info - NO_PREFIX = 0; - // VAR_PROTO uses protobuf (and go-amino) varint encoding of the length - VAR_PROTO = 1; - // VAR_RLP uses rlp int encoding of the length - VAR_RLP = 2; - // FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer - FIXED32_BIG = 3; - // FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer - FIXED32_LITTLE = 4; - // FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer - FIXED64_BIG = 5; - // FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer - FIXED64_LITTLE = 6; - // REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) - REQUIRE_32_BYTES = 7; - // REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) - REQUIRE_64_BYTES = 8; -} - -/** -ExistenceProof takes a key and a value and a set of steps to perform on it. -The result of peforming all these steps will provide a "root hash", which can -be compared to the value in a header. - -Since it is computationally infeasible to produce a hash collission for any of the used -cryptographic hash functions, if someone can provide a series of operations to transform -a given key and value into a root hash that matches some trusted root, these key and values -must be in the referenced merkle tree. - -The only possible issue is maliablity in LeafOp, such as providing extra prefix data, -which should be controlled by a spec. Eg. with lengthOp as NONE, - prefix = FOO, key = BAR, value = CHOICE -and - prefix = F, key = OOBAR, value = CHOICE -would produce the same value. - -With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field -in the ProofSpec is valuable to prevent this mutability. And why all trees should -length-prefix the data before hashing it. -*/ -message ExistenceProof { - bytes key = 1; - bytes value = 2; - LeafOp leaf = 3; - repeated InnerOp path = 4; -} - -/* -NonExistenceProof takes a proof of two neighbors, one left of the desired key, -one right of the desired key. If both proofs are valid AND they are neighbors, -then there is no valid proof for the given key. -*/ -message NonExistenceProof { - bytes key = 1; // TODO: remove this as unnecessary??? we prove a range - ExistenceProof left = 2; - ExistenceProof right = 3; -} - -/* -CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages -*/ -message CommitmentProof { - oneof proof { - ExistenceProof exist = 1; - NonExistenceProof nonexist = 2; - BatchProof batch = 3; - CompressedBatchProof compressed = 4; - } -} - -/** -LeafOp represents the raw key-value data we wish to prove, and -must be flexible to represent the internal transformation from -the original key-value pairs into the basis hash, for many existing -merkle trees. - -key and value are passed in. So that the signature of this operation is: - leafOp(key, value) -> output - -To process this, first prehash the keys and values if needed (ANY means no hash in this case): - hkey = prehashKey(key) - hvalue = prehashValue(value) - -Then combine the bytes, and hash it - output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) -*/ -message LeafOp { - HashOp hash = 1; - HashOp prehash_key = 2; - HashOp prehash_value = 3; - LengthOp length = 4; - // prefix is a fixed bytes that may optionally be included at the beginning to differentiate - // a leaf node from an inner node. - bytes prefix = 5; -} - -/** -InnerOp represents a merkle-proof step that is not a leaf. -It represents concatenating two children and hashing them to provide the next result. - -The result of the previous step is passed in, so the signature of this op is: - innerOp(child) -> output - -The result of applying InnerOp should be: - output = op.hash(op.prefix || child || op.suffix) - - where the || operator is concatenation of binary data, -and child is the result of hashing all the tree below this step. - -Any special data, like prepending child with the length, or prepending the entire operation with -some value to differentiate from leaf nodes, should be included in prefix and suffix. -If either of prefix or suffix is empty, we just treat it as an empty string -*/ -message InnerOp { - HashOp hash = 1; - bytes prefix = 2; - bytes suffix = 3; -} - - -/** -ProofSpec defines what the expected parameters are for a given proof type. -This can be stored in the client and used to validate any incoming proofs. - - verify(ProofSpec, Proof) -> Proof | Error - -As demonstrated in tests, if we don't fix the algorithm used to calculate the -LeafHash for a given tree, there are many possible key-value pairs that can -generate a given hash (by interpretting the preimage differently). -We need this for proper security, requires client knows a priori what -tree format server uses. But not in code, rather a configuration object. -*/ -message ProofSpec { - // any field in the ExistenceProof must be the same as in this spec. - // except Prefix, which is just the first bytes of prefix (spec can be longer) - LeafOp leaf_spec = 1; - InnerSpec inner_spec = 2; - // max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) - int32 max_depth = 3; - // min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) - int32 min_depth = 4; -} - -/* -InnerSpec contains all store-specific structure info to determine if two proofs from a -given store are neighbors. - -This enables: - - isLeftMost(spec: InnerSpec, op: InnerOp) - isRightMost(spec: InnerSpec, op: InnerOp) - isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) -*/ -message InnerSpec { - // Child order is the ordering of the children node, must count from 0 - // iavl tree is [0, 1] (left then right) - // merk is [0, 2, 1] (left, right, here) - repeated int32 child_order = 1; - int32 child_size = 2; - int32 min_prefix_length = 3; - int32 max_prefix_length = 4; - // empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) - bytes empty_child = 5; - // hash is the algorithm that must be used for each InnerOp - HashOp hash = 6; -} - -/* -BatchProof is a group of multiple proof types than can be compressed -*/ -message BatchProof { - repeated BatchEntry entries = 1; -} - -// Use BatchEntry not CommitmentProof, to avoid recursion -message BatchEntry { - oneof proof { - ExistenceProof exist = 1; - NonExistenceProof nonexist = 2; - } -} - - -/****** all items here are compressed forms *******/ - -message CompressedBatchProof { - repeated CompressedBatchEntry entries = 1; - repeated InnerOp lookup_inners = 2; -} - -// Use BatchEntry not CommitmentProof, to avoid recursion -message CompressedBatchEntry { - oneof proof { - CompressedExistenceProof exist = 1; - CompressedNonExistenceProof nonexist = 2; - } -} - -message CompressedExistenceProof { - bytes key = 1; - bytes value = 2; - LeafOp leaf = 3; - // these are indexes into the lookup_inners table in CompressedBatchProof - repeated int32 path = 4; -} - -message CompressedNonExistenceProof { - bytes key = 1; // TODO: remove this as unnecessary??? we prove a range - CompressedExistenceProof left = 2; - CompressedExistenceProof right = 3; -} diff --git a/core-sdk/third_party/proto/cosmos_proto/cosmos.proto b/core-sdk/third_party/proto/cosmos_proto/cosmos.proto deleted file mode 100644 index 167b1707..00000000 --- a/core-sdk/third_party/proto/cosmos_proto/cosmos.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package cosmos_proto; - -import "google/protobuf/descriptor.proto"; - -option go_package = "github.com/regen-network/cosmos-proto"; - -extend google.protobuf.MessageOptions { - string interface_type = 93001; - - string implements_interface = 93002; -} - -extend google.protobuf.FieldOptions { - string accepts_interface = 93001; -} diff --git a/core-sdk/third_party/proto/gogoproto/gogo.proto b/core-sdk/third_party/proto/gogoproto/gogo.proto deleted file mode 100644 index 49e78f99..00000000 --- a/core-sdk/third_party/proto/gogoproto/gogo.proto +++ /dev/null @@ -1,145 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; -option go_package = "github.com/gogo/protobuf/gogoproto"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; - optional bool enumdecl = 62024; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; - optional bool typedecl_all = 63030; - optional bool enumdecl_all = 63031; - - optional bool goproto_registration = 63032; - optional bool messagename_all = 63033; - - optional bool goproto_sizecache_all = 63034; - optional bool goproto_unkeyed_all = 63035; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - optional bool compare = 64029; - - optional bool typedecl = 64030; - - optional bool messagename = 64033; - - optional bool goproto_sizecache = 64034; - optional bool goproto_unkeyed = 64035; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; - optional bool wktpointer = 65012; - - optional string castrepeated = 65013; -} diff --git a/core-sdk/third_party/proto/google/api/annotations.proto b/core-sdk/third_party/proto/google/api/annotations.proto deleted file mode 100644 index 85c361b4..00000000 --- a/core-sdk/third_party/proto/google/api/annotations.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2015, Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.api; - -import "google/api/http.proto"; -import "google/protobuf/descriptor.proto"; - -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "AnnotationsProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -extend google.protobuf.MethodOptions { - // See `HttpRule`. - HttpRule http = 72295728; -} diff --git a/core-sdk/third_party/proto/google/api/http.proto b/core-sdk/third_party/proto/google/api/http.proto deleted file mode 100644 index 2bd3a19b..00000000 --- a/core-sdk/third_party/proto/google/api/http.proto +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright 2018 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.api; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations"; -option java_multiple_files = true; -option java_outer_classname = "HttpProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - - -// Defines the HTTP configuration for an API service. It contains a list of -// [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method -// to one or more HTTP REST API methods. -message Http { - // A list of HTTP configuration rules that apply to individual API methods. - // - // **NOTE:** All service configuration rules follow "last one wins" order. - repeated HttpRule rules = 1; - - // When set to true, URL path parmeters will be fully URI-decoded except in - // cases of single segment matches in reserved expansion, where "%2F" will be - // left encoded. - // - // The default behavior is to not decode RFC 6570 reserved characters in multi - // segment matches. - bool fully_decode_reserved_expansion = 2; -} - -// `HttpRule` defines the mapping of an RPC method to one or more HTTP -// REST API methods. The mapping specifies how different portions of the RPC -// request message are mapped to URL path, URL query parameters, and -// HTTP request body. The mapping is typically specified as an -// `google.api.http` annotation on the RPC method, -// see "google/api/annotations.proto" for details. -// -// The mapping consists of a field specifying the path template and -// method kind. The path template can refer to fields in the request -// message, as in the example below which describes a REST GET -// operation on a resource collection of messages: -// -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}"; -// } -// } -// message GetMessageRequest { -// message SubMessage { -// string subfield = 1; -// } -// string message_id = 1; // mapped to the URL -// SubMessage sub = 2; // `sub.subfield` is url-mapped -// } -// message Message { -// string text = 1; // content of the resource -// } -// -// The same http annotation can alternatively be expressed inside the -// `GRPC API Configuration` YAML file. -// -// http: -// rules: -// - selector: .Messaging.GetMessage -// get: /v1/messages/{message_id}/{sub.subfield} -// -// This definition enables an automatic, bidrectional mapping of HTTP -// JSON to RPC. Example: -// -// HTTP | RPC -// -----|----- -// `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))` -// -// In general, not only fields but also field paths can be referenced -// from a path pattern. Fields mapped to the path pattern cannot be -// repeated and must have a primitive (non-message) type. -// -// Any fields in the request message which are not bound by the path -// pattern automatically become (optional) HTTP query -// parameters. Assume the following definition of the request message: -// -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http).get = "/v1/messages/{message_id}"; -// } -// } -// message GetMessageRequest { -// message SubMessage { -// string subfield = 1; -// } -// string message_id = 1; // mapped to the URL -// int64 revision = 2; // becomes a parameter -// SubMessage sub = 3; // `sub.subfield` becomes a parameter -// } -// -// -// This enables a HTTP JSON to RPC mapping as below: -// -// HTTP | RPC -// -----|----- -// `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))` -// -// Note that fields which are mapped to HTTP parameters must have a -// primitive type or a repeated primitive type. Message types are not -// allowed. In the case of a repeated type, the parameter can be -// repeated in the URL, as in `...?param=A¶m=B`. -// -// For HTTP method kinds which allow a request body, the `body` field -// specifies the mapping. Consider a REST update method on the -// message resource collection: -// -// -// service Messaging { -// rpc UpdateMessage(UpdateMessageRequest) returns (Message) { -// option (google.api.http) = { -// put: "/v1/messages/{message_id}" -// body: "message" -// }; -// } -// } -// message UpdateMessageRequest { -// string message_id = 1; // mapped to the URL -// Message message = 2; // mapped to the body -// } -// -// -// The following HTTP JSON to RPC mapping is enabled, where the -// representation of the JSON in the request body is determined by -// protos JSON encoding: -// -// HTTP | RPC -// -----|----- -// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })` -// -// The special name `*` can be used in the body mapping to define that -// every field not bound by the path template should be mapped to the -// request body. This enables the following alternative definition of -// the update method: -// -// service Messaging { -// rpc UpdateMessage(Message) returns (Message) { -// option (google.api.http) = { -// put: "/v1/messages/{message_id}" -// body: "*" -// }; -// } -// } -// message Message { -// string message_id = 1; -// string text = 2; -// } -// -// -// The following HTTP JSON to RPC mapping is enabled: -// -// HTTP | RPC -// -----|----- -// `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")` -// -// Note that when using `*` in the body mapping, it is not possible to -// have HTTP parameters, as all fields not bound by the path end in -// the body. This makes this option more rarely used in practice of -// defining REST APIs. The common usage of `*` is in custom methods -// which don't use the URL at all for transferring data. -// -// It is possible to define multiple HTTP methods for one RPC by using -// the `additional_bindings` option. Example: -// -// service Messaging { -// rpc GetMessage(GetMessageRequest) returns (Message) { -// option (google.api.http) = { -// get: "/v1/messages/{message_id}" -// additional_bindings { -// get: "/v1/users/{user_id}/messages/{message_id}" -// } -// }; -// } -// } -// message GetMessageRequest { -// string message_id = 1; -// string user_id = 2; -// } -// -// -// This enables the following two alternative HTTP JSON to RPC -// mappings: -// -// HTTP | RPC -// -----|----- -// `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` -// `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")` -// -// # Rules for HTTP mapping -// -// The rules for mapping HTTP path, query parameters, and body fields -// to the request message are as follows: -// -// 1. The `body` field specifies either `*` or a field path, or is -// omitted. If omitted, it indicates there is no HTTP request body. -// 2. Leaf fields (recursive expansion of nested messages in the -// request) can be classified into three types: -// (a) Matched in the URL template. -// (b) Covered by body (if body is `*`, everything except (a) fields; -// else everything under the body field) -// (c) All other fields. -// 3. URL query parameters found in the HTTP request are mapped to (c) fields. -// 4. Any body sent with an HTTP request can contain only (b) fields. -// -// The syntax of the path template is as follows: -// -// Template = "/" Segments [ Verb ] ; -// Segments = Segment { "/" Segment } ; -// Segment = "*" | "**" | LITERAL | Variable ; -// Variable = "{" FieldPath [ "=" Segments ] "}" ; -// FieldPath = IDENT { "." IDENT } ; -// Verb = ":" LITERAL ; -// -// The syntax `*` matches a single path segment. The syntax `**` matches zero -// or more path segments, which must be the last part of the path except the -// `Verb`. The syntax `LITERAL` matches literal text in the path. -// -// The syntax `Variable` matches part of the URL path as specified by its -// template. A variable template must not contain other variables. If a variable -// matches a single path segment, its template may be omitted, e.g. `{var}` -// is equivalent to `{var=*}`. -// -// If a variable contains exactly one path segment, such as `"{var}"` or -// `"{var=*}"`, when such a variable is expanded into a URL path, all characters -// except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the -// Discovery Document as `{var}`. -// -// If a variable contains one or more path segments, such as `"{var=foo/*}"` -// or `"{var=**}"`, when such a variable is expanded into a URL path, all -// characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables -// show up in the Discovery Document as `{+var}`. -// -// NOTE: While the single segment variable matches the semantics of -// [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 -// Simple String Expansion, the multi segment variable **does not** match -// RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion -// does not expand special characters like `?` and `#`, which would lead -// to invalid URLs. -// -// NOTE: the field paths in variables and in the `body` must not refer to -// repeated fields or map fields. -message HttpRule { - // Selects methods to which this rule applies. - // - // Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - string selector = 1; - - // Determines the URL pattern is matched by this rules. This pattern can be - // used with any of the {get|put|post|delete|patch} methods. A custom method - // can be defined using the 'custom' field. - oneof pattern { - // Used for listing and getting information about resources. - string get = 2; - - // Used for updating a resource. - string put = 3; - - // Used for creating a resource. - string post = 4; - - // Used for deleting a resource. - string delete = 5; - - // Used for updating a resource. - string patch = 6; - - // The custom pattern is used for specifying an HTTP method that is not - // included in the `pattern` field, such as HEAD, or "*" to leave the - // HTTP method unspecified for this rule. The wild-card rule is useful - // for services that provide content to Web (HTML) clients. - CustomHttpPattern custom = 8; - } - - // The name of the request field whose value is mapped to the HTTP body, or - // `*` for mapping all fields not captured by the path pattern to the HTTP - // body. NOTE: the referred field must not be a repeated field and must be - // present at the top-level of request message type. - string body = 7; - - // Optional. The name of the response field whose value is mapped to the HTTP - // body of response. Other response fields are ignored. When - // not set, the response message will be used as HTTP body of response. - string response_body = 12; - - // Additional HTTP bindings for the selector. Nested bindings must - // not contain an `additional_bindings` field themselves (that is, - // the nesting may only be one level deep). - repeated HttpRule additional_bindings = 11; -} - -// A custom pattern is used for defining custom HTTP verb. -message CustomHttpPattern { - // The name of this custom HTTP verb. - string kind = 1; - - // The path matched by this custom verb. - string path = 2; -} diff --git a/core-sdk/third_party/proto/google/api/httpbody.proto b/core-sdk/third_party/proto/google/api/httpbody.proto deleted file mode 100644 index 4428515c..00000000 --- a/core-sdk/third_party/proto/google/api/httpbody.proto +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.api; - -import "google/protobuf/any.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody"; -option java_multiple_files = true; -option java_outer_classname = "HttpBodyProto"; -option java_package = "com.google.api"; -option objc_class_prefix = "GAPI"; - -// Message that represents an arbitrary HTTP body. It should only be used for -// payload formats that can't be represented as JSON, such as raw binary or -// an HTML page. -// -// -// This message can be used both in streaming and non-streaming API methods in -// the request as well as the response. -// -// It can be used as a top-level request field, which is convenient if one -// wants to extract parameters from either the URL or HTTP template into the -// request fields and also want access to the raw HTTP body. -// -// Example: -// -// message GetResourceRequest { -// // A unique request id. -// string request_id = 1; -// -// // The raw HTTP body is bound to this field. -// google.api.HttpBody http_body = 2; -// } -// -// service ResourceService { -// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); -// rpc UpdateResource(google.api.HttpBody) returns -// (google.protobuf.Empty); -// } -// -// Example with streaming methods: -// -// service CaldavService { -// rpc GetCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// rpc UpdateCalendar(stream google.api.HttpBody) -// returns (stream google.api.HttpBody); -// } -// -// Use of this type only changes how the request and response bodies are -// handled, all other features will continue to work unchanged. -message HttpBody { - // The HTTP Content-Type header value specifying the content type of the body. - string content_type = 1; - - // The HTTP request/response body as raw binary. - bytes data = 2; - - // Application specific response metadata. Must be set in the first response - // for streaming APIs. - repeated google.protobuf.Any extensions = 3; -} \ No newline at end of file diff --git a/core-sdk/third_party/proto/google/protobuf/any.proto b/core-sdk/third_party/proto/google/protobuf/any.proto deleted file mode 100644 index 1431810e..00000000 --- a/core-sdk/third_party/proto/google/protobuf/any.proto +++ /dev/null @@ -1,161 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -import "gogoproto/gogo.proto"; - -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; -option go_package = "types"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "AnyProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; - -// `Any` contains an arbitrary serialized protocol buffer message along with a -// URL that describes the type of the serialized message. -// -// Protobuf library provides support to pack/unpack Any values in the form -// of utility functions or additional generated methods of the Any type. -// -// Example 1: Pack and unpack a message in C++. -// -// Foo foo = ...; -// Any any; -// any.PackFrom(foo); -// ... -// if (any.UnpackTo(&foo)) { -// ... -// } -// -// Example 2: Pack and unpack a message in Java. -// -// Foo foo = ...; -// Any any = Any.pack(foo); -// ... -// if (any.is(Foo.class)) { -// foo = any.unpack(Foo.class); -// } -// -// Example 3: Pack and unpack a message in Python. -// -// foo = Foo(...) -// any = Any() -// any.Pack(foo) -// ... -// if any.Is(Foo.DESCRIPTOR): -// any.Unpack(foo) -// ... -// -// Example 4: Pack and unpack a message in Go -// -// foo := &pb.Foo{...} -// any, err := ptypes.MarshalAny(foo) -// ... -// foo := &pb.Foo{} -// if err := ptypes.UnmarshalAny(any, foo); err != nil { -// ... -// } -// -// The pack methods provided by protobuf library will by default use -// 'type.googleapis.com/full.type.name' as the type URL and the unpack -// methods only use the fully qualified type name after the last '/' -// in the type URL, for example "foo.bar.com/x/y.z" will yield type -// name "y.z". -// -// -// JSON -// ==== -// The JSON representation of an `Any` value uses the regular -// representation of the deserialized, embedded message, with an -// additional field `@type` which contains the type URL. Example: -// -// package google.profile; -// message Person { -// string first_name = 1; -// string last_name = 2; -// } -// -// { -// "@type": "type.googleapis.com/google.profile.Person", -// "firstName": , -// "lastName": -// } -// -// If the embedded message type is well-known and has a custom JSON -// representation, that representation will be embedded adding a field -// `value` which holds the custom JSON in addition to the `@type` -// field. Example (for message [google.protobuf.Duration][]): -// -// { -// "@type": "type.googleapis.com/google.protobuf.Duration", -// "value": "1.212s" -// } -// -message Any { - // A URL/resource name that uniquely identifies the type of the serialized - // protocol buffer message. This string must contain at least - // one "/" character. The last segment of the URL's path must represent - // the fully qualified name of the type (as in - // `path/google.protobuf.Duration`). The name should be in a canonical form - // (e.g., leading "." is not accepted). - // - // In practice, teams usually precompile into the binary all types that they - // expect it to use in the context of Any. However, for URLs which use the - // scheme `http`, `https`, or no scheme, one can optionally set up a type - // server that maps type URLs to message definitions as follows: - // - // * If no scheme is provided, `https` is assumed. - // * An HTTP GET on the URL must yield a [google.protobuf.Type][] - // value in binary format, or produce an error. - // * Applications are allowed to cache lookup results based on the - // URL, or have them precompiled into a binary to avoid any - // lookup. Therefore, binary compatibility needs to be preserved - // on changes to types. (Use versioned type names to manage - // breaking changes.) - // - // Note: this functionality is not currently available in the official - // protobuf release, and it is not used for type URLs beginning with - // type.googleapis.com. - // - // Schemes other than `http`, `https` (or the empty scheme) might be - // used with implementation specific semantics. - // - string type_url = 1; - - // Must be a valid serialized protocol buffer of the above specified type. - bytes value = 2; - - option (gogoproto.typedecl) = false; -} - -option (gogoproto.goproto_registration) = false; diff --git a/core-sdk/third_party/proto/tendermint/abci/types.proto b/core-sdk/third_party/proto/tendermint/abci/types.proto deleted file mode 100644 index 09b96f1d..00000000 --- a/core-sdk/third_party/proto/tendermint/abci/types.proto +++ /dev/null @@ -1,407 +0,0 @@ -syntax = "proto3"; -package tendermint.abci; - -option go_package = "github.com/tendermint/tendermint/abci/types"; - -// For more information on gogo.proto, see: -// https://github.com/gogo/protobuf/blob/master/extensions.md -import "tendermint/crypto/proof.proto"; -import "tendermint/types/types.proto"; -import "tendermint/crypto/keys.proto"; -import "tendermint/types/params.proto"; -import "google/protobuf/timestamp.proto"; -import "gogoproto/gogo.proto"; - -// This file is copied from http://github.com/tendermint/abci -// NOTE: When using custom types, mind the warnings. -// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues - -//---------------------------------------- -// Request types - -message Request { - oneof value { - RequestEcho echo = 1; - RequestFlush flush = 2; - RequestInfo info = 3; - RequestSetOption set_option = 4; - RequestInitChain init_chain = 5; - RequestQuery query = 6; - RequestBeginBlock begin_block = 7; - RequestCheckTx check_tx = 8; - RequestDeliverTx deliver_tx = 9; - RequestEndBlock end_block = 10; - RequestCommit commit = 11; - RequestListSnapshots list_snapshots = 12; - RequestOfferSnapshot offer_snapshot = 13; - RequestLoadSnapshotChunk load_snapshot_chunk = 14; - RequestApplySnapshotChunk apply_snapshot_chunk = 15; - } -} - -message RequestEcho { - string message = 1; -} - -message RequestFlush {} - -message RequestInfo { - string version = 1; - uint64 block_version = 2; - uint64 p2p_version = 3; -} - -// nondeterministic -message RequestSetOption { - string key = 1; - string value = 2; -} - -message RequestInitChain { - google.protobuf.Timestamp time = 1 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - string chain_id = 2; - ConsensusParams consensus_params = 3; - repeated ValidatorUpdate validators = 4 [(gogoproto.nullable) = false]; - bytes app_state_bytes = 5; - int64 initial_height = 6; -} - -message RequestQuery { - bytes data = 1; - string path = 2; - int64 height = 3; - bool prove = 4; -} - -message RequestBeginBlock { - bytes hash = 1; - tendermint.types.Header header = 2 [(gogoproto.nullable) = false]; - LastCommitInfo last_commit_info = 3 [(gogoproto.nullable) = false]; - repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false]; -} - -enum CheckTxType { - NEW = 0 [(gogoproto.enumvalue_customname) = "New"]; - RECHECK = 1 [(gogoproto.enumvalue_customname) = "Recheck"]; -} - -message RequestCheckTx { - bytes tx = 1; - CheckTxType type = 2; -} - -message RequestDeliverTx { - bytes tx = 1; -} - -message RequestEndBlock { - int64 height = 1; -} - -message RequestCommit {} - -// lists available snapshots -message RequestListSnapshots { -} - -// offers a snapshot to the application -message RequestOfferSnapshot { - Snapshot snapshot = 1; // snapshot offered by peers - bytes app_hash = 2; // light client-verified app hash for snapshot height -} - -// loads a snapshot chunk -message RequestLoadSnapshotChunk { - uint64 height = 1; - uint32 format = 2; - uint32 chunk = 3; -} - -// Applies a snapshot chunk -message RequestApplySnapshotChunk { - uint32 index = 1; - bytes chunk = 2; - string sender = 3; -} - -//---------------------------------------- -// Response types - -message Response { - oneof value { - ResponseException exception = 1; - ResponseEcho echo = 2; - ResponseFlush flush = 3; - ResponseInfo info = 4; - ResponseSetOption set_option = 5; - ResponseInitChain init_chain = 6; - ResponseQuery query = 7; - ResponseBeginBlock begin_block = 8; - ResponseCheckTx check_tx = 9; - ResponseDeliverTx deliver_tx = 10; - ResponseEndBlock end_block = 11; - ResponseCommit commit = 12; - ResponseListSnapshots list_snapshots = 13; - ResponseOfferSnapshot offer_snapshot = 14; - ResponseLoadSnapshotChunk load_snapshot_chunk = 15; - ResponseApplySnapshotChunk apply_snapshot_chunk = 16; - } -} - -// nondeterministic -message ResponseException { - string error = 1; -} - -message ResponseEcho { - string message = 1; -} - -message ResponseFlush {} - -message ResponseInfo { - string data = 1; - - string version = 2; - uint64 app_version = 3; - - int64 last_block_height = 4; - bytes last_block_app_hash = 5; -} - -// nondeterministic -message ResponseSetOption { - uint32 code = 1; - // bytes data = 2; - string log = 3; - string info = 4; -} - -message ResponseInitChain { - ConsensusParams consensus_params = 1; - repeated ValidatorUpdate validators = 2 [(gogoproto.nullable) = false]; - bytes app_hash = 3; -} - -message ResponseQuery { - uint32 code = 1; - // bytes data = 2; // use "value" instead. - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 index = 5; - bytes key = 6; - bytes value = 7; - tendermint.crypto.ProofOps proof_ops = 8; - int64 height = 9; - string codespace = 10; -} - -message ResponseBeginBlock { - repeated Event events = 1 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; -} - -message ResponseCheckTx { - uint32 code = 1; - bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 gas_wanted = 5 [json_name = "gas_wanted"]; - int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; - string codespace = 8; -} - -message ResponseDeliverTx { - uint32 code = 1; - bytes data = 2; - string log = 3; // nondeterministic - string info = 4; // nondeterministic - int64 gas_wanted = 5 [json_name = "gas_wanted"]; - int64 gas_used = 6 [json_name = "gas_used"]; - repeated Event events = 7 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; - string codespace = 8; -} - -message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 - [(gogoproto.nullable) = false]; - ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "events,omitempty"]; -} - -message ResponseCommit { - // reserve 1 - bytes data = 2; - int64 retain_height = 3; -} - -message ResponseListSnapshots { - repeated Snapshot snapshots = 1; -} - -message ResponseOfferSnapshot { - Result result = 1; - - enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Snapshot accepted, apply chunks - ABORT = 2; // Abort all snapshot restoration - REJECT = 3; // Reject this specific snapshot, try others - REJECT_FORMAT = 4; // Reject all snapshots of this format, try others - REJECT_SENDER = 5; // Reject all snapshots from the sender(s), try others - } -} - -message ResponseLoadSnapshotChunk { - bytes chunk = 1; -} - -message ResponseApplySnapshotChunk { - Result result = 1; - repeated uint32 refetch_chunks = 2; // Chunks to refetch and reapply - repeated string reject_senders = 3; // Chunk senders to reject and ban - - enum Result { - UNKNOWN = 0; // Unknown result, abort all snapshot restoration - ACCEPT = 1; // Chunk successfully accepted - ABORT = 2; // Abort all snapshot restoration - RETRY = 3; // Retry chunk (combine with refetch and reject) - RETRY_SNAPSHOT = 4; // Retry snapshot (combine with refetch and reject) - REJECT_SNAPSHOT = 5; // Reject this snapshot, try others - } -} - -//---------------------------------------- -// Misc. - -// ConsensusParams contains all consensus-relevant parameters -// that can be adjusted by the abci app -message ConsensusParams { - BlockParams block = 1; - tendermint.types.EvidenceParams evidence = 2; - tendermint.types.ValidatorParams validator = 3; - tendermint.types.VersionParams version = 4; -} - -// BlockParams contains limits on the block size. -message BlockParams { - // Note: must be greater than 0 - int64 max_bytes = 1; - // Note: must be greater or equal to -1 - int64 max_gas = 2; -} - -message LastCommitInfo { - int32 round = 1; - repeated VoteInfo votes = 2 [(gogoproto.nullable) = false]; -} - -// Event allows application developers to attach additional information to -// ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. -// Later, transactions may be queried using these events. -message Event { - string type = 1; - repeated EventAttribute attributes = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "attributes,omitempty" - ]; -} - -// EventAttribute is a single key-value pair, associated with an event. -message EventAttribute { - bytes key = 1; - bytes value = 2; - bool index = 3; // nondeterministic -} - -// TxResult contains results of executing the transaction. -// -// One usage is indexing transaction results. -message TxResult { - int64 height = 1; - uint32 index = 2; - bytes tx = 3; - ResponseDeliverTx result = 4 [(gogoproto.nullable) = false]; -} - -//---------------------------------------- -// Blockchain Types - -// Validator -message Validator { - bytes address = 1; // The first 20 bytes of SHA256(public key) - // PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; // The voting power -} - -// ValidatorUpdate -message ValidatorUpdate { - tendermint.crypto.PublicKey pub_key = 1 [(gogoproto.nullable) = false]; - int64 power = 2; -} - -// VoteInfo -message VoteInfo { - Validator validator = 1 [(gogoproto.nullable) = false]; - bool signed_last_block = 2; -} - -enum EvidenceType { - UNKNOWN = 0; - DUPLICATE_VOTE = 1; - LIGHT_CLIENT_ATTACK = 2; -} - -message Evidence { - EvidenceType type = 1; - // The offending validator - Validator validator = 2 [(gogoproto.nullable) = false]; - // The height when the offense occurred - int64 height = 3; - // The corresponding time where the offense occurred - google.protobuf.Timestamp time = 4 [ - (gogoproto.nullable) = false, - (gogoproto.stdtime) = true - ]; - // Total voting power of the validator set in case the ABCI application does - // not store historical validators. - // https://github.com/tendermint/tendermint/issues/4581 - int64 total_voting_power = 5; -} - -//---------------------------------------- -// State Sync Types - -message Snapshot { - uint64 height = 1; // The height at which the snapshot was taken - uint32 format = 2; // The application-specific snapshot format - uint32 chunks = 3; // Number of chunks in the snapshot - bytes hash = 4; // Arbitrary snapshot hash, equal only if identical - bytes metadata = 5; // Arbitrary application metadata -} - -//---------------------------------------- -// Service Definition - -service ABCIApplication { - rpc Echo(RequestEcho) returns (ResponseEcho); - rpc Flush(RequestFlush) returns (ResponseFlush); - rpc Info(RequestInfo) returns (ResponseInfo); - rpc SetOption(RequestSetOption) returns (ResponseSetOption); - rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); - rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); - rpc Query(RequestQuery) returns (ResponseQuery); - rpc Commit(RequestCommit) returns (ResponseCommit); - rpc InitChain(RequestInitChain) returns (ResponseInitChain); - rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); - rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); - rpc ListSnapshots(RequestListSnapshots) returns (ResponseListSnapshots); - rpc OfferSnapshot(RequestOfferSnapshot) returns (ResponseOfferSnapshot); - rpc LoadSnapshotChunk(RequestLoadSnapshotChunk) returns (ResponseLoadSnapshotChunk); - rpc ApplySnapshotChunk(RequestApplySnapshotChunk) returns (ResponseApplySnapshotChunk); -} diff --git a/core-sdk/third_party/proto/tendermint/crypto/keys.proto b/core-sdk/third_party/proto/tendermint/crypto/keys.proto deleted file mode 100644 index af9db49f..00000000 --- a/core-sdk/third_party/proto/tendermint/crypto/keys.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; -package tendermint.crypto; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; - -import "gogoproto/gogo.proto"; - -// PublicKey defines the keys available for use with Tendermint Validators -message PublicKey { - option (gogoproto.compare) = true; - option (gogoproto.equal) = true; - - oneof sum { - bytes ed25519 = 1; - } -} diff --git a/core-sdk/third_party/proto/tendermint/crypto/proof.proto b/core-sdk/third_party/proto/tendermint/crypto/proof.proto deleted file mode 100644 index 975df768..00000000 --- a/core-sdk/third_party/proto/tendermint/crypto/proof.proto +++ /dev/null @@ -1,41 +0,0 @@ -syntax = "proto3"; -package tendermint.crypto; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/crypto"; - -import "gogoproto/gogo.proto"; - -message Proof { - int64 total = 1; - int64 index = 2; - bytes leaf_hash = 3; - repeated bytes aunts = 4; -} - -message ValueOp { - // Encoded in ProofOp.Key. - bytes key = 1; - - // To encode in ProofOp.Data - Proof proof = 2; -} - -message DominoOp { - string key = 1; - string input = 2; - string output = 3; -} - -// ProofOp defines an operation used for calculating Merkle root -// The data could be arbitrary format, providing nessecary data -// for example neighbouring node hash -message ProofOp { - string type = 1; - bytes key = 2; - bytes data = 3; -} - -// ProofOps is Merkle proof defined by the list of ProofOps -message ProofOps { - repeated ProofOp ops = 1 [(gogoproto.nullable) = false]; -} diff --git a/core-sdk/third_party/proto/tendermint/libs/bits/types.proto b/core-sdk/third_party/proto/tendermint/libs/bits/types.proto deleted file mode 100644 index 3111d113..00000000 --- a/core-sdk/third_party/proto/tendermint/libs/bits/types.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; -package tendermint.libs.bits; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/libs/bits"; - -message BitArray { - int64 bits = 1; - repeated uint64 elems = 2; -} diff --git a/core-sdk/third_party/proto/tendermint/types/evidence.proto b/core-sdk/third_party/proto/tendermint/types/evidence.proto deleted file mode 100644 index 3ff10c1b..00000000 --- a/core-sdk/third_party/proto/tendermint/types/evidence.proto +++ /dev/null @@ -1,31 +0,0 @@ -syntax = "proto3"; -package tendermint.types; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "tendermint/types/types.proto"; -import "tendermint/crypto/keys.proto"; - -// DuplicateVoteEvidence contains evidence a validator signed two conflicting -// votes. -message DuplicateVoteEvidence { - Vote vote_a = 1; - Vote vote_b = 2; - - google.protobuf.Timestamp timestamp = 3 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; -} - -message Evidence { - oneof sum { - DuplicateVoteEvidence duplicate_vote_evidence = 1; - } -} - -// EvidenceData contains any evidence of malicious wrong-doing by validators -message EvidenceData { - repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; - bytes hash = 2; -} diff --git a/core-sdk/third_party/proto/tendermint/types/params.proto b/core-sdk/third_party/proto/tendermint/types/params.proto deleted file mode 100644 index 897c07c1..00000000 --- a/core-sdk/third_party/proto/tendermint/types/params.proto +++ /dev/null @@ -1,81 +0,0 @@ -syntax = "proto3"; -package tendermint.types; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; - -import "gogoproto/gogo.proto"; -import "google/protobuf/duration.proto"; - -option (gogoproto.equal_all) = true; - -// ConsensusParams contains consensus critical parameters that determine the -// validity of blocks. -message ConsensusParams { - BlockParams block = 1 [(gogoproto.nullable) = false]; - EvidenceParams evidence = 2 [(gogoproto.nullable) = false]; - ValidatorParams validator = 3 [(gogoproto.nullable) = false]; - VersionParams version = 4 [(gogoproto.nullable) = false]; -} - -// BlockParams contains limits on the block size. -message BlockParams { - // Max block size, in bytes. - // Note: must be greater than 0 - int64 max_bytes = 1; - // Max gas per block. - // Note: must be greater or equal to -1 - int64 max_gas = 2; - // Minimum time increment between consecutive blocks (in milliseconds) If the - // block header timestamp is ahead of the system clock, decrease this value. - // - // Not exposed to the application. - int64 time_iota_ms = 3; -} - -// EvidenceParams determine how we handle evidence of malfeasance. -message EvidenceParams { - // Max age of evidence, in blocks. - // - // The basic formula for calculating this is: MaxAgeDuration / {average block - // time}. - int64 max_age_num_blocks = 1; - - // Max age of evidence, in time. - // - // It should correspond with an app's "unbonding period" or other similar - // mechanism for handling [Nothing-At-Stake - // attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). - google.protobuf.Duration max_age_duration = 2 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - - // This sets the maximum number of evidence that can be committed in a single block. - // and should fall comfortably under the max block bytes when we consider the size of - // each evidence (See MaxEvidenceBytes). The maximum number is MaxEvidencePerBlock. - // Default is 50 - uint32 max_num = 3; -} - -// ValidatorParams restrict the public key types validators can use. -// NOTE: uses ABCI pubkey naming, not Amino names. -message ValidatorParams { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; - - repeated string pub_key_types = 1; -} - -// VersionParams contains the ABCI application version. -message VersionParams { - option (gogoproto.populate) = true; - option (gogoproto.equal) = true; - - uint64 app_version = 1; -} - -// HashedParams is a subset of ConsensusParams. -// -// It is hashed into the Header.ConsensusHash. -message HashedParams { - int64 block_max_bytes = 1; - int64 block_max_gas = 2; -} diff --git a/core-sdk/third_party/proto/tendermint/types/types.proto b/core-sdk/third_party/proto/tendermint/types/types.proto deleted file mode 100644 index 2762f4a7..00000000 --- a/core-sdk/third_party/proto/tendermint/types/types.proto +++ /dev/null @@ -1,162 +0,0 @@ -syntax = "proto3"; -package tendermint.types; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; - -import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "tendermint/libs/bits/types.proto"; -import "tendermint/crypto/proof.proto"; -import "tendermint/version/types.proto"; -import "tendermint/types/validator.proto"; - -// BlockIdFlag indicates which BlcokID the signature is for -enum BlockIDFlag { - option (gogoproto.goproto_enum_stringer) = true; - option (gogoproto.goproto_enum_prefix) = false; - - BLOCK_ID_FLAG_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "BlockIDFlagUnknown"]; - BLOCK_ID_FLAG_ABSENT = 1 [(gogoproto.enumvalue_customname) = "BlockIDFlagAbsent"]; - BLOCK_ID_FLAG_COMMIT = 2 [(gogoproto.enumvalue_customname) = "BlockIDFlagCommit"]; - BLOCK_ID_FLAG_NIL = 3 [(gogoproto.enumvalue_customname) = "BlockIDFlagNil"]; -} - -// SignedMsgType is a type of signed message in the consensus. -enum SignedMsgType { - option (gogoproto.goproto_enum_stringer) = true; - option (gogoproto.goproto_enum_prefix) = false; - - SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"]; - // Votes - SIGNED_MSG_TYPE_PREVOTE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"]; - SIGNED_MSG_TYPE_PRECOMMIT = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"]; - - // Proposals - SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"]; -} - -// PartsetHeader -message PartSetHeader { - uint32 total = 1; - bytes hash = 2; -} - -message Part { - uint32 index = 1; - bytes bytes = 2; - tendermint.crypto.Proof proof = 3 [(gogoproto.nullable) = false]; -} - -// BlockID -message BlockID { - bytes hash = 1; - PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; -} - -// -------------------------------- - -// Header defines the structure of a Tendermint block header. -message Header { - // basic block info - tendermint.version.Consensus version = 1 [(gogoproto.nullable) = false]; - string chain_id = 2 [(gogoproto.customname) = "ChainID"]; - int64 height = 3; - google.protobuf.Timestamp time = 4 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - - // prev block info - BlockID last_block_id = 5 [(gogoproto.nullable) = false]; - - // hashes of block data - bytes last_commit_hash = 6; // commit from validators from the last block - bytes data_hash = 7; // transactions - - // hashes from the app output from the prev block - bytes validators_hash = 8; // validators for the current block - bytes next_validators_hash = 9; // validators for the next block - bytes consensus_hash = 10; // consensus params for current block - bytes app_hash = 11; // state after txs from the previous block - bytes last_results_hash = 12; // root hash of all results from the txs from the previous block - - // consensus info - bytes evidence_hash = 13; // evidence included in the block - bytes proposer_address = 14; // original proposer of the block -} - -// Data contains the set of transactions included in the block -message Data { - // Txs that will be applied by state @ block.Height+1. - // NOTE: not all txs here are valid. We're just agreeing on the order first. - // This means that block.AppHash does not include these txs. - repeated bytes txs = 1; - // Volatile - bytes hash = 2; -} - -// Vote represents a prevote, precommit, or commit vote from validators for -// consensus. -message Vote { - SignedMsgType type = 1; - int64 height = 2; - int32 round = 3; - BlockID block_id = 4 - [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; // zero if vote is nil. - google.protobuf.Timestamp timestamp = 5 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes validator_address = 6; - int32 validator_index = 7; - bytes signature = 8; -} - -// Commit contains the evidence that a block was committed by a set of validators. -message Commit { - int64 height = 1; - int32 round = 2; - BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; - repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; - bytes hash = 5; - tendermint.libs.bits.BitArray bit_array = 6; -} - -// CommitSig is a part of the Vote included in a Commit. -message CommitSig { - BlockIDFlag block_id_flag = 1; - bytes validator_address = 2; - google.protobuf.Timestamp timestamp = 3 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 4; -} - -message Proposal { - SignedMsgType type = 1; - int64 height = 2; - int32 round = 3; - int32 pol_round = 4; - BlockID block_id = 5 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - google.protobuf.Timestamp timestamp = 6 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; - bytes signature = 7; -} - -message SignedHeader { - Header header = 1; - Commit commit = 2; -} - -message LightBlock { - SignedHeader signed_header = 1; - tendermint.types.ValidatorSet validator_set = 2; -} - -message BlockMeta { - BlockID block_id = 1 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - int64 block_size = 2; - Header header = 3 [(gogoproto.nullable) = false]; - int64 num_txs = 4; -} - -// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. -message TxProof { - bytes root_hash = 1; - bytes data = 2; - tendermint.crypto.Proof proof = 3; -} diff --git a/core-sdk/third_party/proto/tendermint/types/validator.proto b/core-sdk/third_party/proto/tendermint/types/validator.proto deleted file mode 100644 index 49860b96..00000000 --- a/core-sdk/third_party/proto/tendermint/types/validator.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package tendermint.types; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; - -import "gogoproto/gogo.proto"; -import "tendermint/crypto/keys.proto"; - -message ValidatorSet { - repeated Validator validators = 1; - Validator proposer = 2; - int64 total_voting_power = 3; -} - -message Validator { - bytes address = 1; - tendermint.crypto.PublicKey pub_key = 2 [(gogoproto.nullable) = false]; - int64 voting_power = 3; - int64 proposer_priority = 4; -} - -message SimpleValidator { - tendermint.crypto.PublicKey pub_key = 1; - int64 voting_power = 2; -} diff --git a/core-sdk/third_party/proto/tendermint/version/types.proto b/core-sdk/third_party/proto/tendermint/version/types.proto deleted file mode 100644 index 6061868b..00000000 --- a/core-sdk/third_party/proto/tendermint/version/types.proto +++ /dev/null @@ -1,24 +0,0 @@ -syntax = "proto3"; -package tendermint.version; - -option go_package = "github.com/tendermint/tendermint/proto/tendermint/version"; - -import "gogoproto/gogo.proto"; - -// App includes the protocol and software version for the application. -// This information is included in ResponseInfo. The App.Protocol can be -// updated in ResponseEndBlock. -message App { - uint64 protocol = 1; - string software = 2; -} - -// Consensus captures the consensus rules for processing a block in the blockchain, -// including all blockchain data structures and the rules of the application's -// state transition machine. -message Consensus { - option (gogoproto.equal) = true; - - uint64 block = 1; - uint64 app = 2; -} diff --git a/core-sdk/third_party/protocgen.sh b/core-sdk/third_party/protocgen.sh deleted file mode 100755 index edc53057..00000000 --- a/core-sdk/third_party/protocgen.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail - -proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) -for dir in $proto_dirs; do - protoc \ - -I "proto" \ - -I "third_party/proto" \ - --gocosmos_out=plugins=interfacetype+grpc,\ -Mgoogle/protobuf/any.proto=github.com/irisnet/irishub-sdk-go/codec/types:. \ - $(find "${dir}" -maxdepth 1 -name '*.proto') - -done - -# move proto files to the right places -cp -r github.com/irisnet/core-sdk-go/* ./ -rm -fr github.com diff --git a/core-sdk/types/abci.pb.go b/core-sdk/types/abci.pb.go deleted file mode 100644 index 047f8cbc..00000000 --- a/core-sdk/types/abci.pb.go +++ /dev/null @@ -1,3084 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/abci/v1beta1/abci.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - codectypes "github.com/irisnet/core-sdk-go/common/codec/types" - types1 "github.com/tendermint/tendermint/abci/types" - io "io" - math "math" - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -// 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 - -// TxResponse defines a structure containing relevant tx data and metadata. The -// tags are stringified and the log is JSON decoded. -type TxResponse struct { - // The block height - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - // The transaction hash. - TxHash string `protobuf:"bytes,2,opt,name=txhash,proto3" json:"txhash,omitempty"` - // Namespace for the Code - Codespace string `protobuf:"bytes,3,opt,name=codespace,proto3" json:"codespace,omitempty"` - // Response code. - Code uint32 `protobuf:"varint,4,opt,name=code,proto3" json:"code,omitempty"` - // Result bytes, if any. - Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` - // The output of the application's logger (raw string). May be - // non-deterministic. - RawLog string `protobuf:"bytes,6,opt,name=raw_log,json=rawLog,proto3" json:"raw_log,omitempty"` - // The output of the application's logger (typed). May be non-deterministic. - Logs ABCIMessageLogs `protobuf:"bytes,7,rep,name=logs,proto3,castrepeated=ABCIMessageLogs" json:"logs"` - // Additional information. May be non-deterministic. - Info string `protobuf:"bytes,8,opt,name=info,proto3" json:"info,omitempty"` - // Amount of gas requested for transaction. - GasWanted int64 `protobuf:"varint,9,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"` - // Amount of gas consumed by transaction. - GasUsed int64 `protobuf:"varint,10,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"` - // The request transaction bytes. - Tx *codectypes.Any `protobuf:"bytes,11,opt,name=tx,proto3" json:"tx,omitempty"` - // Time of the previous block. For heights > 1, it's the weighted median of - // the timestamps of the valid votes in the block.LastCommit. For height == 1, - // it's genesis time. - Timestamp string `protobuf:"bytes,12,opt,name=timestamp,proto3" json:"timestamp,omitempty"` -} - -func (m *TxResponse) Reset() { *m = TxResponse{} } -func (*TxResponse) ProtoMessage() {} -func (*TxResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{0} -} -func (m *TxResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxResponse.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 *TxResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxResponse.Merge(m, src) -} -func (m *TxResponse) XXX_Size() int { - return m.Size() -} -func (m *TxResponse) XXX_DiscardUnknown() { - xxx_messageInfo_TxResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_TxResponse proto.InternalMessageInfo - -// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. -type ABCIMessageLog struct { - MsgIndex uint32 `protobuf:"varint,1,opt,name=msg_index,json=msgIndex,proto3" json:"msg_index,omitempty"` - Log string `protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"` - // Events contains a slice of Event objects that were emitted during some - // execution. - Events StringEvents `protobuf:"bytes,3,rep,name=events,proto3,castrepeated=StringEvents" json:"events"` -} - -func (m *ABCIMessageLog) Reset() { *m = ABCIMessageLog{} } -func (*ABCIMessageLog) ProtoMessage() {} -func (*ABCIMessageLog) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{1} -} -func (m *ABCIMessageLog) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ABCIMessageLog) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ABCIMessageLog.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 *ABCIMessageLog) XXX_Merge(src proto.Message) { - xxx_messageInfo_ABCIMessageLog.Merge(m, src) -} -func (m *ABCIMessageLog) XXX_Size() int { - return m.Size() -} -func (m *ABCIMessageLog) XXX_DiscardUnknown() { - xxx_messageInfo_ABCIMessageLog.DiscardUnknown(m) -} - -var xxx_messageInfo_ABCIMessageLog proto.InternalMessageInfo - -func (m *ABCIMessageLog) GetMsgIndex() uint32 { - if m != nil { - return m.MsgIndex - } - return 0 -} - -func (m *ABCIMessageLog) GetLog() string { - if m != nil { - return m.Log - } - return "" -} - -func (m *ABCIMessageLog) GetEvents() StringEvents { - if m != nil { - return m.Events - } - return nil -} - -// StringEvent defines en Event object wrapper where all the attributes -// contain key/value pairs that are strings instead of raw bytes. -type StringEvent struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Attributes []Attribute `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes"` -} - -func (m *StringEvent) Reset() { *m = StringEvent{} } -func (*StringEvent) ProtoMessage() {} -func (*StringEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{2} -} -func (m *StringEvent) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *StringEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_StringEvent.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 *StringEvent) XXX_Merge(src proto.Message) { - xxx_messageInfo_StringEvent.Merge(m, src) -} -func (m *StringEvent) XXX_Size() int { - return m.Size() -} -func (m *StringEvent) XXX_DiscardUnknown() { - xxx_messageInfo_StringEvent.DiscardUnknown(m) -} - -var xxx_messageInfo_StringEvent proto.InternalMessageInfo - -func (m *StringEvent) GetType() string { - if m != nil { - return m.Type - } - return "" -} - -func (m *StringEvent) GetAttributes() []Attribute { - if m != nil { - return m.Attributes - } - return nil -} - -// Attribute defines an attribute wrapper where the key and value are -// strings instead of raw bytes. -type Attribute struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Attribute) Reset() { *m = Attribute{} } -func (*Attribute) ProtoMessage() {} -func (*Attribute) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{3} -} -func (m *Attribute) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Attribute.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 *Attribute) XXX_Merge(src proto.Message) { - xxx_messageInfo_Attribute.Merge(m, src) -} -func (m *Attribute) XXX_Size() int { - return m.Size() -} -func (m *Attribute) XXX_DiscardUnknown() { - xxx_messageInfo_Attribute.DiscardUnknown(m) -} - -var xxx_messageInfo_Attribute proto.InternalMessageInfo - -func (m *Attribute) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *Attribute) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -// GasInfo defines tx execution gas context. -type GasInfo struct { - // GasWanted is the maximum units of work we allow this tx to perform. - GasWanted uint64 `protobuf:"varint,1,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty" yaml:"gas_wanted"` - // GasUsed is the amount of gas actually consumed. - GasUsed uint64 `protobuf:"varint,2,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty" yaml:"gas_used"` -} - -func (m *GasInfo) Reset() { *m = GasInfo{} } -func (*GasInfo) ProtoMessage() {} -func (*GasInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{4} -} -func (m *GasInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GasInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GasInfo.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 *GasInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_GasInfo.Merge(m, src) -} -func (m *GasInfo) XXX_Size() int { - return m.Size() -} -func (m *GasInfo) XXX_DiscardUnknown() { - xxx_messageInfo_GasInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_GasInfo proto.InternalMessageInfo - -func (m *GasInfo) GetGasWanted() uint64 { - if m != nil { - return m.GasWanted - } - return 0 -} - -func (m *GasInfo) GetGasUsed() uint64 { - if m != nil { - return m.GasUsed - } - return 0 -} - -// Result is the union of ResponseFormat and ResponseCheckTx. -type Result struct { - // Data is any data returned from message or handler execution. It MUST be - // length prefixed in order to separate data from multiple message executions. - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - // Log contains the log information from message or handler execution. - Log string `protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"` - // Events contains a slice of Event objects that were emitted during message - // or handler execution. - Events []types1.Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events"` -} - -func (m *Result) Reset() { *m = Result{} } -func (*Result) ProtoMessage() {} -func (*Result) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{5} -} -func (m *Result) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Result.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 *Result) XXX_Merge(src proto.Message) { - xxx_messageInfo_Result.Merge(m, src) -} -func (m *Result) XXX_Size() int { - return m.Size() -} -func (m *Result) XXX_DiscardUnknown() { - xxx_messageInfo_Result.DiscardUnknown(m) -} - -var xxx_messageInfo_Result proto.InternalMessageInfo - -// SimulationResponse defines the response generated when a transaction is -// successfully simulated. -type SimulationResponse struct { - GasInfo `protobuf:"bytes,1,opt,name=gas_info,json=gasInfo,proto3,embedded=gas_info" json:"gas_info"` - Result *Result `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` -} - -func (m *SimulationResponse) Reset() { *m = SimulationResponse{} } -func (*SimulationResponse) ProtoMessage() {} -func (*SimulationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{6} -} -func (m *SimulationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SimulationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SimulationResponse.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 *SimulationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_SimulationResponse.Merge(m, src) -} -func (m *SimulationResponse) XXX_Size() int { - return m.Size() -} -func (m *SimulationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_SimulationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_SimulationResponse proto.InternalMessageInfo - -func (m *SimulationResponse) GetResult() *Result { - if m != nil { - return m.Result - } - return nil -} - -// MsgData defines the data returned in a Result object during message -// execution. -type MsgData struct { - MsgType string `protobuf:"bytes,1,opt,name=msg_type,json=msgType,proto3" json:"msg_type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (m *MsgData) Reset() { *m = MsgData{} } -func (*MsgData) ProtoMessage() {} -func (*MsgData) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{7} -} -func (m *MsgData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgData.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 *MsgData) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgData.Merge(m, src) -} -func (m *MsgData) XXX_Size() int { - return m.Size() -} -func (m *MsgData) XXX_DiscardUnknown() { - xxx_messageInfo_MsgData.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgData proto.InternalMessageInfo - -func (m *MsgData) GetMsgType() string { - if m != nil { - return m.MsgType - } - return "" -} - -func (m *MsgData) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -// TxMsgData defines a list of MsgData. A transaction will have a MsgData object -// for each message. -type TxMsgData struct { - Data []*MsgData `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"` -} - -func (m *TxMsgData) Reset() { *m = TxMsgData{} } -func (*TxMsgData) ProtoMessage() {} -func (*TxMsgData) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{8} -} -func (m *TxMsgData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxMsgData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxMsgData.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 *TxMsgData) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxMsgData.Merge(m, src) -} -func (m *TxMsgData) XXX_Size() int { - return m.Size() -} -func (m *TxMsgData) XXX_DiscardUnknown() { - xxx_messageInfo_TxMsgData.DiscardUnknown(m) -} - -var xxx_messageInfo_TxMsgData proto.InternalMessageInfo - -func (m *TxMsgData) GetData() []*MsgData { - if m != nil { - return m.Data - } - return nil -} - -// SearchTxsResult defines a structure for querying txs pageable -type SearchTxsResult struct { - // Count of all txs - TotalCount uint64 `protobuf:"varint,1,opt,name=total_count,json=totalCount,proto3" json:"total_count" yaml:"total_count"` - // Count of txs in current page - Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` - // Index of current page, start from 1 - PageNumber uint64 `protobuf:"varint,3,opt,name=page_number,json=pageNumber,proto3" json:"page_number" yaml:"page_number"` - // Count of total pages - PageTotal uint64 `protobuf:"varint,4,opt,name=page_total,json=pageTotal,proto3" json:"page_total" yaml:"page_total"` - // Max count txs per page - Limit uint64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"` - // List of txs in current page - Txs []*TxResponse `protobuf:"bytes,6,rep,name=txs,proto3" json:"txs,omitempty"` -} - -func (m *SearchTxsResult) Reset() { *m = SearchTxsResult{} } -func (*SearchTxsResult) ProtoMessage() {} -func (*SearchTxsResult) Descriptor() ([]byte, []int) { - return fileDescriptor_4e37629bc7eb0df8, []int{9} -} -func (m *SearchTxsResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SearchTxsResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SearchTxsResult.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 *SearchTxsResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_SearchTxsResult.Merge(m, src) -} -func (m *SearchTxsResult) XXX_Size() int { - return m.Size() -} -func (m *SearchTxsResult) XXX_DiscardUnknown() { - xxx_messageInfo_SearchTxsResult.DiscardUnknown(m) -} - -var xxx_messageInfo_SearchTxsResult proto.InternalMessageInfo - -func (m *SearchTxsResult) GetTotalCount() uint64 { - if m != nil { - return m.TotalCount - } - return 0 -} - -func (m *SearchTxsResult) GetCount() uint64 { - if m != nil { - return m.Count - } - return 0 -} - -func (m *SearchTxsResult) GetPageNumber() uint64 { - if m != nil { - return m.PageNumber - } - return 0 -} - -func (m *SearchTxsResult) GetPageTotal() uint64 { - if m != nil { - return m.PageTotal - } - return 0 -} - -func (m *SearchTxsResult) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *SearchTxsResult) GetTxs() []*TxResponse { - if m != nil { - return m.Txs - } - return nil -} - -func init() { - proto.RegisterType((*TxResponse)(nil), "cosmos.base.abci.v1beta1.TxResponse") - proto.RegisterType((*ABCIMessageLog)(nil), "cosmos.base.abci.v1beta1.ABCIMessageLog") - proto.RegisterType((*StringEvent)(nil), "cosmos.base.abci.v1beta1.StringEvent") - proto.RegisterType((*Attribute)(nil), "cosmos.base.abci.v1beta1.Attribute") - proto.RegisterType((*GasInfo)(nil), "cosmos.base.abci.v1beta1.GasInfo") - proto.RegisterType((*Result)(nil), "cosmos.base.abci.v1beta1.Result") - proto.RegisterType((*SimulationResponse)(nil), "cosmos.base.abci.v1beta1.SimulationResponse") - proto.RegisterType((*MsgData)(nil), "cosmos.base.abci.v1beta1.MsgData") - proto.RegisterType((*TxMsgData)(nil), "cosmos.base.abci.v1beta1.TxMsgData") - proto.RegisterType((*SearchTxsResult)(nil), "cosmos.base.abci.v1beta1.SearchTxsResult") -} - -func init() { - proto.RegisterFile("cosmos/base/abci/v1beta1/abci.proto", fileDescriptor_4e37629bc7eb0df8) -} - -var fileDescriptor_4e37629bc7eb0df8 = []byte{ - // 930 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0x31, 0x73, 0x1b, 0x45, - 0x14, 0xd6, 0x49, 0xca, 0xc9, 0x7a, 0x72, 0x30, 0x2c, 0x26, 0x39, 0x27, 0xa0, 0x13, 0xe7, 0x64, - 0x50, 0x93, 0xd3, 0xc4, 0x09, 0x0c, 0xe3, 0x82, 0x99, 0x5c, 0x48, 0x88, 0x67, 0x12, 0x8a, 0xb5, - 0x32, 0xcc, 0xd0, 0x68, 0x56, 0xd2, 0x66, 0x75, 0x44, 0x77, 0xab, 0xb9, 0xdd, 0xb3, 0xe5, 0x8e, - 0x92, 0x92, 0x2a, 0x05, 0x15, 0x35, 0xbf, 0x24, 0x1d, 0x2e, 0x53, 0x30, 0x02, 0xec, 0x2e, 0xa5, - 0x7f, 0x01, 0xb3, 0x6f, 0xcf, 0xd2, 0x99, 0x8c, 0x53, 0x69, 0xdf, 0xf7, 0xde, 0xbe, 0x7d, 0xfb, - 0x7d, 0x9f, 0xf6, 0x60, 0x7b, 0x24, 0x55, 0x22, 0x55, 0x6f, 0xc8, 0x14, 0xef, 0xb1, 0xe1, 0x28, - 0xee, 0x1d, 0xdc, 0x1d, 0x72, 0xcd, 0xee, 0x62, 0x10, 0xce, 0x32, 0xa9, 0x25, 0xf1, 0x6c, 0x51, - 0x68, 0x8a, 0x42, 0xc4, 0x8b, 0xa2, 0x1b, 0x9b, 0x42, 0x0a, 0x89, 0x45, 0x3d, 0xb3, 0xb2, 0xf5, - 0x37, 0x6e, 0x6a, 0x9e, 0x8e, 0x79, 0x96, 0xc4, 0xa9, 0xb6, 0x3d, 0xf5, 0xd1, 0x8c, 0xab, 0x22, - 0xb9, 0x25, 0xa4, 0x14, 0x53, 0xde, 0xc3, 0x68, 0x98, 0xbf, 0xe8, 0xb1, 0xf4, 0xc8, 0xa6, 0x82, - 0x57, 0x35, 0x80, 0xfe, 0x9c, 0x72, 0x35, 0x93, 0xa9, 0xe2, 0xe4, 0x1a, 0xb8, 0x13, 0x1e, 0x8b, - 0x89, 0xf6, 0x9c, 0x8e, 0xd3, 0xad, 0xd1, 0x22, 0x22, 0x01, 0xb8, 0x7a, 0x3e, 0x61, 0x6a, 0xe2, - 0x55, 0x3b, 0x4e, 0xb7, 0x19, 0xc1, 0xc9, 0xc2, 0x77, 0xfb, 0xf3, 0x27, 0x4c, 0x4d, 0x68, 0x91, - 0x21, 0x9f, 0x42, 0x73, 0x24, 0xc7, 0x5c, 0xcd, 0xd8, 0x88, 0x7b, 0x35, 0x53, 0x46, 0x57, 0x00, - 0x21, 0x50, 0x37, 0x81, 0x57, 0xef, 0x38, 0xdd, 0xab, 0x14, 0xd7, 0x06, 0x1b, 0x33, 0xcd, 0xbc, - 0x2b, 0x58, 0x8c, 0x6b, 0x72, 0x1d, 0x1a, 0x19, 0x3b, 0x1c, 0x4c, 0xa5, 0xf0, 0x5c, 0x84, 0xdd, - 0x8c, 0x1d, 0x3e, 0x95, 0x82, 0x3c, 0x87, 0xfa, 0x54, 0x0a, 0xe5, 0x35, 0x3a, 0xb5, 0x6e, 0x6b, - 0xa7, 0x1b, 0x5e, 0x46, 0x50, 0xf8, 0x20, 0x7a, 0xb8, 0xf7, 0x8c, 0x2b, 0xc5, 0x04, 0x7f, 0x2a, - 0x45, 0x74, 0xfd, 0xf5, 0xc2, 0xaf, 0xfc, 0xf1, 0xb7, 0xbf, 0x71, 0x11, 0x57, 0x14, 0xdb, 0x99, - 0x19, 0xe2, 0xf4, 0x85, 0xf4, 0xd6, 0xec, 0x0c, 0x66, 0x4d, 0x3e, 0x03, 0x10, 0x4c, 0x0d, 0x0e, - 0x59, 0xaa, 0xf9, 0xd8, 0x6b, 0x22, 0x13, 0x4d, 0xc1, 0xd4, 0x0f, 0x08, 0x90, 0x2d, 0x58, 0x33, - 0xe9, 0x5c, 0xf1, 0xb1, 0x07, 0x98, 0x6c, 0x08, 0xa6, 0x9e, 0x2b, 0x3e, 0x26, 0xb7, 0xa0, 0xaa, - 0xe7, 0x5e, 0xab, 0xe3, 0x74, 0x5b, 0x3b, 0x9b, 0xa1, 0xa5, 0x3d, 0x3c, 0xa7, 0x3d, 0x7c, 0x90, - 0x1e, 0xd1, 0xaa, 0x9e, 0x1b, 0xa6, 0x74, 0x9c, 0x70, 0xa5, 0x59, 0x32, 0xf3, 0xd6, 0x2d, 0x53, - 0x4b, 0x60, 0xb7, 0xfe, 0xcb, 0xef, 0x7e, 0x25, 0xf8, 0xcd, 0x81, 0x0f, 0x2e, 0x4e, 0x4c, 0x6e, - 0x42, 0x33, 0x51, 0x62, 0x10, 0xa7, 0x63, 0x3e, 0x47, 0x7d, 0xae, 0xd2, 0xb5, 0x44, 0x89, 0x3d, - 0x13, 0x93, 0x0f, 0xa1, 0x66, 0x38, 0x43, 0x79, 0xa8, 0x59, 0x92, 0x7d, 0x70, 0xf9, 0x01, 0x4f, - 0xb5, 0xf2, 0x6a, 0x48, 0xd9, 0xed, 0xcb, 0x29, 0xdb, 0xd7, 0x59, 0x9c, 0x8a, 0x47, 0xa6, 0x3a, - 0xda, 0x2c, 0xf8, 0x5a, 0x2f, 0x81, 0x8a, 0x16, 0xad, 0x76, 0xeb, 0x3f, 0xff, 0xd5, 0x71, 0x82, - 0x0c, 0x5a, 0xa5, 0xac, 0xe1, 0xd0, 0xd8, 0x0d, 0x67, 0x6a, 0x52, 0x5c, 0x93, 0x3d, 0x00, 0xa6, - 0x75, 0x16, 0x0f, 0x73, 0xcd, 0x95, 0x57, 0xc5, 0x09, 0xb6, 0xdf, 0x23, 0xda, 0x79, 0x6d, 0x54, - 0x37, 0xe7, 0xd3, 0xd2, 0xe6, 0xe2, 0xcc, 0x7b, 0xd0, 0x5c, 0x16, 0x99, 0xdb, 0xbe, 0xe4, 0x47, - 0xc5, 0x81, 0x66, 0x49, 0x36, 0xe1, 0xca, 0x01, 0x9b, 0xe6, 0xbc, 0x60, 0xc0, 0x06, 0x81, 0x84, - 0xc6, 0x77, 0x4c, 0xed, 0x19, 0x51, 0xef, 0x5f, 0x10, 0xd5, 0xec, 0xac, 0x47, 0x9f, 0x9c, 0x2d, - 0xfc, 0x8f, 0x8e, 0x58, 0x32, 0xdd, 0x0d, 0x56, 0xb9, 0xa0, 0xac, 0x75, 0x58, 0xd2, 0xba, 0x8a, - 0x7b, 0x3e, 0x3e, 0x5b, 0xf8, 0x1b, 0xab, 0x3d, 0x26, 0x13, 0x2c, 0x0d, 0x10, 0xfc, 0x04, 0x2e, - 0xe5, 0x2a, 0x9f, 0xea, 0xa5, 0xb9, 0xcd, 0x49, 0xeb, 0x85, 0xb9, 0xdf, 0x15, 0xe9, 0xfe, 0xff, - 0x44, 0xba, 0x16, 0xae, 0xfe, 0xc8, 0x96, 0x21, 0xab, 0x8a, 0x65, 0x65, 0xa9, 0x02, 0x5a, 0xe4, - 0x95, 0x03, 0x64, 0x3f, 0x4e, 0xf2, 0x29, 0xd3, 0xb1, 0x4c, 0x97, 0xff, 0xe1, 0xc7, 0x76, 0x64, - 0x74, 0xb5, 0x83, 0x4e, 0xfc, 0xfc, 0x72, 0xde, 0x0b, 0x76, 0xa2, 0x35, 0xd3, 0xff, 0x78, 0xe1, - 0x3b, 0x78, 0x15, 0x24, 0xec, 0x6b, 0x70, 0x33, 0xbc, 0x0a, 0xce, 0xdb, 0xda, 0xe9, 0x5c, 0xde, - 0xc5, 0x5e, 0x99, 0x16, 0xf5, 0xc1, 0x37, 0xd0, 0x78, 0xa6, 0xc4, 0xb7, 0xe6, 0xc6, 0x5b, 0x60, - 0x2c, 0x3a, 0x28, 0xd9, 0xa3, 0x91, 0x28, 0xd1, 0x37, 0x0e, 0x39, 0x27, 0xa8, 0xba, 0x22, 0xa8, - 0x90, 0xfa, 0x09, 0x34, 0xfb, 0xf3, 0xf3, 0x0e, 0x5f, 0x2e, 0x79, 0xac, 0xbd, 0xff, 0x2a, 0xc5, - 0x86, 0x0b, 0x9d, 0xfe, 0xac, 0xc2, 0xc6, 0x3e, 0x67, 0xd9, 0x68, 0xd2, 0x9f, 0xab, 0x42, 0x98, - 0xc7, 0xd0, 0xd2, 0x52, 0xb3, 0xe9, 0x60, 0x24, 0xf3, 0x54, 0x17, 0x4e, 0xb8, 0xfd, 0x76, 0xe1, - 0x97, 0xe1, 0xb3, 0x85, 0x4f, 0xac, 0xc8, 0x25, 0x30, 0xa0, 0x80, 0xd1, 0x43, 0x13, 0x18, 0xc7, - 0xd9, 0x0e, 0xe8, 0x0b, 0x6a, 0x03, 0xd3, 0x7d, 0xc6, 0x04, 0x1f, 0xa4, 0x79, 0x32, 0xe4, 0x19, - 0xbe, 0x83, 0x45, 0xf7, 0x12, 0xbc, 0xea, 0x5e, 0x02, 0x03, 0x0a, 0x26, 0xfa, 0x1e, 0x03, 0x12, - 0x01, 0x46, 0x03, 0x3c, 0x10, 0x5f, 0xcd, 0x7a, 0xb4, 0xfd, 0x76, 0xe1, 0x97, 0xd0, 0x95, 0x79, - 0x57, 0x58, 0x40, 0x9b, 0x26, 0xe8, 0x9b, 0xb5, 0x99, 0x70, 0x1a, 0x27, 0xb1, 0xc6, 0x07, 0xb6, - 0x4e, 0x6d, 0x40, 0xbe, 0x82, 0x9a, 0x9e, 0x2b, 0xcf, 0x45, 0x3e, 0x6f, 0x5d, 0xce, 0xe7, 0xea, - 0xb3, 0x40, 0xcd, 0x06, 0xcb, 0x68, 0xf4, 0xe8, 0xcd, 0xbf, 0xed, 0xca, 0xeb, 0x93, 0xb6, 0x73, - 0x7c, 0xd2, 0x76, 0xfe, 0x39, 0x69, 0x3b, 0xbf, 0x9e, 0xb6, 0x2b, 0xc7, 0xa7, 0xed, 0xca, 0x9b, - 0xd3, 0x76, 0xe5, 0xc7, 0x2f, 0x44, 0xac, 0x27, 0xf9, 0x30, 0x1c, 0xc9, 0xa4, 0x17, 0x67, 0xb1, - 0x4a, 0xb9, 0xc6, 0xdf, 0x49, 0x3e, 0xbc, 0xa3, 0xc6, 0x2f, 0xef, 0x08, 0x69, 0x3f, 0x4c, 0x43, - 0x17, 0x1f, 0xc5, 0x7b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x88, 0xd0, 0x11, 0x0d, 0x07, - 0x00, 0x00, -} - -func (m *TxResponse) 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 *TxResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Timestamp) > 0 { - i -= len(m.Timestamp) - copy(dAtA[i:], m.Timestamp) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Timestamp))) - i-- - dAtA[i] = 0x62 - } - if m.Tx != nil { - { - size, err := m.Tx.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - if m.GasUsed != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasUsed)) - i-- - dAtA[i] = 0x50 - } - if m.GasWanted != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasWanted)) - i-- - dAtA[i] = 0x48 - } - if len(m.Info) > 0 { - i -= len(m.Info) - copy(dAtA[i:], m.Info) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Info))) - i-- - dAtA[i] = 0x42 - } - if len(m.Logs) > 0 { - for iNdEx := len(m.Logs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Logs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.RawLog) > 0 { - i -= len(m.RawLog) - copy(dAtA[i:], m.RawLog) - i = encodeVarintAbci(dAtA, i, uint64(len(m.RawLog))) - i-- - dAtA[i] = 0x32 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x2a - } - if m.Code != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Code)) - i-- - dAtA[i] = 0x20 - } - if len(m.Codespace) > 0 { - i -= len(m.Codespace) - copy(dAtA[i:], m.Codespace) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Codespace))) - i-- - dAtA[i] = 0x1a - } - if len(m.TxHash) > 0 { - i -= len(m.TxHash) - copy(dAtA[i:], m.TxHash) - i = encodeVarintAbci(dAtA, i, uint64(len(m.TxHash))) - i-- - dAtA[i] = 0x12 - } - if m.Height != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Height)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ABCIMessageLog) 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 *ABCIMessageLog) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ABCIMessageLog) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Events) > 0 { - for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Log) > 0 { - i -= len(m.Log) - copy(dAtA[i:], m.Log) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Log))) - i-- - dAtA[i] = 0x12 - } - if m.MsgIndex != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.MsgIndex)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *StringEvent) 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 *StringEvent) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *StringEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Attributes) > 0 { - for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Attribute) 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 *Attribute) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GasInfo) 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 *GasInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GasInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.GasUsed != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasUsed)) - i-- - dAtA[i] = 0x10 - } - if m.GasWanted != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.GasWanted)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Result) 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 *Result) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Events) > 0 { - for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Log) > 0 { - i -= len(m.Log) - copy(dAtA[i:], m.Log) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Log))) - i-- - dAtA[i] = 0x12 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SimulationResponse) 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 *SimulationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SimulationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Result != nil { - { - size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - { - size, err := m.GasInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgData) 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 *MsgData) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgData) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintAbci(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x12 - } - if len(m.MsgType) > 0 { - i -= len(m.MsgType) - copy(dAtA[i:], m.MsgType) - i = encodeVarintAbci(dAtA, i, uint64(len(m.MsgType))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TxMsgData) 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 *TxMsgData) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxMsgData) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - for iNdEx := len(m.Data) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Data[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SearchTxsResult) 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 *SearchTxsResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SearchTxsResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Txs) > 0 { - for iNdEx := len(m.Txs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Txs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAbci(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if m.Limit != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x28 - } - if m.PageTotal != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.PageTotal)) - i-- - dAtA[i] = 0x20 - } - if m.PageNumber != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.PageNumber)) - i-- - dAtA[i] = 0x18 - } - if m.Count != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.Count)) - i-- - dAtA[i] = 0x10 - } - if m.TotalCount != 0 { - i = encodeVarintAbci(dAtA, i, uint64(m.TotalCount)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintAbci(dAtA []byte, offset int, v uint64) int { - offset -= sovAbci(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *TxResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovAbci(uint64(m.Height)) - } - l = len(m.TxHash) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Codespace) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if m.Code != 0 { - n += 1 + sovAbci(uint64(m.Code)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.RawLog) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Logs) > 0 { - for _, e := range m.Logs { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - l = len(m.Info) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if m.GasWanted != 0 { - n += 1 + sovAbci(uint64(m.GasWanted)) - } - if m.GasUsed != 0 { - n += 1 + sovAbci(uint64(m.GasUsed)) - } - if m.Tx != nil { - l = m.Tx.Size() - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Timestamp) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *ABCIMessageLog) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MsgIndex != 0 { - n += 1 + sovAbci(uint64(m.MsgIndex)) - } - l = len(m.Log) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Events) > 0 { - for _, e := range m.Events { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *StringEvent) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Attributes) > 0 { - for _, e := range m.Attributes { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *Attribute) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *GasInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.GasWanted != 0 { - n += 1 + sovAbci(uint64(m.GasWanted)) - } - if m.GasUsed != 0 { - n += 1 + sovAbci(uint64(m.GasUsed)) - } - return n -} - -func (m *Result) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Log) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - if len(m.Events) > 0 { - for _, e := range m.Events { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *SimulationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.GasInfo.Size() - n += 1 + l + sovAbci(uint64(l)) - if m.Result != nil { - l = m.Result.Size() - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *MsgData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MsgType) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovAbci(uint64(l)) - } - return n -} - -func (m *TxMsgData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Data) > 0 { - for _, e := range m.Data { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func (m *SearchTxsResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TotalCount != 0 { - n += 1 + sovAbci(uint64(m.TotalCount)) - } - if m.Count != 0 { - n += 1 + sovAbci(uint64(m.Count)) - } - if m.PageNumber != 0 { - n += 1 + sovAbci(uint64(m.PageNumber)) - } - if m.PageTotal != 0 { - n += 1 + sovAbci(uint64(m.PageTotal)) - } - if m.Limit != 0 { - n += 1 + sovAbci(uint64(m.Limit)) - } - if len(m.Txs) > 0 { - for _, e := range m.Txs { - l = e.Size() - n += 1 + l + sovAbci(uint64(l)) - } - } - return n -} - -func sovAbci(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAbci(x uint64) (n int) { - return sovAbci(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ABCIMessageLog) String() string { - if this == nil { - return "nil" - } - repeatedStringForEvents := "[]StringEvent{" - for _, f := range this.Events { - repeatedStringForEvents += strings.Replace(strings.Replace(f.String(), "StringEvent", "StringEvent", 1), `&`, ``, 1) + "," - } - repeatedStringForEvents += "}" - s := strings.Join([]string{`&ABCIMessageLog{`, - `MsgIndex:` + fmt.Sprintf("%v", this.MsgIndex) + `,`, - `Log:` + fmt.Sprintf("%v", this.Log) + `,`, - `Events:` + repeatedStringForEvents + `,`, - `}`, - }, "") - return s -} -func (this *StringEvent) String() string { - if this == nil { - return "nil" - } - repeatedStringForAttributes := "[]Attribute{" - for _, f := range this.Attributes { - repeatedStringForAttributes += fmt.Sprintf("%v", f) + "," - } - repeatedStringForAttributes += "}" - s := strings.Join([]string{`&StringEvent{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Attributes:` + repeatedStringForAttributes + `,`, - `}`, - }, "") - return s -} -func (this *MsgData) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MsgData{`, - `MsgType:` + fmt.Sprintf("%v", this.MsgType) + `,`, - `Data:` + fmt.Sprintf("%v", this.Data) + `,`, - `}`, - }, "") - return s -} -func (this *TxMsgData) String() string { - if this == nil { - return "nil" - } - repeatedStringForData := "[]*MsgData{" - for _, f := range this.Data { - repeatedStringForData += strings.Replace(f.String(), "MsgData", "MsgData", 1) + "," - } - repeatedStringForData += "}" - s := strings.Join([]string{`&TxMsgData{`, - `Data:` + repeatedStringForData + `,`, - `}`, - }, "") - return s -} -func (this *SearchTxsResult) String() string { - if this == nil { - return "nil" - } - repeatedStringForTxs := "[]*TxResponse{" - for _, f := range this.Txs { - repeatedStringForTxs += strings.Replace(fmt.Sprintf("%v", f), "TxResponse", "TxResponse", 1) + "," - } - repeatedStringForTxs += "}" - s := strings.Join([]string{`&SearchTxsResult{`, - `TotalCount:` + fmt.Sprintf("%v", this.TotalCount) + `,`, - `Count:` + fmt.Sprintf("%v", this.Count) + `,`, - `PageNumber:` + fmt.Sprintf("%v", this.PageNumber) + `,`, - `PageTotal:` + fmt.Sprintf("%v", this.PageTotal) + `,`, - `Limit:` + fmt.Sprintf("%v", this.Limit) + `,`, - `Txs:` + repeatedStringForTxs + `,`, - `}`, - }, "") - return s -} -func valueToStringAbci(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *TxResponse) 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 ErrIntOverflowAbci - } - 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: TxResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TxHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Codespace", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Codespace = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - m.Code = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Code |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawLog", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RawLog = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Logs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Logs = append(m.Logs, ABCIMessageLog{}) - if err := m.Logs[len(m.Logs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Info = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasWanted", wireType) - } - m.GasWanted = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasWanted |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) - } - m.GasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasUsed |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tx == nil { - m.Tx = &codectypes.Any{} - } - if err := m.Tx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Timestamp = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ABCIMessageLog) 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 ErrIntOverflowAbci - } - 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: ABCIMessageLog: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ABCIMessageLog: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgIndex", wireType) - } - m.MsgIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MsgIndex |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Log", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Log = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Events = append(m.Events, StringEvent{}) - if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StringEvent) 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 ErrIntOverflowAbci - } - 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: StringEvent: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StringEvent: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attributes = append(m.Attributes, Attribute{}) - if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Attribute) 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 ErrIntOverflowAbci - } - 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: Attribute: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Attribute: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GasInfo) 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 ErrIntOverflowAbci - } - 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: GasInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GasInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasWanted", wireType) - } - m.GasWanted = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasWanted |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasUsed", wireType) - } - m.GasUsed = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasUsed |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Result) 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 ErrIntOverflowAbci - } - 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: Result: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Result: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Log", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Log = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Events = append(m.Events, types1.Event{}) - if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SimulationResponse) 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 ErrIntOverflowAbci - } - 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: SimulationResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SimulationResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GasInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.GasInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Result == nil { - m.Result = &Result{} - } - if err := m.Result.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgData) 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 ErrIntOverflowAbci - } - 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: MsgData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MsgType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - 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 ErrInvalidLengthAbci - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MsgType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TxMsgData) 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 ErrIntOverflowAbci - } - 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: TxMsgData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxMsgData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data, &MsgData{}) - if err := m.Data[len(m.Data)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SearchTxsResult) 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 ErrIntOverflowAbci - } - 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: SearchTxsResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SearchTxsResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalCount", wireType) - } - m.TotalCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PageNumber", wireType) - } - m.PageNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PageNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PageTotal", wireType) - } - m.PageTotal = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PageTotal |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Txs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAbci - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAbci - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAbci - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Txs = append(m.Txs, &TxResponse{}) - if err := m.Txs[len(m.Txs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAbci(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAbci - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAbci(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, ErrIntOverflowAbci - } - 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, ErrIntOverflowAbci - } - 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, ErrIntOverflowAbci - } - 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, ErrInvalidLengthAbci - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAbci - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAbci - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAbci = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAbci = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAbci = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/types/account.go b/core-sdk/types/account.go deleted file mode 100644 index 448613aa..00000000 --- a/core-sdk/types/account.go +++ /dev/null @@ -1,10 +0,0 @@ -package types - -// BaseAccount defines the basic structure of the account -type BaseAccount struct { - Address string `json:"address"` - Coins Coins `json:"coins"` - PubKey string `json:"public_key"` - AccountNumber uint64 `json:"account_number"` - Sequence uint64 `json:"sequence"` -} diff --git a/core-sdk/types/address.go b/core-sdk/types/address.go deleted file mode 100644 index 1c977838..00000000 --- a/core-sdk/types/address.go +++ /dev/null @@ -1,352 +0,0 @@ -package types - -import ( - "bytes" - "encoding/hex" - "encoding/json" - "errors" - "fmt" - - "github.com/irisnet/core-sdk-go/common/bech32" -) - -const ( - // AddrLen defines a valid address length - AddrLen = 20 -) - -// AccAddress a wrapper around bytes meant to represent an account address. -// When marshaled to a string or JSON, it uses Bech32. -type AccAddress []byte - -// AccAddressFromBech32 creates an AccAddress from a Bech32 string. -func AccAddressFromBech32(address string) (AccAddress, Error) { - bech32PrefixAccAddr := GetAddrPrefixCfg().GetBech32AccountAddrPrefix() - bz, err := GetFromBech32(address, bech32PrefixAccAddr) - if err != nil { - return nil, Wrap(err) - } - - return AccAddress(bz), nil -} - -func ValidateAccAddress(address string) Error { - bech32PrefixAccAddr := GetAddrPrefixCfg().GetBech32AccountAddrPrefix() - _, err := GetFromBech32(address, bech32PrefixAccAddr) - if err != nil { - return Wrap(err) - } - return nil -} - -func MustAccAddressFromBech32(address string) AccAddress { - addr, err := AccAddressFromBech32(address) - if err != nil { - panic(err) - } - return addr -} - -// String implements the Stringer interface. -func (aa AccAddress) String() string { - if aa.Empty() { - return "" - } - - bech32PrefixAccAddr := GetAddrPrefixCfg().GetBech32AccountAddrPrefix() - bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixAccAddr, aa.Bytes()) - if err != nil { - panic(err) - } - - return bech32Addr -} - -// Returns boolean for whether two AccAddresses are equal -func (aa AccAddress) Equals(aa2 AccAddress) bool { - if aa.Empty() && aa2.Empty() { - return true - } - - return bytes.Equal(aa.Bytes(), aa2.Bytes()) -} - -// Returns boolean for whether an AccAddress is empty -func (aa AccAddress) Empty() bool { - if aa == nil { - return true - } - - aa2 := AccAddress{} - return bytes.Equal(aa.Bytes(), aa2.Bytes()) -} - -// Marshal returns the raw address bytes. It is needed for protobuf -// compatibility. -func (aa AccAddress) Marshal() ([]byte, error) { - return aa, nil -} - -// Unmarshal sets the address to the given data. It is needed for protobuf -// compatibility. -func (aa *AccAddress) Unmarshal(data []byte) error { - *aa = data - return nil -} - -// MarshalJSON marshals to JSON using Bech32. -func (aa AccAddress) MarshalJSON() ([]byte, error) { - return json.Marshal(aa.String()) -} - -// UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (aa *AccAddress) UnmarshalJSON(data []byte) error { - var s string - err := json.Unmarshal(data, &s) - if err != nil { - return err - } - - aa2, err := AccAddressFromBech32(s) - if err != nil { - return err - } - - *aa = aa2 - return nil -} - -// Bytes returns the raw address bytes. -func (aa AccAddress) Bytes() []byte { - return aa -} - -// ---------------------------------------------------------------------------- -// validator operator -// ---------------------------------------------------------------------------- - -// ValAddress defines a wrapper around bytes meant to present a validator's -// operator. When marshaled to a string or JSON, it uses Bech32. -type ValAddress []byte - -// ValAddressFromBech32 creates a ValAddress from a Bech32 string. -func ValAddressFromBech32(address string) (ValAddress, Error) { - bech32PrefixValAddr := GetAddrPrefixCfg().GetBech32ValidatorAddrPrefix() - bz, err := bech32.GetFromBech32(address, bech32PrefixValAddr) - if err != nil { - return nil, Wrap(err) - } - - return ValAddress(bz), nil -} - -// Returns boolean for whether two ValAddresses are equal -func (va ValAddress) Equals(va2 ValAddress) bool { - if va.Empty() && va2.Empty() { - return true - } - - return bytes.Equal(va.Bytes(), va2.Bytes()) -} - -// Returns boolean for whether an AccAddress is empty -func (va ValAddress) Empty() bool { - if va == nil { - return true - } - - va2 := ValAddress{} - return bytes.Equal(va.Bytes(), va2.Bytes()) -} - -// Marshal returns the raw address bytes. It is needed for protobuf -// compatibility. -func (va ValAddress) Marshal() ([]byte, error) { - return va, nil -} - -// Unmarshal sets the address to the given data. It is needed for protobuf -// compatibility. -func (va *ValAddress) Unmarshal(data []byte) error { - *va = data - return nil -} - -// MarshalJSON marshals to JSON using Bech32. -func (va ValAddress) MarshalJSON() ([]byte, error) { - return json.Marshal(va.String()) -} - -// UnmarshalJSON unmarshals from JSON assuming Bech32 encoding. -func (va *ValAddress) UnmarshalJSON(data []byte) error { - var s string - - err := json.Unmarshal(data, &s) - if err != nil { - return nil - } - - va2, err := ValAddressFromBech32(s) - if err != nil { - return err - } - - *va = va2 - return nil -} - -// Bytes returns the raw address bytes. -func (va ValAddress) Bytes() []byte { - return va -} - -// String implements the Stringer interface. -func (va ValAddress) String() string { - bech32PrefixValAddr := GetAddrPrefixCfg().GetBech32ValidatorAddrPrefix() - bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixValAddr, va.Bytes()) - if err != nil { - panic(err) - } - - return bech32Addr -} - -// Format implements the fmt.Formatter interface. -// nolint: errcheck -func (va ValAddress) Format(s fmt.State, verb rune) { - switch verb { - case 's': - _, _ = s.Write([]byte(va.String())) - case 'p': - _, _ = s.Write([]byte(fmt.Sprintf("%p", va))) - default: - _, _ = s.Write([]byte(fmt.Sprintf("%X", []byte(va)))) - } -} - -// ConsAddress defines a wrapper around bytes meant to present a consensus node. -// When marshaled to a string or JSON, it uses Bech32. -type ConsAddress []byte - -// String implements the Stringer interface. -func (ca ConsAddress) String() string { - bech32PrefixConsAddr := GetAddrPrefixCfg().GetBech32ConsensusAddrPrefix() - bech32Addr, err := bech32.ConvertAndEncode(bech32PrefixConsAddr, ca.Bytes()) - if err != nil { - panic(err) - } - - return bech32Addr -} - -// Bytes returns the raw address bytes. -func (ca ConsAddress) Bytes() []byte { - return ca -} - -// ConsAddressFromHex creates a ConsAddress from a hex string. -func ConsAddressFromHex(address string) (addr ConsAddress, err error) { - if len(address) == 0 { - return addr, errors.New("decoding Bech32 address failed: must provide an address") - } - - bz, err := hex.DecodeString(address) - if err != nil { - return nil, err - } - - return ConsAddress(bz), nil -} - -// GetFromBech32 decodes a bytestring from a Bech32 encoded string. -func GetFromBech32(bech32str, prefix string) ([]byte, error) { - if len(bech32str) == 0 { - return nil, errors.New("decoding Bech32 address failed: must provide an address") - } - - hrp, bz, err := bech32.DecodeAndConvert(bech32str) - if err != nil { - return nil, err - } - - if hrp != prefix { - return nil, fmt.Errorf("invalid Bech32 prefix; expected %s, got %s", prefix, hrp) - } - - return bz, nil -} - -// ConsPubKey defines a wrapper around bytes meant to present a consensus node. -// When marshaled to a string or JSON, it uses Bech32. -type ConsPubKey []byte - -// String implements the Stringer interface. -func (cp ConsPubKey) String() string { - bech32PrefixConsPub := GetAddrPrefixCfg().GetBech32ConsensusPubPrefix() - bech32Pub, err := bech32.ConvertAndEncode(bech32PrefixConsPub, cp.Bytes()) - if err != nil { - panic(err) - } - - return bech32Pub -} - -// Bytes returns the raw address bytes. -func (cp ConsPubKey) Bytes() []byte { - return cp -} - -// Bech32PubKeyType defines a string type alias for a Bech32 public key type. -type Bech32PubKeyType string - -// Bech32 conversion constants -const ( - Bech32PubKeyTypeAccPub Bech32PubKeyType = "accpub" - Bech32PubKeyTypeValPub Bech32PubKeyType = "valpub" - Bech32PubKeyTypeConsPub Bech32PubKeyType = "conspub" -) - -// Bech32ifyPubKey returns a Bech32 encoded string containing the appropriate -// prefix based on the key type provided for a given PublicKey. -func Bech32ifyPubKey(pkt Bech32PubKeyType, pubkey TmPubKey) (string, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ValidatorPubPrefix() - - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ConsensusPubPrefix() - - } - - return bech32.ConvertAndEncode(bech32Prefix, pubkey.Bytes()) -} - -// GetPubKeyFromBech32 returns a PublicKey from a bech32-encoded PublicKey with -// a given key type. -func GetPubKeyFromBech32(pkt Bech32PubKeyType, pubkeyStr string) (TmPubKey, error) { - var bech32Prefix string - - switch pkt { - case Bech32PubKeyTypeAccPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32AccountPubPrefix() - - case Bech32PubKeyTypeValPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ValidatorPubPrefix() - - case Bech32PubKeyTypeConsPub: - bech32Prefix = GetAddrPrefixCfg().GetBech32ConsensusPubPrefix() - - } - - bz, err := GetFromBech32(pubkeyStr, bech32Prefix) - if err != nil { - return nil, err - } - - return PubKeyFromBytes(bz) -} diff --git a/core-sdk/types/address_test.go b/core-sdk/types/address_test.go deleted file mode 100644 index 3030bce1..00000000 --- a/core-sdk/types/address_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package types - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/irisnet/core-sdk-go/common/bech32" -) - -func TestGetFromBech32(t *testing.T) { - addBz, err := bech32.GetFromBech32("caa1rgnu8grzt6mwnjg7jss7w0sfyjn67g4em9njf5", "caa") - require.NoError(t, err) - addr, err := bech32.ConvertAndEncode("iaa", addBz) - require.NoError(t, err) - fmt.Println(addr) - - addBz, err = bech32.GetFromBech32("ccp1ulx45dfpqdnyust0a8ezcdhjjn3cekla9wx9lnpqmer9httzvstx64mns5njqzr4fdd", "ccp") - require.NoError(t, err) - - addr, err = bech32.ConvertAndEncode("icp", addBz) - require.NoError(t, err) - fmt.Println(addr) -} diff --git a/core-sdk/types/auth/auth.pb.go b/core-sdk/types/auth/auth.pb.go deleted file mode 100644 index 72719d8d..00000000 --- a/core-sdk/types/auth/auth.pb.go +++ /dev/null @@ -1,1049 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/auth/v1beta1/auth.proto - -package auth - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types "github.com/irisnet/core-sdk-go/common/codec/types" - - _ "github.com/regen-network/cosmos-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 - -// BaseAccount defines a base account type. It contains all the necessary fields -// for basic account functionality. Any custom account type should extend this -// type for additional functionality (e.g. vesting). -type BaseAccount struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - PubKey *types.Any `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` - AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` - Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` -} - -func (m *BaseAccount) Reset() { *m = BaseAccount{} } -func (*BaseAccount) ProtoMessage() {} -func (*BaseAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_7e1f7e915d020d2d, []int{0} -} -func (m *BaseAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BaseAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BaseAccount.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 *BaseAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_BaseAccount.Merge(m, src) -} -func (m *BaseAccount) XXX_Size() int { - return m.Size() -} -func (m *BaseAccount) XXX_DiscardUnknown() { - xxx_messageInfo_BaseAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_BaseAccount proto.InternalMessageInfo - -// ModuleAccount defines an account for modules that holds coins on a pool. -type ModuleAccount struct { - *BaseAccount `protobuf:"bytes,1,opt,name=base_account,json=baseAccount,proto3,embedded=base_account" json:"base_account,omitempty" yaml:"base_account"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Permissions []string `protobuf:"bytes,3,rep,name=permissions,proto3" json:"permissions,omitempty"` -} - -func (m *ModuleAccount) Reset() { *m = ModuleAccount{} } -func (*ModuleAccount) ProtoMessage() {} -func (*ModuleAccount) Descriptor() ([]byte, []int) { - return fileDescriptor_7e1f7e915d020d2d, []int{1} -} -func (m *ModuleAccount) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModuleAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModuleAccount.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 *ModuleAccount) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModuleAccount.Merge(m, src) -} -func (m *ModuleAccount) XXX_Size() int { - return m.Size() -} -func (m *ModuleAccount) XXX_DiscardUnknown() { - xxx_messageInfo_ModuleAccount.DiscardUnknown(m) -} - -var xxx_messageInfo_ModuleAccount proto.InternalMessageInfo - -// Params defines the parameters for the auth module. -type Params struct { - MaxMemoCharacters uint64 `protobuf:"varint,1,opt,name=max_memo_characters,json=maxMemoCharacters,proto3" json:"max_memo_characters,omitempty" yaml:"max_memo_characters"` - TxSigLimit uint64 `protobuf:"varint,2,opt,name=tx_sig_limit,json=txSigLimit,proto3" json:"tx_sig_limit,omitempty" yaml:"tx_sig_limit"` - TxSizeCostPerByte uint64 `protobuf:"varint,3,opt,name=tx_size_cost_per_byte,json=txSizeCostPerByte,proto3" json:"tx_size_cost_per_byte,omitempty" yaml:"tx_size_cost_per_byte"` - SigVerifyCostED25519 uint64 `protobuf:"varint,4,opt,name=sig_verify_cost_ed25519,json=sigVerifyCostEd25519,proto3" json:"sig_verify_cost_ed25519,omitempty" yaml:"sig_verify_cost_ed25519"` - SigVerifyCostSecp256k1 uint64 `protobuf:"varint,5,opt,name=sig_verify_cost_secp256k1,json=sigVerifyCostSecp256k1,proto3" json:"sig_verify_cost_secp256k1,omitempty" yaml:"sig_verify_cost_secp256k1"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_7e1f7e915d020d2d, []int{2} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetMaxMemoCharacters() uint64 { - if m != nil { - return m.MaxMemoCharacters - } - return 0 -} - -func (m *Params) GetTxSigLimit() uint64 { - if m != nil { - return m.TxSigLimit - } - return 0 -} - -func (m *Params) GetTxSizeCostPerByte() uint64 { - if m != nil { - return m.TxSizeCostPerByte - } - return 0 -} - -func (m *Params) GetSigVerifyCostED25519() uint64 { - if m != nil { - return m.SigVerifyCostED25519 - } - return 0 -} - -func (m *Params) GetSigVerifyCostSecp256k1() uint64 { - if m != nil { - return m.SigVerifyCostSecp256k1 - } - return 0 -} - -func init() { - proto.RegisterType((*BaseAccount)(nil), "cosmos.auth.v1beta1.BaseAccount") - proto.RegisterType((*ModuleAccount)(nil), "cosmos.auth.v1beta1.ModuleAccount") - proto.RegisterType((*Params)(nil), "cosmos.auth.v1beta1.Params") -} - -func init() { proto.RegisterFile("cosmos/auth/v1beta1/auth.proto", fileDescriptor_7e1f7e915d020d2d) } - -var fileDescriptor_7e1f7e915d020d2d = []byte{ - // 681 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0xcf, 0x4f, 0xdb, 0x48, - 0x14, 0x8e, 0x37, 0x59, 0x7e, 0x4c, 0x00, 0x09, 0x13, 0xc0, 0xc9, 0xae, 0x6c, 0xcb, 0xa7, 0x1c, - 0x36, 0x8e, 0x92, 0x15, 0x2b, 0x91, 0xc3, 0x6a, 0x31, 0x5b, 0xa9, 0xa8, 0x05, 0x21, 0x23, 0xf5, - 0x50, 0x55, 0x72, 0xc7, 0xce, 0xe0, 0x58, 0x64, 0x3c, 0xc6, 0x33, 0x46, 0x31, 0x7f, 0x41, 0x8f, - 0x3d, 0xf6, 0xc8, 0x1f, 0xc1, 0x7f, 0xd0, 0x4b, 0x8f, 0x88, 0x53, 0x4f, 0x6e, 0x15, 0x2e, 0x55, - 0x8f, 0xb9, 0x57, 0xaa, 0x32, 0xe3, 0x84, 0x04, 0xa5, 0xa7, 0xcc, 0xfb, 0xbe, 0xef, 0x7d, 0xef, - 0xcd, 0x7b, 0x13, 0x03, 0xd5, 0x23, 0x14, 0x13, 0xda, 0x84, 0x09, 0xeb, 0x35, 0xaf, 0x5a, 0x2e, - 0x62, 0xb0, 0xc5, 0x03, 0x33, 0x8a, 0x09, 0x23, 0xf2, 0x96, 0xe0, 0x4d, 0x0e, 0xe5, 0x7c, 0xad, - 0x2a, 0x40, 0x87, 0x4b, 0x9a, 0xb9, 0x82, 0x07, 0xb5, 0x8a, 0x4f, 0x7c, 0x22, 0xf0, 0xf1, 0x29, - 0x47, 0xab, 0x3e, 0x21, 0x7e, 0x1f, 0x35, 0x79, 0xe4, 0x26, 0xe7, 0x4d, 0x18, 0xa6, 0x82, 0x32, - 0x7e, 0x48, 0xa0, 0x6c, 0x41, 0x8a, 0x0e, 0x3c, 0x8f, 0x24, 0x21, 0x93, 0x15, 0xb0, 0x0c, 0xbb, - 0xdd, 0x18, 0x51, 0xaa, 0x48, 0xba, 0x54, 0x5f, 0xb5, 0x27, 0xa1, 0xfc, 0x06, 0x2c, 0x47, 0x89, - 0xeb, 0x5c, 0xa0, 0x54, 0xf9, 0x4d, 0x97, 0xea, 0xe5, 0x76, 0xc5, 0x14, 0xb6, 0xe6, 0xc4, 0xd6, - 0x3c, 0x08, 0x53, 0xab, 0xf1, 0x3d, 0xd3, 0x2a, 0x51, 0xe2, 0xf6, 0x03, 0x6f, 0xac, 0xfd, 0x8b, - 0xe0, 0x80, 0x21, 0x1c, 0xb1, 0x74, 0x94, 0x69, 0x9b, 0x29, 0xc4, 0xfd, 0x8e, 0xf1, 0xc8, 0x1a, - 0xf6, 0x52, 0x94, 0xb8, 0x2f, 0x50, 0x2a, 0xff, 0x07, 0x36, 0xa0, 0x68, 0xc1, 0x09, 0x13, 0xec, - 0xa2, 0x58, 0x29, 0xea, 0x52, 0xbd, 0x64, 0x55, 0x47, 0x99, 0xb6, 0x2d, 0xd2, 0xe6, 0x79, 0xc3, - 0x5e, 0xcf, 0x81, 0x13, 0x1e, 0xcb, 0x35, 0xb0, 0x42, 0xd1, 0x65, 0x82, 0x42, 0x0f, 0x29, 0xa5, - 0x71, 0xae, 0x3d, 0x8d, 0x3b, 0xca, 0xbb, 0x1b, 0xad, 0xf0, 0xe1, 0x46, 0x2b, 0x7c, 0xbb, 0xd1, - 0x0a, 0xf7, 0xb7, 0x8d, 0x95, 0xfc, 0xba, 0x47, 0xc6, 0x47, 0x09, 0xac, 0x1f, 0x93, 0x6e, 0xd2, - 0x9f, 0x4e, 0xe0, 0x2d, 0x58, 0x73, 0x21, 0x45, 0x4e, 0xee, 0xce, 0xc7, 0x50, 0x6e, 0xeb, 0xe6, - 0x82, 0x4d, 0x98, 0x33, 0x93, 0xb3, 0xfe, 0xb8, 0xcb, 0x34, 0x69, 0x94, 0x69, 0x5b, 0xa2, 0xdb, - 0x59, 0x0f, 0xc3, 0x2e, 0xbb, 0x33, 0x33, 0x96, 0x41, 0x29, 0x84, 0x18, 0xf1, 0x31, 0xae, 0xda, - 0xfc, 0x2c, 0xeb, 0xa0, 0x1c, 0xa1, 0x18, 0x07, 0x94, 0x06, 0x24, 0xa4, 0x4a, 0x51, 0x2f, 0xd6, - 0x57, 0xed, 0x59, 0xa8, 0x53, 0x9b, 0xdc, 0xe1, 0xfe, 0xb6, 0xb1, 0x31, 0xd7, 0xf2, 0x91, 0xf1, - 0xa5, 0x08, 0x96, 0x4e, 0x61, 0x0c, 0x31, 0x95, 0x4f, 0xc0, 0x16, 0x86, 0x03, 0x07, 0x23, 0x4c, - 0x1c, 0xaf, 0x07, 0x63, 0xe8, 0x31, 0x14, 0x8b, 0x65, 0x96, 0x2c, 0x75, 0x94, 0x69, 0x35, 0xd1, - 0xdf, 0x02, 0x91, 0x61, 0x6f, 0x62, 0x38, 0x38, 0x46, 0x98, 0x1c, 0x4e, 0x31, 0x79, 0x1f, 0xac, - 0xb1, 0x81, 0x43, 0x03, 0xdf, 0xe9, 0x07, 0x38, 0x60, 0xbc, 0xe9, 0x92, 0xb5, 0xfb, 0x78, 0xd1, - 0x59, 0xd6, 0xb0, 0x01, 0x1b, 0x9c, 0x05, 0xfe, 0xcb, 0x71, 0x20, 0xdb, 0x60, 0x9b, 0x93, 0xd7, - 0xc8, 0xf1, 0x08, 0x65, 0x4e, 0x84, 0x62, 0xc7, 0x4d, 0x19, 0xca, 0x57, 0xab, 0x8f, 0x32, 0xed, - 0xcf, 0x19, 0x8f, 0xa7, 0x32, 0xc3, 0xde, 0x1c, 0x9b, 0x5d, 0xa3, 0x43, 0x42, 0xd9, 0x29, 0x8a, - 0xad, 0x94, 0x21, 0xf9, 0x12, 0xec, 0x8e, 0xab, 0x5d, 0xa1, 0x38, 0x38, 0x4f, 0x85, 0x1e, 0x75, - 0xdb, 0x7b, 0x7b, 0xad, 0x7d, 0xb1, 0x74, 0xab, 0x33, 0xcc, 0xb4, 0xca, 0x59, 0xe0, 0xbf, 0xe2, - 0x8a, 0x71, 0xea, 0xb3, 0xff, 0x39, 0x3f, 0xca, 0x34, 0x55, 0x54, 0xfb, 0x85, 0x81, 0x61, 0x57, - 0xe8, 0x5c, 0x9e, 0x80, 0xe5, 0x14, 0x54, 0x9f, 0x66, 0x50, 0xe4, 0x45, 0xed, 0xbd, 0x7f, 0x2e, - 0x5a, 0xca, 0xef, 0xbc, 0xe8, 0xbf, 0xc3, 0x4c, 0xdb, 0x99, 0x2b, 0x7a, 0x36, 0x51, 0x8c, 0x32, - 0x4d, 0x5f, 0x5c, 0x76, 0x6a, 0x62, 0xd8, 0x3b, 0x74, 0x61, 0x6e, 0x67, 0x25, 0x7f, 0xb3, 0x92, - 0xf5, 0xfc, 0xd3, 0x50, 0x95, 0xee, 0x86, 0xaa, 0xf4, 0x75, 0xa8, 0x4a, 0xef, 0x1f, 0xd4, 0xc2, - 0xdd, 0x83, 0x5a, 0xf8, 0xfc, 0xa0, 0x16, 0x5e, 0x9b, 0x7e, 0xc0, 0x7a, 0x89, 0x6b, 0x7a, 0x04, - 0x37, 0x83, 0x38, 0xa0, 0x21, 0x62, 0xfc, 0xb7, 0x97, 0xb8, 0x0d, 0xda, 0xbd, 0x68, 0xf8, 0xa4, - 0x89, 0xf9, 0x6b, 0x11, 0x5f, 0x19, 0x77, 0x89, 0xff, 0x5d, 0xff, 0xfe, 0x19, 0x00, 0x00, 0xff, - 0xff, 0x6e, 0x7f, 0xc4, 0x1e, 0x7b, 0x04, 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 - } - if this.MaxMemoCharacters != that1.MaxMemoCharacters { - return false - } - if this.TxSigLimit != that1.TxSigLimit { - return false - } - if this.TxSizeCostPerByte != that1.TxSizeCostPerByte { - return false - } - if this.SigVerifyCostED25519 != that1.SigVerifyCostED25519 { - return false - } - if this.SigVerifyCostSecp256k1 != that1.SigVerifyCostSecp256k1 { - return false - } - return true -} -func (m *BaseAccount) 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 *BaseAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BaseAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sequence != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x20 - } - if m.AccountNumber != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.AccountNumber)) - i-- - dAtA[i] = 0x18 - } - if m.PubKey != nil { - { - size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuth(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ModuleAccount) 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 *ModuleAccount) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModuleAccount) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Permissions) > 0 { - for iNdEx := len(m.Permissions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Permissions[iNdEx]) - copy(dAtA[i:], m.Permissions[iNdEx]) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Permissions[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintAuth(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - } - if m.BaseAccount != nil { - { - size, err := m.BaseAccount.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintAuth(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.SigVerifyCostSecp256k1 != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.SigVerifyCostSecp256k1)) - i-- - dAtA[i] = 0x28 - } - if m.SigVerifyCostED25519 != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.SigVerifyCostED25519)) - i-- - dAtA[i] = 0x20 - } - if m.TxSizeCostPerByte != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.TxSizeCostPerByte)) - i-- - dAtA[i] = 0x18 - } - if m.TxSigLimit != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.TxSigLimit)) - i-- - dAtA[i] = 0x10 - } - if m.MaxMemoCharacters != 0 { - i = encodeVarintAuth(dAtA, i, uint64(m.MaxMemoCharacters)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintAuth(dAtA []byte, offset int, v uint64) int { - offset -= sovAuth(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BaseAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - if m.PubKey != nil { - l = m.PubKey.Size() - n += 1 + l + sovAuth(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovAuth(uint64(m.AccountNumber)) - } - if m.Sequence != 0 { - n += 1 + sovAuth(uint64(m.Sequence)) - } - return n -} - -func (m *ModuleAccount) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BaseAccount != nil { - l = m.BaseAccount.Size() - n += 1 + l + sovAuth(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovAuth(uint64(l)) - } - if len(m.Permissions) > 0 { - for _, s := range m.Permissions { - l = len(s) - n += 1 + l + sovAuth(uint64(l)) - } - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MaxMemoCharacters != 0 { - n += 1 + sovAuth(uint64(m.MaxMemoCharacters)) - } - if m.TxSigLimit != 0 { - n += 1 + sovAuth(uint64(m.TxSigLimit)) - } - if m.TxSizeCostPerByte != 0 { - n += 1 + sovAuth(uint64(m.TxSizeCostPerByte)) - } - if m.SigVerifyCostED25519 != 0 { - n += 1 + sovAuth(uint64(m.SigVerifyCostED25519)) - } - if m.SigVerifyCostSecp256k1 != 0 { - n += 1 + sovAuth(uint64(m.SigVerifyCostSecp256k1)) - } - return n -} - -func sovAuth(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozAuth(x uint64) (n int) { - return sovAuth(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *BaseAccount) 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 ErrIntOverflowAuth - } - 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: BaseAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BaseAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - 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 ErrInvalidLengthAuth - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PubKey == nil { - m.PubKey = &types.Any{} - } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) - } - m.AccountNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AccountNumber |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ModuleAccount) 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 ErrIntOverflowAuth - } - 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: ModuleAccount: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModuleAccount: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BaseAccount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuth - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BaseAccount == nil { - m.BaseAccount = &BaseAccount{} - } - if err := m.BaseAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - 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 ErrInvalidLengthAuth - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - 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 ErrInvalidLengthAuth - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthAuth - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Permissions = append(m.Permissions, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxMemoCharacters", wireType) - } - m.MaxMemoCharacters = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxMemoCharacters |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxSigLimit", wireType) - } - m.TxSigLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxSigLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxSizeCostPerByte", wireType) - } - m.TxSizeCostPerByte = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxSizeCostPerByte |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigVerifyCostED25519", wireType) - } - m.SigVerifyCostED25519 = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigVerifyCostED25519 |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigVerifyCostSecp256k1", wireType) - } - m.SigVerifyCostSecp256k1 = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuth - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigVerifyCostSecp256k1 |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipAuth(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthAuth - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipAuth(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, ErrIntOverflowAuth - } - 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, ErrIntOverflowAuth - } - 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, ErrIntOverflowAuth - } - 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, ErrInvalidLengthAuth - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupAuth - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthAuth - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthAuth = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowAuth = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupAuth = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/types/auth/params.go b/core-sdk/types/auth/params.go deleted file mode 100644 index 68cd240b..00000000 --- a/core-sdk/types/auth/params.go +++ /dev/null @@ -1,11 +0,0 @@ -package auth - -import ( - yaml "gopkg.in/yaml.v2" -) - -// String implements the stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/core-sdk/types/auth/query.pb.go b/core-sdk/types/auth/query.pb.go deleted file mode 100644 index 0255bc32..00000000 --- a/core-sdk/types/auth/query.pb.go +++ /dev/null @@ -1,930 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/auth/v1beta1/query.proto - -package auth - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" - "github.com/irisnet/core-sdk-go/common/codec/types" - _ "github.com/regen-network/cosmos-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 - -// QueryAccountRequest is the request type for the Query/Account RPC method. -type QueryAccountRequest struct { - // address defines the address to query for. - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *QueryAccountRequest) Reset() { *m = QueryAccountRequest{} } -func (m *QueryAccountRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAccountRequest) ProtoMessage() {} -func (*QueryAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_c451370b3929a27c, []int{0} -} -func (m *QueryAccountRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAccountRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAccountRequest.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 *QueryAccountRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAccountRequest.Merge(m, src) -} -func (m *QueryAccountRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAccountRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAccountRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAccountRequest proto.InternalMessageInfo - -// QueryAccountResponse is the response type for the Query/Account RPC method. -type QueryAccountResponse struct { - // account defines the account of the corresponding address. - Account *types.Any `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` -} - -func (m *QueryAccountResponse) Reset() { *m = QueryAccountResponse{} } -func (m *QueryAccountResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAccountResponse) ProtoMessage() {} -func (*QueryAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_c451370b3929a27c, []int{1} -} -func (m *QueryAccountResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAccountResponse.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 *QueryAccountResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAccountResponse.Merge(m, src) -} -func (m *QueryAccountResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAccountResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAccountResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAccountResponse proto.InternalMessageInfo - -func (m *QueryAccountResponse) GetAccount() *types.Any { - if m != nil { - return m.Account - } - return nil -} - -// 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_c451370b3929a27c, []int{2} -} -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 defines the parameters of the module. - 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_c451370b3929a27c, []int{3} -} -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{} -} - -func init() { - proto.RegisterType((*QueryAccountRequest)(nil), "cosmos.auth.v1beta1.QueryAccountRequest") - proto.RegisterType((*QueryAccountResponse)(nil), "cosmos.auth.v1beta1.QueryAccountResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "cosmos.auth.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmos.auth.v1beta1.QueryParamsResponse") -} - -func init() { proto.RegisterFile("cosmos/auth/v1beta1/query.proto", fileDescriptor_c451370b3929a27c) } - -var fileDescriptor_c451370b3929a27c = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x31, 0x8f, 0xd3, 0x30, - 0x14, 0xc7, 0x93, 0x13, 0xb4, 0x87, 0x61, 0xf2, 0x65, 0x38, 0x72, 0x90, 0xa0, 0x30, 0x5c, 0x3b, - 0xd4, 0x56, 0xcb, 0x54, 0xc4, 0xd2, 0x4e, 0xb0, 0x95, 0x88, 0x89, 0x05, 0x39, 0x89, 0x49, 0x23, - 0x1a, 0x3b, 0x8d, 0x6d, 0xa4, 0x0a, 0x21, 0x21, 0x26, 0x36, 0x90, 0x58, 0x19, 0xfa, 0x21, 0xf8, - 0x10, 0x15, 0x53, 0x25, 0x16, 0x26, 0x84, 0x5a, 0x06, 0x3e, 0x06, 0xaa, 0xed, 0x0c, 0x95, 0x82, - 0xb8, 0xa9, 0x7d, 0xef, 0xfd, 0xff, 0xff, 0xf7, 0xcb, 0x33, 0x08, 0x53, 0x2e, 0x4a, 0x2e, 0x30, - 0x51, 0x72, 0x8e, 0x5f, 0x0f, 0x13, 0x2a, 0xc9, 0x10, 0x2f, 0x15, 0xad, 0x57, 0xa8, 0xaa, 0xb9, - 0xe4, 0xf0, 0xcc, 0x08, 0xd0, 0x41, 0x80, 0xac, 0xc0, 0xf7, 0x72, 0x9e, 0x73, 0x3d, 0xc7, 0x87, - 0x7f, 0x46, 0xea, 0xdf, 0xce, 0x39, 0xcf, 0x17, 0x14, 0xeb, 0x2a, 0x51, 0x2f, 0x31, 0x61, 0x36, - 0xc5, 0xbf, 0x63, 0x47, 0xa4, 0x2a, 0x30, 0x61, 0x8c, 0x4b, 0x22, 0x0b, 0xce, 0x84, 0x9d, 0x06, - 0x6d, 0x10, 0x7a, 0xa1, 0x0d, 0x36, 0xf3, 0x17, 0x66, 0xa3, 0x05, 0xd2, 0x45, 0x34, 0x06, 0x67, - 0x4f, 0x0f, 0xb4, 0x93, 0x34, 0xe5, 0x8a, 0xc9, 0x98, 0x2e, 0x15, 0x15, 0x12, 0x9e, 0x83, 0x2e, - 0xc9, 0xb2, 0x9a, 0x0a, 0x71, 0xee, 0xde, 0x73, 0x7b, 0x37, 0xe2, 0xa6, 0x7c, 0x78, 0xfa, 0x61, - 0x1d, 0x3a, 0x7f, 0xd6, 0xa1, 0x13, 0x3d, 0x03, 0xde, 0xb1, 0x55, 0x54, 0x9c, 0x09, 0x0a, 0x1f, - 0x81, 0x2e, 0x31, 0x2d, 0xed, 0xbd, 0x39, 0xf2, 0x90, 0xa1, 0x47, 0xcd, 0x87, 0xa1, 0x09, 0x5b, - 0x4d, 0x6f, 0x7d, 0xfb, 0x3a, 0x38, 0xb5, 0xde, 0x27, 0x71, 0x63, 0x89, 0x3c, 0x00, 0x75, 0xea, - 0x8c, 0xd4, 0xa4, 0x14, 0x96, 0x27, 0x9a, 0x59, 0xcc, 0xa6, 0x6b, 0x57, 0x8d, 0x41, 0xa7, 0xd2, - 0x1d, 0xbb, 0xe9, 0x02, 0xb5, 0x5c, 0x1b, 0x19, 0xd3, 0xf4, 0xda, 0xe6, 0x67, 0xe8, 0xc4, 0xd6, - 0x30, 0xfa, 0x72, 0x02, 0xae, 0xeb, 0x48, 0xf8, 0xd1, 0x05, 0x5d, 0xcb, 0x01, 0x7b, 0xad, 0x01, - 0x2d, 0x17, 0xf2, 0xfb, 0x57, 0x50, 0x1a, 0xca, 0x08, 0xbf, 0xff, 0xfe, 0xfb, 0xf3, 0x49, 0x1f, - 0x5e, 0xe2, 0xd6, 0x77, 0x32, 0x6a, 0x81, 0xdf, 0xd8, 0x13, 0xbf, 0x85, 0xef, 0x5c, 0xd0, 0x31, - 0xd0, 0xf0, 0xf2, 0xdf, 0x6b, 0x8e, 0x2e, 0xe4, 0xf7, 0xfe, 0x2f, 0xb4, 0x38, 0xf7, 0x35, 0xce, - 0x5d, 0x78, 0xd1, 0x8a, 0x63, 0xce, 0x33, 0x7d, 0xbc, 0xd9, 0x05, 0xee, 0x76, 0x17, 0xb8, 0xbf, - 0x76, 0x81, 0xfb, 0x69, 0x1f, 0x38, 0xdb, 0x7d, 0xe0, 0xfc, 0xd8, 0x07, 0xce, 0x73, 0x94, 0x17, - 0x72, 0xae, 0x12, 0x94, 0xf2, 0x12, 0x17, 0x75, 0x21, 0x18, 0x95, 0xfa, 0x77, 0xae, 0x92, 0x81, - 0xc8, 0x5e, 0x0d, 0x72, 0x8e, 0x4b, 0x9e, 0xa9, 0x05, 0x35, 0xc1, 0x49, 0x47, 0xbf, 0xfa, 0x83, - 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x60, 0x3b, 0x07, 0x2a, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // Account returns account details based on address. - Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) - // Params queries all parameters. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) { - out := new(QueryAccountResponse) - err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/Account", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmos.auth.v1beta1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Account returns account details based on address. - Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error) - // Params queries all parameters. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Account(ctx context.Context, req *QueryAccountRequest) (*QueryAccountResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Account not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Account_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAccountRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Account(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/cosmos.auth.v1beta1.Query/Account", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Account(ctx, req.(*QueryAccountRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(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: "/cosmos.auth.v1beta1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmos.auth.v1beta1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Account", - Handler: _Query_Account_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmos/auth/v1beta1/query.proto", -} - -func (m *QueryAccountRequest) 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 *QueryAccountRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAccountRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAccountResponse) 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 *QueryAccountResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAccountResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Account != nil { - { - size, err := m.Account.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 *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 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 *QueryAccountRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAccountResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Account != nil { - l = m.Account.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -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 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 *QueryAccountRequest) 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: QueryAccountRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = 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 *QueryAccountResponse) 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: QueryAccountResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Account", 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.Account == nil { - m.Account = &types.Any{} - } - if err := m.Account.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 *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 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/core-sdk/types/auth/tests/auth_test.go b/core-sdk/types/auth/tests/auth_test.go deleted file mode 100644 index 20f58a19..00000000 --- a/core-sdk/types/auth/tests/auth_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package tests - -import ( - "testing" -) - -const ( - nodeURI = "tcp://localhost:26657" - grpcAddr = "localhost:9090" - chainID = "test" - charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - addr = "iaa1w9lvhwlvkwqvg08q84n2k4nn896u9pqx93velx" -) - -func Test(t *testing.T) { - -} diff --git a/core-sdk/types/auth/types.go b/core-sdk/types/auth/types.go deleted file mode 100644 index 19728b71..00000000 --- a/core-sdk/types/auth/types.go +++ /dev/null @@ -1,146 +0,0 @@ -package auth - -import ( - "encoding/json" - "errors" - "fmt" - - "github.com/gogo/protobuf/proto" - "github.com/tendermint/tendermint/crypto" - - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - codectypes "github.com/irisnet/core-sdk-go/common/codec/types" - sdk "github.com/irisnet/core-sdk-go/types" -) - -// Account is an interface used to store coins at a given address within state. -// It presumes a notion of sequence numbers for replay protection, -// a notion of account numbers for replay protection for previously pruned accounts, -// and a pubkey for authentication purposes. -// -// Many complex conditions can be used in the concrete struct which implements Account. - -type Account interface { - GetAddress() sdk.AccAddress - SetAddress(sdk.AccAddress) error // errors if already set. - - GetPubKey() crypto.PubKey // can return nil. - SetPubKey(crypto.PubKey) error - - GetAccountNumber() uint64 - SetAccountNumber(uint64) error - - GetSequence() uint64 - SetSequence(uint64) error -} - -//BaseAccount Have they all been implemented -var _ Account = (*BaseAccount)(nil) - -// GetAddress - Implements sdk.AccountI. -func (acc BaseAccount) GetAddress() sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(acc.Address) - return addr -} - -// SetAddress - Implements sdk.AccountI. -func (acc *BaseAccount) SetAddress(addr sdk.AccAddress) error { - if len(acc.Address) != 0 { - return errors.New("cannot override BaseAccount address") - } - acc.Address = addr.String() - return nil -} - -// GetPubKey - Implements sdk.AccountI. -func (acc BaseAccount) GetPubKey() (pk crypto.PubKey) { - if acc.PubKey == nil { - return nil - } - content, ok := acc.PubKey.GetCachedValue().(crypto.PubKey) - if !ok { - return nil - } - return content -} - -// SetPubKey - Implements sdk.AccountI. -func (acc *BaseAccount) SetPubKey(pubKey crypto.PubKey) error { - if pubKey == nil { - acc.PubKey = nil - } else { - protoMsg, ok := pubKey.(proto.Message) - if !ok { - return sdk.Wrap(fmt.Errorf("err invalid key, can't proto encode %T", protoMsg)) - } - - any, err := codectypes.NewAnyWithValue(protoMsg) - if err != nil { - return err - } - acc.PubKey = any - } - return nil -} - -// GetAccountNumber - Implements AccountI -func (acc BaseAccount) GetAccountNumber() uint64 { - return acc.AccountNumber -} - -// SetAccountNumber - Implements AccountI -func (acc *BaseAccount) SetAccountNumber(accNumber uint64) error { - acc.AccountNumber = accNumber - return nil -} - -// GetSequence - Implements sdk.AccountI. -func (acc BaseAccount) GetSequence() uint64 { - return acc.Sequence -} - -// SetSequence - Implements sdk.AccountI. -func (acc *BaseAccount) SetSequence(seq uint64) error { - acc.Sequence = seq - return nil -} - -//json.Marshal BaseAccount -func (acc BaseAccount) String() string { - out, _ := json.Marshal(acc) - return string(out) -} - -// Convert return a sdk.BaseAccount -func (acc *BaseAccount) Convert() interface{} { - // error don't use it - return nil -} - -// Convert return a sdk.BaseAccount -// in order to unpack pubKey so not use Convert() -func (acc *BaseAccount) ConvertAccount(cdc commoncodec.Marshaler) interface{} { - account := sdk.BaseAccount{ - Address: acc.Address, - AccountNumber: acc.AccountNumber, - Sequence: acc.Sequence, - } - - var pkStr string - if acc.PubKey == nil { - return account - } - - var pk crypto.PubKey - if err := cdc.UnpackAny(acc.PubKey, &pk); err != nil { - return sdk.BaseAccount{} - } - - pkStr, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, pk) - if err != nil { - panic(err) - } - - account.PubKey = pkStr - return account -} diff --git a/core-sdk/types/block.go b/core-sdk/types/block.go deleted file mode 100644 index 99a76a26..00000000 --- a/core-sdk/types/block.go +++ /dev/null @@ -1,131 +0,0 @@ -package types - -import ( - "encoding/base64" - - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/encoding" - ctypes "github.com/tendermint/tendermint/rpc/core/types" - tmtypes "github.com/tendermint/tendermint/types" - - commoncodec "github.com/irisnet/core-sdk-go/common/codec" -) - -type Block struct { - tmtypes.Header `json:"header"` - Data `json:"data"` - Evidence tmtypes.EvidenceData `json:"evidence"` - LastCommit *tmtypes.Commit `json:"last_commit"` -} - -type Data struct { - Txs []StdTx `json:"txs"` -} - -func ParseBlock(cdc *commoncodec.LegacyAmino, block *tmtypes.Block) Block { - var txs []StdTx - for _, tx := range block.Txs { - var stdTx StdTx - if err := cdc.UnmarshalBinaryBare(tx, &stdTx); err == nil { - txs = append(txs, stdTx) - } - } - return Block{ - Header: block.Header, - Data: Data{Txs: txs}, - Evidence: block.Evidence, - LastCommit: block.LastCommit, - } -} - -type BlockResult struct { - Height int64 `json:"height"` - Results ABCIResponses `json:"results"` -} - -type BlockDetail struct { - BlockID tmtypes.BlockID `json:"block_id"` - Block Block `json:"block"` - BlockResult BlockResult `json:"block_result"` -} - -type ABCIResponses struct { - DeliverTx []TxResult - EndBlock ResultEndBlock - BeginBlock ResultBeginBlock -} - -type ResultBeginBlock struct { - Events StringEvents `json:"events"` -} - -type ResultEndBlock struct { - Events StringEvents `json:"events"` - ValidatorUpdates []ValidatorUpdate `json:"validator_updates"` -} - -func ParseValidatorUpdate(updates []abci.ValidatorUpdate) []ValidatorUpdate { - var vUpdates []ValidatorUpdate - for _, v := range updates { - pubkey, _ := encoding.PubKeyFromProto(v.PubKey) - vUpdates = append( - vUpdates, - ValidatorUpdate{ - PubKey: PubKey{ - Type: pubkey.Type(), - Value: base64.StdEncoding.EncodeToString(pubkey.Bytes()), - }, - Power: v.Power, - }, - ) - } - return vUpdates -} - -func ParseBlockResult(res *ctypes.ResultBlockResults) BlockResult { - var txResults = make([]TxResult, len(res.TxsResults)) - for i, r := range res.TxsResults { - txResults[i] = TxResult{ - Code: r.Code, - Log: r.Log, - GasWanted: r.GasWanted, - GasUsed: r.GasUsed, - Events: StringifyEvents(r.Events), - } - } - return BlockResult{ - Height: res.Height, - Results: ABCIResponses{ - DeliverTx: txResults, - EndBlock: ResultEndBlock{ - Events: StringifyEvents(res.EndBlockEvents), - ValidatorUpdates: ParseValidatorUpdate(res.ValidatorUpdates), - }, - BeginBlock: ResultBeginBlock{ - Events: StringifyEvents(res.BeginBlockEvents), - }, - }, - } -} - -func ParseValidators(cdc *commoncodec.LegacyAmino, vs []*tmtypes.Validator) []Validator { - var validators = make([]Validator, len(vs)) - for i, v := range vs { - bech32Addr, _ := ConsAddressFromHex(v.Address.String()) - bech32PubKey, _ := Bech32ifyPubKey(Bech32PubKeyTypeConsPub, v.PubKey) - - var pubKey PubKey - if bz, err := cdc.MarshalJSON(v.PubKey); err == nil { - _ = cdc.UnmarshalJSON(bz, &pubKey) - } - validators[i] = Validator{ - Bech32Address: bech32Addr.String(), - Bech32PubKey: bech32PubKey, - Address: v.Address.String(), - PubKey: pubKey, - VotingPower: v.VotingPower, - ProposerPriority: v.ProposerPriority, - } - } - return validators -} diff --git a/core-sdk/types/client.go b/core-sdk/types/client.go deleted file mode 100644 index 38c334fb..00000000 --- a/core-sdk/types/client.go +++ /dev/null @@ -1,69 +0,0 @@ -package types - -import ( - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - "google.golang.org/grpc" -) - -type TxManager interface { - TmQuery - SendBatch(msgs Msgs, baseTx BaseTx) ([]ResultTx, Error) - BuildAndSend(msg []Msg, baseTx BaseTx) (ResultTx, Error) - BuildAndSign(msg []Msg, baseTx BaseTx) ([]byte, Error) - BuildTxHash(msg []Msg, baseTx BaseTx) (string, Error) - BuildAndSendWithAccount(addr string, accountNumber, sequence uint64, msg []Msg, baseTx BaseTx) (ResultTx, Error) -} - -type Queries interface { - StoreQuery - AccountQuery - TmQuery -} - -type GRPCClient interface { - GenConn() (*grpc.ClientConn, error) -} - -type ParamQuery interface { - QueryParams(module string, res Response) Error -} - -type StoreQuery interface { - QueryWithResponse(path string, data interface{}, result Response) error - Query(path string, data interface{}) ([]byte, error) - QueryStore(key HexBytes, storeName string, height int64, prove bool) (abci.ResponseQuery, error) -} - -type AccountQuery interface { - QueryAccount(address string) (BaseAccount, Error) - QueryAddress(name, password string) (AccAddress, Error) -} - -type TmQuery interface { - QueryTx(hash string) (ResultQueryTx, error) - QueryTxs(builder *EventQueryBuilder, page, size *int) (ResultSearchTxs, error) - QueryBlock(height int64) (BlockDetail, error) -} - -type TokenManager interface { - QueryToken(denom string) (Token, error) - SaveTokens(tokens ...Token) - ToMinCoin(coin ...DecCoin) (Coins, Error) - ToMainCoin(coin ...Coin) (DecCoins, Error) -} - -type Logger interface { - Logger() log.Logger - SetLogger(log.Logger) -} - -type BaseClient interface { - TokenManager - TxManager - Queries - TmClient - Logger - GRPCClient - KeyManager -} diff --git a/core-sdk/types/codec.go b/core-sdk/types/codec.go deleted file mode 100644 index 405fd1a9..00000000 --- a/core-sdk/types/codec.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -import ( - "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/codec/types" -) - -// EncodingConfig specifies the concrete encoding types to use for a given app. -// This is provided for compatibility between protobuf and amino implementations. -type EncodingConfig struct { - InterfaceRegistry types.InterfaceRegistry - Marshaler codec.Marshaler - TxConfig TxConfig - Amino *codec.LegacyAmino -} diff --git a/core-sdk/types/coin.go b/core-sdk/types/coin.go deleted file mode 100644 index 89acbdbc..00000000 --- a/core-sdk/types/coin.go +++ /dev/null @@ -1,681 +0,0 @@ -package types - -import ( - "encoding/json" - "fmt" - "regexp" - "sort" - "strings" -) - -const ( - BaseDenom = "uiris" -) - -// NewCoin returns a new coin with a denomination and amount. It will panic if -// the amount is negative. -func NewCoin(denom string, amount Int) Coin { - if err := validate(denom, amount); err != nil { - panic(err) - } - - return Coin{ - Denom: denom, - Amount: amount, - } -} - -// NewInt64Coin returns a new coin with a denomination and amount. It will panic -// if the amount is negative. -func NewInt64Coin(denom string, amount int64) Coin { - return NewCoin(denom, NewInt(amount)) -} - -// String provides a human-readable representation of a coin -func (coin Coin) String() string { - return fmt.Sprintf("%v%v", coin.Amount, coin.Denom) -} - -// validate returns an error if the Coin has a negative amount or if -// the denom is invalid. -func validate(denom string, amount Int) error { - if err := ValidateDenom(denom); err != nil { - return err - } - - if amount.IsNegative() { - return fmt.Errorf("negative coin amount: %v", amount) - } - - return nil -} - -// IsValid returns true if the Coin has a non-negative amount and the denom is vaild. -func (coin Coin) IsValid() bool { - return validate(coin.Denom, coin.Amount) == nil -} - -// IsZero returns if this represents no money -func (coin Coin) IsZero() bool { - return coin.Amount.IsZero() -} - -// IsGTE returns true if they are the same type and the receiver is -// an equal or greater value -func (coin Coin) IsGTE(other Coin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return !coin.Amount.LT(other.Amount) -} - -// IsLT returns true if they are the same type and the receiver is -// a smaller value -func (coin Coin) IsLT(other Coin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.LT(other.Amount) -} - -// IsEqual returns true if the two sets of Coins have the same value -func (coin Coin) IsEqual(other Coin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.Equal(other.Amount) -} - -// Adds amounts of two coins with same denom. If the coins differ in denom then -// it panics. -func (coin Coin) Add(coinB Coin) Coin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, coinB.Denom)) - } - - return Coin{coin.Denom, coin.Amount.Add(coinB.Amount)} -} - -// Subtracts amounts of two coins with same denom. If the coins differ in denom -// then it panics. -func (coin Coin) Sub(coinB Coin) Coin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, coinB.Denom)) - } - - res := Coin{coin.Denom, coin.Amount.Sub(coinB.Amount)} - if res.IsNegative() { - panic("negative coin amount") - } - - return res -} - -// IsPositive returns true if coin amount is positive. -// -// TODO: Remove once unsigned integers are used. -func (coin Coin) IsPositive() bool { - return coin.Amount.Sign() == 1 -} - -// IsNegative returns true if the coin amount is negative and false otherwise. -// -// TODO: Remove once unsigned integers are used. -func (coin Coin) IsNegative() bool { - return coin.Amount.Sign() == -1 -} - -// ----------------------------------------------------------------------------- -// Coins - -// Coins is a set of Coin, one per currency -type Coins []Coin - -// NewCoins constructs a new coin set. -func NewCoins(coins ...Coin) Coins { - // remove zeroes - newCoins := removeZeroCoins(Coins(coins)) - if len(newCoins) == 0 { - return Coins{} - } - - newCoins.Sort() - - // detect duplicate Denoms - if dupIndex := findDup(newCoins); dupIndex != -1 { - panic(fmt.Errorf("find duplicate denom: %s", newCoins[dupIndex])) - } - - if !newCoins.IsValid() { - panic(fmt.Errorf("invalid coin set: %s", newCoins)) - } - - return newCoins -} - -type coinsJSON Coins - -// MarshalJSON implements a custom JSON marshaller for the Coins type to allow -// nil Coins to be encoded as an empty array. -func (coins Coins) MarshalJSON() ([]byte, error) { - if coins == nil { - return json.Marshal(coinsJSON(Coins{})) - } - - return json.Marshal(coinsJSON(coins)) -} - -func (coins Coins) String() string { - if len(coins) == 0 { - return "" - } - - out := "" - for _, coin := range coins { - out += fmt.Sprintf("%v,", coin.String()) - } - return out[:len(out)-1] -} - -// IsValid asserts the Coins are sorted, have positive amount, -// and Denom does not contain upper case characters. -func (coins Coins) IsValid() bool { - switch len(coins) { - case 0: - return true - case 1: - if err := ValidateDenom(coins[0].Denom); err != nil { - return false - } - return coins[0].IsPositive() - default: - // check single coin case - if !(Coins{coins[0]}).IsValid() { - return false - } - - lowDenom := coins[0].Denom - for _, coin := range coins[1:] { - if strings.ToLower(coin.Denom) != coin.Denom { - return false - } - if coin.Denom <= lowDenom { - return false - } - if !coin.IsPositive() { - return false - } - - // we compare each coin against the last denom - lowDenom = coin.Denom - } - - return true - } -} - -// Add adds two sets of coins. -// -// e.g. -// {2A} + {A, 2B} = {3A, 2B} -// {2A} + {0B} = {2A} -// -// NOTE: Add operates under the invariant that coins are sorted by -// denominations. -// -// CONTRACT: Add will never return Coins where one Coin has a non-positive -// amount. In otherwords, IsValid will always return true. -func (coins Coins) Add(coinsB ...Coin) Coins { - return coins.safeAdd(coinsB) -} - -// safeAdd will perform addition of two coins sets. If both coin sets are -// empty, then an empty set is returned. If only a single set is empty, the -// other set is returned. Otherwise, the coins are compared in order of their -// denomination and addition only occurs when the denominations match, otherwise -// the coin is simply added to the sum assuming it's not zero. -func (coins Coins) safeAdd(coinsB Coins) Coins { - sum := ([]Coin)(nil) - indexA, indexB := 0, 0 - lenA, lenB := len(coins), len(coinsB) - - for { - if indexA == lenA { - if indexB == lenB { - // return nil coins if both sets are empty - return sum - } - - // return set B (excluding zero coins) if set A is empty - return append(sum, removeZeroCoins(coinsB[indexB:])...) - } else if indexB == lenB { - // return set A (excluding zero coins) if set B is empty - return append(sum, removeZeroCoins(coins[indexA:])...) - } - - coinA, coinB := coins[indexA], coinsB[indexB] - - switch strings.Compare(coinA.Denom, coinB.Denom) { - case -1: // coin A denom < coin B denom - if !coinA.IsZero() { - sum = append(sum, coinA) - } - - indexA++ - - case 0: // coin A denom == coin B denom - res := coinA.Add(coinB) - if !res.IsZero() { - sum = append(sum, res) - } - - indexA++ - indexB++ - - case 1: // coin A denom > coin B denom - if !coinB.IsZero() { - sum = append(sum, coinB) - } - - indexB++ - } - } -} - -// DenomsSubsetOf returns true if receiver's denom set -// is subset of coinsB's denoms. -func (coins Coins) DenomsSubsetOf(coinsB Coins) bool { - // more denoms in B than in receiver - if len(coins) > len(coinsB) { - return false - } - - for _, coin := range coins { - if coinsB.AmountOf(coin.Denom).IsZero() { - return false - } - } - - return true -} - -// Sub subtracts a set of coins from another. -// -// e.g. -// {2A, 3B} - {A} = {A, 3B} -// {2A} - {0B} = {2A} -// {A, B} - {A} = {B} -// -// CONTRACT: Sub will never return Coins where one Coin has a non-positive -// amount. In otherwords, IsValid will always return true. -func (coins Coins) Sub(coinsB Coins) Coins { - diff, hasNeg := coins.SafeSub(coinsB) - if hasNeg { - panic("negative coin amount") - } - - return diff -} - -// SafeSub performs the same arithmetic as Sub but returns a boolean if any -// negative coin amount was returned. -func (coins Coins) SafeSub(coinsB Coins) (Coins, bool) { - diff := coins.safeAdd(coinsB.negative()) - return diff, diff.IsAnyNegative() -} - -// IsAllGT returns true if for every denom in coinsB, -// the denom is present at a greater amount in coins. -func (coins Coins) IsAllGT(coinsB Coins) bool { - if len(coins) == 0 { - return false - } - - if len(coinsB) == 0 { - return true - } - - if !coinsB.DenomsSubsetOf(coins) { - return false - } - - for _, coinB := range coinsB { - amountA, amountB := coins.AmountOf(coinB.Denom), coinB.Amount - if !amountA.GT(amountB) { - return false - } - } - - return true -} - -// IsAllGTE returns false if for any denom in coinsB, -// the denom is present at a smaller amount in coins; -// else returns true. -func (coins Coins) IsAllGTE(coinsB Coins) bool { - if len(coinsB) == 0 { - return true - } - - if len(coins) == 0 { - return false - } - - for _, coinB := range coinsB { - if coinB.Amount.GT(coins.AmountOf(coinB.Denom)) { - return false - } - } - - return true -} - -// IsAllLT returns True iff for every denom in coins, the denom is present at -// a smaller amount in coinsB. -func (coins Coins) IsAllLT(coinsB Coins) bool { - return coinsB.IsAllGT(coins) -} - -// IsAllLTE returns true iff for every denom in coins, the denom is present at -// a smaller or equal amount in coinsB. -func (coins Coins) IsAllLTE(coinsB Coins) bool { - return coinsB.IsAllGTE(coins) -} - -// IsAnyGT returns true iff for any denom in coins, the denom is present at a -// greater amount in coinsB. -// -// e.g. -// {2A, 3B}.IsAnyGT{A} = true -// {2A, 3B}.IsAnyGT{5C} = false -// {}.IsAnyGT{5C} = false -// {2A, 3B}.IsAnyGT{} = false -func (coins Coins) IsAnyGT(coinsB Coins) bool { - if len(coinsB) == 0 { - return false - } - - for _, coin := range coins { - amt := coinsB.AmountOf(coin.Denom) - if coin.Amount.GT(amt) && !amt.IsZero() { - return true - } - } - - return false -} - -// IsAnyGTE returns true iff coins contains at least one denom that is present -// at a greater or equal amount in coinsB; it returns false otherwise. -// -// NOTE: IsAnyGTE operates under the invariant that both coin sets are sorted -// by denominations and there exists no zero coins. -func (coins Coins) IsAnyGTE(coinsB Coins) bool { - if len(coinsB) == 0 { - return false - } - - for _, coin := range coins { - amt := coinsB.AmountOf(coin.Denom) - if coin.Amount.GTE(amt) && !amt.IsZero() { - return true - } - } - - return false -} - -// IsZero returns true if there are no coins or all coins are zero. -func (coins Coins) IsZero() bool { - for _, coin := range coins { - if !coin.IsZero() { - return false - } - } - return true -} - -// IsEqual returns true if the two sets of Coins have the same value -func (coins Coins) IsEqual(coinsB Coins) bool { - if len(coins) != len(coinsB) { - return false - } - - coins = coins.Sort() - coinsB = coinsB.Sort() - - for i := 0; i < len(coins); i++ { - if !coins[i].IsEqual(coinsB[i]) { - return false - } - } - - return true -} - -// Empty returns true if there are no coins and false otherwise. -func (coins Coins) Empty() bool { - return len(coins) == 0 -} - -// Returns the amount of a denom from coins -func (coins Coins) AmountOf(denom string) Int { - mustValidateDenom(denom) - - switch len(coins) { - case 0: - return ZeroInt() - - case 1: - coin := coins[0] - if coin.Denom == denom { - return coin.Amount - } - return ZeroInt() - - default: - midIdx := len(coins) / 2 // 2:1, 3:1, 4:2 - coin := coins[midIdx] - switch { - case denom < coin.Denom: - return coins[:midIdx].AmountOf(denom) - case denom == coin.Denom: - return coin.Amount - default: - return coins[midIdx+1:].AmountOf(denom) - } - } -} - -// GetDenomByIndex returns the Denom of the certain coin to make the findDup generic -func (coins Coins) GetDenomByIndex(i int) string { - return coins[i].Denom -} - -// IsAllPositive returns true if there is at least one coin and all currencies -// have a positive value. -func (coins Coins) IsAllPositive() bool { - if len(coins) == 0 { - return false - } - - for _, coin := range coins { - if !coin.IsPositive() { - return false - } - } - - return true -} - -// IsAnyNegative returns true if there is at least one coin whose amount -// is negative; returns false otherwise. It returns false if the coin set -// is empty too. -// -// TODO: Remove once unsigned integers are used. -func (coins Coins) IsAnyNegative() bool { - for _, coin := range coins { - if coin.IsNegative() { - return true - } - } - - return false -} - -// negative returns a set of coins with all amount negative. -// -// TODO: Remove once unsigned integers are used. -func (coins Coins) negative() Coins { - res := make([]Coin, 0, len(coins)) - - for _, coin := range coins { - res = append(res, Coin{ - Denom: coin.Denom, - Amount: coin.Amount.Neg(), - }) - } - - return res -} - -// removeZeroCoins removes all zero coins from the given coin set in-place. -func removeZeroCoins(coins Coins) Coins { - i, l := 0, len(coins) - for i < l { - if coins[i].IsZero() { - // remove coin - coins = append(coins[:i], coins[i+1:]...) - l-- - } else { - i++ - } - } - - return coins[:i] -} - -// ----------------------------------------------------------------------------- -// Sort interface - -//nolint -func (coins Coins) Len() int { return len(coins) } -func (coins Coins) Less(i, j int) bool { return coins[i].Denom < coins[j].Denom } -func (coins Coins) Swap(i, j int) { coins[i], coins[j] = coins[j], coins[i] } - -var _ sort.Interface = Coins{} - -// Sort is a helper function to sort the set of coins inplace -func (coins Coins) Sort() Coins { - sort.Sort(coins) - return coins -} - -// ----------------------------------------------------------------------------- -// Parsing - -var ( - // Denominations can be 3 ~ 64 characters long. - reDnmString = `[a-zA-Z][a-zA-Z0-9/:]{2,127}` - reAmt = `[[:digit:]]+` - reDecAmt = `[[:digit:]]*[.]*[[:digit:]]+` - reSpc = `[[:space:]]*` - reDnm = regexp.MustCompile(fmt.Sprintf(`^%s$`, reDnmString)) - reCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reAmt, reSpc, reDnmString)) - reDecCoin = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)$`, reDecAmt, reSpc, reDnmString)) -) - -// ValidateDenom validates a denomination string returning an error if it is -// invalid. -func ValidateDenom(denom string) error { - if !reDnm.MatchString(denom) { - return fmt.Errorf("invalid denom: %s", denom) - } - return nil -} - -func mustValidateDenom(denom string) { - if err := ValidateDenom(denom); err != nil { - panic(err) - } -} - -// ParseCoin parses a cli input for one coin type, returning errors if invalid. -// This returns an error on an empty string as well. -func ParseCoin(coinStr string) (coin Coin, err error) { - coinStr = strings.TrimSpace(coinStr) - - matches := reCoin.FindStringSubmatch(coinStr) - if matches == nil { - return Coin{}, fmt.Errorf("invalid coin expression: %s", coinStr) - } - - denomStr, amountStr := matches[2], matches[1] - - amount, ok := NewIntFromString(amountStr) - if !ok { - return Coin{}, fmt.Errorf("failed to parse coin amount: %s", amountStr) - } - - if err := ValidateDenom(denomStr); err != nil { - return Coin{}, fmt.Errorf("invalid denom cannot contain upper case characters or spaces: %s", err) - } - - return NewCoin(denomStr, amount), nil -} - -// ParseCoins will parse out a list of coins separated by commas. -// If nothing is provided, it returns nil Coins. -// Returned coins are sorted. -func ParseCoins(coinsStr string) (Coins, error) { - coinsStr = strings.TrimSpace(coinsStr) - if len(coinsStr) == 0 { - return nil, nil - } - - coinStrs := strings.Split(coinsStr, ",") - coins := make(Coins, len(coinStrs)) - for i, coinStr := range coinStrs { - coin, err := ParseCoin(coinStr) - if err != nil { - return nil, err - } - - coins[i] = coin - } - - // sort coins for determinism - coins.Sort() - - // validate coins before returning - if !coins.IsValid() { - return nil, fmt.Errorf("parseCoins invalid: %#v", coins) - } - - return coins, nil -} - -type findDupDescriptor interface { - GetDenomByIndex(int) string - Len() int -} - -// findDup works on the assumption that coins is sorted -func findDup(coins findDupDescriptor) int { - if coins.Len() <= 1 { - return -1 - } - - prevDenom := coins.GetDenomByIndex(0) - for i := 1; i < coins.Len(); i++ { - if coins.GetDenomByIndex(i) == prevDenom { - return i - } - prevDenom = coins.GetDenomByIndex(i) - } - - return -1 -} diff --git a/core-sdk/types/coin.pb.go b/core-sdk/types/coin.pb.go deleted file mode 100644 index c736c7ea..00000000 --- a/core-sdk/types/coin.pb.go +++ /dev/null @@ -1,978 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/v1beta1/coin.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// Coin defines a token with a denomination and an amount. -// -// NOTE: The amount field is an Int which implements the custom method -// signatures required by gogoproto. -type Coin struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Amount Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` -} - -func (m *Coin) Reset() { *m = Coin{} } -func (*Coin) ProtoMessage() {} -func (*Coin) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{0} -} -func (m *Coin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Coin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Coin.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 *Coin) XXX_Merge(src proto.Message) { - xxx_messageInfo_Coin.Merge(m, src) -} -func (m *Coin) XXX_Size() int { - return m.Size() -} -func (m *Coin) XXX_DiscardUnknown() { - xxx_messageInfo_Coin.DiscardUnknown(m) -} - -var xxx_messageInfo_Coin proto.InternalMessageInfo - -func (m *Coin) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// DecCoin defines a token with a denomination and a decimal amount. -// -// NOTE: The amount field is an Dec which implements the custom method -// signatures required by gogoproto. -type DecCoin struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - Amount Dec `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Dec" json:"amount"` -} - -func (m *DecCoin) Reset() { *m = DecCoin{} } -func (*DecCoin) ProtoMessage() {} -func (*DecCoin) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{1} -} -func (m *DecCoin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DecCoin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DecCoin.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 *DecCoin) XXX_Merge(src proto.Message) { - xxx_messageInfo_DecCoin.Merge(m, src) -} -func (m *DecCoin) XXX_Size() int { - return m.Size() -} -func (m *DecCoin) XXX_DiscardUnknown() { - xxx_messageInfo_DecCoin.DiscardUnknown(m) -} - -var xxx_messageInfo_DecCoin proto.InternalMessageInfo - -func (m *DecCoin) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// IntProto defines a Protobuf wrapper around an Int object. -type IntProto struct { - Int Int `protobuf:"bytes,1,opt,name=int,proto3,customtype=Int" json:"int"` -} - -func (m *IntProto) Reset() { *m = IntProto{} } -func (*IntProto) ProtoMessage() {} -func (*IntProto) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{2} -} -func (m *IntProto) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *IntProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IntProto.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 *IntProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_IntProto.Merge(m, src) -} -func (m *IntProto) XXX_Size() int { - return m.Size() -} -func (m *IntProto) XXX_DiscardUnknown() { - xxx_messageInfo_IntProto.DiscardUnknown(m) -} - -var xxx_messageInfo_IntProto proto.InternalMessageInfo - -// DecProto defines a Protobuf wrapper around a Dec object. -type DecProto struct { - Dec Dec `protobuf:"bytes,1,opt,name=dec,proto3,customtype=Dec" json:"dec"` -} - -func (m *DecProto) Reset() { *m = DecProto{} } -func (*DecProto) ProtoMessage() {} -func (*DecProto) Descriptor() ([]byte, []int) { - return fileDescriptor_189a96714eafc2df, []int{3} -} -func (m *DecProto) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DecProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DecProto.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 *DecProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_DecProto.Merge(m, src) -} -func (m *DecProto) XXX_Size() int { - return m.Size() -} -func (m *DecProto) XXX_DiscardUnknown() { - xxx_messageInfo_DecProto.DiscardUnknown(m) -} - -var xxx_messageInfo_DecProto proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Coin)(nil), "cosmos.base.v1beta1.Coin") - proto.RegisterType((*DecCoin)(nil), "cosmos.base.v1beta1.DecCoin") - proto.RegisterType((*IntProto)(nil), "cosmos.base.v1beta1.IntProto") - proto.RegisterType((*DecProto)(nil), "cosmos.base.v1beta1.DecProto") -} - -func init() { proto.RegisterFile("cosmos/base/v1beta1/coin.proto", fileDescriptor_189a96714eafc2df) } - -var fileDescriptor_189a96714eafc2df = []byte{ - // 272 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, - 0x4f, 0xce, 0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xc8, 0xeb, 0x81, - 0xe4, 0xf5, 0xa0, 0xf2, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x79, 0x7d, 0x10, 0x0b, 0xa2, - 0x54, 0xc9, 0x9d, 0x8b, 0xc5, 0x39, 0x3f, 0x33, 0x4f, 0x48, 0x84, 0x8b, 0x35, 0x25, 0x35, 0x2f, - 0x3f, 0x57, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc2, 0x11, 0x52, 0xe6, 0x62, 0x4b, 0xcc, - 0xcd, 0x2f, 0xcd, 0x2b, 0x91, 0x60, 0x02, 0x09, 0x3b, 0x71, 0x9f, 0xb8, 0x27, 0xcf, 0x70, 0xeb, - 0x9e, 0x3c, 0xb3, 0x67, 0x5e, 0x49, 0x10, 0x54, 0xca, 0x8a, 0xe5, 0xc5, 0x02, 0x79, 0x46, 0x25, - 0x2f, 0x2e, 0x76, 0x97, 0xd4, 0x64, 0x72, 0xcc, 0x72, 0x49, 0x4d, 0x46, 0x33, 0x4b, 0x93, 0x8b, - 0xc3, 0x33, 0xaf, 0x24, 0x00, 0xec, 0x17, 0x59, 0x2e, 0xe6, 0xcc, 0xbc, 0x12, 0x88, 0x51, 0xa8, - 0xf6, 0x83, 0xc4, 0x41, 0x4a, 0x5d, 0x52, 0x93, 0xe1, 0x4a, 0x53, 0x52, 0x93, 0xd1, 0x95, 0x82, - 0x8c, 0x07, 0x89, 0x3b, 0x79, 0xde, 0x78, 0x28, 0xc7, 0xd0, 0xf0, 0x48, 0x8e, 0xe1, 0xc4, 0x23, - 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, - 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xd4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, - 0x92, 0xf3, 0x73, 0xf5, 0x33, 0x8b, 0x32, 0x8b, 0xf3, 0x52, 0x4b, 0xc0, 0x74, 0x46, 0x69, 0x92, - 0x6e, 0x71, 0x4a, 0xb6, 0x6e, 0x7a, 0xbe, 0x7e, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, - 0xf0, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x1f, 0x07, 0xb0, 0x96, 0x89, 0x01, 0x00, 0x00, -} - -func (this *Coin) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Coin) - if !ok { - that2, ok := that.(Coin) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if !this.Amount.Equal(that1.Amount) { - return false - } - return true -} -func (this *DecCoin) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*DecCoin) - if !ok { - that2, ok := that.(DecCoin) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Denom != that1.Denom { - return false - } - if !this.Amount.Equal(that1.Amount) { - return false - } - return true -} -func (m *Coin) 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 *Coin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Coin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintCoin(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DecCoin) 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 *DecCoin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DecCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Amount.Size() - i -= size - if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintCoin(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *IntProto) 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 *IntProto) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *IntProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Int.Size() - i -= size - if _, err := m.Int.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *DecProto) 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 *DecProto) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DecProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size := m.Dec.Size() - i -= size - if _, err := m.Dec.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintCoin(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintCoin(dAtA []byte, offset int, v uint64) int { - offset -= sovCoin(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Coin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovCoin(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func (m *DecCoin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovCoin(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func (m *IntProto) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Int.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func (m *DecProto) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Dec.Size() - n += 1 + l + sovCoin(uint64(l)) - return n -} - -func sovCoin(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozCoin(x uint64) (n int) { - return sovCoin(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Coin) 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 ErrIntOverflowCoin - } - 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: Coin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Coin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DecCoin) 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 ErrIntOverflowCoin - } - 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: DecCoin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DecCoin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IntProto) 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 ErrIntOverflowCoin - } - 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: IntProto: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IntProto: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Int.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DecProto) 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 ErrIntOverflowCoin - } - 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: DecProto: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DecProto: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dec", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCoin - } - 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 ErrInvalidLengthCoin - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCoin - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Dec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCoin(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCoin - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCoin(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, ErrIntOverflowCoin - } - 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, ErrIntOverflowCoin - } - 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, ErrIntOverflowCoin - } - 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, ErrInvalidLengthCoin - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCoin - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthCoin - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthCoin = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCoin = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCoin = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/types/coin_type.go b/core-sdk/types/coin_type.go deleted file mode 100644 index fa869239..00000000 --- a/core-sdk/types/coin_type.go +++ /dev/null @@ -1,88 +0,0 @@ -package types - -import ( - "strings" -) - -type Unit struct { - Denom string `json:"denom"` //denom of unit - Scale uint8 `json:"scale"` //scale of unit -} - -func NewUnit(denom string, scale uint8) Unit { - return Unit{ - Denom: denom, - Scale: scale, - } -} - -//GetScaleFactor return 1 * 10^scale -func (u Unit) GetScaleFactor() Int { - return NewIntWithDecimal(1, int(u.Scale)) -} - -type CoinType struct { - Name string `json:"name"` //description name of CoinType - MinUnit Unit `json:"min_unit"` //the min unit of CoinType - MainUnit Unit `json:"main_unit"` //the max unit of CoinType - Desc string `json:"desc"` //the description of CoinType -} - -//ToMainCoin return the main denom coin from args -func (ct CoinType) ConvertToMainCoin(coin Coin) (DecCoin, error) { - if !ct.hasUnit(coin.Denom) { - return DecCoin{ - Amount: NewDecFromInt(coin.Amount), - Denom: coin.Denom, - }, nil - //return DecCoin{}, errors.New("coinType unit (%s) not defined" + coin.Denom) - } - - if ct.isMainUnit(coin.Denom) { - return DecCoin{}, nil - } - - // dest amount = src amount * (10^(dest scale) / 10^(src scale)) - dstScale := NewDecFromInt(ct.MainUnit.GetScaleFactor()) - srcScale := NewDecFromInt(ct.MinUnit.GetScaleFactor()) - amount := NewDecFromInt(coin.Amount) - - amt := amount.Mul(dstScale).Quo(srcScale) - return NewDecCoinFromDec(ct.MainUnit.Denom, amt), nil -} - -//ToMinCoin return the min denom coin from args -func (ct CoinType) ConvertToMinCoin(coin DecCoin) (newCoin Coin, err error) { - if !ct.hasUnit(coin.Denom) { - return Coin{ - Amount: coin.Amount.TruncateInt(), - Denom: coin.Denom, - }, nil - //return newCoin, errors.New("coinType unit (%s) not defined" + coin.Denom) - } - - if ct.isMinUnit(coin.Denom) { - newCoin, _ := coin.TruncateDecimal() - return newCoin, nil - } - - // dest amount = src amount * (10^(dest scale) / 10^(src scale)) - srcScale := NewDecFromInt(ct.MainUnit.GetScaleFactor()) - dstScale := NewDecFromInt(ct.MinUnit.GetScaleFactor()) - amount := coin.Amount - - amt := amount.Mul(dstScale).Quo(srcScale) - return NewCoin(ct.MinUnit.Denom, amt.RoundInt()), nil -} - -func (ct CoinType) isMainUnit(name string) bool { - return ct.MainUnit.Denom == strings.TrimSpace(name) -} - -func (ct CoinType) isMinUnit(name string) bool { - return ct.MinUnit.Denom == strings.TrimSpace(name) -} - -func (ct CoinType) hasUnit(name string) bool { - return ct.isMainUnit(name) || ct.isMinUnit(name) -} diff --git a/core-sdk/types/config.go b/core-sdk/types/config.go deleted file mode 100644 index c5c58131..00000000 --- a/core-sdk/types/config.go +++ /dev/null @@ -1,288 +0,0 @@ -package types - -import ( - "fmt" - "os" - - "github.com/irisnet/core-sdk-go/common/crypto" - "github.com/irisnet/core-sdk-go/types/store" -) - -const ( - defaultGas = 200000 - defaultFees = "4iris" - defaultTimeout = 5 - defaultLevel = "info" - defaultMaxTxsBytes = 1073741824 - defaultAlgo = "secp256k1" - defaultMode = Sync - defaultPath = "$HOME/irishub-sdk-go/leveldb" - defaultGasAdjustment = 1.0 - defaultTxSizeLimit = 1048576 -) - -type ClientConfig struct { - // irishub node rpc address - NodeURI string - - // irishub grpc address - GRPCAddr string - - // irishub chain-id - ChainID string - - // max gas limit - Gas uint64 - - // Fee amount of point - Fee DecCoins - - // PrivKeyArmor DAO Implements - KeyDAO store.KeyDAO - - // Private key generation algorithm(sm2,secp256k1) - Algo string - - // Transaction broadcast Mode - Mode BroadcastMode - - //Transaction broadcast timeout(seconds) - Timeout uint - - //log level(trace|debug|info|warn|error|fatal|panic) - Level string - - //maximum bytes of a transaction - MaxTxBytes uint64 - - //adjustment factor to be multiplied against the estimate returned by the tx simulation; - GasAdjustment float64 - - //whether to enable caching - Cached bool - - TokenManager TokenManager - - KeyManager crypto.KeyManager - - TxSizeLimit uint64 - - //bech32 Address Prefix - Bech32AddressPrefix AddrPrefixCfg -} - -func NewClientConfig(uri, grpcAddr, chainID string, options ...Option) (ClientConfig, error) { - cfg := ClientConfig{ - NodeURI: uri, - ChainID: chainID, - GRPCAddr: grpcAddr, - } - for _, optionFn := range options { - if err := optionFn(&cfg); err != nil { - return ClientConfig{}, err - } - } - - if err := cfg.checkAndSetDefault(); err != nil { - return ClientConfig{}, err - } - return cfg, nil -} - -func (cfg *ClientConfig) checkAndSetDefault() error { - if len(cfg.NodeURI) == 0 { - return fmt.Errorf("nodeURI is required") - } - - if len(cfg.ChainID) == 0 { - return fmt.Errorf("chainID is required") - } - - if err := GasOption(cfg.Gas)(cfg); err != nil { - return err - } - - if err := FeeOption(cfg.Fee)(cfg); err != nil { - return err - } - - if err := AlgoOption(cfg.Algo)(cfg); err != nil { - return err - } - - if err := KeyDAOOption(cfg.KeyDAO)(cfg); err != nil { - return err - } - - if err := ModeOption(cfg.Mode)(cfg); err != nil { - return err - } - - if err := TimeoutOption(cfg.Timeout)(cfg); err != nil { - return err - } - - if err := LevelOption(cfg.Level)(cfg); err != nil { - return err - } - - if err := MaxTxBytesOption(cfg.MaxTxBytes)(cfg); err != nil { - return err - } - - if err := TokenManagerOption(cfg.TokenManager)(cfg); err != nil { - return err - } - - if err := TxSizeLimitOption(cfg.TxSizeLimit)(cfg); err != nil { - return err - } - - if err := Bech32AddressPrefixOption(cfg.Bech32AddressPrefix)(cfg); err != nil { - return err - } - - return GasAdjustmentOption(cfg.GasAdjustment)(cfg) -} - -type Option func(cfg *ClientConfig) error - -func FeeOption(fee DecCoins) Option { - return func(cfg *ClientConfig) error { - if fee == nil || fee.Empty() || !fee.IsValid() { - fees, _ := ParseDecCoins(defaultFees) - fee = fees - } - cfg.Fee = fee - return nil - } -} - -func KeyDAOOption(dao store.KeyDAO) Option { - return func(cfg *ClientConfig) error { - if dao == nil { - defaultPath := os.ExpandEnv(defaultPath) - levelDB, err := store.NewLevelDB(defaultPath, nil) - if err != nil { - return err - } - dao = levelDB - } - cfg.KeyDAO = dao - return nil - } -} - -func GasOption(gas uint64) Option { - return func(cfg *ClientConfig) error { - if gas <= 0 { - gas = defaultGas - } - cfg.Gas = gas - return nil - } -} - -func AlgoOption(algo string) Option { - return func(cfg *ClientConfig) error { - if algo == "" { - algo = defaultAlgo - } - cfg.Algo = algo - return nil - } -} - -func ModeOption(mode BroadcastMode) Option { - return func(cfg *ClientConfig) error { - if mode == "" { - mode = defaultMode - } - cfg.Mode = mode - return nil - } -} - -func TimeoutOption(timeout uint) Option { - return func(cfg *ClientConfig) error { - if timeout <= 0 { - timeout = defaultTimeout - } - cfg.Timeout = timeout - return nil - } -} - -func LevelOption(level string) Option { - return func(cfg *ClientConfig) error { - if level == "" { - level = defaultLevel - } - cfg.Level = level - return nil - } -} - -func MaxTxBytesOption(maxTxBytes uint64) Option { - return func(cfg *ClientConfig) error { - if maxTxBytes <= 0 { - maxTxBytes = defaultMaxTxsBytes - } - cfg.MaxTxBytes = maxTxBytes - return nil - } -} - -func GasAdjustmentOption(gasAdjustment float64) Option { - return func(cfg *ClientConfig) error { - if gasAdjustment <= 0 { - gasAdjustment = defaultGasAdjustment - } - cfg.GasAdjustment = gasAdjustment - return nil - } -} - -func CachedOption(enabled bool) Option { - return func(cfg *ClientConfig) error { - cfg.Cached = enabled - return nil - } -} - -func TokenManagerOption(tokenManager TokenManager) Option { - return func(cfg *ClientConfig) error { - if tokenManager == nil { - tokenManager = DefaultTokenManager{} - } - cfg.TokenManager = tokenManager - return nil - } -} - -func TxSizeLimitOption(txSizeLimit uint64) Option { - return func(cfg *ClientConfig) error { - if txSizeLimit <= 0 { - txSizeLimit = defaultTxSizeLimit - } - cfg.TxSizeLimit = txSizeLimit - return nil - } -} - -func KeyManagerOption(keyManager crypto.KeyManager) Option { - return func(cfg *ClientConfig) error { - cfg.KeyManager = keyManager - return nil - } -} - -func Bech32AddressPrefixOption(bech32AddressPrefix AddrPrefixCfg) Option { - return func(cfg *ClientConfig) error { - if bech32AddressPrefix.Bech32AddressPrefix == nil { - bech32AddressPrefix = *PrefixCfg - } - cfg.Bech32AddressPrefix = bech32AddressPrefix - return nil - } -} diff --git a/core-sdk/types/dec.go b/core-sdk/types/dec.go deleted file mode 100644 index 947ed328..00000000 --- a/core-sdk/types/dec.go +++ /dev/null @@ -1,797 +0,0 @@ -package types - -import ( - "encoding/json" - "errors" - "fmt" - "math/big" - "strconv" - "strings" - "testing" -) - -// NOTE: never use new(Dec) or else we will panic unmarshalling into the -// nil embedded big.Int -type Dec struct { - i *big.Int -} - -const ( - // number of decimal places - Precision = 18 - - // bytes required to represent the above precision - // Ceiling[Log2[999 999 999 999 999 999]] - DecimalPrecisionBits = 60 - - // max number of iterations in ApproxRoot function - maxApproxRootIterations = 100 -) - -var ( - precisionReuse = new(big.Int).Exp(big.NewInt(10), big.NewInt(Precision), nil) - fivePrecision = new(big.Int).Quo(precisionReuse, big.NewInt(2)) - precisionMultipliers []*big.Int - zeroInt = big.NewInt(0) - oneInt = big.NewInt(1) - tenInt = big.NewInt(10) -) - -// Decimal errors -var ( - ErrEmptyDecimalStr = errors.New("decimal string cannot be empty") - ErrInvalidDecimalLength = errors.New("invalid decimal length") - ErrInvalidDecimalStr = errors.New("invalid decimal string") -) - -// Set precision multipliers -func init() { - precisionMultipliers = make([]*big.Int, Precision+1) - for i := 0; i <= Precision; i++ { - precisionMultipliers[i] = calcPrecisionMultiplier(int64(i)) - } -} - -func precisionInt() *big.Int { - return new(big.Int).Set(precisionReuse) -} - -func ZeroDec() Dec { return Dec{new(big.Int).Set(zeroInt)} } -func OneDec() Dec { return Dec{precisionInt()} } -func SmallestDec() Dec { return Dec{new(big.Int).Set(oneInt)} } - -// calculate the precision multiplier -func calcPrecisionMultiplier(prec int64) *big.Int { - if prec > Precision { - panic(fmt.Sprintf("too much precision, maximum %v, provided %v", Precision, prec)) - } - zerosToAdd := Precision - prec - multiplier := new(big.Int).Exp(tenInt, big.NewInt(zerosToAdd), nil) - return multiplier -} - -// get the precision multiplier, do not mutate result -func precisionMultiplier(prec int64) *big.Int { - if prec > Precision { - panic(fmt.Sprintf("too much precision, maximum %v, provided %v", Precision, prec)) - } - return precisionMultipliers[prec] -} - -// ______________________________________________________________________________________________ - -// create a new Dec from integer assuming whole number -func NewDec(i int64) Dec { - return NewDecWithPrec(i, 0) -} - -// create a new Dec from integer with decimal place at prec -// CONTRACT: prec <= Precision -func NewDecWithPrec(i, prec int64) Dec { - return Dec{ - new(big.Int).Mul(big.NewInt(i), precisionMultiplier(prec)), - } -} - -// create a new Dec from big integer assuming whole numbers -// CONTRACT: prec <= Precision -func NewDecFromBigInt(i *big.Int) Dec { - return NewDecFromBigIntWithPrec(i, 0) -} - -// create a new Dec from big integer assuming whole numbers -// CONTRACT: prec <= Precision -func NewDecFromBigIntWithPrec(i *big.Int, prec int64) Dec { - return Dec{ - new(big.Int).Mul(i, precisionMultiplier(prec)), - } -} - -// create a new Dec from big integer assuming whole numbers -// CONTRACT: prec <= Precision -func NewDecFromInt(i Int) Dec { - return NewDecFromIntWithPrec(i, 0) -} - -// create a new Dec from big integer with decimal place at prec -// CONTRACT: prec <= Precision -func NewDecFromIntWithPrec(i Int, prec int64) Dec { - return Dec{ - new(big.Int).Mul(i.BigInt(), precisionMultiplier(prec)), - } -} - -// create a decimal from an input decimal string. -// valid must come in the form: -// (-) whole integers (.) decimal integers -// examples of acceptable input include: -// -123.456 -// 456.7890 -// 345 -// -456789 -// -// NOTE - An error will return if more decimal places -// are provided in the string than the constant Precision. -// -// CONTRACT - This function does not mutate the input str. -func NewDecFromStr(str string) (Dec, error) { - if len(str) == 0 { - return Dec{}, ErrEmptyDecimalStr - } - - // first extract any negative symbol - neg := false - if str[0] == '-' { - neg = true - str = str[1:] - } - - if len(str) == 0 { - return Dec{}, ErrEmptyDecimalStr - } - - strs := strings.Split(str, ".") - lenDecs := 0 - combinedStr := strs[0] - - if len(strs) == 2 { // has a decimal place - lenDecs = len(strs[1]) - if lenDecs == 0 || len(combinedStr) == 0 { - return Dec{}, ErrInvalidDecimalLength - } - combinedStr += strs[1] - } else if len(strs) > 2 { - return Dec{}, ErrInvalidDecimalStr - } - - if lenDecs > Precision { - return Dec{}, fmt.Errorf("invalid precision; max: %d, got: %d", Precision, lenDecs) - } - - // add some extra zero's to correct to the Precision factor - zerosToAdd := Precision - lenDecs - zeros := fmt.Sprintf(`%0`+strconv.Itoa(zerosToAdd)+`s`, "") - combinedStr += zeros - - combined, ok := new(big.Int).SetString(combinedStr, 10) // base 10 - if !ok { - return Dec{}, fmt.Errorf("failed to set decimal string: %s", combinedStr) - } - if neg { - combined = new(big.Int).Neg(combined) - } - - return Dec{combined}, nil -} - -// Decimal from string, panic on error -func MustNewDecFromStr(s string) Dec { - dec, err := NewDecFromStr(s) - if err != nil { - panic(err) - } - return dec -} - -// ______________________________________________________________________________________________ -//nolint -func (d Dec) IsNil() bool { return d.i == nil } // is decimal nil -func (d Dec) IsZero() bool { return (d.i).Sign() == 0 } // is equal to zero -func (d Dec) IsNegative() bool { return (d.i).Sign() == -1 } // is negative -func (d Dec) IsPositive() bool { return (d.i).Sign() == 1 } // is positive -func (d Dec) Equal(d2 Dec) bool { return (d.i).Cmp(d2.i) == 0 } // equal decimals -func (d Dec) GT(d2 Dec) bool { return (d.i).Cmp(d2.i) > 0 } // greater than -func (d Dec) GTE(d2 Dec) bool { return (d.i).Cmp(d2.i) >= 0 } // greater than or equal -func (d Dec) LT(d2 Dec) bool { return (d.i).Cmp(d2.i) < 0 } // less than -func (d Dec) LTE(d2 Dec) bool { return (d.i).Cmp(d2.i) <= 0 } // less than or equal -func (d Dec) Neg() Dec { return Dec{new(big.Int).Neg(d.i)} } // reverse the decimal sign -func (d Dec) Abs() Dec { return Dec{new(big.Int).Abs(d.i)} } // absolute value - -// BigInt returns a copy of the underlying big.Int. -func (d Dec) BigInt() *big.Int { - if d.IsNil() { - return nil - } - - copy := new(big.Int) - return copy.Set(d.i) -} - -// addition -func (d Dec) Add(d2 Dec) Dec { - res := new(big.Int).Add(d.i, d2.i) - - if res.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{res} -} - -// subtraction -func (d Dec) Sub(d2 Dec) Dec { - res := new(big.Int).Sub(d.i, d2.i) - - if res.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{res} -} - -// multiplication -func (d Dec) Mul(d2 Dec) Dec { - mul := new(big.Int).Mul(d.i, d2.i) - chopped := chopPrecisionAndRound(mul) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// multiplication truncate -func (d Dec) MulTruncate(d2 Dec) Dec { - mul := new(big.Int).Mul(d.i, d2.i) - chopped := chopPrecisionAndTruncate(mul) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// multiplication -func (d Dec) MulInt(i Int) Dec { - mul := new(big.Int).Mul(d.i, i.i) - - if mul.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{mul} -} - -// MulInt64 - multiplication with int64 -func (d Dec) MulInt64(i int64) Dec { - mul := new(big.Int).Mul(d.i, big.NewInt(i)) - - if mul.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{mul} -} - -// quotient -func (d Dec) Quo(d2 Dec) Dec { - // multiply precision twice - mul := new(big.Int).Mul(d.i, precisionReuse) - mul.Mul(mul, precisionReuse) - - quo := new(big.Int).Quo(mul, d2.i) - chopped := chopPrecisionAndRound(quo) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// quotient truncate -func (d Dec) QuoTruncate(d2 Dec) Dec { - // multiply precision twice - mul := new(big.Int).Mul(d.i, precisionReuse) - mul.Mul(mul, precisionReuse) - - quo := new(big.Int).Quo(mul, d2.i) - chopped := chopPrecisionAndTruncate(quo) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// quotient, round up -func (d Dec) QuoRoundUp(d2 Dec) Dec { - // multiply precision twice - mul := new(big.Int).Mul(d.i, precisionReuse) - mul.Mul(mul, precisionReuse) - - quo := new(big.Int).Quo(mul, d2.i) - chopped := chopPrecisionAndRoundUp(quo) - - if chopped.BitLen() > 255+DecimalPrecisionBits { - panic("Int overflow") - } - return Dec{chopped} -} - -// quotient -func (d Dec) QuoInt(i Int) Dec { - mul := new(big.Int).Quo(d.i, i.i) - return Dec{mul} -} - -// QuoInt64 - quotient with int64 -func (d Dec) QuoInt64(i int64) Dec { - mul := new(big.Int).Quo(d.i, big.NewInt(i)) - return Dec{mul} -} - -// ApproxRoot returns an approximate estimation of a Dec's positive real nth root -// using Newton's method (where n is positive). The algorithm starts with some guess and -// computes the sequence of improved guesses until an answer converges to an -// approximate answer. It returns `|d|.ApproxRoot() * -1` if input is negative. -// A maximum number of 100 iterations is used a backup boundary condition for -// cases where the answer never converges enough to satisfy the main condition. -func (d Dec) ApproxRoot(root uint64) (guess Dec, err error) { - defer func() { - if r := recover(); r != nil { - var ok bool - err, ok = r.(error) - if !ok { - err = errors.New("out of bounds") - } - } - }() - - if d.IsNegative() { - absRoot, err := d.MulInt64(-1).ApproxRoot(root) - return absRoot.MulInt64(-1), err - } - - if root == 1 || d.IsZero() || d.Equal(OneDec()) { - return d, nil - } - - if root == 0 { - return OneDec(), nil - } - - rootInt := NewIntFromUint64(root) - guess, delta := OneDec(), OneDec() - - for iter := 0; delta.Abs().GT(SmallestDec()) && iter < maxApproxRootIterations; iter++ { - prev := guess.Power(root - 1) - if prev.IsZero() { - prev = SmallestDec() - } - delta = d.Quo(prev) - delta = delta.Sub(guess) - delta = delta.QuoInt(rootInt) - - guess = guess.Add(delta) - } - - return guess, nil -} - -// Power returns a the result of raising to a positive integer power -func (d Dec) Power(power uint64) Dec { - if power == 0 { - return OneDec() - } - tmp := OneDec() - - for i := power; i > 1; { - if i%2 == 0 { - i /= 2 - } else { - tmp = tmp.Mul(d) - i = (i - 1) / 2 - } - d = d.Mul(d) - } - - return d.Mul(tmp) -} - -// ApproxSqrt is a wrapper around ApproxRoot for the common special case -// of finding the square root of a number. It returns -(sqrt(abs(d)) if input is negative. -func (d Dec) ApproxSqrt() (Dec, error) { - return d.ApproxRoot(2) -} - -// is integer, e.g. decimals are zero -func (d Dec) IsInteger() bool { - return new(big.Int).Rem(d.i, precisionReuse).Sign() == 0 -} - -// format decimal state -func (d Dec) Format(s fmt.State, verb rune) { - _, err := s.Write([]byte(d.String())) - if err != nil { - panic(err) - } -} - -func (d Dec) String() string { - if d.i == nil { - return d.i.String() - } - - isNeg := d.IsNegative() - - if isNeg { - d = d.Neg() - } - - bzInt, err := d.i.MarshalText() - if err != nil { - return "" - } - inputSize := len(bzInt) - - var bzStr []byte - - // TODO: Remove trailing zeros - // case 1, purely decimal - if inputSize <= Precision { - bzStr = make([]byte, Precision+2) - - // 0. prefix - bzStr[0] = byte('0') - bzStr[1] = byte('.') - - // set relevant digits to 0 - for i := 0; i < Precision-inputSize; i++ { - bzStr[i+2] = byte('0') - } - - // set final digits - copy(bzStr[2+(Precision-inputSize):], bzInt) - } else { - // inputSize + 1 to account for the decimal point that is being added - bzStr = make([]byte, inputSize+1) - decPointPlace := inputSize - Precision - - copy(bzStr, bzInt[:decPointPlace]) // pre-decimal digits - bzStr[decPointPlace] = byte('.') // decimal point - copy(bzStr[decPointPlace+1:], bzInt[decPointPlace:]) // post-decimal digits - } - - if isNeg { - return "-" + string(bzStr) - } - - return string(bzStr) -} - -// ____ -// __| |__ "chop 'em -// ` \ round!" -// ___|| ~ _ -bankers -// | | __ -// | | | __|__|__ -// |_____: / | $$$ | -// |________| - -// Remove a Precision amount of rightmost digits and perform bankers rounding -// on the remainder (gaussian rounding) on the digits which have been removed. -// -// Mutates the input. Use the non-mutative version if that is undesired -func chopPrecisionAndRound(d *big.Int) *big.Int { - // remove the negative and add it back when returning - if d.Sign() == -1 { - // make d positive, compute chopped value, and then un-mutate d - d = d.Neg(d) - d = chopPrecisionAndRound(d) - d = d.Neg(d) - return d - } - - // get the truncated quotient and remainder - quo, rem := d, big.NewInt(0) - quo, rem = quo.QuoRem(d, precisionReuse, rem) - - if rem.Sign() == 0 { // remainder is zero - return quo - } - - switch rem.Cmp(fivePrecision) { - case -1: - return quo - case 1: - return quo.Add(quo, oneInt) - default: // bankers rounding must take place - // always round to an even number - if quo.Bit(0) == 0 { - return quo - } - return quo.Add(quo, oneInt) - } -} - -func chopPrecisionAndRoundUp(d *big.Int) *big.Int { - // remove the negative and add it back when returning - if d.Sign() == -1 { - // make d positive, compute chopped value, and then un-mutate d - d = d.Neg(d) - // truncate since d is negative... - d = chopPrecisionAndTruncate(d) - d = d.Neg(d) - return d - } - - // get the truncated quotient and remainder - quo, rem := d, big.NewInt(0) - quo, rem = quo.QuoRem(d, precisionReuse, rem) - - if rem.Sign() == 0 { // remainder is zero - return quo - } - - return quo.Add(quo, oneInt) -} - -func chopPrecisionAndRoundNonMutative(d *big.Int) *big.Int { - tmp := new(big.Int).Set(d) - return chopPrecisionAndRound(tmp) -} - -// RoundInt64 rounds the decimal using bankers rounding -func (d Dec) RoundInt64() int64 { - chopped := chopPrecisionAndRoundNonMutative(d.i) - if !chopped.IsInt64() { - panic("Int64() out of bound") - } - return chopped.Int64() -} - -// RoundInt round the decimal using bankers rounding -func (d Dec) RoundInt() Int { - return NewIntFromBigInt(chopPrecisionAndRoundNonMutative(d.i)) -} - -// ___________________________________________________________________________________ - -// similar to chopPrecisionAndRound, but always rounds down -func chopPrecisionAndTruncate(d *big.Int) *big.Int { - return d.Quo(d, precisionReuse) -} - -func chopPrecisionAndTruncateNonMutative(d *big.Int) *big.Int { - tmp := new(big.Int).Set(d) - return chopPrecisionAndTruncate(tmp) -} - -// TruncateInt64 truncates the decimals from the number and returns an int64 -func (d Dec) TruncateInt64() int64 { - chopped := chopPrecisionAndTruncateNonMutative(d.i) - if !chopped.IsInt64() { - panic("Int64() out of bound") - } - return chopped.Int64() -} - -// TruncateInt truncates the decimals from the number and returns an Int -func (d Dec) TruncateInt() Int { - return NewIntFromBigInt(chopPrecisionAndTruncateNonMutative(d.i)) -} - -// TruncateDec truncates the decimals from the number and returns a Dec -func (d Dec) TruncateDec() Dec { - return NewDecFromBigInt(chopPrecisionAndTruncateNonMutative(d.i)) -} - -// Ceil returns the smallest interger value (as a decimal) that is greater than -// or equal to the given decimal. -func (d Dec) Ceil() Dec { - tmp := new(big.Int).Set(d.i) - - quo, rem := tmp, big.NewInt(0) - quo, rem = quo.QuoRem(tmp, precisionReuse, rem) - - // no need to round with a zero remainder regardless of sign - if rem.Cmp(zeroInt) == 0 { - return NewDecFromBigInt(quo) - } - - if rem.Sign() == -1 { - return NewDecFromBigInt(quo) - } - - return NewDecFromBigInt(quo.Add(quo, oneInt)) -} - -// ___________________________________________________________________________________ - -// MaxSortableDec is the largest Dec that can be passed into SortableDecBytes() -// Its negative form is the least Dec that can be passed in. -var MaxSortableDec = OneDec().Quo(SmallestDec()) - -// ValidSortableDec ensures that a Dec is within the sortable bounds, -// a Dec can't have a precision of less than 10^-18. -// Max sortable decimal was set to the reciprocal of SmallestDec. -func ValidSortableDec(dec Dec) bool { - return dec.Abs().LTE(MaxSortableDec) -} - -// SortableDecBytes returns a byte slice representation of a Dec that can be sorted. -// Left and right pads with 0s so there are 18 digits to left and right of the decimal point. -// For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec. -func SortableDecBytes(dec Dec) []byte { - if !ValidSortableDec(dec) { - panic("dec must be within bounds") - } - // Instead of adding an extra byte to all sortable decs in order to handle max sortable, we just - // makes its bytes be "max" which comes after all numbers in ASCIIbetical order - if dec.Equal(MaxSortableDec) { - return []byte("max") - } - // For the same reason, we make the bytes of minimum sortable dec be --, which comes before all numbers. - if dec.Equal(MaxSortableDec.Neg()) { - return []byte("--") - } - // We move the negative sign to the front of all the left padded 0s, to make negative numbers come before positive numbers - if dec.IsNegative() { - return append([]byte("-"), []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", Precision*2+1), dec.Abs().String()))...) - } - return []byte(fmt.Sprintf(fmt.Sprintf("%%0%ds", Precision*2+1), dec.String())) -} - -// ___________________________________________________________________________________ - -// reuse nil values -var nilJSON []byte - -func init() { - empty := new(big.Int) - bz, _ := empty.MarshalText() - nilJSON, _ = json.Marshal(string(bz)) -} - -// MarshalJSON marshals the decimal -func (d Dec) MarshalJSON() ([]byte, error) { - if d.i == nil { - return nilJSON, nil - } - return json.Marshal(d.String()) -} - -// UnmarshalJSON defines custom decoding scheme -func (d *Dec) UnmarshalJSON(bz []byte) error { - if d.i == nil { - d.i = new(big.Int) - } - - var text string - err := json.Unmarshal(bz, &text) - if err != nil { - return err - } - - // TODO: Reuse dec allocation - newDec, err := NewDecFromStr(text) - if err != nil { - return err - } - - d.i = newDec.i - return nil -} - -// MarshalYAML returns the YAML representation. -func (d Dec) MarshalYAML() (interface{}, error) { - return d.String(), nil -} - -// Marshal implements the gogo proto custom type interface. -func (d Dec) Marshal() ([]byte, error) { - if d.i == nil { - d.i = new(big.Int) - } - return d.i.MarshalText() -} - -// MarshalTo implements the gogo proto custom type interface. -func (d *Dec) MarshalTo(data []byte) (n int, err error) { - if d.i == nil { - d.i = new(big.Int) - } - - if d.i.Cmp(zeroInt) == 0 { - copy(data, []byte{0x30}) - return 1, nil - } - - bz, err := d.Marshal() - if err != nil { - return 0, err - } - - copy(data, bz) - return len(bz), nil -} - -// Unmarshal implements the gogo proto custom type interface. -func (d *Dec) Unmarshal(data []byte) error { - if len(data) == 0 { - d = nil - return nil - } - - if d.i == nil { - d.i = new(big.Int) - } - - if err := d.i.UnmarshalText(data); err != nil { - return err - } - - if d.i.BitLen() > maxBitLen { - return fmt.Errorf("decimal out of range; got: %d, max: %d", d.i.BitLen(), maxBitLen) - } - - return nil -} - -// Size implements the gogo proto custom type interface. -func (d *Dec) Size() int { - bz, _ := d.Marshal() - return len(bz) -} - -// Override Amino binary serialization by proxying to protobuf. -func (d Dec) MarshalAmino() ([]byte, error) { return d.Marshal() } -func (d *Dec) UnmarshalAmino(bz []byte) error { return d.Unmarshal(bz) } - -func (dp DecProto) String() string { - return dp.Dec.String() -} - -// ___________________________________________________________________________________ -// helpers - -// test if two decimal arrays are equal -func DecsEqual(d1s, d2s []Dec) bool { - if len(d1s) != len(d2s) { - return false - } - - for i, d1 := range d1s { - if !d1.Equal(d2s[i]) { - return false - } - } - return true -} - -// minimum decimal between two -func MinDec(d1, d2 Dec) Dec { - if d1.LT(d2) { - return d1 - } - return d2 -} - -// maximum decimal between two -func MaxDec(d1, d2 Dec) Dec { - if d1.LT(d2) { - return d2 - } - return d1 -} - -// intended to be used with require/assert: require.True(DecEq(...)) -func DecEq(t *testing.T, exp, got Dec) (*testing.T, bool, string, string, string) { - return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} diff --git a/core-sdk/types/dec_coin.go b/core-sdk/types/dec_coin.go deleted file mode 100644 index 54920581..00000000 --- a/core-sdk/types/dec_coin.go +++ /dev/null @@ -1,644 +0,0 @@ -package types - -import ( - "fmt" - "sort" - "strings" - - "github.com/pkg/errors" -) - -// Decimal Coin - -// NewDecCoin creates a new DecCoin instance from an Int. -func NewDecCoin(denom string, amount Int) DecCoin { - if err := validate(denom, amount); err != nil { - panic(err) - } - - return DecCoin{ - Denom: denom, - Amount: amount.ToDec(), - } -} - -// NewDecCoinFromDec creates a new DecCoin instance from a Dec. -func NewDecCoinFromDec(denom string, amount Dec) DecCoin { - mustValidateDenom(denom) - - if amount.IsNegative() { - panic(fmt.Sprintf("negative decimal coin amount: %v\n", amount)) - } - - return DecCoin{ - Denom: denom, - Amount: amount, - } -} - -// NewDecCoinFromCoin creates a new DecCoin from a Coin. -func NewDecCoinFromCoin(coin Coin) DecCoin { - if err := validate(coin.Denom, coin.Amount); err != nil { - panic(err) - } - - return DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.ToDec(), - } -} - -// NewInt64DecCoin returns a new DecCoin with a denomination and amount. It will -// panic if the amount is negative or denom is invalid. -func NewInt64DecCoin(denom string, amount int64) DecCoin { - return NewDecCoin(denom, NewInt(amount)) -} - -// IsZero returns if the DecCoin amount is zero. -func (coin DecCoin) IsZero() bool { - return coin.Amount.IsZero() -} - -// IsGTE returns true if they are the same type and the receiver is -// an equal or greater value. -func (coin DecCoin) IsGTE(other DecCoin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return !coin.Amount.LT(other.Amount) -} - -// IsLT returns true if they are the same type and the receiver is -// a smaller value. -func (coin DecCoin) IsLT(other DecCoin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.LT(other.Amount) -} - -// IsEqual returns true if the two sets of Coins have the same value. -func (coin DecCoin) IsEqual(other DecCoin) bool { - if coin.Denom != other.Denom { - panic(fmt.Sprintf("invalid coin denominations; %s, %s", coin.Denom, other.Denom)) - } - - return coin.Amount.Equal(other.Amount) -} - -// Add adds amounts of two decimal coins with same denom. -func (coin DecCoin) Add(coinB DecCoin) DecCoin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("coin denom different: %v %v\n", coin.Denom, coinB.Denom)) - } - return DecCoin{coin.Denom, coin.Amount.Add(coinB.Amount)} -} - -// Sub subtracts amounts of two decimal coins with same denom. -func (coin DecCoin) Sub(coinB DecCoin) DecCoin { - if coin.Denom != coinB.Denom { - panic(fmt.Sprintf("coin denom different: %v %v\n", coin.Denom, coinB.Denom)) - } - res := DecCoin{coin.Denom, coin.Amount.Sub(coinB.Amount)} - if res.IsNegative() { - panic("negative decimal coin amount") - } - return res -} - -// TruncateDecimal returns a Coin with a truncated decimal and a DecCoin for the -// change. Note, the change may be zero. -func (coin DecCoin) TruncateDecimal() (Coin, DecCoin) { - truncated := coin.Amount.TruncateInt() - change := coin.Amount.Sub(truncated.ToDec()) - return NewCoin(coin.Denom, truncated), NewDecCoinFromDec(coin.Denom, change) -} - -// IsPositive returns true if coin amount is positive. -// -// TODO: Remove once unsigned integers are used. -func (coin DecCoin) IsPositive() bool { - return coin.Amount.IsPositive() -} - -// IsNegative returns true if the coin amount is negative and false otherwise. -// -// TODO: Remove once unsigned integers are used. -func (coin DecCoin) IsNegative() bool { - return coin.Amount.IsNegative() -} - -// String implements the Stringer interface for DecCoin. It returns a -// human-readable representation of a decimal coin. -func (coin DecCoin) String() string { - return fmt.Sprintf("%v%v", coin.Amount, coin.Denom) -} - -// IsValid returns true if the DecCoin has a non-negative amount and the denom is vaild. -func (coin DecCoin) IsValid() bool { - if err := ValidateDenom(coin.Denom); err != nil { - return false - } - return !coin.IsNegative() -} - -// ---------------------------------------------------------------------------- -// Decimal Coins - -// DecCoins defines a slice of coins with decimal values -type DecCoins []DecCoin - -// NewDecCoins constructs a new coin set with with decimal values -// from DecCoins. -func NewDecCoins(decCoins ...DecCoin) DecCoins { - // remove zeroes - newDecCoins := removeZeroDecCoins(DecCoins(decCoins)) - if len(newDecCoins) == 0 { - return DecCoins{} - } - - newDecCoins.Sort() - - // detect duplicate Denoms - if dupIndex := findDup(newDecCoins); dupIndex != -1 { - panic(fmt.Errorf("find duplicate denom: %s", newDecCoins[dupIndex])) - } - - if !newDecCoins.IsValid() { - panic(fmt.Errorf("invalid coin set: %s", newDecCoins)) - } - - return newDecCoins -} - -// NewDecCoinsFromCoin constructs a new coin set with decimal values -// from regular Coins. -func NewDecCoinsFromCoins(coins ...Coin) DecCoins { - decCoins := make(DecCoins, len(coins)) - newCoins := NewCoins(coins...) - for i, coin := range newCoins { - decCoins[i] = NewDecCoinFromCoin(coin) - } - - return decCoins -} - -// String implements the Stringer interface for DecCoins. It returns a -// human-readable representation of decimal coins. -func (coins DecCoins) String() string { - if len(coins) == 0 { - return "" - } - - out := "" - for _, coin := range coins { - out += fmt.Sprintf("%v,", coin.String()) - } - - return out[:len(out)-1] -} - -// TruncateDecimal returns the coins with truncated decimals and returns the -// change. Note, it will not return any zero-amount coins in either the truncated or -// change coins. -func (coins DecCoins) TruncateDecimal() (truncatedCoins Coins, changeCoins DecCoins) { - for _, coin := range coins { - truncated, change := coin.TruncateDecimal() - if !truncated.IsZero() { - truncatedCoins = truncatedCoins.Add(truncated) - } - if !change.IsZero() { - changeCoins = changeCoins.Add(change) - } - } - - return truncatedCoins, changeCoins -} - -// Add adds two sets of DecCoins. -// -// NOTE: Add operates under the invariant that coins are sorted by -// denominations. -// -// CONTRACT: Add will never return Coins where one Coin has a non-positive -// amount. In otherwords, IsValid will always return true. -func (coins DecCoins) Add(coinsB ...DecCoin) DecCoins { - return coins.safeAdd(coinsB) -} - -// safeAdd will perform addition of two DecCoins sets. If both coin sets are -// empty, then an empty set is returned. If only a single set is empty, the -// other set is returned. Otherwise, the coins are compared in order of their -// denomination and addition only occurs when the denominations match, otherwise -// the coin is simply added to the sum assuming it's not zero. -func (coins DecCoins) safeAdd(coinsB DecCoins) DecCoins { - sum := ([]DecCoin)(nil) - indexA, indexB := 0, 0 - lenA, lenB := len(coins), len(coinsB) - - for { - if indexA == lenA { - if indexB == lenB { - // return nil coins if both sets are empty - return sum - } - - // return set B (excluding zero coins) if set A is empty - return append(sum, removeZeroDecCoins(coinsB[indexB:])...) - } else if indexB == lenB { - // return set A (excluding zero coins) if set B is empty - return append(sum, removeZeroDecCoins(coins[indexA:])...) - } - - coinA, coinB := coins[indexA], coinsB[indexB] - - switch strings.Compare(coinA.Denom, coinB.Denom) { - case -1: // coin A denom < coin B denom - if !coinA.IsZero() { - sum = append(sum, coinA) - } - - indexA++ - - case 0: // coin A denom == coin B denom - res := coinA.Add(coinB) - if !res.IsZero() { - sum = append(sum, res) - } - - indexA++ - indexB++ - - case 1: // coin A denom > coin B denom - if !coinB.IsZero() { - sum = append(sum, coinB) - } - - indexB++ - } - } -} - -// negative returns a set of coins with all amount negative. -func (coins DecCoins) negative() DecCoins { - res := make([]DecCoin, 0, len(coins)) - for _, coin := range coins { - res = append(res, DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.Neg(), - }) - } - return res -} - -// Sub subtracts a set of DecCoins from another (adds the inverse). -func (coins DecCoins) Sub(coinsB DecCoins) DecCoins { - diff, hasNeg := coins.SafeSub(coinsB) - if hasNeg { - panic("negative coin amount") - } - - return diff -} - -// SafeSub performs the same arithmetic as Sub but returns a boolean if any -// negative coin amount was returned. -func (coins DecCoins) SafeSub(coinsB DecCoins) (DecCoins, bool) { - diff := coins.safeAdd(coinsB.negative()) - return diff, diff.IsAnyNegative() -} - -// Intersect will return a new set of coins which contains the minimum DecCoin -// for common denoms found in both `coins` and `coinsB`. For denoms not common -// to both `coins` and `coinsB` the minimum is considered to be 0, thus they -// are not added to the final set.In other words, trim any denom amount from -// coin which exceeds that of coinB, such that (coin.Intersect(coinB)).IsLTE(coinB). -func (coins DecCoins) Intersect(coinsB DecCoins) DecCoins { - res := make([]DecCoin, len(coins)) - for i, coin := range coins { - minCoin := DecCoin{ - Denom: coin.Denom, - Amount: MinDec(coin.Amount, coinsB.AmountOf(coin.Denom)), - } - res[i] = minCoin - } - return removeZeroDecCoins(res) -} - -// GetDenomByIndex returns the Denom to make the findDup generic -func (coins DecCoins) GetDenomByIndex(i int) string { - return coins[i].Denom -} - -// IsAnyNegative returns true if there is at least one coin whose amount -// is negative; returns false otherwise. It returns false if the DecCoins set -// is empty too. -// -// TODO: Remove once unsigned integers are used. -func (coins DecCoins) IsAnyNegative() bool { - for _, coin := range coins { - if coin.IsNegative() { - return true - } - } - - return false -} - -// MulDec multiplies all the coins by a decimal. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) MulDec(d Dec) DecCoins { - var res DecCoins - for _, coin := range coins { - product := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.Mul(d), - } - - if !product.IsZero() { - res = res.Add(product) - } - } - - return res -} - -// MulDecTruncate multiplies all the decimal coins by a decimal, truncating. It -// panics if d is zero. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) MulDecTruncate(d Dec) DecCoins { - var res DecCoins - - for _, coin := range coins { - product := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.MulTruncate(d), - } - - if !product.IsZero() { - res = res.Add(product) - } - } - - return res -} - -// QuoDec divides all the decimal coins by a decimal. It panics if d is zero. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) QuoDec(d Dec) DecCoins { - if d.IsZero() { - panic("invalid zero decimal") - } - - var res DecCoins - for _, coin := range coins { - quotient := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.Quo(d), - } - - if !quotient.IsZero() { - res = res.Add(quotient) - } - } - - return res -} - -// QuoDecTruncate divides all the decimal coins by a decimal, truncating. It -// panics if d is zero. -// -// CONTRACT: No zero coins will be returned. -func (coins DecCoins) QuoDecTruncate(d Dec) DecCoins { - if d.IsZero() { - panic("invalid zero decimal") - } - - var res DecCoins - for _, coin := range coins { - quotient := DecCoin{ - Denom: coin.Denom, - Amount: coin.Amount.QuoTruncate(d), - } - - if !quotient.IsZero() { - res = res.Add(quotient) - } - } - - return res -} - -// Empty returns true if there are no coins and false otherwise. -func (coins DecCoins) Empty() bool { - return len(coins) == 0 -} - -// AmountOf returns the amount of a denom from deccoins -func (coins DecCoins) AmountOf(denom string) Dec { - mustValidateDenom(denom) - - switch len(coins) { - case 0: - return ZeroDec() - - case 1: - coin := coins[0] - if coin.Denom == denom { - return coin.Amount - } - return ZeroDec() - - default: - midIdx := len(coins) / 2 // 2:1, 3:1, 4:2 - coin := coins[midIdx] - - switch { - case denom < coin.Denom: - return coins[:midIdx].AmountOf(denom) - case denom == coin.Denom: - return coin.Amount - default: - return coins[midIdx+1:].AmountOf(denom) - } - } -} - -// IsEqual returns true if the two sets of DecCoins have the same value. -func (coins DecCoins) IsEqual(coinsB DecCoins) bool { - if len(coins) != len(coinsB) { - return false - } - - coins = coins.Sort() - coinsB = coinsB.Sort() - - for i := 0; i < len(coins); i++ { - if !coins[i].IsEqual(coinsB[i]) { - return false - } - } - - return true -} - -// IsZero returns whether all coins are zero -func (coins DecCoins) IsZero() bool { - for _, coin := range coins { - if !coin.Amount.IsZero() { - return false - } - } - return true -} - -// IsValid asserts the DecCoins are sorted, have positive amount, and Denom -// does not contain upper case characters. -func (coins DecCoins) IsValid() bool { - switch len(coins) { - case 0: - return true - - case 1: - if err := ValidateDenom(coins[0].Denom); err != nil { - return false - } - return coins[0].IsPositive() - - default: - // check single coin case - if !(DecCoins{coins[0]}).IsValid() { - return false - } - - lowDenom := coins[0].Denom - for _, coin := range coins[1:] { - if strings.ToLower(coin.Denom) != coin.Denom { - return false - } - if coin.Denom <= lowDenom { - return false - } - if !coin.IsPositive() { - return false - } - - // we compare each coin against the last denom - lowDenom = coin.Denom - } - - return true - } -} - -// IsAllPositive returns true if there is at least one coin and all currencies -// have a positive value. -// -// TODO: Remove once unsigned integers are used. -func (coins DecCoins) IsAllPositive() bool { - if len(coins) == 0 { - return false - } - - for _, coin := range coins { - if !coin.IsPositive() { - return false - } - } - - return true -} - -func removeZeroDecCoins(coins DecCoins) DecCoins { - i, l := 0, len(coins) - for i < l { - if coins[i].IsZero() { - // remove coin - coins = append(coins[:i], coins[i+1:]...) - l-- - } else { - i++ - } - } - - return coins[:i] -} - -// ----------------------------------------------------------------------------- -// Sorting - -var _ sort.Interface = Coins{} - -//nolint -func (coins DecCoins) Len() int { return len(coins) } -func (coins DecCoins) Less(i, j int) bool { return coins[i].Denom < coins[j].Denom } -func (coins DecCoins) Swap(i, j int) { coins[i], coins[j] = coins[j], coins[i] } - -// Sort is a helper function to sort the set of decimal coins in-place. -func (coins DecCoins) Sort() DecCoins { - sort.Sort(coins) - return coins -} - -// ---------------------------------------------------------------------------- -// Parsing - -// ParseDecCoin parses a decimal coin from a string, returning an error if -// invalid. An empty string is considered invalid. -func ParseDecCoin(coinStr string) (coin DecCoin, err error) { - coinStr = strings.TrimSpace(coinStr) - - matches := reDecCoin.FindStringSubmatch(coinStr) - if matches == nil { - return DecCoin{}, fmt.Errorf("invalid decimal coin expression: %s", coinStr) - } - - amountStr, denomStr := matches[1], matches[2] - - amount, err := NewDecFromStr(amountStr) - if err != nil { - return DecCoin{}, errors.Wrap(err, fmt.Sprintf("failed to parse decimal coin amount: %s", amountStr)) - } - - if err := ValidateDenom(denomStr); err != nil { - return DecCoin{}, fmt.Errorf("invalid denom cannot contain upper case characters or spaces: %s", err) - } - - return NewDecCoinFromDec(denomStr, amount), nil -} - -// ParseDecCoins will parse out a list of decimal coins separated by commas. -// If nothing is provided, it returns nil DecCoins. Returned decimal coins are -// sorted. -func ParseDecCoins(coinsStr string) (DecCoins, error) { - coinsStr = strings.TrimSpace(coinsStr) - if len(coinsStr) == 0 { - return nil, nil - } - - coinStrs := strings.Split(coinsStr, ",") - coins := make(DecCoins, len(coinStrs)) - for i, coinStr := range coinStrs { - coin, err := ParseDecCoin(coinStr) - if err != nil { - return nil, err - } - - coins[i] = coin - } - - // sort coins for determinism - coins.Sort() - - // validate coins before returning - if !coins.IsValid() { - return nil, fmt.Errorf("parsed decimal coins are invalid: %#v", coins) - } - - return coins, nil -} diff --git a/core-sdk/types/doc.go b/core-sdk/types/doc.go deleted file mode 100644 index 9f89f0c9..00000000 --- a/core-sdk/types/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -/* -Package types defines a custom wrapper for google.protobuf.Any which supports -cached values as well as InterfaceRegistry which keeps track of types which can -be used with Any for both security and introspection -*/ -package types diff --git a/core-sdk/types/env.go b/core-sdk/types/env.go deleted file mode 100644 index 931e47d8..00000000 --- a/core-sdk/types/env.go +++ /dev/null @@ -1,73 +0,0 @@ -package types - -const ( - // prefixChain defines the prefix of this chain - prefixChain = "i" - - // PrefixAcc is the prefix for account - prefixAccount = "a" - - // prefixValidator is the prefix for validator keys - prefixValidator = "v" - - // prefixConsensus is the prefix for consensus keys - prefixConsensus = "c" - - // prefixPublic is the prefix for public - prefixPublic = "p" - - // prefixAddress is the prefix for address - prefixAddress = "a" -) - -var ( - PrefixCfg = &AddrPrefixCfg{ - Bech32AddressPrefix: map[string]string{ - "account_addr": prefixChain + prefixAccount + prefixAddress, - "validator_addr": prefixChain + prefixValidator + prefixAddress, - "consensus_addr": prefixChain + prefixConsensus + prefixAddress, - "account_pub": prefixChain + prefixAccount + prefixPublic, - "validator_pub": prefixChain + prefixValidator + prefixPublic, - "consensus_pub": prefixChain + prefixConsensus + prefixPublic, - }, - } -) - -type AddrPrefixCfg struct { - Bech32AddressPrefix map[string]string -} - -// GetAddrPrefixCfg returns the config instance for the corresponding Network type -func GetAddrPrefixCfg() *AddrPrefixCfg { - return PrefixCfg -} - -// GetBech32AccountAddrPrefix returns the Bech32 prefix for account address -func (config *AddrPrefixCfg) GetBech32AccountAddrPrefix() string { - return config.Bech32AddressPrefix["account_addr"] -} - -// GetBech32ValidatorAddrPrefix returns the Bech32 prefix for validator address -func (config *AddrPrefixCfg) GetBech32ValidatorAddrPrefix() string { - return config.Bech32AddressPrefix["validator_addr"] -} - -// GetBech32ConsensusAddrPrefix returns the Bech32 prefix for consensus node address -func (config *AddrPrefixCfg) GetBech32ConsensusAddrPrefix() string { - return config.Bech32AddressPrefix["consensus_addr"] -} - -// GetBech32AccountPubPrefix returns the Bech32 prefix for account public key -func (config *AddrPrefixCfg) GetBech32AccountPubPrefix() string { - return config.Bech32AddressPrefix["account_pub"] -} - -// GetBech32ValidatorPubPrefix returns the Bech32 prefix for validator public key -func (config *AddrPrefixCfg) GetBech32ValidatorPubPrefix() string { - return config.Bech32AddressPrefix["validator_pub"] -} - -// GetBech32ConsensusPubPrefix returns the Bech32 prefix for consensus node public key -func (config *AddrPrefixCfg) GetBech32ConsensusPubPrefix() string { - return config.Bech32AddressPrefix["consensus_pub"] -} diff --git a/core-sdk/types/errors.go b/core-sdk/types/errors.go deleted file mode 100644 index 6b13848e..00000000 --- a/core-sdk/types/errors.go +++ /dev/null @@ -1,235 +0,0 @@ -package types - -import ( - "fmt" - "strings" - - "github.com/pkg/errors" -) - -const ( - // RootCodespace is the codespace for all errors defined in irita - RootCodespace = "sdk" - - OK Code = 0 - Internal Code = 1 - TxDecode Code = 2 - InvalidSequence Code = 3 - Unauthorized Code = 4 - InsufficientFunds Code = 5 - UnknownRequest Code = 6 - InvalidAddress Code = 7 - InvalidPubkey Code = 8 - UnknownAddress Code = 9 - InvalidCoins Code = 10 - OutOfGas Code = 11 - MemoTooLarge Code = 12 - InsufficientFee Code = 13 - TooManySignatures Code = 14 - NoSignatures Code = 15 - ErrJsonMarshal Code = 16 - ErrJsonUnmarshal Code = 17 - InvalidRequest Code = 18 - TxInMempoolCache Code = 19 - MempoolIsFull Code = 20 - TxTooLarge Code = 21 - KeyNotFound Code = 22 - WrongPassword Code = 23 - InvalidSigner Code = 24 - InvalidGasAdjustment Code = 25 - InvalidHeight Code = 26 - InvalidVersion Code = 27 - InvalidChainID Code = 28 - InvalidType Code = 29 - TxTimeoutHeight Code = 30 - UnknownExtensionOptions Code = 31 - WrongSequence Code = 32 - PackAny Code = 33 - UnpackAny Code = 34 - Logic Code = 35 - Conflict Code = 36 - NotSupported Code = 37 - NotFound Code = 38 - IO Code = 39 - Panic Code = 111222 -) - -var ( - // errUnknown = register(RootCodespace, 111222, "unknown error") - errInvalid = register(RootCodespace, 999999, "sdk check error") - wrongSeqMsg = "account sequence mismatch, expected" -) - -func init() { - _ = register(RootCodespace, OK, "success") - _ = register(RootCodespace, Internal, "internal") - _ = register(RootCodespace, TxDecode, "tx parse error") - _ = register(RootCodespace, InvalidSequence, "invalid sequence") - _ = register(RootCodespace, Unauthorized, "unauthorized") - _ = register(RootCodespace, InsufficientFunds, "insufficient funds") - _ = register(RootCodespace, UnknownRequest, "unknown request") - _ = register(RootCodespace, InvalidAddress, "invalid address") - _ = register(RootCodespace, InvalidPubkey, "invalid pubkey") - _ = register(RootCodespace, UnknownAddress, "unknown address") - _ = register(RootCodespace, InvalidCoins, "invalid coins") - _ = register(RootCodespace, OutOfGas, "out of gas") - _ = register(RootCodespace, MemoTooLarge, "memo too large") - _ = register(RootCodespace, InsufficientFee, "insufficient fee") - _ = register(RootCodespace, TooManySignatures, "maximum number of signatures exceeded") - _ = register(RootCodespace, NoSignatures, "no signatures supplied") - _ = register(RootCodespace, ErrJsonMarshal, "failed to marshal JSON bytes") - _ = register(RootCodespace, ErrJsonUnmarshal, "failed to unmarshal JSON bytes") - _ = register(RootCodespace, InvalidRequest, "invalid request") - _ = register(RootCodespace, TxInMempoolCache, "tx already in mempool") - _ = register(RootCodespace, MempoolIsFull, "mempool is full") - _ = register(RootCodespace, TxTooLarge, "tx too large") - _ = register(RootCodespace, KeyNotFound, "key not found") - _ = register(RootCodespace, WrongPassword, "invalid account password") - _ = register(RootCodespace, InvalidSigner, "tx intended signer does not match the given signer") - _ = register(RootCodespace, InvalidGasAdjustment, "invalid gas adjustment") - _ = register(RootCodespace, InvalidHeight, "invalid height") - _ = register(RootCodespace, InvalidVersion, "invalid version") - _ = register(RootCodespace, InvalidChainID, "invalid chain-id") - _ = register(RootCodespace, InvalidType, "invalid type") - _ = register(RootCodespace, TxTimeoutHeight, "tx timeout height") - _ = register(RootCodespace, UnknownExtensionOptions, "unknown extension options") - _ = register(RootCodespace, WrongSequence, "incorrect account sequence") - _ = register(RootCodespace, PackAny, "failed packing protobuf message to Any") - _ = register(RootCodespace, UnpackAny, "failed unpacking protobuf message from Any") - _ = register(RootCodespace, Logic, "internal logic error") - _ = register(RootCodespace, Conflict, "conflict") - _ = register(RootCodespace, NotSupported, "feature not supported") - _ = register(RootCodespace, NotFound, "not found") - _ = register(RootCodespace, IO, "Internal IO error") - _ = register(RootCodespace, Panic, "panic") -} - -type Code uint32 - -// Error represents a root error. -// -// Weave framework is using root error to categorize issues. Each instance -// created during the runtime should wrap one of the declared root errors. This -// allows error tests and returning all errors to the client in a safe manner. -// -// All popular root errors are declared in this package. If an extension has to -// declare a custom root error, always use register function to ensure -// error code uniqueness. -type Error interface { - Error() string - Code() uint32 - Codespace() string -} - -// GetError is used to covert irita error to sdk error -func GetError(codespace string, code uint32, log ...string) Error { - errID := errorID(codespace, code) - err, ok := usedCodes[errID] - if !ok { - return Wrap(errors.New(strings.Join(log, ","))) - } - return err -} - -// Wrap extends given error with an additional information. -// -// If the wrapped error does not provide ABCICode method (ie. stdlib errors), -// it will be labeled as internal error. -// -// If err is nil, this returns nil, avoiding the need for an if statement when -// wrapping a error returned at the end of a function -func Wrap(err error) Error { - if err == nil { - return nil - } - - if strings.Contains(err.Error(), wrongSeqMsg) { - return sdkError{ - codespace: RootCodespace, - code: uint32(WrongSequence), - desc: err.Error(), - } - } - - return sdkError{ - codespace: errInvalid.Codespace(), - code: errInvalid.Code(), - desc: err.Error(), - } -} - -func WrapWithMessage(err error, format string, args ...interface{}) Error { - desc := fmt.Sprintf(format, args...) - return Wrap(errors.WithMessage(err, desc)) -} - -// Wrapf extends given error with an additional information. -// -// This function works like Wrap function with additional functionality of -// formatting the input as specified. -func Wrapf(format string, args ...interface{}) Error { - desc := fmt.Sprintf(format, args...) - return Wrap(errors.New(desc)) -} - -type sdkError struct { - codespace string - code uint32 - desc string -} - -func (e sdkError) Error() string { - return e.desc -} - -func (e sdkError) Code() uint32 { - return e.code -} - -func (e sdkError) Codespace() string { - return e.codespace -} - -// register returns an error instance that should be used as the base for -// creating error instances during runtime. -// -// Popular root errors are declared in this package, but extensions may want to -// declare custom codes. This function ensures that no error code is used -// twice. Attempt to reuse an error code results in panic. -// -// Use this function only during a program startup phase. -func register(codespace string, code Code, description string) Error { - err := sdkError{ - codespace: codespace, - code: uint32(code), - desc: description, - } - setUsed(err) - - return err -} - -// usedCodes is keeping track of used codes to ensure their uniqueness. No two -// error instances should share the same (codespace, code) tuple. -var usedCodes = map[string]Error{} - -func errorID(codespace string, code uint32) string { - return fmt.Sprintf("%s:%d", codespace, code) -} - -func setUsed(err Error) { - usedCodes[errorID(err.Codespace(), err.Code())] = err -} - -func CatchPanic(fn func(errMsg string)) { - if err := recover(); err != nil { - var msg string - switch e := err.(type) { - case error: - msg = e.Error() - case string: - msg = e - } - fn(msg) - } -} diff --git a/core-sdk/types/event.go b/core-sdk/types/event.go deleted file mode 100644 index 51fc0cff..00000000 --- a/core-sdk/types/event.go +++ /dev/null @@ -1,231 +0,0 @@ -package types - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "strings" -) - -type WSClient interface { - SubscribeNewBlock(builder *EventQueryBuilder, handler EventNewBlockHandler) (Subscription, Error) - SubscribeTx(builder *EventQueryBuilder, handler EventTxHandler) (Subscription, Error) - SubscribeNewBlockHeader(handler EventNewBlockHeaderHandler) (Subscription, Error) - SubscribeValidatorSetUpdates(handler EventValidatorSetUpdatesHandler) (Subscription, Error) - Unsubscribe(subscription Subscription) Error -} - -type TmClient interface { - ABCIClient - SignClient - WSClient - StatusClient - NetworkClient -} - -type EventKey string -type EventValue interface{} - -type Subscription struct { - Ctx context.Context `json:"-"` - Query string `json:"query"` - ID string `json:"id"` -} - -type EventHandler func(data EventData) - -// EventData for SubscribeAny -type EventData interface{} - -// EventDataTx for SubscribeTx -type EventDataTx struct { - Hash string `json:"hash"` - Height int64 `json:"height"` - Index uint32 `json:"index"` - Tx Tx `json:"tx"` - Result TxResult `json:"result"` -} - -func (tx EventDataTx) MarshalJson() []byte { - bz, _ := json.Marshal(tx) - return bz -} - -type TxResult struct { - Code uint32 `json:"code"` - Log string `json:"log"` - GasWanted int64 `json:"gas_wanted"` - GasUsed int64 `json:"gas_used"` - Events StringEvents `json:"events"` -} - -type Attributes []Attribute - -func (a Attributes) GetValues(key string) (values []string) { - for _, attr := range a { - if attr.Key == key { - values = append(values, attr.Value) - } - } - return -} - -func (a Attributes) GetValue(key string) string { - for _, attr := range a { - if attr.Key == key { - return attr.Value - } - } - return "" -} - -func (a Attributes) String() string { - var attrs = make([]string, len(a)) - for i, attr := range a { - attrs[i] = fmt.Sprintf("%s=%s", attr.Key, attr.Value) - } - return strings.Join(attrs, ",") -} - -type EventTxHandler func(EventDataTx) - -//EventDataNewBlock for SubscribeNewBlock -type EventDataNewBlock struct { - Block Block `json:"block"` - ResultBeginBlock ResultBeginBlock `json:"result_begin_block"` - ResultEndBlock ResultEndBlock `json:"result_end_block"` -} - -type ValidatorUpdate struct { - PubKey PubKey `json:"pub_key"` - Power int64 `json:"power"` -} - -type PubKey struct { - Type string `json:"type"` - Value string `json:"value"` -} - -type EventNewBlockHandler func(EventDataNewBlock) - -//EventDataNewBlockHeader for SubscribeNewBlockHeader -type EventDataNewBlockHeader struct { - Header Header `json:"header"` - - ResultBeginBlock ResultBeginBlock `json:"result_begin_block"` - ResultEndBlock ResultEndBlock `json:"result_end_block"` -} - -type EventNewBlockHeaderHandler func(EventDataNewBlockHeader) - -//EventDataValidatorSetUpdates for SubscribeValidatorSetUpdates -type Validator struct { - Bech32Address string `json:"bech32_address"` - Bech32PubKey string `json:"bech32_pubkey"` - Address string `json:"address"` - PubKey PubKey `json:"pub_key"` - VotingPower int64 `json:"voting_power"` - ProposerPriority int64 `json:"proposer_priority"` -} -type EventDataValidatorSetUpdates struct { - ValidatorUpdates []Validator `json:"validator_updates"` -} - -type EventValidatorSetUpdatesHandler func(EventDataValidatorSetUpdates) - -//EventQueryBuilder for build query string -type condition struct { - key EventKey - value EventValue - op string -} - -// Cond return a condition object with a key -func Cond(key EventKey) *condition { - return &condition{ - key: key, - } -} - -// NewCond return a condition object with a complete event type and attrKey -func NewCond(typ, attrKey string) *condition { - return &condition{ - key: EventKey(fmt.Sprintf("%s.%s", typ, attrKey)), - } -} - -func (c *condition) LTE(v EventValue) *condition { - return c.fill(v, "<=") -} - -func (c *condition) GTE(v EventValue) *condition { - return c.fill(v, ">=") -} - -func (c *condition) LE(v EventValue) *condition { - return c.fill(v, "<") -} - -func (c *condition) GE(v EventValue) *condition { - return c.fill(v, ">") -} - -func (c *condition) EQ(v EventValue) *condition { - return c.fill(v, "=") -} - -//func (c *condition) Contains(v EventValue) *condition { -// return c.fill(v, "CONTAINS") -//} - -func (c *condition) fill(v EventValue, op string) *condition { - c.value = v - c.op = op - return c -} - -func (c *condition) String() string { - if len(c.key) == 0 || len(c.op) == 0 { - return "" - } - - switch c.value.(type) { - case int64, uint64: - return fmt.Sprintf("%s%s%d", c.key, c.op, c.value) - default: - return fmt.Sprintf("%s%s'%s'", c.key, c.op, c.value) - } -} - -//EventQueryBuilder is responsible for constructing listening conditions -type EventQueryBuilder struct { - conditions []string -} - -func NewEventQueryBuilder() *EventQueryBuilder { - return &EventQueryBuilder{ - conditions: []string{}, - } -} - -//AddCondition is responsible for adding listening conditions -func (eqb *EventQueryBuilder) AddCondition(c *condition) *EventQueryBuilder { - if c == nil { - return nil - } - eqb.conditions = append(eqb.conditions, c.String()) - return eqb -} - -//Build is responsible for constructing the listening condition into a listening instruction identified by tendermint -func (eqb *EventQueryBuilder) Build() string { - var buf bytes.Buffer - for _, condition := range eqb.conditions { - if buf.Len() > 0 { - buf.WriteString(" AND ") - } - buf.WriteString(condition) - } - return buf.String() -} diff --git a/core-sdk/types/events.go b/core-sdk/types/events.go deleted file mode 100644 index 7f5508df..00000000 --- a/core-sdk/types/events.go +++ /dev/null @@ -1,234 +0,0 @@ -package types - -import ( - "fmt" - "sort" - "strings" - - abci "github.com/tendermint/tendermint/abci/types" -) - -// ---------------------------------------------------------------------------- -// Event Manager -// ---------------------------------------------------------------------------- - -// EventManager implements a simple wrapper around a slice of Event objects that -// can be emitted from. -type EventManager struct { - events Events -} - -func NewEventManager() *EventManager { - return &EventManager{EmptyEvents()} -} - -func (em *EventManager) Events() Events { return em.events } - -// EmitEvent stores a single Event object. -func (em *EventManager) EmitEvent(event Event) { - em.events = em.events.AppendEvent(event) -} - -// EmitEvents stores a series of Event objects. -func (em *EventManager) EmitEvents(events Events) { - em.events = em.events.AppendEvents(events) -} - -// ABCIEvents returns all stored Event objects as abci.Event objects. -func (em EventManager) ABCIEvents() []abci.Event { - return em.events.ToABCIEvents() -} - -// ---------------------------------------------------------------------------- -// Events -// ---------------------------------------------------------------------------- - -type ( - // Event is a type alias for an ABCI Event - Event abci.Event - - // Events defines a slice of Event objects - Events []Event -) - -// NewEvent creates a new Event object with a given type and slice of one or more -// attributes. -func NewEvent(ty string, attrs ...Attribute) Event { - e := Event{Type: ty} - - for _, attr := range attrs { - e.Attributes = append(e.Attributes, attr.ToKVPair()) - } - - return e -} - -// NewAttribute returns a new key/value Attribute object. -func NewAttribute(k, v string) Attribute { - return Attribute{k, v} -} - -// EmptyEvents returns an empty slice of events. -func EmptyEvents() Events { - return make(Events, 0) -} - -func (a Attribute) String() string { - return fmt.Sprintf("%s: %s", a.Key, a.Value) -} - -// ToKVPair converts an Attribute object into a Tendermint key/value pair. -func (a Attribute) ToKVPair() abci.EventAttribute { - return abci.EventAttribute{Key: toBytes(a.Key), Value: toBytes(a.Value)} -} - -// AppendAttributes adds one or more attributes to an Event. -func (e Event) AppendAttributes(attrs ...Attribute) Event { - for _, attr := range attrs { - e.Attributes = append(e.Attributes, attr.ToKVPair()) - } - return e -} - -// AppendEvent adds an Event to a slice of events. -func (e Events) AppendEvent(event Event) Events { - return append(e, event) -} - -// AppendEvents adds a slice of Event objects to an exist slice of Event objects. -func (e Events) AppendEvents(events Events) Events { - return append(e, events...) -} - -// ToABCIEvents converts a slice of Event objects to a slice of abci.Event -// objects. -func (e Events) ToABCIEvents() []abci.Event { - res := make([]abci.Event, len(e)) - for i, ev := range e { - res[i] = abci.Event{Type: ev.Type, Attributes: ev.Attributes} - } - - return res -} - -func toBytes(i interface{}) []byte { - switch x := i.(type) { - case []uint8: - return x - case string: - return []byte(x) - default: - panic(i) - } -} - -// Common event types and attribute keys -var ( - TypeKey EventKey = "tm.event" - - EventTypeMessage = "message" - EventTypeCreateContext = "create_context" - EventTypeResponseService = "respond_service" - EventTypeSubmitProposal = "submit_proposal" - - AttributeKeyAction = "action" - AttributeKeyModule = "module" - AttributeKeySender = "sender" - AttributeKeyAmount = "amount" - - TxValue EventValue = "Tx" -) - -type ( - // StringAttributes defines a slice of StringEvents objects. - StringEvents []StringEvent -) - -func (se StringEvents) String() string { - var sb strings.Builder - - for _, e := range se { - sb.WriteString(fmt.Sprintf("\t\t- %s\n", e.Type)) - - for _, attr := range e.Attributes { - sb.WriteString(fmt.Sprintf("\t\t\t- %s\n", attr.String())) - } - } - - return strings.TrimRight(sb.String(), "\n") -} - -// Flatten returns a flattened version of StringEvents by grouping all attributes -// per unique event type. -func (se StringEvents) Flatten() StringEvents { - flatEvents := make(map[string][]Attribute) - - for _, e := range se { - flatEvents[e.Type] = append(flatEvents[e.Type], e.Attributes...) - } - keys := make([]string, 0, len(flatEvents)) - res := make(StringEvents, 0, len(flatEvents)) // appeneded to keys, same length of what is allocated to keys - - for ty := range flatEvents { - keys = append(keys, ty) - } - - sort.Strings(keys) - for _, ty := range keys { - res = append(res, StringEvent{Type: ty, Attributes: flatEvents[ty]}) - } - - return res -} - -// StringifyEvent converts an Event object to a StringEvent object. -func StringifyEvent(e abci.Event) StringEvent { - res := StringEvent{Type: e.Type} - - for _, attr := range e.Attributes { - res.Attributes = append( - res.Attributes, - Attribute{string(attr.Key), string(attr.Value)}, - ) - } - - return res -} - -// StringifyEvents converts a slice of Event objects into a slice of StringEvent -// objects. -func StringifyEvents(events []abci.Event) StringEvents { - res := make(StringEvents, 0, len(events)) - - for _, e := range events { - res = append(res, StringifyEvent(e)) - } - - return res.Flatten() -} - -func (se StringEvents) GetValue(typ, key string) (string, error) { - for _, e := range se { - if e.Type == typ { - for _, attr := range e.Attributes { - if attr.Key == key { - return attr.Value, nil - } - } - } - } - return "", fmt.Errorf("not found type:%s key:%s", typ, key) -} - -func (se StringEvents) GetValues(typ, key string) (res []string) { - for _, e := range se { - if e.Type == typ { - for _, attr := range e.Attributes { - if attr.Key == key { - res = append(res, attr.Value) - } - } - } - } - return res -} diff --git a/core-sdk/types/factory.go b/core-sdk/types/factory.go deleted file mode 100644 index 77210f39..00000000 --- a/core-sdk/types/factory.go +++ /dev/null @@ -1,299 +0,0 @@ -package types - -import ( - "errors" - "fmt" - - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// Factory defines a client transaction factory that facilitates generating and -// signing an application-specific transaction. -type ( - // Factory implements a transaction context created in SDK modules. - Factory struct { - address string - chainID string - memo string - password string - accountNumber uint64 - sequence uint64 - gas uint64 - gasAdjustment float64 - simulateAndExecute bool - fees Coins - gasPrices DecCoins - mode BroadcastMode - signMode signing.SignMode - signModeHandler SignModeHandler - keyManager KeyManager - txConfig TxConfig - queryFunc QueryWithData - } - - // QueryWithData implements a query method from cschain. - QueryWithData func(string, []byte) ([]byte, int64, error) -) - -// NewFactory return a point of the instance of Factory. -func NewFactory() *Factory { - return &Factory{} -} - -// ChainID returns the chainID of the current chain. -func (f *Factory) ChainID() string { return f.chainID } - -// Gas returns the gas of the transaction. -func (f *Factory) Gas() uint64 { return f.gas } - -// GasAdjustment returns the gasAdjustment. -func (f Factory) GasAdjustment() float64 { return f.gasAdjustment } - -// Fees returns the fee of the transaction. -func (f *Factory) Fees() Coins { return f.fees } - -// Sequence returns the sequence of the account. -func (f *Factory) Sequence() uint64 { return f.sequence } - -// Memo returns memo. -func (f *Factory) Memo() string { return f.memo } - -// AccountNumber returns accountNumber. -func (f *Factory) AccountNumber() uint64 { return f.accountNumber } - -// KeyManager returns keyManager. -func (f *Factory) KeyManager() KeyManager { return f.keyManager } - -// Mode returns mode. -func (f *Factory) Mode() BroadcastMode { return f.mode } - -// SimulateAndExecute returns the option to simulateAndExecute and then execute the transaction -// using the gas from the simulation results -func (f *Factory) SimulateAndExecute() bool { return f.simulateAndExecute } - -// Password returns password. -func (f *Factory) Password() string { return f.password } - -// Address returns the address. -func (f *Factory) Address() string { return f.address } - -// WithChainID returns a pointer of the context with an updated ChainID. -func (f *Factory) WithChainID(chainID string) *Factory { - f.chainID = chainID - return f -} - -// WithGas returns a pointer of the context with an updated Gas. -func (f *Factory) WithGas(gas uint64) *Factory { - f.gas = gas - return f -} - -// WithGasAdjustment returns a pointer of the context with an updated gasAdjustment. -func (f *Factory) WithGasAdjustment(gasAdjustment float64) *Factory { - f.gasAdjustment = gasAdjustment - return f -} - -// WithFee returns a pointer of the context with an updated Fee. -func (f *Factory) WithFee(fee Coins) *Factory { - f.fees = fee - return f -} - -// WithSequence returns a pointer of the context with an updated sequence number. -func (f *Factory) WithSequence(sequence uint64) *Factory { - f.sequence = sequence - return f -} - -// WithMemo returns a pointer of the context with an updated memo. -func (f *Factory) WithMemo(memo string) *Factory { - f.memo = memo - return f -} - -// WithAccountNumber returns a pointer of the context with an account number. -func (f *Factory) WithAccountNumber(accnum uint64) *Factory { - f.accountNumber = accnum - return f -} - -// WithKeyManager returns a pointer of the context with a KeyManager. -func (f *Factory) WithKeyManager(keyManager KeyManager) *Factory { - f.keyManager = keyManager - return f -} - -// WithMode returns a pointer of the context with a Mode. -func (f *Factory) WithMode(mode BroadcastMode) *Factory { - f.mode = mode - return f -} - -// WithSimulateAndExecute returns a pointer of the context with a simulateAndExecute. -func (f *Factory) WithSimulateAndExecute(simulate bool) *Factory { - f.simulateAndExecute = simulate - return f -} - -// WithPassword returns a pointer of the context with a password. -func (f *Factory) WithPassword(password string) *Factory { - f.password = password - return f -} - -// WithAddress returns a pointer of the context with a password. -func (f *Factory) WithAddress(address string) *Factory { - f.address = address - return f -} - -// WithTxConfig returns a pointer of the context with an TxConfig -func (f *Factory) WithTxConfig(txConfig TxConfig) *Factory { - f.txConfig = txConfig - return f -} - -// WithSignModeHandler returns a pointer of the context with an signModeHandler. -func (f *Factory) WithSignModeHandler(signModeHandler SignModeHandler) *Factory { - f.signModeHandler = signModeHandler - return f -} - -// WithQueryFunc returns a pointer of the context with an queryFunc. -func (f *Factory) WithQueryFunc(queryFunc QueryWithData) *Factory { - f.queryFunc = queryFunc - return f -} - -func (f *Factory) BuildAndSign(name string, msgs []Msg, json bool) ([]byte, error) { - tx, err := f.BuildUnsignedTx(msgs) - if err != nil { - return nil, err - } - - if err = f.Sign(name, tx); err != nil { - return nil, err - } - - if json { - txBytes, err := f.txConfig.TxJSONEncoder()(tx.GetTx()) - if err != nil { - return nil, err - } - return txBytes, nil - } - - txBytes, err := f.txConfig.TxEncoder()(tx.GetTx()) - if err != nil { - return nil, err - } - - return txBytes, nil -} - -func (f *Factory) BuildUnsignedTx(msgs []Msg) (TxBuilder, error) { - if f.chainID == "" { - return nil, fmt.Errorf("chain ID required but not specified") - } - - fees := f.fees - - if !f.gasPrices.IsZero() { - if !fees.IsZero() { - return nil, errors.New("cannot provide both fees and gas prices") - } - - glDec := NewDec(int64(f.gas)) - - // Derive the fees based on the provided gas prices, where - // fee = ceil(gasPrice * gasLimit). - fees = make(Coins, len(f.gasPrices)) - - for i, gp := range f.gasPrices { - fee := gp.Amount.Mul(glDec) - fees[i] = NewCoin(gp.Denom, fee.Ceil().RoundInt()) - } - } - - tx := f.txConfig.NewTxBuilder() - - if err := tx.SetMsgs(msgs...); err != nil { - return nil, err - } - - tx.SetMemo(f.memo) - tx.SetFeeAmount(fees) - tx.SetGasLimit(f.gas) - //f.txBuilder.SetTimeoutHeight(f.TimeoutHeight()) - - return tx, nil -} - -// Sign signs a transaction given a name, passphrase, and a single message to -// signed. An error is returned if signing fails. -func (f *Factory) Sign(name string, txBuilder TxBuilder) error { - signMode := f.signMode - if signMode == signing.SignMode_SIGN_MODE_UNSPECIFIED { - // use the SignModeHandler's default mode if unspecified - signMode = f.txConfig.SignModeHandler().DefaultMode() - } - signerData := SignerData{ - ChainID: f.chainID, - AccountNumber: f.accountNumber, - Sequence: f.sequence, - } - - pubkey, _, err := f.keyManager.Find(name, f.password) - if err != nil { - return err - } - - // For SIGN_MODE_DIRECT, calling SetSignatures calls setSignerInfos on - // Factory under the hood, and SignerInfos is needed to generated the - // sign bytes. This is the reason for setting SetSignatures here, with a - // nil signature. - // - // Note: this line is not needed for SIGN_MODE_LEGACY_AMINO, but putting it - // also doesn't affect its generated sign bytes, so for code's simplicity - // sake, we put it here. - sigData := signing.SingleSignatureData{ - SignMode: signMode, - Signature: nil, - } - sig := signing.SignatureV2{ - PubKey: pubkey, - Data: &sigData, - Sequence: f.Sequence(), - } - if err := txBuilder.SetSignatures(sig); err != nil { - return err - } - - // Generate the bytes to be signed. - signBytes, err := f.signModeHandler.GetSignBytes(signMode, signerData, txBuilder.GetTx()) - if err != nil { - return err - } - - // Sign those bytes - sigBytes, _, err := f.keyManager.Sign(name, f.password, signBytes) - if err != nil { - return err - } - - // Construct the SignatureV2 struct - sigData = signing.SingleSignatureData{ - SignMode: signMode, - Signature: sigBytes, - } - sig = signing.SignatureV2{ - PubKey: pubkey, - Data: &sigData, - Sequence: f.Sequence(), - } - - // And here the tx is populated with the signature - return txBuilder.SetSignatures(sig) -} diff --git a/core-sdk/types/handler_map.go b/core-sdk/types/handler_map.go deleted file mode 100644 index cea08084..00000000 --- a/core-sdk/types/handler_map.go +++ /dev/null @@ -1,58 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// SignModeHandlerMap is SignModeHandler that aggregates multiple SignModeHandler's into -// a single handler -type SignModeHandlerMap struct { - defaultMode signing.SignMode - modes []signing.SignMode - signModeHandlers map[signing.SignMode]SignModeHandler -} - -var _ SignModeHandler = SignModeHandlerMap{} - -// NewSignModeHandlerMap returns a new SignModeHandlerMap with the provided defaultMode and handlers -func NewSignModeHandlerMap(defaultMode signing.SignMode, handlers []SignModeHandler) SignModeHandlerMap { - handlerMap := make(map[signing.SignMode]SignModeHandler) - var modes []signing.SignMode - - for _, h := range handlers { - for _, m := range h.Modes() { - if _, have := handlerMap[m]; have { - panic(fmt.Errorf("duplicate sign mode handler for mode %s", m)) - } - handlerMap[m] = h - modes = append(modes, m) - } - } - - return SignModeHandlerMap{ - defaultMode: defaultMode, - modes: modes, - signModeHandlers: handlerMap, - } -} - -// DefaultMode implements SignModeHandler.DefaultMode -func (h SignModeHandlerMap) DefaultMode() signing.SignMode { - return h.defaultMode -} - -// Modes implements SignModeHandler.Modes -func (h SignModeHandlerMap) Modes() []signing.SignMode { - return h.modes -} - -// DefaultMode implements SignModeHandler.GetSignBytes -func (h SignModeHandlerMap) GetSignBytes(mode signing.SignMode, data SignerData, tx Tx) ([]byte, error) { - handler, found := h.signModeHandlers[mode] - if !found { - return nil, fmt.Errorf("can't verify sign mode %s", mode.String()) - } - return handler.GetSignBytes(mode, data, tx) -} diff --git a/core-sdk/types/int.go b/core-sdk/types/int.go deleted file mode 100644 index bf1a0f55..00000000 --- a/core-sdk/types/int.go +++ /dev/null @@ -1,429 +0,0 @@ -package types - -import ( - "encoding" - "encoding/json" - "fmt" - "testing" - - "math/big" -) - -const maxBitLen = 255 - -func newIntegerFromString(s string) (*big.Int, bool) { - return new(big.Int).SetString(s, 0) -} - -func equal(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == 0 } - -func gt(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == 1 } - -func gte(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) >= 0 } - -func lt(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) == -1 } - -func lte(i *big.Int, i2 *big.Int) bool { return i.Cmp(i2) <= 0 } - -func add(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Add(i, i2) } - -func sub(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Sub(i, i2) } - -func mul(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Mul(i, i2) } - -func div(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Quo(i, i2) } - -func mod(i *big.Int, i2 *big.Int) *big.Int { return new(big.Int).Mod(i, i2) } - -func neg(i *big.Int) *big.Int { return new(big.Int).Neg(i) } - -func min(i *big.Int, i2 *big.Int) *big.Int { - if i.Cmp(i2) == 1 { - return new(big.Int).Set(i2) - } - - return new(big.Int).Set(i) -} - -func max(i *big.Int, i2 *big.Int) *big.Int { - if i.Cmp(i2) == -1 { - return new(big.Int).Set(i2) - } - - return new(big.Int).Set(i) -} - -func unmarshalText(i *big.Int, text string) error { - if err := i.UnmarshalText([]byte(text)); err != nil { - return err - } - - if i.BitLen() > maxBitLen { - return fmt.Errorf("integer out of range: %s", text) - } - - return nil -} - -// Int wraps integer with 256 bit range bound -// Checks overflow, underflow and division by zero -// Exists in range from -(2^maxBitLen-1) to 2^maxBitLen-1 -type Int struct { - i *big.Int -} - -// BigInt converts Int to big.Int -func (i Int) BigInt() *big.Int { - if i.IsNil() { - return nil - } - return new(big.Int).Set(i.i) -} - -// IsNil returns true if Int is uninitialized -func (i Int) IsNil() bool { - return i.i == nil -} - -// NewInt constructs Int from int64 -func NewInt(n int64) Int { - return Int{big.NewInt(n)} -} - -// NewIntFromUint64 constructs an Int from a uint64. -func NewIntFromUint64(n uint64) Int { - b := big.NewInt(0) - b.SetUint64(n) - return Int{b} -} - -// NewIntFromBigInt constructs Int from big.Int -func NewIntFromBigInt(i *big.Int) Int { - if i.BitLen() > maxBitLen { - panic("NewIntFromBigInt() out of bound") - } - return Int{i} -} - -// NewIntFromString constructs Int from string -func NewIntFromString(s string) (res Int, ok bool) { - i, ok := newIntegerFromString(s) - if !ok { - return - } - // Check overflow - if i.BitLen() > maxBitLen { - ok = false - return - } - return Int{i}, true -} - -// NewIntWithDecimal constructs Int with decimal -// Result value is n*10^dec -func NewIntWithDecimal(n int64, dec int) Int { - if dec < 0 { - panic("NewIntWithDecimal() decimal is negative") - } - exp := new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(dec)), nil) - i := new(big.Int) - i.Mul(big.NewInt(n), exp) - - // Check overflow - if i.BitLen() > maxBitLen { - panic("NewIntWithDecimal() out of bound") - } - return Int{i} -} - -// ZeroInt returns Int value with zero -func ZeroInt() Int { return Int{big.NewInt(0)} } - -// OneInt returns Int value with one -func OneInt() Int { return Int{big.NewInt(1)} } - -// ToDec converts Int to Dec -func (i Int) ToDec() Dec { - return NewDecFromInt(i) -} - -// Int64 converts Int to int64 -// Panics if the value is out of range -func (i Int) Int64() int64 { - if !i.i.IsInt64() { - panic("Int64() out of bound") - } - return i.i.Int64() -} - -// IsInt64 returns true if Int64() not panics -func (i Int) IsInt64() bool { - return i.i.IsInt64() -} - -// Uint64 converts Int to uint64 -// Panics if the value is out of range -func (i Int) Uint64() uint64 { - if !i.i.IsUint64() { - panic("Uint64() out of bounds") - } - return i.i.Uint64() -} - -// IsUint64 returns true if Uint64() not panics -func (i Int) IsUint64() bool { - return i.i.IsUint64() -} - -// IsZero returns true if Int is zero -func (i Int) IsZero() bool { - return i.i.Sign() == 0 -} - -// IsNegative returns true if Int is negative -func (i Int) IsNegative() bool { - return i.i.Sign() == -1 -} - -// IsPositive returns true if Int is positive -func (i Int) IsPositive() bool { - return i.i.Sign() == 1 -} - -// Sign returns sign of Int -func (i Int) Sign() int { - return i.i.Sign() -} - -// Equal compares two Ints -func (i Int) Equal(i2 Int) bool { - return equal(i.i, i2.i) -} - -// GT returns true if first Int is greater than second -func (i Int) GT(i2 Int) bool { - return gt(i.i, i2.i) -} - -// GTE returns true if receiver Int is greater than or equal to the parameter -// Int. -func (i Int) GTE(i2 Int) bool { - return gte(i.i, i2.i) -} - -// LT returns true if first Int is lesser than second -func (i Int) LT(i2 Int) bool { - return lt(i.i, i2.i) -} - -// LTE returns true if first Int is less than or equal to second -func (i Int) LTE(i2 Int) bool { - return lte(i.i, i2.i) -} - -// Add adds Int from another -func (i Int) Add(i2 Int) (res Int) { - res = Int{add(i.i, i2.i)} - // Check overflow - if res.i.BitLen() > maxBitLen { - panic("Int overflow") - } - return -} - -// AddRaw adds int64 to Int -func (i Int) AddRaw(i2 int64) Int { - return i.Add(NewInt(i2)) -} - -// Sub subtracts Int from another -func (i Int) Sub(i2 Int) (res Int) { - res = Int{sub(i.i, i2.i)} - // Check overflow - if res.i.BitLen() > maxBitLen { - panic("Int overflow") - } - return -} - -// SubRaw subtracts int64 from Int -func (i Int) SubRaw(i2 int64) Int { - return i.Sub(NewInt(i2)) -} - -// Mul multiples two Ints -func (i Int) Mul(i2 Int) (res Int) { - // Check overflow - if i.i.BitLen()+i2.i.BitLen()-1 > maxBitLen { - panic("Int overflow") - } - res = Int{mul(i.i, i2.i)} - // Check overflow if sign of both are same - if res.i.BitLen() > maxBitLen { - panic("Int overflow") - } - return -} - -// MulRaw multipies Int and int64 -func (i Int) MulRaw(i2 int64) Int { - return i.Mul(NewInt(i2)) -} - -// Quo divides Int with Int -func (i Int) Quo(i2 Int) (res Int) { - // Check division-by-zero - if i2.i.Sign() == 0 { - panic("Division by zero") - } - return Int{div(i.i, i2.i)} -} - -// QuoRaw divides Int with int64 -func (i Int) QuoRaw(i2 int64) Int { - return i.Quo(NewInt(i2)) -} - -// Mod returns remainder after dividing with Int -func (i Int) Mod(i2 Int) Int { - if i2.Sign() == 0 { - panic("division-by-zero") - } - return Int{mod(i.i, i2.i)} -} - -// ModRaw returns remainder after dividing with int64 -func (i Int) ModRaw(i2 int64) Int { - return i.Mod(NewInt(i2)) -} - -// Neg negates Int -func (i Int) Neg() (res Int) { - return Int{neg(i.i)} -} - -// return the minimum of the ints -func MinInt(i1, i2 Int) Int { - return Int{min(i1.BigInt(), i2.BigInt())} -} - -// MaxInt returns the maximum between two integers. -func MaxInt(i, i2 Int) Int { - return Int{max(i.BigInt(), i2.BigInt())} -} - -// Human readable string -func (i Int) String() string { - return i.i.String() -} - -// MarshalJSON defines custom encoding scheme -func (i Int) MarshalJSON() ([]byte, error) { - if i.i == nil { // Necessary since default Uint initialization has i.i as nil - i.i = new(big.Int) - } - return marshalJSON(i.i) -} - -// UnmarshalJSON defines custom decoding scheme -func (i *Int) UnmarshalJSON(bz []byte) error { - if i.i == nil { // Necessary since default Int initialization has i.i as nil - i.i = new(big.Int) - } - return unmarshalJSON(i.i, bz) -} - -// MarshalJSON for custom encoding scheme -// Must be encoded as a string for JSON precision -func marshalJSON(i encoding.TextMarshaler) ([]byte, error) { - text, err := i.MarshalText() - if err != nil { - return nil, err - } - - return json.Marshal(string(text)) -} - -// UnmarshalJSON for custom decoding scheme -// Must be encoded as a string for JSON precision -func unmarshalJSON(i *big.Int, bz []byte) error { - var text string - if err := json.Unmarshal(bz, &text); err != nil { - return err - } - - return unmarshalText(i, text) -} - -// MarshalYAML returns the YAML representation. -func (i Int) MarshalYAML() (interface{}, error) { - return i.String(), nil -} - -// Marshal implements the gogo proto custom type interface. -func (i Int) Marshal() ([]byte, error) { - if i.i == nil { - i.i = new(big.Int) - } - return i.i.MarshalText() -} - -// MarshalTo implements the gogo proto custom type interface. -func (i *Int) MarshalTo(data []byte) (n int, err error) { - if i.i == nil { - i.i = new(big.Int) - } - if len(i.i.Bytes()) == 0 { - copy(data, []byte{0x30}) - return 1, nil - } - - bz, err := i.Marshal() - if err != nil { - return 0, err - } - - copy(data, bz) - return len(bz), nil -} - -// Unmarshal implements the gogo proto custom type interface. -func (i *Int) Unmarshal(data []byte) error { - if len(data) == 0 { - i = nil - return nil - } - - if i.i == nil { - i.i = new(big.Int) - } - - if err := i.i.UnmarshalText(data); err != nil { - return err - } - - if i.i.BitLen() > maxBitLen { - return fmt.Errorf("integer out of range; got: %d, max: %d", i.i.BitLen(), maxBitLen) - } - - return nil -} - -// Size implements the gogo proto custom type interface. -func (i *Int) Size() int { - bz, _ := i.Marshal() - return len(bz) -} - -// Override Amino binary serialization by proxying to protobuf. -func (i Int) MarshalAmino() ([]byte, error) { return i.Marshal() } -func (i *Int) UnmarshalAmino(bz []byte) error { return i.Unmarshal(bz) } - -// intended to be used with require/assert: require.True(IntEq(...)) -func IntEq(t *testing.T, exp, got Int) (*testing.T, bool, string, string, string) { - return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() -} - -func (ip IntProto) String() string { - return ip.Int.String() -} diff --git a/core-sdk/types/kv/kv.pb.go b/core-sdk/types/kv/kv.pb.go deleted file mode 100644 index fe70f525..00000000 --- a/core-sdk/types/kv/kv.pb.go +++ /dev/null @@ -1,558 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/kv/v1beta1/kv.proto - -package kv - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/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 - -// Pairs defines a repeated slice of Pair objects. -type Pairs struct { - Pairs []Pair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"` -} - -func (m *Pairs) Reset() { *m = Pairs{} } -func (m *Pairs) String() string { return proto.CompactTextString(m) } -func (*Pairs) ProtoMessage() {} -func (*Pairs) Descriptor() ([]byte, []int) { - return fileDescriptor_a44e87fe7182bb73, []int{0} -} -func (m *Pairs) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pairs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pairs.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 *Pairs) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pairs.Merge(m, src) -} -func (m *Pairs) XXX_Size() int { - return m.Size() -} -func (m *Pairs) XXX_DiscardUnknown() { - xxx_messageInfo_Pairs.DiscardUnknown(m) -} - -var xxx_messageInfo_Pairs proto.InternalMessageInfo - -func (m *Pairs) GetPairs() []Pair { - if m != nil { - return m.Pairs - } - return nil -} - -// Pair defines a key/value bytes tuple. -type Pair struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (m *Pair) Reset() { *m = Pair{} } -func (m *Pair) String() string { return proto.CompactTextString(m) } -func (*Pair) ProtoMessage() {} -func (*Pair) Descriptor() ([]byte, []int) { - return fileDescriptor_a44e87fe7182bb73, []int{1} -} -func (m *Pair) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pair.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 *Pair) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pair.Merge(m, src) -} -func (m *Pair) XXX_Size() int { - return m.Size() -} -func (m *Pair) XXX_DiscardUnknown() { - xxx_messageInfo_Pair.DiscardUnknown(m) -} - -var xxx_messageInfo_Pair proto.InternalMessageInfo - -func (m *Pair) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *Pair) GetValue() []byte { - if m != nil { - return m.Value - } - return nil -} - -func init() { - proto.RegisterType((*Pairs)(nil), "cosmos.base.kv.v1beta1.Pairs") - proto.RegisterType((*Pair)(nil), "cosmos.base.kv.v1beta1.Pair") -} - -func init() { proto.RegisterFile("cosmos/base/kv/v1beta1/kv.proto", fileDescriptor_a44e87fe7182bb73) } - -var fileDescriptor_a44e87fe7182bb73 = []byte{ - // 232 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0x2f, 0xce, - 0xcd, 0x2f, 0xd6, 0x4f, 0x4a, 0x2c, 0x4e, 0xd5, 0xcf, 0x2e, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, - 0x49, 0x34, 0xd4, 0xcf, 0x2e, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0x28, 0xd0, - 0x03, 0x29, 0xd0, 0xcb, 0x2e, 0xd3, 0x83, 0x2a, 0x90, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, - 0xd1, 0x07, 0xb1, 0x20, 0xaa, 0x95, 0x1c, 0xb9, 0x58, 0x03, 0x12, 0x33, 0x8b, 0x8a, 0x85, 0x2c, - 0xb8, 0x58, 0x0b, 0x40, 0x0c, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x19, 0x3d, 0xec, 0xc6, - 0xe8, 0x81, 0x54, 0x3b, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0xd1, 0xa0, 0xa4, 0xc7, 0xc5, - 0x02, 0x12, 0x14, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, - 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, 0x10, - 0x8e, 0x93, 0xcb, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa5, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x67, 0x16, 0x65, 0x16, 0xe7, 0xa5, 0x96, - 0x80, 0xe9, 0x8c, 0xd2, 0x24, 0xdd, 0xe2, 0x94, 0x6c, 0xdd, 0xf4, 0x7c, 0xfd, 0x92, 0xca, 0x82, - 0xd4, 0x62, 0xfd, 0xec, 0xb2, 0x24, 0x36, 0xb0, 0xfb, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, - 0xfa, 0x0d, 0xdf, 0x2c, 0x10, 0x01, 0x00, 0x00, -} - -func (m *Pairs) 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 *Pairs) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pairs) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Pairs) > 0 { - for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintKv(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Pair) 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 *Pair) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Pair) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Value) > 0 { - i -= len(m.Value) - copy(dAtA[i:], m.Value) - i = encodeVarintKv(dAtA, i, uint64(len(m.Value))) - i-- - dAtA[i] = 0x12 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintKv(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintKv(dAtA []byte, offset int, v uint64) int { - offset -= sovKv(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Pairs) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Pairs) > 0 { - for _, e := range m.Pairs { - l = e.Size() - n += 1 + l + sovKv(uint64(l)) - } - } - return n -} - -func (m *Pair) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovKv(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovKv(uint64(l)) - } - return n -} - -func sovKv(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozKv(x uint64) (n int) { - return sovKv(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Pairs) 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 ErrIntOverflowKv - } - 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: Pairs: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pairs: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pairs = append(m.Pairs, Pair{}) - if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKv(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKv - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Pair) 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 ErrIntOverflowKv - } - 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: Pair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowKv - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthKv - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthKv - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], dAtA[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipKv(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthKv - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipKv(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, ErrIntOverflowKv - } - 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, ErrIntOverflowKv - } - 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, ErrIntOverflowKv - } - 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, ErrInvalidLengthKv - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupKv - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthKv - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthKv = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowKv = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupKv = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/types/module.go b/core-sdk/types/module.go deleted file mode 100644 index 7015eca6..00000000 --- a/core-sdk/types/module.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -import ( - "github.com/tendermint/tendermint/crypto" - - codectypes "github.com/irisnet/core-sdk-go/common/codec/types" -) - -//The purpose of this interface is to convert the irishub system type to the user receiving type -// and standardize the user interface -type Response interface { - Convert() interface{} -} - -type SplitAble interface { - Len() int - Sub(begin, end int) SplitAble -} - -type Module interface { - RegisterInterfaceTypes(registry codectypes.InterfaceRegistry) -} - -type KeyManager interface { - Sign(name, password string, data []byte) ([]byte, crypto.PubKey, error) - Insert(name, password string) (string, string, error) - Recover(name, password, mnemonic, hdPath string) (string, error) - Import(name, password string, privKeyArmor string) (address string, err error) - Export(name, password string) (privKeyArmor string, err error) - Delete(name, password string) error - Find(name, password string) (crypto.PubKey, AccAddress, error) - Add(name, password string) (address string, mnemonic string, err Error) -} diff --git a/core-sdk/types/proof.go b/core-sdk/types/proof.go deleted file mode 100644 index 102c8017..00000000 --- a/core-sdk/types/proof.go +++ /dev/null @@ -1,13 +0,0 @@ -package types - -import "github.com/tendermint/tendermint/proto/tendermint/crypto" - -type ProofValue struct { - Proof []byte `json:"proof"` - Path []string `json:"path"` - Value []byte `json:"value"` -} - -type MerkleProof struct { - Proof *crypto.ProofOps `json:"proof"` -} diff --git a/core-sdk/types/query/pagination.pb.go b/core-sdk/types/query/pagination.pb.go deleted file mode 100644 index 8fee17e2..00000000 --- a/core-sdk/types/query/pagination.pb.go +++ /dev/null @@ -1,674 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/base/query/v1beta1/pagination.proto - -package query - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/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 - -// PageRequest is to be embedded in gRPC request messages for efficient -// pagination. Ex: -// -// message SomeRequest { -// Foo some_parameter = 1; -// PageRequest pagination = 2; -// } -type PageRequest struct { - // key is a value returned in PageResponse.next_key to begin - // querying the next page most efficiently. Only one of offset or key - // should be set. - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - // offset is a numeric offset that can be used when key is unavailable. - // It is less efficient than using key. Only one of offset or key should - // be set. - Offset uint64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` - // limit is the total number of results to be returned in the result page. - // If left empty it will default to a value to be set by each app. - Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` - // count_total is set to true to indicate that the result set should include - // a count of the total number of items available for pagination in UIs. - // count_total is only respected when offset is used. It is ignored when key - // is set. - CountTotal bool `protobuf:"varint,4,opt,name=count_total,json=countTotal,proto3" json:"count_total,omitempty"` -} - -func (m *PageRequest) Reset() { *m = PageRequest{} } -func (m *PageRequest) String() string { return proto.CompactTextString(m) } -func (*PageRequest) ProtoMessage() {} -func (*PageRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_53d6d609fe6828af, []int{0} -} -func (m *PageRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PageRequest.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 *PageRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_PageRequest.Merge(m, src) -} -func (m *PageRequest) XXX_Size() int { - return m.Size() -} -func (m *PageRequest) XXX_DiscardUnknown() { - xxx_messageInfo_PageRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_PageRequest proto.InternalMessageInfo - -func (m *PageRequest) GetKey() []byte { - if m != nil { - return m.Key - } - return nil -} - -func (m *PageRequest) GetOffset() uint64 { - if m != nil { - return m.Offset - } - return 0 -} - -func (m *PageRequest) GetLimit() uint64 { - if m != nil { - return m.Limit - } - return 0 -} - -func (m *PageRequest) GetCountTotal() bool { - if m != nil { - return m.CountTotal - } - return false -} - -// PageResponse is to be embedded in gRPC response messages where the -// corresponding request message has used PageRequest. -// -// message SomeResponse { -// repeated Bar results = 1; -// PageResponse page = 2; -// } -type PageResponse struct { - // next_key is the key to be passed to PageRequest.key to - // query the next page most efficiently - NextKey []byte `protobuf:"bytes,1,opt,name=next_key,json=nextKey,proto3" json:"next_key,omitempty"` - // total is total number of results available if PageRequest.count_total - // was set, its value is undefined otherwise - Total uint64 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` -} - -func (m *PageResponse) Reset() { *m = PageResponse{} } -func (m *PageResponse) String() string { return proto.CompactTextString(m) } -func (*PageResponse) ProtoMessage() {} -func (*PageResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_53d6d609fe6828af, []int{1} -} -func (m *PageResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PageResponse.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 *PageResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_PageResponse.Merge(m, src) -} -func (m *PageResponse) XXX_Size() int { - return m.Size() -} -func (m *PageResponse) XXX_DiscardUnknown() { - xxx_messageInfo_PageResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_PageResponse proto.InternalMessageInfo - -func (m *PageResponse) GetNextKey() []byte { - if m != nil { - return m.NextKey - } - return nil -} - -func (m *PageResponse) GetTotal() uint64 { - if m != nil { - return m.Total - } - return 0 -} - -func init() { - proto.RegisterType((*PageRequest)(nil), "cosmos.base.query.v1beta1.PageRequest") - proto.RegisterType((*PageResponse)(nil), "cosmos.base.query.v1beta1.PageResponse") -} - -func init() { - proto.RegisterFile("cosmos/base/query/v1beta1/pagination.proto", fileDescriptor_53d6d609fe6828af) -} - -var fileDescriptor_53d6d609fe6828af = []byte{ - // 275 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x90, 0x41, 0x4b, 0xc3, 0x30, - 0x18, 0x86, 0x1b, 0x37, 0xe7, 0xc8, 0x76, 0x90, 0x20, 0xd2, 0x5d, 0x62, 0xd9, 0xa9, 0x08, 0x6d, - 0x18, 0xfe, 0x00, 0xc1, 0x8b, 0x07, 0x2f, 0x52, 0x3c, 0x79, 0x19, 0x69, 0xfd, 0xd6, 0x85, 0xad, - 0x49, 0xd7, 0x7c, 0x15, 0xfb, 0x2f, 0xfc, 0x59, 0x1e, 0x77, 0xf4, 0x28, 0xed, 0x1f, 0x91, 0x36, - 0x83, 0x9d, 0x92, 0xf7, 0xe5, 0xe1, 0x7b, 0xe0, 0xa5, 0xf7, 0x99, 0xb1, 0x85, 0xb1, 0x22, 0x95, - 0x16, 0xc4, 0xa1, 0x86, 0xaa, 0x11, 0x9f, 0xab, 0x14, 0x50, 0xae, 0x44, 0x29, 0x73, 0xa5, 0x25, - 0x2a, 0xa3, 0xe3, 0xb2, 0x32, 0x68, 0xd8, 0xc2, 0xb1, 0x71, 0xcf, 0xc6, 0x03, 0x1b, 0x9f, 0xd8, - 0xa5, 0xa6, 0xb3, 0x57, 0x99, 0x43, 0x02, 0x87, 0x1a, 0x2c, 0xb2, 0x6b, 0x3a, 0xda, 0x41, 0xe3, - 0x93, 0x80, 0x84, 0xf3, 0xa4, 0xff, 0xb2, 0x5b, 0x3a, 0x31, 0x9b, 0x8d, 0x05, 0xf4, 0x2f, 0x02, - 0x12, 0x8e, 0x93, 0x53, 0x62, 0x37, 0xf4, 0x72, 0xaf, 0x0a, 0x85, 0xfe, 0x68, 0xa8, 0x5d, 0x60, - 0x77, 0x74, 0x96, 0x99, 0x5a, 0xe3, 0x1a, 0x0d, 0xca, 0xbd, 0x3f, 0x0e, 0x48, 0x38, 0x4d, 0xe8, - 0x50, 0xbd, 0xf5, 0xcd, 0xf2, 0x91, 0xce, 0x9d, 0xcf, 0x96, 0x46, 0x5b, 0x60, 0x0b, 0x3a, 0xd5, - 0xf0, 0x85, 0xeb, 0xb3, 0xf5, 0xaa, 0xcf, 0x2f, 0xd0, 0xf4, 0x06, 0x77, 0xc5, 0x89, 0x5d, 0x78, - 0x7a, 0xfe, 0x69, 0x39, 0x39, 0xb6, 0x9c, 0xfc, 0xb5, 0x9c, 0x7c, 0x77, 0xdc, 0x3b, 0x76, 0xdc, - 0xfb, 0xed, 0xb8, 0xf7, 0x1e, 0xe5, 0x0a, 0xb7, 0x75, 0x1a, 0x67, 0xa6, 0x10, 0xaa, 0x52, 0x56, - 0x03, 0x0e, 0xef, 0xb6, 0x4e, 0x23, 0xfb, 0xb1, 0x8b, 0x72, 0x23, 0xb0, 0x29, 0xc1, 0xba, 0xb5, - 0xd2, 0xc9, 0xb0, 0xcd, 0xc3, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0x45, 0x81, 0x38, 0x49, - 0x01, 0x00, 0x00, -} - -func (m *PageRequest) 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 *PageRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PageRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CountTotal { - i-- - if m.CountTotal { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.Limit != 0 { - i = encodeVarintPagination(dAtA, i, uint64(m.Limit)) - i-- - dAtA[i] = 0x18 - } - if m.Offset != 0 { - i = encodeVarintPagination(dAtA, i, uint64(m.Offset)) - i-- - dAtA[i] = 0x10 - } - if len(m.Key) > 0 { - i -= len(m.Key) - copy(dAtA[i:], m.Key) - i = encodeVarintPagination(dAtA, i, uint64(len(m.Key))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PageResponse) 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 *PageResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PageResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Total != 0 { - i = encodeVarintPagination(dAtA, i, uint64(m.Total)) - i-- - dAtA[i] = 0x10 - } - if len(m.NextKey) > 0 { - i -= len(m.NextKey) - copy(dAtA[i:], m.NextKey) - i = encodeVarintPagination(dAtA, i, uint64(len(m.NextKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintPagination(dAtA []byte, offset int, v uint64) int { - offset -= sovPagination(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *PageRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovPagination(uint64(l)) - } - if m.Offset != 0 { - n += 1 + sovPagination(uint64(m.Offset)) - } - if m.Limit != 0 { - n += 1 + sovPagination(uint64(m.Limit)) - } - if m.CountTotal { - n += 2 - } - return n -} - -func (m *PageResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NextKey) - if l > 0 { - n += 1 + l + sovPagination(uint64(l)) - } - if m.Total != 0 { - n += 1 + sovPagination(uint64(m.Total)) - } - return n -} - -func sovPagination(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozPagination(x uint64) (n int) { - return sovPagination(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PageRequest) 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 ErrIntOverflowPagination - } - 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: PageRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PageRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPagination - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPagination - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) - if m.Key == nil { - m.Key = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Offset |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Limit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CountTotal", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CountTotal = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipPagination(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPagination - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PageResponse) 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 ErrIntOverflowPagination - } - 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: PageResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PageResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPagination - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthPagination - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NextKey = append(m.NextKey[:0], dAtA[iNdEx:postIndex]...) - if m.NextKey == nil { - m.NextKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType) - } - m.Total = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPagination - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Total |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipPagination(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthPagination - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipPagination(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, ErrIntOverflowPagination - } - 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, ErrIntOverflowPagination - } - 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, ErrIntOverflowPagination - } - 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, ErrInvalidLengthPagination - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupPagination - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthPagination - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthPagination = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPagination = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupPagination = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/types/result.go b/core-sdk/types/result.go deleted file mode 100644 index 8137b375..00000000 --- a/core-sdk/types/result.go +++ /dev/null @@ -1,258 +0,0 @@ -package types - -import ( - "encoding/hex" - "encoding/json" - "fmt" - "math" - "strings" - - commoncodec "github.com/irisnet/core-sdk-go/common/codec" - - yaml "gopkg.in/yaml.v2" - - ctypes "github.com/tendermint/tendermint/rpc/core/types" - - cryptotypes "github.com/irisnet/core-sdk-go/common/codec/types" -) - -var cdc = commoncodec.NewLegacyAmino() - -func (gi GasInfo) String() string { - bz, _ := yaml.Marshal(gi) - return string(bz) -} - -func (r Result) String() string { - bz, _ := yaml.Marshal(r) - return string(bz) -} - -func (r Result) GetEvents() Events { - events := make(Events, len(r.Events)) - for i, e := range r.Events { - events[i] = Event(e) - } - - return events -} - -// ABCIMessageLogs represents a slice of ABCIMessageLog. -type ABCIMessageLogs []ABCIMessageLog - -// String implements the fmt.Stringer interface for the ABCIMessageLogs type. -func (logs ABCIMessageLogs) String() (str string) { - if logs != nil { - raw, err := cdc.MarshalJSON(logs) - if err == nil { - str = string(raw) - } - } - - return str -} - -// NewResponseResultTx returns a TxResponse given a ResultTx from tendermint -func NewResponseResultTx(res *ctypes.ResultTx, anyTx *cryptotypes.Any, timestamp string) *TxResponse { - if res == nil { - return nil - } - - parsedLogs, _ := ParseABCILogs(res.TxResult.Log) - - return &TxResponse{ - TxHash: res.Hash.String(), - Height: res.Height, - Codespace: res.TxResult.Codespace, - Code: res.TxResult.Code, - Data: strings.ToUpper(hex.EncodeToString(res.TxResult.Data)), - RawLog: res.TxResult.Log, - Logs: parsedLogs, - Info: res.TxResult.Info, - GasWanted: res.TxResult.GasWanted, - GasUsed: res.TxResult.GasUsed, - Tx: anyTx, - Timestamp: timestamp, - } -} - -// NewResponseFormatBroadcastTxCommit returns a TxResponse given a -// ResultBroadcastTxCommit from tendermint. -func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - if !res.CheckTx.IsOK() { - return newTxResponseCheckTx(res) - } - - return newTxResponseDeliverTx(res) -} - -func newTxResponseCheckTx(res *ctypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - var txHash string - if res.Hash != nil { - txHash = res.Hash.String() - } - - parsedLogs, _ := ParseABCILogs(res.CheckTx.Log) - - return &TxResponse{ - Height: res.Height, - TxHash: txHash, - Codespace: res.CheckTx.Codespace, - Code: res.CheckTx.Code, - Data: strings.ToUpper(hex.EncodeToString(res.CheckTx.Data)), - RawLog: res.CheckTx.Log, - Logs: parsedLogs, - Info: res.CheckTx.Info, - GasWanted: res.CheckTx.GasWanted, - GasUsed: res.CheckTx.GasUsed, - } -} - -func newTxResponseDeliverTx(res *ctypes.ResultBroadcastTxCommit) *TxResponse { - if res == nil { - return nil - } - - var txHash string - if res.Hash != nil { - txHash = res.Hash.String() - } - - parsedLogs, _ := ParseABCILogs(res.DeliverTx.Log) - - return &TxResponse{ - Height: res.Height, - TxHash: txHash, - Codespace: res.DeliverTx.Codespace, - Code: res.DeliverTx.Code, - Data: strings.ToUpper(hex.EncodeToString(res.DeliverTx.Data)), - RawLog: res.DeliverTx.Log, - Logs: parsedLogs, - Info: res.DeliverTx.Info, - GasWanted: res.DeliverTx.GasWanted, - GasUsed: res.DeliverTx.GasUsed, - } -} - -// NewResponseFormatBroadcastTx returns a TxResponse given a ResultBroadcastTx from tendermint -func NewResponseFormatBroadcastTx(res *ctypes.ResultBroadcastTx) *TxResponse { - if res == nil { - return nil - } - - parsedLogs, _ := ParseABCILogs(res.Log) - - return &TxResponse{ - Code: res.Code, - Codespace: res.Codespace, - Data: res.Data.String(), - RawLog: res.Log, - Logs: parsedLogs, - TxHash: res.Hash.String(), - } -} - -func (r TxResponse) String() string { - var sb strings.Builder - sb.WriteString("Response:\n") - - if r.Height > 0 { - sb.WriteString(fmt.Sprintf(" Height: %d\n", r.Height)) - } - if r.TxHash != "" { - sb.WriteString(fmt.Sprintf(" TxHash: %s\n", r.TxHash)) - } - if r.Code > 0 { - sb.WriteString(fmt.Sprintf(" Code: %d\n", r.Code)) - } - if r.Data != "" { - sb.WriteString(fmt.Sprintf(" Data: %s\n", r.Data)) - } - if r.RawLog != "" { - sb.WriteString(fmt.Sprintf(" Raw Log: %s\n", r.RawLog)) - } - if r.Logs != nil { - sb.WriteString(fmt.Sprintf(" Logs: %s\n", r.Logs)) - } - if r.Info != "" { - sb.WriteString(fmt.Sprintf(" Info: %s\n", r.Info)) - } - if r.GasWanted != 0 { - sb.WriteString(fmt.Sprintf(" GasWanted: %d\n", r.GasWanted)) - } - if r.GasUsed != 0 { - sb.WriteString(fmt.Sprintf(" GasUsed: %d\n", r.GasUsed)) - } - if r.Codespace != "" { - sb.WriteString(fmt.Sprintf(" Codespace: %s\n", r.Codespace)) - } - if r.Timestamp != "" { - sb.WriteString(fmt.Sprintf(" Timestamp: %s\n", r.Timestamp)) - } - - return strings.TrimSpace(sb.String()) -} - -// Empty returns true if the response is empty -func (r TxResponse) Empty() bool { - return r.TxHash == "" && r.Logs == nil -} - -func NewSearchTxsResult(totalCount, count, page, limit uint64, txs []*TxResponse) *SearchTxsResult { - return &SearchTxsResult{ - TotalCount: totalCount, - Count: count, - PageNumber: page, - PageTotal: uint64(math.Ceil(float64(totalCount) / float64(limit))), - Limit: limit, - Txs: txs, - } -} - -// ParseABCILogs attempts to parse a stringified ABCI tx log into a slice of -// ABCIMessageLog types. It returns an error upon JSON decoding failure. -func ParseABCILogs(logs string) (res ABCIMessageLogs, err error) { - err = json.Unmarshal([]byte(logs), &res) - return res, err -} - -var _, _ cryptotypes.UnpackInterfacesMessage = SearchTxsResult{}, TxResponse{} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -// -// types.UnpackInterfaces needs to be called for each nested Tx because -// there are generally interfaces to unpack in Tx's -func (s SearchTxsResult) UnpackInterfaces(unpacker cryptotypes.AnyUnpacker) error { - for _, tx := range s.Txs { - err := cryptotypes.UnpackInterfaces(tx, unpacker) - if err != nil { - return err - } - } - return nil -} - -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (r TxResponse) UnpackInterfaces(unpacker cryptotypes.AnyUnpacker) error { - if r.Tx != nil { - var tx Tx - return unpacker.UnpackAny(r.Tx, &tx) - } - return nil -} - -// GetTx unpacks the Tx from within a TxResponse and returns it -func (r TxResponse) GetTx() Tx { - if tx, ok := r.Tx.GetCachedValue().(Tx); ok { - return tx - } - return nil -} diff --git a/core-sdk/types/sign_mode_handler.go b/core-sdk/types/sign_mode_handler.go deleted file mode 100644 index 07ec9f6e..00000000 --- a/core-sdk/types/sign_mode_handler.go +++ /dev/null @@ -1,36 +0,0 @@ -package types - -import ( - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// SignModeHandler defines a interface to be implemented by types which will handle -// SignMode's by generating sign bytes from a Tx and SignerData -type SignModeHandler interface { - // DefaultMode is the default mode that is to be used with this handler if no - // other mode is specified. This can be useful for testing and CLI usage - DefaultMode() signing.SignMode - - // Modes is the list of modes supporting by this handler - Modes() []signing.SignMode - - // GetSignBytes returns the sign bytes for the provided SignMode, SignerData and Tx, - // or an error - GetSignBytes(mode signing.SignMode, data SignerData, tx Tx) ([]byte, error) -} - -// SignerData is the specific information needed to sign a transaction that generally -// isn't included in the transaction body itself -type SignerData struct { - // ChainID is the chain that this transaction is targeted - ChainID string - - // AccountNumber is the account number of the signer - AccountNumber uint64 - - // Sequence is the account sequence number of the signer that is used - // for replay protection. This field is only useful for Legacy Amino signing, - // since in SIGN_MODE_DIRECT the account sequence is already in the signer - // info. - Sequence uint64 -} diff --git a/core-sdk/types/stdtx.go b/core-sdk/types/stdtx.go deleted file mode 100644 index db88cf84..00000000 --- a/core-sdk/types/stdtx.go +++ /dev/null @@ -1,227 +0,0 @@ -package types - -import ( - "encoding/json" - "errors" - "fmt" - - commoncodec "github.com/irisnet/core-sdk-go/common/codec" -) - -const ( - // maxMemoCharacters = 100 - // txSigLimit = 7 - maxGasWanted = uint64((1 << 63) - 1) - - Sync BroadcastMode = "sync" - Async BroadcastMode = "async" - Commit BroadcastMode = "commit" -) - -type BroadcastMode string - -type Msgs []Msg - -func (m Msgs) Len() int { - return len(m) -} - -func (m Msgs) Sub(begin, end int) SplitAble { - return m[begin:end] -} - -// StdFee includes the amount of coins paid in fees and the maximum -// Gas to be used by the transaction. The ratio yields an effective "gasprice", -// which must be above some miminum to be accepted into the mempool. -type StdFee struct { - Amount Coins `json:"amount"` - Gas uint64 `json:"gas"` -} - -func NewStdFee(gas uint64, amount ...Coin) StdFee { - return StdFee{ - Amount: amount, - Gas: gas, - } -} - -// Fee bytes for signing later -func (fee StdFee) Bytes() []byte { - //TODO - return nil -} - -// Standard Signature -type StdSignature struct { - PubKey []byte `json:"pub_key" yaml:"pub_key"` // optional - Signature []byte `json:"signature" yaml:"signature"` -} - -// StdSignMsg is a convenience structure for passing along -// a Msg with the other requirements for a StdSignDoc before -// it is signed. For use in the CLI. -type StdSignMsg struct { - ChainID string `json:"chain_id"` - AccountNumber uint64 `json:"account_number"` - Sequence uint64 `json:"sequence"` - Fee StdFee `json:"fee"` - Msgs []Msg `json:"msgs"` - Memo string `json:"memo"` -} - -// get message bytes -func (msg StdSignMsg) Bytes(cdc commoncodec.Marshaler) []byte { - var msgsBytes []json.RawMessage - for _, msg := range msg.Msgs { - msgsBytes = append(msgsBytes, json.RawMessage(msg.GetSignBytes())) - } - bz, err := json.Marshal(StdSignDoc{ - AccountNumber: msg.AccountNumber, - ChainID: msg.ChainID, - Fee: json.RawMessage(msg.Fee.Bytes()), - Memo: msg.Memo, - Msgs: msgsBytes, - Sequence: msg.Sequence, - }) - if err != nil { - panic(err) - } - return MustSortJSON(bz) -} - -// StdSignDoc is replay-prevention structure. -// It includes the result of msg.GetSignBytes(), -// as well as the ChainID (prevent cross chain replay) -// and the Sequence numbers for each signature (prevent -// inchain replay and enforce tx ordering per account). -type StdSignDoc struct { - AccountNumber uint64 `json:"account_number"` - ChainID string `json:"chain_id"` - Fee json.RawMessage `json:"fee"` - Memo string `json:"memo"` - Msgs []json.RawMessage `json:"msgs"` - Sequence uint64 `json:"sequence"` -} - -// StdTx is a standard way to wrap a Msg with Fee and Signatures. -// NOTE: the first signature is the fee payer (Signatures must not be nil). -type StdTx struct { - Msgs []Msg `json:"msg"` - Fee StdFee `json:"fee"` - Signatures []StdSignature `json:"signatures"` - Memo string `json:"memo"` -} - -func NewStdTx(msgs []Msg, fee StdFee, sigs []StdSignature, memo string) StdTx { - return StdTx{ - Msgs: msgs, - Fee: fee, - Signatures: sigs, - Memo: memo, - } -} - -//nolint -// GetMsgs returns the all the transaction's messages. -func (tx StdTx) GetMsgs() []Msg { return tx.Msgs } -func (tx StdTx) GetSignBytes() []string { - var bz []string - for _, msg := range tx.Msgs { - bz = append(bz, string(msg.GetSignBytes())) - } - return bz -} - -// ValidateBasic does a simple and lightweight validation check that doesn't -// require access to any other information. -func (tx StdTx) ValidateBasic() error { - stdSigs := tx.GetSignatures() - - if tx.Fee.Gas > maxGasWanted { - return fmt.Errorf("invalid gas supplied; %d > %d", tx.Fee.Gas, maxGasWanted) - } - - if tx.Fee.Amount.IsAnyNegative() { - return fmt.Errorf("invalid fee %s amount provided", tx.Fee.Amount) - } - - if len(stdSigs) == 0 { - return errors.New("no signers") - } - if len(stdSigs) != len(tx.GetSigners()) { - return errors.New("wrong number of signers") - } - if len(stdSigs) != len(tx.GetSigners()) { - return fmt.Errorf( - "wrong number of signers; expected %d, got %d", len(tx.GetSigners()), len(stdSigs), - ) - } - return nil -} - -// GetSigners returns the addresses that must sign the transaction. -// Addresses are returned in a deterministic order. -// They are accumulated from the GetSigners method for each Msg -// in the order they appear in tx.GetMsgs(). -// Duplicate addresses will be omitted. -func (tx StdTx) GetSigners() []AccAddress { - seen := map[string]bool{} - var signers []AccAddress - for _, msg := range tx.GetMsgs() { - for _, addr := range msg.GetSigners() { - if !seen[addr.String()] { - signers = append(signers, addr) - seen[addr.String()] = true - } - } - } - return signers -} - -//nolint -func (tx StdTx) GetMemo() string { return tx.Memo } - -// GetSignatures returns the signature of signers who signed the Msg. -// CONTRACT: Length returned is same as length of -// pubkeys returned from MsgKeySigners, and the order -// matches. -// CONTRACT: If the signature is missing (ie the Msg is -// invalid), then the corresponding signature is -// .Empty(). -func (tx StdTx) GetSignatures() []StdSignature { return tx.Signatures } - -type BaseTx struct { - From string `json:"from"` - Password string `json:"password"` - Gas uint64 `json:"gas"` - Fee DecCoins `json:"fee"` - Memo string `json:"memo"` - Mode BroadcastMode `json:"broadcast_mode"` - SimulateAndExecute bool `json:"simulate_and_execute"` - GasAdjustment float64 `json:"gas_adjustment"` -} - -// ResultTx encapsulates the return result of the transaction. When the transaction fails, -// it is an empty object. The specific error information can be obtained through the Error interface. -type ResultTx struct { - GasWanted int64 `json:"gas_wanted"` - GasUsed int64 `json:"gas_used"` - Events StringEvents `json:"events"` - Hash string `json:"hash"` - Height int64 `json:"height"` -} - -// ResultQueryTx is used to prepare info to display -type ResultQueryTx struct { - Hash string `json:"hash"` - Height int64 `json:"height"` - Tx Tx `json:"tx"` - Result TxResult `json:"result"` - Timestamp string `json:"timestamp"` -} - -// ResultSearchTxs defines a structure for querying txs pageable -type ResultSearchTxs struct { - Total int `json:"total"` // Count of all txs - Txs []ResultQueryTx `json:"txs"` // List of txs in current page -} diff --git a/core-sdk/types/store/aes.go b/core-sdk/types/store/aes.go deleted file mode 100644 index 44b5a5ac..00000000 --- a/core-sdk/types/store/aes.go +++ /dev/null @@ -1,64 +0,0 @@ -package store - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "encoding/base64" - "fmt" - "io" -) - -type AES struct{} - -func (AES) Encrypt(text string, key string) (string, error) { - plaintext := []byte(text) - k := generateKey(key) - - block, err := aes.NewCipher(k) - if err != nil { - return "", err - } - - cipherText := make([]byte, aes.BlockSize+len(plaintext)) - iv := cipherText[:aes.BlockSize] - if _, err := io.ReadFull(rand.Reader, iv); err != nil { - return "", err - } - - stream := cipher.NewCFBEncrypter(block, iv) - stream.XORKeyStream(cipherText[aes.BlockSize:], plaintext) - - return base64.URLEncoding.EncodeToString(cipherText), nil -} - -func (AES) Decrypt(cryptoText string, key string) (string, error) { - cipherText, _ := base64.URLEncoding.DecodeString(cryptoText) - k := generateKey(key) - block, err := aes.NewCipher(k) - if err != nil { - return "", err - } - - if len(cipherText) < aes.BlockSize { - return "", err - } - iv := cipherText[:aes.BlockSize] - cipherText = cipherText[aes.BlockSize:] - - stream := cipher.NewCFBDecrypter(block, iv) - stream.XORKeyStream(cipherText, cipherText) - return fmt.Sprintf("%s", cipherText), nil -} - -func generateKey(key string) (genKey []byte) { - keyBz := []byte(key) - genKey = make([]byte, 32) - copy(genKey, keyBz) - for i := 32; i < len(keyBz); { - for j := 0; j < 32 && i < len(keyBz); j, i = j+1, i+1 { - genKey[j] ^= keyBz[i] - } - } - return genKey -} diff --git a/core-sdk/types/store/codec.go b/core-sdk/types/store/codec.go deleted file mode 100644 index b90fbf69..00000000 --- a/core-sdk/types/store/codec.go +++ /dev/null @@ -1,31 +0,0 @@ -package store - -import ( - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/common/codec" - cryptocodec "github.com/irisnet/core-sdk-go/common/crypto/codec" - "github.com/irisnet/core-sdk-go/common/crypto/hd" -) - -var cdc *codec.LegacyAmino - -func init() { - cdc = codec.NewLegacyAmino() - cryptocodec.RegisterCrypto(cdc) - RegisterCodec(cdc) - cdc.Seal() -} - -// RegisterCodec registers concrete types and interfaces on the given codec. -func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterInterface((*Info)(nil), nil) - cdc.RegisterConcrete(hd.BIP44Params{}, "crypto/keys/hd/BIP44Params", nil) - cdc.RegisterConcrete(localInfo{}, "crypto/keys/localInfo", nil) -} - -// PubKeyFromBytes unmarshals public key bytes and returns a PubKey -func PubKeyFromBytes(pubKeyBytes []byte) (pubKey crypto.PubKey, err error) { - err = cdc.UnmarshalBinaryBare(pubKeyBytes, &pubKey) - return -} diff --git a/core-sdk/types/store/level_db.go b/core-sdk/types/store/level_db.go deleted file mode 100644 index f718f19a..00000000 --- a/core-sdk/types/store/level_db.go +++ /dev/null @@ -1,118 +0,0 @@ -package store - -import ( - "encoding/json" - "fmt" - "path/filepath" - - dbm "github.com/tendermint/tm-db" -) - -const ( - keyDBName = "keys" - infoSuffix = "info" -) - -var ( - _ KeyDAO = LevelDBDAO{} -) - -type LevelDBDAO struct { - db dbm.DB - Crypto -} - -// NewLevelDB initialize a keybase based on the configuration. -// Use leveldb as storage -func NewLevelDB(rootDir string, crypto Crypto) (KeyDAO, error) { - db, err := dbm.NewGoLevelDB(keyDBName, filepath.Join(rootDir, "keys")) - if err != nil { - return nil, err - } - - if crypto == nil { - crypto = AES{} - } - - levelDB := LevelDBDAO{ - db: db, - Crypto: crypto, - } - return levelDB, nil -} - -// Write add a key information to the local store -func (k LevelDBDAO) Write(name, password string, info KeyInfo) error { - if k.Has(name) { - return fmt.Errorf("name %s has exist", name) - } - - privStr, err := k.Encrypt(info.PrivKeyArmor, password) - if err != nil { - return err - } - - info.PrivKeyArmor = privStr - - bz, err := json.Marshal(info) - if err != nil { - return err - } - return k.db.SetSync(infoKey(name), bz) -} - -// Read read a key information from the local store -func (k LevelDBDAO) Read(name, password string) (store KeyInfo, err error) { - bz, err := k.db.Get(infoKey(name)) - if bz == nil || err != nil { - return store, err - } - - if err := json.Unmarshal(bz, &store); err != nil { - return store, err - } - - if len(password) > 0 { - privStr, err := k.Decrypt(store.PrivKeyArmor, password) - if err != nil { - return store, err - } - store.PrivKeyArmor = privStr - } - return -} - -// ReadMetadata read a key information from the local store -func (k LevelDBDAO) ReadMetadata(name string) (store KeyInfo, err error) { - bz, err := k.db.Get(infoKey(name)) - if bz == nil || err != nil { - return store, err - } - - if err := json.Unmarshal(bz, &store); err != nil { - return store, err - } - return -} - -// Delete delete a key from the local store -func (k LevelDBDAO) Delete(name, password string) error { - _, err := k.Read(name, password) - if err != nil { - return err - } - return k.db.DeleteSync(infoKey(name)) -} - -// Delete delete a key from the local store -func (k LevelDBDAO) Has(name string) bool { - existed, err := k.db.Has(infoKey(name)) - if err != nil { - return false - } - return existed -} - -func infoKey(name string) []byte { - return []byte(fmt.Sprintf("%s.%s", name, infoSuffix)) -} diff --git a/core-sdk/types/store/memory.go b/core-sdk/types/store/memory.go deleted file mode 100644 index f1a2d2c2..00000000 --- a/core-sdk/types/store/memory.go +++ /dev/null @@ -1,40 +0,0 @@ -package store - -// Use memory as storage, use with caution in build environment -type MemoryDAO struct { - store map[string]KeyInfo - Crypto -} - -func NewMemory(crypto Crypto) MemoryDAO { - if crypto == nil { - crypto = AES{} - } - return MemoryDAO{ - store: make(map[string]KeyInfo), - Crypto: crypto, - } -} -func (m MemoryDAO) Write(name, password string, store KeyInfo) error { - m.store[name] = store - return nil -} - -func (m MemoryDAO) Read(name, password string) (KeyInfo, error) { - return m.store[name], nil -} - -// ReadMetadata read a key information from the local store -func (m MemoryDAO) ReadMetadata(name string) (store KeyInfo, err error) { - return m.store[name], nil -} - -func (m MemoryDAO) Delete(name, password string) error { - delete(m.store, name) - return nil -} - -func (m MemoryDAO) Has(name string) bool { - _, ok := m.store[name] - return ok -} diff --git a/core-sdk/types/store/types.go b/core-sdk/types/store/types.go deleted file mode 100644 index 2f3c9d09..00000000 --- a/core-sdk/types/store/types.go +++ /dev/null @@ -1,107 +0,0 @@ -package store - -import ( - "fmt" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/common/crypto/hd" -) - -var ( - _ Info = &localInfo{} -) - -// KeyType reflects a human-readable type for key listing. -type KeyType uint - -// Info KeyTypes -const ( - TypeLocal KeyType = 0 -) - -// KeyInfo saves the basic information of the key -type KeyInfo struct { - Name string `json:"name"` - PubKey []byte `json:"pubkey"` - PrivKeyArmor string `json:"priv_key_armor"` - Algo string `json:"algo"` -} - -type KeyDAO interface { - // Write will use user password to encrypt data and save to file, the file name is user name - Write(name, password string, store KeyInfo) error - - // Read will read encrypted data from file and decrypt with user password - Read(name, password string) (KeyInfo, error) - - // Delete will delete user data and use user password to verify permissions - Delete(name, password string) error - - // Has returns whether the specified user name exists - Has(name string) bool -} - -type Crypto interface { - Encrypt(data string, password string) (string, error) - Decrypt(data string, password string) (string, error) -} - -// Info is the publicly exposed information about a keypair -type Info interface { - // Human-readable type for key listing - GetType() KeyType - // Name of the key - GetName() string - // Public key - GetPubKey() crypto.PubKey - // Bip44 Path - GetPath() (*hd.BIP44Params, error) - // Algo - GetAlgo() hd.PubKeyType -} - -// localInfo is the public information about a locally stored key -// Note: Algo must be last field in struct for backwards amino compatibility -type localInfo struct { - Name string `json:"name"` - PubKey crypto.PubKey `json:"pubkey"` - PrivKeyArmor string `json:"privkey.armor"` - Algo hd.PubKeyType `json:"algo"` -} - -// GetType implements Info interface -func (i localInfo) GetType() KeyType { - return TypeLocal -} - -// GetType implements Info interface -func (i localInfo) GetName() string { - return i.Name -} - -// GetType implements Info interface -func (i localInfo) GetPubKey() crypto.PubKey { - return i.PubKey -} - -// GetType implements Info interface -func (i localInfo) GetAlgo() hd.PubKeyType { - return i.Algo -} - -// GetType implements Info interface -func (i localInfo) GetPath() (*hd.BIP44Params, error) { - return nil, fmt.Errorf("BIP44 Paths are not available for this type") -} - -// encoding info -func marshalInfo(i Info) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(i) -} - -// decoding info -func unmarshalInfo(bz []byte) (info Info, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(bz, &info) - return -} diff --git a/core-sdk/types/tm_types.go b/core-sdk/types/tm_types.go deleted file mode 100644 index 94982f56..00000000 --- a/core-sdk/types/tm_types.go +++ /dev/null @@ -1,47 +0,0 @@ -package types - -import ( - "encoding/hex" - "strings" - - "github.com/tendermint/tendermint/crypto" - tmbytes "github.com/tendermint/tendermint/libs/bytes" - tmclient "github.com/tendermint/tendermint/rpc/client" - tmtypes "github.com/tendermint/tendermint/types" - - cryptoAmino "github.com/irisnet/core-sdk-go/common/crypto/codec" - "github.com/irisnet/core-sdk-go/types/kv" -) - -type ( - HexBytes = tmbytes.HexBytes - ABCIClient = tmclient.ABCIClient - SignClient = tmclient.SignClient - StatusClient = tmclient.StatusClient - NetworkClient = tmclient.NetworkClient - Header = tmtypes.Header - Pair = kv.Pair - - TmPubKey = crypto.PubKey -) - -var ( - PubKeyFromBytes = cryptoAmino.PubKeyFromBytes -) - -func MustHexBytesFrom(hexStr string) HexBytes { - v, _ := hex.DecodeString(hexStr) - return HexBytes(v) -} - -func HexBytesFrom(hexStr string) (HexBytes, error) { - v, err := hex.DecodeString(hexStr) - if err != nil { - return nil, err - } - return HexBytes(v), nil -} - -func HexStringFrom(bz []byte) string { - return strings.ToUpper(hex.EncodeToString(bz)) -} diff --git a/core-sdk/types/token.go b/core-sdk/types/token.go deleted file mode 100644 index 8a818834..00000000 --- a/core-sdk/types/token.go +++ /dev/null @@ -1,24 +0,0 @@ -package types - -type Token struct { - Symbol string `json:"symbol"` - Name string `json:"name"` - Scale uint32 `json:"scale"` - MinUnit string `json:"min_unit"` - InitialSupply uint64 `json:"initial_supply"` - MaxSupply uint64 `json:"max_supply"` - Mintable bool `json:"mintable"` - Owner string `json:"owner"` -} - -// GetCoinType returns CnType -func (t Token) GetCoinType() CoinType { - return CoinType{ - Name: t.Name, - MinUnit: NewUnit(t.MinUnit, uint8(t.Scale)), - MainUnit: NewUnit(t.Symbol, 0), - Desc: t.Name, - } -} - -type Tokens []Token diff --git a/core-sdk/types/token_manager.go b/core-sdk/types/token_manager.go deleted file mode 100644 index 752706a6..00000000 --- a/core-sdk/types/token_manager.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -type DefaultTokenManager struct{} - -func (TokenManager DefaultTokenManager) QueryToken(denom string) (Token, error) { - return Token{}, nil -} - -func (TokenManager DefaultTokenManager) SaveTokens(tokens ...Token) { - return -} - -func (TokenManager DefaultTokenManager) ToMinCoin(coins ...DecCoin) (Coins, Error) { - for i := range coins { - if coins[i].Denom == "iris" { - coins[i].Denom = "uiris" - coins[i].Amount = coins[i].Amount.MulInt(NewIntWithDecimal(1, 6)) - } - } - ucoins, _ := DecCoins(coins).TruncateDecimal() - return ucoins, nil -} - -func (TokenManager DefaultTokenManager) ToMainCoin(coins ...Coin) (DecCoins, Error) { - decCoins := make(DecCoins, len(coins), 0) - for _, coin := range coins { - if coin.Denom == "uiris" { - amtount := NewDecFromInt(coin.Amount).Mul(NewDecWithPrec(1, 6)) - decCoins = append(decCoins, NewDecCoinFromDec("iris", amtount)) - } - } - return decCoins, nil -} diff --git a/core-sdk/types/tx.go b/core-sdk/types/tx.go deleted file mode 100644 index 7bf8af33..00000000 --- a/core-sdk/types/tx.go +++ /dev/null @@ -1,53 +0,0 @@ -package types - -import ( - "github.com/tendermint/tendermint/crypto" - - commoncodec "github.com/irisnet/core-sdk-go/common/codec" -) - -type ( - // Generator defines an interface a client can utilize to generate an - // application-defined concrete transaction type. The type returned must - // implement ClientTx. - Generator interface { - NewTx() ClientTx - NewFee() ClientFee - NewSignature() ClientSignature - } - - ClientFee interface { - Fee - SetGas(uint64) - SetAmount(Coins) - } - - ClientSignature interface { - Signature - SetPubKey(crypto.PubKey) error - SetSignature([]byte) - } - - // ClientTx defines an interface which an application-defined concrete transaction - // type must implement. Namely, it must be able to set messages, generate - // signatures, and provide canonical bytes to sign over. The transaction must - // also know how to encode itself. - ClientTx interface { - Tx - commoncodec.ProtoMarshaler - - SetMsgs(...Msg) error - GetSignatures() []Signature - SetSignatures(...ClientSignature) error - GetFee() Fee - SetFee(ClientFee) error - GetMemo() string - SetMemo(string) - - // CanonicalSignBytes returns the canonical JSON bytes to sign over, given a - // chain ID, along with an account and sequence number. The JSON encoding - // ensures all field names adhere to their proto definition, default values - // are omitted, and follows the JSON Canonical Form. - CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error) - } -) diff --git a/core-sdk/types/tx/builder.go b/core-sdk/types/tx/builder.go deleted file mode 100644 index 169a2349..00000000 --- a/core-sdk/types/tx/builder.go +++ /dev/null @@ -1,351 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - - "github.com/tendermint/tendermint/crypto" - - codectypes "github.com/irisnet/core-sdk-go/common/codec/types" - "github.com/irisnet/core-sdk-go/types" - sdk "github.com/irisnet/core-sdk-go/types" - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// wrapper is a wrapper around the tx.Tx proto.Message which retain the raw -// body and auth_info bytes. -type wrapper struct { - tx *Tx - - // bodyBz represents the protobuf encoding of TxBody. This should be encoding - // from the client using TxRaw if the tx was decoded from the wire - bodyBz []byte - - // authInfoBz represents the protobuf encoding of TxBody. This should be encoding - // from the client using TxRaw if the tx was decoded from the wire - authInfoBz []byte - - txBodyHasUnknownNonCriticals bool -} - -var ( - _ ExtensionOptionsTxBuilder = &wrapper{} - _ codectypes.IntoAny = &wrapper{} -) - -// ExtensionOptionsTxBuilder defines a TxBuilder that can also set extensions. -type ExtensionOptionsTxBuilder interface { - SetExtensionOptions(...*codectypes.Any) - SetNonCriticalExtensionOptions(...*codectypes.Any) -} - -func newBuilder() *wrapper { - return &wrapper{ - tx: &Tx{ - Body: &TxBody{}, - AuthInfo: &AuthInfo{ - Fee: &Fee{}, - }, - }, - } -} - -func (w *wrapper) GetMsgs() []sdk.Msg { - return w.tx.GetMsgs() -} - -func (w *wrapper) ValidateBasic() error { - return w.tx.ValidateBasic() -} - -func (w *wrapper) getBodyBytes() []byte { - if len(w.bodyBz) == 0 { - // if bodyBz is empty, then marshal the body. bodyBz will generally - // be set to nil whenever SetBody is called so the result of calling - // this method should always return the correct bytes. Note that after - // decoding bodyBz is derived from TxRaw so that it matches what was - // transmitted over the wire - var err error - w.bodyBz, err = proto.Marshal(w.tx.Body) - if err != nil { - panic(err) - } - } - return w.bodyBz -} - -func (w *wrapper) getAuthInfoBytes() []byte { - if len(w.authInfoBz) == 0 { - // if authInfoBz is empty, then marshal the body. authInfoBz will generally - // be set to nil whenever SetAuthInfo is called so the result of calling - // this method should always return the correct bytes. Note that after - // decoding authInfoBz is derived from TxRaw so that it matches what was - // transmitted over the wire - var err error - w.authInfoBz, err = proto.Marshal(w.tx.AuthInfo) - if err != nil { - panic(err) - } - } - return w.authInfoBz -} - -func (w *wrapper) GetSigners() []sdk.AccAddress { - return w.tx.GetSigners() -} - -func (w *wrapper) GetPubKeys() []crypto.PubKey { - signerInfos := w.tx.AuthInfo.SignerInfos - pks := make([]crypto.PubKey, len(signerInfos)) - - for i, si := range signerInfos { - // NOTE: it is okay to leave this nil if there is no PubKey in the SignerInfo. - // PubKey's can be left unset in SignerInfo. - if si.PublicKey == nil { - continue - } - - pk, ok := si.PublicKey.GetCachedValue().(crypto.PubKey) - if ok { - pks[i] = pk - } - } - - return pks -} - -func (w *wrapper) GetGas() uint64 { - return w.tx.AuthInfo.Fee.GasLimit -} - -func (w *wrapper) GetFee() sdk.Coins { - return w.tx.AuthInfo.Fee.Amount -} - -func (w *wrapper) FeePayer() sdk.AccAddress { - feePayer := w.tx.AuthInfo.Fee.Payer - if feePayer != "" { - payerAddr, err := sdk.AccAddressFromBech32(feePayer) - if err != nil { - panic(err) - } - return payerAddr - } - // use first signer as default if no payer specified - return w.GetSigners()[0] -} - -func (w *wrapper) FeeGranter() sdk.AccAddress { - feePayer := w.tx.AuthInfo.Fee.Granter - if feePayer != "" { - granterAddr, err := sdk.AccAddressFromBech32(feePayer) - if err != nil { - panic(err) - } - return granterAddr - } - return nil -} - -func (w *wrapper) GetMemo() string { - return w.tx.Body.Memo -} - -func (w *wrapper) GetSignatures() [][]byte { - return w.tx.Signatures -} - -// GetTimeoutHeight returns the transaction's timeout height (if set). -func (w *wrapper) GetTimeoutHeight() uint64 { - return w.tx.Body.TimeoutHeight -} - -func (w *wrapper) GetSignaturesV2() ([]signing.SignatureV2, error) { - signerInfos := w.tx.AuthInfo.SignerInfos - sigs := w.tx.Signatures - pubKeys := w.GetPubKeys() - n := len(signerInfos) - res := make([]signing.SignatureV2, n) - - for i, si := range signerInfos { - // handle nil signatures (in case of simulation) - if si.ModeInfo == nil { - res[i] = signing.SignatureV2{ - PubKey: pubKeys[i], - } - } else { - var err error - sigData, err := ModeInfoAndSigToSignatureData(si.ModeInfo, sigs[i]) - if err != nil { - return nil, err - } - res[i] = signing.SignatureV2{ - PubKey: pubKeys[i], - Data: sigData, - Sequence: si.GetSequence(), - } - - } - } - - return res, nil -} - -func (w *wrapper) SetMsgs(msgs ...sdk.Msg) error { - anys := make([]*codectypes.Any, len(msgs)) - - for i, msg := range msgs { - var err error - anys[i], err = codectypes.NewAnyWithValue(msg) - if err != nil { - return err - } - } - - w.tx.Body.Messages = anys - - // set bodyBz to nil because the cached bodyBz no longer matches tx.Body - w.bodyBz = nil - - return nil -} - -// SetTimeoutHeight sets the transaction's height timeout. -func (w *wrapper) SetTimeoutHeight(height uint64) { - w.tx.Body.TimeoutHeight = height - - // set bodyBz to nil because the cached bodyBz no longer matches tx.Body - w.bodyBz = nil -} - -func (w *wrapper) SetMemo(memo string) { - w.tx.Body.Memo = memo - - // set bodyBz to nil because the cached bodyBz no longer matches tx.Body - w.bodyBz = nil -} - -func (w *wrapper) SetGasLimit(limit uint64) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.GasLimit = limit - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetFeeAmount(coins sdk.Coins) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.Amount = coins - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetFeePayer(feePayer sdk.AccAddress) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.Payer = feePayer.String() - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetFeeGranter(feeGranter sdk.AccAddress) { - if w.tx.AuthInfo.Fee == nil { - w.tx.AuthInfo.Fee = &Fee{} - } - - w.tx.AuthInfo.Fee.Granter = feeGranter.String() - - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) SetSignatures(signatures ...signing.SignatureV2) error { - n := len(signatures) - signerInfos := make([]*SignerInfo, n) - rawSigs := make([][]byte, n) - - for i, sig := range signatures { - var modeInfo *ModeInfo - modeInfo, rawSigs[i] = SignatureDataToModeInfoAndSig(sig.Data) - any, err := PubKeyToAny(sig.PubKey) - if err != nil { - return err - } - signerInfos[i] = &SignerInfo{ - PublicKey: any, - ModeInfo: modeInfo, - Sequence: sig.Sequence, - } - } - - w.setSignerInfos(signerInfos) - w.setSignatures(rawSigs) - - return nil -} - -func (w *wrapper) setSignerInfos(infos []*SignerInfo) { - w.tx.AuthInfo.SignerInfos = infos - // set authInfoBz to nil because the cached authInfoBz no longer matches tx.AuthInfo - w.authInfoBz = nil -} - -func (w *wrapper) setSignatures(sigs [][]byte) { - w.tx.Signatures = sigs -} - -func (w *wrapper) GetTx() sdk.Tx { - return w -} - -// GetProtoTx returns the tx as a proto.Message. -func (w *wrapper) AsAny() *codectypes.Any { - // We're sure here that w.tx is a proto.Message, so this will call - // codectypes.NewAnyWithValue under the hood. - return codectypes.UnsafePackAny(w.tx) -} - -// WrapTx creates a TxBuilder wrapper around a tx.Tx proto message. -func WrapTx(protoTx *Tx) types.TxBuilder { - return &wrapper{ - tx: protoTx, - } -} - -func (w *wrapper) GetExtensionOptions() []*codectypes.Any { - return w.tx.Body.ExtensionOptions -} - -func (w *wrapper) GetNonCriticalExtensionOptions() []*codectypes.Any { - return w.tx.Body.NonCriticalExtensionOptions -} - -func (w *wrapper) SetExtensionOptions(extOpts ...*codectypes.Any) { - w.tx.Body.ExtensionOptions = extOpts - w.bodyBz = nil -} - -func (w *wrapper) SetNonCriticalExtensionOptions(extOpts ...*codectypes.Any) { - w.tx.Body.NonCriticalExtensionOptions = extOpts - w.bodyBz = nil -} - -// PubKeyToAny converts a crypto.PubKey to a proto Any. -func PubKeyToAny(key crypto.PubKey) (*codectypes.Any, error) { - protoMsg, ok := key.(proto.Message) - if !ok { - return nil, sdk.Wrap(fmt.Errorf("err invalid key, can't proto encode %T", protoMsg)) - } - return codectypes.NewAnyWithValue(protoMsg) -} diff --git a/core-sdk/types/tx/config.go b/core-sdk/types/tx/config.go deleted file mode 100644 index 753453ab..00000000 --- a/core-sdk/types/tx/config.go +++ /dev/null @@ -1,65 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/irisnet/core-sdk-go/common/codec" - sdk "github.com/irisnet/core-sdk-go/types" - signingtypes "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -type config struct { - handler sdk.SignModeHandler - decoder sdk.TxDecoder - encoder sdk.TxEncoder - jsonDecoder sdk.TxDecoder - jsonEncoder sdk.TxEncoder - protoCodec *codec.ProtoCodec -} - -// NewTxConfig returns a new protobuf TxConfig using the provided ProtoCodec and sign modes. The -// first enabled sign mode will become the default sign mode. -func NewTxConfig(protoCodec *codec.ProtoCodec, enabledSignModes []signingtypes.SignMode) sdk.TxConfig { - return &config{ - handler: MakeSignModeHandler(enabledSignModes), - decoder: DefaultTxDecoder(protoCodec), - encoder: DefaultTxEncoder(), - jsonDecoder: DefaultJSONTxDecoder(protoCodec), - jsonEncoder: DefaultJSONTxEncoder(), - protoCodec: protoCodec, - } -} - -func (g config) NewTxBuilder() sdk.TxBuilder { - return newBuilder() -} - -// WrapTxBuilder returns a builder from provided transaction -func (g config) WrapTxBuilder(newTx sdk.Tx) (sdk.TxBuilder, error) { - newBuilder, ok := newTx.(*wrapper) - if !ok { - return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, newTx) - } - - return newBuilder, nil -} - -func (g config) SignModeHandler() sdk.SignModeHandler { - return g.handler -} - -func (g config) TxEncoder() sdk.TxEncoder { - return g.encoder -} - -func (g config) TxDecoder() sdk.TxDecoder { - return g.decoder -} - -func (g config) TxJSONEncoder() sdk.TxEncoder { - return g.jsonEncoder -} - -func (g config) TxJSONDecoder() sdk.TxDecoder { - return g.jsonDecoder -} diff --git a/core-sdk/types/tx/decoder.go b/core-sdk/types/tx/decoder.go deleted file mode 100644 index e6f4a599..00000000 --- a/core-sdk/types/tx/decoder.go +++ /dev/null @@ -1,79 +0,0 @@ -package tx - -import ( - "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/codec/unknownproto" - sdk "github.com/irisnet/core-sdk-go/types" -) - -// DefaultTxDecoder returns a default protobuf TxDecoder using the provided Marshaler. -func DefaultTxDecoder(cdc *codec.ProtoCodec) sdk.TxDecoder { - return func(txBytes []byte) (sdk.Tx, error) { - var raw TxRaw - - // reject all unknown proto fields in the root TxRaw - err := unknownproto.RejectUnknownFieldsStrict(txBytes, &raw) - if err != nil { - return nil, err - } - - err = cdc.UnmarshalBinaryBare(txBytes, &raw) - if err != nil { - return nil, err - } - - var body TxBody - - // allow non-critical unknown fields in TxBody - txBodyHasUnknownNonCriticals, err := unknownproto.RejectUnknownFields(raw.BodyBytes, &body, true) - if err != nil { - return nil, err - } - - err = cdc.UnmarshalBinaryBare(raw.BodyBytes, &body) - if err != nil { - return nil, err - } - - var authInfo AuthInfo - - // reject all unknown proto fields in AuthInfo - err = unknownproto.RejectUnknownFieldsStrict(raw.AuthInfoBytes, &authInfo) - if err != nil { - return nil, err - } - - err = cdc.UnmarshalBinaryBare(raw.AuthInfoBytes, &authInfo) - if err != nil { - return nil, err - } - - theTx := &Tx{ - Body: &body, - AuthInfo: &authInfo, - Signatures: raw.Signatures, - } - - return &wrapper{ - tx: theTx, - bodyBz: raw.BodyBytes, - authInfoBz: raw.AuthInfoBytes, - txBodyHasUnknownNonCriticals: txBodyHasUnknownNonCriticals, - }, nil - } -} - -// DefaultJSONTxDecoder returns a default protobuf JSON TxDecoder using the provided Marshaler. -func DefaultJSONTxDecoder(cdc *codec.ProtoCodec) sdk.TxDecoder { - return func(txBytes []byte) (sdk.Tx, error) { - var theTx Tx - err := cdc.UnmarshalJSON(txBytes, &theTx) - if err != nil { - return nil, err - } - - return &wrapper{ - tx: &theTx, - }, nil - } -} diff --git a/core-sdk/types/tx/direct.go b/core-sdk/types/tx/direct.go deleted file mode 100644 index cea816b9..00000000 --- a/core-sdk/types/tx/direct.go +++ /dev/null @@ -1,52 +0,0 @@ -package tx - -import ( - "fmt" - - sdk "github.com/irisnet/core-sdk-go/types" - signingtypes "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// signModeDirectHandler defines the SIGN_MODE_DIRECT SignModeHandler -type signModeDirectHandler struct{} - -var _ sdk.SignModeHandler = signModeDirectHandler{} - -// DefaultMode implements SignModeHandler.DefaultMode -func (signModeDirectHandler) DefaultMode() signingtypes.SignMode { - return signingtypes.SignMode_SIGN_MODE_DIRECT -} - -// Modes implements SignModeHandler.Modes -func (signModeDirectHandler) Modes() []signingtypes.SignMode { - return []signingtypes.SignMode{signingtypes.SignMode_SIGN_MODE_DIRECT} -} - -// GetSignBytes implements SignModeHandler.GetSignBytes -func (signModeDirectHandler) GetSignBytes(mode signingtypes.SignMode, data sdk.SignerData, tx sdk.Tx) ([]byte, error) { - if mode != signingtypes.SignMode_SIGN_MODE_DIRECT { - return nil, fmt.Errorf("expected %s, got %s", signingtypes.SignMode_SIGN_MODE_DIRECT, mode) - } - - protoTx, ok := tx.(*wrapper) - if !ok { - return nil, fmt.Errorf("can only handle a protobuf Tx, got %T", tx) - } - - bodyBz := protoTx.getBodyBytes() - authInfoBz := protoTx.getAuthInfoBytes() - - return DirectSignBytes(bodyBz, authInfoBz, data.ChainID, data.AccountNumber) -} - -// DirectSignBytes returns the SIGN_MODE_DIRECT sign bytes for the provided TxBody bytes, AuthInfo bytes, chain ID, -// account number and sequence. -func DirectSignBytes(bodyBytes, authInfoBytes []byte, chainID string, accnum uint64) ([]byte, error) { - signDoc := SignDoc{ - BodyBytes: bodyBytes, - AuthInfoBytes: authInfoBytes, - ChainId: chainID, - AccountNumber: accnum, - } - return signDoc.Marshal() -} diff --git a/core-sdk/types/tx/encoder.go b/core-sdk/types/tx/encoder.go deleted file mode 100644 index 45c5a26a..00000000 --- a/core-sdk/types/tx/encoder.go +++ /dev/null @@ -1,46 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/gogo/protobuf/proto" - - "github.com/irisnet/core-sdk-go/common/codec" - sdk "github.com/irisnet/core-sdk-go/types" -) - -// DefaultTxEncoder returns a default protobuf TxEncoder using the provided Marshaler -func DefaultTxEncoder() sdk.TxEncoder { - return func(tx sdk.Tx) ([]byte, error) { - txWrapper, ok := tx.(*wrapper) - if !ok { - return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, tx) - } - - raw := &TxRaw{ - BodyBytes: txWrapper.getBodyBytes(), - AuthInfoBytes: txWrapper.getAuthInfoBytes(), - Signatures: txWrapper.tx.Signatures, - } - - return proto.Marshal(raw) - } -} - -// DefaultJSONTxEncoder returns a default protobuf JSON TxEncoder using the provided Marshaler. -func DefaultJSONTxEncoder() sdk.TxEncoder { - return func(tx sdk.Tx) ([]byte, error) { - txWrapper, ok := tx.(*wrapper) - if ok { - return codec.ProtoMarshalJSON(txWrapper.tx) - } - - protoTx, ok := tx.(*Tx) - if ok { - return codec.ProtoMarshalJSON(protoTx) - } - - return nil, fmt.Errorf("expected %T, got %T", &wrapper{}, tx) - - } -} diff --git a/core-sdk/types/tx/mode_handler.go b/core-sdk/types/tx/mode_handler.go deleted file mode 100644 index 16285fad..00000000 --- a/core-sdk/types/tx/mode_handler.go +++ /dev/null @@ -1,40 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/irisnet/core-sdk-go/types" - signingtypes "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// DefaultSignModes are the default sign modes enabled for protobuf transactions. -var DefaultSignModes = []signingtypes.SignMode{ - signingtypes.SignMode_SIGN_MODE_DIRECT, - //signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON, -} - -// makeSignModeHandler returns the default protobuf SignModeHandler supporting -// SIGN_MODE_DIRECT and SIGN_MODE_LEGACY_AMINO_JSON. -func MakeSignModeHandler(modes []signingtypes.SignMode) types.SignModeHandler { - if len(modes) < 1 { - panic(fmt.Errorf("no sign modes enabled")) - } - - handlers := make([]types.SignModeHandler, len(modes)) - - for i, mode := range modes { - switch mode { - case signingtypes.SignMode_SIGN_MODE_DIRECT: - handlers[i] = signModeDirectHandler{} - case signingtypes.SignMode_SIGN_MODE_LEGACY_AMINO_JSON: - //handlers[i] = signModeLegacyAminoJSONHandler{} - default: - panic(fmt.Errorf("unsupported sign mode %+v", mode)) - } - } - - return types.NewSignModeHandlerMap( - modes[0], - handlers, - ) -} diff --git a/core-sdk/types/tx/signing/signature.go b/core-sdk/types/tx/signing/signature.go deleted file mode 100644 index b07cba47..00000000 --- a/core-sdk/types/tx/signing/signature.go +++ /dev/null @@ -1,100 +0,0 @@ -package signing - -import ( - "fmt" - - "github.com/tendermint/tendermint/crypto" -) - -// SignatureV2 is a convenience type that is easier to use in application logic -// than the protobuf SignerInfo's and raw signature bytes. It goes beyond the -// first sdk.Signature types by supporting sign modes and explicitly nested -// multi-signatures. It is intended to be used for both building and verifying -// signatures. -type SignatureV2 struct { - // PubKey is the public key to use for verifying the signature - PubKey crypto.PubKey - - // Data is the actual data of the signature which includes SignMode's and - // the signatures themselves for either single or multi-signatures. - Data SignatureData - - // Sequence is the sequence of this account. Only populated in - // SIGN_MODE_DIRECT. - Sequence uint64 - - // Ugly flag to keep backwards-compatibility with Amino StdSignatures. - // In SIGN_MODE_DIRECT, sequence is in AuthInfo, and will thus be populated - // in the Sequence field above. The ante handler then checks this Sequence - // with the actual sequence on-chain. - // In SIGN_MODE_LEGACY_AMINO_JSON, sequence is signed via StdSignDoc, and - // checked during signature verification. It's not populated in the - // Sequence field above. This flag indicates that the Sequence field should - // be skipped in ante handlers. - // TLDR; - // - false (by default) in SIGN_MODE_DIRECT - // - true in SIGN_MODE_LEGACY_AMINO_JSON - // ref: https://github.com/irisnet/core-sdk-go/issues/7229 - SkipSequenceCheck bool -} - -// SignatureDataToProto converts a SignatureData to SignatureDescriptor_Data. -// SignatureDescriptor_Data is considered an encoding type whereas SignatureData is used for -// business logic. -func SignatureDataToProto(data SignatureData) *SignatureDescriptor_Data { - switch data := data.(type) { - case *SingleSignatureData: - return &SignatureDescriptor_Data{ - Sum: &SignatureDescriptor_Data_Single_{ - Single: &SignatureDescriptor_Data_Single{ - Mode: data.SignMode, - Signature: data.Signature, - }, - }, - } - case *MultiSignatureData: - descDatas := make([]*SignatureDescriptor_Data, len(data.Signatures)) - - for j, d := range data.Signatures { - descDatas[j] = SignatureDataToProto(d) - } - - return &SignatureDescriptor_Data{ - Sum: &SignatureDescriptor_Data_Multi_{ - Multi: &SignatureDescriptor_Data_Multi{ - Bitarray: data.BitArray, - Signatures: descDatas, - }, - }, - } - default: - panic(fmt.Errorf("unexpected case %+v", data)) - } -} - -// SignatureDataFromProto converts a SignatureDescriptor_Data to SignatureData. -// SignatureDescriptor_Data is considered an encoding type whereas SignatureData is used for -// business logic. -func SignatureDataFromProto(descData *SignatureDescriptor_Data) SignatureData { - switch descData := descData.Sum.(type) { - case *SignatureDescriptor_Data_Single_: - return &SingleSignatureData{ - SignMode: descData.Single.Mode, - Signature: descData.Single.Signature, - } - case *SignatureDescriptor_Data_Multi_: - multi := descData.Multi - datas := make([]SignatureData, len(multi.Signatures)) - - for j, d := range multi.Signatures { - datas[j] = SignatureDataFromProto(d) - } - - return &MultiSignatureData{ - BitArray: multi.Bitarray, - Signatures: datas, - } - default: - panic(fmt.Errorf("unexpected case %+v", descData)) - } -} diff --git a/core-sdk/types/tx/signing/signature_data.go b/core-sdk/types/tx/signing/signature_data.go deleted file mode 100644 index b2562290..00000000 --- a/core-sdk/types/tx/signing/signature_data.go +++ /dev/null @@ -1,36 +0,0 @@ -package signing - -import ( - "github.com/irisnet/core-sdk-go/common/crypto/types" -) - -// SignatureData represents either a *SingleSignatureData or *MultiSignatureData. -// It is a convenience type that is easier to use in business logic than the encoded -// protobuf ModeInfo's and raw signatures. -type SignatureData interface { - isSignatureData() -} - -// SingleSignatureData represents the signature and SignMode of a single (non-multisig) signer -type SingleSignatureData struct { - // SignMode represents the SignMode of the signature - SignMode SignMode - - // SignMode represents the SignMode of the signature - Signature []byte -} - -// MultiSignatureData represents the nested SignatureData of a multisig signature -type MultiSignatureData struct { - // BitArray is a compact way of indicating which signers from the multisig key - // have signed - BitArray *types.CompactBitArray - - // Signatures is the nested SignatureData's for each signer - Signatures []SignatureData -} - -var _, _ SignatureData = &SingleSignatureData{}, &MultiSignatureData{} - -func (m *SingleSignatureData) isSignatureData() {} -func (m *MultiSignatureData) isSignatureData() {} diff --git a/core-sdk/types/tx/signing/signing.pb.go b/core-sdk/types/tx/signing/signing.pb.go deleted file mode 100644 index cee5dc14..00000000 --- a/core-sdk/types/tx/signing/signing.pb.go +++ /dev/null @@ -1,1453 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/tx/signing/v1beta1/signing.proto - -package signing - -import ( - fmt "fmt" - proto "github.com/gogo/protobuf/proto" - types2 "github.com/irisnet/core-sdk-go/common/codec/types" - types1 "github.com/irisnet/core-sdk-go/common/crypto/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// SignMode represents a signing mode with its own security guarantees. -type SignMode int32 - -const ( - // SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be - // rejected - SignMode_SIGN_MODE_UNSPECIFIED SignMode = 0 - // SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is - // verified with raw bytes from Tx - SignMode_SIGN_MODE_DIRECT SignMode = 1 - // SIGN_MODE_TEXTUAL is a future signing mode that will verify some - // human-readable textual representation on top of the binary representation - // from SIGN_MODE_DIRECT - SignMode_SIGN_MODE_TEXTUAL SignMode = 2 - // SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses - // Amino JSON and will be removed in the future - SignMode_SIGN_MODE_LEGACY_AMINO_JSON SignMode = 127 -) - -var SignMode_name = map[int32]string{ - 0: "SIGN_MODE_UNSPECIFIED", - 1: "SIGN_MODE_DIRECT", - 2: "SIGN_MODE_TEXTUAL", - 127: "SIGN_MODE_LEGACY_AMINO_JSON", -} - -var SignMode_value = map[string]int32{ - "SIGN_MODE_UNSPECIFIED": 0, - "SIGN_MODE_DIRECT": 1, - "SIGN_MODE_TEXTUAL": 2, - "SIGN_MODE_LEGACY_AMINO_JSON": 127, -} - -func (x SignMode) String() string { - return proto.EnumName(SignMode_name, int32(x)) -} - -func (SignMode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{0} -} - -// SignatureDescriptors wraps multiple SignatureDescriptor's. -type SignatureDescriptors struct { - // signatures are the signature descriptors - Signatures []*SignatureDescriptor `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *SignatureDescriptors) Reset() { *m = SignatureDescriptors{} } -func (m *SignatureDescriptors) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptors) ProtoMessage() {} -func (*SignatureDescriptors) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{0} -} -func (m *SignatureDescriptors) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptors) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptors.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 *SignatureDescriptors) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptors.Merge(m, src) -} -func (m *SignatureDescriptors) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptors) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptors.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptors proto.InternalMessageInfo - -func (m *SignatureDescriptors) GetSignatures() []*SignatureDescriptor { - if m != nil { - return m.Signatures - } - return nil -} - -// SignatureDescriptor is a convenience type which represents the full data for -// a signature including the public key of the signer, signing modes and the -// signature itself. It is primarily used for coordinating signatures between -// clients. -type SignatureDescriptor struct { - // public_key is the public key of the signer - PublicKey *types2.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - Data *SignatureDescriptor_Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to prevent - // replay attacks. - Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` -} - -func (m *SignatureDescriptor) Reset() { *m = SignatureDescriptor{} } -func (m *SignatureDescriptor) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor) ProtoMessage() {} -func (*SignatureDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1} -} -func (m *SignatureDescriptor) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor.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 *SignatureDescriptor) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor.Merge(m, src) -} -func (m *SignatureDescriptor) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor proto.InternalMessageInfo - -func (m *SignatureDescriptor) GetPublicKey() *types2.Any { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *SignatureDescriptor) GetData() *SignatureDescriptor_Data { - if m != nil { - return m.Data - } - return nil -} - -func (m *SignatureDescriptor) GetSequence() uint64 { - if m != nil { - return m.Sequence - } - return 0 -} - -// Data represents signature data -type SignatureDescriptor_Data struct { - // sum is the oneof that specifies whether this represents single or multi-signature data - // - // Types that are valid to be assigned to Sum: - // *SignatureDescriptor_Data_Single_ - // *SignatureDescriptor_Data_Multi_ - Sum isSignatureDescriptor_Data_Sum `protobuf_oneof:"sum"` -} - -func (m *SignatureDescriptor_Data) Reset() { *m = SignatureDescriptor_Data{} } -func (m *SignatureDescriptor_Data) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor_Data) ProtoMessage() {} -func (*SignatureDescriptor_Data) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1, 0} -} -func (m *SignatureDescriptor_Data) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor_Data) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor_Data.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 *SignatureDescriptor_Data) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor_Data.Merge(m, src) -} -func (m *SignatureDescriptor_Data) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor_Data) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor_Data.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor_Data proto.InternalMessageInfo - -type isSignatureDescriptor_Data_Sum interface { - isSignatureDescriptor_Data_Sum() - MarshalTo([]byte) (int, error) - Size() int -} - -type SignatureDescriptor_Data_Single_ struct { - Single *SignatureDescriptor_Data_Single `protobuf:"bytes,1,opt,name=single,proto3,oneof" json:"single,omitempty"` -} -type SignatureDescriptor_Data_Multi_ struct { - Multi *SignatureDescriptor_Data_Multi `protobuf:"bytes,2,opt,name=multi,proto3,oneof" json:"multi,omitempty"` -} - -func (*SignatureDescriptor_Data_Single_) isSignatureDescriptor_Data_Sum() {} -func (*SignatureDescriptor_Data_Multi_) isSignatureDescriptor_Data_Sum() {} - -func (m *SignatureDescriptor_Data) GetSum() isSignatureDescriptor_Data_Sum { - if m != nil { - return m.Sum - } - return nil -} - -func (m *SignatureDescriptor_Data) GetSingle() *SignatureDescriptor_Data_Single { - if x, ok := m.GetSum().(*SignatureDescriptor_Data_Single_); ok { - return x.Single - } - return nil -} - -func (m *SignatureDescriptor_Data) GetMulti() *SignatureDescriptor_Data_Multi { - if x, ok := m.GetSum().(*SignatureDescriptor_Data_Multi_); ok { - return x.Multi - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*SignatureDescriptor_Data) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*SignatureDescriptor_Data_Single_)(nil), - (*SignatureDescriptor_Data_Multi_)(nil), - } -} - -// Single is the signature data for a single signer -type SignatureDescriptor_Data_Single struct { - // mode is the signing mode of the single signer - Mode SignMode `protobuf:"varint,1,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"` - // signature is the raw signature bytes - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (m *SignatureDescriptor_Data_Single) Reset() { *m = SignatureDescriptor_Data_Single{} } -func (m *SignatureDescriptor_Data_Single) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor_Data_Single) ProtoMessage() {} -func (*SignatureDescriptor_Data_Single) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1, 0, 0} -} -func (m *SignatureDescriptor_Data_Single) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor_Data_Single) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor_Data_Single.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 *SignatureDescriptor_Data_Single) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor_Data_Single.Merge(m, src) -} -func (m *SignatureDescriptor_Data_Single) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor_Data_Single) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor_Data_Single.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor_Data_Single proto.InternalMessageInfo - -func (m *SignatureDescriptor_Data_Single) GetMode() SignMode { - if m != nil { - return m.Mode - } - return SignMode_SIGN_MODE_UNSPECIFIED -} - -func (m *SignatureDescriptor_Data_Single) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -// Multi is the signature data for a multisig public key -type SignatureDescriptor_Data_Multi struct { - // bitarray specifies which keys within the multisig are signing - Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"` - // signatures is the signatures of the multi-signature - Signatures []*SignatureDescriptor_Data `protobuf:"bytes,2,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *SignatureDescriptor_Data_Multi) Reset() { *m = SignatureDescriptor_Data_Multi{} } -func (m *SignatureDescriptor_Data_Multi) String() string { return proto.CompactTextString(m) } -func (*SignatureDescriptor_Data_Multi) ProtoMessage() {} -func (*SignatureDescriptor_Data_Multi) Descriptor() ([]byte, []int) { - return fileDescriptor_9a54958ff3d0b1b9, []int{1, 0, 1} -} -func (m *SignatureDescriptor_Data_Multi) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignatureDescriptor_Data_Multi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignatureDescriptor_Data_Multi.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 *SignatureDescriptor_Data_Multi) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignatureDescriptor_Data_Multi.Merge(m, src) -} -func (m *SignatureDescriptor_Data_Multi) XXX_Size() int { - return m.Size() -} -func (m *SignatureDescriptor_Data_Multi) XXX_DiscardUnknown() { - xxx_messageInfo_SignatureDescriptor_Data_Multi.DiscardUnknown(m) -} - -var xxx_messageInfo_SignatureDescriptor_Data_Multi proto.InternalMessageInfo - -func (m *SignatureDescriptor_Data_Multi) GetBitarray() *types1.CompactBitArray { - if m != nil { - return m.Bitarray - } - return nil -} - -func (m *SignatureDescriptor_Data_Multi) GetSignatures() []*SignatureDescriptor_Data { - if m != nil { - return m.Signatures - } - return nil -} - -func init() { - proto.RegisterEnum("cosmos.tx.signing.v1beta1.SignMode", SignMode_name, SignMode_value) - proto.RegisterType((*SignatureDescriptors)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptors") - proto.RegisterType((*SignatureDescriptor)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor") - proto.RegisterType((*SignatureDescriptor_Data)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data") - proto.RegisterType((*SignatureDescriptor_Data_Single)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single") - proto.RegisterType((*SignatureDescriptor_Data_Multi)(nil), "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi") -} - -func init() { - proto.RegisterFile("cosmos/tx/signing/v1beta1/signing.proto", fileDescriptor_9a54958ff3d0b1b9) -} - -var fileDescriptor_9a54958ff3d0b1b9 = []byte{ - // 551 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc7, 0xed, 0x7c, 0x29, 0xdd, 0x22, 0x14, 0x96, 0x54, 0x4a, 0x0c, 0x32, 0x51, 0x39, 0x10, - 0x21, 0x65, 0xad, 0x26, 0x07, 0x04, 0xb7, 0x7c, 0x98, 0x34, 0x34, 0x1f, 0x60, 0xa7, 0x12, 0x70, - 0xb1, 0x6c, 0x67, 0xeb, 0xae, 0x1a, 0x7b, 0x8d, 0x77, 0x8d, 0xea, 0x13, 0xaf, 0xc0, 0x6b, 0xf0, - 0x1c, 0x5c, 0x38, 0xf6, 0xc8, 0x11, 0x25, 0xcf, 0xc0, 0x1d, 0xc5, 0x8e, 0x93, 0x20, 0x15, 0xa1, - 0xe6, 0x64, 0xcd, 0xcc, 0x7f, 0x7f, 0xf3, 0x5f, 0xcd, 0x78, 0xc1, 0x33, 0x9b, 0x32, 0x97, 0x32, - 0x85, 0x5f, 0x2b, 0x8c, 0x38, 0x1e, 0xf1, 0x1c, 0xe5, 0xf3, 0x89, 0x85, 0xb9, 0x79, 0x92, 0xc6, - 0xc8, 0x0f, 0x28, 0xa7, 0xb0, 0x9a, 0x08, 0x11, 0xbf, 0x46, 0x69, 0x61, 0x2d, 0x94, 0x1a, 0x6b, - 0x86, 0x1d, 0x44, 0x3e, 0xa7, 0x8a, 0x1b, 0xce, 0x39, 0x61, 0x64, 0x0b, 0x4a, 0x13, 0x09, 0x49, - 0xaa, 0x3a, 0x94, 0x3a, 0x73, 0xac, 0xc4, 0x91, 0x15, 0x5e, 0x28, 0xa6, 0x17, 0x25, 0xa5, 0xe3, - 0x0b, 0x50, 0xd6, 0x89, 0xe3, 0x99, 0x3c, 0x0c, 0x70, 0x0f, 0x33, 0x3b, 0x20, 0x3e, 0xa7, 0x01, - 0x83, 0x63, 0x00, 0x58, 0x9a, 0x67, 0x15, 0xb1, 0x96, 0xad, 0x1f, 0x36, 0x11, 0xfa, 0xa7, 0x23, - 0x74, 0x0b, 0x44, 0xdb, 0x21, 0x1c, 0xff, 0xce, 0x81, 0x87, 0xb7, 0x68, 0x60, 0x0b, 0x00, 0x3f, - 0xb4, 0xe6, 0xc4, 0x36, 0xae, 0x70, 0x54, 0x11, 0x6b, 0x62, 0xfd, 0xb0, 0x59, 0x46, 0x89, 0x5f, - 0x94, 0xfa, 0x45, 0x6d, 0x2f, 0xd2, 0x0e, 0x12, 0xdd, 0x19, 0x8e, 0x60, 0x1f, 0xe4, 0x66, 0x26, - 0x37, 0x2b, 0x99, 0x58, 0xde, 0xba, 0x9b, 0x2d, 0xd4, 0x33, 0xb9, 0xa9, 0xc5, 0x00, 0x28, 0x81, - 0x22, 0xc3, 0x9f, 0x42, 0xec, 0xd9, 0xb8, 0x92, 0xad, 0x89, 0xf5, 0x9c, 0xb6, 0x89, 0xa5, 0xef, - 0x59, 0x90, 0x5b, 0x49, 0xe1, 0x14, 0x14, 0x18, 0xf1, 0x9c, 0x39, 0x5e, 0xdb, 0x7b, 0xb5, 0x47, - 0x3f, 0xa4, 0xc7, 0x84, 0x53, 0x41, 0x5b, 0xb3, 0xe0, 0x3b, 0x90, 0x8f, 0xa7, 0xb4, 0xbe, 0xc4, - 0xcb, 0x7d, 0xa0, 0xa3, 0x15, 0xe0, 0x54, 0xd0, 0x12, 0x92, 0x64, 0x80, 0x42, 0xd2, 0x06, 0xbe, - 0x00, 0x39, 0x97, 0xce, 0x12, 0xc3, 0xf7, 0x9b, 0x4f, 0xff, 0xc3, 0x1e, 0xd1, 0x19, 0xd6, 0xe2, - 0x03, 0xf0, 0x31, 0x38, 0xd8, 0x0c, 0x2d, 0x76, 0x76, 0x4f, 0xdb, 0x26, 0xa4, 0x6f, 0x22, 0xc8, - 0xc7, 0x3d, 0xe1, 0x19, 0x28, 0x5a, 0x84, 0x9b, 0x41, 0x60, 0xa6, 0x43, 0x53, 0xd2, 0x26, 0xc9, - 0x4e, 0xa2, 0xcd, 0x0a, 0xa6, 0x9d, 0xba, 0xd4, 0xf5, 0x4d, 0x9b, 0x77, 0x08, 0x6f, 0xaf, 0x8e, - 0x69, 0x1b, 0x00, 0xd4, 0xff, 0xda, 0xb5, 0x4c, 0xbc, 0x6b, 0x7b, 0x0d, 0x75, 0x07, 0xd3, 0xc9, - 0x83, 0x2c, 0x0b, 0xdd, 0xe7, 0x0c, 0x14, 0xd3, 0x2b, 0xc2, 0x2a, 0x38, 0xd2, 0x07, 0xfd, 0xb1, - 0x31, 0x9a, 0xf4, 0x54, 0xe3, 0x7c, 0xac, 0xbf, 0x55, 0xbb, 0x83, 0xd7, 0x03, 0xb5, 0x57, 0x12, - 0x60, 0x19, 0x94, 0xb6, 0xa5, 0xde, 0x40, 0x53, 0xbb, 0xd3, 0x92, 0x08, 0x8f, 0xc0, 0x83, 0x6d, - 0x76, 0xaa, 0xbe, 0x9f, 0x9e, 0xb7, 0x87, 0xa5, 0x0c, 0x7c, 0x02, 0x1e, 0x6d, 0xd3, 0x43, 0xb5, - 0xdf, 0xee, 0x7e, 0x30, 0xda, 0xa3, 0xc1, 0x78, 0x62, 0xbc, 0xd1, 0x27, 0xe3, 0xd2, 0x97, 0xce, - 0xf0, 0xc7, 0x42, 0x16, 0x6f, 0x16, 0xb2, 0xf8, 0x6b, 0x21, 0x8b, 0x5f, 0x97, 0xb2, 0x70, 0xb3, - 0x94, 0x85, 0x9f, 0x4b, 0x59, 0xf8, 0xd8, 0x74, 0x08, 0xbf, 0x0c, 0x2d, 0x64, 0x53, 0x57, 0x21, - 0x01, 0x61, 0x1e, 0xe6, 0xf1, 0xf7, 0x32, 0xb4, 0x1a, 0x6c, 0x76, 0xd5, 0x70, 0xa8, 0xc2, 0x23, - 0x1f, 0xef, 0xbe, 0x0e, 0x56, 0x21, 0xfe, 0x0d, 0x5a, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xfa, - 0x35, 0xb3, 0x26, 0x39, 0x04, 0x00, 0x00, -} - -func (m *SignatureDescriptors) 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 *SignatureDescriptors) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptors) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor) 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 *SignatureDescriptor) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sequence != 0 { - i = encodeVarintSigning(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x18 - } - if m.Data != nil { - { - size, err := m.Data.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.PublicKey != nil { - { - size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor_Data) 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 *SignatureDescriptor_Data) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor_Data_Single_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Single_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Single != nil { - { - size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *SignatureDescriptor_Data_Multi_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Multi_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Multi != nil { - { - size, err := m.Multi.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *SignatureDescriptor_Data_Single) 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 *SignatureDescriptor_Data_Single) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Single) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintSigning(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if m.Mode != 0 { - i = encodeVarintSigning(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *SignatureDescriptor_Data_Multi) 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 *SignatureDescriptor_Data_Multi) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignatureDescriptor_Data_Multi) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Signatures[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Bitarray != nil { - { - size, err := m.Bitarray.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintSigning(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintSigning(dAtA []byte, offset int, v uint64) int { - offset -= sovSigning(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *SignatureDescriptors) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovSigning(uint64(l)) - } - } - return n -} - -func (m *SignatureDescriptor) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = m.PublicKey.Size() - n += 1 + l + sovSigning(uint64(l)) - } - if m.Data != nil { - l = m.Data.Size() - n += 1 + l + sovSigning(uint64(l)) - } - if m.Sequence != 0 { - n += 1 + sovSigning(uint64(m.Sequence)) - } - return n -} - -func (m *SignatureDescriptor_Data) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n -} - -func (m *SignatureDescriptor_Data_Single_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Single != nil { - l = m.Single.Size() - n += 1 + l + sovSigning(uint64(l)) - } - return n -} -func (m *SignatureDescriptor_Data_Multi_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Multi != nil { - l = m.Multi.Size() - n += 1 + l + sovSigning(uint64(l)) - } - return n -} -func (m *SignatureDescriptor_Data_Single) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Mode != 0 { - n += 1 + sovSigning(uint64(m.Mode)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovSigning(uint64(l)) - } - return n -} - -func (m *SignatureDescriptor_Data_Multi) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Bitarray != nil { - l = m.Bitarray.Size() - n += 1 + l + sovSigning(uint64(l)) - } - if len(m.Signatures) > 0 { - for _, e := range m.Signatures { - l = e.Size() - n += 1 + l + sovSigning(uint64(l)) - } - } - return n -} - -func sovSigning(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozSigning(x uint64) (n int) { - return sovSigning(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *SignatureDescriptors) 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 ErrIntOverflowSigning - } - 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: SignatureDescriptors: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignatureDescriptors: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, &SignatureDescriptor{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor) 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 ErrIntOverflowSigning - } - 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: SignatureDescriptor: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignatureDescriptor: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PublicKey == nil { - m.PublicKey = &types2.Any{} - } - if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &SignatureDescriptor_Data{} - } - if err := m.Data.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor_Data) 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 ErrIntOverflowSigning - } - 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: Data: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Single", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SignatureDescriptor_Data_Single{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &SignatureDescriptor_Data_Single_{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Multi", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SignatureDescriptor_Data_Multi{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &SignatureDescriptor_Data_Multi_{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor_Data_Single) 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 ErrIntOverflowSigning - } - 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: Single: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Single: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mode |= SignMode(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignatureDescriptor_Data_Multi) 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 ErrIntOverflowSigning - } - 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: Multi: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Multi: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bitarray", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Bitarray == nil { - m.Bitarray = &types1.CompactBitArray{} - } - if err := m.Bitarray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigning - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigning - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthSigning - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, &SignatureDescriptor_Data{}) - if err := m.Signatures[len(m.Signatures)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigning(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthSigning - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSigning(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, ErrIntOverflowSigning - } - 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, ErrIntOverflowSigning - } - 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, ErrIntOverflowSigning - } - 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, ErrInvalidLengthSigning - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupSigning - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthSigning - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthSigning = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSigning = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupSigning = fmt.Errorf("proto: unexpected end of group") -) diff --git a/core-sdk/types/tx/sigs.go b/core-sdk/types/tx/sigs.go deleted file mode 100644 index 22da561f..00000000 --- a/core-sdk/types/tx/sigs.go +++ /dev/null @@ -1,149 +0,0 @@ -package tx - -import ( - "fmt" - - "github.com/tendermint/tendermint/crypto" - - "github.com/irisnet/core-sdk-go/common/codec" - "github.com/irisnet/core-sdk-go/common/crypto/types" - "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -// SignatureDataToModeInfoAndSig converts a SignatureData to a ModeInfo and raw bytes signature -func SignatureDataToModeInfoAndSig(data signing.SignatureData) (*ModeInfo, []byte) { - if data == nil { - return nil, nil - } - - switch data := data.(type) { - case *signing.SingleSignatureData: - return &ModeInfo{ - Sum: &ModeInfo_Single_{ - Single: &ModeInfo_Single{Mode: data.SignMode}, - }, - }, data.Signature - case *signing.MultiSignatureData: - n := len(data.Signatures) - modeInfos := make([]*ModeInfo, n) - sigs := make([][]byte, n) - - for i, d := range data.Signatures { - modeInfos[i], sigs[i] = SignatureDataToModeInfoAndSig(d) - } - - multisig := types.MultiSignature{ - Signatures: sigs, - } - sig, err := multisig.Marshal() - if err != nil { - panic(err) - } - - return &ModeInfo{ - Sum: &ModeInfo_Multi_{ - Multi: &ModeInfo_Multi{ - Bitarray: data.BitArray, - ModeInfos: modeInfos, - }, - }, - }, sig - default: - panic(fmt.Sprintf("unexpected signature data type %T", data)) - } -} - -// ModeInfoAndSigToSignatureData converts a ModeInfo and raw bytes signature to a SignatureData or returns -// an error -func ModeInfoAndSigToSignatureData(modeInfo *ModeInfo, sig []byte) (signing.SignatureData, error) { - switch modeInfo := modeInfo.Sum.(type) { - case *ModeInfo_Single_: - return &signing.SingleSignatureData{ - SignMode: modeInfo.Single.Mode, - Signature: sig, - }, nil - - case *ModeInfo_Multi_: - multi := modeInfo.Multi - - sigs, err := decodeMultisignatures(sig) - if err != nil { - return nil, err - } - - sigv2s := make([]signing.SignatureData, len(sigs)) - for i, mi := range multi.ModeInfos { - sigv2s[i], err = ModeInfoAndSigToSignatureData(mi, sigs[i]) - if err != nil { - return nil, err - } - } - - return &signing.MultiSignatureData{ - BitArray: multi.Bitarray, - Signatures: sigv2s, - }, nil - - default: - panic(fmt.Errorf("unexpected ModeInfo data type %T", modeInfo)) - } -} - -// decodeMultisignatures safely decodes the the raw bytes as a MultiSignature protobuf message -func decodeMultisignatures(bz []byte) ([][]byte, error) { - multisig := types.MultiSignature{} - err := multisig.Unmarshal(bz) - if err != nil { - return nil, err - } - // NOTE: it is import to reject multi-signatures that contain unrecognized fields because this is an exploitable - // malleability in the protobuf message. Basically an attacker could bloat a MultiSignature message with unknown - // fields, thus bloating the transaction and causing it to fail. - if len(multisig.XXX_unrecognized) > 0 { - return nil, fmt.Errorf("rejecting unrecognized fields found in MultiSignature") - } - return multisig.Signatures, nil -} - -func (g config) MarshalSignatureJSON(sigs []signing.SignatureV2) ([]byte, error) { - descs := make([]*signing.SignatureDescriptor, len(sigs)) - - for i, sig := range sigs { - any, err := PubKeyToAny(sig.PubKey) - if err != nil { - return nil, err - } - - descData := signing.SignatureDataToProto(sig.Data) - - descs[i] = &signing.SignatureDescriptor{ - PublicKey: any, - Data: descData, - } - } - - toJSON := &signing.SignatureDescriptors{Signatures: descs} - - return codec.ProtoMarshalJSON(toJSON) -} - -func (g config) UnmarshalSignatureJSON(bz []byte) ([]signing.SignatureV2, error) { - var sigDescs signing.SignatureDescriptors - if err := g.protoCodec.UnmarshalJSON(bz, &sigDescs); err != nil { - return nil, err - } - - sigs := make([]signing.SignatureV2, len(sigDescs.Signatures)) - for i, desc := range sigDescs.Signatures { - pubKey, _ := desc.PublicKey.GetCachedValue().(crypto.PubKey) - data := signing.SignatureDataFromProto(desc.Data) - - sigs[i] = signing.SignatureV2{ - PubKey: pubKey, - Data: data, - Sequence: desc.Sequence, - } - } - - return sigs, nil -} diff --git a/core-sdk/types/tx/tx.pb.go b/core-sdk/types/tx/tx.pb.go deleted file mode 100644 index 68415d22..00000000 --- a/core-sdk/types/tx/tx.pb.go +++ /dev/null @@ -1,3107 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmos/tx/v1beta1/tx.proto - -package tx - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - types2 "github.com/irisnet/core-sdk-go/common/codec/types" - types1 "github.com/irisnet/core-sdk-go/common/crypto/types" - types "github.com/irisnet/core-sdk-go/types" - signing "github.com/irisnet/core-sdk-go/types/tx/signing" - 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 - -// Tx is the standard type used for broadcasting transactions. -type Tx struct { - // body is the processable content of the transaction - Body *TxBody `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` - // auth_info is the authorization related content of the transaction, - // specifically signers, signer modes and fee - AuthInfo *AuthInfo `protobuf:"bytes,2,opt,name=auth_info,json=authInfo,proto3" json:"auth_info,omitempty"` - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - Signatures [][]byte `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *Tx) Reset() { *m = Tx{} } -func (m *Tx) String() string { return proto.CompactTextString(m) } -func (*Tx) ProtoMessage() {} -func (*Tx) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{0} -} -func (m *Tx) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Tx.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 *Tx) XXX_Merge(src proto.Message) { - xxx_messageInfo_Tx.Merge(m, src) -} -func (m *Tx) XXX_Size() int { - return m.Size() -} -func (m *Tx) XXX_DiscardUnknown() { - xxx_messageInfo_Tx.DiscardUnknown(m) -} - -var xxx_messageInfo_Tx proto.InternalMessageInfo - -func (m *Tx) GetBody() *TxBody { - if m != nil { - return m.Body - } - return nil -} - -func (m *Tx) GetAuthInfo() *AuthInfo { - if m != nil { - return m.AuthInfo - } - return nil -} - -func (m *Tx) GetSignatures() [][]byte { - if m != nil { - return m.Signatures - } - return nil -} - -// TxRaw is a variant of Tx that pins the signer's exact binary representation -// of body and auth_info. This is used for signing, broadcasting and -// verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and -// the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used -// as the transaction ID. -type TxRaw struct { - // body_bytes is a protobuf serialization of a TxBody that matches the - // representation in SignDoc. - BodyBytes []byte `protobuf:"bytes,1,opt,name=body_bytes,json=bodyBytes,proto3" json:"body_bytes,omitempty"` - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in SignDoc. - AuthInfoBytes []byte `protobuf:"bytes,2,opt,name=auth_info_bytes,json=authInfoBytes,proto3" json:"auth_info_bytes,omitempty"` - // signatures is a list of signatures that matches the length and order of - // AuthInfo's signer_infos to allow connecting signature meta information like - // public key and signing mode by position. - Signatures [][]byte `protobuf:"bytes,3,rep,name=signatures,proto3" json:"signatures,omitempty"` -} - -func (m *TxRaw) Reset() { *m = TxRaw{} } -func (m *TxRaw) String() string { return proto.CompactTextString(m) } -func (*TxRaw) ProtoMessage() {} -func (*TxRaw) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{1} -} -func (m *TxRaw) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxRaw) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxRaw.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 *TxRaw) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxRaw.Merge(m, src) -} -func (m *TxRaw) XXX_Size() int { - return m.Size() -} -func (m *TxRaw) XXX_DiscardUnknown() { - xxx_messageInfo_TxRaw.DiscardUnknown(m) -} - -var xxx_messageInfo_TxRaw proto.InternalMessageInfo - -func (m *TxRaw) GetBodyBytes() []byte { - if m != nil { - return m.BodyBytes - } - return nil -} - -func (m *TxRaw) GetAuthInfoBytes() []byte { - if m != nil { - return m.AuthInfoBytes - } - return nil -} - -func (m *TxRaw) GetSignatures() [][]byte { - if m != nil { - return m.Signatures - } - return nil -} - -// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. -type SignDoc struct { - // body_bytes is protobuf serialization of a TxBody that matches the - // representation in TxRaw. - BodyBytes []byte `protobuf:"bytes,1,opt,name=body_bytes,json=bodyBytes,proto3" json:"body_bytes,omitempty"` - // auth_info_bytes is a protobuf serialization of an AuthInfo that matches the - // representation in TxRaw. - AuthInfoBytes []byte `protobuf:"bytes,2,opt,name=auth_info_bytes,json=authInfoBytes,proto3" json:"auth_info_bytes,omitempty"` - // chain_id is the unique identifier of the chain this transaction targets. - // It prevents signed transactions from being used on another chain by an - // attacker - ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - // account_number is the account number of the account in state - AccountNumber uint64 `protobuf:"varint,4,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty"` -} - -func (m *SignDoc) Reset() { *m = SignDoc{} } -func (m *SignDoc) String() string { return proto.CompactTextString(m) } -func (*SignDoc) ProtoMessage() {} -func (*SignDoc) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{2} -} -func (m *SignDoc) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignDoc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignDoc.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 *SignDoc) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignDoc.Merge(m, src) -} -func (m *SignDoc) XXX_Size() int { - return m.Size() -} -func (m *SignDoc) XXX_DiscardUnknown() { - xxx_messageInfo_SignDoc.DiscardUnknown(m) -} - -var xxx_messageInfo_SignDoc proto.InternalMessageInfo - -func (m *SignDoc) GetBodyBytes() []byte { - if m != nil { - return m.BodyBytes - } - return nil -} - -func (m *SignDoc) GetAuthInfoBytes() []byte { - if m != nil { - return m.AuthInfoBytes - } - return nil -} - -func (m *SignDoc) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *SignDoc) GetAccountNumber() uint64 { - if m != nil { - return m.AccountNumber - } - return 0 -} - -// TxBody is the body of a transaction that all signers sign over. -type TxBody struct { - // messages is a list of messages to be executed. The required signers of - // those messages define the number and order of elements in AuthInfo's - // signer_infos and Tx's signatures. Each required signer address is added to - // the list only the first time it occurs. - // - // By convention, the first required signer (usually from the first message) - // is referred to as the primary signer and pays the fee for the whole - // transaction. - Messages []*types2.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - // memo is any arbitrary memo to be added to the transaction - Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` - // timeout is the block height after which this transaction will not - // be processed by the chain - TimeoutHeight uint64 `protobuf:"varint,3,opt,name=timeout_height,json=timeoutHeight,proto3" json:"timeout_height,omitempty"` - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, the transaction will be rejected - ExtensionOptions []*types2.Any `protobuf:"bytes,1023,rep,name=extension_options,json=extensionOptions,proto3" json:"extension_options,omitempty"` - // extension_options are arbitrary options that can be added by chains - // when the default options are not sufficient. If any of these are present - // and can't be handled, they will be ignored - NonCriticalExtensionOptions []*types2.Any `protobuf:"bytes,2047,rep,name=non_critical_extension_options,json=nonCriticalExtensionOptions,proto3" json:"non_critical_extension_options,omitempty"` -} - -func (m *TxBody) Reset() { *m = TxBody{} } -func (m *TxBody) String() string { return proto.CompactTextString(m) } -func (*TxBody) ProtoMessage() {} -func (*TxBody) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{3} -} -func (m *TxBody) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TxBody) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TxBody.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 *TxBody) XXX_Merge(src proto.Message) { - xxx_messageInfo_TxBody.Merge(m, src) -} -func (m *TxBody) XXX_Size() int { - return m.Size() -} -func (m *TxBody) XXX_DiscardUnknown() { - xxx_messageInfo_TxBody.DiscardUnknown(m) -} - -var xxx_messageInfo_TxBody proto.InternalMessageInfo - -func (m *TxBody) GetMessages() []*types2.Any { - if m != nil { - return m.Messages - } - return nil -} - -func (m *TxBody) GetMemo() string { - if m != nil { - return m.Memo - } - return "" -} - -func (m *TxBody) GetTimeoutHeight() uint64 { - if m != nil { - return m.TimeoutHeight - } - return 0 -} - -func (m *TxBody) GetExtensionOptions() []*types2.Any { - if m != nil { - return m.ExtensionOptions - } - return nil -} - -func (m *TxBody) GetNonCriticalExtensionOptions() []*types2.Any { - if m != nil { - return m.NonCriticalExtensionOptions - } - return nil -} - -// AuthInfo describes the fee and signer modes that are used to sign a -// transaction. -type AuthInfo struct { - // signer_infos defines the signing modes for the required signers. The number - // and order of elements must match the required signers from TxBody's - // messages. The first element is the primary signer and the one which pays - // the fee. - SignerInfos []*SignerInfo `protobuf:"bytes,1,rep,name=signer_infos,json=signerInfos,proto3" json:"signer_infos,omitempty"` - // Fee is the fee and gas limit for the transaction. The first signer is the - // primary signer and the one which pays the fee. The fee can be calculated - // based on the cost of evaluating the body and doing signature verification - // of the signers. This can be estimated via simulation. - Fee *Fee `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee,omitempty"` -} - -func (m *AuthInfo) Reset() { *m = AuthInfo{} } -func (m *AuthInfo) String() string { return proto.CompactTextString(m) } -func (*AuthInfo) ProtoMessage() {} -func (*AuthInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{4} -} -func (m *AuthInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AuthInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AuthInfo.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 *AuthInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuthInfo.Merge(m, src) -} -func (m *AuthInfo) XXX_Size() int { - return m.Size() -} -func (m *AuthInfo) XXX_DiscardUnknown() { - xxx_messageInfo_AuthInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_AuthInfo proto.InternalMessageInfo - -func (m *AuthInfo) GetSignerInfos() []*SignerInfo { - if m != nil { - return m.SignerInfos - } - return nil -} - -func (m *AuthInfo) GetFee() *Fee { - if m != nil { - return m.Fee - } - return nil -} - -// SignerInfo describes the public key and signing mode of a single top-level -// signer. -type SignerInfo struct { - // public_key is the public key of the signer. It is optional for accounts - // that already exist in state. If unset, the verifier can use the required \ - // signer address for this position and lookup the public key. - PublicKey *types2.Any `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - // mode_info describes the signing mode of the signer and is a nested - // structure to support nested multisig pubkey's - ModeInfo *ModeInfo `protobuf:"bytes,2,opt,name=mode_info,json=modeInfo,proto3" json:"mode_info,omitempty"` - // sequence is the sequence of the account, which describes the - // number of committed transactions signed by a given address. It is used to - // prevent replay attacks. - Sequence uint64 `protobuf:"varint,3,opt,name=sequence,proto3" json:"sequence,omitempty"` -} - -func (m *SignerInfo) Reset() { *m = SignerInfo{} } -func (m *SignerInfo) String() string { return proto.CompactTextString(m) } -func (*SignerInfo) ProtoMessage() {} -func (*SignerInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{5} -} -func (m *SignerInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *SignerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignerInfo.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 *SignerInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_SignerInfo.Merge(m, src) -} -func (m *SignerInfo) XXX_Size() int { - return m.Size() -} -func (m *SignerInfo) XXX_DiscardUnknown() { - xxx_messageInfo_SignerInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_SignerInfo proto.InternalMessageInfo - -func (m *SignerInfo) GetPublicKey() *types2.Any { - if m != nil { - return m.PublicKey - } - return nil -} - -func (m *SignerInfo) GetModeInfo() *ModeInfo { - if m != nil { - return m.ModeInfo - } - return nil -} - -func (m *SignerInfo) GetSequence() uint64 { - if m != nil { - return m.Sequence - } - return 0 -} - -// ModeInfo describes the signing mode of a single or nested multisig signer. -type ModeInfo struct { - // sum is the oneof that specifies whether this represents a single or nested - // multisig signer - // - // Types that are valid to be assigned to Sum: - // *ModeInfo_Single_ - // *ModeInfo_Multi_ - Sum isModeInfo_Sum `protobuf_oneof:"sum"` -} - -func (m *ModeInfo) Reset() { *m = ModeInfo{} } -func (m *ModeInfo) String() string { return proto.CompactTextString(m) } -func (*ModeInfo) ProtoMessage() {} -func (*ModeInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{6} -} -func (m *ModeInfo) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModeInfo.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 *ModeInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModeInfo.Merge(m, src) -} -func (m *ModeInfo) XXX_Size() int { - return m.Size() -} -func (m *ModeInfo) XXX_DiscardUnknown() { - xxx_messageInfo_ModeInfo.DiscardUnknown(m) -} - -var xxx_messageInfo_ModeInfo proto.InternalMessageInfo - -type isModeInfo_Sum interface { - isModeInfo_Sum() - MarshalTo([]byte) (int, error) - Size() int -} - -type ModeInfo_Single_ struct { - Single *ModeInfo_Single `protobuf:"bytes,1,opt,name=single,proto3,oneof" json:"single,omitempty"` -} -type ModeInfo_Multi_ struct { - Multi *ModeInfo_Multi `protobuf:"bytes,2,opt,name=multi,proto3,oneof" json:"multi,omitempty"` -} - -func (*ModeInfo_Single_) isModeInfo_Sum() {} -func (*ModeInfo_Multi_) isModeInfo_Sum() {} - -func (m *ModeInfo) GetSum() isModeInfo_Sum { - if m != nil { - return m.Sum - } - return nil -} - -func (m *ModeInfo) GetSingle() *ModeInfo_Single { - if x, ok := m.GetSum().(*ModeInfo_Single_); ok { - return x.Single - } - return nil -} - -func (m *ModeInfo) GetMulti() *ModeInfo_Multi { - if x, ok := m.GetSum().(*ModeInfo_Multi_); ok { - return x.Multi - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*ModeInfo) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*ModeInfo_Single_)(nil), - (*ModeInfo_Multi_)(nil), - } -} - -// Single is the mode info for a single signer. It is structured as a message -// to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the -// future -type ModeInfo_Single struct { - // mode is the signing mode of the single signer - Mode signing.SignMode `protobuf:"varint,1,opt,name=mode,proto3,enum=cosmos.tx.signing.v1beta1.SignMode" json:"mode,omitempty"` -} - -func (m *ModeInfo_Single) Reset() { *m = ModeInfo_Single{} } -func (m *ModeInfo_Single) String() string { return proto.CompactTextString(m) } -func (*ModeInfo_Single) ProtoMessage() {} -func (*ModeInfo_Single) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{6, 0} -} -func (m *ModeInfo_Single) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModeInfo_Single) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModeInfo_Single.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 *ModeInfo_Single) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModeInfo_Single.Merge(m, src) -} -func (m *ModeInfo_Single) XXX_Size() int { - return m.Size() -} -func (m *ModeInfo_Single) XXX_DiscardUnknown() { - xxx_messageInfo_ModeInfo_Single.DiscardUnknown(m) -} - -var xxx_messageInfo_ModeInfo_Single proto.InternalMessageInfo - -func (m *ModeInfo_Single) GetMode() signing.SignMode { - if m != nil { - return m.Mode - } - return signing.SignMode_SIGN_MODE_UNSPECIFIED -} - -// Multi is the mode info for a multisig public key -type ModeInfo_Multi struct { - // bitarray specifies which keys within the multisig are signing - Bitarray *types1.CompactBitArray `protobuf:"bytes,1,opt,name=bitarray,proto3" json:"bitarray,omitempty"` - // mode_infos is the corresponding modes of the signers of the multisig - // which could include nested multisig public keys - ModeInfos []*ModeInfo `protobuf:"bytes,2,rep,name=mode_infos,json=modeInfos,proto3" json:"mode_infos,omitempty"` -} - -func (m *ModeInfo_Multi) Reset() { *m = ModeInfo_Multi{} } -func (m *ModeInfo_Multi) String() string { return proto.CompactTextString(m) } -func (*ModeInfo_Multi) ProtoMessage() {} -func (*ModeInfo_Multi) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{6, 1} -} -func (m *ModeInfo_Multi) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ModeInfo_Multi) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ModeInfo_Multi.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 *ModeInfo_Multi) XXX_Merge(src proto.Message) { - xxx_messageInfo_ModeInfo_Multi.Merge(m, src) -} -func (m *ModeInfo_Multi) XXX_Size() int { - return m.Size() -} -func (m *ModeInfo_Multi) XXX_DiscardUnknown() { - xxx_messageInfo_ModeInfo_Multi.DiscardUnknown(m) -} - -var xxx_messageInfo_ModeInfo_Multi proto.InternalMessageInfo - -func (m *ModeInfo_Multi) GetBitarray() *types1.CompactBitArray { - if m != nil { - return m.Bitarray - } - return nil -} - -func (m *ModeInfo_Multi) GetModeInfos() []*ModeInfo { - if m != nil { - return m.ModeInfos - } - return nil -} - -// Fee includes the amount of coins paid in fees and the maximum -// gas to be used by the transaction. The ratio yields an effective "gasprice", -// which must be above some miminum to be accepted into the mempool. -type Fee struct { - // amount is the amount of coins to be paid as a fee - Amount types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/irisnet/core-sdk-go/types.Coins" json:"amount"` - // gas_limit is the maximum gas that can be used in transaction processing - // before an out of gas error occurs - GasLimit uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` - // if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. - // the payer must be a tx signer (and thus have signed this field in AuthInfo). - // setting this field does *not* change the ordering of required signers for the transaction. - Payer string `protobuf:"bytes,3,opt,name=payer,proto3" json:"payer,omitempty"` - // if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used - // to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does - // not support fee grants, this will fail - Granter string `protobuf:"bytes,4,opt,name=granter,proto3" json:"granter,omitempty"` -} - -func (m *Fee) Reset() { *m = Fee{} } -func (m *Fee) String() string { return proto.CompactTextString(m) } -func (*Fee) ProtoMessage() {} -func (*Fee) Descriptor() ([]byte, []int) { - return fileDescriptor_96d1575ffde80842, []int{7} -} -func (m *Fee) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Fee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Fee.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 *Fee) XXX_Merge(src proto.Message) { - xxx_messageInfo_Fee.Merge(m, src) -} -func (m *Fee) XXX_Size() int { - return m.Size() -} -func (m *Fee) XXX_DiscardUnknown() { - xxx_messageInfo_Fee.DiscardUnknown(m) -} - -var xxx_messageInfo_Fee proto.InternalMessageInfo - -func (m *Fee) GetAmount() types.Coins { - if m != nil { - return m.Amount - } - return nil -} - -func (m *Fee) GetGasLimit() uint64 { - if m != nil { - return m.GasLimit - } - return 0 -} - -func (m *Fee) GetPayer() string { - if m != nil { - return m.Payer - } - return "" -} - -func (m *Fee) GetGranter() string { - if m != nil { - return m.Granter - } - return "" -} - -func init() { - proto.RegisterType((*Tx)(nil), "cosmos.tx.v1beta1.Tx") - proto.RegisterType((*TxRaw)(nil), "cosmos.tx.v1beta1.TxRaw") - proto.RegisterType((*SignDoc)(nil), "cosmos.tx.v1beta1.SignDoc") - proto.RegisterType((*TxBody)(nil), "cosmos.tx.v1beta1.TxBody") - proto.RegisterType((*AuthInfo)(nil), "cosmos.tx.v1beta1.AuthInfo") - proto.RegisterType((*SignerInfo)(nil), "cosmos.tx.v1beta1.SignerInfo") - proto.RegisterType((*ModeInfo)(nil), "cosmos.tx.v1beta1.ModeInfo") - proto.RegisterType((*ModeInfo_Single)(nil), "cosmos.tx.v1beta1.ModeInfo.Single") - proto.RegisterType((*ModeInfo_Multi)(nil), "cosmos.tx.v1beta1.ModeInfo.Multi") - proto.RegisterType((*Fee)(nil), "cosmos.tx.v1beta1.Fee") -} - -func init() { proto.RegisterFile("cosmos/tx/v1beta1/tx.proto", fileDescriptor_96d1575ffde80842) } - -var fileDescriptor_96d1575ffde80842 = []byte{ - // 851 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xdd, 0x6e, 0xdc, 0x44, - 0x14, 0x5e, 0xef, 0x5f, 0x76, 0x4f, 0x92, 0x96, 0x8e, 0x22, 0xb4, 0xd9, 0xa8, 0x6e, 0x58, 0x04, - 0xac, 0x90, 0xd6, 0xa6, 0xa9, 0x10, 0x3f, 0xe2, 0x82, 0x6c, 0x4b, 0x95, 0xaa, 0x14, 0xa4, 0x49, - 0xae, 0x7a, 0x63, 0x8d, 0xbd, 0x13, 0x7b, 0xd4, 0xf5, 0xcc, 0xe2, 0x19, 0x17, 0xfb, 0x21, 0x90, - 0x2a, 0x24, 0xc4, 0x3b, 0xf0, 0x0c, 0x3c, 0x40, 0x2f, 0x7b, 0xc9, 0x15, 0x44, 0xc9, 0x83, 0x80, - 0x66, 0x3c, 0x76, 0x22, 0x58, 0x25, 0x5c, 0xf4, 0xca, 0x73, 0xce, 0x7c, 0xe7, 0x9b, 0xcf, 0xe7, - 0x0f, 0xc6, 0x91, 0x90, 0xa9, 0x90, 0xbe, 0x2a, 0xfc, 0x97, 0xf7, 0x43, 0xaa, 0xc8, 0x7d, 0x5f, - 0x15, 0xde, 0x2a, 0x13, 0x4a, 0xa0, 0x3b, 0xd5, 0x9d, 0xa7, 0x0a, 0xcf, 0xde, 0x8d, 0x77, 0x62, - 0x11, 0x0b, 0x73, 0xeb, 0xeb, 0x53, 0x05, 0x1c, 0xcf, 0x2c, 0x49, 0x94, 0x95, 0x2b, 0x25, 0xfc, - 0x34, 0x5f, 0x2a, 0x26, 0x59, 0xdc, 0x30, 0xd6, 0x0e, 0x0b, 0x77, 0x2d, 0x3c, 0x24, 0x92, 0x36, - 0x98, 0x48, 0x30, 0x6e, 0xef, 0x3f, 0xba, 0xd4, 0x24, 0x59, 0xcc, 0x19, 0xbf, 0x64, 0xb2, 0xb6, - 0x05, 0xee, 0xc6, 0x42, 0xc4, 0x4b, 0xea, 0x1b, 0x2b, 0xcc, 0x4f, 0x7d, 0xc2, 0xcb, 0xea, 0x6a, - 0xf2, 0x93, 0x03, 0xed, 0x93, 0x02, 0xcd, 0xa0, 0x1b, 0x8a, 0x45, 0x39, 0x72, 0xf6, 0x9d, 0xe9, - 0xe6, 0xc1, 0xae, 0xf7, 0x9f, 0x3f, 0xf2, 0x4e, 0x8a, 0xb9, 0x58, 0x94, 0xd8, 0xc0, 0xd0, 0xe7, - 0x30, 0x24, 0xb9, 0x4a, 0x02, 0xc6, 0x4f, 0xc5, 0xa8, 0x6d, 0x62, 0xf6, 0xd6, 0xc4, 0x1c, 0xe6, - 0x2a, 0x79, 0xc2, 0x4f, 0x05, 0x1e, 0x10, 0x7b, 0x42, 0x2e, 0x80, 0xd6, 0x46, 0x54, 0x9e, 0x51, - 0x39, 0xea, 0xec, 0x77, 0xa6, 0x5b, 0xf8, 0x8a, 0x67, 0xc2, 0xa1, 0x77, 0x52, 0x60, 0xf2, 0x23, - 0xba, 0x0b, 0xa0, 0x9f, 0x0a, 0xc2, 0x52, 0x51, 0x69, 0x74, 0x6d, 0xe1, 0xa1, 0xf6, 0xcc, 0xb5, - 0x03, 0x7d, 0x08, 0xb7, 0x1b, 0x05, 0x16, 0xd3, 0x36, 0x98, 0xed, 0xfa, 0xa9, 0x0a, 0x77, 0xd3, - 0x7b, 0x3f, 0x3b, 0xb0, 0x71, 0xcc, 0x62, 0xfe, 0x48, 0x44, 0x6f, 0xeb, 0xc9, 0x5d, 0x18, 0x44, - 0x09, 0x61, 0x3c, 0x60, 0x8b, 0x51, 0x67, 0xdf, 0x99, 0x0e, 0xf1, 0x86, 0xb1, 0x9f, 0x2c, 0xd0, - 0x07, 0x70, 0x8b, 0x44, 0x91, 0xc8, 0xb9, 0x0a, 0x78, 0x9e, 0x86, 0x34, 0x1b, 0x75, 0xf7, 0x9d, - 0x69, 0x17, 0x6f, 0x5b, 0xef, 0x77, 0xc6, 0x39, 0xf9, 0xa5, 0x0d, 0xfd, 0x2a, 0xdf, 0xe8, 0x13, - 0x18, 0xa4, 0x54, 0x4a, 0x12, 0x1b, 0x45, 0x9d, 0xe9, 0xe6, 0xc1, 0x8e, 0x57, 0x55, 0xd3, 0xab, - 0xab, 0xe9, 0x1d, 0xf2, 0x12, 0x37, 0x28, 0x84, 0xa0, 0x9b, 0xd2, 0xb4, 0x2a, 0xcb, 0x10, 0x9b, - 0xb3, 0x7e, 0x57, 0xb1, 0x94, 0x8a, 0x5c, 0x05, 0x09, 0x65, 0x71, 0xa2, 0x8c, 0xb0, 0x2e, 0xde, - 0xb6, 0xde, 0x23, 0xe3, 0x44, 0x73, 0xb8, 0x43, 0x0b, 0x45, 0xb9, 0x64, 0x82, 0x07, 0x62, 0xa5, - 0x98, 0xe0, 0x72, 0xf4, 0xf7, 0xc6, 0x35, 0xcf, 0xbe, 0xd3, 0xe0, 0xbf, 0xaf, 0xe0, 0xe8, 0x39, - 0xb8, 0x5c, 0xf0, 0x20, 0xca, 0x98, 0x62, 0x11, 0x59, 0x06, 0x6b, 0x08, 0x6f, 0x5f, 0x43, 0xb8, - 0xc7, 0x05, 0x7f, 0x68, 0x63, 0xbf, 0xf9, 0x17, 0xf7, 0xe4, 0x25, 0x0c, 0xea, 0x96, 0x42, 0x5f, - 0xc3, 0x96, 0x2e, 0x23, 0xcd, 0x4c, 0x3d, 0xea, 0xe4, 0xdc, 0x5d, 0xd3, 0x85, 0xc7, 0x06, 0x66, - 0xfa, 0x70, 0x53, 0x36, 0x67, 0x89, 0xa6, 0xd0, 0x39, 0xa5, 0xd4, 0xb6, 0xef, 0xbb, 0x6b, 0x02, - 0x1f, 0x53, 0x8a, 0x35, 0x64, 0xf2, 0xab, 0x03, 0x70, 0xc9, 0x82, 0x1e, 0x00, 0xac, 0xf2, 0x70, - 0xc9, 0xa2, 0xe0, 0x05, 0xad, 0x47, 0x66, 0xfd, 0xdf, 0x0c, 0x2b, 0xdc, 0x53, 0x6a, 0x46, 0x26, - 0x15, 0x0b, 0x7a, 0xd3, 0xc8, 0x3c, 0x13, 0x0b, 0x5a, 0x8d, 0x4c, 0x6a, 0x4f, 0x68, 0x0c, 0x03, - 0x49, 0x7f, 0xc8, 0x29, 0x8f, 0xa8, 0x2d, 0x5b, 0x63, 0x4f, 0xce, 0xda, 0x30, 0xa8, 0x43, 0xd0, - 0x57, 0xd0, 0x97, 0x8c, 0xc7, 0x4b, 0x6a, 0x35, 0x4d, 0xae, 0xe1, 0xf7, 0x8e, 0x0d, 0xf2, 0xa8, - 0x85, 0x6d, 0x0c, 0xfa, 0x02, 0x7a, 0x66, 0xff, 0x58, 0x71, 0xef, 0x5d, 0x17, 0xfc, 0x4c, 0x03, - 0x8f, 0x5a, 0xb8, 0x8a, 0x18, 0x1f, 0x42, 0xbf, 0xa2, 0x43, 0x9f, 0x41, 0x57, 0xeb, 0x36, 0x02, - 0x6e, 0x1d, 0xbc, 0x7f, 0x85, 0xa3, 0xde, 0x48, 0x57, 0xab, 0xa2, 0xf9, 0xb0, 0x09, 0x18, 0xbf, - 0x72, 0xa0, 0x67, 0x58, 0xd1, 0x53, 0x18, 0x84, 0x4c, 0x91, 0x2c, 0x23, 0x75, 0x6e, 0xfd, 0x9a, - 0xa6, 0xda, 0x9b, 0x5e, 0xb3, 0x26, 0x6b, 0xae, 0x87, 0x22, 0x5d, 0x91, 0x48, 0xcd, 0x99, 0x3a, - 0xd4, 0x61, 0xb8, 0x21, 0x40, 0x5f, 0x02, 0x34, 0x59, 0xd7, 0xe3, 0xda, 0xb9, 0x29, 0xed, 0xc3, - 0x3a, 0xed, 0x72, 0xde, 0x83, 0x8e, 0xcc, 0xd3, 0xc9, 0xef, 0x0e, 0x74, 0x1e, 0x53, 0x8a, 0x12, - 0xe8, 0x93, 0x54, 0x0f, 0xa9, 0x6d, 0xb5, 0x66, 0x49, 0xea, 0xf5, 0x7c, 0x45, 0x0a, 0xe3, 0xf3, - 0x4f, 0x5f, 0xff, 0x79, 0xaf, 0xf5, 0xdb, 0x5f, 0xf7, 0x66, 0x31, 0x53, 0x49, 0x1e, 0x7a, 0x91, - 0x48, 0x7d, 0x96, 0x31, 0xc9, 0xa9, 0x32, 0xdf, 0x24, 0x0f, 0x67, 0x72, 0xf1, 0x62, 0x16, 0x0b, - 0x5f, 0x95, 0x2b, 0x2a, 0x4d, 0x94, 0xc4, 0x96, 0x1f, 0xed, 0xc1, 0x30, 0x26, 0x32, 0x58, 0xb2, - 0x94, 0x29, 0x53, 0x8d, 0x2e, 0x1e, 0xc4, 0x44, 0x7e, 0xab, 0x6d, 0xb4, 0x03, 0xbd, 0x15, 0x29, - 0x69, 0x66, 0x57, 0x4b, 0x65, 0xa0, 0x11, 0x6c, 0xc4, 0x19, 0xe1, 0xca, 0x6e, 0x94, 0x21, 0xae, - 0xcd, 0xf9, 0xa3, 0xd7, 0xe7, 0xae, 0xf3, 0xe6, 0xdc, 0x75, 0xce, 0xce, 0x5d, 0xe7, 0xd5, 0x85, - 0xdb, 0x7a, 0x73, 0xe1, 0xb6, 0xfe, 0xb8, 0x70, 0x5b, 0xcf, 0x3f, 0xfe, 0x9f, 0xea, 0x7c, 0x55, - 0x84, 0x7d, 0xd3, 0xd6, 0x0f, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0xde, 0xe7, 0xdb, 0x7e, 0x07, - 0x07, 0x00, 0x00, -} - -func (m *Tx) 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 *Tx) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Tx) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Signatures[iNdEx]) - copy(dAtA[i:], m.Signatures[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signatures[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if m.AuthInfo != nil { - { - size, err := m.AuthInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Body != nil { - { - size, err := m.Body.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TxRaw) 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 *TxRaw) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxRaw) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signatures) > 0 { - for iNdEx := len(m.Signatures) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Signatures[iNdEx]) - copy(dAtA[i:], m.Signatures[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signatures[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.AuthInfoBytes) > 0 { - i -= len(m.AuthInfoBytes) - copy(dAtA[i:], m.AuthInfoBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.AuthInfoBytes))) - i-- - dAtA[i] = 0x12 - } - if len(m.BodyBytes) > 0 { - i -= len(m.BodyBytes) - copy(dAtA[i:], m.BodyBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.BodyBytes))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SignDoc) 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 *SignDoc) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignDoc) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AccountNumber != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.AccountNumber)) - i-- - dAtA[i] = 0x20 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0x1a - } - if len(m.AuthInfoBytes) > 0 { - i -= len(m.AuthInfoBytes) - copy(dAtA[i:], m.AuthInfoBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.AuthInfoBytes))) - i-- - dAtA[i] = 0x12 - } - if len(m.BodyBytes) > 0 { - i -= len(m.BodyBytes) - copy(dAtA[i:], m.BodyBytes) - i = encodeVarintTx(dAtA, i, uint64(len(m.BodyBytes))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TxBody) 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 *TxBody) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TxBody) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NonCriticalExtensionOptions) > 0 { - for iNdEx := len(m.NonCriticalExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.NonCriticalExtensionOptions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x7f - i-- - dAtA[i] = 0xfa - } - } - if len(m.ExtensionOptions) > 0 { - for iNdEx := len(m.ExtensionOptions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ExtensionOptions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3f - i-- - dAtA[i] = 0xfa - } - } - if m.TimeoutHeight != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.TimeoutHeight)) - i-- - dAtA[i] = 0x18 - } - if len(m.Memo) > 0 { - i -= len(m.Memo) - copy(dAtA[i:], m.Memo) - i = encodeVarintTx(dAtA, i, uint64(len(m.Memo))) - i-- - dAtA[i] = 0x12 - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *AuthInfo) 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 *AuthInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AuthInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Fee != nil { - { - size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.SignerInfos) > 0 { - for iNdEx := len(m.SignerInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SignerInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SignerInfo) 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 *SignerInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *SignerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sequence != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Sequence)) - i-- - dAtA[i] = 0x18 - } - if m.ModeInfo != nil { - { - size, err := m.ModeInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.PublicKey != nil { - { - size, err := m.PublicKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ModeInfo) 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 *ModeInfo) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Sum != nil { - { - size := m.Sum.Size() - i -= size - if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *ModeInfo_Single_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Single_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Single != nil { - { - size, err := m.Single.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *ModeInfo_Multi_) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Multi_) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Multi != nil { - { - size, err := m.Multi.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *ModeInfo_Single) 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 *ModeInfo_Single) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Single) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Mode != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Mode)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ModeInfo_Multi) 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 *ModeInfo_Multi) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ModeInfo_Multi) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ModeInfos) > 0 { - for iNdEx := len(m.ModeInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ModeInfos[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Bitarray != nil { - { - size, err := m.Bitarray.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Fee) 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 *Fee) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Fee) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Granter) > 0 { - i -= len(m.Granter) - copy(dAtA[i:], m.Granter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Granter))) - i-- - dAtA[i] = 0x22 - } - if len(m.Payer) > 0 { - i -= len(m.Payer) - copy(dAtA[i:], m.Payer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Payer))) - i-- - dAtA[i] = 0x1a - } - if m.GasLimit != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.GasLimit)) - i-- - dAtA[i] = 0x10 - } - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func 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 *Tx) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Body != nil { - l = m.Body.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.AuthInfo != nil { - l = m.AuthInfo.Size() - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - l = len(b) - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *TxRaw) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BodyBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.AuthInfoBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - l = len(b) - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *SignDoc) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BodyBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.AuthInfoBytes) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.AccountNumber != 0 { - n += 1 + sovTx(uint64(m.AccountNumber)) - } - return n -} - -func (m *TxBody) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Memo) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.TimeoutHeight != 0 { - n += 1 + sovTx(uint64(m.TimeoutHeight)) - } - if len(m.ExtensionOptions) > 0 { - for _, e := range m.ExtensionOptions { - l = e.Size() - n += 2 + l + sovTx(uint64(l)) - } - } - if len(m.NonCriticalExtensionOptions) > 0 { - for _, e := range m.NonCriticalExtensionOptions { - l = e.Size() - n += 2 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *AuthInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SignerInfos) > 0 { - for _, e := range m.SignerInfos { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.Fee != nil { - l = m.Fee.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *SignerInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublicKey != nil { - l = m.PublicKey.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.ModeInfo != nil { - l = m.ModeInfo.Size() - n += 1 + l + sovTx(uint64(l)) - } - if m.Sequence != 0 { - n += 1 + sovTx(uint64(m.Sequence)) - } - return n -} - -func (m *ModeInfo) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sum != nil { - n += m.Sum.Size() - } - return n -} - -func (m *ModeInfo_Single_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Single != nil { - l = m.Single.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} -func (m *ModeInfo_Multi_) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Multi != nil { - l = m.Multi.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} -func (m *ModeInfo_Single) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Mode != 0 { - n += 1 + sovTx(uint64(m.Mode)) - } - return n -} - -func (m *ModeInfo_Multi) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Bitarray != nil { - l = m.Bitarray.Size() - n += 1 + l + sovTx(uint64(l)) - } - if len(m.ModeInfos) > 0 { - for _, e := range m.ModeInfos { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *Fee) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if m.GasLimit != 0 { - n += 1 + sovTx(uint64(m.GasLimit)) - } - l = len(m.Payer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Granter) - if l > 0 { - n += 1 + l + sovTx(uint64(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 *Tx) 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: Tx: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Tx: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Body == nil { - m.Body = &TxBody{} - } - if err := m.Body.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AuthInfo == nil { - m.AuthInfo = &AuthInfo{} - } - if err := m.AuthInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var 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.Signatures = append(m.Signatures, make([]byte, postIndex-iNdEx)) - copy(m.Signatures[len(m.Signatures)-1], 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 *TxRaw) 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: TxRaw: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxRaw: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodyBytes", 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.BodyBytes = append(m.BodyBytes[:0], dAtA[iNdEx:postIndex]...) - if m.BodyBytes == nil { - m.BodyBytes = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthInfoBytes", 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.AuthInfoBytes = append(m.AuthInfoBytes[:0], dAtA[iNdEx:postIndex]...) - if m.AuthInfoBytes == nil { - m.AuthInfoBytes = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", 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.Signatures = append(m.Signatures, make([]byte, postIndex-iNdEx)) - copy(m.Signatures[len(m.Signatures)-1], 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 *SignDoc) 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: SignDoc: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignDoc: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BodyBytes", 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.BodyBytes = append(m.BodyBytes[:0], dAtA[iNdEx:postIndex]...) - if m.BodyBytes == nil { - m.BodyBytes = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthInfoBytes", 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.AuthInfoBytes = append(m.AuthInfoBytes[:0], dAtA[iNdEx:postIndex]...) - if m.AuthInfoBytes == nil { - m.AuthInfoBytes = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", 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.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AccountNumber", wireType) - } - m.AccountNumber = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AccountNumber |= uint64(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 *TxBody) 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: TxBody: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TxBody: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, &types2.Any{}) - if err := m.Messages[len(m.Messages)-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 Memo", 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.Memo = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TimeoutHeight |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 1023: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExtensionOptions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExtensionOptions = append(m.ExtensionOptions, &types2.Any{}) - if err := m.ExtensionOptions[len(m.ExtensionOptions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2047: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NonCriticalExtensionOptions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NonCriticalExtensionOptions = append(m.NonCriticalExtensionOptions, &types2.Any{}) - if err := m.NonCriticalExtensionOptions[len(m.NonCriticalExtensionOptions)-1].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 *AuthInfo) 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: AuthInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AuthInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignerInfos", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignerInfos = append(m.SignerInfos, &SignerInfo{}) - if err := m.SignerInfos[len(m.SignerInfos)-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 Fee", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Fee == nil { - m.Fee = &Fee{} - } - if err := m.Fee.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 *SignerInfo) 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: SignerInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignerInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PublicKey == nil { - m.PublicKey = &types2.Any{} - } - if err := m.PublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModeInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ModeInfo == nil { - m.ModeInfo = &ModeInfo{} - } - if err := m.ModeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sequence", wireType) - } - m.Sequence = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Sequence |= uint64(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 *ModeInfo) 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: ModeInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ModeInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Single", 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 - } - v := &ModeInfo_Single{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &ModeInfo_Single_{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Multi", 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 - } - v := &ModeInfo_Multi{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Sum = &ModeInfo_Multi_{v} - 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 *ModeInfo_Single) 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: Single: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Single: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mode", wireType) - } - m.Mode = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mode |= signing.SignMode(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 *ModeInfo_Multi) 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: Multi: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Multi: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bitarray", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Bitarray == nil { - m.Bitarray = &types1.CompactBitArray{} - } - if err := m.Bitarray.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ModeInfos", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ModeInfos = append(m.ModeInfos, &ModeInfo{}) - if err := m.ModeInfos[len(m.ModeInfos)-1].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 *Fee) 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: Fee: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Fee: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) - } - m.GasLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.GasLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payer", 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.Payer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Granter", 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.Granter = 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 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/core-sdk/types/tx/types.go b/core-sdk/types/tx/types.go deleted file mode 100644 index 033cf53a..00000000 --- a/core-sdk/types/tx/types.go +++ /dev/null @@ -1,121 +0,0 @@ -package tx - -import ( - "errors" - "fmt" - - "github.com/irisnet/core-sdk-go/common/codec/types" - - sdk "github.com/irisnet/core-sdk-go/types" -) - -// MaxGasWanted defines the max gas allowed. -const MaxGasWanted = uint64((1 << 63) - 1) - -var _, _ types.UnpackInterfacesMessage = &Tx{}, &TxBody{} -var _ sdk.Tx = &Tx{} - -// GetMsgs implements the GetMsgs method on sdk.Tx. -func (t *Tx) GetMsgs() []sdk.Msg { - if t == nil || t.Body == nil { - return nil - } - - anys := t.Body.Messages - res := make([]sdk.Msg, len(anys)) - for i, any := range anys { - msg := any.GetCachedValue().(sdk.Msg) - res[i] = msg - } - return res -} - -// ValidateBasic implements the ValidateBasic method on sdk.Tx. -func (t *Tx) ValidateBasic() error { - if t == nil { - return fmt.Errorf("bad Tx") - } - - body := t.Body - if body == nil { - return fmt.Errorf("missing TxBody") - } - - authInfo := t.AuthInfo - if authInfo == nil { - return fmt.Errorf("missing AuthInfo") - } - - fee := authInfo.Fee - if fee == nil { - return fmt.Errorf("missing fee") - } - - if fee.GasLimit > MaxGasWanted { - return fmt.Errorf( - "invalid gas supplied; %d > %d", fee.GasLimit, MaxGasWanted, - ) - } - - if fee.Amount.IsAnyNegative() { - return fmt.Errorf( - "invalid fee provided: %s", fee.Amount, - ) - } - - sigs := t.Signatures - - if len(sigs) == 0 { - return errors.New("no signatures supplied") - } - - if len(sigs) != len(t.GetSigners()) { - return fmt.Errorf( - "wrong number of signers; expected %d, got %d", t.GetSigners(), len(sigs), - ) - } - - return nil -} - -// GetSigners retrieves all the signers of a tx. -func (t *Tx) GetSigners() []sdk.AccAddress { - var signers []sdk.AccAddress - seen := map[string]bool{} - - for _, msg := range t.GetMsgs() { - for _, addr := range msg.GetSigners() { - if !seen[addr.String()] { - signers = append(signers, addr) - seen[addr.String()] = true - } - } - } - - return signers -} - -// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (t *Tx) UnpackInterfaces(unpacker types.AnyUnpacker) error { - if t.Body != nil { - return t.Body.UnpackInterfaces(unpacker) - } - return nil -} - -// UnpackInterfaces implements the UnpackInterfaceMessages.UnpackInterfaces method -func (m *TxBody) UnpackInterfaces(unpacker types.AnyUnpacker) error { - for _, any := range m.Messages { - var msg sdk.Msg - if err := unpacker.UnpackAny(any, &msg); err != nil { - return err - } - } - return nil -} - -// RegisterInterfaces registers the sdk.Tx interface. -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterInterface("cosmos.tx.v1beta1.Tx", (*sdk.Tx)(nil)) - registry.RegisterImplementations((*sdk.Tx)(nil), &Tx{}) -} diff --git a/core-sdk/types/tx_config.go b/core-sdk/types/tx_config.go deleted file mode 100644 index f530eedd..00000000 --- a/core-sdk/types/tx_config.go +++ /dev/null @@ -1,44 +0,0 @@ -package types - -import ( - signingtypes "github.com/irisnet/core-sdk-go/types/tx/signing" -) - -type ( - // TxBuilder defines an interface which an application-defined concrete transaction - // type must implement. Namely, it must be able to set messages, generate - // signatures, and provide canonical bytes to sign over. The transaction must - // also know how to encode itself. - TxBuilder interface { - GetTx() Tx - - SetMsgs(msgs ...Msg) error - SetSignatures(signatures ...signingtypes.SignatureV2) error - SetMemo(memo string) - SetFeeAmount(amount Coins) - SetGasLimit(limit uint64) - SetTimeoutHeight(height uint64) - } - - // TxEncodingConfig defines an interface that contains transaction - // encoders and decoders - TxEncodingConfig interface { - TxEncoder() TxEncoder - TxDecoder() TxDecoder - TxJSONEncoder() TxEncoder - TxJSONDecoder() TxDecoder - MarshalSignatureJSON([]signingtypes.SignatureV2) ([]byte, error) - UnmarshalSignatureJSON([]byte) ([]signingtypes.SignatureV2, error) - } - - // TxConfig defines an interface a client can utilize to generate an - // application-defined concrete transaction type. The type returned must - // implement TxBuilder. - TxConfig interface { - TxEncodingConfig - - NewTxBuilder() TxBuilder - WrapTxBuilder(Tx) (TxBuilder, error) - SignModeHandler() SignModeHandler - } -) diff --git a/core-sdk/types/tx_msg.go b/core-sdk/types/tx_msg.go deleted file mode 100644 index e75b7b6a..00000000 --- a/core-sdk/types/tx_msg.go +++ /dev/null @@ -1,87 +0,0 @@ -package types - -import ( - "github.com/gogo/protobuf/proto" - - "github.com/tendermint/tendermint/crypto" -) - -type ( - // Msg defines the interface a transaction message must fulfill. - Msg interface { - proto.Message - - // Return the message type. - // Must be alphanumeric or empty. - Route() string - - // Returns a human-readable string for the message, intended for utilization - // within tags - Type() string - - // ValidateBasic does a simple validation check that - // doesn't require access to any other information. - ValidateBasic() error - - // Get the canonical byte representation of the Msg. - GetSignBytes() []byte - - // Signers returns the addrs of signers that must sign. - // CONTRACT: All signatures must be present to be valid. - // CONTRACT: Returns addrs in some deterministic order. - GetSigners() []AccAddress - } - - // Fee defines an interface for an application application-defined concrete - // transaction type to be able to set and return the transaction fee. - Fee interface { - GetGas() uint64 - GetAmount() Coins - } - - // Signature defines an interface for an application application-defined - // concrete transaction type to be able to set and return transaction signatures. - Signature interface { - GetPubKey() crypto.PubKey - GetSignature() []byte - } - - // Tx defines the interface a transaction must fulfill. - Tx interface { - // Gets the all the transaction's messages. - GetMsgs() []Msg - - // ValidateBasic does a simple and lightweight validation check that doesn't - // require access to any other information. - ValidateBasic() error - } - - // FeeTx defines the interface to be implemented by Tx to use the FeeDecorators - FeeTx interface { - Tx - GetGas() uint64 - GetFee() Coins - FeePayer() AccAddress - FeeGranter() AccAddress - } - - // Tx must have GetMemo() method to use ValidateMemoDecorator - TxWithMemo interface { - Tx - GetMemo() string - } - - // TxWithTimeoutHeight extends the Tx interface by allowing a transaction to - // set a height timeout. - TxWithTimeoutHeight interface { - Tx - - GetTimeoutHeight() uint64 - } -) - -// TxDecoder unmarshals transaction bytes -type TxDecoder func(txBytes []byte) (Tx, error) - -// TxEncoder marshals transaction to bytes -type TxEncoder func(tx Tx) ([]byte, error) diff --git a/core-sdk/types/utils.go b/core-sdk/types/utils.go deleted file mode 100644 index 7cc3347f..00000000 --- a/core-sdk/types/utils.go +++ /dev/null @@ -1,75 +0,0 @@ -package types - -import ( - "encoding/binary" - "encoding/json" - "time" -) - -// SortedJSON takes any JSON and returns it sorted by keys. Also, all white-spaces -// are removed. -// This method can be used to canonicalize JSON to be returned by GetSignBytes, -// e.g. for the ledger integration. -// If the passed JSON isn't valid it will return an error. -func SortJSON(toSortJSON []byte) ([]byte, error) { - var c interface{} - if err := json.Unmarshal(toSortJSON, &c); err != nil { - return nil, err - } - return json.Marshal(c) -} - -// MustSortJSON is like SortJSON but panic if an error occurs, e.g., if -// the passed JSON isn't valid. -func MustSortJSON(toSortJSON []byte) []byte { - js, err := SortJSON(toSortJSON) - if err != nil { - panic(err) - } - return js -} - -// Uint64ToBigEndian - marshals uint64 to a bigendian byte slice so it can be sorted -func Uint64ToBigEndian(i uint64) []byte { - b := make([]byte, 8) - binary.BigEndian.PutUint64(b, i) - return b -} - -// BigEndianToUint64 returns an uint64 from big endian encoded bytes. If encoding -// is empty, zero is returned. -func BigEndianToUint64(bz []byte) uint64 { - if len(bz) == 0 { - return 0 - } - - return binary.BigEndian.Uint64(bz) -} - -// Slight modification of the RFC3339Nano but it right pads all zeros and drops the time zone info -const SortableTimeFormat = "2006-01-02T15:04:05.000000000" - -// Formats a time.Time into a []byte that can be sorted -func FormatTimeBytes(t time.Time) []byte { - return []byte(t.UTC().Round(0).Format(SortableTimeFormat)) -} - -// Parses a []byte encoded using FormatTimeKey back into a time.Time -func ParseTimeBytes(bz []byte) (time.Time, error) { - str := string(bz) - t, err := time.Parse(SortableTimeFormat, str) - if err != nil { - return t, err - } - return t.UTC().Round(0), nil -} - -// copy bytes -func CopyBytes(bz []byte) (ret []byte) { - if bz == nil { - return nil - } - ret = make([]byte, len(bz)) - copy(ret, bz) - return ret -} From c631516f1f662704332c57842587f8f3296f1aac Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 19 Jul 2021 11:51:24 +0800 Subject: [PATCH 39/41] fix go mod --- module-sdk/coinswap/go.mod | 2 +- module-sdk/coinswap/go.sum | 4 ++-- module-sdk/gov/go.mod | 2 +- module-sdk/gov/go.sum | 4 ++-- module-sdk/htlc/go.mod | 2 +- module-sdk/htlc/go.sum | 4 ++-- module-sdk/integration_test/go.mod | 2 +- module-sdk/integration_test/go.sum | 5 ++--- module-sdk/nft/go.mod | 2 +- module-sdk/nft/go.sum | 4 ++-- module-sdk/oracle/go.mod | 2 +- module-sdk/oracle/go.sum | 4 ++-- module-sdk/random/go.mod | 2 +- module-sdk/random/go.sum | 4 ++-- module-sdk/record/go.mod | 2 +- module-sdk/record/go.sum | 4 ++-- module-sdk/service/go.mod | 2 +- module-sdk/service/go.sum | 4 ++-- module-sdk/staking/go.mod | 2 +- module-sdk/staking/go.sum | 4 ++-- module-sdk/token/go.mod | 2 +- module-sdk/token/go.sum | 4 ++-- 22 files changed, 33 insertions(+), 34 deletions(-) diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index ebf6b0d7..538b4a06 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) diff --git a/module-sdk/coinswap/go.sum b/module-sdk/coinswap/go.sum index 869f356b..f81feeb2 100644 --- a/module-sdk/coinswap/go.sum +++ b/module-sdk/coinswap/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/gov/go.mod b/module-sdk/gov/go.mod index fc778f3b..4ba9bcab 100644 --- a/module-sdk/gov/go.mod +++ b/module-sdk/gov/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 github.com/regen-network/cosmos-proto v0.3.1 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 diff --git a/module-sdk/gov/go.sum b/module-sdk/gov/go.sum index 40f5f630..ea9e19e3 100644 --- a/module-sdk/gov/go.sum +++ b/module-sdk/gov/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/htlc/go.mod b/module-sdk/htlc/go.mod index 110900d1..cb69f0c6 100644 --- a/module-sdk/htlc/go.mod +++ b/module-sdk/htlc/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) diff --git a/module-sdk/htlc/go.sum b/module-sdk/htlc/go.sum index 869f356b..f81feeb2 100644 --- a/module-sdk/htlc/go.sum +++ b/module-sdk/htlc/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index 2187ccf5..7f27e998 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/irisnet/coinswap-sdk-go v0.1.0 - github.com/irisnet/core-sdk-go v0.0.0-20210713083711-a3be069f0258 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 github.com/irisnet/gov-sdk-go v0.1.0 github.com/irisnet/htlc-sdk-go v0.1.0 github.com/irisnet/nft-sdk-go v0.1.0 diff --git a/module-sdk/integration_test/go.sum b/module-sdk/integration_test/go.sum index c8e02782..dbf9ca7f 100644 --- a/module-sdk/integration_test/go.sum +++ b/module-sdk/integration_test/go.sum @@ -252,9 +252,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= -github.com/irisnet/core-sdk-go v0.0.0-20210713083711-a3be069f0258 h1:IoJdAlVfUmxBNQa3xyTov1K8zdJU3tZavbcIxrPFdkQ= -github.com/irisnet/core-sdk-go v0.0.0-20210713083711-a3be069f0258/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/nft/go.mod b/module-sdk/nft/go.mod index 46a3994e..c50e6849 100644 --- a/module-sdk/nft/go.mod +++ b/module-sdk/nft/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) diff --git a/module-sdk/nft/go.sum b/module-sdk/nft/go.sum index 869f356b..f81feeb2 100644 --- a/module-sdk/nft/go.sum +++ b/module-sdk/nft/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 8c8e7a36..44f26f39 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 github.com/irisnet/service-sdk-go v0.1.0 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 diff --git a/module-sdk/oracle/go.sum b/module-sdk/oracle/go.sum index 869f356b..f81feeb2 100644 --- a/module-sdk/oracle/go.sum +++ b/module-sdk/oracle/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/random/go.mod b/module-sdk/random/go.mod index c2026172..c6f152d2 100644 --- a/module-sdk/random/go.mod +++ b/module-sdk/random/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) diff --git a/module-sdk/random/go.sum b/module-sdk/random/go.sum index 869f356b..f81feeb2 100644 --- a/module-sdk/random/go.sum +++ b/module-sdk/random/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/record/go.mod b/module-sdk/record/go.mod index 7a198074..4d4ed040 100644 --- a/module-sdk/record/go.mod +++ b/module-sdk/record/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 ) diff --git a/module-sdk/record/go.sum b/module-sdk/record/go.sum index 869f356b..f81feeb2 100644 --- a/module-sdk/record/go.sum +++ b/module-sdk/record/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/service/go.mod b/module-sdk/service/go.mod index f4d98228..3f1480d9 100644 --- a/module-sdk/service/go.mod +++ b/module-sdk/service/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 gopkg.in/yaml.v2 v2.3.0 diff --git a/module-sdk/service/go.sum b/module-sdk/service/go.sum index 869f356b..f81feeb2 100644 --- a/module-sdk/service/go.sum +++ b/module-sdk/service/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/staking/go.mod b/module-sdk/staking/go.mod index ddcda130..44b95038 100644 --- a/module-sdk/staking/go.mod +++ b/module-sdk/staking/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.4.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 github.com/regen-network/cosmos-proto v0.3.1 github.com/tendermint/tendermint v0.34.11 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 diff --git a/module-sdk/staking/go.sum b/module-sdk/staking/go.sum index 40f5f630..ea9e19e3 100644 --- a/module-sdk/staking/go.sum +++ b/module-sdk/staking/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= diff --git a/module-sdk/token/go.mod b/module-sdk/token/go.mod index 13161e29..7b855370 100644 --- a/module-sdk/token/go.mod +++ b/module-sdk/token/go.mod @@ -4,7 +4,7 @@ go 1.16 require ( github.com/gogo/protobuf v1.3.3 - github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 + github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 github.com/regen-network/cosmos-proto v0.3.1 google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4 google.golang.org/grpc v1.37.0 diff --git a/module-sdk/token/go.sum b/module-sdk/token/go.sum index 40f5f630..ea9e19e3 100644 --- a/module-sdk/token/go.sum +++ b/module-sdk/token/go.sum @@ -255,8 +255,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3 h1:xXYoM4SVaL43fdTaqmX+rkabvyq4v4KMk+wiwxmeeMw= -github.com/irisnet/core-sdk-go v0.0.0-20210712061654-e9201a163ea3/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908 h1:kqOFHunsQWx3LBnBheIZpb7oWiL7RHTMMowDFK2N8Tw= +github.com/irisnet/core-sdk-go v0.0.0-20210719031639-9c6ece68d908/go.mod h1:ODgRsJ1Vo+OQ9CENiYoMPJvXx5eTTAsbD4SG59hhnmM= 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/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= From e86f7bba5b55d8a48a2ae5c8ba65ff25213bb655 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 19 Jul 2021 14:30:14 +0800 Subject: [PATCH 40/41] fix go mod --- module-sdk/integration_test/go.mod | 20 ++++++++++---------- module-sdk/oracle/go.mod | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/module-sdk/integration_test/go.mod b/module-sdk/integration_test/go.mod index 7f27e998..9d6e82f2 100644 --- a/module-sdk/integration_test/go.mod +++ b/module-sdk/integration_test/go.mod @@ -21,15 +21,15 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/coinswap-sdk-go => ../../module-sdk/coinswap - github.com/irisnet/gov-sdk-go => ../../module-sdk/gov - github.com/irisnet/htlc-sdk-go => ../../module-sdk/htlc - github.com/irisnet/nft-sdk-go => ../../module-sdk/nft - github.com/irisnet/oracle-sdk-go => ../../module-sdk/oracle - github.com/irisnet/random-sdk-go => ../../module-sdk/random - github.com/irisnet/record-sdk-go => ../../module-sdk/record - github.com/irisnet/service-sdk-go => ../../module-sdk/service - github.com/irisnet/staking-sdk-go => ../../module-sdk/staking - github.com/irisnet/token-sdk-go => ../../module-sdk/token + github.com/irisnet/coinswap-sdk-go => ../coinswap + github.com/irisnet/gov-sdk-go => ../gov + github.com/irisnet/htlc-sdk-go => ../htlc + github.com/irisnet/nft-sdk-go => ../nft + github.com/irisnet/oracle-sdk-go => ../oracle + github.com/irisnet/random-sdk-go => ../random + github.com/irisnet/record-sdk-go => ../record + github.com/irisnet/service-sdk-go => ../service + github.com/irisnet/staking-sdk-go => ../staking + github.com/irisnet/token-sdk-go => ../token github.com/tendermint/tendermint => github.com/bianjieai/tendermint v0.34.1-irita-210113 ) diff --git a/module-sdk/oracle/go.mod b/module-sdk/oracle/go.mod index 44f26f39..f127c881 100644 --- a/module-sdk/oracle/go.mod +++ b/module-sdk/oracle/go.mod @@ -13,5 +13,5 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/irisnet/service-sdk-go => ../../module-sdk/service + github.com/irisnet/service-sdk-go => ../service ) From b5274315e1040e5ee9185f8fde306982efa38444 Mon Sep 17 00:00:00 2001 From: Nicke-lucky <13965882371@163.com> Date: Mon, 19 Jul 2021 16:10:19 +0800 Subject: [PATCH 41/41] fix go mod --- module-sdk/coinswap/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-sdk/coinswap/go.mod b/module-sdk/coinswap/go.mod index 538b4a06..fb547f0f 100644 --- a/module-sdk/coinswap/go.mod +++ b/module-sdk/coinswap/go.mod @@ -1,4 +1,4 @@ -module github.com/irisnet/irishub-sdk-go/module-sdk/coinswap +module github.com/irisnet/coinswap-sdk-go go 1.16